function limitText(a,b,c){var d=document.getElementById(a);var e=document.getElementById(b);if(d.value.length>c){d.value=d.value.substring(0,c)}else{e.value=c-d.value.length}}function fnCheckItValid(){var a=document.getElementById("divEmailFriend1").getElementsByTagName("input"),b=true;if(a){for(i=0;i<a.length;i++){if(a[i].id.indexOf("txtYourName")>=0){if(fnCheckIt(a[i].id,"divYourName",true)==false){b=false}}else if(a[i].id.indexOf("txtYourEmail")>=0){if(fnCheckIt(a[i].id,"divYourEmail",true)==false){b=false}}else if(a[i].id.indexOf("txtFriendsName")>=0){if(fnCheckIt(a[i].id,"divFriendsName",true)==false){b=false}}else if(a[i].id.indexOf("txtFriendsEmail")>=0){if(fnCheckIt(a[i].id,"divFriendsEmail",true)==false){b=false}}else{}}return b}}function fn_input_warning(a,b,c,d,e,f){b.style.display="block";b.className="CheckIt_icon icon_warning";c.innerHTML="* ";d.style.display="block";e.innerHTML=f;e.style.color="#CC0000";a.style.backgroundColor="#FFE0D2"}function fn_input_pending(a,b,c,d,e,f){b.style.display="block";b.className="CheckIt_icon icon_pending";c.innerHTML="* ";d.style.display="block";e.innerHTML=f;a.style.backgroundColor="#FFF0D2"}function fn_input_ok(a,b,c,d,e){b.style.display="block";b.className="CheckIt_icon icon_ok";c.innerHTML="  ";d.style.display="none";e.innerHTML="";a.style.backgroundColor="#F1FFD2"}function fnCheckIt(a,b,c){if(document.getElementById(a)){var d=document.getElementById(a);if(document.getElementById(b+"-icon")){var e=document.getElementById(b+"-icon")}if(document.getElementById(b+"-star")){var f=document.getElementById(b+"-star")}if(document.getElementById(b+"-helpbox")){var g=document.getElementById(b+"-helpbox")}if(document.getElementById(b+"-helptxt")){var h=document.getElementById(b+"-helptxt")}if(d.value==null||d.value==""){var i="This is a required field";if(c==true){fn_input_warning(d,e,f,g,h,i);return false}else{fn_input_pending(d,e,f,g,h,i)}}else if(b.toLowerCase().indexOf("email")>=0){var j=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;if(j.test(d.value)){fn_input_ok(d,e,f,g,h)}else{var i="Please enter a valid email address";if(c==true){fn_input_warning(d,e,f,g,h,i);return false}else{fn_input_pending(d,e,f,g,h,i)}}}else{if(c==true){return true}else{fn_input_ok(d,e,f,g,h)}}}}function fnCheckEmailMessage(){if(document.URL.toLowerCase().indexOf("emailpage=")>=0){document.getElementById("EmailBox1").style.display="block"}}function fnShowPageOptions(){document.getElementById("divSocialMedia").style.display="block"}function fnBookmarkThis(){if(window.sidebar){window.sidebar.addPanel(document.title,document.URL,"");return false}else if(document.all){window.external.AddFavorite(document.URL,document.title);return false}else{return true}}function fnBubbleToggle(a){var b=document.getElementById(a).style.display;if(b=="block"){document.getElementById(a).style.display="none"}else{document.getElementById(a).style.display="block"}return false}function fnAssignFooterBehaviours(){d.getElementById("imgFooterMap").setAttribute("width","208");d.getElementById("imgFooterMap").setAttribute("height","171");var a=["BDC","MHC","RBC","COW","WFC","WDC","WCC"];var b=null;b=fnGetEle("areaFooterMap"+a[0]);b.onmouseover=function(){fnFooterMapImageSwap(a[0]);fnFooterAnchorClassUpdate(a[0],"whubLinkHover")};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc");fnFooterAnchorClassUpdate(a[0],"")};b.onblur=b.onmouseout;b=fnGetEle("areaFooterMap"+a[1]);b.onmouseover=function(){fnFooterMapImageSwap(a[1]);fnFooterAnchorClassUpdate(a[1],"whubLinkHover")};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc");fnFooterAnchorClassUpdate(a[1],"")};b.onblur=b.onmouseout;b=fnGetEle("areaFooterMap"+a[2]);b.onmouseover=function(){fnFooterMapImageSwap(a[2]);fnFooterAnchorClassUpdate(a[2],"whubLinkHover")};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc");fnFooterAnchorClassUpdate(a[2],"")};b.onblur=b.onmouseout;b=fnGetEle("areaFooterMap"+a[3]);b.onmouseover=function(){fnFooterMapImageSwap(a[3]);fnFooterAnchorClassUpdate(a[3],"whubLinkHover")};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc");fnFooterAnchorClassUpdate(a[3],"")};b.onblur=b.onmouseout;b=fnGetEle("areaFooterMap"+a[4]);b.onmouseover=function(){fnFooterMapImageSwap(a[4]);fnFooterAnchorClassUpdate(a[4],"whubLinkHover")};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc");fnFooterAnchorClassUpdate(a[4],"")};b.onblur=b.onmouseout;b=fnGetEle("areaFooterMap"+a[5]);b.onmouseover=function(){fnFooterMapImageSwap(a[5]);fnFooterAnchorClassUpdate(a[5],"whubLinkHover")};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc");fnFooterAnchorClassUpdate(a[5],"")};b.onblur=b.onmouseout;b=fnGetEle("areaFooterMap"+a[6]);if(b){b.onmouseover=function(){fnFooterMapImageSwap(a[6]+"-rollover");fnFooterAnchorClassUpdate(a[6],"whubLinkHover")};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc");fnFooterAnchorClassUpdate(a[6],"")};b.onblur=b.onmouseout}b=fnGetEle("ancFooterLink"+a[0]);b.onmouseover=function(){fnFooterMapImageSwap(a[0])};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc")};b.onblur=b.onmouseout;b=fnGetEle("ancFooterLink"+a[1]);b.onmouseover=function(){fnFooterMapImageSwap(a[1])};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc")};b.onblur=b.onmouseout;b=fnGetEle("ancFooterLink"+a[2]);b.onmouseover=function(){fnFooterMapImageSwap(a[2])};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc")};b.onblur=b.onmouseout;b=fnGetEle("ancFooterLink"+a[3]);b.onmouseover=function(){fnFooterMapImageSwap(a[3])};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc")};b.onblur=b.onmouseout;b=fnGetEle("ancFooterLink"+a[4]);b.onmouseover=function(){fnFooterMapImageSwap(a[4])};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc")};b.onblur=b.onmouseout;b=fnGetEle("ancFooterLink"+a[5]);b.onmouseover=function(){fnFooterMapImageSwap(a[5])};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc")};b.onblur=b.onmouseout;b=fnGetEle("ancFooterLink"+a[6]);if(b){b.onmouseover=function(){fnFooterMapImageSwap(a[6]+"-rollover")};b.onfocus=b.onmouseover;b.onmouseout=function(){fnFooterMapImageSwap("wcc")};b.onblur=b.onmouseout}}function fnFooterAnchorClassUpdate(a,b){fnUpdateClass("ancFooterLink{0}".replace("{0}",a),b)}function fnFooterMapImageSwap(a){fnUpdateImageSrc("imgFooterMap",fnGetBaseUrl()+"templates/default/images/common/map-footer-{0}.gif".replace("{0}",a.toLowerCase()))}function fnTidyIndexServerSearch(){var a=false;var b=false;if(d.getElementById("Template_ctl15_ctl00_searchTerms").value!="search keywords here"){a=true}var c=d.getElementsByTagName("select");for(i=0;i<c.length;i++){if(c[i].id.indexOf("searchTypes")>-1){for(j=0;j<c[i].options.length;j++){if(c[i].options[j].innerHTML=="HTML"){c[i].options[j].innerHTML="Web Pages"}if(j>0&&c[i].options[j].selected){b=true}}for(k=0;k<c[i].options.length;k++){if(c[i].options[k].innerHTML=="Web Pages"&&!b){c[i].options[k].selected=true}}}}}function fnTidyForm(){var a=d.getElementsByTagName("table");for(i=0;i<a.length;i++){if(a[i].className=="tbform"){var b=a[i].getElementsByTagName("input");for(j=0;j<b.length;j++){if(b[j].type=="text"){b[j].onfocus=fnGetInputControlFocusOnFunction()}}var c=a[i].getElementsByTagName("textarea");for(k=0;k<c.length;k++){c[k].onfocus=fnGetInputControlFocusOnFunction()}}}}function fnGetInputControlFocusOnFunction(){return function(){this.select()}}function fnTidyPoll(){arrTbls=d.body.getElementsByTagName("table");for(var a=0;a<arrTbls.length;a++){if(arrTbls[a].id.indexOf("ctl00_userpoll")>-1&&arrTbls[a].id.indexOf("_tbl")>-1){arrTbls[a].style.width="300px";arrTbls[a].style.padding="5px";arrTbls[a].style.border="0px solid #cccccc";var b=arrTbls[a].getElementsByTagName("table");for(var c=0;c<b.length;c++){if(b[c].summary==="Answers"){b[c].style.width="300px"}else{b[c].style.border="1px solid #000000";b[c].style.height="15px";b[c].style.width="200px";b[c].style.backgroundColor="#ffffff"}}}}}function whubTabContainer(a,b){this.id=a;this.activeTab=b;this.selectTab=function(a){var b=document.getElementById("liTabs"+this.id+"-Tab"+this.activeTab),c=document.getElementById("divTabs"+this.id+"-Tab"+this.activeTab),d=document.getElementById("liTabs"+this.id+"-Tab"+a),e=document.getElementById("divTabs"+this.id+"-Tab"+a);if(b.className.indexOf(" selected")>-1){b.className=b.className.substring(0,b.className.indexOf(" selected"))}if(d.className.indexOf(" selected")<0){d.className=d.className+" selected"}if(c.className.indexOf(" selected")>-1){c.className=c.className.substring(0,c.className.indexOf(" selected"))}if(e.className.indexOf(" selected")<0){e.className=e.className+" selected"}this.activeTab=a;return false}}function whubGoogleMapControl(a,b,c,e,f,g){function n(){d.getElementById("imgStaticMap_"+a).style.zIndex="-1"}function m(){var b=d.getElementById("divLoading_"+a);b.style.zIndex="-1"}function l(){var b=d.getElementById("divLoading_"+a);b.innerHTML="Loading...";b.style.zIndex="2"}var h="scrptWhubGoogleMapPlugin";var i=false;var j=null;var k=null;this.googleMap=null;this.layers=[];this.border=null;this.dynamicLoad=function(){if(!d.getElementById(h)){j=d.getElementById("btnUpdate-"+a);k=d.getElementById("btnReset-"+a);j.disabled="disabled";k.disabled="disabled";l();if(location.href.indexOf("www.worcestershire.gov.uk")>-1){g="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBTKwbA4yruutuWwHhQ1gXgIX0dzLhQ3FVC0XA0lvoHQpceItu-43FLzkA"}else if(location.href.indexOf("whub.org.uk")>-1){g="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBTsOvB2e4PnjUXlvrFCXwkJBva4LhQJvn3Ovv6c_aAMcgWDB1VidNdg3A"}else if(location.href.indexOf("www.bromsgrove.gov.uk")>-1){g="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBTkGsWDCrjRhscFh2C5nVrsC27b4hQ_z8KNK0d3XYw9aZV8kUAySXZixA"}else if(location.href.indexOf("www.malvernhills.gov.uk")>-1){g="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBQr23v877zmtoykJ6lAcqmc8TEVcRRpV3oTlM5SG67n405lsY-9QUbqEA"}else if(location.href.indexOf("www.redditch.gov.uk")>-1){g="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBTBWPzBNaAZoiYmuofZkgJvzxKU3xSNIdTrL8Qq1Jzn8kxODJua8zaceQ"}else if(location.href.indexOf("www.wychavon.gov.uk")>-1){g="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBQuHVglvzZb8bD1pf3BGUjzV8Z8tRQ_lI13ztEgm1NUU8ku-8Drvbg9Fw"}else if(location.href.indexOf("www.wyreforestdc.gov.uk")>-1){g="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBRECY6B9J9BpwR8VdJGbuxj0DIraBQgP9S8cYiNErOIyg5p2A_aE6dCbA"}else if(location.href.indexOf("www.worcester.gov.uk")>-1){g="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBRu3ZqoDxYxvo3KdDw15E8mEI0rrxQ4Gq3hhHY7kM5qKvoLVC1msSoFbw"}else{g="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBSY_MYKlWxDbMF9_Vr1ack__N9LWRQBBUTSwY992DfN_gDRVMaaIAZnyQ"}var b=d.createElement("script");b.id=h;b.type="text/javascript";b.src="http://maps.google.com/maps?file=api&v=2.x&key="+g+"&async=2&callback=map_"+a+".initialise";d.body.appendChild(b)}};this.initialise=function(){if(GBrowserIsCompatible()){l();this.googleMap=new GMap2(document.getElementById(a));this.goToDefaultLocation();this.googleMap.setUIToDefault();this.loadBorder();GEvent.addListener(this.googleMap,"tilesloaded",function(){n();m();i=true;d.getElementById("btnUpdate-divGoogleMap").disabled="";d.getElementById("btnReset-divGoogleMap").disabled=""})}else{alert("The page you are viewing is trying to display a Google Map but your web browser does not support this.")}};this.loadBorder=function(){if(f!==""){this.border=new GGeoXml(f);this.googleMap.addOverlay(this.border)}};this.goToDefaultLocation=function(){this.googleMap.setCenter(new GLatLng(b,c),e)};this.reset=function(){for(var b=0;b<this.layers.length;b++){this.layers[b].remove()}var c=d.getElementById("ddlLayers_"+a);if(c){for(var e=0;e<c.options.length;e++){c.options[e].innerHTML=c.options[e].innerHTML.replace(" (On)","")}}this.goToDefaultLocation()};this.unload=function(){if(d.getElementById(h)&&i){GUnload()}};this.addLayer=function(a){this.layers.push(new whubGoogleMapLayer(a))};this.toggleByDropdown=function(){var b=d.getElementById("ddlLayers_"+a);if(b){var c=b.options[b.selectedIndex].value;if(c!==""){this.toggleLayer(c);var e=b.options[b.selectedIndex].innerHTML;var f=" (On)";if(e.indexOf(f)>-1){b.options[b.selectedIndex].innerHTML=e.substring(0,e.indexOf(f))}else{b.options[b.selectedIndex].innerHTML=e+f}}else{alert("Please select an option from the drop down menu in order to make a change to the map.")}}};this.toggleLayer=function(b){if(i){if(this.layers[b].isVisible){this.layers[b].remove()}else{for(var c=0;c<this.layers.length;c++){if(c!=b){if(this.layers[c].isVisible){this.layers[c].remove();var e=d.getElementById("ddlLayers_"+a);if(e){e.options[c+1].innerHTML=e.options[c+1].innerHTML.replace(" (On)","")}}}}this.layers[b].display(this.googleMap)}}else{alert("In order to make this page load quicker for you, we delayed loading the map until it looked like you wanted to use it.\n\nYou were a bit quick and the map hasn't quite finished loading yet, please click OK and try again and everything should be ready.")}}}function whubGoogleMapLayer(a){var a=a;var b=null;this.hasLoaded=false;this.isVisible=false;this.display=function(a){if(!this.isVisible){if(!this.hasLoaded){this.load(a)}else{this.show(a)}}};this.remove=function(){if(this.isVisible){b.hide();this.isVisible=false}};this.show=function(a){if(!this.isVisible){if(this.hasLoaded){b.show();this.isVisible=true}else{alert("We were unable to update the map because the data has not loaded.  Please try again later.")}}};this.load=function(c){if(!this.hasLoaded){b=new GGeoXml(a);this.hasLoaded=true;c.addOverlay(b);this.isVisible=true}}}function whubEventsCalendar(a,b,c,e,f,g,h,i){function o(){if(k.IsComplete(m)){var a=m.responseText;m=null;if(a){d.getElementById(g).innerHTML=a}}}function n(){if(j.IsComplete(l)){var a=l.responseText;l=null;if(a){d.getElementById(strContainerID).innerHTML=a;this.SelectedDate=this.NewDate;this.NewDate=null}}}strContainerID=a;g=g;this.SelectedDate=b;this.Partner=c;this.EventsCalendarPageUrl=e;this.PageBaseUrl=f;this.CalendarHTMLURL="Plugins/EventsCalendar/AJAX/GetCalendarHTML.aspx";this.EventDetailsHTMLURL="Plugins/EventsCalendar/AJAX/GetEventDetailsHTML.aspx";var j=new AjaxManager;var k=new AjaxManager;var l=null;var m=null;this.Update=function(a){l=null;var b="?ID="+strContainerID+"&SelectedDate="+a+"&Partner="+this.Partner+"&EventsCalendarUrl="+this.EventsCalendarPageUrl;var c=this.PageBaseUrl+this.CalendarHTMLURL+b;l=j.Execute(c,n);this.NewDate=a;b="?SelectedDate="+a+"&Partner="+this.Partner+"&EventsCalendarUrl="+this.EventsCalendarPageUrl+"&ShowFullDetails="+h+"&ResultCount="+i;var d=this.PageBaseUrl+this.EventDetailsHTMLURL+b;m=k.Execute(d,o);return false}}function fnFocusOnSelect(a){var b=document;var c=b.getElementById("divFocusOnText");c.innerHTML=arrFocusOnText[a];liSelected=b.getElementById("liFocusOn"+intSelectedFocusOn);if(liSelected.className.indexOf("selected")>-1){liSelected.className=liSelected.className.substring(0,liSelected.className.indexOf(" selected"))}var d=b.getElementById("liFocusOn"+a);d.className=d.className+" selected";intSelectedFocusOn=a}function OpenWindow(a,b,c,d){window.open(a,b,"scrollbars=yes,width="+c+",height="+d)}function clickOnEnter(a){if((document.all?window.event.keyCode:event.which)==13){document.getElementById(a).click();return false}else{return true}}function clearText(a,b){if(document.getElementById(a).value==b){document.getElementById(a).value=""}}function fnOpenMuseumVirtualTourWindow(a){fnOpenNewWindow(a,"MuseumVirtualTourWindow",512,520,"address=0,addressbar=0,menu=0,menubar=0,resizable=0,status=0,statusbar=0")}function fnOpenCSCVirtualTourWindow(a){fnOpenNewWindow(a,"CSCVirtualTourWindow",903,500,"address=0,addressbar=0,menu=0,menubar=0,resizable=0,status=0,statusbar=0")}function fnOpenGISWindow(a){fnOpenNewWindow(a,"GISWindow",900,700,"address=0,addressbar=0,menu=0,menubar=0,resizable=0,status=0,statusbar=0")}function fnOpenNewWindow(a,b,c,d,e){var f=(screen.width-c)/2;var g=(screen.height-d)/2;var h=["width=",c,",height=",d,",left=",f,",top=",g,",",e];var i=window.open(a,b,h.toString(""));if(i){i.focus()}return i}function fnResultMouseOut(a){a.style.backgroundColor="transparent"}function fnResultMouseOver(a){a.style.backgroundColor="#eeeeee"}function AjaxManager(){}function fnUpdateClass(a,b){fnGetEle(a).className=b}function fnUpdateImageSrc(a,b){fnGetEle(a).src=b}function fnToggleElement(a){var b=d.getElementById(a);if(b.style.visibility=="hidden"||b.style.display=="none"||b.style.visibility===""||b.style.display===""){b.style.display="block";b.style.visibility="visible"}else{b.style.display="none";b.style.visibility="hidden"}}function fnScrollToTop(){scroll(0,0);return false}function fnOnClickOnEnter(a,b){var c=a?a:window.event;if(b){if(c.keyCode==13){b.onclick();return false}else{return true}}else{return true}}function fnClickButtonOnEnter(a,b){var c=a?a:window.event;var d=fnGetEle(b);if(d){if(c.keyCode==13){d.click();return false}}}function fnClickButton(a,b){var c=a?a:window.event;var d=fnGetEle(b);if(d){if(c.keyCode==13){d.click();return false}}}function fnSelectTextBoxValue(a,b){if(fnIsDefaultValue(a,b)){a.value=""}}function fnRestoreTextBoxValue(a,b){if(a.value===""){a.value=b}}function fnClearTextBoxValue(a,b){if(fnIsDefaultValue(a,b)){a.value=""}}function fnIsDefaultValue(a,b){if(a.value==b){return true}else{return false}}function fnGetBaseUrl(){if(!strBaseUrl){var a=location.href;strBaseUrl=a.substring(0,a.indexOf("/",a.indexOf("/",a.indexOf("/",8)+1))+1)}return strBaseUrl}function fnGetEle(a){return d.getElementById(a)}function fnSelfServiceImageSwap(a,b){fnUpdateImageSrc(a,fnGetBaseUrl()+"templates/default/images/homepage/selfservice/{0}.jpg".replace("{0}",b.toLowerCase()))}var d=document;var strBaseUrl="";AjaxManager.prototype.Execute=function(a,b){var c=this.GetHttpRequest();c.onreadystatechange=b;c.open("GET",a,true);c.send(null);return c};AjaxManager.prototype.IsComplete=function(a){if(!a){return false}if(a.readyState==4||a.readyState=="complete"){return true}return false};AjaxManager.prototype.GetHttpRequest=function(){var a=null;if(window.XMLHttpRequest){try{a=new XMLHttpRequest}catch(b){a=null}}else if(window.ActiveXObject){try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(c){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(d){a=null}}}return a};if(typeof jQuery!="undefined"){function fnCheckSearchBeforeSubmit(a){if(a==false||a==null){var b=$(".whubHeaderSearchTextBox");if(b.val().length==0||b.val()=="Enter a keyword or postcode"){$("#divSearchBoxHelpTxt").html("Oops, Please enter a keyword or postcode");fnShowSearchHelpBox();return false}else{return true}}else{fnHideSearchHelpBox();return true}}function fnShowSearchHelpBox(){$("#divSearchBubble").css("display","block");$("#divSearchYellowIcon").css("display","block");$(".whubHeaderSearchTextBox").css("background-color","#FFF0D2");$("#divSearchBoxOutter").css("background-color","#FFF0D2")}function fnHideSearchHelpBox(){$("#divSearchBubble").css("display","none");$("#divSearchYellowIcon").css("display","none");$(".whubHeaderSearchTextBox").css("background-color","#FFFFFF");$("#divSearchBoxOutter").css("background-color","#FFFFFF")}function fnGetBestMatches(){var a=$("#divBestMatchesContainer");var b=$("#divBestMatchesLoading");if(a!=null&&b!=null){if(a.html()==""){if(location.href.indexOf("://www.worcestershire.gov.uk")>-1){b.css("display","block");var c=new AjaxManager;var d=c.GetHttpRequest();if(!d){a.html("<br />Sorry, there was a problem retrieving best matches to your search [Error Code 1]<br /><br />");return false}d.onreadystatechange=function(){if(d.readyState==4){if(d.status==200){a.html(d.responseText);b.css("display","none")}else{a.html('<div style="padding:10px;">Sorry, there was a problem retrieving best matches to your search [Error Code 2]</div>');b.css("display","none")}}else{b.css("display","block")}};d.open("GET",strBaseUrl+"Plugins/TemplateControls/AJAX/GetBestMatches.aspx",true);d.send("")}}}}function fnFilterMatches(){var a=d.getElementById("divBestMatchesContainer");var b=d.getElementById("ulbestMatches");var c=d.getElementById("divBestMatchesLoading");var e=$(".whubHeaderSearchTextBox");if(b!=null&&a!=null&&c!=null&&e!=null){if(e.val().length>0){$("#divSearchClear").css("display","block");$("#ulbestMatches").css("top","0px");var b=d.getElementById("ulbestMatches");var f=0;for(var g=0;g<b.childNodes.length;g++){var h=b.childNodes[g];if(h.nodeName=="LI"){var i=h.firstChild.attributes.getNamedItem("title").value.toLowerCase();if(i.indexOf(e.val().toLowerCase())==-1){h.setAttribute("class","hide");if(navigator.userAgent.indexOf("MSIE")>0){h.setAttribute("className","hide")}}else{h.setAttribute("class","show");if(navigator.userAgent.indexOf("MSIE")>0){h.setAttribute("className","show")}f++}}}d.getElementById("divBMTitle").innerHTML='<div id="divBMStar"></div>'+f+" Best Matches:";if(f>0){a.style.display="block";if(f>10){d.getElementById("divBMPaging").style.visibility="visible";d.getElementById("ancBMPrev").style.color="#BBBBBB";d.getElementById("ancBMFirst").style.color="#BBBBBB";$("#ancBMNext").removeAttr("style");$("#ancBMLast").removeAttr("style")}else{d.getElementById("divBMPaging").style.visibility="hidden"}}else{$("#divBestMatchesContainer").fadeOut(250)}}else{d.getElementById("divBMTitle").innerHTML="Our Best Matches:";$("#divBestMatchesContainer").fadeOut(250);$("#divSearchClear").css("display","none")}}}function fnToggleBMResults(a){var b=$("#ulbestMatches").css("top");var c=$("#ulbestMatches").height();var e=$("#divBestMatches").height();b=parseInt(b.replace("px",""));if(a=="next"){h=b-e;if(h>-c){$("#ancBMPrev").removeAttr("style");$("#ancBMFirst").removeAttr("style");var f=h-e;if(f<-c){d.getElementById("ancBMNext").style.color="#BBBBBB";d.getElementById("ancBMLast").style.color="#BBBBBB"}$("#ulbestMatches").animate({top:h+"px"},"slow")}}else if(a=="previous"){h=b+e;if(h<=0){$("#ancBMNext").removeAttr("style");$("#ancBMLast").removeAttr("style");var g=h+e;if(g>=0){d.getElementById("ancBMPrev").style.color="#BBBBBB";d.getElementById("ancBMFirst").style.color="#BBBBBB"}$("#ulbestMatches").animate({top:h+"px"},"slow")}}else if(a=="first"){$("#ulbestMatches").animate({top:"0px"},"slow");$("#ancBMNext").removeAttr("style");$("#ancBMLast").removeAttr("style");d.getElementById("ancBMPrev").style.color="#BBBBBB";d.getElementById("ancBMFirst").style.color="#BBBBBB"}else if(a=="last"){var h=b;while(h>-c){h=h-e}h=h+e;$("#ulbestMatches").animate({top:h+"px"},"slow");$("#ancBMPrev").removeAttr("style");$("#ancBMFirst").removeAttr("style");d.getElementById("ancBMNext").style.color="#BBBBBB";d.getElementById("ancBMLast").style.color="#BBBBBB"}return false}var txtSearchDefaultText="";$(document).ready(function(){txtSearchDefaultText=$(".whubHeaderSearchTextBox").val();var a=d.getElementById("divBestMatchesContainer");var b=$(".whubHeaderSearchTextBox");var c=d.getElementById("divSearchBoxOutter");var e=d.getElementById("divSearchContainer");if(a!=null&&b!=null&&c!=null&&e!=null){$(".whubHeaderSearchTextBox").width(305);$(".whubHeaderSearchTextBox").focus(function(){$(".divSearchBoxOutter").animate({width:"330px"},500)});$(document).click(function(){$("#divBestMatchesContainer").fadeOut(250);if($(".whubHeaderSearchTextBox").val()==""||$(".whubHeaderSearchTextBox").val()==txtSearchDefaultText){$(".divSearchBoxOutter").animate({width:"230px"},800)}});$("#divSearchContainer").click(function(a){a.stopPropagation()})}});function fnClearSearchBox(){$(".whubHeaderSearchTextBox").val("");$("#divBestMatchesContainer").fadeOut(250);$(".whubHeaderSearchTextBox").focus();fnFilterMatches();return false}}
