$(document).ready(function(){var d=$("#pubURL").val();if((d==null)||((d.length==1)&&(d.charAt(0)=="/"))){d=""}homePageFunctions(d);$(".navigation-tools ul li").mouseover(function(){$(this).toggleClass("hovered")}).mouseout(function(){$(this).toggleClass("hovered")});if($(".standard-table").length){$(".standard-table").each(function(){$(this).find("tr:first").addClass("header")})}if($("#country-legal").length){$("#country-legal-button").click(function(){var e=$("#country-legal").val();if(e>=1&&e<=6){window.location=d+"/utilities/legal/not_accessible.aspx"}else{if(e==7){window.location=d+"/utilities/legal/legal_info.aspx"}}})}if(jQuery.browser.opera){var p=$("#page-body").height();$(".wrap").css("height",p)}if($("#UseCommunicationTool").length){var f=$("select.substance");var k=$(f).next();var b=$("select.product");var l=$(b).next();var g=$("input.product");var a=$("input.prod-search");var i=$("#breadcrumb li");var h=$("#breadcrumb li:last");var q=$("input.substance");var n=$("input.search");var j=$("table.substance-search input:text");var o=$("table.substance-search textarea");$(".open-comment").click(function(){var r=$(this).attr("id");r="comment_"+r.substring(r.indexOf("_")+1);var e=document.getElementById(r);if($(this).hasClass("opened")){$(e).slideUp();$(this).toggleClass("opened")}else{$(e).slideDown();$(this).toggleClass("opened")}});$(f).change(function(){if($(this).get(0).selectedIndex>0){if($(q).hasClass("disabled")){$(q).toggleClass("disabled")}if($(k).hasClass("mandatory")){$(k).removeClass("mandatory");$(k).hide()}$(q).removeAttr("disabled")}else{$(q).val("");$(q).addClass("disabled");$(q).attr("disabled","disabled");$(n).attr("disabled","disabled");$(k).addClass("mandatory");$(k).show()}$(j).each(function(){$(this).val("")});$(o).val("");$(q).val("Type substance name here");$(q).select()});$(b).change(function(){if($(this).get(0).selectedIndex>0){if($(g).hasClass("disabled")){$(g).toggleClass("disabled")}if($(l).hasClass("mandatory")){$(l).removeClass("mandatory");$(l).hide()}$(g).removeAttr("disabled");$(a).removeAttr("disabled")}else{$(g).val("");$(g).toggleClass("disabled");$(g).attr("disabled","disabled");$(a).attr("disabled","disabled");$(g).val("");$(l).addClass("mandatory");$(l).show()}});$(g).focus(function(){$(this).select()});$(g).blur(function(){if($(this).val()==""){$(this).val("Type substance name here")}})}carousal();carousal1();carouselWide();carouselNarrow();carouselOne();localSites(d);backToTop();$("#searchQuery :text").focus(function(){$(this).val("")});$("#SearchTxt :text").focus(function(){$(this).val("")});$("#access-navigation > li:first").addClass("first");$("#access-navigation >li:last").addClass("last");$("#access-navigation li.current:first").prev().children().addClass("noUnderline");$("#access-navigation li").hover(function(){$(this).prev().children().addClass("hideUnderline")},function(){$(this).prev().children().removeClass("hideUnderline")});tabnavs();ipf_tabnavs();newsBox_tabnavs();boxhover();zebra("#events-calendar-table");ourRegions();print_page();createEmailForm(d);emailThisPage();tableRowHover();loadFontSize();fontSizeChanger();if(sIFR.bIsDisabled==false){doSifrReplacements(d)}try{$("#QsearchQuery").keyup(function(r){if(r.keyCode==13){ExecuteSearch()}})}catch(m){}if($("#smallNav").length){smallNavJuggler("#smallNavOption","#firstLevelNav");$("#backToPrevPage").click(function(){history.go(-1)})}$("a:contains('Closing global gaps'), img[alt='Closing global gaps']").click(function(){var s=$(".wrapper");if(s.length){s.show()}else{$.ajax({url:"/campaigns/global_gaps/index.aspx",cache:true,dataType:"html",beforeSend:function(){$("<link>").appendTo($("head")).attr({type:"text/css",rel:"stylesheet"}).attr("href","/campaigns/global_gaps/css/styles.css");$("<link>").appendTo($("head")).attr({type:"text/css",rel:"stylesheet"}).attr("href","/campaigns/global_gaps/css/hotspots.css")},success:function(u){var t=$(u);$("<div>").addClass("wrapper").html($(".whiteContainer",t)).appendTo($("body"));$.getScript("/campaigns/global_gaps/js/webmodel.js")},complete:function(){var t=$(document).height();$(".wrapper").css("height",t)}})}var e=new WebTrends();e.dcsGetId();var r=document.title;if($(this).parent().parent().parent().attr("id")=="report"){r+=" (Menu)"}else{r+=" (Banner)"}e.WT.ti=r;e.WT.ac="Global Gaps";e.dcsCollect();return false});$("li.yara-channel a").click(function(){var e=new WebTrends();e.dcsGetId();var s=document.title;var r="Yara Channel";if($(this).parent().parent().parent().attr("id")=="in-site-links"){r+=" (Menu)"}else{r+=" (Footer)"}e.WT.ti=s;e.WT.ac=r;e.dcsCollect()});$("li.yara-linkedin a").click(function(){var e=new WebTrends();e.dcsGetId();var s=document.title;var r="Yara on LinkedIn";if($(this).parent().parent().parent().attr("id")=="in-site-links"){r+=" (Menu)"}else{r+=" (Footer)"}e.WT.ti=s;e.WT.ac=r;e.dcsCollect()});$("#report.sidelet a").click(function(){var e=new WebTrends();e.dcsGetId();var s=document.title;var r="Menu Banner ("+$(this).siblings(":last").val()+")";e.WT.ti=s;e.WT.ac=r;e.dcsCollect()});$("table.expandable tr.expand td").click(function(){var e=$(this).parent();var r=e.next();if(e.hasClass("expand")){e.removeClass("expand").addClass("collapse");while(r.length>0&&!(r.hasClass("expand")||r.hasClass("collapse"))){r.show();r=r.next()}}else{if(e.hasClass("collapse")){e.removeClass("collapse").addClass("expand");while(r.length>0&&!(r.hasClass("expand")||r.hasClass("collapse"))){r.hide();r=r.next()}}}})});var smallNavJuggler=function(a,b){$(a).mouseover(function(){$(b).show();$(a).addClass("active")});$(a).mouseout(function(){$(b).hide();$(a).removeClass("active")});$(a).click(function(){})};$.fn.wait=function(b,a){b=b||1000;a=a||"fx";return this.queue(a,function(){var d=this;setTimeout(function(){$(d).dequeue()},b)})};var backToTop=function(){if($("#content-area").innerHeight()>$(window).height()){$(".back-to-top").show()}};var createEmailForm=function(a){$("#page-body").append('<div id="emailThisPageForm"><div class="closeForm"><a href="#" id="emailCloseButton">Close X</a></div><iframe id="emailFormPage" src="'+a+'/utilities/email.aspx" border="0" width="310px" height="450px" frameborder="0" scrolling="no"></iframe></div>')};var emailThisPage=function(){$("#utilities li.email a").click(function(){if($("#emailThisPageForm").is(":hidden")){$("#emailThisPageForm").slideDown("slow")}else{$("#emailThisPageForm").hide()}return false});$("#emailThisPageForm .closeForm a").click(function(){closeEmailThisPageForm();return false})};var closeEmailThisPageForm=function(){if($("#emailThisPageForm").is(":visible")){$("#emailThisPageForm").slideUp("slow")}};var tableRowHover=function(){$("table:not(.documents) tr").hover(function(){$(this).addClass("hovered-row")},function(){$(this).removeClass("hovered-row")})};var ourRegions=function(){if($("#where-we-operate").length){$("#where-we-operate .region .link").click(function(){$("#where-we-operate li.on").removeClass("on");$("#where-we-operate li.region").removeAttr("style");$(this).parent().addClass("on").css("z-index","99");var a=$("#where-we-operate .on div.sites-in-region").height();a=Math.floor(a/2)*-1;a=a+7;c=a-15;a=a+"px";c=c+"px";$("#where-we-operate .on div.sites-in-region").css("top",a);$("#where-we-operate .on .close-button").css("top",c);return false});$("#where-we-operate .close-button").click(function(){$("#where-we-operate li.on").removeClass("on");$("#where-we-operate li.region").removeAttr("style");return false})}};var zebra=function(b){var a="'"+b+" tr:odd'";$("#events-calendar-table tr:odd").addClass("highlighted");a=null};var homePageFunctions=function(a){var b=$("#home-page").length;if(b){$("#access-navigation > li").each(function(d){d+=2;flyerMaker("#home-menu-"+d,"#flyer-"+d);menuJuggler("#home-menu-"+d,"#flyer-"+d,a)})}if(b&&$("#country-home").length==0){insertHomeFlash(a)}};var newsBox_tabnavs=function(){if($("#news-box").length){var b=$("#news-box .latest");var a=$("#news-box .most-read");$("#news-box #tab-latest").click(function(){b.show();a.hide();$(this).addClass("current");$("#news-box #tab-most-read").removeClass("current");return false});$("#news-box #tab-most-read").click(function(){b.hide();a.show();$(this).addClass("current");$("#news-box #tab-latest").removeClass("current");return false})}};var ipf_tabnavs=function(){if($(".industrial-product-finder").length){var b=$(".ipf-search-box");var d=$(".ipf-markets-list");var a=$(".ipf-a2z-list");$("#tab-ipf-search").click(function(){b.show();$(this).addClass("current");d.hide();$("#tab-ipf-market").removeClass("current");a.hide();$("#tab-ipf-a2z").removeClass("current");return false});$("#tab-ipf-market").click(function(){b.hide();$("#tab-ipf-search").removeClass("current");d.show();$(this).addClass("current");a.hide();$("#tab-ipf-a2z").removeClass("current");return false});$("#tab-ipf-a2z").click(function(){b.hide();$("#tab-ipf-search").removeClass("current");d.hide();$("#tab-ipf-market").removeClass("current");a.show();$(this).addClass("current");return false})}};var tabnavs=function(){var b=$(".search-box");var a=$(".tags-cloud");var d=$(".popular");$("#tab-search").click(function(){b.show();$(this).addClass("current");d.hide();$("#tab-popular").removeClass("current");a.hide();$("#tab-cloud").removeClass("current");return false});$("#tab-popular").click(function(){b.hide();$("#tab-search").removeClass("current");d.show();$(this).addClass("current");a.hide();$("#tab-cloud").removeClass("current");return false});$("#tab-cloud").click(function(){b.hide();$("#tab-search").removeClass("current");d.hide();$("#tab-popular").removeClass("current");a.show();$(this).addClass("current");return false})};var insertHomeFlash=function(b){var a={};var e={WMODE:"opaque"};var d={};swfobject.embedSWF(b+"/swf/yara.swf","flash-wallpaper","987","545","8.0.0","false",a,e,d);swfobject.addDomLoadEvent(function(){var f=document.getElementById("flash-wallpaper");if(f&&f.nodeName==="OBJECT"){$("html").addClass("has_HF")}else{$("html").addClass("no_HF")}})};var localSitesShow=false;var localSites=function(a){var e=$("#breadcrumb");var d=e.html();var b=e.children("div:first").html();$("#yara-local-websites .c-button").click(function(){if(localSitesShow==false){e.html(b);$("#local-sites").show();var f=$("#local-sites h4 object").length;if(sIFR.bIsDisabled==false&&f<1){sIFR.replaceElement(named({sSelector:"#local-sites h4",sFlashSrc:a+"/swf/yaramax_regular_latin1.swf",sColor:"#ffffff;",sBgColor:"#658d2d",nPaddingTop:0,nPaddingBottom:0,nMarginTop:-15,sFlashVars:"textalign=left&offsetTop=0"}))}f=null;if($.browser.msie){$("#content select").css("visibility","hidden")}localSitesShow=true}else{e.html(d);$("#local-sites").hide();if($.browser.msie){$("#content select").css("visibility","visible")}localSitesShow=false}});$("#local-sites").mouseout(function(f){if(localSitesShow&&!IsWithinLocalSites(f)){e.html(d);$("#local-sites").hide();if($.browser.msie){$("#content select").css("visibility","visible")}localSitesShow=false}})};function IsWithinLocalSites(d){var b=$("#local-sites").width();var a=$("#local-sites").height();var f=$("#local-sites").offset();if(d.pageX>f.left&&d.pageX<(f.left+b)&&d.pageY>f.top&&d.pageY<(f.top+a)){return true}return false}$.fn.hoverIntent=function(k,j){var l={sensitivity:7,interval:50,timeout:200};l=$.extend(l,j?{over:k,out:j}:k);var n,m,h,d;var e=function(f){n=f.pageX;m=f.pageY};var b=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-n)+Math.abs(d-m))<l.sensitivity){$(f).unbind("mousemove",e);f.hoverIntent_s=1;return l.over.apply(f,[g])}else{h=n;d=m;f.hoverIntent_t=setTimeout(function(){b(g,f)},l.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return l.out.apply(f,[g])};var a=function(s){var r=(s.type=="mouseover"?s.fromElement:s.toElement)||s.relatedTarget;while(r&&r!=this){try{r=r.parentNode}catch(s){r=this}}if(r==this){return false}var q=jQuery.extend({},s);var f=this;if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(s.type=="mouseover"){h=q.pageX;d=q.pageY;$(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){b(q,f)},l.interval)}if($(".has_HF").length){var g=document.getElementById("flash-wallpaper");if(g){try{g.overlayEnDis(true)}catch(o){}}g=null}}else{$(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(q,f)},l.timeout)}if($(".has_HF").length){var g=document.getElementById("flash-wallpaper");if(g){try{g.overlayEnDis(false)}catch(o){}}g=null}}};return this.mouseover(a).mouseout(a)};var menuJuggler=function(b,d,a){$(b).hoverIntent(function(){$(d).show();$(this).addClass("current");if(sIFR.bIsDisabled==false){var e=d+" h2";sIFR.replaceElement(named({sSelector:e,sFlashSrc:a+"/swf/yaramax_regular_latin1.swf",sColor:"#ffffff;",sBgColor:"#658d2d",nPaddingTop:0,nPaddingBottom:0,nMarginTop:-150,sFlashVars:"textalign=leftoffsetTop=0",sWmode:"opaque"}))}},function(){$(d).hide();$(this).removeClass("current")})};var flyerMaker=function(b,e){var d="#home-page "+b;if($(d)){var a=$(e).clone();$(e).remove();a.appendTo(b)}};var applyOverlay=function(a){$(a).prepend('<div id="overlay" />');$(a).css({position:"relative"});$("#overlay").css({width:"100%",height:"100%","z-index":"3",position:"absolute",top:"0",left:"0","background-color":"#000"});if($.browser.msie){$("#overlay").css({filter:"alpha(opacity=80)"})}else{if($.browser.mozilla){$("#overlay").css({"-moz-opacity":".80"})}else{$("#overlay").css({opacity:".80"})}}};var removeOverlay=function(a){$("#overlay").remove()};function openLocation(a){if($(a).prev().get(0).selectedIndex>0){location.href=$(a).prev().val()}}var carousal=function(){if($(".normalcarousal").length){$(".normalcarousal").each(function(){var b=0;var a=3;var g=1;var f=$(".slider-belt li",this).length;var h=(140*f)+"px";var e=$(".slider-belt",this);var d=$(".status-counter",this);$(e).css("width",h);var i=getActiveBox(this);if(i>a){$(e).css({left:(-140*(i-a))+"px"});g=g*i-2}if(f>=a){$(d).html(" "+g+"-"+(g+2)+" of "+f)}else{$(d).html(" "+g+"-"+f+" of "+f)}if(f>a){$(".next",this).click(function(){if(g<(f-a+1)){$(e).animate({left:"-=140px"},"medium");g++;$(d).html(" "+g+"-"+(g+2)+" of "+f)}else{}});$(".previous",this).click(function(){if(g>1){$(e).animate({left:"+=140px"},"medium");g--;$(d).html(" "+g+"-"+(g+2)+" of "+f)}})}})}};var carouselWide=function(){if($("#carousel.wide").length){var d=0;var b=0;var a=3;var e=1;d=$(".slider-belt li").length;var f=(225*d)+"px";$(".slider-belt").css("width",f);if(d>a){$(".next").click(function(){if(e<(d-a+1)){$(".slider-belt").animate({left:"-=225px"},"medium");e++}else{}});$(".previous").click(function(){if(e>1){$(".slider-belt").animate({left:"+=225px"},"medium");e--}})}}};var carouselNarrow=function(){if($("#carousel.narrow").length){var d=0;var b=0;var a=3;var e=1;d=$(".slider-belt li").length;var f=(225*d)+"px";$(".slider-belt").css("width",f);if(d>a){$(".next").click(function(){if(e<(d-a+1)){$(".slider-belt").animate({left:"-=225px"},"medium");e++}else{}});$(".previous").click(function(){if(e>1){$(".slider-belt").animate({left:"+=225px"},"medium");e--}})}}};var carouselOne=function(){if($(".carousel-one").length){var d=0;var b=0;var a=1;var e=1;d=$(".slider-belt .carousel-box").length;var f=(470*d)+"px";$(".slider-belt").css("width",f);if(d>a){$(".next-arrow").click(function(){if(e<(d-a+1)){$(".slider-belt").animate({left:"-=470px"},"medium");e++}else{}});$(".previous-arrow").click(function(){if(e>1){$(".slider-belt").animate({left:"+=470px"},"medium");e--}})}}};function getActiveBox(a){$("#viewframe",a).find("li").each(function(b){if($(this).attr("class")=="current"){return b+1}})}var carousal1=function(){if($("#carousal.wide").length){var d=0;var b=0;var a=3;var e=1;if($("#carousal").length){d=$(".slider-belt li").length;var f=(213*d)+"px";$(".slider-belt").css("width",f);$(".status-counter").html(" "+e+"-"+(e+2)+" of "+d);if(d>a){$(".next").click(function(){if(e<(d-a+1)){$(".slider-belt").animate({left:"-=213px"},"medium");e++;$(".status-counter").html(" "+e+"-"+(e+2)+" of "+d)}else{}});$(".previous").click(function(){if(e>1){$(".slider-belt").animate({left:"+=213px"},"medium");e--;$(".status-counter").html(" "+e+"-"+(e+2)+" of "+d)}})}}}};var boxhover=function(){$(".box .box-text").hover(function(){$(this).addClass("hovered")},function(){$(this).removeClass("hovered")})};var print_page=function(){$("#utilities .print").click(function(){platform=navigator.platform;platform=platform.toLowerCase();var d=platform.indexOf("mac");var a=(navigator.appName=="Netscape");var b=parseInt(navigator.appVersion);if(navigator.appVersion.indexOf("Win")!=-1){window.print()}else{if(d){alert("You will have to use the print command from the file menu\n")}else{if(a){window.print()}else{if((b>3)&&(d<0)){var e='<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';document.body.insertAdjacentHTML("beforeEnd",e);WebBrowser1.ExecWB(6,1)}else{alert("You will have to use the print command from the file menu\n")}}}}return false})};function loadFontSize(){var a;a=readCookie("yaraFontSize");if(a==null){a=0}setFontSize(a)}var fontSizeChanger=function(){$("#footer .text-resize a.x").click(function(){setFontSize(0);createCookie("yaraFontSize",0);return false});$("#footer .text-resize a.xl").click(function(){setFontSize(1);createCookie("yaraFontSize",1);return false});$("#footer .text-resize a.xxl").click(function(){setFontSize(2);createCookie("yaraFontSize",2);return false})};var setFontSize=function(a){switch(a){case 0:case"0":$("body").removeClass("zx zxl zxxl");$("body").addClass("zx");$(".text-resize *").removeClass("current");$(".text-resize .x").addClass("current");break;case 1:case"1":$("body").removeClass("zx zxl zxxl");$("body").addClass("zxl");$(".text-resize *").removeClass("current");$(".text-resize .xl").addClass("current");break;case 2:case"2":$("body").removeClass("zx zxl zxxl");$("body").addClass("zxxl");$(".text-resize *").removeClass("current");$(".text-resize .xxl").addClass("current");break}};function createCookie(d,e,f){if(f){var b=new Date();b.setTime(b.getTime()+(f*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=d+"="+e+a+"; path=/"}function readCookie(b){var e=b+"=";var a=document.cookie.split(";");for(var d=0;d<a.length;d++){var f=a[d];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(e)==0){return f.substring(e.length,f.length)}}return null}function eraseCookie(a){createCookie(a,"",-1)}var doSifrReplacements=function(a){if(typeof sIFR=="function"){sIFR.replaceElement(named({sSelector:"h1.content-title, h2.content-title, .member-details h3.name",sFlashSrc:a+"/swf/yaramax_regular_latin1.swf",sColor:"#484848",sLinkColor:"#484848",sBgColor:"#FFFFFF",sHoverColor:"#484848",nPaddingTop:0,nPaddingBottom:0,sFlashVars:"textalign=left&offsetTop=0",sWmode:"opaque"}));sIFR.replaceElement(named({sSelector:".quote p",sFlashSrc:a+"/swf/yaramax_regular_latin1.swf",sColor:"#457900;",sLinkColor:"#457900;",sBgColor:"#FFFFFF",sHoverColor:"#457900;",nPaddingTop:0,nPaddingBottom:0,sFlashVars:"textalign=right&offsetTop=0",sWmode:"opaque"}));sIFR.replaceElement(named({sSelector:".head-line",sFlashSrc:a+"/swf/yaramax_regular_latin1.swf",sColor:"#ffffff;",sLinkColor:"#ffffff;",sHoverColor:"#ffffff;",nPaddingTop:0,nPaddingBottom:0,sFlashVars:"textalign=right&offsetTop=0",sWmode:"transparent",kerning:"true"}));sIFR.replaceElement(named({sSelector:".sub-head-line",sFlashSrc:a+"/swf/yaramax_regular_latin1.swf",sColor:"#ffffff;",sLinkColor:"#ffffff;",sHoverColor:"#ffffff;",nPaddingTop:0,nPaddingBottom:0,sFlashVars:"textalign=right&offsetTop=0",sWmode:"transparent",kerning:"true"}));sIFR.replaceElement(named({sSelector:".carousel-one .info p.header",sFlashSrc:a+"/swf/yaramax_regular_latin1.swf",sColor:"#ffffff;",sLinkColor:"#ffffff;",sHoverColor:"#ffffff;",nPaddingTop:0,nPaddingBottom:0,sFlashVars:"textalign=left&offsetTop=0",sWmode:"transparent",kerning:"true"}))}};function AutoSuggestControl(b,a){this.cur=-1;this.layer=null;this.provider=a;this.textbox=b;this.init()}AutoSuggestControl.prototype.autosuggest=function(b,a){if(b.length>0){if(a){this.typeAhead(b[0])}this.showSuggestions(b)}else{this.hideSuggestions()}};AutoSuggestControl.prototype.createDropDown=function(){var a=this;this.layer=document.createElement("div");this.layer.className="suggestions";this.layer.style.visibility="hidden";this.layer.style.width=this.textbox.offsetWidth;this.layer.onmousedown=this.layer.onmouseup=this.layer.onmouseover=function(b){b=b||window.event;oTarget=b.target||b.srcElement;if(b.type=="mousedown"){a.textbox.value=oTarget.firstChild.nodeValue;a.hideSuggestions();submitForm()}else{if(b.type=="mouseover"){a.highlightSuggestion(oTarget)}else{a.textbox.focus()}}};document.body.appendChild(this.layer)};AutoSuggestControl.prototype.getLeft=function(){var b=this.textbox;var a=0;while(b.offsetParent!=null&&b.tagName!="BODY"){a+=b.offsetLeft;b=b.offsetParent}return a};AutoSuggestControl.prototype.getTop=function(){var b=this.textbox;var a=0;while(b.offsetParent!=null&&b.tagName!="BODY"){a+=b.offsetTop;b=b.offsetParent}return a};AutoSuggestControl.prototype.handleKeyDown=function(a){switch(a.keyCode){case 38:this.previousSuggestion();break;case 40:this.nextSuggestion();break;case 13:if(this.cur==-1&&this.layer.childNodes.length>0){this.textbox.value=this.layer.childNodes[0].firstChild.nodeValue}submitForm();break}};AutoSuggestControl.prototype.handleKeyUp=function(a){var b=a.keyCode;if(b==8||b==46){this.provider.requestSuggestions(this,false);this.cur=-1}else{if(b<32||(b>=33&&b<46)||(b>=112&&b<=123)){}else{this.provider.requestSuggestions(this,false);this.cur=-1}}};AutoSuggestControl.prototype.hideSuggestions=function(){this.layer.style.visibility="hidden"};AutoSuggestControl.prototype.highlightSuggestion=function(a){for(var b=0;b<this.layer.childNodes.length;b++){var d=this.layer.childNodes[b];if(d==a){d.className="current"}else{if(d.className=="current"){d.className=""}}}};AutoSuggestControl.prototype.init=function(){var a=this;this.textbox.onkeyup=function(b){if(!b){b=window.event}a.handleKeyUp(b)};this.textbox.onkeydown=function(b){if(!b){b=window.event}a.handleKeyDown(b)};this.textbox.onblur=function(){a.hideSuggestions()};this.createDropDown()};AutoSuggestControl.prototype.nextSuggestion=function(){var b=this.layer.childNodes;if(b.length>0&&this.cur<b.length-1){var a=b[++this.cur];this.highlightSuggestion(a);this.textbox.value=a.firstChild.nodeValue}};AutoSuggestControl.prototype.previousSuggestion=function(){var b=this.layer.childNodes;if(b.length>0&&this.cur>0){var a=b[--this.cur];this.highlightSuggestion(a);this.textbox.value=a.firstChild.nodeValue}};AutoSuggestControl.prototype.selectRange=function(a,b){if(this.textbox.createTextRange){var d=this.textbox.createTextRange();d.moveStart("character",a);d.moveEnd("character",b-this.textbox.value.length);d.select()}else{if(this.textbox.setSelectionRange){this.textbox.setSelectionRange(a,b)}}this.textbox.focus()};AutoSuggestControl.prototype.showSuggestions=function(d){var a=null;this.layer.innerHTML="";for(var b=0;b<d.length;b++){a=document.createElement("div");a.appendChild(document.createTextNode(d[b]));this.layer.appendChild(a)}this.layer.style.left=this.getLeft()+"px";this.layer.style.top=(this.getTop()+this.textbox.offsetHeight)+"px";this.layer.style.visibility="visible";this.layer.style.width=this.textbox.offsetWidth};AutoSuggestControl.prototype.typeAhead=function(b){if(this.textbox.createTextRange||this.textbox.setSelectionRange){var a=this.textbox.value.length;this.textbox.value=b;this.selectRange(a,b.length)}};function SubstanceSuggestions(){}SubstanceSuggestions.prototype.requestSuggestions=function(g,e){var d=[];var f=g.textbox.value;if(f.length>0){var b=1;for(var a=0;a<this.states.length;a++){if(this.states[a].toLowerCase().indexOf(f.toLowerCase())>=0){d.push(this.states[a]);b++;if(b==10){break}}}}g.autosuggest(d,e)};var cX=0;var cY=0;var rX=0;var rY=0;function UpdateCursorPosition(a){cX=a.pageX;cY=a.pageY}function UpdateCursorPositionDocAll(a){cX=event.clientX;cY=event.clientY}if(document.all){document.onmousemove=UpdateCursorPositionDocAll}else{document.onmousemove=UpdateCursorPosition}function AssignPosition(f){if(self.pageYOffset){rX=self.pageXOffset;rY=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){rX=document.documentElement.scrollLeft;rY=document.documentElement.scrollTop}else{if(document.body){rX=document.body.scrollLeft;rY=document.body.scrollTop}}}if(document.all){cX+=rX;cY+=rY}var e=document.getElementById("primary-content");var b=0;while(e.offsetParent!=null&&e.tagName!="BODY"){b+=e.offsetLeft;e=e.offsetParent}var e=document.getElementById("primary-content");var a=0;while(e.offsetParent!=null&&e.tagName!="BODY"){a+=e.offsetTop;e=e.offsetParent}f.style.left=(cX-75-b)+"px";f.style.top=(cY+10-a)+"px"}function HideContent(a){if(a.length<1){return}document.getElementById(a).style.display="none"}function ShowContent(b){if(b.length<1){return}var a=document.getElementById(b);AssignPosition(a);a.style.display="block"}function ReverseContentDisplay(b){if(b.length<1){return}var a=document.getElementById(b);AssignPosition(a);if(a.style.display=="none"){a.style.display="block"}else{a.style.display="none"}};
