shortcut={all_shortcuts:{},add:function(g,h,d){var a={type:"keydown",propagate:false,disable_in_input:false,target:document,keycode:false};if(!d){d=a}else{for(var e in a){if(typeof d[e]=="undefined"){d[e]=a[e]}}}var c=d.target;if(typeof d.target=="string"){c=document.getElementById(d.target)}var f=this;g=g.toLowerCase();var b=function(p){p=p||window.event;if(d.disable_in_input){var n;if(p.target){n=p.target}else{if(p.srcElement){n=p.srcElement}}if(n.nodeType==3){n=n.parentNode}if(n.tagName=="INPUT"||n.tagName=="TEXTAREA"){return}}if(p.keyCode){code=p.keyCode}else{if(p.which){code=p.which}}var m=String.fromCharCode(code);if(code==188){m=","}if(code==190){m="."}var q=g.split("+");var o=0;var r={"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"};var s={esc:27,escape:27,tab:9,space:32,"return":13,enter:13,backspace:8,scrolllock:145,scroll_lock:145,scroll:145,capslock:20,caps_lock:20,caps:20,numlock:144,num_lock:144,num:144,pause:19,"break":19,insert:45,home:36,"delete":46,end:35,pageup:33,page_up:33,pu:33,pagedown:34,page_down:34,pd:34,left:37,up:38,right:39,down:40,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123};var t={shift:{wanted:false,pressed:false},ctrl:{wanted:false,pressed:false},alt:{wanted:false,pressed:false},meta:{wanted:false,pressed:false}};if(p.ctrlKey){t.ctrl.pressed=true}if(p.shiftKey){t.shift.pressed=true}if(p.altKey){t.alt.pressed=true}if(p.metaKey){t.meta.pressed=true}for(var l=0;k=q[l],l<q.length;l++){if(k=="ctrl"||k=="control"){o++;t.ctrl.wanted=true}else{if(k=="shift"){o++;t.shift.wanted=true}else{if(k=="alt"){o++;t.alt.wanted=true}else{if(k=="meta"){o++;t.meta.wanted=true}else{if(k.length>1){if(s[k]==code){o++}}else{if(d.keycode){if(d.keycode==code){o++}}else{if(m==k){o++}else{if(r[m]&&p.shiftKey){m=r[m];if(m==k){o++}}}}}}}}}}if(o==q.length&&t.ctrl.pressed==t.ctrl.wanted&&t.shift.pressed==t.shift.wanted&&t.alt.pressed==t.alt.wanted&&t.meta.pressed==t.meta.wanted){h(p);if(!d.propagate){p.cancelBubble=true;p.returnValue=false;if(p.stopPropagation){p.stopPropagation();p.preventDefault()}return false}}};this.all_shortcuts[g]={callback:b,target:c,event:d.type};if(c.addEventListener){c.addEventListener(d.type,b,false)}else{if(c.attachEvent){c.attachEvent("on"+d.type,b)}else{c["on"+d.type]=b}}},remove:function(b){b=b.toLowerCase();var a=this.all_shortcuts[b];delete (this.all_shortcuts[b]);if(!a){return}var c=a.event;var d=a.target;var e=a.callback;if(d.detachEvent){d.detachEvent("on"+c,e)}else{if(d.removeEventListener){d.removeEventListener(c,e,false)}else{d["on"+c]=false}}}};shortcut.add("Esc",function(){CloseLightBox()},{type:"keydown",propagate:true,target:document});var ns4=(document.layers);var ie4=(document.all&&!document.getElementById);var ie5=(document.all&&document.getElementById);var ns6=(!document.all&&document.getElementById);function PageQuery(b){if(b.length>1){this.q=b.substring(1,b.length)}else{this.q=null}this.keyValuePairs=new Array();if(b.length>1){for(var a=0;a<this.q.split("&").length;a++){this.keyValuePairs[a]=this.q.split("&")[a]}}this.getKeyValuePairs=function(){return this.keyValuePairs};this.getValue=function(c){for(var d=0;d<this.keyValuePairs.length;d++){if(this.keyValuePairs[d].split("=")[0]==c){return this.keyValuePairs[d].split("=")[1]}}return false};this.getParameters=function(){var c=new Array(this.getLength());for(var d=0;d<this.keyValuePairs.length;d++){c[d]=this.keyValuePairs[d].split("=")[0]}return c};this.getLength=function(){return this.keyValuePairs.length}}function queryString(b){var a=new PageQuery(window.location.search);return unescape(a.getValue(b))}var bDebug=false;if(queryString("debug")=="true"){bDebug=true}function OpenWindow(c,b,a){newwindow=window.open(c,b,a);if(window.focus){newwindow.focus()}}var iDarkenScreen_ExtraHeight;function grayOut(e,a){var a=a||{};var g=a.zindex||100;var l=a.opacity||70;var h=(l/100);var m=a.bgcolor||"#000000";var b=document.getElementById("darkenScreenObject");if(!b){var f=document.getElementsByTagName("body")[0];var n=document.createElement("div");n.style.position="absolute";n.style.top="0px";n.style.left="0px";n.style.overflow="hidden";n.style.display="none";n.id="darkenScreenObject";f.appendChild(n);f.onclick="alert('')";b=document.getElementById("darkenScreenObject")}if(e){var c=0;if(iDarkenScreen_ExtraHeight){c=iDarkenScreen_ExtraHeight}sSelectHide="none";if(document.body&&(document.body.scrollWidth||document.body.scrollHeight)){var o=document.body.scrollWidth+"px";if(document.body.scrollHeight<document.body.offsetHeight){var d=document.body.offsetHeight+c+"px"}else{var d=document.body.scrollHeight+c+"px"}}else{if(document.body.offsetWidth){var o=document.body.offsetWidth+"px";var d=document.body.offsetHeight+c+"px"}else{var o="100%";var d="100%"}}b.style.opacity=h;b.style.MozOpacity=h;b.style.filter="alpha(opacity="+l+")";b.style.zIndex=g;b.style.backgroundColor=m;b.style.width=o;b.style.height=d;b.style.display="block"}else{b.style.display="none";sSelectHide=""}oSelects=document.getElementsByTagName("select");for(x=0;x<oSelects.length;x++){}}function showHideFAQ(b){var a=document.getElementById("FAQ"+b);if(a){if(a.style.display==""){a.style.display="none"}else{a.style.display=""}}}function changeCurrency(a){if(confirm("Are you sure you want to change the currency?")){location.href="/includes/changecurrency.asp?code="+a+"&url="+window.location}}function object_attach(a){var b;if(ns4){b=document.layers[a]}else{if(ie4){b=document.all[a]}else{if(ie5||ns6){b=document.getElementById(a)}}}return b}function addLoadEvent(b){var a=window.onload;if(typeof window.onload!="function"){window.onload=b}else{window.onload=function(){if(a){a()}b()}}}function getQuerystring(){var b=document.URL;if(b.indexOf("?")){var a=b.split("?");return a[1]}}function validateNewsletter(b){var a="";if(!b.firstname.value||b.firstname.value=="Enter your first name"){a+="- Please enter your first name\n"}if(!b.lastname.value||b.lastname.value=="Enter your last name"){a+="- Please enter your last name\n"}if(!/.+@[^.]+(\.[^.]+)+/.test(b.email.value)||isValidField(b.email.value,2)==false||b.email.value=="Enter your email"){a+="- Please enter a valid email address\n"}if(a){alert(a);return false}else{return true}}function IsNumeric(a){var b="0123456789. ";var d=true;var c;for(i=0;i<a.length&&d==true;i++){c=a.charAt(i);if(b.indexOf(c)==-1){d=false}}return d}function validateEnquiry(b){var a="";if(b.title.value=="-"){a+="- Please select your title\n"}if(!b.firstname.value||b.firstname.value=="- First name -"){a+="- Please enter your first name\n"}if(!b.surname.value||b.surname.value=="- Surname -"){a+="- Please enter your surname\n"}if(b.telephone.getAttribute("validateFId")=="true"||b.telephone.getAttribute("validateFId")=="True"){if(!b.telephone.value||isValidField(b.telephone.value,6)==false){a+="- Please enter a valid telephone number\n"}}if(b.telephone.value){if(!IsNumeric(b.telephone.value)){a+="- Please enter a valid telephone number\n"}}if(!/.+@[^.]+(\.[^.]+)+/.test(b.email.value)||isValidField(b.email.value,2)==false){a+="- Please enter a valid email address\n"}if(!b.enquiry.value){a+="- Please enter your enquiry\n"}if(a){alert(a);return false}else{return true}}function LoadGoogleMap(b,d,e,h,l,c){var g=13;if(l){g=l}if(document.getElementById(b)){b=document.getElementById(b);if(!h){b.style.width="500px";b.style.height="220px"}if(GBrowserIsCompatible()){var a=new GMap2(b);a.addControl(new GSmallMapControl());a.addControl(new GMapTypeControl());a.setCenter(new GLatLng(d,e),g);if(!c){var f=new GLatLng(d,e);a.addOverlay(new GMarker(f))}}}}function SwitchPhoto(a,b){var c=b;if(document.all){document.getElementById(a).style.filter="blendTrans(duration=1)";document.getElementById(a).filters.blendTrans.Apply()}if(document.getElementById){document.getElementById(a).src=c}else{document.HotelImage.src=c}if(document.all){document.getElementById(a).filters.blendTrans.Play()}}function isValidField(a,d){if(d==1){ValidChars="0123456789"}else{if(d==2){ValidChars="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-@"}else{if(d==3){ValidChars="0123456789."}else{if(d==4){ValidChars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "}else{if(d==5){ValidChars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-/' "}else{if(d==6){ValidChars="+0123456789-()[] "}}}}}}var c=true;var b;for(iii=0;iii<a.length&&c==true;iii++){b=a.charAt(iii);if(ValidChars.indexOf(b)==-1){c=false}}return c}function echeck(a){if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,9})+$/.test(a)){return(true)}return(false)}function writeInDiv(a,b){if(document.getElementById(b)){document.getElementById(b).innerHTML=a}}function checkPackageForm(c){sCurForm=c;sCurSearchType="Package";sSubmitForm=document.getElementsByName("frm"+c);sLocationID=document.getElementById("packageLocationTo"+c);var b=sSubmitForm.elements,a="";if(countPassengers()>9){alert("You can only search for a maximum of 9 passengers when your search includes a flight");return false}if(sLocationID.value==""){a+="- Please select a destination.\n"}if(validateDate("startdate_d"+c,"startdate_m"+c,"startdate_y"+c)<=2){a+="- Departure date is not valid.\n"}bBoard=false;if(document.forms["frm"+c].board!=null){for(x=0;x<document.forms["frm"+c].board.length;x++){if(document.forms["frm"+c].board[x].checked==true){bBoard=true}}if(!bBoard){a+="- Please select at least one board option.\n"}}if(document.getElementById("rooms"+c)){if(document.getElementById("rooms"+c).value=="0"){a+="- Please select no. of rooms\n"}}if(a){OpenSearch();alert("The following errors occurred:\n\n"+a);return false}else{sSubmitForm[0].submit()}}function checkTourForm(a){sSubmitForm=document.getElementsByName("frm"+a);oDDLCountry=document.getElementById("country"+a);if(oDDLCountry.selectedIndex==0){alert("Please select a country");return false}oDDLType=document.getElementById("tourtype"+a);if(oDDLType.selectedIndex==0){alert("Please select the type of holiday you would like");return false}oDDLTM=document.getElementById("tourtransportmethod"+a);if(oDDLTM.selectedIndex==0){alert("Please select a transport method");return false}if(oDDLTM.selectedIndex==1){oDDLAirport=document.getElementById("airportfrom"+a);if(oDDLAirport.selectedIndex==0){alert("Please select a departure airport");return false}}oDDLDate=document.getElementById("startdate"+a);if(oDDLDate.selectedIndex==0){alert("Please select a leave date");return false}return true}function showhidechangeoptionsFH(a,b){if(a=="show"){div_switch("divFreetext"+b,true,true);div_switch("DivShow",false,true);div_switch("DivHide",true,true)}if(a=="hide"){div_switch("divFreetext"+b,false,true);div_switch("DivShow",true,true);div_switch("DivHide",false,true)}}function showhidechangeoptions(a){if(a=="show"){div_switch("slimSearchTop",true,true);div_switch("slimSearchBottom",true,true);div_switch("DivShow",false,true);div_switch("DivHide",true,true)}if(a=="hide"){div_switch("slimSearchTop",false,true);div_switch("slimSearchBottom",false,true);div_switch("DivShow",true,true);div_switch("DivHide",false,true)}}var SelectedSearchTab="search_tab1";function SwitchTabs(b,a){if(SelectedSearchTab!=b&&SelectedHeaderTab!=b){sExtra="";if(a==1){if(document.getElementById(b).className.indexOf("Over")<0){document.getElementById(b).className=document.getElementById(b).className+"Over"}else{SelectedSearchTab=b}}else{if(document.getElementById(b).className.indexOf("Over")>-1){document.getElementById(b).className=Left(document.getElementById(b).className,document.getElementById(b).className.length-4)}}}}function SwitchSearch(a){if(document.getElementById("as_idFreetextHotel")){document.getElementById("as_idFreetextHotel").style.display="none"}if(document.getElementById("as_idFreetextFlight")){document.getElementById("as_idFreetextFlight").style.display="none"}if(document.getElementById("as_idFreetextFlightHotel")){document.getElementById("as_idFreetextFlightHotel").style.display="none"}for(x=1;x<9;x++){idSearchTab=document.getElementById("search_tab"+x);if(idSearchTab){idSearchTab.className="searchtab"}if(document.getElementById("search"+x)){document.getElementById("search"+x).style.display="none"}}SelectedSearchTab=a;sSelectedSearchTab=document.getElementById(a);if(sSelectedSearchTab){sRadarBars=sSelectedSearchTab.getElementsByTagName("input");if(sRadarBars.length>0){for(xx=0;xx<sRadarBars.length;xx++){if(sRadarBars[xx].type.toLowerCase()=="radio"){sRadarBars[xx].checked=true}}}sSelectedSearchTab.className="searchtabOver"}if(document.getElementById("search"+Right(a,1))){document.getElementById("search"+Right(a,1)).style.display=""}}function SwitchLanding(a){for(x=1;x<9;x++){if(document.getElementById("landing_tab"+x)){document.getElementById("landing_tab"+x).className="searchtab"}if(document.getElementById("divLanding"+x)){document.getElementById("divLanding"+x).style.display="none"}}SelectedSearchTab=a;if(document.getElementById(a)){document.getElementById(a).className="searchtabOver"}if(document.getElementById("divLanding"+Right(a,1))){document.getElementById("divLanding"+Right(a,1)).style.display=""}if(Right(a,1)=="4"){if(document.getElementById("divLandingSearch")){document.getElementById("divLandingSearch").style.display=""}}else{if(document.getElementById("divLandingSearch")){document.getElementById("divLandingSearch").style.display="none"}}if(Right(a,1)=="3"){if(document.getElementById("divLandingOffers")){document.getElementById("divLandingOffers").style.display=""}}else{if(document.getElementById("divLandingOffers")){document.getElementById("divLandingOffers").style.display="none"}}}function Left(b,a){if(a<=0){return""}else{if(a>String(b).length){return b}else{return String(b).substring(0,a)}}}function Right(b,a){if(a<=0){return""}else{if(a>String(b).length){return b}else{var c=String(b).length;return String(b).substring(c,c-a)}}}function clearField(b,a,c){if(c==null){c=""}if(trim(b.value)==a){b.value=c}}function div_switch(b,a,c){if(document.getElementById(b)){if(a==true){document.getElementById(b).style.display=""}else{document.getElementById(b).style.display="none"}}}function toggle_switch(a){if(document.getElementById(a)){if(document.getElementById(a).style.display=="none"){document.getElementById(a).style.display=""}else{document.getElementById(a).style.display="none"}}}function checkFormFieldSelectedIndex(a,b){oTitleElements=document.getElementsByTagName("select");for(i=0;i<oTitleElements.length;i++){if(oTitleElements.item(i).id.indexOf(a)==0){if(oTitleElements.item(i).selectedIndex==0){alert(b);oTitleElements.item(i).focus();return false;break}}}return true}function checkFormFieldValue(a,g,d,c,f,b){if(c==undefined||c==null){c=1}if(b==undefined){b=false}var e=false;oFormElements=document.getElementsByTagName("input");for(i=0;i<oFormElements.length;i++){if(oFormElements.item(i).id.indexOf(a)==0){if((oFormElements.item(i).value==""||oFormElements.item(i).value==g||oFormElements.item(i).value.length<c||(a=="surname"&&oFormElements.item(i).value.indexOf(" ")>-1)||((a=="surname"||a=="firstname")&&(isValidField(oFormElements.item(i).value,5)==false||Left(oFormElements.item(i).value,1)=="-"||Left(oFormElements.item(i).value,1)=="/"||oFormElements.item(i).value.length<2||oFormElements.item(i).value==g)))&&e==false){alert(d);oFormElements.item(i).focus();return false;break}else{if(f!=""){if(f=="telno"){if(e==false){if(!isValidPhone(oFormElements.item(i).value)){alert(d);oFormElements.item(i).focus();return false;break}}}if(f=="email"){if(e==false){if(!/.+@[^.]+(\.[^.]+)+/.test(oFormElements.item(i).value)){alert(d);oFormElements.item(i).focus();return false;break}}}}}if(b){e=true}}}e=false;oFormElements=document.getElementsByTagName("textarea");for(i=0;i<oFormElements.length;i++){if(oFormElements.item(i).id.indexOf(a)==0){if(oFormElements.item(i).value==""||oFormElements.item(i).value==g&&e==false){alert(d);oFormElements.item(i).focus();return false;break}if(b){e=true}}}return true}function formatCurrency(c,a){if(typeof c!="undefined"){c=c.toString().replace(/\$|\,/g,"");if(isNaN(c)){c="0"}sign=(c==(c=Math.abs(c)));c=Math.floor(c*100+0.50000000001);cents=c%100;c=Math.floor(c/100).toString();if(cents<10){cents="0"+cents}for(var b=0;b<Math.floor((c.length-(1+b))/3);b++){c=c.substring(0,c.length-(4*b+3))+","+c.substring(c.length-(4*b+3))}if(a==true){return(((sign)?"":"-")+c+"."+cents)}else{return(((sign)?"":"-")+"&pound;"+c+"."+cents)}}}Xoffset=20;Yoffset=20;var yyy=-1000;var newDiv,newFrame;function ShowInfoPop(a,c,b,d){if(b){Yoffset=b}if(d){Xoffset=d}if(window.Event&&document.captureEvents){document.captureEvents(Event.MOUSEMOVE)}document.onmousemove=get_mouse;sHTML="";sHTML+='<div class="infotitle">'+a+"</div>";sHTML+='<div class="infotext">'+c+"</div>";yyy=Yoffset;document.getElementById("CTInfoBox").innerHTML=sHTML;document.getElementById("CTInfoBox").style.display="block";if(document.getElementById("CTInfoBoxFrame")){document.getElementById("CTInfoBoxFrame").style.display="block";document.getElementById("CTInfoBoxFrame").style.width=document.getElementById("CTInfoBox").offsetWidth+"px";document.getElementById("CTInfoBoxFrame").style.height=document.getElementById("CTInfoBox").offsetHeight+"px"}}function HideInfoPop(){yyy=-1000;if(document.getElementById("CTInfoBoxFrame")){document.getElementById("CTInfoBoxFrame").style.display="none"}document.getElementById("CTInfoBox").style.display="none"}function get_mouse(a){if(!a){var a=window.event||window.Event}if("undefined"!=typeof a.pageX){mouseX=a.pageX;mouseY=a.pageY}else{mouseX=a.clientX+document.documentElement.scrollLeft;mouseY=a.clientY+document.documentElement.scrollTop}iMouseX=mouseX+Xoffset;if(document.getElementById("CTInfoBoxFrame")){document.getElementById("CTInfoBoxFrame").style.left=mouseX+Xoffset+"px";document.getElementById("CTInfoBoxFrame").style.top=mouseY+yyy+"px"}if(document.getElementById("CTInfoBox")){document.getElementById("CTInfoBox").style.left=mouseX+Xoffset+"px";document.getElementById("CTInfoBox").style.top=mouseY+yyy+"px"}}function updateDivAJAX(a,d,b){if(document.getElementById(a)&&b){document.getElementById(a).innerHTML=b}var c=new ajaxObject(a,d);c.update(a)}function ajaxObject(a,d){var b=this;var e=false;this.callback=function(){};this.update=function(h){if(e==true){return false}e=true;var g=null;if(window.XMLHttpRequest){g=new XMLHttpRequest()}else{g=new ActiveXObject("Microsoft.XMLHTTP")}if(g==null){alert("Your browser doesn't support AJAX.");return false}else{g.onreadystatechange=function(){if(f){if(g.readyState==4||g.readyState=="complete"){var n=g.responseText;if(n.indexOf("|")>-1){n=n.split("|")[1]}f.innerHTML=n;delete g;e=false;b.callback()}}};var l=new Date();var m=c+"?"+h+"&timestamp="+(l*1);g.open("GET",m,true);g.send(null);return true}};var f=document.getElementById(a);var c=d}var dtCh="/";var minYear=1900;var maxYear=2100;function isInteger(a){var d;for(d=0;d<a.length;d++){var b=a.charAt(d);if(((b<"0")||(b>"9"))){return false}}return true}function stripCharsInBag(a,d){var f;var b="";for(f=0;f<a.length;f++){var e=a.charAt(f);if(d.indexOf(e)==-1){b+=e}}return b}function daysInFebruary(a){return(((a%4==0)&&((!(a%100==0))||(a%400==0)))?29:28)}function DaysArray(a){for(var b=1;b<=a;b++){this[b]=31;if(b==4||b==6||b==9||b==11){this[b]=30}if(b==2){this[b]=29}}return this}function CTisDate(d){var h=DaysArray(12);var c=d.indexOf(dtCh);var b=d.indexOf(dtCh,c+1);var f=d.substring(0,c);var g=d.substring(c+1,b);var e=d.substring(b+1);strYr=e;if(f.charAt(0)=="0"&&f.length>1){f=f.substring(1)}if(g.charAt(0)=="0"&&g.length>1){g=g.substring(1)}for(var a=1;a<=3;a++){if(strYr.charAt(0)=="0"&&strYr.length>1){strYr=strYr.substring(1)}}month=parseInt(g);day=parseInt(f);year=parseInt(strYr);if(c==-1||b==-1){return false}if(g.length<1||month<1||month>12){return false}if(f.length<1||day<1||day>31||(month==2&&day>daysInFebruary(year))||day>h[month]){return false}if(e.length!=4||year==0||year<minYear||year>maxYear){return false}if(d.indexOf(dtCh,b+1)!=-1||isInteger(stripCharsInBag(d,dtCh))==false){return false}return true}var MouseYPosition=0;var MouseXPosition=0;function GetMousePosition(){if(window.Event&&document.captureEvents){document.captureEvents(Event.CLICK)}document.onclick=GetMousePositionScript}function GetMousePositionScript(a){if(!a){var a=window.event||window.Event}if("undefined"!=typeof a.pageX){MouseXPosition=a.pageX;MouseYPosition=a.pageY}else{MouseXPosition=a.clientX+document.documentElement.scrollLeft;MouseYPosition=a.clientY+document.documentElement.scrollTop}}GetMousePosition();function updateLocationTo(a){document.getElementById("PackageLocation").value=a}function setCookie(d,a,b){if(a!=null&&a!=""){var c=new Date();c.setDate(c.getDate()+b);document.cookie=d+"="+a+((b==null)?"":"; expires="+c.toGMTString())+((a.indexOf("path=")==-1)?"; path=/":"")}}function getCookie(a){if(document.cookie.length>0){c_start=document.cookie.indexOf(a+"=");if(c_start!=-1){c_start=c_start+a.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end).replace(new RegExp("^[&]+","g"),"").replace(new RegExp("[&]+$","g"),""))}}return""}function PersistCookies(a,b){setCookie(a+"Affiliate",getCookie(a+"Affiliate"),b);setCookie(a,getCookie(a),1)}function readFile(a){if(window.XMLHttpRequest){SyncDOM=new XMLHttpRequest()}else{SyncDOM=new ActiveXObject("Microsoft.XMLHTTP")}if(SyncDOM){if(bDebug){var b=new Date();if(a.indexOf("?")>-1){a=a+"&"+b}else{a=a+"?"+b}}SyncDOM.open("GET",a,false);SyncDOM.send(null);return SyncDOM.responseText}else{return false}}function hideShowPassportInfo(a,b){if(b=="multicom"){for(x=1;x<=a;x++){if(document.getElementById("FOIDVal_"+x).disabled==true){document.getElementById("FOIDVal_"+x).disabled=false;document.getElementById("FOIDVal_"+x).style.display="";document.getElementById("FOIDValTitle_"+x).style.display="";document.getElementById("FOID_ByPass").value=false;document.getElementById("infoPassportExpiryD"+x).disabled=false;document.getElementById("infoPassportExpiryM"+x).disabled=false;document.getElementById("infoPassportExpiryY"+x).disabled=false;if(document.getElementById("infoPassportIssueD"+x)){document.getElementById("infoPassportIssueD"+x).disabled=false;document.getElementById("infoPassportIssueM"+x).disabled=false;document.getElementById("infoPassportIssueY"+x).disabled=false}if(x==a){document.getElementById("FOIDlabel3").innerHTML="Don't have all the passengers passport details right now?"}}else{document.getElementById("FOIDVal_"+x).disabled=true;document.getElementById("FOIDVal_"+x).style.display="none";document.getElementById("FOIDValTitle_"+x).style.display="none";document.getElementById("FOID_ByPass").value=true;document.getElementById("infoPassportExpiryD"+x).disabled=true;document.getElementById("infoPassportExpiryM"+x).disabled=true;document.getElementById("infoPassportExpiryY"+x).disabled=true;if(document.getElementById("infoPassportIssueD"+x)){document.getElementById("infoPassportIssueD"+x).disabled=true;document.getElementById("infoPassportIssueM"+x).disabled=true;document.getElementById("infoPassportIssueY"+x).disabled=true}if(x==a){document.getElementById("FOIDlabel3").innerHTML="Do you have all the passengers passport details?";alert("Please note that passport information will still be required to complete this booking.\n\nYou will be prompted to pay offline at the next stage and one of our team will call you back as soon as possible to confirm the necessary details.")}}}}else{for(x=1;x<=a;x++){if(document.getElementById("infoPassportNum"+x).disabled==true){document.getElementById("FOID_ByPass").value=false;document.getElementById("infoPassportNum"+x).disabled=false;document.getElementById("infoPassportExpiryD"+x).disabled=false;document.getElementById("infoPassportExpiryM"+x).disabled=false;document.getElementById("infoPassportExpiryY"+x).disabled=false;document.getElementById("infoPassportNumTitle"+x).style.display="";document.getElementById("infoPassportExpiryTitle"+x).style.display="";document.getElementById("infoPassportNum"+x).style.display="";document.getElementById("infoPassportExpiryD"+x).style.display="";document.getElementById("infoPassportExpiryM"+x).style.display="";document.getElementById("infoPassportExpiryY"+x).style.display="";if(x==a){document.getElementById("FOIDlabel3").innerHTML="Don't have all the passengers passport details right now?"}}else{document.getElementById("FOID_ByPass").value=true;document.getElementById("infoPassportNum"+x).disabled=true;document.getElementById("infoPassportExpiryD"+x).disabled=true;document.getElementById("infoPassportExpiryM"+x).disabled=true;document.getElementById("infoPassportExpiryY"+x).disabled=true;document.getElementById("infoPassportNumTitle"+x).style.display="none";document.getElementById("infoPassportExpiryTitle"+x).style.display="none";document.getElementById("infoPassportNum"+x).style.display="none";document.getElementById("infoPassportExpiryD"+x).style.display="none";document.getElementById("infoPassportExpiryM"+x).style.display="none";document.getElementById("infoPassportExpiryY"+x).style.display="none";if(x==a){document.getElementById("FOIDlabel3").innerHTML="Do you have all the passengers passport details?";alert("Please note that passport information will still be required to complete this booking.\n\nYou will be prompted to pay offline at the next stage and one of our team will call you back as soon as possible to confirm the necessary details.")}}}}}function CTdivSwitch(a){o1=document.getElementById(a);if(o1){if(o1.style.display==""){o1.style.display="none"}else{o1.style.display=""}}}function fillPassengerData(){sURL="/includes/getpassengerxml.asp?ts="+new Date();var d=false;var a=readFile(sURL);if(window.DOMParser){var f=new DOMParser();var b=f.parseFromString(a,"text/xml")}else{var b=new ActiveXObject("Microsoft.XMLDOM");b.async="false";b.loadXML(a)}var c=b.getElementsByTagName("Passenger");if(c.length>0){d=true;for(x=0;x<c.length;x++){iID=x+1;sTitle=GetNode(c[x].getElementsByTagName("Title")[0].childNodes[0]);sFirstName=GetNode(c[x].getElementsByTagName("FName")[0].childNodes[0]);sSurname=GetNode(c[x].getElementsByTagName("SName")[0].childNodes[0]);sDOBd=GetNode(c[x].getElementsByTagName("DOB_D")[0].childNodes[0]);sDOBm=GetNode(c[x].getElementsByTagName("DOB_M")[0].childNodes[0]);sDOBy=GetNode(c[x].getElementsByTagName("DOB_Y")[0].childNodes[0]);if(sTitle==""||sFirstName==""||sSurname==""||sDOBd==""||sDOBm==""||sDOBy==""){d=false;alert(sTitle+"-"+sFirstName+"-"+sSurname+"-"+sDOBd+"-"+sDOBm+"-"+sDOBy)}o1=document.getElementById("title"+iID);o2=document.getElementById("firstname"+iID);o3=document.getElementById("surname"+iID);o4=document.getElementById("dobd"+iID);o5=document.getElementById("dobm"+iID);o6=document.getElementById("doby"+iID);if(o1){for(y=0;y<o1.length;y++){if(o1[y].value.toLowerCase()==sTitle.toLowerCase()){o1.selectedIndex=y;y=o1.length}}}if(o2){o2.value=sFirstName}if(o3){o3.value=sSurname}if(o4&&o5&&o6){for(y=0;y<o4.length;y++){if(o4[y].value.toLowerCase()==sDOBd.toLowerCase()){o4.selectedIndex=y;y=o4.length}}for(y=0;y<o5.length;y++){if(o5[y].value.toLowerCase()==sDOBm.toLowerCase()){o5.selectedIndex=y;y=o5.length}}for(y=0;y<o6.length;y++){if(o6[y].value.toLowerCase()==sDOBy.toLowerCase()){o6.selectedIndex=y;y=o6.length}}}}}var e=b.getElementsByTagName("ExtraInformation");if(e.length>0){sEmail=GetNode(e[0].getElementsByTagName("Email")[0].childNodes[0]);sTelNo=GetNode(e[0].getElementsByTagName("TelNo")[0].childNodes[0]);if(e[0].getElementsByTagName("FlightNo")[0]!=undefined){sFlightNo=GetNode(e[0].getElementsByTagName("FlightNo")[0].childNodes[0])}if(e[0].getElementsByTagName("OutboundArrivalTime")[0]!=undefined){sArrivalTime=GetNode(e[0].getElementsByTagName("OutboundArrivalTime")[0].childNodes[0])}o1=document.getElementById("email");o2=document.getElementById("telephone");o3=document.getElementById("CarFlightNo");o4=document.getElementById("CarFlightTime");if(o1){o1.value=sEmail}if(o2){o2.value=sTelNo}if(o3){o3.value=sFlightNo}if(o4){for(y=0;y<o4.length;y++){if(o4[y].value.toLowerCase()==sArrivalTime.toLowerCase()){o4.selectedIndex=y;y=o4.length}}}}checkHideInputs(d)}function readFile(a){if(window.XMLHttpRequest){SyncDOM=new XMLHttpRequest()}else{SyncDOM=new ActiveXObject("Microsoft.XMLHTTP")}if(SyncDOM){if(bDebug){var b=new Date();if(a.indexOf("?")>-1){a=a+"&"+b}else{a=a+"?"+b}}SyncDOM.open("GET",a,false);SyncDOM.send(null);return SyncDOM.responseText}else{return false}}function GetNode(a){if(a){return a.nodeValue}return""}function checkHideInputs(a){if(document.getElementById("PersonalInputAreaHidden")&&document.getElementById("PersonalInputAreaShown")){if(a){document.getElementById("PersonalInputAreaHidden").style.display="";document.getElementById("PersonalInputAreaShown").style.display="none"}}}function upsell_showpax(c,g,e){for(i=1;i<=50;i++){var a=document.getElementById(g+"_"+i);if(a){a.style.display="none";var f=a.getElementsByTagName("td");for(j=0;j<=f.length;j++){var b=f[j];if(b){b.style.display="none"}}}else{break}}var d=true;if(c.type==="checkbox"){if(c.checked==false){d=false}}if(d){for(i=1;i<=c.value;i++){var a=document.getElementById(g+"_"+i);if(a){a.style.display="";var f=a.getElementsByTagName("td");for(j=0;j<=f.length;j++){var b=f[j];if(b){b.style.display=""}}}}}}function trim(a){return a.replace(/^\s+|\s+$/g,"")}function isValidPhone(a){isValid=false;if(!a==""){a=a.replace(/\s/g,"");if(/^(01|02|07|08)[0-9]{8,9}.*$/.test(a)){isValid=true}}return isValid}function isValidPostcode(a){isValid=false;if(!a==""){a=a.toUpperCase();if(/^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/.test(a)){isValid=true}}return isValid}var disableOnEnter=false;var sSpecialType;var sCurForm;var sCurSearchType;var sFlasher;var bFirstTimer=false;var intervalAutoComplete;function submitSearchForm(b){var a="";if(document.getElementById("idDepartureAirport"+b)){if(!document.getElementById("idDepartureAirport"+b).value||document.getElementById("idDepartureAirport"+b).value=="-"){a+="Please confirm your departure airport\n"}}if(document.getElementById("idLocationto"+b)){if(!document.getElementById("idLocationto"+b).value||document.getElementById("idLocationto"+b).value=="-"){a+="Please confirm your destination\n"}}if(document.getElementById("idAirportto"+b)){if(!document.getElementById("idAirportto"+b).value||document.getElementById("idAirportto"+b).value=="-"){a+="Please select your destination airport\n"}}if(a){alert(a)}else{document.forms["frm"+b].submit()}}function DisableOnEnter(a){disableOnEnter=a}function OpenSearch(){if(document.getElementById("DivLocations")){showhidechangeoptions("show")}}function checkAndRemoveReturnDate(a){if(document.forms["frm"+a].oneway){var b="";if(document.forms["frm"+a].oneway.checked!=true){b="none"}if(document.getElementById("idReturnDateText"+a)){document.getElementById("idReturnDateText"+a).style.display=b}if(document.getElementById("idReturnDateField"+a)){document.getElementById("idReturnDateField"+a).style.display=b}}}function changeCarInclude(a,c){var b=0;sList=a.includecar;for(x=0;x<sList.length;x++){if(sList[x].checked==true&&sList[x].value=="yes"){b=1;a.flexibility.disabled=true;if(a.flexibility.value!="0"&&a.flexibility.value!=""){alert("By including car hire, date flexibility has been disabled.")}if(c==1){a.flexibility.selectedIndex=0}else{a.flexibility.selectedIndex=1}}else{if(b==0){a.flexibility.disabled="";if(c==1){a.flexibility.selectedIndex=3}else{a.flexibility.selectedIndex=4}}}}}function onEnterSearch(a,b){}function showFullSearch(){if(document.getElementById("DivShow")){showhidechangeoptions("show")}}function validateLocationForm(){var c="";var d="";var f="";sSubmitForm=document.getElementsByName("frm"+sCurForm);sLocationID=document.getElementById("idLocationto"+sCurForm);var b=sSubmitForm.elements,a="";if(sLocationID.value=="-"){a+="- Please select a destination.\n"}arStartDate=document.getElementById("startdate"+sCurForm).value.split(" ");if(arStartDate.length!=3){a+="- Departure date is not valid.\n"}if(document.getElementById("rooms"+sCurForm)){if(document.getElementById("rooms"+sCurForm).value=="0"){a+="- Please select no. of rooms\n"}}if(a){showFullSearch();switchLocationDivs("divLocation"+sCurForm);alert("The following errors occurred:\n\n"+a);return false}else{sSubmitForm[0].submit()}}function locationGoBack(c){var a=document.getElementById("idLocationto"+c);var b=document.getElementById("idFreetext"+c);clearLocationList(a);div_switch("divLocationLoad"+c,false,true);div_switch("divLocation"+c,false,true);div_switch("divFreetext"+c,true,true);if(document.getElementById("idConfirmedDestination"+c)){document.getElementById("idConfirmedDestination"+c).style.display="none"}if(document.getElementById("idConfirmDestinationDDL"+c)){document.getElementById("idConfirmDestinationDDL"+c).style.display=""}if(document.getElementById("idConfirmDepartureAirport"+c)){document.getElementById("idConfirmDepartureAirport"+c).style.display="none"}if(document.getElementById("idConfirmDepartureAirportDDL"+c)){document.getElementById("idConfirmDepartureAirportDDL"+c).style.display=""}clearInterval(intervalAutoComplete)}function switchLocationDivs(a){div_switch("divFreetext"+sCurForm,false,true);div_switch("divLocationLoad"+sCurForm,false,true);div_switch("divLocation"+sCurForm,false,true);div_switch(a,true,true)}function clearLocationList(a){if(a!=0){while(a.options.length>0){a.options[0]=null}while(a.hasChildNodes()){a.removeChild(a.firstChild)}}}function HideAutoCompleteDiv(a){if(document.getElementById(a)){document.getElementById(a).style.display="none";if(document.getElementById("DivShim")){document.getElementById("DivShim").style.display="none";document.getElementById("DivShim").parentNode.removeChild(document.getElementById("DivShim"))}clearInterval(intervalAutoComplete)}}function countPassengers(){var a=0;sSubmitForm=document.forms["frm"+sCurForm];if(sCurForm.indexOf("Flight")>-1||sCurForm.indexOf("Package")>-1){if(sCurSearchType=="Hotel"){for(x=1;x<parseFloat(sSubmitForm.rooms.value)+1;x++){if(sSubmitForm.elements["r"+x+"a"]){a+=parseFloat(sSubmitForm.elements["r"+x+"a"].value);a+=parseFloat(sSubmitForm.elements["r"+x+"c"].value);a+=parseFloat(sSubmitForm.elements["r"+x+"i"].value)}}}else{if(sSubmitForm.elements.seats_adult){a+=parseFloat(sSubmitForm.elements.seats_adult.value);a+=parseFloat(sSubmitForm.elements.seats_child.value);a+=parseFloat(sSubmitForm.elements.seats_infant.value)}}}return a}function getLocations(l,a,m,h){if(!disableOnEnter){sSpecialType=h;sCurForm=a;sCurSearchType=m;var b=document.getElementById("idFreetext"+sCurForm);var g=false;var n=false;if(document.getElementById("idPopularDestinations"+sCurForm)){if(document.getElementById("idPopularDestinations"+sCurForm).value!=""){var d=document.getElementById("idPopularDestinations"+sCurForm);l=document.getElementById("idPopularDestinations"+sCurForm).options[document.getElementById("idPopularDestinations"+sCurForm).selectedIndex].text;l=l.replace("-","");l=LTrim(l);g=true}else{var d=document.getElementById("idLocationto"+sCurForm)}}else{var d=document.getElementById("idLocationto"+sCurForm)}if(document.getElementById("idFreetextDep"+sCurForm)){n=true;var c=document.getElementById("idFreetextDep"+sCurForm);var e=document.getElementById("idDepartureAirport"+sCurForm);var f=c.value.replace("'","")}else{var c="";var e="";var f=""}l=l.replace("'","");if(countPassengers()>9){alert("You can only search for a maximum of 9 passengers when your search includes a flight")}else{if(n&&(c.value.length<1||c.value=="- type your departure airport -")){showFullSearch();alert("Please enter your departure airport");c.focus()}else{if((b.value.length<1||b.value=="- type your destination -"||b.value==" - Type your destination here -")&&!g){showFullSearch();alert("Please enter your destination");if(document.getElementById("idFreetextSearch"+sCurForm).style.display!="none"){b.focus()}}else{if(d.value==""||(n&&e.value=="")||(g&&sCurForm!="Hotel")){intervalAutoComplete=setInterval("HideAutoCompleteDiv('as_idFreetext"+a+"')",500);sURL="/includes/search/LookupXML.asp?searchtype="+sCurSearchType+"&location="+l+"&departure="+f+"&hund";if(sURL!=""){if(bDebug){if(confirm("Open "+sURL)){window.open(sURL)}}if(!g){clearLocationList(d)}setTimeout("loadLocationXMLDoc('"+sURL+"')",100)}else{alert("No url defined")}}else{validateLocationForm()}}}}}}function LTrim(a){var b=/\s*((\S+\s*)*)/;return a.replace(b,"$1")}function loadLocationXMLDoc(b){var a=processLocationChange;if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=a;req.open("GET",b,true);req.send(null)}else{if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=a;req.open("GET",b,true);req.send()}}}}function processLocationChange(){switchLocationDivs("divLocationLoad"+sCurForm);if(document.getElementById("idAirportto"+sCurForm)){sLocationList=document.getElementById("idAirportto"+sCurForm);sLocationList.disabled="true"}var c=document.getElementById("idLocationto"+sCurForm);if(document.getElementById("idDepartureAirport"+sCurForm)){var g=true;var d=document.getElementById("idDepartureAirport"+sCurForm)}else{var d=""}var e=document.getElementById("idFreetext"+sCurForm);if(req.readyState==4){if(req.status==200){xmldoc=req.responseXML.documentElement;nodes=xmldoc.getElementsByTagName("Location");nodesDeparturePoints=xmldoc.getElementsByTagName("DepartureAirport");c.options[0]=new Option("- Select a destination -","-");for(var l=0;l<nodes.length;l++){if(nodes.length!=0){var a=nodes.item(l).attributes.getNamedItem("title").nodeValue;if(b!=a){var m=document.createElement("optgroup");m.label=a;if(a!="zzz"){c.appendChild(m)}else{if(l>0){m.label="Others";c.appendChild(m)}}}var b=a;sCode=nodes.item(l).attributes.getNamedItem("code").nodeValue;sName=nodes.item(l).childNodes.item(0).nodeValue;c.options[c.options.length]=new Option(sName,sCode)}}if(nodes.length==1&&sSpecialType!="contact"){if(document.getElementById("idConfirmDestinationDDL"+sCurForm)){document.getElementById("idConfirmDestinationDDL"+sCurForm).style.display="none"}if(document.getElementById("idConfirmedDestination"+sCurForm)){document.getElementById("idConfirmedDestination"+sCurForm).style.display="";document.getElementById("idConfirmedDestinationText"+sCurForm).innerHTML=c.options[1].innerHTML}c.options[1].selected=true;findDestAirport(sCurForm,c.options[1].value);bFirstTimer=true}else{if(nodes.length<1){showFullSearch();var f="No destinations found.\n\nClick OK to open the destination guide or cancel to go back and refine your search!";switch(sCurForm){case"FlightHotel":f="No destinations found for your flight and hotel search.\nWe may only be able to provide you with a flight to this destination.\n\nClick OK to open the destination guide or cancel to go back and refine your search!";break;case"Hotel":f="No destinations found for your hotel search.\n\nClick OK to open the destination guide or cancel to go back and refine your search!";break;case"Flight":f="No destinations found for your flight search.\n\nClick OK to open the destination guide or cancel to go back and refine your search!";break}if(confirm(f)){locationGoBack(sCurForm);openDestinationHelp(sCurSearchType.toLowerCase(),"frm"+sCurForm)}else{locationGoBack(sCurForm);e.focus();e.select()}}else{showFullSearch();switchLocationDivs("divLocation"+sCurForm);sFlasher=setInterval("selectFlash();",600)}}if(g&&sCurForm.toLowerCase().indexOf("flight")!=-1){clearLocationList(d);d.options[0]=new Option("- Select a departure airport -","-");for(var l=0;l<nodesDeparturePoints.length;l++){if(nodesDeparturePoints.length!=0){var a=nodesDeparturePoints.item(l).attributes.getNamedItem("title").nodeValue;if(b!=a){var m=document.createElement("optgroup");m.label=a;if(a!="zzz"){d.appendChild(m)}else{if(l>0){m.label="Others";d.appendChild(m)}}}var b=a;sCode=nodesDeparturePoints.item(l).attributes.getNamedItem("code").nodeValue;sName=nodesDeparturePoints.item(l).childNodes.item(0).nodeValue;d.options[d.options.length]=new Option(sName,sCode)}}if(nodesDeparturePoints.length==1&&sSpecialType!="contact"){if(document.getElementById("idConfirmDepartureAirportDDL"+sCurForm)){document.getElementById("idConfirmDepartureAirportDDL"+sCurForm).style.display="none"}if(document.getElementById("idConfirmDepartureAirport"+sCurForm)){document.getElementById("idConfirmDepartureAirport"+sCurForm).style.display="";document.getElementById("idConfirmedDepartureAirportText"+sCurForm).innerHTML=d.options[1].innerHTML}d.options[1].selected=true}else{if(nodesDeparturePoints.length<1){showFullSearch();var f="No departure airports found.";switch(sCurForm){case"FlightHotel":f="No departure airports found for your flight and hotel search.";break;case"Flight":f="No departure airports found for your flight search.";break}if(confirm(f)){locationGoBack(sCurForm);openDestinationHelp("departureairport","frm"+sCurForm)}else{var h=document.getElementById("idFreetextDep"+sCurForm);locationGoBack(sCurForm);h.focus();h.select()}}else{showFullSearch();switchLocationDivs("divLocation"+sCurForm);sFlasher=setInterval("selectFlash();",600)}}}}else{alert("There was a problem retrieving the XML data:\n"+req.statusText)}}}var sCurrentFormID="";var sCurrentForm="";function findDestAirport(b,a){sCurrentForm=document.getElementsByName("frm"+b);sCurrentFormID=b;if(document.getElementById("idAirportto"+b)){sLocationList=document.getElementById("idAirportto"+b);sLocationList.disabled="true";if(a.length>0&&a!="-"){sURL="/includes/search/LookupXML.asp?searchtype=findairports&location="+a+"&c";if(sURL!=""){if(bDebug){if(confirm("Open "+sURL)){window.open(sURL)}}clearLocationList(sLocationList);sLocationList.options[0]=new Option("Loading... Please wait","");setTimeout("loadServedAirportXMLDoc('"+sURL+"')",100)}else{alert("No url defined")}}else{sLocationList.options[0]=new Option("- Select destination airport -","");sLocationList.selectedIndex=0;sLocationList.disabled="true"}}else{if(!document.getElementById("idDepartureAirport"+b)){sCurrentForm[0].submit()}else{switchLocationDivs("divLocation"+b)}}}function loadServedAirportXMLDoc(a){if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=processServedAirportChange;req.open("GET",a,true);req.send(null)}else{if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=processServedAirportChange;req.open("GET",a,true);req.send()}}}}function processServedAirportChange(){if(req.readyState==4){if(req.status==200){sLocationList=document.getElementById("idAirportto"+sCurrentFormID);xmldoc=req.responseXML.documentElement;nodes=xmldoc.getElementsByTagName("Location");sLocationList.options[0]=new Option("- Select destination airport -","");for(var a=0;a<nodes.length;a++){if(nodes.length!=0){sCode=nodes.item(a).attributes.getNamedItem("code").nodeValue;sName=nodes.item(a).childNodes.item(0).nodeValue;sLocationList.options[sLocationList.options.length]=new Option(sName,sCode)}}sLocationList.disabled="";if(nodes.length==1){sLocationList.selectedIndex=1;if(!document.getElementById("idDepartureAirport"+sCurrentFormID)){sCurrentForm[0].submit()}else{switchLocationDivs("divLocation"+sCurrentFormID)}}else{if(nodes.length==0&&bFirstTimer==true){alert("No airports found for this destination");locationGoBack(sCurrentFormID)}else{switchLocationDivs("divLocation"+sCurrentFormID)}}}}}function addDurationBYO(d){var a=new Array("January","February","March","April","May","June","July","August","September","October","November","December");oSelect=document.getElementById("startdate_d"+d);iDay=oSelect.options[oSelect.selectedIndex].value;oSelect=document.getElementById("startdate_m"+d);iMonth=oSelect.options[oSelect.selectedIndex].value;oSelect=document.getElementById("startdate_y"+d);iYear=oSelect.options[oSelect.selectedIndex].value;cindate=new Date(iYear,iMonth-1,iDay,0,0,0);oSelect=document.getElementById("duration"+d);if(oSelect.options[oSelect.selectedIndex].value=="other"){tmpDuration=prompt("Please enter the number of nights","");if((tmpDuration==" ")||(tmpDuration==null)||(tmpDuration=="")){iDuration=7;oSelect.options[0].selected="selected"}else{var b=tmpDuration;if(b<10){b="0"+b}for(loop=0;loop<oSelect.options.length;loop++){if(oSelect.options[loop].value==b){oSelect.options[loop].selected="selected";iDuration=b}}if(isNumeric(tmpDuration)==true){var c=new Option(tmpDuration+" days",tmpDuration);insertOptionAt(oSelect,c,oSelect.options.length);iDuration=oSelect.options[oSelect.options.length-1].value;oSelect.selectIndex=oSelect.options.length;oSelect.options[oSelect.options.length-1].selected="selected"}else{iDuration=7;oSelect.options[0].selected="selected"}}}else{iDuration=oSelect.options[oSelect.selectedIndex].value}days=1000*60*60*24*iDuration;newdate=new Date(cindate.valueOf()+days);if((newdate.getHours()!=0)||(newdate.getMinutes()!=0)||(newdate.getSeconds()!=0)){time=newdate.getHours()*60*60*1000;time+=newdate.getMinutes()*60*1000;time+=newdate.getSeconds()*1000;newdate=new Date(newdate.getTime()+time)}if(newdate.getDate()+""!="NaN"){sArrDate=newdate.getDate()+" "+a[newdate.getMonth()]+" "+newdate.getFullYear()}else{sArrDate="Please select a departure date."}document.getElementById("arrdate"+d).innerHTML="<b>"+sArrDate+"</b>"}function GetElementWidth(b){var a;if(typeof(b)=="object"){a=b}else{a=document.getElementById(b)}return parseInt(a.offsetWidth)}function clearFlash(){try{var b=document.getElementById("idLocationto"+sCurForm);clearInterval(sFlasher);b.className="redSelectBox"}catch(a){}}function selectFlash(){var a=document.getElementById("idLocationto"+sCurForm);if(a.className=="redSelectBox"){a.className="redSelectBox_Switch"}else{a.className="redSelectBox"}}function updateRooms(c,g,d){if(d==null){formid=""}else{formid=d}if(c){var e=parseInt(c.options[c.selectedIndex].value);if(!e==0){for(var f=1;f<=g;f++){var a=document.getElementById("trRoom"+f+"Values"+formid);var b=document.getElementById("trRoom"+f+"Ages"+formid);vAgeControl=parseFloat(document.getElementById("ageControl"+f+formid).value);if(a){if(f>e){a.style.display="none"}else{a.style.display=""}}if(b){if(f>e){b.style.display="none"}else{if(!vAgeControl==0){b.style.display=""}}}}}}}function updatePax(n,o,w,z){var c=document.getElementById("rooms");var m=0,t=0,b=0,v=0,q=0,p=0,a=0;var r=false;if(c){r=true;var f=parseInt(c.options[c.selectedIndex].value);for(var s=1;s<=f;s++){t=0;b=0;v=0;var h=document.getElementById("r"+s+"a");if(h){t=parseInt(h.options[h.selectedIndex].value)}var l=document.getElementById("r"+s+"c");if(l){b=parseInt(l.options[l.selectedIndex].value)}var e=document.getElementById("r"+s+"i");if(e){v=parseInt(e.options[e.selectedIndex].value)}m+=t+b+v;if(n!=-1){if(m>n){alert("The maximum number of people allowed across all rooms is "+n);r=false}}if(r&&o!=-1){if(t>o){alert("The maximum number of adults allowed in room "+s+" is "+o);r=false}}if(r&&w!=-1){if(b>w){alert("The maximum number of children allowed in room "+s+" is "+w);r=false}}if(r&&z!=-1){if(v>z){alert("The maximum number of infants allowed in room "+s+" is "+z);r=false}}if(b>0||v>0){for(var g=1;g<=w;g++){obj=document.getElementById("r"+s+"c_ages"+g);if(obj){if(g<=b){obj.style.display="block"}else{obj.style.display="none"}}}obj=document.getElementById("sCAges"+s);if(obj){if(b<1){obj.style.display="none"}else{obj.style.display="block"}}for(var d=1;d<=z;d++){obj=document.getElementById("r"+s+"i_ages"+d);if(obj){if(d<=v){obj.style.display="block"}else{obj.style.display="none"}}}obj=document.getElementById("sIAges"+s);if(obj){if(v<1){obj.style.display="none"}else{obj.style.display="block"}}}if(b<1){for(var g=1;g<=w;g++){obj=document.getElementById("r"+s+"c_ages"+g);if(obj){obj.style.display="none"}}obj=document.getElementById("sCAges"+s);if(obj){obj.style.display="none"}}if(v<1){for(var d=1;d<=z;d++){obj=document.getElementById("r"+s+"i_ages"+d);if(obj){obj.style.display="none"}}obj=document.getElementById("sIAges"+s);if(obj){obj.style.display="none"}}q+=t;p+=b;a+=v}var u=document.getElementById("seats_adult");if(u&&t<=u.options.length){u.options[q].selected=true}var u=document.getElementById("seats_child");if(u&&b<=u.options.length){u.options[p].selected=true}var u=document.getElementById("seats_infant");if(u&&v<=u.options.length){u.options[a].selected=true}}return r}function updatePax2(d,c,e){if(e==null){formid=""}else{formid=e}vPerson=parseFloat(document.getElementById("r"+d+c+formid).value);vAgeControl=parseFloat(document.getElementById("ageControl"+d+formid).value);var b=document.getElementById("trRoom"+d+"Ages"+formid);for(i=1;i<15;i++){if(i>vPerson){div_switch("r"+d+c+"_ages"+i+formid,false,true)}else{var a="yes";div_switch("r"+d+c+"_ages"+i+formid,true,true)}}if(a=="yes"){if(document.getElementById("s"+c.toUpperCase()+"Ages"+d+formid).style.display=="none"){vAgeControl=vAgeControl+1}div_switch("s"+c.toUpperCase()+"Ages"+d+formid,true,true)}else{if(document.getElementById("s"+c.toUpperCase()+"Ages"+d+formid).style.display=="block"){vAgeControl=vAgeControl-1}div_switch("s"+c.toUpperCase()+"Ages"+d+formid,false,true)}if((vAgeControl==0)&&(b)){div_switch("trRoom"+d+"Ages"+formid,false,true)}else{if(b){div_switch("trRoom"+d+"Ages"+formid,true,true)}}document.getElementById("ageControl"+d+formid).value=vAgeControl}function switchPopularFreetextSearch(a){if(document.getElementById("idPopularSearch"+a).style.display==""){document.getElementById("idPopularSearch"+a).style.display="none";document.getElementById("idFreetextSearch"+a).style.display="";document.getElementById("idSearchSwitchLink"+a).innerHTML="View our popular destinations?";document.getElementById("idPopularDestinations"+a).selectedIndex=0}else{document.getElementById("idPopularSearch"+a).style.display="";document.getElementById("idFreetextSearch"+a).style.display="none";document.getElementById("idSearchSwitchLink"+a).innerHTML="Can't find your destination?"}}function checkCarOnlyForm(b){var a="";if(b.country.value=="-"||b.country.value==""){a=a+"\n- Country is not selected"}if(b.pickup.value=="-"||b.pickup.value==""){a=a+"\n- Pickup point is not selected"}if(a!=""){OpenSearch();alert("The following errors occured:\n"+a);return false}else{return true}}function clearListCar(a){if(a!=0){while(a.options.length>0){a.options[0]=null;a.disabled="disabled"}while(a.hasChildNodes()){a.removeChild(a.firstChild)}a.options[0]=new Option("- Loading pickup points -","-");a.options[1]=new Option("- Select a pickup point -","-")}}function changePickupPoints(a){var b=document.getElementById("idPickup");sURL="/includes/HolidayAutos/pickuppointsXML.asp?country="+a;if(sURL!=""){clearListCar(b);setTimeout("loadCarhireXMLDoc('"+sURL+"')",100)}else{alert("No url defined")}}function loadCarhireXMLDoc(b){var a=processCarhireChange;if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=a;req.open("GET",b,true);req.send(null)}else{if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=a;req.open("GET",b,true);req.send()}}}}function processCarhireChange(){var c=document.getElementById("idPickup");if(req.readyState==4){if(req.status==200){xmldoc=req.responseXML.documentElement;nodes=xmldoc.getElementsByTagName("pp");for(var b=0;b<nodes.length;b++){if(nodes.length!=0){var a=nodes.item(b).attributes.getNamedItem("regionname").nodeValue;if(e!=a){var d=document.createElement("optgroup");d.label=a;if(a!="zzz"){c.appendChild(d)}else{if(b>0){d.label="Others";c.appendChild(d)}}}var e=a;sId=nodes.item(b).attributes.getNamedItem("id").nodeValue;sName=nodes.item(b).childNodes.item(0).nodeValue;c.options[c.options.length]=new Option(sName,sId)}}c.options[0]=null;c.disabled="";if(nodes.length==1){c.options[1].selected=true}}else{alert("There was a problem retrieving the XML data:\n"+req.statusText)}}}var depAirport;function loadPackageXML(){if(window.ActiveXObject){xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async=false;xmlDoc.load("/includes/packageholidays_destinations.xml");getPackageDestinations()}else{if(document.implementation&&document.implementation.createDocument){xmlDoc=document.implementation.createDocument("","",null);xmlDoc.load("/includes/packageholidays_destinations.xml");xmlDoc.onload=getPackageDestinations}else{alert("Your browser cannot handle this script")}}}function clearListPackage(a){if(a!=0){while(a.options.length>0){a.options[0]=null}while(a.hasChildNodes()){a.removeChild(a.firstChild)}a.options[0]=new Option("- Loading destination -","")}}function clearListGeneric(b,a){if(b!=0){while(b.options.length>0){b.options[0]=null}while(b.hasChildNodes()){b.removeChild(b.firstChild)}b.options[0]=new Option(a,"")}}function getPackageDestinations(a){sDestinationDDL=document.getElementById("packageLocationToPackages");sDestinationDDL.disabled="disabled";clearListPackage(sDestinationDDL);if(a!=undefined&&a.length==3){depAirport=a}if(typeof xmlDoc=="object"){Departure=xmlDoc.getElementsByTagName("Departure");for(x=0;x<Departure.length;x++){if(Departure[x].attributes.getNamedItem("AirportCode").nodeValue==depAirport){Destination=Departure[x].getElementsByTagName("Destination");for(y=0;y<Destination.length;y++){sAirportCode=Destination[y].attributes.getNamedItem("AirportCode").nodeValue;sAirportName=Destination[y].attributes.getNamedItem("AirportName").nodeValue;sCountryName=Destination[y].attributes.getNamedItem("CountryName").nodeValue;if(b!=sCountryName){var c=document.createElement("optgroup");c.label=sCountryName;sDestinationDDL.appendChild(c)}var b=sCountryName;sDestinationDDL.options[sDestinationDDL.options.length]=new Option(sAirportName,sAirportCode)}}}sDestinationDDL.options[0].innerHTML="- Select your destination -";sDestinationDDL.disabled=""}else{loadPackageXML()}}function disableTourForm(a){if(a==1){oTourTypesDDL=document.getElementById("tourtypeTours");oTourTypesDDL.disabled="disabled";clearListGeneric(oTourTypesDDL,"- Loading Types - ");oTourTypesDDL.options[0]=new Option("- Select a country -","");oTourTypesDDL.options[0].selected="selected"}if(a==1||a==2){oTourTypesDDL=document.getElementById("touroptionTours");oTourTypesDDL.disabled="disabled";clearListGeneric(oTourTypesDDL,"- Loading Types - ");oTourTypesDDL.options[0]=new Option("- Select a type -","");oTourTypesDDL.options[0].selected="selected"}if(a==1||a==2||a==3){oTransportMethod=document.getElementById("tourtransportmethodTours");oTransportMethod.disabled="disabled"}if(a==1||a==2||a==3||a==4){oTransportMethod.options[0].selected="selected";oAirportFrom=document.getElementById("airportfromTours");oAirportFrom.disabled="disabled"}if(a==1||a==2||a==3||a==4||a==5){oAirportFrom.options[0].selected="selected";oLeaveDate=document.getElementById("startdateTours");oLeaveDate.disabled="disabled";oLeaveDate.options[0].selected="selected"}}function getTourTypes(e,d,c){if(c==0){disableTourForm(1);oTourTypesDDL=document.getElementById("touroptionTours");oTourTypesDDL.disabled="disabled";oTourTypesDDL=document.getElementById("tourtypeTours")}else{oTourTypesDDL=document.getElementById("touroptionTours");disableTourForm(2)}if(e!=""){oTourTypesDDL.disabled="disabled";clearListGeneric(oTourTypesDDL,"- Loading Types - ");var f=readFile("/includes/search/LookupTourOpXML.asp?searchtype=tourtype&location="+e+"&parent="+c);if(window.DOMParser){var g=new DOMParser();var b=g.parseFromString(f,"text/xml")}else{var b=new ActiveXObject("Microsoft.XMLDOM");b.async="false";b.loadXML(f)}oTourTypesDDL.options[0]=new Option("- Select a type -","");var a=b.getElementsByTagName("Type");if(a.length>0){for(x=0;x<a.length;x++){oTourTypesDDL.options[oTourTypesDDL.options.length]=new Option(a[x].attributes.getNamedItem("title").nodeValue,a[x].attributes.getNamedItem("code").nodeValue)}}oTourTypesDDL.disabled="";if(c!=0){oTourTypesDDL.options[0]=new Option("All Options","");oTourTypesDDL.options[0].selected="selected";oTransportMethod=document.getElementById("tourtransportmethodTours");oTransportMethod.disabled=""}}}function changeTransportMethod(d,c){var b=document.getElementById("airportfromTours");var a=document.getElementById("startdateTours");a.disabled="";if(d==""){a.disabled="disabled"}if(d=="Flight"){b.disabled="";b.options[0]=new Option("- Select an airport -","");b.options[0].selected="selected"}else{b.options[0]=new Option("- Select a method -","");b.disabled="disabled";b.options[0].selected="selected"}getTourDates(d,c)}function getTourNames(c,b){sDestinationDDL=document.getElementById("packageLocationTours");if(c!=""){sDestinationDDL.disabled="disabled";clearListPackage(sDestinationDDL);var d=readFile("/includes/search/LookupTourOpXML.asp?searchtype=tour&location="+c);if(window.DOMParser){var f=new DOMParser();var a=f.parseFromString(d,"text/xml")}else{var a=new ActiveXObject("Microsoft.XMLDOM");a.async="false";a.loadXML(d)}sDestinationDDL.options[0]=new Option("- All tours -","");var e=a.getElementsByTagName("Location");if(e.length>0){for(x=0;x<e.length;x++){sDestinationDDL.options[sDestinationDDL.options.length]=new Option(e[x].attributes.getNamedItem("title").nodeValue,e[x].attributes.getNamedItem("code").nodeValue)}}sDestinationDDL.disabled=""}else{sDestinationDDL.disabled="disabled";clearListPackage(sDestinationDDL);sDestinationDDL.options[0]=new Option("- Select a country -","")}getTourDates(0,c,b)}function getTourDates(e,a){oCountry=document.getElementById("countryTours");if(oCountry!=null){iCountry=oCountry.options[oCountry.selectedIndex].value}oType=document.getElementById("tourtypeTours");if(oType!=null){iType=oType.options[oType.selectedIndex].value}oOption=document.getElementById("touroptionTours");if(oOption!=null){iOption=oOption.options[oOption.selectedIndex].value}var c="tdTourDates";if(iOption==""){iCatID=iType}else{iCatID=iOption}var d="/includes/search/TourDates.asp?CountryID="+iCountry+"&FormID="+a+"&CategoryID="+iCatID+"&Method="+e;var b=new TourAJAX(c,d);b.update(c)}var currentFrm="";var currentType="";var mouseX=0;var mouseY=0;var destLoaderHTML='<div style="text-align:center"><img src="/images/animations/ajax-loader-white.gif" style="margin-top:40px; margin-bottom:5px;" /><br /><div style="margin-bottom:4px;"><strong>Loading destinations... Please wait.</strong></div></div>';function getDestinationHelpDest(b,a){sURL="/includes/destinationhelp/lookup_dest.asp?country="+b+"&type="+a+"&qsss";if(!b){openDestinationHelp(currentType,currentFrm)}else{if(document.getElementById("destinationHelpDest")){document.getElementById("destinationHelpDest").innerHTML=destLoaderHTML}if(sURL){setTimeout("loadDestinationHelpXMLDoc('"+sURL+"','dest')",100)}}}function setDestination(a){document.forms[currentFrm].freetext.value=a;closeDestinationHelp()}function setDeparture(a){document.forms[currentFrm].airportfrom.value=a;closeDestinationHelp()}function closeDestinationHelp(){clearInterval(intervalAutoComplete);document.getElementById("destinationHelp").style.display="none";if(document.getElementById("destinationHelpFrame")){document.getElementById("destinationHelpFrame").style.display="none"}grayOut(false)}function openDestinationHelp(b,a){clearInterval(intervalAutoComplete);currentType=b;currentFrm=a;sURL="/includes/destinationhelp/lookup_top.asp?type="+b+"&qs";if(sURL){grayOut(true);setTimeout("loadDestinationHelpXMLDoc('"+sURL+"','top')",100)}}function loadDestinationHelpXMLDoc(b,a){if(a=="top"){var c=processDestinationHelpTop}else{var c=processDestinationHelpDest}if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=c;req.open("GET",b,true);req.send(null)}else{if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=c;req.open("GET",b,true);req.send()}}}}function processDestinationHelpDest(){if(req.readyState==4){if(req.status==200){html=req.responseText;if(document.getElementById("destinationHelpDest")){document.getElementById("destinationHelpDest").innerHTML=html}}else{alert("There was a problem retrieving the XML data:\n"+req.statusText);grayOut(false)}}}function processDestinationHelpTop(){if(req.readyState==4){if(req.status==200){html=req.responseText;document.getElementById("destinationHelp").style.display="block";if(document.getElementById("destinationHelpFrame")){document.getElementById("destinationHelpFrame").style.top=document.getElementById("destinationHelp").offsetTop+"px";document.getElementById("destinationHelpFrame").style.left=document.getElementById("destinationHelp").offsetLeft+"px";document.getElementById("destinationHelpFrame").style.width="520px";document.getElementById("destinationHelpFrame").style.height="350px";document.getElementById("destinationHelpFrame").style.display="block"}if(document.getElementById("destinationHelpTop")){document.getElementById("destinationHelpTop").innerHTML=html}if(document.getElementById("destinationHelpDest")){if(currentType=="airport"){sHTML='<div style="margin-top:25px; margin-left:10px;">';sHTML+="<strong>Not sure of the name of the airport?</strong><br><br>";sHTML+='<div style="float:left"><img src="/images/other/alternative_dest.gif" style="margin-left:10px;" /></div>';sHTML+='<div style="float:left; margin-top:5px;">';sHTML+='<ul type="square">';sHTML+="<li>Choose the country you are travelling to from the drop down.</li>";sHTML+="<li>All airports are listed alphabetically.</li>";sHTML+="<li>Click on the correct airport.</li>";sHTML+="<li>Search</li>";sHTML+="<li>Fly!</li>";sHTML+="</ul>";sHTML+="</div>";sHTML+="</div>"}else{if(currentType=="departureairport"){sHTML='<div style="margin-top:25px; margin-left:10px;">';sHTML+="<strong>Not sure of the name of your departure airport?</strong><br><br>";sHTML+='<div style="float:left"><img src="/images/other/alternative_dest.gif" style="margin-left:10px;" /></div>';sHTML+='<div style="float:left; margin-top:5px;">';sHTML+='<ul type="square">';sHTML+="<li>Choose the country from which you are travelling from the dropdown list above</li>";sHTML+="<li>All airports are listed alphabetically.</li>";sHTML+="<li>Click on the correct airport.</li>";sHTML+="<li>Search</li>";sHTML+="<li>Fly!</li>";sHTML+="</ul>";sHTML+="</div>";sHTML+="</div>"}else{sHTML='<div style="margin-top:25px; margin-left:10px;">';sHTML+="<strong>Not sure of the name of the city?</strong><br><br>";sHTML+='<div style="float:left"><img src="/images/other/alternative_dest.gif" style="margin-left:10px;" /></div>';sHTML+='<div style="float:left; margin-top:5px;">';sHTML+='<ul type="square">';sHTML+="<li>Choose the country you are travelling to from the drop down.</li>";sHTML+="<li>All cities are listed alphabetically.</li>";sHTML+="<li>Click on the correct city.</li>";sHTML+="<li>Search</li>";sHTML+="</ul>";sHTML+="</div>";sHTML+="</div>"}}document.getElementById("destinationHelpDest").innerHTML=sHTML}}else{alert("There was a problem retrieving the XML data:\n"+req.statusText)}}}if(typeof(bsn)=="undefined"){_b=bsn={}}if(typeof(_b.Autosuggest)=="undefined"){_b.Autosuggest={}}else{alert("Autosuggest is already set!")}_b.AutoSuggest=function(c,a){if(!document.getElementById){return 0}this.fld=_b.DOM.gE(c);if(!this.fld){return 0}this.sInp="";this.nInpC=0;this.aSug=[];this.iHigh=0;this.oP=a?a:{};var d,e={minchars:1,meth:"get",varname:"input",className:"autosuggest",timeout:18500,delay:500,offsety:-5,shownoresults:true,noresults:"",maxheight:250,cache:true,maxentries:25};for(d in e){if(typeof(this.oP[d])!=typeof(e[d])){this.oP[d]=e[d]}}var b=this;this.fld.onkeypress=function(f){return b.onKeyPress(f)};this.fld.onkeyup=function(f){return b.onKeyUp(f)};this.fld.setAttribute("autocomplete","off")};_b.AutoSuggest.prototype.onKeyPress=function(d){var c=(window.event)?window.event.keyCode:d.keyCode;var a=13;var e=9;var f=27;var b=1;switch(c){case a:this.setHighlightedValue();b=0;break;case e:this.setHighlightedValue();b=0;break;case f:this.clearSuggestions();break}return b};_b.AutoSuggest.prototype.onKeyUp=function(c){var b=(window.event)?window.event.keyCode:c.keyCode;var a=38;var d=40;var e=1;switch(b){case a:this.changeHighlight(b);e=0;break;case d:this.changeHighlight(b);e=0;break;default:this.getSuggestions(this.fld.value)}return e};_b.AutoSuggest.prototype.getSuggestions=function(f){if(f==this.sInp){return 0}_b.DOM.remE(this.idAs);this.sInp=f;if(f.length<this.oP.minchars){this.aSug=[];this.nInpC=f.length;return 0}var e=this.nInpC;this.nInpC=f.length?f.length:0;var g=this.aSug.length;if(this.nInpC>e&&g&&g<this.oP.maxentries&&this.oP.cache){var a=[];for(var d=0;d<g;d++){if(this.aSug[d].value.substr(0,f.length).toLowerCase()==f.toLowerCase()){a.push(this.aSug[d])}}this.aSug=a;this.createList(this.aSug);return false}else{var b=this;var c=this.sInp;clearTimeout(this.ajID);this.ajID=setTimeout(function(){b.doAjaxRequest(c)},this.oP.delay)}return false};_b.AutoSuggest.prototype.doAjaxRequest=function(d){if(d!=this.fld.value){return false}var g=this;if(typeof(this.oP.script)=="function"){var e=this.oP.script(encodeURIComponent(this.sInp.replace("'","&#39;")))}else{var e=this.oP.script+this.oP.varname+"="+encodeURIComponent(this.sInp.replace("'","&#39;"))}if(!e){return false}var a=this.oP.meth;var d=this.sInp;var c=function(h){g.setSuggestions(h,d)};var b=function(h){alert("AJAX error: "+h)};var f=new _b.Ajax();f.makeRequest(e,a,c,b)};_b.AutoSuggest.prototype.setSuggestions=function(req,input){if(input!=this.fld.value){return false}this.aSug=[];if(this.oP.json){var jsondata=eval("("+req.responseText+")");for(var i=0;i<jsondata.results.length;i++){this.aSug.push({id:jsondata.results[i].id,value:jsondata.results[i].value,info:jsondata.results[i].info})}}else{var xml=req.responseXML;var results=xml.getElementsByTagName("results")[0].childNodes;for(var i=0;i<results.length;i++){if(results[i].hasChildNodes()){this.aSug.push({id:results[i].getAttribute("id"),value:results[i].childNodes[0].nodeValue,info:results[i].getAttribute("info")})}}}this.idAs="as_"+this.fld.id;this.createList(this.aSug)};_b.AutoSuggest.prototype.createList=function(C){var f=this;_b.DOM.remE(this.idAs);this.killTimeout();if(C.length==0){return false}var E=_b.DOM.cE("div",{id:this.idAs,className:this.oP.className});var w=_b.DOM.cE("div",{className:"as_corner"});var s=_b.DOM.cE("div",{className:"as_bar"});var n=_b.DOM.cE("div",{className:"as_header"});n.appendChild(w);n.appendChild(s);E.appendChild(n);var p=_b.DOM.cE("ul",{id:"as_ul"});for(var h=0;h<C.length;h++){var m=C[h].value;var l=m.toLowerCase().indexOf(this.sInp.toLowerCase());var o=m.substring(l+this.sInp.length);var F=m.substring(0,l)+"<em>"+m.substring(l,l+this.sInp.length)+"</em>"+m.substring(l+this.sInp.length);var D=_b.DOM.cE("span",{},F,true);if(C[h].info!=""){var c=_b.DOM.cE("br",{});D.appendChild(c);var A=_b.DOM.cE("small",{},C[h].info);D.appendChild(A)}var r=_b.DOM.cE("a",{href:"#"});var z=_b.DOM.cE("span",{className:"tl"}," ");var t=_b.DOM.cE("span",{className:"tr"}," ");r.appendChild(z);r.appendChild(t);r.appendChild(D);r.name=h+1;r.onclick=function(){f.setHighlightedValue();return false};r.onmouseover=function(){f.setHighlight(this.name)};var g=_b.DOM.cE("li",{},r);p.appendChild(g)}if(C.length==0&&this.oP.shownoresults){var g=_b.DOM.cE("li",{className:"as_warning"},this.oP.noresults);p.appendChild(g)}E.appendChild(p);var b=_b.DOM.cE("div",{className:"as_corner"});var B=_b.DOM.cE("div",{className:"as_bar"});var q=_b.DOM.cE("div",{className:"as_footer"});q.appendChild(b);q.appendChild(B);E.appendChild(q);var G=_b.DOM.getPos(this.fld);E.style.left=G.x+"px";E.style.top=(G.y+this.fld.offsetHeight+this.oP.offsety)+"px";E.style.width=this.fld.offsetWidth+130+"px";E.onmouseover=function(){f.killTimeout()};E.onmouseout=function(){f.resetTimeout()};var e=navigator.appName;var u=/MSIE \d+.\d+/;var d=navigator.appVersion.match(u);var v=false;if(e=="Microsoft Internet Explorer"&&d!="MSIE 7.0"){v=true}else{v=false}if(v==true){IfrRef=document.createElement("IFRAME");IfrRef.src="";IfrRef.scrolling="no";IfrRef.frameBorder="0";IfrRef.allowtransparency="true";IfrRef.style.zindex="1";IfrRef.id="DivShim";IfrRef.style.position="absolute";IfrRef.style.top="0px";IfrRef.style.left="0px";IfrRef.style.opacity="0";IfrRef.style.filter="alpha(opacity=0);"}if(v==true){document.body.appendChild(IfrRef)}document.body.appendChild(E);if(v==true){IfrRef.style.width=E.offsetWidth;IfrRef.style.height=E.offsetHeight;IfrRef.style.top=E.style.top;IfrRef.style.left=E.style.left;IfrRef.style.display="block"}this.iHigh=0;var f=this;this.toID=setTimeout(function(){f.clearSuggestions()},this.oP.timeout)};_b.AutoSuggest.prototype.changeHighlight=function(b){var c=_b.DOM.gE("as_ul");if(!c){return false}var a;if(b==40){a=this.iHigh+1}else{if(b==38){a=this.iHigh-1}}if(a>c.childNodes.length){a=c.childNodes.length}if(a<1){a=1}this.setHighlight(a)};_b.AutoSuggest.prototype.setHighlight=function(a){var b=_b.DOM.gE("as_ul");if(!b){return false}if(this.iHigh>0){this.clearHighlight()}this.iHigh=Number(a);b.childNodes[this.iHigh-1].className="as_highlight";this.killTimeout()};_b.AutoSuggest.prototype.clearHighlight=function(){var a=_b.DOM.gE("as_ul");if(!a){return false}if(this.iHigh>0){a.childNodes[this.iHigh-1].className="";this.iHigh=0}};_b.AutoSuggest.prototype.setHighlightedValue=function(){if(this.iHigh){this.sInp=this.fld.value=this.aSug[this.iHigh-1].value;this.fld.focus();if(this.fld.selectionStart){this.fld.setSelectionRange(this.sInp.length,this.sInp.length)}this.clearSuggestions();if(typeof(this.oP.callback)=="function"){this.oP.callback(this.aSug[this.iHigh-1])}}};_b.AutoSuggest.prototype.killTimeout=function(){clearTimeout(this.toID)};_b.AutoSuggest.prototype.resetTimeout=function(){clearTimeout(this.toID);var a=this;this.toID=setTimeout(function(){a.clearSuggestions()},1000)};_b.AutoSuggest.prototype.clearSuggestions=function(){if(document.getElementById("DivShim")){var f=navigator.appName;var e=/MSIE \d+.\d+/;var b=navigator.appVersion.match(e);if(f=="Microsoft Internet Explorer"&&b!="MSIE 7.0"){document.getElementById("DivShim").parentNode.removeChild(document.getElementById("DivShim"))}}this.killTimeout();var a=_b.DOM.gE(this.idAs);var d=this;if(a){if(document.getElementById("DivShim")){document.getElementById("DivShim").style.display="none";document.getElementById("DivShim").parentNode.removeChild(document.getElementById("DivShim"))}var c=new _b.Fader(a,1,0,250,function(){_b.DOM.remE(d.idAs)})}};if(typeof(_b.Ajax)=="undefined"){_b.Ajax={}}_b.Ajax=function(){this.req={};this.isIE=false};_b.Ajax.prototype.makeRequest=function(c,a,d,b){if(a!="POST"){a="GET"}this.onComplete=d;this.onError=b;var e=this;if(window.XMLHttpRequest){this.req=new XMLHttpRequest();this.req.onreadystatechange=function(){e.processReqChange()};this.req.open("GET",c,true);this.req.send(null)}else{if(window.ActiveXObject){this.req=new ActiveXObject("Microsoft.XMLHTTP");if(this.req){this.req.onreadystatechange=function(){e.processReqChange()};this.req.open(a,c,true);this.req.send()}}}};_b.Ajax.prototype.processReqChange=function(){if(this.req.readyState==4){if(this.req.status==200){this.onComplete(this.req)}else{this.onError(this.req.status)}}};if(typeof(_b.DOM)=="undefined"){_b.DOM={}}_b.DOM.cE=function(f,h,g,d){var b=document.createElement(f);if(!b){return 0}for(var e in h){b[e]=h[e]}var c=typeof(g);if(c=="string"&&!d){b.appendChild(document.createTextNode(g))}else{if(c=="string"&&d){b.innerHTML=g}else{if(c=="object"){b.appendChild(g)}}}return b};_b.DOM.gE=function(b){var a=typeof(b);if(a=="undefined"){return 0}else{if(a=="string"){var c=document.getElementById(b);if(!c){return 0}else{if(typeof(c.appendChild)!="undefined"){return c}else{return 0}}}else{if(typeof(b.appendChild)!="undefined"){return b}else{return 0}}}};_b.DOM.remE=function(a){var b=this.gE(a);if(!b){return 0}else{if(b.parentNode.removeChild(b)){return true}else{return 0}}};_b.DOM.getPos=function(c){var c=this.gE(c);var d=c;var a=0;if(d.offsetParent){while(d.offsetParent){a+=d.offsetLeft;d=d.offsetParent}}else{if(d.x){a+=d.x}}var d=c;var b=0;if(d.offsetParent){while(d.offsetParent){b+=d.offsetTop;d=d.offsetParent}}else{if(d.y){b+=d.y}}return{x:a,y:b}};if(typeof(_b.Fader)=="undefined"){_b.Fader={}}_b.Fader=function(b,a,c,d,f){if(!b){return 0}this.e=b;this.from=a;this.to=c;this.cb=f;this.nDur=d;this.nInt=50;this.nTime=0;var e=this;this.nID=setInterval(function(){e._fade()},this.nInt)};_b.Fader.prototype._fade=function(){this.nTime+=this.nInt;var a=Math.round(this._tween(this.nTime,this.from,this.to,this.nDur)*100);var c=a/100;if(this.e.filters){try{this.e.filters.item("DXImageTransform.Microsoft.Alpha").opacity=a}catch(b){this.e.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+a+")"}}else{this.e.style.opacity=c}if(this.nTime==this.nDur){clearInterval(this.nID);if(this.cb!=undefined){this.cb()}}};_b.Fader.prototype._tween=function(a,e,f,g){return e+((f-e)*(a/g))};var SelectedOfferTab="offer_tab1";function SwitchOfferSearch(a){for(x=1;x<8;x++){if(document.getElementById("offer_tab"+x)){document.getElementById("offer_tab"+x).className="searchtab"}if(document.getElementById("offer"+x)){document.getElementById("offer"+x).style.display="none"}}if(document.getElementById("offer0")){document.getElementById("offer0").style.display="none"}SelectedOfferTab=a;if(document.getElementById(a)){document.getElementById(a).className="searchtabOver"}if(document.getElementById("offer"+Right(a,1))){if(document.getElementById("offer0")&&Right(a,1)==1){document.getElementById("offer0").style.display=""}document.getElementById("offer"+Right(a,1)).style.display=""}}function SwitchOfferTabs(b,a){if(SelectedOfferTab!=b){sExtra="";if(a==1){if(document.getElementById(b).className.indexOf("Over")<0){document.getElementById(b).className=document.getElementById(b).className+"Over"}else{SelectedSearchTab=b}}else{if(document.getElementById(b).className.indexOf("Over")>-1){document.getElementById(b).className=Left(document.getElementById(b).className,document.getElementById(b).className.length-4)}}}}function SendHotelToFriend(a){sEmail=document.getElementById("EmailForHotelInfo").value;if(!sEmail){alert("Please enter an email address!")}else{sURL="/includes/mailoffer.asp?id="+a+"&email="+sEmail+"&casperas";updateDivAJAX("divAjaxHolder",sURL,"");setTimeout("alert('Email sent to your friend!');document.getElementById('EmailForHotelInfo').value='';",1000)}}var sCurrentPosition="";function GetMoreInfo(d,f,a,b,c,e){sCurrentPosition=c;if(!e&&document.getElementById("SessionID")){e=document.getElementById("SessionID").value}if(document.getElementById("divMoreInfo"+c).style.display=="none"){sURL="/includes/info/default.asp?provider="+a+"&id="+b+"&session="+e+"&type="+f+"&rand="+Math.random();if(sURL!=""){document.getElementById("divMoreInfo"+c).style.display="";document.getElementById("divInfoStart"+c).innerHTML='<div align="center"><img src="/images/animations/ajax-loader-white.gif" style="margin-top:15px;" /><br /><br /><span class="resultPleaseWait">Loading... Please wait.</span></div>';if(bDebug){if(confirm("Open "+sURL)){window.open(sURL)}}setTimeout("loadMoreInfoXMLDoc('"+sURL+"')",100);d.innerHTML=d.innerHTML.replace("Click here for","Click here to hide")}else{alert("No url defined")}}else{d.innerHTML=d.innerHTML.replace("Click here to hide","Click here for");document.getElementById("divMoreInfo"+c).style.display="none"}}function loadMoreInfoXMLDoc(a){if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=processMoreInfo;req.open("GET",a,true);req.send(null)}else{if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=processMoreInfo;req.open("GET",a,true);req.send()}}}}function processMoreInfo(){if(req.readyState==4){if(req.status==200){sXml=req.responseText;document.getElementById("divInfoStart"+sCurrentPosition).innerHTML=sXml}else{alert("More hotel information is not available");document.getElementById("divMoreInfo"+sCurrentPosition).style.display="none"}}}function toggle_text(c,b,a){objText=document.getElementById(c);if(objText){if(objText.innerHTML==b){objText.innerHTML=a}else{objText.innerHTML=b}}}function changeType(a){for(intOpt=0;intOpt<a.options.length;intOpt++){for(intRoom=1;intRoom<parseInt(a.getAttribute("norooms"))+1;intRoom++){strDivName="roomdiv_A"+a.getAttribute("accomm_pos")+"_R"+intRoom+"_"+a.options[intOpt].value;if(document.getElementById(strDivName)){objBoardDiv=document.getElementById(strDivName);if(intOpt==a.selectedIndex){objBoardDiv.style.display="";objBoardDiv.getElementsByTagName("input")[0].checked=true}else{objBoardDiv.style.display="none"}}}}}var ClientDebug=false;shortcut.add("Ctrl+Alt+Shift+1",function(){if(ClientDebug==false){ClientDebug=true;alert("Debug turned on!")}else{ClientDebug=false;alert("Debug turned off!")}},{type:"keydown",propagate:true,target:document});function alertDebug(a){if(ClientDebug){alert(a)}}var LightBoxurl="";var LightBoxValues="";var LightBoxx,LightBoxy;var LB_Object="";function LightBox(e,b,f,l,a,d,h,g){LB_Object=a;if(b){LightBoxValues=b}if(!f){f=0}if(!l){l=0}if(document.getElementById("div"+LB_Object)){PlaceHolder=document.getElementById("div"+LB_Object);FramePlaceHolder=document.getElementById("frame"+LB_Object);if(!e){LightBoxurl=location.href;grayOut(true);FramePlaceHolder.style.display="block";PlaceHolder.style.display="block";FramePlaceHolder.style.border="none";var c=parseFloat(((document.documentElement.clientHeight-g)/2)+document.documentElement.scrollTop);if(c<10){c=10}FramePlaceHolder.style.left=parseFloat((document.documentElement.clientWidth-h)/2)+"px";PlaceHolder.style.left=parseFloat((document.documentElement.clientWidth-h)/2)+"px";FramePlaceHolder.style.top=c+"px";PlaceHolder.style.top=c+"px";if(h!=""){FramePlaceHolder.style.height=g+"px";PlaceHolder.style.height=g+"px";FramePlaceHolder.style.width=h+"px";PlaceHolder.style.width=h+"px"}}PlaceHolder.innerHTML='<div align="center" style="padding-top:50px; font-weight:bold;"><img src="/images/animations/ajax-loader-white.gif"/><br/><br/>Please wait...</div>';if(d!=""){if(bDebug){if(confirm("Open "+d)){window.open(d)}}setTimeout("loadLightBoxDoc('"+d+"')",500)}else{alert("No url defined")}}}function CloseLightBox(){if(document.getElementById("div"+LB_Object)){FramePlaceHolder=document.getElementById("frame"+LB_Object);document.getElementById("div"+LB_Object).innerHTML="";FramePlaceHolder.style.display="none";PlaceHolder=document.getElementById("div"+LB_Object);PlaceHolder.style.display="none";grayOut(false)}}function loadLightBoxDoc(a){sPostValues=LightBoxValues;a="/includes/lightbox.asp?content="+a;if(window.XMLHttpRequest){reqTAF=new XMLHttpRequest();reqTAF.onreadystatechange=processLightBox;reqTAF.open("POST",a,true);reqTAF.setRequestHeader("Content-type","application/x-www-form-urlencoded");reqTAF.setRequestHeader("Content-length",sPostValues.length);reqTAF.setRequestHeader("Connection","close");reqTAF.send("resorts="+sPostValues)}else{if(window.ActiveXObject){reqTAF=new ActiveXObject("Microsoft.XMLHTTP");if(reqTAF){reqTAF.onreadystatechange=processLightBox;reqTAF.open("POST",a,true);reqTAF.setRequestHeader("Content-type","application/x-www-form-urlencoded");reqTAF.setRequestHeader("Content-length",sPostValues.length);reqTAF.setRequestHeader("Connection","close");reqTAF.send("resorts="+sPostValues)}}}}function processLightBox(){if(reqTAF.readyState==4){if(reqTAF.status==200){PlaceHolder=document.getElementById("div"+LB_Object);PlaceHolder.innerHTML=reqTAF.responseText}}}function SubmitLightBox(a){}function updateBaggageSelection(){if(document.getElementById("baggopt_1")&&document.getElementById("baggagequantity")&&document.getElementById("baggagelist")){if(document.getElementById("baggagequantity").value==""){BaggageMultiplier=0}else{BaggageMultiplier=document.getElementById("baggagequantity").value}if(document.getElementById("baggagequantity").value==""){document.getElementById("baggopt_1").value="";document.getElementById("baggagelist").options[document.getElementById("baggagelist").selectedIndex].itemValue=parseFloat(document.getElementById("baggagelist").options[document.getElementById("baggagelist").selectedIndex].getAttribute("itemValueOriginal"))*parseInt(BaggageMultiplier);document.getElementById("baggagelist").options[document.getElementById("baggagelist").selectedIndex].setAttribute("itemvalue",parseFloat(document.getElementById("baggagelist").options[document.getElementById("baggagelist").selectedIndex].getAttribute("itemValueOriginal"))*parseInt(BaggageMultiplier))}else{document.getElementById("baggopt_1").value=document.getElementById("baggagequantity").value+document.getElementById("baggagelist").value;document.getElementById("baggagelist").options[document.getElementById("baggagelist").selectedIndex].itemValue=parseFloat(document.getElementById("baggagelist").options[document.getElementById("baggagelist").selectedIndex].getAttribute("itemValueOriginal"))*parseInt(BaggageMultiplier);document.getElementById("baggagelist").options[document.getElementById("baggagelist").selectedIndex].setAttribute("itemvalue",parseFloat(document.getElementById("baggagelist").options[document.getElementById("baggagelist").selectedIndex].getAttribute("itemValueOriginal"))*parseInt(BaggageMultiplier))}}}function showGoogleMap(a,b){grayOut(true);document.getElementById("googleMapDiv").innerHTML='<div align="right" style="padding:2px 15px 4px 0px;"><p style="text-align:right; padding:2px 0px 0px 0px; margin:0px;"><a href="javascript:hideGoogleMap()">Close map viewer</a>&nbsp;<a href="javascript:hideGoogleMap()"><img src="/images/icons/closecross.gif" border="0" style="border:0px; vertical-align:middle;" /></a></p></div><div id="popupMap" style="margin:0px 15px 15px 15px;"></div>';document.getElementById("googleMapDiv").style.display="block";document.getElementById("googleMapDiv").style.marginLeft="-250px";LoadGoogleMap("popupMap",a,b)}function hideGoogleMap(){grayOut(false);document.getElementById("googleMapDiv").innerHTML="";document.getElementById("googleMapDiv").style.display="none"}function TranslateText(b){if(b==undefined){b="p"}arTags=b.split(",");for(i=0;i<arTags.length;i++){var a="";$(arTags[i]).translate("en","sk",{each:function(c){try{a=a+(this.translation[c])}catch(d){}}})}}var bClose=true;function getAnchorPosition(f){var d=false;var c=new Object();var e=0,b=0;var h=false,n=false,m=false;if(document.getElementById){h=true}else{if(document.all){n=true}else{if(document.layers){m=true}}}if(h&&document.all){e=AnchorPosition_getPageOffsetLeft(document.all[f]);b=AnchorPosition_getPageOffsetTop(document.all[f])}else{if(h){var a=document.getElementById(f);e=AnchorPosition_getPageOffsetLeft(a);b=AnchorPosition_getPageOffsetTop(a)}else{if(n){e=AnchorPosition_getPageOffsetLeft(document.all[f]);b=AnchorPosition_getPageOffsetTop(document.all[f])}else{if(m){var g=0;for(var l=0;l<document.anchors.length;l++){if(document.anchors[l].name==f){g=1;break}}if(g==0){c.x=0;c.y=0;return c}e=document.anchors[l].x;b=document.anchors[l].y}else{c.x=0;c.y=0;return c}}}}c.x=e;c.y=b;return c}function getAnchorWindowPosition(d){var c=getAnchorPosition(d);var a=0;var b=0;if(document.getElementById){if(isNaN(window.screenX)){a=c.x-document.body.scrollLeft+window.screenLeft;b=c.y-document.body.scrollTop+window.screenTop}else{a=c.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;b=c.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset}}else{if(document.all){a=c.x-document.body.scrollLeft+window.screenLeft;b=c.y-document.body.scrollTop+window.screenTop}else{if(document.layers){a=c.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;b=c.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset}}}c.x=a;c.y=b;return c}function AnchorPosition_getPageOffsetLeft(a){var b=a.offsetLeft;while((a=a.offsetParent)!=null){b+=a.offsetLeft}return b}function AnchorPosition_getWindowOffsetLeft(a){return AnchorPosition_getPageOffsetLeft(a)-document.body.scrollLeft}function AnchorPosition_getPageOffsetTop(b){var a=b.offsetTop;while((b=b.offsetParent)!=null){a+=b.offsetTop}return a}function AnchorPosition_getWindowOffsetTop(a){return AnchorPosition_getPageOffsetTop(a)-document.body.scrollTop}var MONTH_NAMES=new Array("January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");var DAY_NAMES=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sun","Mon","Tue","Wed","Thu","Fri","Sat");function LZ(a){return(a<0||a>9?"":"0")+a}function isDate(c,a){var b=getDateFromFormat(c,a);if(b==0){return false}return true}function compareDates(e,a,c,d){var f=getDateFromFormat(e,a);var b=getDateFromFormat(c,d);if(f==0||b==0){return -1}else{if(f>b){return 1}}return 0}function formatDate(l,C){C=C+"";var u="";var n=0;var F="";var A="";var a=l.getYear()+"";var I=l.getMonth()+1;var B=l.getDate();var O=l.getDay();var D=l.getHours();var t=l.getMinutes();var g=l.getSeconds();var L,P,z,f,N,v,p,b,Q,G,e,D,o,J,q,r;var w=new Object();if(a.length<4){a=""+(a-0+1900)}w.y=""+a;w.yyyy=a;w.yy=a.substring(2,4);w.M=I;w.MM=LZ(I);w.MMM=MONTH_NAMES[I-1];w.NNN=MONTH_NAMES[I+11];w.d=B;w.dd=LZ(B);w.E=DAY_NAMES[O+7];w.EE=DAY_NAMES[O];w.H=D;w.HH=LZ(D);if(D==0){w.h=12}else{if(D>12){w.h=D-12}else{w.h=D}}w.hh=LZ(w.h);if(D>11){w.K=D-12}else{w.K=D}w.k=D+1;w.KK=LZ(w.K);w.kk=LZ(w.k);if(D>11){w.a="PM"}else{w.a="AM"}w.m=t;w.mm=LZ(t);w.s=g;w.ss=LZ(g);while(n<C.length){F=C.charAt(n);A="";while((C.charAt(n)==F)&&(n<C.length)){A+=C.charAt(n++)}if(w[A]!=null){u=u+w[A]}else{u=u+A}}return u}function _isInteger(c){var a="1234567890";for(var b=0;b<c.length;b++){if(a.indexOf(c.charAt(b))==-1){return false}}return true}function _getInt(d,e,b,f){for(var a=f;a>=b;a--){var c=d.substring(e,e+a);if(c.length<b){return null}if(_isInteger(c)){return c}}return null}function getDateFromFormat(n,s){n=n+"";s=s+"";var v=0;var h=0;var r="";var o="";var f="";var d,e;var a=new Date();var m=a.getYear();var p=a.getMonth()+1;var z=1;var g=a.getHours();var b=a.getMinutes();var A=a.getSeconds();var u="";while(h<s.length){r=s.charAt(h);o="";while((s.charAt(h)==r)&&(h<s.length)){o+=s.charAt(h++)}if(o=="yyyy"||o=="yy"||o=="y"){if(o=="yyyy"){d=4;e=4}if(o=="yy"){d=2;e=2}if(o=="y"){d=2;e=4}m=_getInt(n,v,d,e);if(m==null){return 0}v+=m.length;if(m.length==2){if(m>70){m=1900+(m-0)}else{m=2000+(m-0)}}}else{if(o=="MMM"||o=="NNN"){p=0;for(var l=0;l<MONTH_NAMES.length;l++){var q=MONTH_NAMES[l];if(n.substring(v,v+q.length).toLowerCase()==q.toLowerCase()){if(o=="MMM"||(o=="NNN"&&l>11)){p=l+1;if(p>12){p-=12}v+=q.length;break}}}if((p<1)||(p>12)){return 0}}else{if(o=="EE"||o=="E"){for(var l=0;l<DAY_NAMES.length;l++){var t=DAY_NAMES[l];if(n.substring(v,v+t.length).toLowerCase()==t.toLowerCase()){v+=t.length;break}}}else{if(o=="MM"||o=="M"){p=_getInt(n,v,o.length,2);if(p==null||(p<1)||(p>12)){return 0}v+=p.length}else{if(o=="dd"||o=="d"){z=_getInt(n,v,o.length,2);if(z==null||(z<1)||(z>31)){return 0}v+=z.length}else{if(o=="hh"||o=="h"){g=_getInt(n,v,o.length,2);if(g==null||(g<1)||(g>12)){return 0}v+=g.length}else{if(o=="HH"||o=="H"){g=_getInt(n,v,o.length,2);if(g==null||(g<0)||(g>23)){return 0}v+=g.length}else{if(o=="KK"||o=="K"){g=_getInt(n,v,o.length,2);if(g==null||(g<0)||(g>11)){return 0}v+=g.length}else{if(o=="kk"||o=="k"){g=_getInt(n,v,o.length,2);if(g==null||(g<1)||(g>24)){return 0}v+=g.length;g--}else{if(o=="mm"||o=="m"){b=_getInt(n,v,o.length,2);if(b==null||(b<0)||(b>59)){return 0}v+=b.length}else{if(o=="ss"||o=="s"){A=_getInt(n,v,o.length,2);if(A==null||(A<0)||(A>59)){return 0}v+=A.length}else{if(o=="a"){if(n.substring(v,v+2).toLowerCase()=="am"){u="AM"}else{if(n.substring(v,v+2).toLowerCase()=="pm"){u="PM"}else{return 0}}v+=2}else{if(n.substring(v,v+o.length)!=o){return 0}else{v+=o.length}}}}}}}}}}}}}}if(v!=n.length){return 0}if(p==2){if(((m%4==0)&&(m%100!=0))||(m%400==0)){if(z>29){return 0}}else{if(z>28){return 0}}}if((p==4)||(p==6)||(p==9)||(p==11)){if(z>30){return 0}}if(g<12&&u=="PM"){g=g-0+12}else{if(g>11&&u=="AM"){g-=12}}var w=new Date(m,p-1,z,g,b,A);return w.getTime()}function parseDate(g){var b=(arguments.length==2)?arguments[1]:false;generalFormats=new Array("y-M-d","MMM d, y","MMM d,y","y-MMM-d","d-MMM-y","MMM d");monthFirst=new Array("M/d/y","M-d-y","M.d.y","MMM-d","M/d","M-d");dateFirst=new Array("d/M/y","d-M-y","d.M.y","d-MMM","d/M","d-M");var h=new Array("generalFormats",b?"dateFirst":"monthFirst",b?"monthFirst":"dateFirst");var e=null;for(var c=0;c<h.length;c++){var a=window[h[c]];for(var f=0;f<a.length;f++){e=getDateFromFormat(g,a[f]);if(e!=0){return new Date(e)}}}return null}function PopupWindow_getXYPosition(b){var a;if(this.type=="WINDOW"){a=getAnchorWindowPosition(b)}else{a=getAnchorPosition(b)}this.x=a.x;this.y=a.y}function PopupWindow_setSize(b,a){this.width=b;this.height=a}function PopupWindow_populate(a){this.contents=a;this.populated=false}function PopupWindow_setUrl(a){this.url=a}function PopupWindow_setWindowProperties(a){this.windowProperties=a}function PopupWindow_refresh(){if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).innerHTML=this.contents}else{if(this.use_css){document.all[this.divName].innerHTML=this.contents}else{if(this.use_layers){var a=document.layers[this.divName];a.document.open();a.document.writeln(this.contents);a.document.close()}}}}else{if(this.popupWindow!=null&&!this.popupWindow.closed){if(this.url!=""){this.popupWindow.location.href=this.url}else{this.popupWindow.document.open();this.popupWindow.document.writeln(this.contents);this.popupWindow.document.close()}this.popupWindow.focus()}}}function showHideObjects(a,b){if(navigator.userAgent.indexOf("MSIE 6")>=0||navigator.userAgent.indexOf("MSIE 5")>=0||navigator.userAgent.indexOf("MSIE 4")>=0){sObjects=document.getElementsByTagName(a);sDisplay="";if(b!=true){sDisplay="none"}for(x=0;x<sObjects.length;x++){if(sObjects[x].getAttribute("HideObject")=="true"||sObjects[x].getAttribute("HideObject")=="True"){sObjects[x].style.display=sDisplay}}}}function PopupWindow_showPopup(b){this.getXYPosition(b);this.x+=this.offsetX;this.y+=this.offsetY;if(!this.populated&&(this.contents!="")){this.populated=true;this.refresh()}if(this.divName!=null){showHideObjects("select",false);if(this.use_gebi){document.getElementById(this.divName).style.left=this.x+"px";document.getElementById(this.divName).style.top=this.y+"px";document.getElementById(this.divName).style.visibility="visible";document.getElementById(this.divName).style.zIndex="100"}else{if(this.use_css){document.all[this.divName].style.left=this.x;document.all[this.divName].style.top=this.y;document.all[this.divName].style.visibility="visible";document.all[this.divName].style.zIndex="100"}else{if(this.use_layers){document.layers[this.divName].left=this.x;document.layers[this.divName].top=this.y;document.layers[this.divName].visibility="visible";document.layers[this.divName].style.zIndex="100"}}}}else{if(this.popupWindow==null||this.popupWindow.closed){if(this.x<0){this.x=0}if(this.y<0){this.y=0}if(screen&&screen.availHeight){if((this.y+this.height)>screen.availHeight){this.y=screen.availHeight-this.height}}if(screen&&screen.availWidth){if((this.x+this.width)>screen.availWidth){this.x=screen.availWidth-this.width}}var a=window.opera||(document.layers&&!navigator.mimeTypes["*"])||navigator.vendor=="KDE"||(document.childNodes&&!document.all&&!navigator.taintEnabled);this.popupWindow=window.open(a?"":"about:blank","window_"+b,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"")}this.refresh()}}function PopupWindow_hidePopup(){if(this.divName!=null){showHideObjects("select",true);if(this.use_gebi){document.getElementById(this.divName).style.visibility="hidden"}else{if(this.use_css){document.all[this.divName].style.visibility="hidden"}else{if(this.use_layers){document.layers[this.divName].visibility="hidden"}}}}else{if(this.popupWindow&&!this.popupWindow.closed){this.popupWindow.close();this.popupWindow=null}}}function PopupWindow_isClicked(d){if(this.divName!=null){if(this.use_layers){var c=d.pageX;var b=d.pageY;var a=document.layers[this.divName];if((c>a.left)&&(c<a.left+a.clip.width)&&(b>a.top)&&(b<a.top+a.clip.height)){return true}else{return false}}else{if(document.all){var a=window.event.srcElement;while(a.parentElement!=null){if(a.id==this.divName){return true}a=a.parentElement}return false}else{if(this.use_gebi&&d){var a=d.originalTarget;while(a.parentNode!=null){if(a.id==this.divName){return true}a=a.parentNode}return false}}}return false}return false}function PopupWindow_hideIfNotClicked(a){if(this.autoHideEnabled&&!this.isClicked(a)&&bClose){this.hidePopup()}}function PopupWindow_autoHide(){this.autoHideEnabled=true}function PopupWindow_hidePopupWindows(b){for(var a=0;a<popupWindowObjects.length;a++){if(popupWindowObjects[a]!=null){var c=popupWindowObjects[a];c.hideIfNotClicked(b)}}}function PopupWindow_attachListener(){if(document.layers){document.captureEvents(Event.MOUSEUP)}window.popupWindowOldEventListener=document.onmouseup;if(window.popupWindowOldEventListener!=null){document.onmouseup=new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();")}else{document.onmouseup=PopupWindow_hidePopupWindows}}function PopupWindow(){if(!window.popupWindowIndex){window.popupWindowIndex=0}if(!window.popupWindowObjects){window.popupWindowObjects=new Array()}if(!window.listenerAttached){window.listenerAttached=true;PopupWindow_attachListener()}this.index=popupWindowIndex++;popupWindowObjects[this.index]=this;this.divName=null;this.popupWindow=null;this.width=0;this.height=0;this.populated=false;this.visible=false;this.autoHideEnabled=false;this.contents="";this.url="";this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";if(arguments.length>0){this.type="DIV";this.divName=arguments[0];if(arguments.length>1){this.calendarType=arguments[1]}}else{this.type="WINDOW"}this.use_gebi=false;this.use_css=false;this.use_layers=false;if(document.getElementById){this.use_gebi=true}else{if(document.all){this.use_css=true}else{if(document.layers){this.use_layers=true}else{this.type="WINDOW"}}}this.offsetX=0;this.offsetY=0;this.getXYPosition=PopupWindow_getXYPosition;this.populate=PopupWindow_populate;this.setUrl=PopupWindow_setUrl;this.setWindowProperties=PopupWindow_setWindowProperties;this.refresh=PopupWindow_refresh;this.showPopup=PopupWindow_showPopup;this.hidePopup=PopupWindow_hidePopup;this.setSize=PopupWindow_setSize;this.isClicked=PopupWindow_isClicked;this.autoHide=PopupWindow_autoHide;this.hideIfNotClicked=PopupWindow_hideIfNotClicked}var currentCalendar="";function CalendarPopup(){var a;if(arguments.length>0){if(arguments.length>1){a=new PopupWindow(arguments[0],arguments[1])}else{a=new PopupWindow(arguments[0])}currentCalendar=arguments[0]}else{a=new PopupWindow();a.setSize(150,175)}a.offsetX=-152;a.offsetY=25;a.autoHide();a.monthNames=new Array("January","February","March","April","May","June","July","August","September","October","November","December");a.monthAbbreviations=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");a.dayHeaders=new Array("S","M","T","W","T","F","S");a.returnFunction="CP_tmpReturnFunction";a.returnMonthFunction="CP_tmpReturnMonthFunction";a.returnQuarterFunction="CP_tmpReturnQuarterFunction";a.returnYearFunction="CP_tmpReturnYearFunction";a.weekStartDay=0;a.isShowYearNavigation=false;a.displayType="date";a.disabledWeekDays=new Object();a.disabledDatesExpression="";a.yearSelectStartOffset=2;a.currentDate=null;a.todayText="Today";a.cssPrefix="";a.isShowNavigationDropdowns=true;a.isShowYearNavigationInput=false;window.CP_calendarObject=null;window.CP_targetInput=null;window.CP_dateFormat="MM/dd/yyyy";a.copyMonthNamesToWindow=CP_copyMonthNamesToWindow;a.setReturnFunction=CP_setReturnFunction;a.setReturnMonthFunction=CP_setReturnMonthFunction;a.setReturnQuarterFunction=CP_setReturnQuarterFunction;a.setReturnYearFunction=CP_setReturnYearFunction;a.setMonthNames=CP_setMonthNames;a.setMonthAbbreviations=CP_setMonthAbbreviations;a.setDayHeaders=CP_setDayHeaders;a.setWeekStartDay=CP_setWeekStartDay;a.setDisplayType=CP_setDisplayType;a.setDisabledWeekDays=CP_setDisabledWeekDays;a.addDisabledDates=CP_addDisabledDates;a.setYearSelectStartOffset=CP_setYearSelectStartOffset;a.setTodayText=CP_setTodayText;a.showYearNavigation=CP_showYearNavigation;a.showCalendar=CP_showCalendar;a.hideCalendar=CP_hideCalendar;a.getStyles=getCalendarStyles;a.refreshCalendar=CP_refreshCalendar;a.getCalendar=CP_getCalendar;a.select=CP_select;a.setCssPrefix=CP_setCssPrefix;a.showNavigationDropdowns=CP_showNavigationDropdowns;a.showYearNavigationInput=CP_showYearNavigationInput;a.copyMonthNamesToWindow();return a}function CP_copyMonthNamesToWindow(){if(typeof(window.MONTH_NAMES)!="undefined"&&window.MONTH_NAMES!=null){window.MONTH_NAMES=new Array();for(var a=0;a<this.monthNames.length;a++){window.MONTH_NAMES[window.MONTH_NAMES.length]=this.monthNames[a]}for(var a=0;a<this.monthAbbreviations.length;a++){window.MONTH_NAMES[window.MONTH_NAMES.length]=this.monthAbbreviations[a]}}}function CP_tmpReturnFunction(b,a,c){if(window.CP_targetInput!=null){var e=new Date(b,a-1,c,0,0,0);if(window.CP_calendarObject!=null){window.CP_calendarObject.copyMonthNamesToWindow()}window.CP_targetInput.value=formatDate(e,window.CP_dateFormat);if(CP_linkname.indexOf("StartDate")==6){arCal=CP_linkname.split("_");var f;if(document.getElementById("ExtrasDuration"+arCal[1])){f=parseInt(document.getElementById("ExtrasDuration"+arCal[1]).value)}else{f=7}end_dt=e.add("d",f);if(document.getElementById("enddate"+arCal[1])){document.getElementById("enddate"+arCal[1]).value=formatDate(e,window.CP_dateFormat)}}}else{alert("Use setReturnFunction() to define which function will get the clicked results!")}}Date.prototype.add=function(c,a){var b=this;if(!c||a==0){return b}switch(c.toLowerCase()){case"ms":b.setMilliseconds(b.getMilliseconds()+a);break;case"s":b.setSeconds(b.getSeconds()+a);break;case"mi":b.setMinutes(b.getMinutes()+a);break;case"h":b.setHours(b.getHours()+a);break;case"d":b.setDate(b.getDate()+a);break;case"mo":b.setMonth(b.getMonth()+a);break;case"y":b.setFullYear(b.getFullYear()+a);break}return b};function CP_tmpReturnMonthFunction(b,a){alert("Use setReturnMonthFunction() to define which function will get the clicked results!\nYou clicked: year="+b+" , month="+a)}function CP_tmpReturnQuarterFunction(a,b){alert("Use setReturnQuarterFunction() to define which function will get the clicked results!\nYou clicked: year="+a+" , quarter="+b)}function CP_tmpReturnYearFunction(a){alert("Use setReturnYearFunction() to define which function will get the clicked results!\nYou clicked: year="+a)}function CP_setReturnFunction(a){this.returnFunction=a}function CP_setReturnMonthFunction(a){this.returnMonthFunction=a}function CP_setReturnQuarterFunction(a){this.returnQuarterFunction=a}function CP_setReturnYearFunction(a){this.returnYearFunction=a}function CP_setMonthNames(){for(var a=0;a<arguments.length;a++){this.monthNames[a]=arguments[a]}this.copyMonthNamesToWindow()}function CP_setMonthAbbreviations(){for(var a=0;a<arguments.length;a++){this.monthAbbreviations[a]=arguments[a]}this.copyMonthNamesToWindow()}function CP_setDayHeaders(){for(var a=0;a<arguments.length;a++){this.dayHeaders[a]=arguments[a]}}function CP_setWeekStartDay(a){this.weekStartDay=a}function CP_showYearNavigation(){this.isShowYearNavigation=(arguments.length>0)?arguments[0]:true}function CP_setDisplayType(a){if(a!="date"&&a!="week-end"&&a!="month"&&a!="quarter"&&a!="year"){alert("Invalid display type! Must be one of: date,week-end,month,quarter,year");return false}this.displayType=a}function CP_setYearSelectStartOffset(a){this.yearSelectStartOffset=a}function CP_setDisabledWeekDays(){this.disabledWeekDays=new Object();for(var a=0;a<arguments.length;a++){this.disabledWeekDays[arguments[a]]=true}}function CP_addDisabledDates(a,b){if(arguments.length==1){b=a}if(a==null&&b==null){return}if(this.disabledDatesExpression!=""){this.disabledDatesExpression+="||"}if(a!=null){a=parseDate(a);a=""+a.getFullYear()+LZ(a.getMonth()+1)+LZ(a.getDate())}if(b!=null){b=parseDate(b);b=""+b.getFullYear()+LZ(b.getMonth()+1)+LZ(b.getDate())}if(a==null){this.disabledDatesExpression+="(ds<="+b+")"}else{if(b==null){this.disabledDatesExpression+="(ds>="+a+")"}else{this.disabledDatesExpression+="(ds>="+a+"&&ds<="+b+")"}}}function CP_setTodayText(a){this.todayText=a}function CP_setCssPrefix(a){this.cssPrefix=a}function CP_showNavigationDropdowns(){this.isShowNavigationDropdowns=(arguments.length>0)?arguments[0]:true}function CP_showYearNavigationInput(){this.isShowYearNavigationInput=(arguments.length>0)?arguments[0]:true}function CP_hideCalendar(){if(arguments.length>0){window.popupWindowObjects[arguments[0]].hidePopup()}else{this.hidePopup()}}function CP_refreshCalendar(b){showHideObjects("select",false);var a=window.popupWindowObjects[b];if(arguments.length>1){a.populate(a.getCalendar(arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]))}else{a.populate(a.getCalendar())}a.refresh()}function CP_showCalendar(a){if(arguments.length>1){if(arguments[1]==null||arguments[1]==""){this.currentDate=new Date()}else{this.currentDate=new Date(parseDate(arguments[1]))}}this.populate(this.getCalendar());this.showPopup(a)}function CP_select(a,d,b){var c=(arguments.length>3)?arguments[3]:null;if(!window.getDateFromFormat){alert("calendar.select: To use this method you must also include 'date.js' for date formatting");return}if(this.displayType!="date"&&this.displayType!="week-end"){alert("calendar.select: This function can only be used with displayType 'date' or 'week-end'");return}if(a.type!="text"&&a.type!="hidden"&&a.type!="textarea"){alert("calendar.select: Input object passed is not a valid form input object");window.CP_targetInput=null;return}if(a.disabled){return}window.CP_targetInput=a;window.CP_calendarObject=this;this.currentDate=null;var e=0;if(c!=null){e=getDateFromFormat(c,b)}else{if(a.value!=""){e=getDateFromFormat(a.value,b)}}if(c!=null||a.value!=""){if(e==0){this.currentDate=null}else{this.currentDate=new Date(e)}}window.CP_dateFormat=b;window.CP_linkname=d;this.showCalendar(d)}function getCalendarStyles(){var a="";var b="";if(this!=null&&typeof(this.cssPrefix)!="undefined"&&this.cssPrefix!=null&&this.cssPrefix!=""){b=this.cssPrefix}a+="<STYLE>\n";a+="."+b+"cpYearNavigation,."+b+"cpMonthNavigation { background-color:#C0C0C0; text-align:center; vertical-align:center; text-decoration:none; color:#000000; font-weight:bold; }\n";a+="."+b+"cpDayColumnHeader, ."+b+"cpYearNavigation,."+b+"cpMonthNavigation,."+b+"cpCurrentMonthDate,."+b+"cpCurrentMonthDateDisabled,."+b+"cpOtherMonthDate,."+b+"cpOtherMonthDateDisabled,."+b+"cpCurrentDate,."+b+"cpCurrentDateDisabled,."+b+"cpTodayText,."+b+"cpTodayTextDisabled,."+b+"cpText { font-family:arial; font-size:8pt; }\n";a+="TD."+b+"cpDayColumnHeader { text-align:right; border:solid thin #C0C0C0;border-width:0px 0px 1px 0px; }\n";a+="."+b+"cpCurrentMonthDate, ."+b+"cpOtherMonthDate, ."+b+"cpCurrentDate  { text-align:right; text-decoration:none; }\n";a+="."+b+"cpCurrentMonthDateDisabled, ."+b+"cpOtherMonthDateDisabled, ."+b+"cpCurrentDateDisabled { color:#D0D0D0; text-align:right; text-decoration:line-through; }\n";a+="."+b+"cpCurrentMonthDate, .cpCurrentDate { color:#000000; }\n";a+="."+b+"cpOtherMonthDate { color:#808080; }\n";a+="TD."+b+"cpCurrentDate { color:white; background-color: #C0C0C0; border-width:1px; border:solid thin #800000; }\n";a+="TD."+b+"cpCurrentDateDisabled { border-width:1px; border:solid thin #FFAAAA; }\n";a+="TD."+b+"cpTodayText, TD."+b+"cpTodayTextDisabled { border:solid thin #C0C0C0; border-width:1px 0px 0px 0px;}\n";a+="A."+b+"cpTodayText, SPAN."+b+"cpTodayTextDisabled { height:20px; }\n";a+="A."+b+"cpTodayText { color:black; }\n";a+="."+b+"cpTodayTextDisabled { color:#D0D0D0; }\n";a+="."+b+"cpBorder { border:solid thin #808080; }\n";a+="</STYLE>\n";return a}function getMonthFromName(b){var a=1;switch(b){case"January":a=0;break;case"February":a=1;break;case"March":a=2;break;case"April":a=3;break;case"May":a=4;break;case"June":a=5;break;case"July":a=6;break;case"August":a=7;break;case"September":a=8;break;case"October":a=9;break;case"November":a=10;break;case"December":a=11;break}return(a)}function GetCorrectDayNum(a,b){var c=b;if(b>28){switch(a){case (1):case (3):case (5):case (7):case (8):case (10):case (12):c=b;break;case (4):case (6):case (9):case (11):if(b>30){c=30}break;case (2):c=28;break}}return(c)}function BSCalClose2(){bClose=true}function BSCalClose(){bClose=false;setTimeout("BSCalClose2()",200)}function CP_getCalendar(){var now=new Date();if(this.type=="WINDOW"){var windowref="window.opener."}else{var windowref=""}var result="";if(this.type=="WINDOW"){result+="<HTML><HEAD><TITLE>Calendar</TITLE>"+this.getStyles()+"</HEAD><BODY MARGINWIDTH=0 MARGINHEIGHT=0 TOPMARGIN=0 RIGHTMARGIN=0 LEFTMARGIN=0>\n";result+="<CENTER><TABLE WIDTH=100% BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>\n"}else{result+='<TABLE CLASS="'+this.cssPrefix+'cpBorder" WIDTH=144 BORDER=1 BORDERWIDTH=1 CELLSPACING=0 CELLPADDING=1>\n';result+="<TR><TD ALIGN=CENTER>\n";result+="<CENTER>\n"}if(this.displayType=="date"||this.displayType=="week-end"){if(this.currentDate==null){this.currentDate=now}if(arguments.length>0){var month=arguments[0]}else{var month=this.currentDate.getMonth()+1}if(arguments.length>1&&arguments[1]>0&&arguments[1]-0==arguments[1]){var year=arguments[1]}else{var year=this.currentDate.getFullYear()}var current_month=new Date(year,month-1,1);var true_current_date=new Date();if((current_month.getMonth()<true_current_date.getMonth())&&(current_month.getYear()<=true_current_date.getFullYear())){year=true_current_date.getFullYear()+1}current_month=new Date(year,month-1,1);var daysinmonth=new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);if(((year%4==0)&&(year%100!=0))||(year%400==0)){daysinmonth[2]=29}var display_year=year;var display_month=month;var display_date=1;var weekday=current_month.getDay();var offset=0;offset=(weekday>=this.weekStartDay)?weekday-this.weekStartDay:7-this.weekStartDay+weekday;if(offset>0){display_month--;if(display_month<1){display_month=12;display_year--}display_date=daysinmonth[display_month]-offset+1}var next_month=month+1;var next_month_year=year;if(next_month>12){next_month=1;next_month_year++}var last_month=month-1;var last_month_year=year;if(last_month<1){last_month=12;last_month_year--}var date_class;if(this.type!="WINDOW"){result+="<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>"}result+="<TR>\n";var refresh=windowref+"CP_refreshCalendar";var refreshLink="javascript:"+refresh;if(this.isShowNavigationDropdowns){result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="78" COLSPAN="3"><select CLASS="" name="cpMonth" onChange="BSCalClose();'+refresh+"("+this.index+",this.options[this.selectedIndex].value-0,"+(year-0)+');">';for(var monthCounter=1;monthCounter<=12;monthCounter++){var selected=(monthCounter==month)?"SELECTED":"";if(this.calendarType=="ski"){if(monthCounter==1||monthCounter==2||monthCounter==3||monthCounter==4||monthCounter==5||monthCounter==12){result+='<option value="'+monthCounter+'" '+selected+">"+this.monthNames[monthCounter-1]+"</option>"}}else{result+='<option value="'+monthCounter+'" '+selected+">"+this.monthNames[monthCounter-1]+"</option>"}}result+="</select></TD>";result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10">&nbsp;</TD>';result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="56" COLSPAN="3"><select CLASS="" name="cpYear" onChange="BSCalClose();'+refresh+"("+this.index+","+month+',this.options[this.selectedIndex].value-0);">';var dDate=new Date();for(var yearCounter=dDate.getFullYear();yearCounter<=dDate.getFullYear()+2;yearCounter++){var selected=(yearCounter==year)?"SELECTED":"";result+='<option value="'+yearCounter+'" '+selected+">"+yearCounter+"</option>"}result+="</select></TD>"}else{if(this.isShowYearNavigation){result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+"("+this.index+","+last_month+","+last_month_year+');">&lt;</A></TD>';result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="58"><SPAN CLASS="'+this.cssPrefix+'cpMonthNavigation">'+this.monthNames[month-1]+"</SPAN></TD>";result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+"("+this.index+","+next_month+","+next_month_year+');">&gt;</A></TD>';result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10">&nbsp;</TD>';result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="'+refreshLink+"("+this.index+","+month+","+(year-1)+');">&lt;</A></TD>';if(this.isShowYearNavigationInput){result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="36"><INPUT NAME="cpYear" CLASS="'+this.cssPrefix+'cpYearNavigation" SIZE="4" MAXLENGTH="4" VALUE="'+year+'" onblur="'+refresh+"("+this.index+","+month+',this.value-0);"></TD>'}else{result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="36"><SPAN CLASS="'+this.cssPrefix+'cpYearNavigation">'+year+"</SPAN></TD>"}result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="'+refreshLink+"("+this.index+","+month+","+(year+1)+');">&gt;</A></TD>'}else{if(this.calendarType=="ski"){if(next_month==6){next_month=12}if(last_month==11){last_month=5}}result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+"("+this.index+","+last_month+","+last_month_year+');">&lt;&lt;</A></TD>\n';result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="100"><SPAN CLASS="'+this.cssPrefix+'cpMonthNavigation">'+this.monthNames[month-1]+" "+year+"</SPAN></TD>\n";result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+"("+this.index+","+next_month+","+next_month_year+');">&gt;&gt;</A></TD>\n'}}result+="</TR></TABLE>\n";result+="<TABLE WIDTH=120 BORDER=0 CELLSPACING=0 CELLPADDING=1 ALIGN=CENTER>\n";result+="<TR>\n";for(var j=0;j<7;j++){result+='<TD CLASS="'+this.cssPrefix+'cpDayColumnHeader" WIDTH="14%"><SPAN CLASS="'+this.cssPrefix+'cpDayColumnHeader">'+this.dayHeaders[(this.weekStartDay+j)%7]+"</TD>\n"}result+="</TR>\n";startdate_dt=new Date();if(CP_linkname.indexOf("EndDate")==6){arCal=CP_linkname.split("_");if(document.getElementById("startdate"+arCal[1])){if(document.getElementById("startdate"+arCal[1]).value){arStartDate=document.getElementById("startdate"+arCal[1]).value.split(" ");startdate_dt.setDate(arStartDate[0]);startdate_dt.setMonth(parseFloat(getMonthFromName(arStartDate[1])));startdate_dt.setFullYear(arStartDate[2])}}}var sTestAlert="";var bLinksShowing=false;for(var row=1;row<=6;row++){result+="<TR>\n";for(var col=1;col<=7;col++){var disabled=false;if(this.disabledDatesExpression!=""){var ds=""+display_year+LZ(display_month)+LZ(display_date);eval("disabled=("+this.disabledDatesExpression+")")}var dateClass="";if((display_month==this.currentDate.getMonth()+1)&&(display_date==this.currentDate.getDate())&&(display_year==this.currentDate.getFullYear())){dateClass="cpCurrentDate"}else{if((display_month==startdate_dt.getMonth()+1)&&(display_date==startdate_dt.getDate())&&(display_year==startdate_dt.getFullYear())&&(CP_linkname.indexOf("EndDate")==6)){dateClass="cpCurrentStartDate"}else{if(display_month==month){dateClass="cpCurrentMonthDate"}else{dateClass="cpOtherMonthDate"}}}if(disabled||this.disabledWeekDays[col-1]){result+='	<TD CLASS="'+this.cssPrefix+dateClass+'"><SPAN CLASS="'+this.cssPrefix+dateClass+'Disabled">'+display_date+"</SPAN></TD>\n"}else{var selected_date=display_date;var selected_month=display_month;var selected_year=display_year;if(this.displayType=="week-end"){var d=new Date(selected_year,selected_month-1,selected_date,0,0,0,0);d.setDate(d.getDate()+(7-col));selected_year=d.getYear();if(selected_year<1000){selected_year+=1900}selected_month=d.getMonth()+1;selected_date=d.getDate()}tempdate=new Date();tempdate.setMonth(parseFloat(selected_month)-1);tempdate.setDate(GetCorrectDayNum(parseFloat(selected_month)-1,parseFloat(selected_date)));tempdate.setFullYear(selected_year);sTestAlert+=tempdate+" < "+startdate_dt+"\n";if(tempdate<startdate_dt){result+='	<TD><span CLASS="cpDateNotAvail">'+display_date+"</span></TD>\n"}else{result+='	<TD CLASS="'+this.cssPrefix+dateClass+'"><A HREF="javascript:'+windowref+this.returnFunction+"("+selected_year+","+selected_month+","+selected_date+");"+windowref+"CP_hideCalendar('"+this.index+'\');" CLASS="'+this.cssPrefix+dateClass+'">'+display_date+"</A></TD>\n";bLinksShowing=true}}display_date++;if(display_date>daysinmonth[display_month]){display_date=1;display_month++}if(display_month>12){display_month=1;display_year++}}result+="</TR>"}var current_weekday=now.getDay()-this.weekStartDay;if(current_weekday<0){current_weekday+=7}result+="<TR>\n";result+='	<TD COLSPAN=7 ALIGN=CENTER CLASS="'+this.cssPrefix+'cpTodayText">\n';if(this.disabledDatesExpression!=""){var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate());eval("disabled=("+this.disabledDatesExpression+")")}if(disabled||this.disabledWeekDays[current_weekday+1]){result+='		<SPAN CLASS="'+this.cssPrefix+'cpTodayTextDisabled">'+this.todayText+"</SPAN>\n"}else{}result+="		<br/>\n";result+="	</TD></TR></TABLE></CENTER></TD></TR></TABLE>\n"}if(this.displayType=="month"||this.displayType=="quarter"||this.displayType=="year"){if(arguments.length>0){var year=arguments[0]}else{if(this.displayType=="year"){var year=now.getFullYear()-this.yearSelectStartOffset}else{var year=now.getFullYear()}}if(this.displayType!="year"&&this.isShowYearNavigation){result+="<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";result+="<TR>\n";result+='	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+"CP_refreshCalendar("+this.index+","+(year-1)+');">&lt;&lt;</A></TD>\n';result+='	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="100">'+year+"</TD>\n";result+='	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+"CP_refreshCalendar("+this.index+","+(year+1)+');">&gt;&gt;</A></TD>\n';result+="</TR></TABLE>\n"}}if(this.displayType=="month"){result+="<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n";for(var i=0;i<4;i++){result+="<TR>";for(var j=0;j<3;j++){var monthindex=((i*3)+j);result+='<TD WIDTH=33% ALIGN=CENTER><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnMonthFunction+"("+year+","+(monthindex+1)+");"+windowref+"CP_hideCalendar('"+this.index+'\');" CLASS="'+date_class+'">'+this.monthAbbreviations[monthindex]+"</A></TD>"}result+="</TR>"}result+="</TABLE></CENTER></TD></TR></TABLE>\n"}if(this.displayType=="quarter"){result+="<br/><TABLE WIDTH=120 BORDER=1 CELLSPACING=0 CELLPADDING=0 ALIGN=CENTER>\n";for(var i=0;i<2;i++){result+="<TR>";for(var j=0;j<2;j++){var quarter=((i*2)+j+1);result+='<TD WIDTH=50% ALIGN=CENTER><br/><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnQuarterFunction+"("+year+","+quarter+");"+windowref+"CP_hideCalendar('"+this.index+'\');" CLASS="'+date_class+'">Q'+quarter+"</A><br/><br/></TD>"}result+="</TR>"}result+="</TABLE></CENTER></TD></TR></TABLE>\n"}if(this.displayType=="year"){var yearColumnSize=4;result+="<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";result+="<TR>\n";result+='	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="50%"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+"CP_refreshCalendar("+this.index+","+(year-(yearColumnSize*2))+');">&lt;&lt;</A></TD>\n';result+='	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="50%"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+"CP_refreshCalendar("+this.index+","+(year+(yearColumnSize*2))+');">&gt;&gt;</A></TD>\n';result+="</TR></TABLE>\n";result+="<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n";for(var i=0;i<yearColumnSize;i++){for(var j=0;j<2;j++){var currentyear=year+(j*yearColumnSize)+i;result+='<TD WIDTH=50% ALIGN=CENTER><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnYearFunction+"("+currentyear+");"+windowref+"CP_hideCalendar('"+this.index+'\');" CLASS="'+date_class+'">'+currentyear+"</A></TD>"}result+="</TR>"}result+="</TABLE></CENTER></TD></TR></TABLE>\n"}if(this.type=="WINDOW"){result+="</BODY></HTML>\n"}return result};