﻿var d=document;var strBaseUrl=null;function fnGet(strEle)
{return d.getElementById(strEle);}
function fnGetBaseUrl()
{if(!strBaseUrl)
{var strUrl=location.href;strBaseUrl=strUrl.substring(0,strUrl.indexOf("/",strUrl.indexOf("/",strUrl.indexOf("/",8)+1))+1);}
return strBaseUrl;}
function fnClearTextBoxValue(txt,strDefaultValue)
{var strCurrentValue=txt.value;if(strCurrentValue==strDefaultValue)
{txt.value="";}}
function fnRestoreTextBoxValue(txt,strDefaultValue)
{var strCurrentValue=txt.value;if(strCurrentValue=="")
{txt.value=strDefaultValue;}}
function fnClickButton(e,strButtonID)
{var evt=e?e:window.event;var btn=fnGet(strButtonID);if(btn)
{if(evt.keyCode==13)
{btn.click();return false;}}}
function fnClickButtonOnEnter(e,strButtonID)
{var evt=e?e:window.event;var btn=fnGet(strButtonID);if(btn)
{if(evt.keyCode==13)
{btn.click();return false;}}}
function fnOnClickOnEnter(e,lnk)
{var evt=e?e:window.event;if(lnk)
{if(evt.keyCode==13)
{lnk.onclick();return false;}
else
{return true;}}
else
{return true;}}
function fnScrollToTop()
{scroll(0,0);return false;}
function fnToggleElement(strElementId)
{ele=d.getElementById(strElementId);if(ele.style.visibility=="hidden"||ele.style.display=="none"||ele.style.visibility==""||ele.style.display=="")
{ele.style.display="block";ele.style.visibility="visible";}
else
{ele.style.display="none";ele.style.visibility="hidden";}}
function fnUpdateImageSrc(strImgId,strImgUrl)
{fnGet(strImgId).src=strImgUrl;}
function fnUpdateClass(strEleId,strClass)
{fnGet(strEleId).className=strClass;}
function AjaxManager()
{}
AjaxManager.prototype.Execute=function(url,onReadyStateHandler)
{var httpRequest=this.GetHttpRequest();httpRequest.onreadystatechange=onReadyStateHandler;httpRequest.open("GET",url,true);httpRequest.send(null);return httpRequest;};AjaxManager.prototype.IsComplete=function(httpRequest)
{if(httpRequest===undefined)
{return false;}
if(httpRequest.readyState==4||httpRequest.readyState=="complete")
{return true;}
return false;};AjaxManager.prototype.GetHttpRequest=function()
{req=null;if(window.XMLHttpRequest)
{try
{req=new XMLHttpRequest();}
catch(err1)
{req=null;}}
else if(window.ActiveXObject)
{try
{req=new ActiveXObject("Msxml2.XMLHTTP");}
catch(err2)
{try
{req=new ActiveXObject("Microsoft.XMLHTTP");}
catch(err3)
{req=null;}}}
return req;};function fnResultMouseOver(div)
{div.style.backgroundColor="#eeeeee";}
function fnResultMouseOut(div)
{div.style.backgroundColor="transparent";}
function fnOpenNewWindow(strUrl,strPopupName,intPopupWidth,intPopupHeight,strProperties)
{var intPopupX=(screen.width-intPopupWidth)/2;var intPopupY=(screen.height-intPopupHeight)/2;var arrProperties=["width=",intPopupWidth,",height=",intPopupHeight,",left=",intPopupX,",top=",intPopupY,",",strProperties];var objWindow=window.open(strUrl,strPopupName,arrProperties.toString(""));if(objWindow)
{objWindow.focus();}
return objWindow;}
function fnOpenGISWindow(strUrl)
{fnOpenNewWindow(strUrl,"GISWindow",900,700,"address=0,addressbar=0,menu=0,menubar=0,resizable=0,status=0,statusbar=0");}
function fnOpenCSCVirtualTourWindow(strUrl)
{fnOpenNewWindow(strUrl,"CSCVirtualTourWindow",903,500,"address=0,addressbar=0,menu=0,menubar=0,resizable=0,status=0,statusbar=0");}
function fnOpenMuseumVirtualTourWindow(strUrl)
{fnOpenNewWindow(strUrl,"MuseumVirtualTourWindow",512,520,"address=0,addressbar=0,menu=0,menubar=0,resizable=0,status=0,statusbar=0");}
function clearText(textBoxID,defaultVal)
{if(document.getElementById(textBoxID).value==defaultVal)
{document.getElementById(textBoxID).value='';}}
function clickOnEnter(buttonID)
{if(((document.all)?window.event.keyCode:event.which)==13)
{document.getElementById(buttonID).click();return false;}
else
{return true;}}
function OpenWindow(URL,name,width,height)
{window.open(URL,name,"scrollbars=yes,width="+width+",height="+height);}
function fnFocusOnSelect(intFocusOn)
{var d=document;var divText=d.getElementById('divFocusOnText');divText.innerHTML=arrFocusOnText[intFocusOn];liSelected=d.getElementById("liFocusOn"+intSelectedFocusOn);if(liSelected.className.indexOf("selected")>-1)
{liSelected.className=liSelected.className.substring(0,liSelected.className.indexOf(" selected"));}
var liToSelect=d.getElementById("liFocusOn"+intFocusOn);liToSelect.className=liToSelect.className+" selected";intSelectedFocusOn=intFocusOn;}
function whubEventsCalendar(strCalendarContainerId,strSelectedDate,strPartnerAcronym,strEventsCalendarPageUrl,strBaseUrl,strEventsDetailsContainerID,blnShowFullEventDetails,intResultCount)
{strContainerID=strCalendarContainerId;strEventsDetailsContainerID=strEventsDetailsContainerID;this.SelectedDate=strSelectedDate;this.Partner=strPartnerAcronym;this.EventsCalendarPageUrl=strEventsCalendarPageUrl;this.PageBaseUrl=strBaseUrl;this.CalendarHTMLURL="Plugins/EventsCalendar/AJAX/GetCalendarHTML.aspx";this.EventDetailsHTMLURL="Plugins/EventsCalendar/AJAX/GetEventDetailsHTML.aspx";var calendarUpdateManager=new AjaxManager();var eventsUpdateManager=new AjaxManager();var calendarHttpRequest=null;var eventsHttpRequest=null;this.Update=function(strNewDate)
{calendarHttpRequest=null;var strQS="?ID="+strContainerID+"&SelectedDate="+strNewDate+"&Partner="+this.Partner+"&EventsCalendarUrl="+this.EventsCalendarPageUrl;var strUrl=this.PageBaseUrl+this.CalendarHTMLURL+strQS;calendarHttpRequest=calendarUpdateManager.Execute(strUrl,UpdateCalendar_Callback);this.NewDate=strNewDate;strQS="?SelectedDate="+strNewDate+"&Partner="+this.Partner+"&EventsCalendarUrl="+this.EventsCalendarPageUrl+"&ShowFullDetails="+blnShowFullEventDetails+"&ResultCount="+intResultCount;var strUrl2=this.PageBaseUrl+this.EventDetailsHTMLURL+strQS;eventsHttpRequest=eventsUpdateManager.Execute(strUrl2,UpdateEventDetails_Callback);return false;};function UpdateCalendar_Callback()
{if(calendarUpdateManager.IsComplete(calendarHttpRequest))
{var strHtml=calendarHttpRequest.responseText;calendarHttpRequest=null;if(strHtml)
{d.getElementById(strContainerID).innerHTML=strHtml;this.SelectedDate=this.NewDate;this.NewDate=null;}}}
function UpdateEventDetails_Callback()
{if(eventsUpdateManager.IsComplete(eventsHttpRequest))
{var strHtml=eventsHttpRequest.responseText;eventsHttpRequest=null;if(strHtml)
{d.getElementById(strEventsDetailsContainerID).innerHTML=strHtml;}}}}
function whubGoogleMapLayer(strUrl)
{var strUrl=strUrl;var overlay=null;this.hasLoaded=false;this.isVisible=false;this.display=function(whubGglMp)
{if(!this.isVisible)
{if(!this.hasLoaded)
{this.load(whubGglMp);}
else
{this.show(whubGglMp);}}};this.remove=function()
{if(this.isVisible)
{overlay.hide();this.isVisible=false;}};this.show=function(whubGglMp)
{if(!this.isVisible)
{if(this.hasLoaded)
{overlay.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(whubGglMp)
{if(!this.hasLoaded)
{overlay=new GGeoXml(strUrl);this.hasLoaded=true;whubGglMp.addOverlay(overlay);this.isVisible=true;}};}
function whubGoogleMapControl(strMapContainerID,strLongitude,strLatitude,intZoomLevel,strBorderUrl,strAPIKey)
{var strScriptId="scrptWhubGoogleMapPlugin";var blnMapReady=false;var btnUpdate=null;var btnReset=null;this.googleMap=null;this.layers=[];this.border=null;this.dynamicLoad=function()
{if(!d.getElementById(strScriptId))
{btnUpdate=d.getElementById("btnUpdate-"+strMapContainerID);btnReset=d.getElementById("btnReset-"+strMapContainerID);btnUpdate.disabled="disabled";btnReset.disabled="disabled";fnShowStatus();if(location.href.indexOf("www.worcestershire.gov.uk")>-1)
{strAPIKey="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBTKwbA4yruutuWwHhQ1gXgIX0dzLhQ3FVC0XA0lvoHQpceItu-43FLzkA";}
else if(location.href.indexOf("whub.org.uk")>-1)
{strAPIKey="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBTsOvB2e4PnjUXlvrFCXwkJBva4LhQJvn3Ovv6c_aAMcgWDB1VidNdg3A";}
else if(location.href.indexOf("www.bromsgrove.gov.uk")>-1)
{strAPIKey="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBTkGsWDCrjRhscFh2C5nVrsC27b4hQ_z8KNK0d3XYw9aZV8kUAySXZixA";}
else if(location.href.indexOf("www.malvernhills.gov.uk")>-1)
{strAPIKey="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBQr23v877zmtoykJ6lAcqmc8TEVcRRpV3oTlM5SG67n405lsY-9QUbqEA";}
else if(location.href.indexOf("www.redditch.gov.uk")>-1)
{strAPIKey="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBTBWPzBNaAZoiYmuofZkgJvzxKU3xSNIdTrL8Qq1Jzn8kxODJua8zaceQ";}
else if(location.href.indexOf("www.wychavon.gov.uk")>-1)
{strAPIKey="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBQuHVglvzZb8bD1pf3BGUjzV8Z8tRQ_lI13ztEgm1NUU8ku-8Drvbg9Fw";}
else if(location.href.indexOf("www.wyreforestdc.gov.uk")>-1)
{strAPIKey="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBRECY6B9J9BpwR8VdJGbuxj0DIraBQgP9S8cYiNErOIyg5p2A_aE6dCbA";}
else if(location.href.indexOf("www.worcester.gov.uk")>-1)
{strAPIKey="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBRu3ZqoDxYxvo3KdDw15E8mEI0rrxQ4Gq3hhHY7kM5qKvoLVC1msSoFbw";}
else
{strAPIKey="ABQIAAAAjNYYnob9oMOm1M6LvSY5KBSY_MYKlWxDbMF9_Vr1ack__N9LWRQBBUTSwY992DfN_gDRVMaaIAZnyQ";}
var script=d.createElement("script");script.id=strScriptId;script.type="text/javascript";script.src="http://maps.google.com/maps?file=api&v=2.x&key="+strAPIKey+"&async=2&callback=map_"+strMapContainerID+".initialise";d.body.appendChild(script);}};this.initialise=function()
{if(GBrowserIsCompatible())
{fnShowStatus();this.googleMap=new GMap2(document.getElementById(strMapContainerID));this.goToDefaultLocation();this.googleMap.setUIToDefault();this.loadBorder();GEvent.addListener(this.googleMap,"tilesloaded",function(){fnHideStaticMap();fnHideStatus();blnMapReady=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.");}};function fnShowStatus()
{var div=d.getElementById("divLoading_"+strMapContainerID);div.innerHTML="Loading...";div.style.zIndex="2";}
function fnHideStatus()
{var div=d.getElementById("divLoading_"+strMapContainerID);div.style.zIndex="-1";}
function fnHideStaticMap()
{d.getElementById("imgStaticMap_"+strMapContainerID).style.zIndex="-1";}
this.loadBorder=function()
{if(strBorderUrl!="")
{this.border=new GGeoXml(strBorderUrl);this.googleMap.addOverlay(this.border);}};this.goToDefaultLocation=function()
{this.googleMap.setCenter(new GLatLng(strLongitude,strLatitude),intZoomLevel);};this.reset=function()
{for(var i=0;i<this.layers.length;i++)
{this.layers[i].remove();}
var ddl=d.getElementById("ddlLayers_"+strMapContainerID);if(ddl)
{for(var j=0;j<ddl.options.length;j++)
{ddl.options[j].innerHTML=ddl.options[j].innerHTML.replace(" (On)","");}}
this.goToDefaultLocation();};this.unload=function()
{if(d.getElementById(strScriptId)&&blnMapReady)
{GUnload();}};this.addLayer=function(strLayerDataUrl)
{this.layers.push(new whubGoogleMapLayer(strLayerDataUrl));};this.toggleByDropdown=function()
{var ddl=d.getElementById("ddlLayers_"+strMapContainerID);if(ddl)
{var intLayerID=ddl.options[ddl.selectedIndex].value;if(intLayerID!="")
{this.toggleLayer(intLayerID);var strLayerText=ddl.options[ddl.selectedIndex].innerHTML;var strLayerOffText="";var strLayerOnText=" (On)";if(strLayerText.indexOf(strLayerOnText)>-1)
{ddl.options[ddl.selectedIndex].innerHTML=strLayerText.substring(0,strLayerText.indexOf(strLayerOnText));}
else
{ddl.options[ddl.selectedIndex].innerHTML=strLayerText+strLayerOnText;}}
else
{alert("Please select an option from the drop down menu in order to make a change to the map.");}}};this.toggleLayer=function(intLayerID)
{if(blnMapReady)
{if(this.layers[intLayerID].isVisible)
{this.layers[intLayerID].remove();}
else
{for(var i=0;i<this.layers.length;i++)
{if(i!=intLayerID)
{if(this.layers[i].isVisible)
{this.layers[i].remove();var ddl=d.getElementById("ddlLayers_"+strMapContainerID);if(ddl)
{ddl.options[i+1].innerHTML=ddl.options[i+1].innerHTML.replace(" (On)","");}}}}
this.layers[intLayerID].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 fnTidyPoll()
{arrTbls=d.body.getElementsByTagName("table");for(var i=0;i<arrTbls.length;i++)
{if(arrTbls[i].id.indexOf("ctl00_userpoll")>-1&&arrTbls[i].id.indexOf("_tbl")>-1)
{arrTbls[i].style.width="246px";arrTbls[i].style.padding="5px";arrTbls[i].style.border="0px solid #cccccc";var arrSubTbls=arrTbls[i].getElementsByTagName("table");for(var j=0;j<arrSubTbls.length;j++)
{arrSubTbls[j].style.width="150px";}}}}
function fnGetInputControlFocusOnFunction()
{return function()
{this.select();};}
function fnTidyForm()
{var arrTables=d.getElementsByTagName("table");for(i=0;i<arrTables.length;i++)
{if(arrTables[i].className=="tbform")
{var arrInputs=arrTables[i].getElementsByTagName("input");for(j=0;j<arrInputs.length;j++)
{if(arrInputs[j].type=="text")
{arrInputs[j].onfocus=fnGetInputControlFocusOnFunction();}}
var arrTextareas=arrTables[i].getElementsByTagName("textarea");for(k=0;k<arrTextareas.length;k++)
{arrTextareas[k].onfocus=fnGetInputControlFocusOnFunction();}}}}
function fnTidyIndexServerSearch()
{var blnSomethingSearchedFor=false;var blnSearchTypeSelected=false;if(d.getElementById("Template_ctl15_ctl00_searchTerms").value!="search keywords here")
{blnSomethingSearchedFor=true;}
var arrDDLs=d.getElementsByTagName("select");for(i=0;i<arrDDLs.length;i++)
{if(arrDDLs[i].id.indexOf("searchTypes")>-1)
{for(j=0;j<arrDDLs[i].options.length;j++)
{if(arrDDLs[i].options[j].innerHTML=="HTML")
{arrDDLs[i].options[j].innerHTML="Web Pages";}
if(j>0&&arrDDLs[i].options[j].selected===true)
{blnSearchTypeSelected=true;}}
for(k=0;k<arrDDLs[i].options.length;k++)
{if(arrDDLs[i].options[k].innerHTML=="Web Pages"&&blnSearchTypeSelected===false)
{arrDDLs[i].options[k].selected=true;}}}}}
function fnFooterMapImageSwap(strPartnerAcronym)
{fnUpdateImageSrc('imgFooterMap',fnGetBaseUrl()+"templates/default/images/common/footer-map-{0}.gif".replace('{0}',strPartnerAcronym.toLowerCase()));}
function fnFooterAnchorClassUpdate(strPartnerAcronym,strClass)
{fnUpdateClass("ancFooterLink{0}".replace("{0}",strPartnerAcronym),strClass);}
function fnAssignFooterBehaviours()
{var arrPartners=['BDC','MHC','RBC','COW','WFC','WDC'];var objEle=null;objEle=fnGet('areaFooterMap'+arrPartners[0]);objEle.onmouseover=function(){fnFooterMapImageSwap(arrPartners[0]);fnFooterAnchorClassUpdate(arrPartners[0],'whubLinkHover');};objEle.onfocus=objEle.onmouseover;objEle.onmouseout=function(){fnFooterMapImageSwap('wcc');fnFooterAnchorClassUpdate(arrPartners[0],'');};objEle.onblur=objEle.onmouseout;objEle=fnGet('areaFooterMap'+arrPartners[1]);objEle.onmouseover=function(){fnFooterMapImageSwap(arrPartners[1]);fnFooterAnchorClassUpdate(arrPartners[1],'whubLinkHover');};objEle.onfocus=objEle.onmouseover;objEle.onmouseout=function(){fnFooterMapImageSwap('wcc');fnFooterAnchorClassUpdate(arrPartners[1],'');};objEle.onblur=objEle.onmouseout;objEle=fnGet('areaFooterMap'+arrPartners[2]);objEle.onmouseover=function(){fnFooterMapImageSwap(arrPartners[2]);fnFooterAnchorClassUpdate(arrPartners[2],'whubLinkHover');};objEle.onfocus=objEle.onmouseover;objEle.onmouseout=function(){fnFooterMapImageSwap('wcc');fnFooterAnchorClassUpdate(arrPartners[2],'');};objEle.onblur=objEle.onmouseout;objEle=fnGet('areaFooterMap'+arrPartners[3]);objEle.onmouseover=function(){fnFooterMapImageSwap(arrPartners[3]);fnFooterAnchorClassUpdate(arrPartners[3],'whubLinkHover');};objEle.onfocus=objEle.onmouseover;objEle.onmouseout=function(){fnFooterMapImageSwap('wcc');fnFooterAnchorClassUpdate(arrPartners[3],'');};objEle.onblur=objEle.onmouseout;objEle=fnGet('areaFooterMap'+arrPartners[4]);objEle.onmouseover=function(){fnFooterMapImageSwap(arrPartners[4]);fnFooterAnchorClassUpdate(arrPartners[4],'whubLinkHover');};objEle.onfocus=objEle.onmouseover;objEle.onmouseout=function(){fnFooterMapImageSwap('wcc');fnFooterAnchorClassUpdate(arrPartners[4],'');};objEle.onblur=objEle.onmouseout;objEle=fnGet('areaFooterMap'+arrPartners[5]);objEle.onmouseover=function(){fnFooterMapImageSwap(arrPartners[5]);fnFooterAnchorClassUpdate(arrPartners[5],'whubLinkHover');};objEle.onfocus=objEle.onmouseover;objEle.onmouseout=function(){fnFooterMapImageSwap('wcc');fnFooterAnchorClassUpdate(arrPartners[5],'');};objEle.onblur=objEle.onmouseout;objEle=fnGet('ancFooterLink'+arrPartners[0]);objEle.onmouseover=function(){fnFooterMapImageSwap(arrPartners[0]);};objEle.onfocus=objEle.onmouseover;objEle.onmouseout=function(){fnFooterMapImageSwap('wcc');};objEle.onblur=objEle.onmouseout;objEle=fnGet('ancFooterLink'+arrPartners[1]);objEle.onmouseover=function(){fnFooterMapImageSwap(arrPartners[1]);};objEle.onfocus=objEle.onmouseover;objEle.onmouseout=function(){fnFooterMapImageSwap('wcc');};objEle.onblur=objEle.onmouseout;objEle=fnGet('ancFooterLink'+arrPartners[2]);objEle.onmouseover=function(){fnFooterMapImageSwap(arrPartners[2]);};objEle.onfocus=objEle.onmouseover;objEle.onmouseout=function(){fnFooterMapImageSwap('wcc');};objEle.onblur=objEle.onmouseout;objEle=fnGet('ancFooterLink'+arrPartners[3]);objEle.onmouseover=function(){fnFooterMapImageSwap(arrPartners[3]);};objEle.onfocus=objEle.onmouseover;objEle.onmouseout=function(){fnFooterMapImageSwap('wcc');};objEle.onblur=objEle.onmouseout;objEle=fnGet('ancFooterLink'+arrPartners[4]);objEle.onmouseover=function(){fnFooterMapImageSwap(arrPartners[4]);};objEle.onfocus=objEle.onmouseover;objEle.onmouseout=function(){fnFooterMapImageSwap('wcc');};objEle.onblur=objEle.onmouseout;objEle=fnGet('ancFooterLink'+arrPartners[5]);objEle.onmouseover=function(){fnFooterMapImageSwap(arrPartners[5]);};objEle.onfocus=objEle.onmouseover;objEle.onmouseout=function(){fnFooterMapImageSwap('wcc');};objEle.onblur=objEle.onmouseout;}