﻿Type.registerNamespace('Eviivo');Eviivo.SubmitDisableItems=function(){if(typeof(Page_ClientValidate)=='function'){Page_ClientValidate();} if(Page_IsValid){var form=document.Form1;var element;for(var i=0;i<form.elements.length;i++){element=form.elements[i];if(element.tagName=="INPUT"||element.tagName=="TEXTAREA"){if(element.type=="checkbox"||element.type=="button"||element.type=="submit"){element.disabled="disabled";} else{element.readOnly="readonly";}}} document.body.className+=" wait";return true;}};Eviivo.GetParent=function(element,parent){if(typeof(element)=='string'){element=$get(element);} if(!element){return null;} var elements=[];if(typeof(parent)!='string'){while(element.parentNode){element=element.parentNode;elements.unshift(element);if(element==parent){return elements;}}} else{parent=parent.toUpperCase();if(element.nodeName&&element.nodeName.toUpperCase()==parent){elements.unshift(element);return elements;} while(element.parentNode){element=element.parentNode;elements.unshift(element);if(element.nodeName&&element.nodeName.toUpperCase()==parent){return elements;}}} return elements;};Eviivo.GetParentWithClass=function(element,className){if(typeof(element)=='string'){element=$get(element);} if(!element){return null;} var elements=[];if(typeof(parent)!='string'){while(element.parentNode){element=element.parentNode;elements.unshift(element);if(Sys.UI.DomElement.containsCssClass(element,className)){return elements;}}} else{if(element.nodeName&&Sys.UI.DomElement.containsCssClass(element,className)){elements.unshift(element);return elements;} while(element.parentNode){element=element.parentNode;elements.unshift(element);if(element.nodeName&&Sys.UI.DomElement.containsCssClass(element,className)){return elements;}}} return elements;};Eviivo.ChangeSort=function(selectElementID){var element=$get(selectElementID);if(element){var value=element.value;var url=self.document.location.search;url=url.replace(/&sort=(\d)/i,'');url=url.replace(/&page=(\d)/i,'');self.document.location.search=url+"&sort="+value;}};Eviivo.FilterManager=function(containerId,modalPopupId){this._container=$get(containerId);this._modalPopupId=modalPopupId;this._triggers=[];if(this._container&&this._modalPopupId!=''){var links=this._container.getElementsByTagName('a');for(var i=0;i<links.length;i++){var trigger=links[i];this._triggers.push(trigger);$addHandlers(trigger,{"click":this._onClick},this);}}};Eviivo.FilterManager.prototype={_onClick:function(e){var target=e.target;setTimeout("$find('"+this._modalPopupId+"').show();",100);self.document.location=(target.tagName=='A')?target.href:Eviivo.GetParent(target,'A');return false;},dispose:function(){for(var i=0;i<this._triggers.length;i++){$clearHandlers(this._triggers[i]);} this._container=null;this._modalPopupId=null;this._triggers=null;}};Eviivo.FilterManager.registerClass('Eviivo.FilterManager',null,Sys.IDisposable);Eviivo.FilterManager.create=Eviivo$FilterManager$create=function(containerId,modalPopupId){Sys.Application.add_load(function(){Eviivo.FilterManager.Instance=new Eviivo.FilterManager(containerId,modalPopupId);});};Eviivo.Submit=function(modalPopupId,validationGroup){if(typeof(Page_ClientValidate)=='function'){var oldPage_IsValid=Page_IsValid;var oldPage_BlockSubmit=Page_BlockSubmit;if(Page_ClientValidate(validationGroup)==false){Page_IsValid=oldPage_IsValid;Page_BlockSubmit=oldPage_BlockSubmit;return false;}} setTimeout("$find('"+modalPopupId+"').show();",200);return true;};Eviivo.SetImage=function(sourceElement,targetImgId,imageSrc){targetElement=$get(targetImgId);var thumbs=sourceElement.parentNode.getElementsByTagName('IMG');for(var i=0;i<thumbs.length;i++){Sys.UI.DomElement.removeCssClass(thumbs[i],'selected_thumb');} if(imageSrc){targetElement.src=imageSrc;} else{targetElement.src=sourceElement.src;} targetElement.alt=sourceElement.alt;targetElement.title=sourceElement.title;Sys.UI.DomElement.addCssClass(sourceElement,'selected_thumb');};Eviivo.OpenW=function(loc){window.open(loc,'popup','left=20,top=20,width=800,height=420,toolbar=0,resizable=0,scrollbars=yes');};Eviivo.OpenWF=function(loc){window.open(loc,'popup','left=20,top=20,width=800,toolbar=0,resizable=0,scrollbars=yes');};Eviivo.OpenWP=function(loc){window.open(loc,'popup','left=20,top=20,width=620,height=420,toolbar=0,resizable=1,scrollbars=yes');};Type.registerNamespace('Eviivo.Search');Type.registerNamespace('Eviivo.Layout');Eviivo.Layout=function Eviivo$Layout(containerID,controlsIDs,onLayoutChanged){var e=Function._validateParams(arguments,[{name:"containerID",type:String},{name:"controlsIDs",type:Object},{name:"onLayoutChanged",type:Object,mayBeNull:true,optional:true}]);if(e)throw e;var element=$get(containerID);if(!element)throw e;Eviivo.Layout.initializeBase(this,[element]);this._controlHandler=Function.createDelegate(this,this.controlClickedHandler);this._onLayoutChanged=onLayoutChanged||null;this._previousClassNameModifier=null;this._controls=[];for(var key in controlsIDs){var control=$get(key);if(control){this._controls.push(control);var classModifier=controlsIDs[key];control.classNameModifier=classModifier;if(control.tagName=='INPUT'&&control.type=='radio'){control.eventName='click';$addHandler(control,'click',this._controlHandler);if(control.checked==true){this.controlClicked(control);this._previousClassNameModifier=this.getClassModifier(control);} else{Sys.UI.DomElement.removeCssClass(element,this.getClassModifier(control));}} else if(control.tagName=='SELECT'){control.eventName='change';$addHandler(control,'change',this._controlHandler);this.controlClicked(control);this._previousClassNameModifier=this.getClassModifier(control);} else if(control.tagName=='A'||control.tagName=='SPAN'){control.eventName='click';$addHandler(control,'click',this._controlHandler);this.controlClicked(control);this._previousClassNameModifier=this.getClassModifier(control);}}} this.initialize();};Eviivo.Layout.prototype={initialize:function Eviivo$Layout$initialize(){Eviivo.Layout.callBaseMethod(this,'initialize');},dispose:function Eviivo$Layout$dispose(){if(this._controls){for(var i=0;i<this._controls.length;i++){$removeHandler(this._controls[i],this._controls[i].eventName,this._controlHandler);}} this._controls=null;this._controlHandler=null;this._previousClassNameModifier=null;this._onLayoutChanged=null;Eviivo.Layout.callBaseMethod(this,'dispose');},get_controls:function Eviivo$Layout$get_controls(index){return this._controls[index];},getClassModifier:function Eviivo$Layout$getClassModifier(control){if(control.tagName=='SELECT'){return control.classNameModifier+control.value;} else{return control.classNameModifier;}},controlClickedHandler:function Eviivo$Layout$controlClickedHandler(e){this.controlClicked(e.target);if(e.target.tagName=='A'||e.target.tagName=='SPAN'){e.preventDefault();e.stopPropagation();}},controlClicked:function Eviivo$Layout$controlClicked(control){if(control.tagName=='LABEL'&&control.htmlFor){control=$get(control.htmlFor);} var container=this.get_element();if(this._previousClassNameModifier&&Sys.UI.DomElement.containsCssClass(container,this._previousClassNameModifier)){Sys.UI.DomElement.removeCssClass(container,this._previousClassNameModifier);} var classModifier=this.getClassModifier(control);Sys.UI.DomElement.addCssClass(container,classModifier);this._previousClassNameModifier=classModifier;this.layoutChangedHandler();},layoutChangedHandler:function Eviivo$Layout$layoutChangedHandler(){if(this._onLayoutChanged){this._onLayoutChanged(this);}}};Eviivo.Layout.registerClass('Eviivo.Layout',Sys.UI.Behavior,Sys.IDisposable);Eviivo.Layout.create=Eviivo$Layout$create=function(containerID,controlsIDArray,onLayoutChanged){Sys.Application.add_load(function(){new Eviivo.Layout(containerID,controlsIDArray,onLayoutChanged);});};Eviivo.FixTopSearch=function(layout){var searchContainer=$get('searchbox_top');var roomsClass=layout.getClassModifier(layout.get_controls(0));searchContainer.className=roomsClass;var browserClass='browser_'+Sys.Browser.name.toLowerCase();if(Sys.UI.DomElement.containsCssClass(searchContainer,browserClass)===false){Sys.UI.DomElement.addCssClass(searchContainer,browserClass);}};Eviivo.Search.SwapTemp=function(ele,stylename,before,after){if(ele.value==before){AddStylesheet(stylename);ele.value=after;} else{RemoveStylesheet(stylename);ele.value=before;}};Eviivo.FlipImage=function(imageList,imgElementID,headerElementID,descriptionElementID,thumbBlockElementID){this._currentImageIndex=0;this._imageList=imageList;this._img=$get(imgElementID);this._header=$get(headerElementID);this._description=$get(descriptionElementID);this._thumbBlock=$get(thumbBlockElementID);};Eviivo.FlipImage.prototype={previousImage:function(){this.setMainImage(--this._currentImageIndex);},nextImage:function(){this.setMainImage(++this._currentImageIndex);},setMainImage:function(index){if(index<0){index=this._imageList.length-1;} else if(index>=this._imageList.length){index=0;} var image=this._imageList[index];this._img.src=image.Url;this._img.title=image.Description;this._img.alt=image.Description;this._header.innerHTML=image.ImageType;var images=this._thumbBlock.getElementsByTagName('IMG');for(var i=0;i<images.length;i++){Sys.UI.DomElement.removeCssClass(images[i],'selected_thumb');} Sys.UI.DomElement.addCssClass(images[index],'selected_thumb');if(image.Description.length===0){this._description.innerHTML="&nbsp;";} else{this._description.innerHTML=image.Description;} this._currentImageIndex=index;}};Eviivo.FlipImage.registerClass('Eviivo.FlipImage',null);Date.prototype.addDays=function Date$addDays(days){return new Date(this.getTime()+days*24*60*60*1000);};Eviivo.CheckIn=function(formats,startDateID,durationID,endDateID,calendarID){var e=Function._validateParams(arguments,[{name:"formats",type:String},{name:"startDateID",type:String},{name:"durationID",type:String},{name:"endDateID",type:String},{name:"calendarID",type:String}]);if(e)throw e;this._dateFormats=formats;this._startDate=Date.Now;this._duration=0;this._startE=$get(startDateID);if(this._startE){this._startDate=Date.parseInvariant(this._startE.value,formats);$addHandlers(this._startE,{"blur":this._onStartBlur},this);} this._durationE=$get(durationID);if(this._durationE){$addHandlers(this._durationE,{"blur":this._onDurationBlur},this);} this._endDate=$get(endDateID);this._calendarE=$find(calendarID);if(this._calendarE){this.calDateSelected=Function.createDelegate(this,this._calDateSelected);this._calendarE.add_dateSelectionChanged(this.calDateSelected);}};Eviivo.CheckIn.prototype={_onStartBlur:function(e){if(e.target.value.length>0){var checkInDate=Date.parseInvariant(e.target.value,this._dateFormats);if(checkInDate){this._startDate=checkInDate;this._updateEndDate();}}},_onDurationBlur:function(e){if(e.target.value.length>0){var duration=parseInt(e.target.value,10);if(!isNaN(duration)){this._duration=duration;this._updateEndDate();}}},_calDateSelected:function(e){this._startDate=e.get_selectedDate();this._updateEndDate();},_updateEndDate:function(){if(this._startDate&&this._endDate){var endDate=this._startDate.addDays(this._duration);this._endDate.innerHTML=endDate.format('dd/MM/yyyy');}},dispose:function(){if(this._calendarE){this._calendarE.remove_dateSelectionChanged(this.calDateSelected);} $clearHandlers(this._durationE);$clearHandlers(this._startE);$clearHandlers(this);Eviivo.CheckIn.callBaseMethod(this,'dispose');}};Eviivo.CheckIn.registerClass('Eviivo.CheckIn',null,Sys.IDisposable);Eviivo.CheckIn.Create=function(formats,startDateID,durationID,endDateID,calendarID){Sys.Application.add_load(function(){new Eviivo.CheckIn(formats,startDateID,durationID,endDateID,calendarID);});};Eviivo.AssociateDate=function(format,calendarID,associatedCalendarID,endDateID){var e=Function._validateParams(arguments,[{name:"format",type:String},{name:"calendarID",type:String},{name:"associatedCalendarID",type:String},{name:"endDateID",type:String}]);if(e)throw e;this._dateFormat=format;this._startDate=Date.Now;this._endControl=$get(endDateID);this._calendarControl=$find(calendarID);this._associatedCalendarControl=$find(associatedCalendarID);if(this._calendarControl&&this._associatedCalendarControl){this.calDateSelected=Function.createDelegate(this,this._calDateSelected);this._calendarControl.add_dateSelectionChanged(this.calDateSelected);}};Eviivo.AssociateDate.prototype={_calDateSelected:function(e){this._startDate=e.get_selectedDate();this._updateEndDate();},_updateEndDate:function(){if(this._startDate&&this._endControl){var endDate=Date.parseInvariant(this._endControl.value,this._dateFormat);if(!endDate||endDate<this._startDate){this._associatedCalendarControl.set_selectedDate(this._startDate);}}},dispose:function(){if(this._calendarControl){this._calendarControl.remove_dateSelectionChanged(this.calDateSelected);} $clearHandlers(this);Eviivo.AssociateDate.callBaseMethod(this,'dispose');}};Eviivo.AssociateDate.registerClass('Eviivo.AssociateDate',null,Sys.IDisposable);Eviivo.AssociateDate.Create=function(formats,calendarID,associatedCalendarID,endDateID){Sys.Application.add_load(function(){new Eviivo.AssociateDate(formats,calendarID,associatedCalendarID,endDateID);});};Eviivo.SecurityCode=function(){this._element=$get('security_code_help');this._elementHelp=$get('security_code_help_box');if(this._element){$addHandlers(this._element,{"mouseover":this._onMouseOver,"mouseout":this._onMouseOut},this);}};Eviivo.SecurityCode.prototype={_onMouseOver:function(e){this._elementHelp.style.visibility='visible';},_onMouseOut:function(e){this._elementHelp.style.left='0px';this._elementHelp.style.visibility='hidden';},dispose:function(){$clearHandlers(this._element);Eviivo.SecurityCode.callBaseMethod(this,'dispose');}};Eviivo.SecurityCode.Create=function(){Sys.Application.add_load(function(){new Eviivo.SecurityCode();});};Eviivo.SecurityCode.registerClass('Eviivo.SecurityCode',null,Sys.IDisposable);Eviivo.Availability=function(buttonID,durationID,roomID,consumerIDList,errrorDivID){this._button=$get(buttonID);this._errorDiv=$get(errrorDivID);this._duration=$get(durationID);this._room=$get(roomID);this._consumerIDList=consumerIDList;this._errorList=[];if(this._button){$addHandlers(this._button,{"click":this._onClick},this);}};Eviivo.Availability.prototype={_onClick:function(e){this._errorDiv.innerHTML='';this._errorList=[];if(!this._errorList.length>0){this._errorDiv.innerHTML='We had an error';e.stopPropagation();}},_validate:function(){this._errorList[0]='error';},getRoomTotal:function(roomNumber){return getNumber(this._consumerIDList[roomNumber].Adult)+getNumber(this._consumerIDList[roomNumber].Child)+getNumber(this._consumerIDList[roomNumber].Con);},getNumber:function(elemID){if(elemID){var elem=$get(elemID);if(elemID&&!isNan(elemID.innerHTML)){return parseInt(elemID.HTML,10);}} return 0;},dispose:function(){$clearHandlers(this._button);Eviivo.Availability.callBaseMethod(this,'dispose');}};Eviivo.Availability.registerClass('Eviivo.Availability',null,Sys.IDisposable);Eviivo.ToggleLink=function(text,altText){this._text=text;this._altText=altText;};Eviivo.ToggleLink.Instance=null;Eviivo.ToggleLink.Toggle=function(e,src,targetID){if(Eviivo.ToggleLink.Instance){Eviivo.ToggleLink.Instance.toggle(e,src,targetID);} return false;};Eviivo.ToggleLink.prototype={toggle:function(e,src,targetID){if(this._isVisible(src)){$get(targetID).style.display='none';src.innerHTML=this._text;src.mode=false;} else{$get(targetID).style.display='block';src.innerHTML=this._altText;src.mode=true;} if(Eviivo&&Eviivo.Controls&&Eviivo.Controls.GoogleMap&&Eviivo.Controls.GoogleMap.Instance){Eviivo.Controls.GoogleMap.Instance.scrollMapAfterResize();}},_isVisible:function(e){if(typeof(e.mode)=='undefined'){e.mode=false;} return e.mode;}};Eviivo.ToggleLink.registerClass('Eviivo.ToggleLink',null);Eviivo.ToggleLink.create=Eviivo$ToggleLink$create=function(text,altText){Sys.Application.add_load(function(){Eviivo.ToggleLink.Instance=new Eviivo.ToggleLink(text,altText);});};Type.registerNamespace('Eviivo.Bookmarks');Eviivo.Bookmarks=function(className,urlFieldId,cultureCode,linkSrc,imageSrc){var e=Function._validateParams(arguments,[{name:"className",type:String},{name:"urlFieldId",type:String},{name:"cultureCode",type:String},{name:"linkSrc",type:String},{name:"imageSrc",type:String}]);if(e)throw e;this._url=this.GetUrl(urlFieldId);this._links=[];this._imgs=[];var anchorTags=document.getElementsByTagName("A");for(var i=0;i<anchorTags.length;i++){var link=anchorTags[i];if(Sys.UI.DomElement.containsCssClass(link,className)){link.href=linkSrc;link._url=this._url;var linkImageChild=document.createElement("img");linkImageChild._srcUrl=imageSrc;linkImageChild.src=String.format(imageSrc,cultureCode);linkImageChild.id="imgBookMark"+i;try{$addHandlers(window,{"error":this._onError},linkImageChild);} catch(Error){} link.appendChild(linkImageChild);$addHandlers(link,{"mouseover":this._onMouseOver},link);$addHandlers(link,{"mouseout":this._onMouseOut});$addHandlers(link,{"click":this._onClick});this._imgs.push(linkImageChild);this._links.push(link);var element=document.getElementById("imgBookMark"+i);if((element.complete!=null)&&(!element.complete)||(element.offsetHeight==0)){element.src=String.format(imageSrc,'en');}}}};Eviivo.Bookmarks.ShowSelectTag=Eviivo$Bookmarks$ShowSelectTag=function(){if(document.getElementById('at15s').style.display=='none'&&document.getElementById('at16p').style.display=='none'){var selectTags=document.getElementsByTagName("SELECT");for(var i=0;i<selectTags.length;i++){Sys.UI.DomElement.removeCssClass(selectTags[i],'hideContainer');} clearInterval(Eviivo$Bookmarks$TimeInterval);}};Eviivo.Bookmarks.prototype={_onMouseOver:function(e){if((Sys.Browser.agent==Sys.Browser.InternetExplorer)&&(Sys.Browser.version<7)){var selectTags=document.getElementsByTagName("SELECT");for(var i=0;i<selectTags.length;i++){Sys.UI.DomElement.addCssClass(selectTags[i],'hideContainer');} Eviivo$Bookmarks$TimeInterval=setInterval("Eviivo$Bookmarks$ShowSelectTag()",1000);} return addthis_open(this,'',this._url,'[TITLE]');},_onMouseOut:function(){return addthis_close();},_onClick:function(){return addthis_sendto();},_onError:function(e){this.src=String.format(this._srcUrl,'en');},GetUrl:function(urlFieldId){var element=$get(urlFieldId);if(element){return element.value;}},Add:function(e){var url=this.href;var title=document.title;if(Sys.Browser.agent==Sys.Browser.InternetExplorer&&window.external){window.external.AddFavorite(url,title);} else if(Sys.Browser.agent==Sys.Browser.Firefox&&window.sidebar){window.sidebar.addPanel(title,url,"");} e.preventDefault();e.stopPropagation();return false;},dispose:function(){if(this._links){for(var i=0;i<this._links.length;i++){$clearHandlers(this._links[i]);}} if(this._imgs){for(var i=0;i<this._imgs.length;i++){$clearHandlers(this._imgs[i]);}} this._url=null;this._links=null;this._imgs=null;Eviivo.Bookmarks.callBaseMethod(this,'dispose');}};Eviivo.Bookmarks.registerClass('Eviivo.Bookmarks',null,Sys.IDisposable);Eviivo.Bookmarks.create=Eviivo$Bookmarks$create=function(className,urlFieldId,cultureCode,linkSrc,imageSrc){Sys.Application.add_load(function(){Eviivo.Bookmarks.Instance=new Eviivo.Bookmarks(className,urlFieldId,cultureCode,linkSrc,imageSrc);});};Eviivo.LogLocation=function(ctrl){Eviivo.Distribution.Presentation.LocationServiceProxy.LogLocation(document.location.href,ctrl.href);};Eviivo.LogUserEvent=function(ctrl){Eviivo.Distribution.Presentation.LocationServiceProxy.LogUserEvent('LinkClicked',ctrl.href);};Type.registerNamespace('Eviivo.Supplements');Eviivo.Supplements=function Eviivo$Supplements(controls,totalID,crate,format){var e=Function._validateParams(arguments,[{name:"controls",type:Object},{name:"totalID",type:String},{name:"crate",type:Number},{name:"format",type:String}]);if(e)throw e;this._totalElement=null;this._changeHandler=null;this._controls=null;this._crate=null;this._format=null;this.init(controls,totalID,crate,format);};Eviivo.Supplements.Instance=null;Eviivo.Supplements.prototype={init:function Eviivo$Supplements$init(controls,totalID,crate,format){this._totalElement=$get(totalID);this._controls=controls;this._crate=new Number(crate);this._format=format;if(this._totalElement&&controls.length){this._changeHandler=Function.createDelegate(this,this.calculatePrice);for(var i=0;i<this._controls.length;i++){this.initCheckbox(this._controls[i]);} this.calculatePrice();}},initCheckbox:function Eviivo$Supplements$initCheckbox(control){var e=Function._validateParams(control,[{name:"checkboxID",type:String},{name:"subtotalID",type:String},{name:"price",type:Number},{name:"quantityID",type:String,mayBeNull:true,optional:true}]);if(e)throw e;control.checkboxElement=$get(control.checkboxID);control.subtotalElement=$get(control.subtotalID);if(control.checkboxElement&&control.subtotalElement){$addHandler(control.checkboxElement,'click',this._changeHandler);if(control.quantityID){control.quantityElement=$get(control.quantityID);if(control.quantityElement){$addHandler(control.quantityElement,'change',this._changeHandler);}}}},calculatePrice:function Eviivo$Supplements$calculatePrice(){var total=new Number(0);var subtotal=new Number(0);var control=null;for(var i=0;i<this._controls.length;i++){control=this._controls[i];subtotal=this.calculateSinglePrice(control);control.subtotalElement.innerHTML=String.format(this._format,subtotal);total+=(control.checkboxElement.checked===true)?subtotal:new Number(0);} control=null;this._totalElement.innerHTML=String.format(this._format,total);},calculateSinglePrice:function Eviivo$Supplements$calculateSinglePrice(control){var quantity=1;if(control.quantityElement){quantity=parseInt(control.quantityElement.item(control.quantityElement.selectedIndex).value,0);} return new Number((control.price*quantity*this._crate).toFixed(2));},dispose:function Eviivo$Supplements$dispose(){if(this._checkboxElements.length>0){var control=null;for(var i=0;i<this._controls.length;i++){control=this._controls[i];$removeHandler(control.checkboxElement,'click',this._changeHandler);control.checkboxElement=null;control.subtotalElement=null;if(control.quantityElement){$removeHandler(control.quantityElement,'change',this._changeHandler);control.quantityElement=null;}}} this._totalElement=null;this._checkboxHandler=null;this._controls=null;Eviivo.Supplements.callBaseMethod(this,'dispose');}};Eviivo.Supplements.registerClass('Eviivo.Supplements',null,Sys.IDisposable);Eviivo.Supplements.create=Eviivo$Supplements$create=function(controls,totalID,crate,format){Sys.Application.add_load(function(){Eviivo.Supplements.Instance=new Eviivo.Supplements(controls,totalID,crate,format);});};Type.registerNamespace('Eviivo.AvailabilityMessages');Eviivo.AvailabilityMessages=function(containerId,triggersClassName,messagesElementId){this._triggersClassName=triggersClassName;this._container=$get(containerId);this._messagesElement=$get(messagesElementId);this._triggers=[];if(this._container&&this._messagesElement){var messagesElement=this._messagesElement.parentNode.removeChild(this._messagesElement);document.body.appendChild(messagesElement);var divs=this._container.getElementsByTagName('div');for(var i=0;i<divs.length;i++){if(divs[i].className==triggersClassName){var trigger=divs[i].parentNode;this._triggers.push(trigger);$addHandlers(trigger,{"mouseover":this._onMouseOver},this);$addHandlers(trigger,{"mouseout":this._onMouseOut},this);}}}};Eviivo.AvailabilityMessages.prototype={_onMouseOver:function(e){var target=e.target;if(target.tagName!="TD"){target=target.parentNode;} var bounds=Sys.UI.DomElement.getBounds(target);this._messagesElement.style.top=(bounds.y)+'px';this._messagesElement.style.left=(bounds.x+bounds.width)+'px';this._messagesElement.className="";},_onMouseOut:function(e){this._messagesElement.className="hidden";},dispose:function(){for(var i=0;i<this._triggers.length;i++){$clearHandlers(this._triggers[i]);} this._className=null;this._container=null;this._messagesElement=null;this._triggers=null;}};Eviivo.AvailabilityMessages.registerClass('Eviivo.AvailabilityMessages',null,Sys.IDisposable);Eviivo.AvailabilityMessages.create=Eviivo$AvailabilityMessages$create=function(containerId,triggersClassName,messagesElementId){Sys.Application.add_load(function(){Eviivo.AvailabilityMessages.Instance=new Eviivo.AvailabilityMessages(containerId,triggersClassName,messagesElementId);});};Eviivo.CheckCharLimit=function(element,charLimit){if(element.value.length>charLimit){element.value=element.value.substring(0,charLimit);}};Eviivo.SetCurrency=function(elementID){var element=$get(elementID);if(currentISOValue&&element){for(var i=0;i<=element.length-1;i++){var currencyValue=element.options[i].value;if(currencyValue==currentISOValue){element.selectedIndex=i;break;}}}};Eviivo.SetCurrency.registerClass('Eviivo.SetCurrency',null,Sys.IDisposable);Eviivo.SetCurrency.create=Eviivo$SetCurrency$create=function(elementID){Sys.Application.add_load(function(){Eviivo.SetCurrency.Instance=new Eviivo.SetCurrency(elementID);});};Eviivo.ShowRecentItemDivTag=function(groupNumber){var divTag;for(var i=1;i<=3;i++){divTag=document.getElementById('group'+i);if(divTag!==null){if(i==groupNumber){divTag.className='lastview_visible';} else{divTag.className='lastview_hidden';}}}};if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
// register namespace for localized resources used in javascript
Type.registerNamespace('Eviivo.ScriptResources');
Type.registerNamespace('Eviivo');Eviivo.ScriptResources={"LyteboxPrevious":"&laquo; Previous","InvalidAddress":"Address not found.","NavigateText":"More information &#187;","ToText":"{0} to {1}","GoogleMapPrintLink":"Click to print map","LyteboxPage":"Page {0} of {1}","LyteboxNext":"Next &raquo;","Calendar_Today":"Today: {0}","Close":"Close","MapDistanceMilesAway":"{0:n2} miles away","GoogleFindAddressButtonText":"Go","MapBestPrice":"From \u003cspan\u003e{0:c0}\u003c/span\u003e\u003cbr /\u003e(total stay)","GoogleFindAddressTitle":"Enter your postcode for driving directions to {0} : ","LanguageCode":"en","LyteboxClose":"CLOSE","LyteboxImage":"Image {0} of {1}","MapBestPriceFree":"Free Admission is available"};
var SearchControl={Latitude:'SearchControlLatitude',Longitude:'SearchControlLongitude',LocationAutocomplete:null};Type.registerNamespace('AjaxControlToolkit');AjaxControlToolkit.AutoCompleteBehavior=function(element){AjaxControlToolkit.AutoCompleteBehavior.initializeBase(this,[element]);this._servicePath=null;this._serviceMethod=null;this._contextKey=null;this._useContextKey=false;this._minimumPrefixLength=3;this._completionSetCount=10;this._completionInterval=1000;this._completionListElementID=null;this._completionListElement=null;this._textColor='windowtext';this._textBackground='window';this._popupBehavior=null;this._popupBehaviorHiddenHandler=null;this._onShowJson=null;this._onHideJson=null;this._timer=null;this._cache=null;this._currentPrefix=null;this._selectIndex=-1;this._focusHandler=null;this._blurHandler=null;this._bodyClickHandler=null;this._completionListBlurHandler=null;this._keyDownHandler=null;this._mouseDownHandler=null;this._mouseUpHandler=null;this._mouseOverHandler=null;this._tickHandler=null;this._enableCaching=true;this._flyoutHasFocus=false;this._textBoxHasFocus=false;this._completionListCssClass=null;this._completionListItemCssClass=null;this._highlightedItemCssClass=null;this._delimiterCharacters=null;this._firstRowSelected=false;this._webRequest=null;this._onLoadHandler=null;};AjaxControlToolkit.AutoCompleteBehavior.prototype={initialize:function(){AjaxControlToolkit.AutoCompleteBehavior.callBaseMethod(this,'initialize');$common.prepareHiddenElementForATDeviceUpdate();this._popupBehaviorHiddenHandler=Function.createDelegate(this,this._popupHidden);this._tickHandler=Function.createDelegate(this,this._onTimerTick);this._focusHandler=Function.createDelegate(this,this._onGotFocus);this._blurHandler=Function.createDelegate(this,this._onLostFocus);this._keyDownHandler=Function.createDelegate(this,this._onKeyDown);this._mouseDownHandler=Function.createDelegate(this,this._onListMouseDown);this._mouseUpHandler=Function.createDelegate(this,this._onListMouseUp);this._mouseOverHandler=Function.createDelegate(this,this._onListMouseOver);this._completionListBlurHandler=Function.createDelegate(this,this._onCompletionListBlur);this._bodyClickHandler=Function.createDelegate(this,this._onCompletionListBlur);this._onLoadHandler=Function.createDelegate(this,this._onLoad);this._timer=new Sys.Timer();this.initializeTimer(this._timer);var element=this.get_element();this.initializeTextBox(element);if(this._completionListElementID!==null)this._completionListElement=$get(this._completionListElementID);if(this._completionListElement==null){this._completionListElement=document.createElement('ul');this._completionListElement.id=this.get_id()+'_completionListElem';if(Sys.Browser.agent===Sys.Browser.Safari||(Sys.Browser.agent==Sys.Browser.InternetExplorer&&Sys.Browser.version==6)){document.body.appendChild(this._completionListElement);} else{element.parentNode.insertBefore(this._completionListElement,element.nextSibling);}} this.initializeCompletionList(this._completionListElement);this._popupBehavior=$create(AjaxControlToolkit.PopupBehavior,{'id':this.get_id()+'PopupBehavior','parentElement':element,"positioningMode":AjaxControlToolkit.PositioningMode.BottomLeft},null,null,this._completionListElement);this._popupBehavior.add_hidden(this._popupBehaviorHiddenHandler);if(this._onShowJson){this._popupBehavior.set_onShow(this._onShowJson);} if(this._onHideJson){this._popupBehavior.set_onHide(this._onHideJson);} this._cleanDependentFields();Sys.Application.add_load(this._onLoadHandler);},_onLoad:function(){var element=this.get_element();if(document.activeElement!=null&&element.id==document.activeElement.id){this._onGotFocus();this._currentPrefix=element.value;this._hideCompletionList();if(element.value!=''&&element.value.length>this._minimumPrefixLength){var oldValue=element.value;element.value=oldValue.substring(0,this._minimumPrefixLength);this._tickHandler();element.value=oldValue;}}},dispose:function(){this._onShowJson=null;this._onHideJson=null;if(this._popupBehavior){if(this._popupBehaviorHiddenHandler){this._popupBehavior.remove_hidden(this._popupBehaviorHiddenHandler);} this._popupBehavior.dispose();this._popupBehavior=null;} if(this._timer){this._timer.dispose();this._timer=null;} var element=this.get_element();if(element){$removeHandler(element,"focus",this._focusHandler);$removeHandler(element,"blur",this._blurHandler);$removeHandler(element,"keydown",this._keyDownHandler);$removeHandler(this._completionListElement,'blur',this._completionListBlurHandler);$removeHandler(this._completionListElement,'mousedown',this._mouseDownHandler);$removeHandler(this._completionListElement,'mouseup',this._mouseUpHandler);$removeHandler(this._completionListElement,'mouseover',this._mouseOverHandler);} if(this._bodyClickHandler){$removeHandler(document.body,'click',this._bodyClickHandler);this._bodyClickHandler=null;} this._popupBehaviorHiddenHandler=null;this._tickHandler=null;this._focusHandler=null;this._blurHandler=null;this._keyDownHandler=null;this._completionListBlurHandler=null;this._mouseDownHandler=null;this._mouseUpHandler=null;this._mouseOverHandler=null;this._onLoadHandler=null;AjaxControlToolkit.AutoCompleteBehavior.callBaseMethod(this,'dispose');},initializeTimer:function(timer){timer.set_interval(this._completionInterval);timer.add_tick(this._tickHandler);},initializeTextBox:function(element){element.autocomplete="off";$addHandler(element,"focus",this._focusHandler);$addHandler(element,"blur",this._blurHandler);$addHandler(element,"keydown",this._keyDownHandler);},initializeCompletionList:function(element){if(this._completionListCssClass){Sys.UI.DomElement.addCssClass(element,this._completionListCssClass);} else{var completionListStyle=element.style;completionListStyle.textAlign='left';completionListStyle.visibility='hidden';completionListStyle.cursor='default';completionListStyle.listStyle='none';completionListStyle.padding='0px';completionListStyle.margin='0px! important';if(Sys.Browser.agent===Sys.Browser.Safari){completionListStyle.border='solid 1px gray';completionListStyle.backgroundColor='white';completionListStyle.color='black';} else{completionListStyle.border='solid 1px buttonshadow';completionListStyle.backgroundColor=this._textBackground;completionListStyle.color=this._textColor;}} $addHandler(element,"mousedown",this._mouseDownHandler);$addHandler(element,"mouseup",this._mouseUpHandler);$addHandler(element,"mouseover",this._mouseOverHandler);$addHandler(element,"blur",this._completionListBlurHandler);$addHandler(document.body,'click',this._bodyClickHandler);},_currentCompletionWord:function(){var element=this.get_element();var elementValue=element.value;var word=elementValue;if(this.get_isMultiWord()){var startIndex=this._getCurrentWordStartIndex();var endIndex=this._getCurrentWordEndIndex(startIndex);if(endIndex<=startIndex){word=elementValue.substring(startIndex);} else{word=elementValue.substring(startIndex,endIndex);}} return word.toLowerCase();},_getCursorIndex:function(){return this.get_element().selectionStart;},_getCurrentWordStartIndex:function(){var element=this.get_element();var elementText=element.value.substring(0,this._getCursorIndex());var index=0;var lastIndex=-1;for(var i=0;i<this._delimiterCharacters.length;++i){var curIndex=elementText.lastIndexOf(this._delimiterCharacters.charAt(i));if(curIndex>lastIndex){lastIndex=curIndex;}} index=lastIndex;if(index>=this._getCursorIndex()){index=0;} return index<0?0:index+1;},_getCurrentWordEndIndex:function(wordStartIndex){var element=this.get_element();var elementText=element.value.substring(wordStartIndex);var index=0;for(var i=0;i<this._delimiterCharacters.length;++i){var curIndex=elementText.indexOf(this._delimiterCharacters.charAt(i));if(curIndex>0&&(curIndex<index||index==0)){index=curIndex;}} return index<=0?element.value.length:index+wordStartIndex;},get_isMultiWord:function(){return(this._delimiterCharacters!=null)&&(this._delimiterCharacters!='');},_getTextWithInsertedWord:function(wordToInsert){var text=wordToInsert;var replaceIndex=0;var element=this.get_element();var originalText=element.value;if(this.get_isMultiWord()){var startIndex=this._getCurrentWordStartIndex();var endIndex=this._getCurrentWordEndIndex(startIndex);var prefix='';var suffix='';if(startIndex>0){prefix=originalText.substring(0,startIndex);} if(endIndex>startIndex){suffix=originalText.substring(endIndex);} text=prefix+wordToInsert+suffix;} return text;},_hideCompletionList:function(){var eventArgs=new Sys.CancelEventArgs();this.raiseHiding(eventArgs);if(eventArgs.get_cancel()){return;} this.hidePopup();},showPopup:function(){this._popupBehavior.show();this.raiseShown(Sys.EventArgs.Empty);},hidePopup:function(){if(this._popupBehavior){this._popupBehavior.hide();} else{this._popupHidden();}},_popupHidden:function(){this._completionListElement.innerHTML='';this._selectIndex=-1;this._flyoutHasFocus=false;this.raiseHidden(Sys.EventArgs.Empty);},_highlightItem:function(item){var children=this._completionListElement.childNodes;for(var i=0;i<children.length;i++){var child=children[i];if(child._highlighted){if(this._completionListItemCssClass){Sys.UI.DomElement.removeCssClass(child,this._highlightedItemCssClass);Sys.UI.DomElement.addCssClass(child,this._completionListItemCssClass);} else{if(Sys.Browser.agent===Sys.Browser.Safari){child.style.backgroundColor='white';child.style.color='black';} else{child.style.backgroundColor=this._textBackground;child.style.color=this._textColor;}} this.raiseItemOut(new AjaxControlToolkit.AutoCompleteItemEventArgs(child,child.firstChild.nodeValue,child._value));}} if(this._highlightedItemCssClass){Sys.UI.DomElement.removeCssClass(item,this._completionListItemCssClass);Sys.UI.DomElement.addCssClass(item,this._highlightedItemCssClass);} else{if(Sys.Browser.agent===Sys.Browser.Safari){item.style.backgroundColor='lemonchiffon';} else{item.style.backgroundColor='highlight';item.style.color='highlighttext';}} item._highlighted=true;this.raiseItemOver(new AjaxControlToolkit.AutoCompleteItemEventArgs(item,item.firstChild.nodeValue,item._value));},_onCompletionListBlur:function(ev){this._hideCompletionList();},_onListMouseDown:function(ev){if(ev.target!==this._completionListElement){this._setText(ev.target);this._flyoutHasFocus=false;} else{this._flyoutHasFocus=true;}},_onListMouseUp:function(ev){this.get_element().focus();},_onListMouseOver:function(ev){var item=ev.target;if(item!==this._completionListElement){var children=this._completionListElement.childNodes;for(var i=0;i<children.length;++i){if(item===children[i]){this._highlightItem(item);this._selectIndex=i;break;}}}},_onGotFocus:function(ev){this._textBoxHasFocus=true;if(this._flyoutHasFocus){this._hideCompletionList();} if((this._minimumPrefixLength==0)&&(!this.get_element().value)){this._timer.set_enabled(true);}},_onKeyDown:function(ev){this._timer.set_enabled(false);this._textBoxHasFocus=true;var k=ev.keyCode?ev.keyCode:ev.rawEvent.keyCode;if(k===Sys.UI.Key.esc){this._hideCompletionList();ev.preventDefault();} else if(k===Sys.UI.Key.up){if(this._selectIndex>0){this._selectIndex--;this._handleScroll(this._completionListElement.childNodes[this._selectIndex],this._selectIndex);this._highlightItem(this._completionListElement.childNodes[this._selectIndex]);ev.stopPropagation();ev.preventDefault();}} else if(k===Sys.UI.Key.down){if(this._selectIndex<(this._completionListElement.childNodes.length-1)){this._selectIndex++;this._handleScroll(this._completionListElement.childNodes[this._selectIndex],this._selectIndex);this._highlightItem(this._completionListElement.childNodes[this._selectIndex]);ev.stopPropagation();ev.preventDefault();}} else if(k===Sys.UI.Key.enter){if(this._selectIndex!==-1){this._setText(this._completionListElement.childNodes[this._selectIndex]);ev.preventDefault();} else{this.hidePopup();}} else if(k===Sys.UI.Key.tab){if(this._selectIndex!==-1){this._setText(this._completionListElement.childNodes[this._selectIndex]);}} else{this._timer.set_enabled(true);}},_handleScroll:function(element,index){var flyout=this._completionListElement;var elemBounds=$common.getBounds(element);var numItems=this._completionListElement.childNodes.length;if(((elemBounds.height*index)-(flyout.clientHeight+flyout.scrollTop))>=0){flyout.scrollTop+=(((elemBounds.height*index)-(flyout.clientHeight+flyout.scrollTop))+elemBounds.height);} if(((elemBounds.height*(numItems-(index+1)))-(flyout.scrollHeight-flyout.scrollTop))>=0){flyout.scrollTop-=(((elemBounds.height*(numItems-(index+1)))-(flyout.scrollHeight-flyout.scrollTop))+elemBounds.height);} if(flyout.scrollTop%elemBounds.height!==0){if(((elemBounds.height*(index+1))-(flyout.clientHeight+flyout.scrollTop))>=0){flyout.scrollTop-=(flyout.scrollTop%elemBounds.height);} else{flyout.scrollTop+=(elemBounds.height-(flyout.scrollTop%elemBounds.height));}}},_handleFlyoutFocus:function(){if(!this._textBoxHasFocus){if(!this._flyoutHasFocus){if(this._webRequest){this._webRequest.get_executor().abort();this._webRequest=null;} this._hideCompletionList();var text=this.get_element().value;if(SearchControl.LocationAutocomplete!=text){this._cleanDependentFields();}} else{return;}}},_cleanDependentFields:function(){var field_latitude=$get(SearchControl.Latitude);var field_longitude=$get(SearchControl.Longitude);if(field_latitude){field_latitude.value='';} if(field_longitude){field_longitude.value='';}},_onLostFocus:function(){this._textBoxHasFocus=false;this._timer.set_enabled(false);window.setTimeout(Function.createDelegate(this,this._handleFlyoutFocus),500);},_onMethodComplete:function(result,context){this._webRequest=null;var separator=":";if(result&&result.length>0&&result[0].indexOf(separator)>0){var objects=[];var obj;for(var i=0;i<result.length;i++){obj=result[i].split(separator);objects.push({"DisplayName":obj[0],"Latitude":obj[1],"Longitude":obj[2]});} result=objects;obj=null;} this._update(context,result,true);},_onMethodFailed:function(err,response,context){this._webRequest=null;},_onTimerTick:function(sender,eventArgs){this._timer.set_enabled(false);if(this._servicePath&&this._serviceMethod){var text=this._currentCompletionWord();if(text.trim().length<this._minimumPrefixLength){this._currentPrefix=null;this._update('',null,false);return;} if((this._currentPrefix!==text)||((text=="")&&(this._minimumPrefixLength==0))){this._currentPrefix=text;var cacheKey=this._getCacheKey(text);if((text!="")&&this._cache&&this._cache[cacheKey]){var cachedResults=this._cache[cacheKey];var results=[];var value=null;var cachedResult=null;var text2=text.replace(/([.*+?^${}()|[\]\/\\])/g,'\\$1');var regExp=new RegExp(text2,"i");for(var i=0;i<cachedResults.length;i++){cachedResult=cachedResults[i];value=this._getDisplayText(cachedResult);if(regExp.test(value)){var commaIndex=value.indexOf(",");if(commaIndex>-1){if(value.toLowerCase().indexOf(text)<commaIndex){results.push(cachedResult);}} else{results.push(cachedResult);}}} cachedResults=null;cachedResult=null;this._update(text,results,false);return;} var eventArgs=new Sys.CancelEventArgs();this.raisePopulating(eventArgs);if(eventArgs.get_cancel()){return;} var params={prefixText:this._currentPrefix,count:this._completionSetCount};if(this._useContextKey){params.contextKey=this._contextKey;} if(this._webRequest&&this._currentPrefix<=this._minimumPrefixLength){this._webRequest.get_executor().abort();this._webRequest=null;} if(!this._webRequest){this._webRequest=Sys.Net.WebServiceProxy.invoke(this.get_servicePath(),this.get_serviceMethod(),true,params,Function.createDelegate(this,this._onMethodComplete),Function.createDelegate(this,this._onMethodFailed),text);$common.updateFormToRefreshATDeviceBuffer();}}}},_getCacheKey:function(text){return"_"+text.substring(0,this._minimumPrefixLength);},_getDisplayText:function(item){if(this._hasDisplayText(item)){return item.DisplayName;} else{return item;}},_hasDisplayText:function(item){return typeof(item)==='object'&&item.DisplayName;},_setText:function(item){if(item.tagName=="B")item=item.parentNode;var text=(item)?item._value:null;if(this._hasDisplayText(text)){var field_latitude=$get(SearchControl.Latitude);var field_longitude=$get(SearchControl.Longitude);if(field_latitude){field_latitude.value=text.Latitude;} if(field_longitude){field_longitude.value=text.Longitude;} text=this._getDisplayText(text);} SearchControl.LocationAutocomplete=text;this._timer.set_enabled(false);var element=this.get_element();var control=element.control;if(control&&control.set_text){control.set_text(text);$common.tryFireEvent(control,"change");} else{element.value=text;$common.tryFireEvent(element,"change");} this.raiseItemSelected(new AjaxControlToolkit.AutoCompleteItemEventArgs(item,text,item?item._value:null));this._currentPrefix=this._currentCompletionWord();this._hideCompletionList();},_update:function(prefixText,completionItems,cacheResults){if(cacheResults&&this.get_enableCaching()&&prefixText.length==this._minimumPrefixLength){if(!this._cache){this._cache={};} var cacheKey=this._getCacheKey(prefixText);this._cache[cacheKey]=completionItems;} if((!this._textBoxHasFocus)||(prefixText!=this._currentCompletionWord())){this._hideCompletionList();return;} if(completionItems&&completionItems.length){this._completionListElement.innerHTML='';this._selectIndex=-1;var _firstChild=null;var text=null;var value=null;for(var i=0;i<completionItems.length;i++){var itemElement=null;if(this._completionListElementID){itemElement=document.createElement('div');} else{itemElement=document.createElement('li');} if(_firstChild==null){_firstChild=itemElement;} var item=completionItems[i];value=item;text=this._getDisplayText(item);var index=text.toLowerCase().indexOf(prefixText.toLowerCase());if(index>0&&(text.substring(index-1,index)!=' '||text.substring(index-1,index)!='(')){if(text.substring(index-1,index)==' '){index=text.toLowerCase().indexOf(' '+prefixText.toLowerCase())+1;} if(text.substring(index-1,index)=='('){index=text.toLowerCase().indexOf('('+prefixText.toLowerCase())+1;}} var html=text.substring(0,index)+"<b>"+text.substring(index,index+prefixText.length)+"</b>"+text.substring(index+prefixText.length);itemElement.innerHTML=html;itemElement._value=value;itemElement.__item='';if(this._completionListItemCssClass){Sys.UI.DomElement.addCssClass(itemElement,this._completionListItemCssClass);} else{var itemElementStyle=itemElement.style;itemElementStyle.padding='0px';itemElementStyle.textAlign='left';itemElementStyle.textOverflow='ellipsis';if(Sys.Browser.agent===Sys.Browser.Safari){itemElementStyle.backgroundColor='white';itemElementStyle.color='black';} else{itemElementStyle.backgroundColor=this._textBackground;itemElementStyle.color=this._textColor;}} this._completionListElement.appendChild(itemElement);} var elementBounds=$common.getBounds(this.get_element());this._completionListElement.style.width=Math.max(1,elementBounds.width-2)+'px';this._completionListElement.scrollTop=0;this.raisePopulated(Sys.EventArgs.Empty);var eventArgs=new Sys.CancelEventArgs();this.raiseShowing(eventArgs);if(!eventArgs.get_cancel()){this.showPopup();if(this._firstRowSelected&&(_firstChild!=null)){this._highlightItem(_firstChild);this._selectIndex=0;}}} else{this._hideCompletionList();}},get_onShow:function(){return this._popupBehavior?this._popupBehavior.get_onShow():this._onShowJson;},set_onShow:function(value){if(this._popupBehavior){this._popupBehavior.set_onShow(value);} else{this._onShowJson=value;} this.raisePropertyChanged('onShow');},get_onShowBehavior:function(){return this._popupBehavior?this._popupBehavior.get_onShowBehavior():null;},onShow:function(){if(this._popupBehavior){this._popupBehavior.onShow();}},get_onHide:function(){return this._popupBehavior?this._popupBehavior.get_onHide():this._onHideJson;},set_onHide:function(value){if(this._popupBehavior){this._popupBehavior.set_onHide(value);} else{this._onHideJson=value;} this.raisePropertyChanged('onHide');},get_onHideBehavior:function(){return this._popupBehavior?this._popupBehavior.get_onHideBehavior():null;},onHide:function(){if(this._popupBehavior){this._popupBehavior.onHide();}},get_completionInterval:function(){return this._completionInterval;},set_completionInterval:function(value){if(this._completionInterval!=value){this._completionInterval=value;this.raisePropertyChanged('completionInterval');}},get_completionList:function(){return this._completionListElement;},set_completionList:function(value){if(this._completionListElement!=value){this._completionListElement=value;this.raisePropertyChanged('completionList');}},get_completionSetCount:function(){return this._completionSetCount;},set_completionSetCount:function(value){if(this._completionSetCount!=value){this._completionSetCount=value;this.raisePropertyChanged('completionSetCount');}},get_minimumPrefixLength:function(){return this._minimumPrefixLength;},set_minimumPrefixLength:function(value){if(this._minimumPrefixLength!=value){this._minimumPrefixLength=value;this.raisePropertyChanged('minimumPrefixLength');}},get_serviceMethod:function(){return this._serviceMethod;},set_serviceMethod:function(value){if(this._serviceMethod!=value){this._serviceMethod=value;this.raisePropertyChanged('serviceMethod');}},get_servicePath:function(){return this._servicePath;},set_servicePath:function(value){if(this._servicePath!=value){this._servicePath=value;this.raisePropertyChanged('servicePath');}},get_contextKey:function(){return this._contextKey;},set_contextKey:function(value){if(this._contextKey!=value){this._contextKey=value;this.set_useContextKey(true);this.raisePropertyChanged('contextKey');}},get_useContextKey:function(){return this._useContextKey;},set_useContextKey:function(value){if(this._useContextKey!=value){this._useContextKey=value;this.raisePropertyChanged('useContextKey');}},get_enableCaching:function(){return this._enableCaching;},set_enableCaching:function(value){if(this._enableCaching!=value){this._enableCaching=value;this.raisePropertyChanged('enableCaching');}},get_completionListElementID:function(){return this._completionListElementID;},set_completionListElementID:function(value){if(this._completionListElementID!=value){this._completionListElementID=value;this.raisePropertyChanged('completionListElementID');}},get_completionListCssClass:function(){return this._completionListCssClass;},set_completionListCssClass:function(value){if(this._completionListCssClass!=value){this._completionListCssClass=value;this.raisePropertyChanged('completionListCssClass');}},get_completionListItemCssClass:function(){return this._completionListItemCssClass;},set_completionListItemCssClass:function(value){if(this._completionListItemCssClass!=value){this._completionListItemCssClass=value;this.raisePropertyChanged('completionListItemCssClass');}},get_highlightedItemCssClass:function(){return this._highlightedItemCssClass;},set_highlightedItemCssClass:function(value){if(this._highlightedItemCssClass!=value){this._highlightedItemCssClass=value;this.raisePropertyChanged('highlightedItemCssClass');}},get_delimiterCharacters:function(){return this._delimiterCharacters;},set_delimiterCharacters:function(value){if(this._delimiterCharacters!=value){this._delimiterCharacters=value;this.raisePropertyChanged('delimiterCharacters');}},get_firstRowSelected:function(){return this._firstRowSelected;},set_firstRowSelected:function(value){if(this._firstRowSelected!=value){this._firstRowSelected=value;this.raisePropertyChanged('firstRowSelected');}},add_populating:function(handler){this.get_events().addHandler('populating',handler);},remove_populating:function(handler){this.get_events().removeHandler('populating',handler);},raisePopulating:function(eventArgs){var handler=this.get_events().getHandler('populating');if(handler){handler(this,eventArgs);}},add_populated:function(handler){this.get_events().addHandler('populated',handler);},remove_populated:function(handler){this.get_events().removeHandler('populated',handler);},raisePopulated:function(eventArgs){var handler=this.get_events().getHandler('populated');if(handler){handler(this,eventArgs);}},add_showing:function(handler){this.get_events().addHandler('showing',handler);},remove_showing:function(handler){this.get_events().removeHandler('showing',handler);},raiseShowing:function(eventArgs){var handler=this.get_events().getHandler('showing');if(handler){handler(this,eventArgs);}},add_shown:function(handler){this.get_events().addHandler('shown',handler);},remove_shown:function(handler){this.get_events().removeHandler('shown',handler);},raiseShown:function(eventArgs){var handler=this.get_events().getHandler('shown');if(handler){handler(this,eventArgs);}},add_hiding:function(handler){this.get_events().addHandler('hiding',handler);},remove_hiding:function(handler){this.get_events().removeHandler('hiding',handler);},raiseHiding:function(eventArgs){var handler=this.get_events().getHandler('hiding');if(handler){handler(this,eventArgs);}},add_hidden:function(handler){this.get_events().addHandler('hidden',handler);},remove_hidden:function(handler){this.get_events().removeHandler('hidden',handler);},raiseHidden:function(eventArgs){var handler=this.get_events().getHandler('hidden');if(handler){handler(this,eventArgs);}},add_itemSelected:function(handler){this.get_events().addHandler('itemSelected',handler);},remove_itemSelected:function(handler){this.get_events().removeHandler('itemSelected',handler);},raiseItemSelected:function(eventArgs){var handler=this.get_events().getHandler('itemSelected');if(handler){handler(this,eventArgs);}},add_itemOver:function(handler){this.get_events().addHandler('itemOver',handler);},remove_itemOver:function(handler){this.get_events().removeHandler('itemOver',handler);},raiseItemOver:function(eventArgs){var handler=this.get_events().getHandler('itemOver');if(handler){handler(this,eventArgs);}},add_itemOut:function(handler){this.get_events().addHandler('itemOut',handler);},remove_itemOut:function(handler){this.get_events().removeHandler('itemOut',handler);},raiseItemOut:function(eventArgs){var handler=this.get_events().getHandler('itemOut');if(handler){handler(this,eventArgs);}}};AjaxControlToolkit.AutoCompleteBehavior.registerClass('AjaxControlToolkit.AutoCompleteBehavior',AjaxControlToolkit.BehaviorBase);AjaxControlToolkit.AutoCompleteBehavior.descriptor={properties:[{name:'completionInterval',type:Number},{name:'completionList',isDomElement:true},{name:'completionListElementID',type:String},{name:'completionSetCount',type:Number},{name:'minimumPrefixLength',type:Number},{name:'serviceMethod',type:String},{name:'servicePath',type:String},{name:'enableCaching',type:Boolean}]};AjaxControlToolkit.AutoCompleteItemEventArgs=function(item,text,value){AjaxControlToolkit.AutoCompleteItemEventArgs.initializeBase(this);this._item=item;this._text=text;this._value=(value!==undefined)?value:null;};AjaxControlToolkit.AutoCompleteItemEventArgs.prototype={get_item:function(){return this._item;},set_item:function(value){this._item=value;},get_text:function(){return this._text;},set_text:function(value){this._text=value;},get_value:function(){return this._value;},set_value:function(value){this._value=value;}};AjaxControlToolkit.AutoCompleteItemEventArgs.registerClass('AjaxControlToolkit.AutoCompleteItemEventArgs',Sys.EventArgs);
Type.registerNamespace("AjaxControlToolkit");AjaxControlToolkit.CalendarBehavior=function(element){AjaxControlToolkit.CalendarBehavior.initializeBase(this,[element]);this._textbox=AjaxControlToolkit.TextBoxWrapper.get_Wrapper(element);this._format="d";this._cssClass="ajax__calendar";this._enabled=true;this._animated=false;this._buttonID=null;this._layoutRequested=0;this._layoutSuspended=false;this._button=null;this._popupMouseDown=false;this._selectedDate=null;this._visibleDate=null;this._todaysDate=null;this._firstDayOfWeek=AjaxControlToolkit.FirstDayOfWeek.Default;this._container=null;this._popupDiv=null;this._header=null;this._prevArrow=null;this._nextArrow=null;this._title=null;this._body=null;this._today=null;this._days=null;this._daysTable=null;this._daysTableHeader=null;this._daysTableHeaderRow=null;this._daysBody=null;this._months=null;this._monthsTable=null;this._monthsBody=null;this._years=null;this._yearsTable=null;this._yearsBody=null;this._popupPosition=AjaxControlToolkit.CalendarPosition.BottomLeft;this._popupBehavior=null;this._modeChangeAnimation=null;this._modeChangeMoveTopOrLeftAnimation=null;this._modeChangeMoveBottomOrRightAnimation=null;this._mode="days";this._selectedDateChanging=false;this._isOpen=false;this._isAnimating=false;this._width=170;this._height=139;this._modes={"days":null,"months":null,"years":null};this._modeOrder={"days":0,"months":1,"years":2};this._hourOffsetForDst=12;this._blur=new AjaxControlToolkit.DeferredOperation(1,this,this.blur);this._button$delegates={click:Function.createDelegate(this,this._button_onclick),keypress:Function.createDelegate(this,this._button_onkeypress),blur:Function.createDelegate(this,this._button_onblur)};this._element$delegates={change:Function.createDelegate(this,this._element_onchange),keypress:Function.createDelegate(this,this._element_onkeypress),click:Function.createDelegate(this,this._element_onclick),focus:Function.createDelegate(this,this._element_onfocus),blur:Function.createDelegate(this,this._element_onblur)};this._popup$delegates={mousedown:Function.createDelegate(this,this._popup_onmousedown),mouseup:Function.createDelegate(this,this._popup_onmouseup),drag:Function.createDelegate(this,this._popup_onevent),dragstart:Function.createDelegate(this,this._popup_onevent),select:Function.createDelegate(this,this._popup_onevent)};this._cell$delegates={mouseover:Function.createDelegate(this,this._cell_onmouseover),mouseout:Function.createDelegate(this,this._cell_onmouseout),click:Function.createDelegate(this,this._cell_onclick)};};AjaxControlToolkit.CalendarBehavior.prototype={get_animated:function(){return this._animated;},set_animated:function(value){if(this._animated!=value){this._animated=value;this.raisePropertyChanged("animated");}},get_enabled:function(){return this._enabled;},set_enabled:function(value){if(this._enabled!=value){this._enabled=value;this.raisePropertyChanged("enabled");}},get_button:function(){return this._button;},set_button:function(value){if(this._button!=value){if(this._button&&this.get_isInitialized()){$common.removeHandlers(this._button,this._button$delegates);} this._button=value;if(this._button&&this.get_isInitialized()){$addHandlers(this._button,this._button$delegates);} this.raisePropertyChanged("button");}},get_popupPosition:function(){return this._popupPosition;},set_popupPosition:function(value){if(this._popupPosition!=value){this._popupPosition=value;this.raisePropertyChanged('popupPosition');}},get_format:function(){return this._format;},set_format:function(value){if(this._format!=value){this._format=value;this.raisePropertyChanged("format");}},get_selectedDate:function(){if(this._selectedDate==null){var value=this._textbox.get_Value();if(value){value=this._parseTextValue(value);if(value){this._selectedDate=value.getDateOnly();}}} return this._selectedDate;},set_selectedDate:function(value){if(value&&(String.isInstanceOfType(value))&&(value.length!=0)){value=new Date(value);} if(value)value=value.getDateOnly();if(this._selectedDate!=value){this._selectedDate=value;this._selectedDateChanging=true;var text="";if(value){text=value.localeFormat(this._format);} if(text!=this._textbox.get_Value()){this._textbox.set_Value(text);this._fireChanged();} this._selectedDateChanging=false;this.invalidate();this.raisePropertyChanged("selectedDate");}},get_visibleDate:function(){return this._visibleDate;},set_visibleDate:function(value){if(value)value=value.getDateOnly();if(this._visibleDate!=value){this._switchMonth(value,!this._isOpen);this.raisePropertyChanged("visibleDate");}},get_isOpen:function(){return this._isOpen;},get_todaysDate:function(){if(this._todaysDate!=null){return this._todaysDate;} return new Date().getDateOnly();},set_todaysDate:function(value){if(value)value=value.getDateOnly();if(this._todaysDate!=value){this._todaysDate=value;this.invalidate();this.raisePropertyChanged("todaysDate");}},get_firstDayOfWeek:function(){return this._firstDayOfWeek;},set_firstDayOfWeek:function(value){if(this._firstDayOfWeek!=value){this._firstDayOfWeek=value;this.invalidate();this.raisePropertyChanged("firstDayOfWeek");}},get_cssClass:function(){return this._cssClass;},set_cssClass:function(value){if(this._cssClass!=value){if(this._cssClass&&this.get_isInitialized()){Sys.UI.DomElement.removeCssClass(this._container,this._cssClass);} this._cssClass=value;if(this._cssClass&&this.get_isInitialized()){Sys.UI.DomElement.addCssClass(this._container,this._cssClass);} this.raisePropertyChanged("cssClass");}},get_todayButton:function(){return this._today;},get_dayCell:function(row,col){if(this._daysBody){return this._daysBody.rows[row].cells[col].firstChild;} return null;},add_showing:function(handler){this.get_events().addHandler("showing",handler);},remove_showing:function(handler){this.get_events().removeHandler("showing",handler);},raiseShowing:function(eventArgs){var handler=this.get_events().getHandler('showing');if(handler){handler(this,eventArgs);}},add_shown:function(handler){this.get_events().addHandler("shown",handler);},remove_shown:function(handler){this.get_events().removeHandler("shown",handler);},raiseShown:function(){var handlers=this.get_events().getHandler("shown");if(handlers){handlers(this,Sys.EventArgs.Empty);}},add_hiding:function(handler){this.get_events().addHandler("hiding",handler);},remove_hiding:function(handler){this.get_events().removeHandler("hiding",handler);},raiseHiding:function(eventArgs){var handler=this.get_events().getHandler('hiding');if(handler){handler(this,eventArgs);}},add_hidden:function(handler){this.get_events().addHandler("hidden",handler);},remove_hidden:function(handler){this.get_events().removeHandler("hidden",handler);},raiseHidden:function(){var handlers=this.get_events().getHandler("hidden");if(handlers){handlers(this,Sys.EventArgs.Empty);}},add_dateSelectionChanged:function(handler){this.get_events().addHandler("dateSelectionChanged",handler);},remove_dateSelectionChanged:function(handler){this.get_events().removeHandler("dateSelectionChanged",handler);},raiseDateSelectionChanged:function(){var handlers=this.get_events().getHandler("dateSelectionChanged");if(handlers){handlers(this,Sys.EventArgs.Empty);}},initialize:function(){AjaxControlToolkit.CalendarBehavior.callBaseMethod(this,"initialize");var elt=this.get_element();$addHandlers(elt,this._element$delegates);if(this._button){$addHandlers(this._button,this._button$delegates);} this._modeChangeMoveTopOrLeftAnimation=new AjaxControlToolkit.Animation.LengthAnimation(null,null,null,"style",null,0,0,"px");this._modeChangeMoveBottomOrRightAnimation=new AjaxControlToolkit.Animation.LengthAnimation(null,null,null,"style",null,0,0,"px");this._modeChangeAnimation=new AjaxControlToolkit.Animation.ParallelAnimation(null,0.25,null,[this._modeChangeMoveTopOrLeftAnimation,this._modeChangeMoveBottomOrRightAnimation]);var value=this.get_selectedDate();if(value){this.set_selectedDate(value);}},dispose:function(){if(this._popupBehavior){this._popupBehavior.dispose();this._popupBehavior=null;} this._modes=null;this._modeOrder=null;if(this._modeChangeMoveTopOrLeftAnimation){this._modeChangeMoveTopOrLeftAnimation.dispose();this._modeChangeMoveTopOrLeftAnimation=null;} if(this._modeChangeMoveBottomOrRightAnimation){this._modeChangeMoveBottomOrRightAnimation.dispose();this._modeChangeMoveBottomOrRightAnimation=null;} if(this._modeChangeAnimation){this._modeChangeAnimation.dispose();this._modeChangeAnimation=null;} if(this._container){if(this._container.parentNode){this._container.parentNode.removeChild(this._container);} this._container=null;} if(this._popupDiv){$common.removeHandlers(this._popupDiv,this._popup$delegates);this._popupDiv=null;} if(this._prevArrow){$common.removeHandlers(this._prevArrow,this._cell$delegates);this._prevArrow=null;} if(this._nextArrow){$common.removeHandlers(this._nextArrow,this._cell$delegates);this._nextArrow=null;} if(this._title){$common.removeHandlers(this._title,this._cell$delegates);this._title=null;} if(this._today){$common.removeHandlers(this._today,this._cell$delegates);this._today=null;} if(this._button){$common.removeHandlers(this._button,this._button$delegates);this._button=null;} if(this._daysBody){for(var i=0;i<this._daysBody.rows.length;i++){var row=this._daysBody.rows[i];for(var j=0;j<row.cells.length;j++){$common.removeHandlers(row.cells[j].firstChild,this._cell$delegates);}} this._daysBody=null;} if(this._monthsBody){for(var i=0;i<this._monthsBody.rows.length;i++){var row=this._monthsBody.rows[i];for(var j=0;j<row.cells.length;j++){$common.removeHandlers(row.cells[j].firstChild,this._cell$delegates);}} this._monthsBody=null;} if(this._yearsBody){for(var i=0;i<this._yearsBody.rows.length;i++){var row=this._yearsBody.rows[i];for(var j=0;j<row.cells.length;j++){$common.removeHandlers(row.cells[j].firstChild,this._cell$delegates);}} this._yearsBody=null;} var elt=this.get_element();$common.removeHandlers(elt,this._element$delegates);AjaxControlToolkit.CalendarBehavior.callBaseMethod(this,"dispose");},show:function(){this._ensureCalendar();if(!this._isOpen){var eventArgs=new Sys.CancelEventArgs();this.raiseShowing(eventArgs);if(eventArgs.get_cancel()){return;} this._isOpen=true;this._switchMonth(null,true);this._popupBehavior.show();this.raiseShown();}},hide:function(){if(this._isOpen){var eventArgs=new Sys.CancelEventArgs();this.raiseHiding(eventArgs);if(eventArgs.get_cancel()){return;} if(this._container){this._popupBehavior.hide();this._switchMode("days",true);} this._isOpen=false;this.raiseHidden();this._popupMouseDown=false;}},focus:function(){if(this._button){this._button.focus();} else{this.get_element().focus();}},blur:function(force){if(!force&&Sys.Browser.agent===Sys.Browser.Opera){this._blur.post(true);} else{if(!this._popupMouseDown){this.hide();} this._popupMouseDown=false;}},suspendLayout:function(){this._layoutSuspended++;},resumeLayout:function(){this._layoutSuspended--;if(this._layoutSuspended<=0){this._layoutSuspended=0;if(this._layoutRequested){this._performLayout();}}},invalidate:function(){if(this._layoutSuspended>0){this._layoutRequested=true;} else{this._performLayout();}},_buildCalendar:function(){var elt=this.get_element();var id=this.get_id();this._container=$common.createElementFromTemplate({nodeName:"div",properties:{id:id+"_container"},cssClasses:[this._cssClass]},document.body);this._popupDiv=$common.createElementFromTemplate({nodeName:"div",events:this._popup$delegates,properties:{id:id+"_popupDiv"},cssClasses:["ajax__calendar_container"],visible:false},this._container);},_buildHeader:function(){var id=this.get_id();this._header=$common.createElementFromTemplate({nodeName:"div",properties:{id:id+"_header"},cssClasses:["ajax__calendar_header"]},this._popupDiv);var prevArrowWrapper=$common.createElementFromTemplate({nodeName:"div"},this._header);this._prevArrow=$common.createElementFromTemplate({nodeName:"div",properties:{id:id+"_prevArrow",mode:"prev"},events:this._cell$delegates,cssClasses:["ajax__calendar_prev"]},prevArrowWrapper);var nextArrowWrapper=$common.createElementFromTemplate({nodeName:"div"},this._header);this._nextArrow=$common.createElementFromTemplate({nodeName:"div",properties:{id:id+"_nextArrow",mode:"next"},events:this._cell$delegates,cssClasses:["ajax__calendar_next"]},nextArrowWrapper);var titleWrapper=$common.createElementFromTemplate({nodeName:"div"},this._header);this._title=$common.createElementFromTemplate({nodeName:"div",properties:{id:id+"_title",mode:"title"},events:this._cell$delegates,cssClasses:["ajax__calendar_title"]},titleWrapper);},_buildBody:function(){this._body=$common.createElementFromTemplate({nodeName:"div",properties:{id:this.get_id()+"_body"},cssClasses:["ajax__calendar_body"]},this._popupDiv);this._buildDays();this._buildMonths();this._buildYears();},_buildFooter:function(){var todayWrapper=$common.createElementFromTemplate({nodeName:"div"},this._popupDiv);this._today=$common.createElementFromTemplate({nodeName:"div",properties:{id:this.get_id()+"_today",mode:"today"},events:this._cell$delegates,cssClasses:["ajax__calendar_footer","ajax__calendar_today"]},todayWrapper);},_buildDays:function(){var dtf=Sys.CultureInfo.CurrentCulture.dateTimeFormat;var id=this.get_id();this._days=$common.createElementFromTemplate({nodeName:"div",properties:{id:id+"_days"},cssClasses:["ajax__calendar_days"]},this._body);this._modes["days"]=this._days;this._daysTable=$common.createElementFromTemplate({nodeName:"table",properties:{id:id+"_daysTable",cellPadding:0,cellSpacing:0,border:0,style:{margin:"auto"}}},this._days);this._daysTableHeader=$common.createElementFromTemplate({nodeName:"thead",properties:{id:id+"_daysTableHeader"}},this._daysTable);this._daysTableHeaderRow=$common.createElementFromTemplate({nodeName:"tr",properties:{id:id+"_daysTableHeaderRow"}},this._daysTableHeader);for(var i=0;i<7;i++){var dayCell=$common.createElementFromTemplate({nodeName:"td"},this._daysTableHeaderRow);var dayDiv=$common.createElementFromTemplate({nodeName:"div",cssClasses:["ajax__calendar_dayname"]},dayCell);} this._daysBody=$common.createElementFromTemplate({nodeName:"tbody",properties:{id:id+"_daysBody"}},this._daysTable);for(var i=0;i<6;i++){var daysRow=$common.createElementFromTemplate({nodeName:"tr"},this._daysBody);for(var j=0;j<7;j++){var dayCell=$common.createElementFromTemplate({nodeName:"td"},daysRow);var dayDiv=$common.createElementFromTemplate({nodeName:"div",properties:{mode:"day",id:id+"_day_"+i+"_"+j,innerHTML:"&nbsp;"},events:this._cell$delegates,cssClasses:["ajax__calendar_day"]},dayCell);}}},_buildMonths:function(){var dtf=Sys.CultureInfo.CurrentCulture.dateTimeFormat;var id=this.get_id();this._months=$common.createElementFromTemplate({nodeName:"div",properties:{id:id+"_months"},cssClasses:["ajax__calendar_months"],visible:false},this._body);this._modes["months"]=this._months;this._monthsTable=$common.createElementFromTemplate({nodeName:"table",properties:{id:id+"_monthsTable",cellPadding:0,cellSpacing:0,border:0,style:{margin:"auto"}}},this._months);this._monthsBody=$common.createElementFromTemplate({nodeName:"tbody",properties:{id:id+"_monthsBody"}},this._monthsTable);for(var i=0;i<3;i++){var monthsRow=$common.createElementFromTemplate({nodeName:"tr"},this._monthsBody);for(var j=0;j<4;j++){var monthCell=$common.createElementFromTemplate({nodeName:"td"},monthsRow);var monthDiv=$common.createElementFromTemplate({nodeName:"div",properties:{id:id+"_month_"+i+"_"+j,mode:"month",month:(i*4)+j,innerHTML:"<br />"+dtf.AbbreviatedMonthNames[(i*4)+j]},events:this._cell$delegates,cssClasses:["ajax__calendar_month"]},monthCell);}}},_buildYears:function(){var id=this.get_id();this._years=$common.createElementFromTemplate({nodeName:"div",properties:{id:id+"_years"},cssClasses:["ajax__calendar_years"],visible:false},this._body);this._modes["years"]=this._years;this._yearsTable=$common.createElementFromTemplate({nodeName:"table",properties:{id:id+"_yearsTable",cellPadding:0,cellSpacing:0,border:0,style:{margin:"auto"}}},this._years);this._yearsBody=$common.createElementFromTemplate({nodeName:"tbody",properties:{id:id+"_yearsBody"}},this._yearsTable);for(var i=0;i<3;i++){var yearsRow=$common.createElementFromTemplate({nodeName:"tr"},this._yearsBody);for(var j=0;j<4;j++){var yearCell=$common.createElementFromTemplate({nodeName:"td"},yearsRow);var yearDiv=$common.createElementFromTemplate({nodeName:"div",properties:{id:id+"_year_"+i+"_"+j,mode:"year",year:((i*4)+j)-1},events:this._cell$delegates,cssClasses:["ajax__calendar_year"]},yearCell);}}},_changeCssClass:function(dayCell,part){$common.removeCssClasses(dayCell.parentNode,["ajax__calendar_other","ajax__calendar_active","ajax__calendar_active_today","ajax__calendar_past"]);Sys.UI.DomElement.addCssClass(dayCell.parentNode,this._getCssClass(dayCell.date,part));},_performLayout:function(){var elt=this.get_element();if(!elt)return;if(!this.get_isInitialized())return;if(!this._isOpen)return;var dtf=Sys.CultureInfo.CurrentCulture.dateTimeFormat;var selectedDate=this.get_selectedDate();var visibleDate=this._getEffectiveVisibleDate();var todaysDate=this.get_todaysDate();this._prevArrow.style.display="block";this._nextArrow.style.display="block";switch(this._mode){case"days":var firstDayOfWeek=this._getFirstDayOfWeek();var daysToBacktrack=visibleDate.getDay()-firstDayOfWeek;if(daysToBacktrack<=0)daysToBacktrack+=7;var startDate=new Date(visibleDate.getFullYear(),visibleDate.getMonth(),visibleDate.getDate()-daysToBacktrack,this._hourOffsetForDst);var currentDate=startDate;for(var i=0;i<7;i++){var dayCell=this._daysTableHeaderRow.cells[i].firstChild;if(dayCell.firstChild){dayCell.removeChild(dayCell.firstChild);} dayCell.appendChild(document.createTextNode(dtf.ShortestDayNames[(i+firstDayOfWeek)%7]));} for(var week=0;week<6;week++){var weekRow=this._daysBody.rows[week];for(var dayOfWeek=0;dayOfWeek<7;dayOfWeek++){var dayCell=weekRow.cells[dayOfWeek].firstChild;if(dayCell.firstChild){dayCell.removeChild(dayCell.firstChild);} dayCell.appendChild(document.createTextNode(currentDate.getDate()));dayCell.title=currentDate.localeFormat("D");dayCell.date=currentDate;this._changeCssClass(dayCell,'d');currentDate=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()+1,this._hourOffsetForDst);}} this._prevArrow.date=new Date(visibleDate.getFullYear(),visibleDate.getMonth()-1,1,this._hourOffsetForDst);this._nextArrow.date=new Date(visibleDate.getFullYear(),visibleDate.getMonth()+1,1,this._hourOffsetForDst);if(this._title.firstChild){this._title.removeChild(this._title.firstChild);} this._title.appendChild(document.createTextNode(visibleDate.localeFormat("MMMM, yyyy")));this._title.date=visibleDate;break;case"months":for(var i=0;i<this._monthsBody.rows.length;i++){var row=this._monthsBody.rows[i];for(var j=0;j<row.cells.length;j++){var cell=row.cells[j].firstChild;cell.date=new Date(visibleDate.getFullYear(),cell.month,1,this._hourOffsetForDst);cell.title=cell.date.localeFormat("Y");this._changeCssClass(cell,'M');}} if(this._title.firstChild){this._title.removeChild(this._title.firstChild);} this._title.appendChild(document.createTextNode(visibleDate.localeFormat("yyyy")));this._title.date=visibleDate;this._prevArrow.date=new Date(visibleDate.getFullYear()-1,0,1,this._hourOffsetForDst);this._nextArrow.date=new Date(visibleDate.getFullYear()+1,0,1,this._hourOffsetForDst);break;case"years":var minYear=todaysDate.getFullYear();for(var i=0;i<this._yearsBody.rows.length;i++){var row=this._yearsBody.rows[i];for(var j=0;j<row.cells.length;j++){var cell=row.cells[j].firstChild;cell.date=new Date(minYear+cell.year,0,1,this._hourOffsetForDst);if(cell.firstChild){cell.removeChild(cell.lastChild);} else{cell.appendChild(document.createElement("br"));} cell.appendChild(document.createTextNode(minYear+cell.year));this._changeCssClass(cell,'y');}} if(this._title.firstChild){this._title.removeChild(this._title.firstChild);} this._title.appendChild(document.createTextNode(minYear.toString()+"-"+(minYear+9).toString()));this._title.date=visibleDate;this._prevArrow.date=new Date(minYear-10,0,1,this._hourOffsetForDst);this._nextArrow.date=new Date(minYear+10,0,1,this._hourOffsetForDst);this._prevArrow.style.display="none";this._nextArrow.style.display="none";break;} if(this._today.firstChild){this._today.removeChild(this._today.firstChild);} this._today.appendChild(document.createTextNode(String.format(Eviivo.ScriptResources.Calendar_Today,todaysDate.localeFormat("MMMM d, yyyy"))));this._today.date=todaysDate;},_ensureCalendar:function(){if(!this._container){var elt=this.get_element();this._buildCalendar();this._buildHeader();this._buildBody();this._buildFooter();this._popupBehavior=new $create(AjaxControlToolkit.PopupBehavior,{parentElement:elt},{},{},this._popupDiv);if(this._popupPosition==AjaxControlToolkit.CalendarPosition.TopLeft){this._popupBehavior.set_positioningMode(AjaxControlToolkit.PositioningMode.TopLeft);} else if(this._popupPosition==AjaxControlToolkit.CalendarPosition.TopRight){this._popupBehavior.set_positioningMode(AjaxControlToolkit.PositioningMode.TopRight);} else if(this._popupPosition==AjaxControlToolkit.CalendarPosition.BottomRight){this._popupBehavior.set_positioningMode(AjaxControlToolkit.PositioningMode.BottomRight);} else if(this._popupPosition==AjaxControlToolkit.CalendarPosition.Right){this._popupBehavior.set_positioningMode(AjaxControlToolkit.PositioningMode.Right);} else if(this._popupPosition==AjaxControlToolkit.CalendarPosition.Left){this._popupBehavior.set_positioningMode(AjaxControlToolkit.PositioningMode.Left);} else{this._popupBehavior.set_positioningMode(AjaxControlToolkit.PositioningMode.BottomLeft);}}},_fireChanged:function(){var elt=this.get_element();if(document.createEventObject){elt.fireEvent("onchange");} else if(document.createEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",true,true);elt.dispatchEvent(e);}},_switchMonth:function(date,dontAnimate){if(this._isAnimating){return;} var visibleDate=this._getEffectiveVisibleDate();if((date&&date.getFullYear()==visibleDate.getFullYear()&&date.getMonth()==visibleDate.getMonth())){dontAnimate=true;} if(this._animated&&!dontAnimate){this._isAnimating=true;var newElement=this._modes[this._mode];var oldElement=newElement.cloneNode(true);this._body.appendChild(oldElement);if(visibleDate>date){$common.setLocation(newElement,{x:-162,y:0});$common.setVisible(newElement,true);this._modeChangeMoveTopOrLeftAnimation.set_propertyKey("left");this._modeChangeMoveTopOrLeftAnimation.set_target(newElement);this._modeChangeMoveTopOrLeftAnimation.set_startValue(-this._width);this._modeChangeMoveTopOrLeftAnimation.set_endValue(0);$common.setLocation(oldElement,{x:0,y:0});$common.setVisible(oldElement,true);this._modeChangeMoveBottomOrRightAnimation.set_propertyKey("left");this._modeChangeMoveBottomOrRightAnimation.set_target(oldElement);this._modeChangeMoveBottomOrRightAnimation.set_startValue(0);this._modeChangeMoveBottomOrRightAnimation.set_endValue(this._width);} else{$common.setLocation(oldElement,{x:0,y:0});$common.setVisible(oldElement,true);this._modeChangeMoveTopOrLeftAnimation.set_propertyKey("left");this._modeChangeMoveTopOrLeftAnimation.set_target(oldElement);this._modeChangeMoveTopOrLeftAnimation.set_endValue(-this._width);this._modeChangeMoveTopOrLeftAnimation.set_startValue(0);$common.setLocation(newElement,{x:162,y:0});$common.setVisible(newElement,true);this._modeChangeMoveBottomOrRightAnimation.set_propertyKey("left");this._modeChangeMoveBottomOrRightAnimation.set_target(newElement);this._modeChangeMoveBottomOrRightAnimation.set_endValue(0);this._modeChangeMoveBottomOrRightAnimation.set_startValue(this._width);} this._visibleDate=date;this.invalidate();var endHandler=Function.createDelegate(this,function(){this._body.removeChild(oldElement);oldElement=null;this._isAnimating=false;this._modeChangeAnimation.remove_ended(endHandler);});this._modeChangeAnimation.add_ended(endHandler);this._modeChangeAnimation.play();} else{this._visibleDate=date;this.invalidate();}},_switchMode:function(mode,dontAnimate){if(this._isAnimating||(this._mode==mode)){return;} var moveDown=this._modeOrder[this._mode]<this._modeOrder[mode];var oldElement=this._modes[this._mode];var newElement=this._modes[mode];this._mode=mode;if(this._animated&&!dontAnimate){this._isAnimating=true;this.invalidate();if(moveDown){$common.setLocation(newElement,{x:0,y:-this._height});$common.setVisible(newElement,true);this._modeChangeMoveTopOrLeftAnimation.set_propertyKey("top");this._modeChangeMoveTopOrLeftAnimation.set_target(newElement);this._modeChangeMoveTopOrLeftAnimation.set_startValue(-this._height);this._modeChangeMoveTopOrLeftAnimation.set_endValue(0);$common.setLocation(oldElement,{x:0,y:0});$common.setVisible(oldElement,true);this._modeChangeMoveBottomOrRightAnimation.set_propertyKey("top");this._modeChangeMoveBottomOrRightAnimation.set_target(oldElement);this._modeChangeMoveBottomOrRightAnimation.set_startValue(0);this._modeChangeMoveBottomOrRightAnimation.set_endValue(this._height);} else{$common.setLocation(oldElement,{x:0,y:0});$common.setVisible(oldElement,true);this._modeChangeMoveTopOrLeftAnimation.set_propertyKey("top");this._modeChangeMoveTopOrLeftAnimation.set_target(oldElement);this._modeChangeMoveTopOrLeftAnimation.set_endValue(-this._height);this._modeChangeMoveTopOrLeftAnimation.set_startValue(0);$common.setLocation(newElement,{x:0,y:139});$common.setVisible(newElement,true);this._modeChangeMoveBottomOrRightAnimation.set_propertyKey("top");this._modeChangeMoveBottomOrRightAnimation.set_target(newElement);this._modeChangeMoveBottomOrRightAnimation.set_endValue(0);this._modeChangeMoveBottomOrRightAnimation.set_startValue(this._height);} var endHandler=Function.createDelegate(this,function(){this._isAnimating=false;this._modeChangeAnimation.remove_ended(endHandler);});this._modeChangeAnimation.add_ended(endHandler);this._modeChangeAnimation.play();} else{this._mode=mode;$common.setVisible(oldElement,false);this.invalidate();$common.setVisible(newElement,true);$common.setLocation(newElement,{x:0,y:0});}},_isSelected:function(date,part){var value=this.get_selectedDate();if(!value)return false;switch(part){case'd':if(date.getDate()!=value.getDate())return false;case'M':if(date.getMonth()!=value.getMonth())return false;case'y':if(date.getFullYear()!=value.getFullYear())return false;break;} return true;},_isOther:function(date,part){var value=this._getEffectiveVisibleDate();switch(part){case'd':return(date.getFullYear()!=value.getFullYear()||date.getMonth()!=value.getMonth());case'M':return false;case'y':var minYear=(Math.floor(value.getFullYear()/10)*10);return date.getFullYear()<minYear||(minYear+10)<=date.getFullYear();} return false;},_isToday:function(date,part){var today=new Date();switch(part){case'd':return(date.getFullYear()==today.getFullYear()&&date.getMonth()==today.getMonth()&&date.getDate()==today.getDate());case'M':return(date.getFullYear()==today.getFullYear()&&date.getMonth()==today.getMonth());case'y':return(date.getFullYear()==today.getFullYear());} return false;},_isPast:function(date,part){var today=new Date();switch(part){case'd':return(date.getFullYear()<today.getFullYear()||date.getFullYear()==today.getFullYear()&&date.getMonth()<today.getMonth()||date.getFullYear()==today.getFullYear()&&date.getMonth()==today.getMonth()&&date.getDate()<today.getDate());case'M':return(date.getFullYear()<today.getFullYear()||date.getFullYear()==today.getFullYear()&&date.getMonth()<today.getMonth());case'y':return(date.getFullYear()<today.getFullYear());} return false;},_getCssClass:function(date,part){if(this._isPast(date,part)){return"ajax__calendar_past";} else if(this._isToday(date,part)){return"ajax__calendar_active_today";} else if(this._isSelected(date,part)){return"ajax__calendar_active";} else if(this._isOther(date,part)){return"ajax__calendar_other";} else{return"";}},_getEffectiveVisibleDate:function(){var value=this.get_visibleDate();if(value==null)value=this.get_selectedDate();if(value==null)value=this.get_todaysDate();return new Date(value.getFullYear(),value.getMonth(),1,this._hourOffsetForDst);},_getFirstDayOfWeek:function(){if(this.get_firstDayOfWeek()!=AjaxControlToolkit.FirstDayOfWeek.Default){return this.get_firstDayOfWeek();} return Sys.CultureInfo.CurrentCulture.dateTimeFormat.FirstDayOfWeek;},_parseTextValue:function(text){var value=null;if(text){value=Date.parseLocale(text,this.get_format());} if(isNaN(value)){value=null;} return value;},_element_onfocus:function(e){if(!this._enabled)return;if(!this._button){this.show();this._popupMouseDown=false;}},_element_onblur:function(e){if(!this._enabled)return;if(!this._button){this.blur();}},_element_onchange:function(e){if(!this._selectedDateChanging){var value=this._parseTextValue(this._textbox.get_Value());if(value)value=value.getDateOnly();this._selectedDate=value;if(this._isOpen){this._switchMonth(this._selectedDate,this._selectedDate==null);}}},_element_onkeypress:function(e){if(!this._enabled)return;if(!this._button&&e.charCode==Sys.UI.Key.esc){e.stopPropagation();e.preventDefault();this.hide();}},_element_onclick:function(e){if(!this._enabled)return;if(!this._button){this.show();this._popupMouseDown=false;}},_popup_onevent:function(e){e.stopPropagation();e.preventDefault();},_popup_onmousedown:function(e){this._popupMouseDown=true;},_popup_onmouseup:function(e){if(Sys.Browser.agent===Sys.Browser.Opera&&this._blur.get_isPending()){this._blur.cancel();} this._popupMouseDown=false;this.focus();},_cell_onmouseover:function(e){e.stopPropagation();if(Sys.Browser.agent===Sys.Browser.Safari){for(var i=0;i<this._daysBody.rows.length;i++){var row=this._daysBody.rows[i];for(var j=0;j<row.cells.length;j++){Sys.UI.DomElement.removeCssClass(row.cells[j].firstChild.parentNode,"ajax__calendar_hover");}}} var target=e.target;Sys.UI.DomElement.addCssClass(target.parentNode,"ajax__calendar_hover");},_cell_onmouseout:function(e){e.stopPropagation();var target=e.target;Sys.UI.DomElement.removeCssClass(target.parentNode,"ajax__calendar_hover");},_cell_onclick:function(e){e.stopPropagation();e.preventDefault();if(!this._enabled)return;var target=e.target;var visibleDate=this._getEffectiveVisibleDate();Sys.UI.DomElement.removeCssClass(target.parentNode,"ajax__calendar_hover");switch(target.mode){case"prev":case"next":this._switchMonth(target.date);break;case"title":switch(this._mode){case"days":this._switchMode("months");break;case"months":this._switchMode("years");break;} break;case"month":if(this._isPast(target.date,'M'))return;if(target.month==visibleDate.getMonth()){this._switchMode("days");} else{this._visibleDate=target.date;this._switchMode("days");} break;case"year":if(this._isPast(target.date,'y'))return;if(target.date.getFullYear()==visibleDate.getFullYear()){this._switchMode("months");} else{this._visibleDate=target.date;this._switchMode("months");} break;case"day":if(this._isPast(target.date,'d'))return;this.set_selectedDate(target.date);this._switchMonth(target.date);this._blur.post(true);this.raiseDateSelectionChanged();break;case"today":this.set_selectedDate(target.date);this._switchMonth(target.date);this._blur.post(true);this.raiseDateSelectionChanged();break;}},_button_onclick:function(e){e.preventDefault();e.stopPropagation();if(!this._enabled)return;if(!this._isOpen){this.show();} else{this.hide();} this.focus();this._popupMouseDown=false;},_button_onblur:function(e){if(!this._enabled)return;if(!this._popupMouseDown){this.hide();} this._popupMouseDown=false;},_button_onkeypress:function(e){if(!this._enabled)return;if(e.charCode==Sys.UI.Key.esc){e.stopPropagation();e.preventDefault();this.hide();} this._popupMouseDown=false;}};AjaxControlToolkit.CalendarBehavior.registerClass("AjaxControlToolkit.CalendarBehavior",AjaxControlToolkit.BehaviorBase);AjaxControlToolkit.CalendarPosition=function(){throw Error.invalidOperation();};AjaxControlToolkit.CalendarPosition.prototype={BottomLeft:0,BottomRight:1,TopLeft:2,TopRight:3,Right:4,Left:5};AjaxControlToolkit.CalendarPosition.registerEnum('AjaxControlToolkit.CalendarPosition');
Type.registerNamespace('Eviivo.Controls');Eviivo.Controls.GoogleMap=function(elementID,latitude,longitude,config){var e=Function._validateParams(arguments,[{name:"elementID",type:String,mayBeNull:true},{name:"latitude",type:Number},{name:"longitude",type:Number},{name:"config",type:Object}]);if(e)throw e;Eviivo.Controls.GoogleMap.ImagesPrefix=config.ApplicationUrl+"Images/Markers/";Eviivo.Controls.GoogleMap.MaxRatingNumber=config.MaxRatingNumber;Eviivo.Controls.GoogleMap.ProviderBaseUrl=config.ProviderBaseUrl;Eviivo.Controls.GoogleMap.IsTSU=config.IsTSUEnvironment;Eviivo.Controls.GoogleMap.Zoom=15;Eviivo.Controls.GoogleMap.ZoomPopUp=13;Eviivo.Controls.GoogleMap.Category={Icons:{Undefined:{image:"marker.png",shadow:"shadow50.png",transparent:"markerTransparent.png",width:20,height:34},OriginalLocation:{image:"arrow.png",shadow:"arrowshadow.png",transparent:"arrowtransparent.png",width:39,height:34},ActiveProvider:{image:"arrow.png",shadow:"arrowshadow.png",transparent:"arrowtransparent.png",width:39,height:34},NearbyProvider:{image:"marker.png",shadow:"shadow50.png",transparent:"markerTransparent.png",width:20,height:34},AvailableProvider:{image:"marker.png",shadow:"shadow50.png",transparent:"markerTransparent.png",width:20,height:34},NonAvailableProvider:{image:"marker_gray.png",shadow:"shadow50.png",transparent:"markerTransparent.png",width:20,height:34},POI:{image:"marker.png",shadow:"shadow50.png",transparent:"markerTransparent.png",width:20,height:34},LetteredNonAvailableProvider:{image:"marker_gray.png",shadow:"shadow50.png",transparent:"markerTransparent.png",width:20,height:34},LetteredAvailableProvider:{image:"marker.png",shadow:"shadow50.png",transparent:"markerTransparent.png",width:20,height:34},Address:{image:"marker.png",shadow:"shadow50.png",transparent:"markerTransparent.png",width:20,height:34}},CreateIcon:function(category){var urlPrefix=Eviivo.Controls.GoogleMap.ImagesPrefix;var icon=new GIcon(G_DEFAULT_ICON);var iconConfig=Eviivo.Controls.GoogleMap.Category.Icons[category];icon.image=urlPrefix+iconConfig.image;icon.shadow=urlPrefix+iconConfig.shadow;icon.transparent=urlPrefix+iconConfig.transparent;icon.iconSize=new GSize(iconConfig.width,iconConfig.height);return icon;},PreloadIcons:function(){var icons=[];var urlPrefix=Eviivo.Controls.GoogleMap.ImagesPrefix;var name="";for(var key in Eviivo.Controls.GoogleMap.Category.Icons){var iconObj=Eviivo.Controls.GoogleMap.Category.Icons[key];for(var key2 in iconObj){name=iconObj[key2];icons[name]=name;}} for(name in icons){var icon=new Image();if(isNaN(icons[name])){icon.src=urlPrefix+icons[name];}} icons=null;},Template:" \
        <div class='infowindow_provider'> \
            <div class='infowindow_name'>NAME</div> \
            <div class='clear'></div> \
            <div class='infowindow_image'><img height='75px' src='IMAGEURL' ALT='NAME'/></div> \
            <div class='infowindow_right'> \
                RATING \
                <div class='clear'></div> \
                <div class='infowindow_bestPrice'>BESTPRICE</div> \
                <div class='clear'></div> \
            </div> \
            <div class='clear'></div> \
            MOREINFOLINK \
        </div>",TemplateMoreinfoLink:"<a class='infowindow_moreinfo' href='PROVIDERURL'>MOREINFOTEXT</a>",Template_ShowPOI:"<div class='infowindow_provider'> \
            <div class='infowindow_name'>NAME</div> \
            <div class='clear'></div> \
            POILINK \
        </div>",TemplatePOILink:"<a target='_blank' class='infowindow_moreinfo' href='HOMEPAGEURL'>HOMEPAGETEXT</a>",TemplateMapPopUp:" \<div class='popup_provider'> \
            <div id='popup_provider_name' class='provider_name'></div> \
            <div ID='imgClose' class='divClose' title='CLOSE'>&nbsp;</div> \
        </div>",TemplateMapPopUpHeader:"<a href='PROVIDERURL'>NAME</a>RATING",GetInfoWindowHTML:function(marker){if(typeof(marker.html)=="undefined"){var serverMarker=marker.data;if(serverMarker.MarkerCategoryName=="POI"){var html=Eviivo.Controls.GoogleMap.Category.Template_ShowPOI.replace(/NAME/g,serverMarker.Name);var linkHTML="";if(serverMarker.ImageUrl){linkHTML=Eviivo.Controls.GoogleMap.Category.TemplatePOILink.replace(/HOMEPAGETEXT/g,serverMarker.ImageUrl);var homePage=serverMarker.ImageUrl.toLowerCase();if(homePage.indexOf("http://")!=0){homePage="http://"+homePage;} linkHTML=linkHTML.replace(/HOMEPAGEURL/g,homePage);} html=html.replace(/POILINK/g,linkHTML);return html;} else{var html=Eviivo.Controls.GoogleMap.Category.Template.replace(/NAME/g,serverMarker.Name);html=html.replace(/IMAGEURL/,serverMarker.ImageUrl);html=html.replace(/LOCATION/,serverMarker.LocationName);html=html.replace(/DISTANCE/,serverMarker.Distance?String.localeFormat(Eviivo.ScriptResources.MapDistanceMilesAway,serverMarker.Distance):"");if(serverMarker.BestPriceText=="0"){html=html.replace(/BESTPRICE/,serverMarker.BestPrice?String.localeFormat(Eviivo.ScriptResources.MapBestPriceFree,serverMarker.BestPriceText):"");} else{html=html.replace(/BESTPRICE/,serverMarker.BestPrice?String.localeFormat(Eviivo.ScriptResources.MapBestPrice,serverMarker.BestPriceText):"");} var ratingTitle=serverMarker.RatingDescription?" title='"+serverMarker.RatingDescription+"'":"";var ratingHtml="<div class='infowindow_rating'"+ratingTitle+">";if(serverMarker.RatingImageUrl&&serverMarker.RatingDescription&&(serverMarker.RatingNumber>0||marker.isTSU===true)){ratingHtml+="<div class='su'><img src='"+serverMarker.RatingImageUrl+"' /></div>";} if(serverMarker.DisplayRating){for(var i=0;i<serverMarker.RatingNumber;i++){ratingHtml+="<div class='icon_smallstar'></div>";} for(var j=Eviivo.Controls.GoogleMap.MaxRatingNumber;j>serverMarker.RatingNumber;j--){ratingHtml+="<div class='icon_smallstar_no'></div>";}} ratingHtml+="</div>";var linkHtml="";if(serverMarker.ContentID){var query=document.location.search.substring(1);query=query.replace(/(\&)?ContentID(=(\w)*)?/i,"");if(!query.startsWith("&")){query="&"+query;} query="?ContentID="+serverMarker.ContentID+query;var url=Eviivo.Controls.GoogleMap.ProviderBaseUrl+query;linkHtml=Eviivo.Controls.GoogleMap.Category.TemplateMoreinfoLink;linkHtml=linkHtml.replace(/PROVIDERURL/g,url);linkHtml=linkHtml.replace(/MOREINFOTEXT/g,Eviivo.ScriptResources.NavigateText);} html=html.replace(/MOREINFOLINK/g,linkHtml);html=html.replace(/RATING/,ratingHtml);marker.html=html;return html;}} else{return marker.html;}}};Eviivo.Controls.GoogleMap.Category.PreloadIcons();this._elementID=null;this._key=null;this._map=null;this._markers=null;this._config=null;this._markerHandler=null;this._updateControlElement=null;this._updateControlVisible=false;this._scrollAlongControlElement=null;this._scrollContainerElement=null;this._scrollBounds=null;this._scrollHandler=null;this._resizeHandler=null;this._markersLoaderHandler=null;this._nearbyContainerElement=null;this._nearbyCheckboxElement=null;this._nearbyCheckboxHandler=null;this.initialize(elementID,latitude,longitude,config);};Eviivo.Controls.GoogleMap.Instance=null;Eviivo.Controls.GoogleMap.delayedLoadMarkers=function(){Eviivo.Controls.GoogleMap.Instance._loadMarkers();};Eviivo.Controls.GoogleMap.prototype={initialize:function(elementID,latitude,longitude,config){var element=$get(elementID);this._config=config;this._elementID=elementID;if(this._config.HideMap===false){if(GBrowserIsCompatible()&&element){this._map=new google.maps.Map2(element);this._geocoder=new GClientGeocoder();if(config.ShowScaleControl===true){this._map.addControl(new GScaleControl());} if(config.ShowLargeMapControl===true){this._map.addControl(new GLargeMapControl());} if(config.ShowSmallMapControl===true){this._map.addControl(new GSmallMapControl());} if(config.ShowMapTypeControl===true){this._map.addControl(new GMapTypeControl());} if(config.ShowOverviewMapControl===true){this._map.addControl(new GOverviewMapControl());} if(config.ShowTerrainMapTypeControl===true){this._map.addMapType(G_PHYSICAL_MAP);} this._map.setCenter(new GLatLng(latitude,longitude),Eviivo.Controls.GoogleMap.Zoom);this._map.setZoom(Eviivo.Controls.GoogleMap.Zoom);this._map.savePosition();this._markerHandler=Function.createDelegate(this,this.showMarkerWindow);GEvent.addListener(this._map,"click",this.showMarkerWindow);this._markers=[];this._markersLoaderHandler=Function.createDelegate(this,this.markersLoaderJSON);if(config.DelayLoadingMarkers===true){setTimeout(Eviivo.Controls.GoogleMap.delayedLoadMarkers,3000);} else{this._loadMarkers();} var instance=this;if(config.UpdateControlID){this._updateControlElement=$get(config.UpdateControlID);GEvent.addListener(map,"moveend",function(){instance.showUpdateControl();});} if(config.MarkerTriggerControlID){this._updateControlElement=$get(config.UpdateControlID);GEvent.addListener(map,"moveend",function(){instance.showUpdateControl();});} if(config.ScrollAlongControlID&&config.ScrollMapContainerID){this._scrollAlongControlElement=$get(config.ScrollAlongControlID);this._scrollContainerElement=$get(config.ScrollMapContainerID);if(this._scrollAlongControlElement&&this._scrollContainerElement){this.calculateScrollBounds();if(this._scrollBounds.enabled===true){this._scrollHandler=Function.createDelegate(this,this.scrollMap);this._resizeHandler=Function.createDelegate(this,this.scrollMapAfterResize);$addHandler(window,'scroll',this._scrollHandler);$addHandler(window,'resize',this._resizeHandler);this.scrollMap();}}} if(config.ShowNearbyOptions===true&&config.NearbyContainerID&&config.NearbyCheckboxID){this._nearbyContainerElement=$get(config.NearbyContainerID);this._nearbyCheckboxElement=$get(config.NearbyCheckboxID);if(this._nearbyCheckboxElement){this._nearbyCheckboxElement.checked=false;this._nearbyCheckboxHandler=Function.createDelegate(this,this.checkboxNearbyChanged);$addHandler(this._nearbyCheckboxElement,'click',this._nearbyCheckboxHandler);}}} if(config.PrintMap==true){var printElement=$get(this._elementID+"_printMap");if(printElement){var printMapButtonElementID=String.localeFormat("{0}_PrintMap_Button",this._elementID);printElement.innerHTML=String.localeFormat("<input type=\"button\" id='{0}' value=\"{1}\" />",printMapButtonElementID,Eviivo.ScriptResources.GoogleMapPrintLink);var printMapButtonElement=$get(printMapButtonElementID);$addHandlers(printMapButtonElement,{"click":this.buttonPrintMapClick},this);}} if(config.FindAddress==true){var findAddressElement=$get(this._elementID+"_findAddress");if(findAddressElement){var findAddressTextElementID=String.localeFormat("{0}_FinadAddress_Text",this._elementID);var findAddressButtonElementID=String.localeFormat("{0}_FinadAddress_Button",this._elementID);var innerHtml=String.localeFormat(Eviivo.ScriptResources.GoogleFindAddressTitle,this._config.ProviderName);innerHtml+=String.localeFormat("<input type='text' id='{0}'  />",findAddressTextElementID);innerHtml+=String.localeFormat("<input type=\"button\" id='{0}' value=\"{1}\" />",findAddressButtonElementID,Eviivo.ScriptResources.GoogleFindAddressButtonText);innerHtml+=String.localeFormat("<div id='{0}_FinadAddress_ErrorMessage'></div>",this._elementID);findAddressElement.innerHTML=innerHtml;var findAddressTextElement=$get(findAddressTextElementID);$addHandlers(findAddressTextElement,{"keydown":this.textBoxFindAddressKeyDown},this);var findAddressButtonElement=$get(findAddressButtonElementID);$addHandlers(findAddressButtonElement,{"click":this.buttonFindAddressClick},this);}}} else{this._markers=[];this._markersLoaderHandler=Function.createDelegate(this,this.markersLoaderJSON);this._loadMarkers();}},buttonPrintMapClick:function(){var point=this._map.getCenter();var zoomLevel=this._map.getZoom();if(point&&zoomLevel){var linkHTML=this._config.PrintMapUrl;linkHTML=linkHTML.replace("/LATITUDE/",point.lat());linkHTML=linkHTML.replace("/LONGITUDE/",point.lng());linkHTML=linkHTML.replace("/ZOOM_LEVEL/",zoomLevel);window.open(linkHTML,"PrintMap","","_blank");}},buttonFindAddressClick:function(){this.OpenGetDirectionWindow();},textBoxFindAddressKeyDown:function(e){if(e.keyCode==Sys.UI.Key.enter||e.keyCode==0||typeof(e.keyCode)=="undefined"){this.OpenGetDirectionWindow();e.preventDefault();e.stopPropagation();return false;} else{return true;}},OpenGetDirectionWindow:function(){var postCodeElement=$get(String.localeFormat("{0}_FinadAddress_Text",this._elementID));var messageElement=$get(String.localeFormat("{0}_FinadAddress_ErrorMessage",this._elementID));var url=this._config.DirectionUrl;var countryCode=this._config.DirectionCountryCode;var address=postCodeElement.value;messageElement.innerHTML="";if(countryCode&&postCodeElement.value!=""){address=countryCode+", "+postCodeElement.value;} this._geocoder.getLocations(address,function(response){if(!response||response.Status.code!=200){messageElement.innerHTML=Eviivo.ScriptResources.InvalidAddress;} else{place=response.Placemark[0];point=new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);if(!point||!place.AddressDetails.Country){messageElement.innerHTML=Eviivo.ScriptResources.InvalidAddress;} else{if(!countryCode||(countryCode==place.AddressDetails.Country.CountryNameCode)){var linkHTML=url.replace("/LATITUDE/",point.lat());linkHTML=linkHTML.replace("/LONGITUDE/",point.lng());linkHTML=linkHTML.replace("/LOCATION/",postCodeElement.value);window.open(linkHTML,"Direction","","_blank");} else{messageElement.innerHTML=Eviivo.ScriptResources.InvalidAddress;}}}});},calculateScrollBounds:function(){var bounds=Sys.UI.DomElement.getBounds(this._scrollAlongControlElement);var boundsContainer=Sys.UI.DomElement.getBounds(this._scrollContainerElement);this._scrollBounds={enabled:(bounds.height>boundsContainer.height),top:bounds.y,bottom:bounds.height-boundsContainer.height,left:bounds.x+bounds.width};},dispose:function(){try{$removeHandler(window,'scroll',this._scrollHandler);$removeHandler(window,'resize',this._resizeHandler);} catch(Error){} try{$removeHandler(this._nearbyCheckboxElement,'click',this._nearbyCheckboxHandler);} catch(Error){} if(this._markers){for(var i=0;i<this._markers.length;i++){var elementID=this._markers[i].data.TriggerElementID;if(elementID){var element=$get(elementID);if(element){$clearHandlers(element);}}}} try{GUnload();} catch(Error){} this._key=null;this._map=null;this._markers=null;this._config=null;this._markerHandler=null;this._updateControlElement=null;this._updateControlVisible=false;this._isAutoZooming=false;this._scrollAlongControlElement=null;this._scrollContainerElement=null;this._scrollBounds=null;this._scrollHandler=null;this._resizeHandler=null;this._markersLoaderHandler=null;this._nearbyContainerElement=null;this._nearbyCheckboxElement=null;this._nearbyCheckboxHandler=null;Eviivo.Controls.GoogleMap.callBaseMethod(this,'dispose');},_loadMarkers:function(){Eviivo.Distribution.Presentation.MappingService.GetMarkers(this._config.MarkersKey,this._markersLoaderHandler);},markersLoaderJSON:function(resultJSON){this.markersLoader(eval(resultJSON));},markersLoader:function(result){if(result&&typeof(result)==='object'){if(typeof(result.get_exceptionType)!=='undefined'){return;} else if(typeof(result.length)!=='undefined'){this.addMarkers(result);} else{this.addMarker(result);}}},addMarkers:function(markers){if(this._config.ShowDirections==true){var serverMarkerFrom=markers[0];var serverMarkerTo=markers[1];var directionsText=String.localeFormat(Eviivo.ScriptResources.ToText,serverMarkerFrom.Latitude+','+serverMarkerFrom.Longitude,serverMarkerTo.Latitude+','+serverMarkerTo.Longitude);var directionsPanel=document.getElementById("textualDirections");var directions=new GDirections(this._map,directionsPanel);directions.load(directionsText);} else{for(var i=0;i<markers.length;i++){this.addMarker(markers[i]);} this.zoomToMarkers();}},addMarker:function(serverMarker){var e=Function._validateParams(serverMarker,[{name:"Latitude",type:Number},{name:"Longitude",type:Number},{name:"LocationName",type:String},{name:"MarkerCategoryName",type:String},{name:"Name",type:String,mayBeNull:true,optional:true},{name:"ContentID",type:String,mayBeNull:true,optional:true},{name:"RatingNumber",type:Number,mayBeNull:true},{name:"RatingImageUrl",type:String,mayBeNull:true},{name:"RatingDescription",type:String,mayBeNull:true},{name:"DisplayRating",type:Boolean},{name:"ImageUrl",type:String,mayBeNull:true,optional:true},{name:"Index",type:Number,mayBeNull:true,optional:true},{name:"TriggerElementID",type:String,mayBeNull:true,optional:true}]);if(e)throw e;if(!serverMarker.Name){serverMarker.Name="";} if(this._config.HideMap===false){var category=serverMarker.MarkerCategoryName;if(category==="Undefined"){if(serverMarker.TriggerElementID){var element=$get(serverMarker.TriggerElementID);if(element){$addHandler(element,'click',function(){var map=Eviivo.Controls.GoogleMap.Instance._map;map.closeInfoWindow();});}} return;} var point=new GLatLng(serverMarker.Latitude,serverMarker.Longitude);var icon=Eviivo.Controls.GoogleMap.Category.CreateIcon(category);if(category==="NearbyProvider"||category==="LetteredAvailableProvider"||category==="LetteredNonAvailableProvider"){var letter=(serverMarker.Index<26)?String.fromCharCode("A".charCodeAt(0)+serverMarker.Index):"";icon.image=icon.image.replace(".png",letter+".png");if(this._nearbyContainerElement&&Sys.UI.DomElement.containsCssClass(this._nearbyContainerElement,'map_seenearby_hide')){Sys.UI.DomElement.removeCssClass(this._nearbyContainerElement,'map_seenearby_hide');}} var marker=new GMarker(point,{icon:icon,title:serverMarker.Name});marker.data=serverMarker;marker.isMarker=true;marker.isTSU=this._config.IsTSUEnvironment;this._markers.push(marker);this._map.addOverlay(marker);if(serverMarker.TriggerElementID){var element=$get(serverMarker.TriggerElementID);if(element){$addHandler(element,'click',function(){marker.openInfoWindowHtml(Eviivo.Controls.GoogleMap.Category.GetInfoWindowHTML(marker));});}} if(category==="NearbyProvider"){marker.hide();}} if(serverMarker.TriggerElementID){var element=$get(serverMarker.TriggerElementID);if(element){var streetViewDiv=$get('mapPopup'+serverMarker.Index);if(streetViewDiv){Eviivo$Controls$GoogleMapPopup$Create(serverMarker);}}}},showMarkerWindow:function(overlay,point){if(overlay){if(overlay.isMarker&&overlay.data.MarkerCategoryName!=="OriginalLocation"){overlay.openInfoWindowHtml(Eviivo.Controls.GoogleMap.Category.GetInfoWindowHTML(overlay));}}},showUpdateControl:function(){if(this._map.isLoaded()===true){if(this._updateControlVisible===false&&this._isAutoZooming===false){this._updateControlVisible=true;this._updateControlElement.style.display="block";} var linkElement=this._updateControlElement.childNodes[0];if(linkElement){var center=this._map.getCenter();var corner=this._map.getBounds().getNorthEast();var distance=center.distanceFrom(corner);var KM_TO_MILES=1.609344;var distanceMiles=Math.round(distance*KM_TO_MILES);var url=document.location.href;url=url.replace(/%22latitude%22%3a([^%2c]*)/i,"%22latitude%22%3a"+center.lat());url=url.replace(/%22longitude%22%3a([^%2c]*)/i,"%22longitude%22%3a"+center.lng());linkElement.href=url;}}},scrollMap:function(){var map_container=this._scrollContainerElement;var bounds=this._scrollBounds;if(document.documentElement.scrollTop>(bounds.bottom+bounds.top)||self.pageYOffset>(bounds.bottom+bounds.top)){Sys.UI.DomElement.removeCssClass(map_container,"map_container_scroll");map_container.style.position='absolute';map_container.style.top=bounds.bottom+'px';map_container.style.left=null;if(Sys.Browser.agent==Sys.Browser.Opera){map_container.style.left='';}} else if(document.documentElement.scrollTop>bounds.top||self.pageYOffset>bounds.top){Sys.UI.DomElement.addCssClass(map_container,"map_container_scroll");if(Sys.Browser.agent==Sys.Browser.InternetExplorer&&Sys.Browser.version<7){var EXTRA_MARGIN_TOP=40;var top=document.documentElement.scrollTop-bounds.top+EXTRA_MARGIN_TOP;map_container.style.top=top+'px';} else{map_container.style.position='fixed';map_container.style.top='0px';map_container.style.left=bounds.left+'px';}} else if(document.documentElement.scrollTop<=this._scrollBounds.top||self.pageYOffset<=this._scrollBounds.top){Sys.UI.DomElement.removeCssClass(map_container,"map_container_scroll");map_container.style.position='absolute';map_container.style.top=null;map_container.style.left=null;if(Sys.Browser.agent==Sys.Browser.Opera){map_container.style.left='';}}},scrollMapAfterResize:function(){if(this._scrollBounds&&this._scrollBounds.enabled===true){this.calculateScrollBounds();this.scrollMap();}},zoomToMarkers:function(){if(!this._map||!this._markers||this._markers.length===0)return;this._isAutoZooming=true;if(this._markers.length==1){this._map.setCenter(this._markers[0].getPoint(),this._map.getZoom());} var slopPercentage=10;var heightOffsetPct=6;var marker,thePoint,x,y,minX,maxX,minY,maxY,span;var count=0;for(var i=0;i<this._markers.length;i++){marker=this._markers[i];if(marker.isHidden()===false){thePoint=marker.getPoint();x=parseFloat(thePoint.lat());y=parseFloat(thePoint.lng());if(count===0){minX=x;maxX=x;minY=y;maxY=y;} else{if(x<minX)minX=x;if(x>maxX)maxX=x;if(y<minY)minY=y;if(y>maxY)maxY=y;} count++;}} if(count==1){this._map.setCenter(new GLatLng(x,y),this._map.getZoom());} else if(count>1){var center=new GLatLng((minX+maxX)/2,(minY+maxY)/2);span=new GSize(Math.abs(maxX-minX),Math.abs(maxY-minY));slopWid=0;slopHgt=0;if(typeof slopPercentage!="undefined"){slopWid=span.width*slopPercentage/200;slopHgt=span.height*slopPercentage/200;span.width*=1+slopPercentage/100;span.height*=1+slopPercentage/100;} deltaHgt=0;if(typeof heightOffsetPct!="undefined"){deltaHgt=span.height*heightOffsetPct/100;center=new GLatLng(center.lat()+deltaHgt,center.lng());} var bounds=new GLatLngBounds(new GLatLng(minX-slopHgt,minY-slopWid),new GLatLng(maxX+slopHgt,maxY+slopWid));var zoom=this._map.getBoundsZoomLevel(bounds);this._map.setCenter(center,zoom);this._isAutoZooming=false;}},checkboxNearbyChanged:function(){var value=this._nearbyCheckboxElement.checked;for(var i=0;i<this._markers.length;i++){var marker=this._markers[i];if(marker.data.MarkerCategoryName==="NearbyProvider"){value===true?marker.show():marker.hide();}} if(value===true){this.zoomToMarkers();} else{this._map.closeInfoWindow();this._map.returnToSavedPosition();}},showNearbyMarkers:function(){if(this._nearbyCheckboxElement){this._nearbyCheckboxElement.checked=true;this.checkboxNearbyChanged();}}};Eviivo.Controls.GoogleMap.registerClass('Eviivo.Controls.GoogleMap',null,Sys.IDisposable);Eviivo.Controls.GoogleMap.create=function(elementID,latitude,longitude,config){Sys.Application.add_load(function(){Eviivo.Controls.GoogleMap.Instance=new Eviivo.Controls.GoogleMap(elementID,latitude,longitude,config);});};Eviivo.Controls.GoogleMapPopup=function(serverMarker){this._element=$get('mapPopup'+serverMarker.Index);this._elementDisplay=$get('googleMapPopup');this._elementClose=$get('googleMapPopupClose');this._popUp=$get('popUp');this._popUpText=$get('popUpText');this._serverMarker=serverMarker;$addHandlers(this._element,{"click":this._onClick},this);};Eviivo.Controls.GoogleMapPopup.prototype={initLoader:function(){var script=document.createElement("script");script.src=Eviivo$Controls$GoogleMap$API;script.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(script);},_onClick:function(e){this._elementDisplay.style.visibility='visible';this._popUp.style.visibility='visible';var googleMapPopup=Eviivo$Controls$GoogleMapPopupInstance.Map;if(googleMapPopup==null){if(Eviivo$Controls$GoogleMap$HideMap==='True'){Eviivo$Controls$GoogleMapPopupInstance.FirstInstance=this;this.initLoader(this);} else{this.loadMapPopUp(this);}} else{googleMapPopup.clearOverlays();if(this._elementClose.lastChild){this._elementClose.removeChild(this._elementClose.lastChild);} this.displayPopUp(this);}},loadMapPopUp:function(){var map=new google.maps.Map2(this._elementDisplay);map.setCenter(new GLatLng(this._serverMarker.Latitude,this._serverMarker.Longitude),Eviivo.Controls.GoogleMap.ZoomPopUp);map.addControl(new GSmallMapControl());map.addControl(new GScaleControl());Eviivo$Controls$GoogleMapPopupInstance.Map=map;this.displayPopUp(this);},displayPopUp:function(){var point=new GLatLng(this._serverMarker.Latitude,this._serverMarker.Longitude);var googleMapPopup=Eviivo$Controls$GoogleMapPopupInstance.Map;var marker=new GMarker(point);googleMapPopup.setCenter(point,Eviivo.Controls.GoogleMap.ZoomPopUp);googleMapPopup.addOverlay(marker);this.loadPopUpContent(this);this._elementClose.appendChild(document.createTextNode(Eviivo.ScriptResources.Close));this._popUp.appendChild(this._elementClose);this._popUp.appendChild(this._elementDisplay);this._element.parentNode.appendChild(this._popUp);},loadPopUpContent:function(){var serverMarker=this._serverMarker;var ratingTitle=serverMarker.RatingDescription?" title='"+serverMarker.RatingDescription+"'":"";var ratingHtml="<div class='provider_rating prating_name'"+ratingTitle+">";if(serverMarker.RatingImageUrl&&serverMarker.RatingDescription&&(serverMarker.RatingNumber>0||Eviivo.Controls.GoogleMap.IsTSU===true)){ratingHtml+="<div class='icon_su'><img src='"+serverMarker.RatingImageUrl+"' /></div>";} if(serverMarker.DisplayRating){for(var j=Eviivo.Controls.GoogleMap.MaxRatingNumber;j>serverMarker.RatingNumber;j--){ratingHtml+="<div class='icon_smallstar_no'></div>";} for(var i=0;i<serverMarker.RatingNumber;i++){ratingHtml+="<div class='icon_smallstar'></div>";}} ratingHtml+="</div>";if(serverMarker.ContentID){var query=document.location.search.substring(1);query=query.replace(/(\&)?ContentID(=(\w)*)?/i,"");if(!query.startsWith("&")){query="&"+query;} query="?ContentID="+serverMarker.ContentID+query;var url=Eviivo.Controls.GoogleMap.ProviderBaseUrl+query;} var html=Eviivo.Controls.GoogleMap.Category.TemplateMapPopUpHeader.replace(/NAME/g,serverMarker.Name);html=html.replace(/PROVIDERURL/g,url);html=html.replace(/RATING/,ratingHtml);if(this._popUpText.innerHTML===""){this._popUpText.innerHTML=Eviivo.Controls.GoogleMap.Category.TemplateMapPopUp.replace(/CLOSE/g,Eviivo.ScriptResources.Close);this._linkClose=document.getElementById('imgClose');$addHandlers(this._linkClose,{"click":this._onClickClose},this);$addHandlers(this._elementClose,{"click":this._onClickClose},this);} $get('popup_provider_name').innerHTML=html;},_onClickClose:function(e){if(this._elementClose.lastChild){this._elementClose.removeChild(this._elementClose.lastChild);} this._elementDisplay.style.visibility='hidden';this._popUp.style.visibility='hidden';$clearHandlers(this._elementDisplay);},dispose:function(){$clearHandlers(this._element);$clearHandlers(this._elementDisplay);$clearHandlers(this._elementClose);$clearHandlers(this._linkClose);Eviivo.Controls.GoogleMapPopup.callBaseMethod(this,'dispose');}};Eviivo.Controls.GoogleMapPopup.registerClass('Eviivo.Controls.GoogleMapPopup',Sys.UI.Behavior,Sys.IDisposable);Eviivo.Controls.GoogleMapPopupInstance=Eviivo$Controls$GoogleMapPopupInstance={Map:null,FirstInstance:null,handleApiReady:function(){google.load("maps",Eviivo$Controls$GoogleMap$Version,{"callback":Eviivo$Controls$GoogleMapPopupInstance.mapsLoaded,"language":Eviivo.ScriptResources.LanguageCode,"other_params":"sensor=false"});},mapsLoaded:function(){Eviivo$Controls$GoogleMapPopupInstance.FirstInstance.loadMapPopUp(this);}};Eviivo.Controls.GoogleMapPopup.Create=Eviivo$Controls$GoogleMapPopup$Create=function(severMarker){new Eviivo.Controls.GoogleMapPopup(severMarker);};if(typeof(Eviivo$Controls$GoogleMap$Version)=='undefined'){Eviivo$Controls$GoogleMap$Version="2";}if((typeof(Eviivo$Controls$GoogleMap$HideMap)!='undefined'&&Eviivo$Controls$GoogleMap$HideMap==='False')){google.load("maps",Eviivo$Controls$GoogleMap$Version,{"language":Eviivo.ScriptResources.LanguageCode,"other_params":"sensor=false"});}if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();