var wsProxyTimeout=60000;var oneDay=60*1000*60*24;function formatNumber(a,b,c,d){a=a.toString();var k='';if(a.indexOf('-')==0){k='-';a=a*-1}a=Math.round(a*Math.pow(10,b))/Math.pow(10,b);var e=a+'';var f=e.split('.');if(!f[0])f[0]='0';if(!f[1])f[1]='';if(f[1].length<b){var g=f[1];for(var i=f[1].length+1;i<=b;i++){g+='0'}f[1]=g}if(d!=''&&f[0].length>3){var h=f[0];f[0]='';for(var j=3;j<h.length;j+=3){i=h.slice(h.length-j,h.length-j+3);f[0]=d+i+f[0]+''}j=h.substr(0,(h.length%3==0)?3:(h.length%3));f[0]=j+f[0]}c=(b<=0)?'':c;return k+f[0]+c+f[1]}function formatCurr(a,b,c){if(c!=undefined&&c!=null){c=parseInt(c)}else{c=2}var d="";if(b)d=b.toUpperCase();switch(d){case"NZD":case"AUD":case"USD":case"CAD":case"HKD":return"$"+formatNumber(a,c,".",",");break;case"CNY":case"JPY":return"&#165;"+formatNumber(a,c,".",",");break;case"KPW":case"KRW":return"&#8361;"+formatNumber(a,c,".",",");break;case"SAR":return"&#65020;"+formatNumber(a,c,".",",");break;case"THB":return"&#3647;"+formatNumber(a,c,".",",");break;case"EUR":return"&#8364;"+formatNumber(a,c,",",".");break;case"GBP":return"&#163;"+formatNumber(a,c,".",",");break;case"ZAR":return"R"+formatNumber(a,c,".",",");break;case"ZWD":return"Z$"+formatNumber(a,c,".",",");break;default:return formatNumber(a,c,".",",");break}}function findElementPos(a){var x=0;var y=0;try{while(a!=null){x+=a.offsetLeft;y+=a.offsetTop;a=a.offsetParent}}catch(ex){x=0;y=0}var b=new function(){this.x=x;this.y=y};return b}function str2Date(a){if(a.length==8){var b=new Date();b.setFullYear(a.substr(0,4));b.setMonth(parseFloat(a.substr(4,2))-1);b.setMonth(parseFloat(a.substr(4,2))-1);b.setDate(a.substr(6,2));b.setHours(0,0,0,0);return b}else{var b=new Date();b.parse(a);b.setHours(0,0,0,0);return b}}function date2Str(a){var b="";var c="";var d="";b+=a.getFullYear();c+=(a.getMonth()+1);d+=a.getDate();if(c.length<2)c="0"+c;if(d.length<2)d="0"+d;b=b+c+d;return b}function centerElement(a,b){if(a){a.style.position="absolute";var c=document.body.scrollTop;var d=document.body.scrollLeft;var e=document.body.clientHeight;var f=document.body.clientWidth;if(typeof(window.pageYOffset)=='number'){c=window.pageYOffset;d=window.pageXOffset}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){c=document.body.scrollTop;d=document.body.scrollLeft}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){c=document.documentElement.scrollTop;d=document.documentElement.scrollLeft}if(typeof(window.innerWidth)=='number'){f=window.innerWidth;e=window.innerHeight}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){f=document.documentElement.clientWidth;e=document.documentElement.clientHeight}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){f=document.body.clientWidth;e=document.body.clientHeight}var g;var h;if(b){g=0;h=0;a.style.width=document.body.parentNode.scrollWidth+"px";a.style.height=document.body.parentNode.scrollHeight+"px"}else{var i=false;var j=0;var k=0;if(a.style.display=="none"){i=true;a.style.display="block"}j=a.offsetHeight;k=a.offsetWidth;if(i)a.style.display="none";var l=Math.ceil(e/2-j/2);var m=Math.ceil(f/2-k/2);g=c+l-40;h=d+m-70}a.style.top=g+"px";a.style.left=h+"px"}}function validateEmailAddress(a,b){if(b&&a=="")return true;if(a&&typeof a=="string"){var c="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?";return a.match(new RegExp(c))}return false}function findChildNodeByID(a,b,c){if(a.childNodes&&((b!=undefined&&b!=null)||(c!=undefined&&c!=null))){for(var i=0;i<a.childNodes.length;i++){if(b!=undefined&&b!=null){if(a.childNodes[i].id==b)return a.childNodes[i]}else{if(a.childNodes[i].name==c)return a.childNodes[i]}var d=findChildNodeByID(a.childNodes[i],b,c);if(d!=null)return d}}return null}function findFirstElementByClassName(a,b){if(b.className==a){return b}for(var i=0;i<b.childNodes.length;i++){return findFirstElementByClassName(a,b.childNodes[i])}}function Rate(c){this.tdRate=c.parentNode.parentNode;this.trRate=this.tdRate.parentNode;this.supplierID=parseInt(this.trRate.getAttribute("SupplierID"));this.serviceID=parseInt(this.trRate.getAttribute("ServiceID"));this.rateRowID=this.trRate.getAttribute("RateRowID");this.ACI=this.trRate.getAttribute("ACI");this.rateDate=this.tdRate.getAttribute("RateDate");this.availability=parseInt(this.tdRate.getAttribute("Avail"));this.allotName=this.trRate.getAttribute("AllotName");this.allotCount=parseInt(c.getAttribute("AllotCount"));this.rateID=parseInt(c.getAttribute("RateID"));this.rateAmount=parseFloat(c.getAttribute("Rate"));if(isNaN(this.rateAmount))this.rateAmount=0;this.rateAdult=parseFloat(c.getAttribute("RateA"));if(isNaN(this.rateAdult))this.rateAdult=0;this.rateChild=parseFloat(c.getAttribute("RateC"));if(isNaN(this.rateChild))this.rateChild=0;this.rateInfant=parseFloat(c.getAttribute("RateI"));if(isNaN(this.rateInfant))this.rateInfant=0;this.ticked=(c.getAttribute("Tick")=="1")?true:false;this.timeSlotID=parseInt(this.trRate.getAttribute("TimeSlotID"));if(isNaN(this.timeSlotID))this.timeSlotID=null;this.set_ticked=function(a,b){if(a==true){c.setAttribute("Tick","1");c.className=b.rateTickedClass}else{c.setAttribute("Tick","0");c.className=b.rateUntickedClass}}}function BookEngine(R,S,T,U,V,W,X,Y,Z,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv,bw,bx,by,bz,bA,bB,bC,bD,bE,bF,bG,bH,bI,bJ,bK,bL,bM,bN,bO,bP,bQ,bR,bS,bT,bU,bV,bW,bX,bY,bZ,ca,cb,cc,cd,ce,cf,cg,ch,ci,cj,ck,cl,cm,cn,co,cp,cq,cr,cs,ct,cu,cv,cw,cx,cy,cz,cA,cB,cC,cD,cE,cF,cG,cH,cI,cJ){this.ID=R;this.uniqueID=R.replace(/_/g,"$");this.supplierID=S;this.clientIDRate=U;this.supplierName=Y;this.serviceID=V;this.categoryID=T;this.timeSlotMode=W;this.rateCode=X;this.currencyCode=Z;this.currRate=ba;this.bsAmendID=bb;this.visibleDates=bc;this.jumpSize=bd;this.scrollSize=be;this.showUnavailableServices=bf;this.strNoSelectionsMsg=cr;this.strSomeServicesOnRequestMsg=cs;this.strRateCondMinStay=cC;this.strRateCondMaxStay=cD;this.strRateCondMinPax=cE;this.strRateCondMaxPax=cF;this.strRateCellContentHTMLTemplate=cG;this.strConfirmDelSelections=cH;this.strAvailability=cI;this.headerDateClass=bn;this.headerDateAltClass=bo;this.toolTipLoadingClass=bp;this.rateNameCellClass=bq;this.rateTipClass=br;this.rateTickedClass=bs;this.rateUntickedClass=bt;this.rateEmptyClass=bu;this.rateNotAvailClass=bv;this.rateAvailClass=bw;this.rateRequestClass=bx;this.rateSelectedClass=by;this.dayNames=bC.split(",");this.monthNames=bD.split(",");this.availability=new function(){var a=bE.split(",");this.unknown=parseInt(a[0]);this.unavailable=parseInt(a[1]);this.available=parseInt(a[2]);this.onRequest=parseInt(a[3])};this.strAdult=cw;this.strChild=cy;this.strInfant=cA;this.showAvailTip=bm;this.services=new Array();this.regService=function(a){var b="service_"+a.serviceID;if(a.timeSlotID!=null)b+="_"+a.timeSlotID.toString();this.services[this.services.length]=a;this.services[b]=a};this.cleanupServices=function(a){var i=0;while(i<this.services.length){var b=this.services[i];var c="service_"+b.serviceID;if(b.timeSlotID!=null)c+="_"+b.timeSlotID.toString();var d=0;if(b)d=b.removeEmptyRateRows();if(d==0&&!(this.showUnavailableServices)&&!(b.get_hasSelections())&&(b.get_selectedQty()<=1)&&(a==null||a==undefined||a[c]!=true)){var e=b.get_tblService();if(e&&e.parentNode){e.parentNode.removeChild(e)}this.services.splice(i,1);if(this.services[c])delete this.services[c]}else{i++}}};this.get_serviceByID=function(a,b){var c="service_"+a;if(b!=undefined&&b!=null&&b!=""&&!isNaN(b))c+="_"+b.toString();return this.services[c]};this.refresh=function(){var a=document.getElementById(bO);if(a){var b=document.getElementById(bL);if(b){b.value="1"}a.click()}};function SelState(){function SelStateItem(j,k,l,m,n,o,p,q,r){this.init=function(a,b,c,d,e,f,g,h,i){if(a!=undefined&&a!=null)this.supplierID=parseInt(a);if(b!=undefined&&b!=null)this.serviceID=parseInt(b);if(c!=undefined&&c!=null)this.timeSlotID=parseInt(c);if(d!=undefined&&d!=null)this.rateRowID=d;if(e!=undefined&&e!=null)this.rateID=parseInt(e);if(f!=undefined&&f!=null){if(typeof f=="string"){this.rateDate=str2Date(f)}else{this.rateDate=f}}if(g!=undefined&&g!=null)this.rateAmount=parseFloat(g);if(h!=undefined&&h!=null)this.availability=parseInt(h);if(i!=undefined&&i!=null)this.ACI=i};this.init(j,k,l,m,n,o,p,q,r);this.toString=function(){return"SS#"+this.supplierID+"#"+this.serviceID+"#"+this.timeSlotID+"#"+this.rateRowID+"#"+this.rateID+"#"+date2Str(this.rateDate)+"#"+this.rateAmount+"#"+this.ACI+"="+this.availability};this.parse=function(a){if(a.indexOf("SS#")==0){var b=a.split("=");if(b.length>1){var c=b[0].split("#");if(c.length>8){this.init(c[1],c[2],c[3],c[4],c[5],c[6],c[7],b[1],c[8])}}}}}this.items=new Array();this.isMatch=function(a,b,c,d,e,f,g,h,i,j){if(b==null||b==undefined||b==a.supplierID){if(c==null||c==undefined||c==a.serviceID){if(d==null||d==undefined||d==a.timeSlotID){if(e==null||e==undefined||e==a.rateRowID){if(f==null||f==undefined||f==a.rateID){if(g==null||g==undefined||g.getTime()==a.rateDate.getTime()){if(h==null||h==undefined||h==a.rateAmount){if(i==null||i==undefined||i==a.availability){if(j==null||j==undefined||j==a.ACI){return true}}}}}}}}}return false};this.find=function(a,b,c,d,e,f,g,h,j){var k=new Array();for(var i=0;i<this.items.length;i++){var l=this.items[i];if(f!=null&&f!=undefined&&typeof f=="string")f=str2Date(f);if(this.isMatch(l,a,b,c,d,e,f,g,h,j)){k[k.length]=l}}return k};this.remove=function(a,b,c,d,e,f,g,h,j){var i=0;while(i<this.items.length){var k=this.items[i];if(f!=null&&f!=undefined&&typeof f=="string")f=str2Date(f);if(this.isMatch(k,a,b,c,d,e,f,g,h,j)){var l=this.items[i].toString();this.items.splice(i,1);delete this.items[l]}else{i++}}};this.add=function(a,b,c,d,e,f,g,h,i){if(f!=null&&f!=undefined&&typeof f=="string")f=str2Date(f);var j=new SelStateItem(a,b,c,d,e,f,g,h,i);this.items[this.items.length]=j;this.items[j.toString()]=j};this.parse=function(a,b){if(!b){var c=this.items.length;if(c>0){this.items.splice(0,c)}}var d=a.split("&");for(var i=0;i<d.length;i++){if(d[i]!=""){var e=new SelStateItem();e.parse(d[i]);this.add(e.supplierID,e.serviceID,e.timeSlotID,e.rateRowID,e.rateID,e.rateDate,e.rateAmount,e.availability,e.ACI)}}};this.toString=function(){var a="";for(var i=0;i<this.items.length;i++){if(i>0)a+="&";a+=this.items[i].toString()}return a}}this.get_selectState=function(){var a=document.getElementById(bP).value;var b=new SelState();b.parse(a,false);return b};this.show_selectState=function(){var a=this.get_selectState();var b="";for(var i=0;i<a.items.length;i++){if(a.items[i]){if(b!="")b+="\n";b+=a.items[i]}}if(b!="")alert(b);else alert("No selection state.")};this.set_selectState=function(a){var b=document.getElementById(bP);if(b&&a){b.value=a.toString()}};this.get_divRates=function(){return document.getElementsByName(this.uniqueID+"$divRate")};this.get_childDivRate=function(a){return findChildNodeByID(a,null,this.uniqueID+"$divRate")};this.date2HeaderDateStr=function(a){var b=this.dayNames[a.getDay()]+"<br/>"+a.getDate()+" "+this.monthNames[a.getMonth()];return b};this.date2SummaryStr=function(a){var b=this.dayNames[a.getDay()]+" "+a.getDate()+" "+this.monthNames[a.getMonth()]+" '"+a.getFullYear().toString().substr(2,2);return b};this.minDate=str2Date(bh);this.maxDate=str2Date(bi);this.get_startDateStr=function(){var a=document.getElementById(bQ);if(a){return a.value}return""};this.get_startDate=function(){var a=this.get_startDateStr();if(a&&a!="")return str2Date(a)};this.set_startDate=function(a){var b=document.getElementById(bQ);if(b){a.setHours(0,0,0,0);b.value=date2Str(a)}};this.buildRateContentRequest=function(a,b,c,d,e,f,g,h){var i="";try{i+=("DestCellID="+a.id);i+=("&ServiceID="+b);if(d!=undefined&&d!=null&&!isNaN(d))i+=("&TimeSlotID="+d);i+=("&RateRowID="+e);i+=("&RateDate="+f);i+=("&QtyRequired="+g);i+=("&ACI="+h);i+=("|||||")}catch(ex){i=""}return i};this.get_visibleRateRowIDs=function(){var a=new Array();try{for(var i=0;i<this.services.length;i++){var b=this.services[i];if(b){var c=b.get_visibleRateRowIDs();if(c){for(var j=0;j<c.length;j++){a[a.length]=c[j]}}}}}catch(ex){}return a};this.get_visibleServiceKeys=function(){var a=new Array();try{for(var i=0;i<this.services.length;i++){var b=this.services[i];if(b){var c=this.supplierID+"_"+b.serviceID;if(b.timeSlotID!=null)c+="_"+b.timeSlotID.toString();a[a.length]=c}}}catch(ex){}return a};this.requestRateContent=function(a,b,c){var d="";var e=this.get_selectState();var f=this.get_visibleRateRowIDs().join(",");var g=this.get_visibleServiceKeys().join(",");if(b==undefined||b==null)b=this.serviceID;var h="";h+=("SupplierID="+this.supplierID);h+=("&CategoryID="+this.categoryID);h+=("&ClientIDRate="+this.clientIDRate);h+=("&ServiceID="+b);h+=("&TimeSlotMode="+(this.timeSlotMode?1:0));h+=("&RateCode="+this.rateCode);h+=("&BSAmendID="+this.bsAmendID);h+=("&StartDate="+this.get_startDateStr());h+=("&VisibleDates="+this.visibleDates);h+=("&VisibleRateRowIDs="+f);h+=("&VisibleServiceKeys="+g);h+=("&CurrencyCode="+this.currencyCode);h+=("&Adults="+bj);h+=("&Children="+bk);h+=("&Infants="+bl);if(e!="")h+=("&"+e.toString());h+=("|||||");var i=new Evolution.BookEngineWebService();i.set_timeout(wsProxyTimeout);if(c)d="NOCLEANUP";i.GetRateContent(h+a,this.rateContentSuccess,this.rateContentFail,d)};this.rateContentSuccess=function(a,b,c){try{if(!a||a=="")return;var d=document[R];var e=d.get_selectState();var f=d.get_selectState();var g=a.split("|||||");var h=new Array();for(var i=0;i<g.length;i++){var j=false;var k=g[i].split("=====");if(k.length>0){var l=k[0].split(",");for(var m=0;m<l.length;m++){l[m]=l[m].replace(/\\x2C/g,",")}if(l&&l.length>0&&l[0]!=""){switch(l[0]){case"1":d.refresh();return;break;case"3":if(l.length>2){var n=parseInt(l[1]);var o=parseInt(l[2]);if(isNaN(o))o=null;var p=d.get_serviceByID(n,o);var q="service_"+n;if(o!=null)q+="_"+o.toString();h[q]=true;j=true}break;case"9999":msg=l[1];stack=l[2];exType=l[3];return;break;default:break}if(!j){try{var r=l[1];var n=l[2];var s=l[3];var t=l[4];var u=l[5];var v=parseFloat(l[6]);var w=parseInt(l[7]);var x=(parseInt(l[8])!=0);var y=parseFloat(l[9]);var z=parseFloat(l[10]);var A=parseFloat(l[11]);var B=l[12];var C=l[13];var D="";var E=0;var o=null;if(l.length>=15){ba=parseFloat(l[14]);d.currRate=ba}if(l.length>=16)D=l[15];if(l.length>=17)E=parseInt(l[16]);if(l.length>=18)o=parseInt(l[17]);if(isNaN(o))o=null;var F=document.getElementById(r);var p=d.get_serviceByID(n,o);if(w==d.availability.unavailable||w==d.availability.unknown){f.remove(undefined,n,o,s,undefined,u,undefined,undefined,B);x=false}if(x){f.remove(d.supplierID,n,o,s,t,u,undefined,undefined,B);f.add(d.supplierID,n,o,s,t,u,v,w,B)}if(F){p.set_RateCellContent(F,w,str2Date(u),t,v,x,d.ID+".rateClick(this);",y,z,A,D,E);p.set_rateStyle(F,x,w)}if(C!=null&&C!=""){p.set_rateNameByRateRowID(s,B,C,D)}}catch(ex){}}}}}d.set_selectState(f);if(b!="NOCLEANUP"){d.cleanupServices(h)}else{for(var i=0;i<d.services.length;i++){var q="service_"+d.services[i].serviceID;if(d.services[i].timeSlotID!=null)q+="_"+d.services[i].timeSlotID.toString();if(h[q]!=true){d.services[i].removeEmptyRateRows()}}}var G=document.getElementById(bN);if(G&&d.services.length==0){G.style.display="inline"}else if(G){G.style.display="none"}var H=document.getElementById(bG);if(H){var I=d.get_visibleRateRowIDs();H.style.display=(I.length>bg)?"block":"none"}if(f.items.length<e.items.length){var J=new Array();J[0]="Some selections were removed as they were no longer available.";d.showSummary(J)}else{d.showSummary()}}catch(ex){}};this.rateContentFailed=function(a,b,c){if(a.get_timedOut()){alert("The connection to the server timed out.")}else{alert(a.get_exceptionType()+": \""+a.get_message()+"\"")}};this.scrollHeaderDates=function(a,b,c,d){try{if(c>0)c=c-1;if(d>0)d=d-1;var e=document.getElementById(a);e.deleteCell(c);var f=e.insertCell(d);f.innerHTML=this.date2HeaderDateStr(b);f.className=this.headerDateClass;var g=f.previousSibling;if(!g)g=f.nextSibling;if(g&&g.className==this.headerDateClass)f.className=this.headerDateAltClass}catch(ex){}};var cK=false;this.doScroll=function(a,b){if(cK)return"";cK=true;var c;var d;var e="";var f;var g;try{if(a==0)return"";if(a>0){f=new Date(this.get_startDate().getTime());f.setDate(f.getDate()+this.visibleDates);if(f.getTime()>this.maxDate.getTime())return"";var h=new Date(this.get_startDate().getTime());h.setDate(h.getDate()+1);this.set_startDate(h);c=-1;d=1;if(this.get_startDate().getDate()>26){g=this.get_startDate();g.setDate(g.getDate()+7)}}else{f=new Date(this.get_startDate().getTime());f.setDate(f.getDate()-1);if(f.getTime()<this.minDate.getTime())return"";this.set_startDate(f);c=1;d=-1;if(this.get_startDate().getDate()<4){g=this.get_startDate();g.setDate(g.getDate()-7)}}this.scrollHeaderDates(bH,f,d,c);this.scrollHeaderDates(bI,f,d,c);for(var i=0;i<this.services.length;i++){var k=this.services[i];var l=k.get_ratesRows();if(l){for(var j=0;j<l.length;j++){l[j].deleteCell(d);var m=k.get_rateRowIDByRow(l[j]);var n=k.get_ACIByRow(l[j]);var o=k.buildRateCell(l[j],c,date2Str(f),cn,co);e+=this.buildRateContentRequest(o,k.serviceID,k.servicePerID,k.timeSlotID,m,date2Str(f),k.get_selectedQty(),n)}}}if(!b)this.requestRateContent(e)}catch(ex){}finally{cK=false}return e};var cL=false;this.doJump=function(a){if(cL)return false;cL=true;try{var b="";var c;if(a==0)return false;c=new Date(this.get_startDate().getTime()+(oneDay*a));c.setHours(0,0,0,0);if((c.getTime()+(this.visibleDates*oneDay)-oneDay)>=this.maxDate.getTime())c=new Date(this.maxDate.getTime()-(this.visibleDates*oneDay)+oneDay);if(c.getTime()<this.minDate.getTime())c=new Date(this.minDate.getTime());if(this.get_startDate().getTime()==c.getTime())return false;if(a>0){do{var d=this.doScroll(1,true);var e=c;var f=new Date(c.getTime()+(this.visibleDates*oneDay)-oneDay);var g=new Date(this.get_startDate().getTime()+(this.visibleDates*oneDay)-oneDay);e.setHours(0,0,0,0);f.setHours(0,0,0,0);g.setHours(0,0,0,0);if(g.getTime()>=e.getTime()&&g.getTime()<=f.getTime()){b+=d}}while(this.get_startDate().getTime()<c.getTime())}else{do{var d=this.doScroll(-1,true);var e=c;var f=new Date(c.getTime()+(this.visibleDates*oneDay)-oneDay);var g=this.get_startDate();e.setHours(0,0,0,0);f.setHours(0,0,0,0);g.setHours(0,0,0,0);if(g.getTime()>=e.getTime()&&g.getTime()<=f.getTime()){b+=d}}while(this.get_startDate().getTime()>c.getTime())}this.updateMonthJump(bJ);this.updateMonthJump(bK);this.requestRateContent(b);return false}catch(ex){}finally{cL=false}};this.updateMonthJump=function(b){var c=document.getElementById(bL);var d=document.getElementById(b);if(d){var e=this.get_startDateStr().substring(0,6);for(var i=0;i<d.length;i++){if(d.item(i).value.substring(0,6)==e&&d.selectedIndex!=i){var f=d.onchange;try{d.onchange=null;d.selectedIndex=i;if(c)c.value="1"}catch(ex){}finally{var g=function(){var a=document.getElementById(bL);if(a)c.value="";f()};d.onchange=g}return}}}};this.refreshServiceRates=function(a,b,c){var d="";var e=null;if(a==null||a==undefined){a=null;e=this.services}else{e=new Array();e[0]=this.get_serviceByID(a,b)}for(var s=0;s<e.length;s++){var f=e[s];if(f){var g=f.get_ratesRows();if(g){for(var i=0;i<g.length;i++){var h=g[i].cells;if(h){for(var j=1;j<h.length;j++){var k=f.get_rateRowIDByRow(g[i]);var l=f.get_ACIByRow(g[i]);var m=g[i].cells[j].getAttribute("RateDate");var n=f.get_selectedQty();var o=f.buildRateCell(g[i],j,m,cn,co,true);if(!c)d+=this.buildRateContentRequest(o,f.serviceID,f.servicePerID,f.timeSlotID,k,m,n,l)}}}}}}if(c){if(e.length>2){this.refresh()}else if(e.length>0){for(var i=0;i<e.length;i++){e[i].refresh()}}}else{this.requestRateContent(d,a,true)}};this.rateClick=function(a,b,c){var d=this.supplierID;var e=new Rate(a);var f=e.serviceID;var g=e.rateRowID;var h=e.ACI;var j=e.rateDate;var k=e.availability;var l=e.rateID;var m=e.rateAmount;var n=e.timeSlotID;var o=this.get_serviceByID(f,n);if(!e.ticked){var p=this.get_selectState();if(p.find(d,f,n,g).length==0){this.condTipShow(a,d,f,n,g,h)}else{this.condTipShow()}if(o.servicePerID!=1&&o.servicePerID!=3&&o.servicePerID!=6&&o.servicePerID!=7){var q=this.get_divRates();for(var i=0;i<q.length;i++){var r=new Rate(q[i]);if(q[i]!=a&&r.ticked&&r.supplierID==d&&r.serviceID==f&&r.rateDate==j&&r.rateRowID!=g){this.rateClick(q[i],true,true)}}p=this.get_selectState();var s=0;while(s<p.items.length){var t=p.items[s];if(t.supplierID==d&&t.serviceid&&t.rateDate==j&&t.rateRowID!=g){var u=p.items[s].toString();this.items.splice(s,1);delete this.items[u]}else{s++}}this.set_selectState(p)}else if(o.servicePerID==1||o.servicePerID==6){var q=this.get_divRates();for(var i=0;i<q.length;i++){var r=new Rate(q[i]);if(r[i]!=a&&r.ticked&&r.supplierID==d&&r.serviceID==f){this.rateClick(q[i],true,true)}}p=this.get_selectState();p.remove(d,f);this.set_selectState(p)}e.set_ticked(true,this);p.add(d,f,n,g,l,j,m,k,h);this.set_selectState(p);if(!c&&o.get_selectedQty()=="0"){o.set_selectedQty("1")}if(!c&&o.get_paxQtyValByID(g,h)=="0"){o.set_paxQtyValByID(g,h,"1")}o.set_rateStyle(e.tdRate,true,k)}else{this.condTipShow();e.set_ticked(false,this);var p=this.get_selectState();p.remove(d,f,n,g,undefined,j,undefined,undefined,h);this.set_selectState(p);if(!c&&o.get_selectedQty()==1){if(p.items.length==0||p.find(d,f,n).length==0){o.set_selectedQty("0")}}if(o.get_paxQtyValByID(g,h)>0){if(p.items.length==0||p.find(d,f,n,g,undefined,undefined,undefined,undefined,h).length==0){o.set_paxQtyValByID(g,h,"0")}}o.set_rateStyle(e.tdRate,false,k)}if(!b)this.showSummary()};this.serviceTipShow=function(a,b,c,d,e){var f=document.getElementById(bS);var g=$find(bT);var h=document.getElementById(bU);var i=document.getElementById(bY);if(g&&f&&h){f.style.display="none";g.get_element().style.display="block";g.get_element().innerHTML="&nbsp;";g.get_element().className=this.toolTipLoadingClass;h.innerHTML=e;var j=findElementPos(a);if(i!=null&&i.scrollTop!=undefined&&i.scrollLeft!=undefined){j.x=j.x-i.scrollLeft;j.y=j.y-i.scrollTop;if(j.x<0)j.x=0;if(j.y<0)j.y=0}f.style.position="absolute";f.style.left=j.x+"px";f.style.top=j.y+"px";$telerik.$("#"+bS).fadeIn("fast");var k="";k+=("&ServiceID="+c);k+=("&LanguageID="+d);g.set_value(k);f.serviceID=c}};this.serviceTipRec=function(a,e){var b=$find(bT);if(b&&e.get_content()!=""){b.get_element().className=""}};this.serviceTipClose=function(){$telerik.$("#"+bS).fadeOut("fast")};this.serviceMore=function(a){if(cp!=""&&a!=undefined&&a!=null){this.serviceTipClose();var b=cp+"?pop=1&hidebe=1&beslinksoff=1&sid="+a;popAvail(b)}};this.genTipShow=function(a,b,c,d,e,f,g,h){var i=document.getElementById(bV);var j=document.getElementById(bW);var k=document.getElementById(bX);if(i){i.style.display="none";i.style.position="absolute";var l=document[bV+"_W"];var m=document[bV+"_H"];if(l==undefined||l==null)document[bV+"_W"]=i.style.width;if(m==undefined||m==null)document[bV+"_H"]=i.style.height;l=document[bV+"_W"];m=document[bV+"_H"];if(a){var n=null;var o=null;if(g==undefined||g==null)g=l;if(h==undefined||h==null)h=m;if(g!=""&&!isNaN(g))g=g+"px";if(h!=""&&!isNaN(h))h=h+"px";i.style.width=g;i.style.height=h;if(d){var p=findElementPos(d);if(!(isNaN(p.x)||isNaN(p.y))){n=p.x;o=p.y}if(e!=null&&e!=undefined&&f!=null&&f!=undefined){if(n==null)n=0;if(o==null)o=0;n=n+e;o=o+f}}else if(e!=null&&e!=undefined&&f!=null&&f!=undefined){n=e;o=f}if(n!=null&&o!=null){i.style.left=n+"px";i.style.top=o+"px"}else{centerElement(i)}}else{return}if(j){while(j.firstChild)j.removeChild(j.firstChild);if(b!=undefined&&b!=null){var q=document.createElement("span");q.innerHTML=b;j.appendChild(q)}}if(k){while(k.firstChild)k.removeChild(k.firstChild);if(c!=undefined&&c!=null){var q=document.createElement("span");q.innerHTML=c;k.appendChild(q)}}$telerik.$("#"+bV).slideDown("fast")}};this.genTipClose=function(){$telerik.$("#"+bV).fadeOut("fast")};this.condTipShow=function(a,b,c,d,e,f){try{if(a==null||a==undefined||b==null||b==undefined||c==undefined||c==null){this.genTipClose();return}if(d!=undefined&&d!=null&&isNaN(d))d=null;var g=this.get_serviceByID(c,d);if(g){var h=document.getElementById(bY);var i=findElementPos(a);if(h&&h.scrollTop!=undefined&&h.scrollLeft!=undefined){if(i&&i.x!=undefined&&i.x!=null&&i.y!=undefined&&i.y!=undefined){i.x=i.x-h.scrollLeft;i.y=i.y-h.scrollTop}}var j=g.get_conditionIDByRateRowID(e,f);if(j==null||j==undefined||j==-1)return;var k=c+"#";if(d!=null)k+=d;k+="#"+e+"#"+f+"#"+(i.x+40)+"#"+(i.y-30);var l=new Evolution.BookEngineWebService();l.set_timeout(wsProxyTimeout);var m="";m+=("supplierID="+b);m+=("&conditionID="+j);l.GetCondTip(m,this.condTipSuccess,this.condTipFail,k)}}catch(ex){}};this.condTipGen=function(a,b,c,d,e,f){try{if(b==undefined||b==null||isNaN(b))b=null;var g=this.get_serviceByID(a,b);if(g){var h=g.get_conditionByRateRowID(c,d);if(h&&h.text!=null&&h.text!=undefined){this.genTipShow(true,ct,h.text,null,e,f)}else{this.genTipClose()}}}catch(ex){}};this.condTipSuccess=function(a,b,c){try{var d=b.split("#");var e=document[R];var r=a.split("=====");if(!r||r.length==0||r[1]==""){if(d&&d.length>=5){e.condTipGen(d[0],d[1],d[2],d[3],d[4],d[5])}}else{var f=r[1];if(d&&d.length>=6){f=f.replace(/\\r\\n/g,"<BR/>");f=f.replace(/\\r/g,"<BR/>");f=f.replace(/\\n/g,"<BR/>");e.genTipShow(true,ct,f,null,d[4],d[5])}}}catch(ex){}};this.condTipFail=function(a,b,c){try{var d=b.split("#");if(d&&d.length>=6){this.condTipGen(d[0],d[1],d[2],d[3],d[4],d[5])}}catch(a){}};this.rateTipShow=function(a){this.genTipShow()};this.rateTipClose=function(a){this.genTipShow()};this.validateBooking=function(){var a=new Array();a.success=true;var b="";try{b=this.get_selectState();if(b.items.length==0){if(cm){a.success=true;return}else{a[a.length]=this.strNoSelectionsMsg;a.success=false;return}}}catch(ex){a[a.length]=cq+"<br/>"+ex.message;a.success=false}finally{return a}};this.get_serviceSummary=function(e,f,g,h){var k=new Date(0);var l=new Date(0);var m=false;var n=new Array();var o=null;switch(g.servicePerID){case 1:case 3:case 6:case 7:var p=e.find(f,g.serviceID,g.timeSlotID);var q=new Array();for(var i=0;i<p.length;i++){var r="RATECODE__"+p[i].rateRowID;if(!q[r]){q[q.length]=p[i].rateRowID;q[r]=p[i].rateRowID}}for(var i=0;i<q.length;i++){var s=q[i].replace("RATECODE__","");p=e.find(f,g.serviceID,g.timeSlotID,q[i]);p.sort(function(a,b){return a.rateDate.getTime()-b.rateDate.getTime()});var t=null;for(var j=0;j<p.length;j++){if(t==null||(p[j].rateDate.getTime()!=t.getTime())){o=new function(){this.selections=new Array();this.earliestDate=p[j].rateDate;this.latestDate=p[j].rateDate};n[n.length]=o}o.selections[o.selections.length]=p[j];o.latestDate=p[j].rateDate;t=p[j].rateDate}}break;default:var p=e.find(f,g.serviceID,g.timeSlotID);p.sort(function(a,b){return a.rateDate.getTime()-b.rateDate.getTime()});var t=null;var u=null;var v=new Array();for(var i=0;i<p.length;i++){var r=date2Str(p[i].rateDate)+"|||||"+p[i].rateRowID;var w=v[r];if(w==null){w=new function(){this.A=0;this.C=0;this.I=0};v[r]=w;v[v.length]=r}switch(p[i].ACI){case"A":w.A=1;break;case"C":w.C=1;break;case"I":w.I=1;break;default:break}}for(var i=0;i<p.length;i++){var x=v[date2Str(p[i].rateDate)+"|||||"+p[i].rateRowID];if(t==null||(p[i].rateDate.getTime()-t.getTime())>oneDay||u==null||(u.A!=x.A||u.C!=x.C||u.I!=x.I)){o=new function(){this.selections=new Array();this.earliestDate=p[i].rateDate;this.latestDate=p[i].rateDate};n[n.length]=o}o.selections[o.selections.length]=p[i];o.latestDate=p[i].rateDate;t=p[i].rateDate;u=x}break}var y=new Array();for(var i=0;i<n.length;i++){o=n[i];var z=new Array();var A=new function(){this.earliestDate=o.earliestDate;this.latestDate=o.latestDate;this.summaryLines=new Array();this.totalSelections=0;this.quantity=0;this.subTotal=0;this.total=0;this.onRequest};switch(g.servicePerID){case 3:case 4:case 7:case 8:for(j=0;j<o.selections.length;j++){var B=o.selections[j];var C="aci_"+B.ACI;if(B.availability==this.availability.onRequest)m=true;var D=g.get_paxQtyValByID(B.rateRowID,B.ACI);if(!z[C]){z[C]=new function(){this.price=B.rateAmount;this.rateRowID=B.rateRowID;this.paxQty=D};z[z.length]=C}else{var E=z[C];if(B.rateRowID!=E.rateRowID)E.rateRowID="";E.paxQty+=D}}z.sort();for(var j=0;j<z.length;j++){var r=z[j];var F=r.replace("aci_","");var E=z[r];var G=parseFloat(E.price)*this.currRate;var H=E.paxQty;var s=E.rateRowID;var D=parseInt(E.paxQty);A.summaryLines[A.summaryLines.length]=new function(){this.price=G;this.selectionCount=H;this.rateRowID=s;this.ACI=F};A.totalSelections+=H;A.subTotal+=(G*D);A.total=(A.subTotal*1)}break;default:for(j=0;j<o.selections.length;j++){var B=o.selections[j];var I="price_"+(B.rateAmount*this.currRate);if(B.availability==this.availability.onRequest)m=true;if(!z[I]){z[I]=new function(){this.rateRowID=B.rateRowID;this.count=1};z[z.length]=I}else{var E=z[I];if(B.rateRowID!=E.rateRowID)E.rateRowID="";E.count+=1}}z.sort(function(a,b){var c=parseFloat(a.replace("price_",""));var d=parseFloat(b.replace("price_",""));return c-d});for(var j=0;j<z.length;j++){var r=z[j];var G=parseFloat(r.replace("price_",""));var E=z[r];var H=E.count;var s=E.rateRowID;A.summaryLines[A.summaryLines.length]=new function(){this.price=G;this.selectionCount=H;this.rateRowID=s};A.totalSelections+=H;switch(g.servicePerID){case 1:case 3:case 6:A.subTotal=parseFloat(z[0].replace("price_",""));break;default:A.subTotal+=(G*H);break}A.total=(A.subTotal*h)}}A.quantity=h;A.onRequest=m;y[y.length]=A}return y};this.showSummary=function(f,g,h,k,l){var m=this.get_selectState();var n=0;var o=0;var p=0;var q=false;var r=document.getElementById(cb);r.createLine=function(){var a=r.insertRow(r.rows.length-1);a.height="20px";var b=a.insertCell(-1);var c=a.insertCell(-1);var d=a.insertCell(-1);var e=a.insertCell(-1);b.innerHTML="&nbsp;";c.innerHTML="&nbsp;";d.innerHTML="&nbsp;";e.innerHTML="&nbsp;";b.align="left";c.align="left";d.align="right";e.align="right";b.vAlign="top";c.vAlign="top";d.vAlign="top";e.vAlign="top";b.classname=bz;c.classname=bz;d.classname=bz;e.classname=bz;a.tdService=b;a.tdDate=c;a.tdStay=d;a.tdPrice=e;return a};while(r.rows.length>2){r.deleteRow(1)}if(this.services.length==0)return;var s=new Array();for(var i=0;i<this.services.length;i++){var t=this.services[i];var u=this.get_serviceSummary(m,t.supplierID,t,t.get_selectedQty());if(u){for(j=0;j<u.length;j++){var v=u[j];if(v){var w=new function(){this.service=t;this.summary=v};s[s.length]=w}}}}s.sort(function(a,b){return a.summary.earliestDate.getTime()-b.summary.earliestDate.getTime()});for(var i=0;i<s.length;i++){var t=s[i].service;var v=s[i].summary;if(v.onRequest)q=true;for(var j=0;j<v.summaryLines.length;j++){var x=r.createLine();if(j==0){var y="<span class=\""+bB+"\" style=\"font-weight: bold;\">"+this.supplierName+" - "+t.serviceName;if(t.timeSlotID!=null&&t.timeSlotName!="")y+=(" ("+t.timeSlotName+")");if(v.quantity>1){y+=" x"+v.quantity}y+="</span>";x.tdService.innerHTML=y;var z=null;switch(t.servicePerID){case 2:case 4:case 5:case 8:case 9:case 10:z=new Date(v.latestDate.getTime());z.setDate(z.getDate()+1);break;default:z=new Date(v.latestDate.getTime());break}var A="<span class=\""+bB+"\">"+this.date2SummaryStr(v.earliestDate);if(z!=null&&z.getTime()!=v.earliestDate.getTime()){A+=(" to "+this.date2SummaryStr(z))}A+="</span>";x.tdDate.innerHTML=A;x.tdDate.colSpan="3";x.deleteCell(3);x.deleteCell(2);x=r.createLine()}var B=(v.summaryLines[j].selectionCount==1)?t.strServicePer:t.strServicePerPlural;var C=(v.summaryLines[j].rateRowID=="")?cu:t.get_rateNameByRateRowID(v.summaryLines[j].rateRowID,v.summaryLines[j].ACI);x.tdService.innerHTML="<span class=\""+bB+"\">"+C+"</span>";x.tdStay.innerHTML="<span class=\""+bB+"\">"+v.summaryLines[j].selectionCount+" "+B+" @"+"</span>";x.tdPrice.innerHTML="<span class=\""+bB+"\">"+formatCurr(v.summaryLines[j].price,this.currencyCode,0)+"</span>"}if(v.summaryLines.length>0){n+=v.total;o+=v.summaryLines.length;p+=v.quantity;r.createLine()}}var D=document.getElementById(cc);D.innerHTML=formatCurr(n,this.currencyCode,0);var E=document.getElementById(cd);if(E){var F;if(!l)F=this.validateBooking();if(!F)F=new Array();if(!f)f=new Array();for(var G=0;G<F;G++){f[f.length]=F[G]}if(q){f[f.length]=this.strSomeServicesOnRequestMsg}if((f&&f.length>0)||k){if(!k){while(E.rows.length>1){E.deleteRow(E.rows.length-1)}}for(var i=0;i<f.length;i++){var H=E.insertRow(E.rows.length);H.valign="top";var I=H.insertCell(-1);I.innerHTML="<span class=\""+bB+"\">*&nbsp;&nbsp;</span>";var J=H.insertCell(-1);J.innerHTML="<span class=\""+bB+"\">"+f[i]+"</span>";J.className=this.summaryMsgClass}E.style.display=""}else{E.style.display="none"}}var K=document.getElementById(ca);if(K)K.style.display="";var L=document.getElementById(bZ);if(L&&K&&g){L.style.display="";centerElement(L,true);centerElement(K);K.style.display="none";$telerik.$("#"+ca).fadeIn("fast");var M=document.getElementById(cg);if(M)M.style.display=""}var N=document.getElementById(cf);if(N)N.style.display=(h||!g)?"":"none";var O=document.getElementById(bM);if(O){O.innerHTML=formatCurr(n,this.currencyCode,0)}var P=document.getElementById(ci);if(P){P.innerHTML="("+this.currencyCode+")"}var Q=document.getElementById(cj);if(Q){Q.innerHTML="("+this.currencyCode+")"}};this.closeSummary=function(){var a=document.getElementById(bZ);var b=document.getElementById(ca);if(a&&b){a.style.display="none";b.style.position="relative";b.style.top="0px";b.style.left="0px";var c=document.getElementById(cg);if(c)c.style.display="none";var d=document.getElementById(cf);if(d)d.style.display=""}return false};this.submitBooking=function(){var a=false;try{var b=this.validateBooking();if((b&&b.length>0)||(!b)){a=false;if(cl){this.showSummary(b,true,false,false,true)}else{document.location.href="#"+ce}}else if(b.success){a=true;if(ck){this.showSummary(b,true,true,false,true);a=false}}}catch(ex){a=false;alert("Error while submitting Booking: "+ex.message)}return a};this.centerLoadingPanel=function(a,e){var b=document.getElementById(bR);if(b){centerElement(b,true)}};this.currencyChanged=function(){var a=document.getElementById(ch);if(a){var b=a.value;if(b!=undefined&&b!=null&&b!=""){var c="";c+=("SupplierID="+this.supplierID);c+=("&CurrCode="+b);var d=new Evolution.BookEngineWebService();d.set_timeout(wsProxyTimeout);d.GetCurrRate(c,this.currRateSuccess,this.currRateFailed,b)}}};this.currRateSuccess=function(a,b,c){var d=document[R];if(isNaN(a)||parseFloat(a)<0){var e=document.getElementById(ch);if(e){for(var i=0;i<e.length;i++){if(e[i].value==d.currencyCode){e.selectedIndex=i;break}}}alert(cJ)}else{Z=b;d.currencyCode=b;ba=parseFloat(a);d.currRate=parseFloat(a);var f=d.get_divRates();for(var i=0;i<f.length;i++){var g=new Rate(f[i]);var h=d.get_selectState().find(d.supplierID,g.serviceID,g.timeSlotID,g.rateRowID,g.rateID,g.rateDate,null,null,g.ACI);var j=(h.length&&h.length>0);if(j!=null&&g.rateRowID!=null&&g.rateID!=null&&g.rateDate!=null&&g.rateAmount!=null&&g.rateAdult!=null&&g.rateChild!=null&&g.rateInfant!=null&&g.ACI!=null){var k=d.get_serviceByID(g.serviceID,g.timeSlotID);k.set_RateCellContent(g.tdRate,g.availability,str2Date(g.rateDate),g.rateID,g.rateAmount,j,d.ID+".rateClick(this);",g.rateAdult,g.rateChild,g.rateInfant,g.allotName,g.allotCount)}}d.showSummary()}};this.currRateFailed=function(a,b,c){if(a.get_timedOut()){alert("The connection to the server timed out.")}else{alert(a.get_exceptionType()+": \""+a.get_message()+"\"")}}}function BookEngineService(r,s,t,u,v,w,x,y,z,A,B,C,D,E,F){this.engineObjectID=r;this.controlID=s;this.supplierID=t;this.serviceID=u;this.timeSlotID=w;this.timeSlotName=x;this.serviceName=v;this.servicePerID=y;this.strServicePer=E;this.strServicePerPlural=F;this.refresh=function(){var a=document.getElementById(z);if(a){a.click()}};this.get_tblService=function(){return document.getElementById(A)};this.get_selectedQty=function(){var a=document.getElementById(B);if(a)return parseInt(a.value);return 0};this.set_selectedQty=function(a){var b=$find(B);if(b){b.set_value(a)}};this.get_ratesRows=function(){var a=document.getElementById(D);if(a)return a.rows;return null};this.get_visibleRateRowIDs=function(){var a=document.getElementById(D);var b=new Array();if(a){for(var i=0;i<a.rows.length;i++){var c=a.rows[i];var d=this.get_rateRowIDByRow(c);if(d)b[b.length]=d}}return b};this.get_rateRowIDByRow=function(a){return a.getAttribute("RateRowID")};this.get_ACIByRow=function(a){return a.getAttribute("ACI")};this.get_rateRowByRateRowID=function(a,b){var c=document.getElementById(D);if(c){for(var i=0;i<c.rows.length;i++){var d=c.rows[i];if(this.get_rateRowIDByRow(d)==a&&(b==null||b==undefined||this.get_ACIByRow(d)==b)){return d}}}return null};this.get_rateDescCellByRateRowID=function(a,b){var c=this.get_rateRowByRateRowID(a,b);if(c&&c.cells.length>0)return c.cells[0]};this.get_paxQtyByRow=function(a){var b=(this.controlID+"_"+"txtPaxQty_"+this.get_rateRowIDByRow(a)+"_"+this.get_ACIByRow(a)).replace(/-/g,"_");if(b){return $find(b)}};this.get_paxQtyByID=function(a,b){var c=this.get_rateRowByRateRowID(a,b);if(c){return this.get_paxQtyByRow(c)}};this.get_paxQtyValByID=function(a,b){var c=this.get_paxQtyByID(a,b);if(c){return parseInt(c.get_value())}return 0};this.set_paxQtyValByID=function(a,b,c){var d=this.get_paxQtyByID(a,b);if(d){d.set_value(c)}};this.get_rateNameByRateRowID=function(a,b){var c=this.get_rateRowByRateRowID(a,b);if(c){return c.getAttribute("RateName")}return""};this.set_rateNameByRateRowID=function(a,b,c,d){var e=document[r];var f=this.get_rateRowByRateRowID(a,b);if(f){switch(b){case"A":if(this.get_rateRowByRateRowID(a,"C")!=null||this.get_rateRowByRateRowID(a,"I")!=null){if(c!="")c+=" ";c+=document[this.engineObjectID].strAdult}break;case"C":if(c!="")c+=" ";c+=document[this.engineObjectID].strChild;break;case"I":if(c!="")c+=" ";c+=document[this.engineObjectID].strInfant;break}f.setAttribute("RateName",c);var g=findFirstElementByClassName(e.rateNameCellClass,f);if(g&&g.innerHTML){g.innerHTML=c}if(d!=undefined)f.setAttribute("AllotName",d)}};this.get_conditionIDByRateRowID=function(a,b){var c=this.get_rateRowByRateRowID(a,b);if(c)return c.getAttribute("CondID")};this.get_conditionByRateRowID=function(a,b){var c=document[r];var d=this.get_rateRowByRateRowID(a,b);if(d&&d.getAttribute("CondName")){var e="";var f="";var g=-1;var h=-1;var j=-1;var k=-1;var l="";var m;e=d.getAttribute("RateName");f=d.getAttribute("CondName");g=parseInt(d.getAttribute("MinStay"));h=parseInt(d.getAttribute("MaxStay"));j=parseInt(d.getAttribute("MinPax"));k=parseInt(d.getAttribute("MaxPax"));var n=new Array();if(g>1){var o=c.strRateCondMinStay;o=o.replace("{SUPPLIERNAME}",c.supplierName);o=o.replace("{SERVICENAME}",this.serviceName);o=o.replace("{MINSTAY}",g.toString());o=o.replace("{SERVICEPERPLURAL}",this.strServicePerPlural);o=o.replace("{RATENAME}",e);n[n.length]=o}if(h>0){var o=c.strRateCondMaxStay;o=o.replace("{SUPPLIERNAME}",c.supplierName);o=o.replace("{SERVICENAME}",this.serviceName);o=o.replace("{MAXSTAY}",h.toString());o=o.replace("{SERVICEPERPLURAL}",this.strServicePerPlural);o=o.replace("{RATENAME}",e);n[n.length]=o}if(j>1){var o=c.strRateCondMinPax;o=o.replace("{SUPPLIERNAME}",c.supplierName);o=o.replace("{SERVICENAME}",this.serviceName);o=o.replace("{MINPERSONS}",j.toString());n[n.length]=o}if(k>0){var o=c.strRateCondMaxPax;o=o.replace("{SUPPLIERNAME}",c.supplierName);o=o.replace("{SERVICENAME}",this.serviceName);o=o.replace("{MAXPERSONS}",k.toString());n[n.length]=o}for(var i=0;i<n.length;i++){if(i==0){l="<ul>"}l+=("<li>"+n[i]+"</li>");if(i==n.length-1){l+="</ul>"}}var p=new function(){this.rateRowID=a;this.rateName=e;this.conditionName=f;this.minStay=g;this.maxStay=h;this.minPax=j;this.maxPax=k;this.text=l};return p}return null};this.get_hasSelections=function(){var a=document[r];var b=a.get_selectState();var c=b.find(this.supplierID,this.serviceID,this.timeSlotID);return(c.length>0)};this.buildRateCell=function(a,b,c,d,e,f){var g=document[this.engineObjectID];var h=this.get_rateRowIDByRow(a);var i=this.get_ACIByRow(a);var j;if(f){j=a.cells[b]}else{j=a.insertCell(b)}if(j){j.id=(this.controlID+"_"+h+"_"+c+"_"+i).replace("-","_");j.innerHTML="&nbsp;";j.className=g.rateEmptyClass;if(e!="")j.onmouseover=function(){setTimeout(d+"(document.getElementById('"+j.id+"'));",0)};if(e!="")j.onmouseleave=function(){setTimeout(e+"(document.getElementById('"+j.id+"'));",0)};j.setAttribute("RateDate",c);j.setAttribute("Avail",g.availability.unknown);return j}};this.set_RateCellContent=function(a,b,c,d,e,f,g,h,i,j,k,l,m){if(!a)return;var n=document[this.engineObjectID];switch(b){case n.availability.available:case n.availability.onRequest:var o=n.strRateCellContentHTMLTemplate;o=o.replace(/{NAME}/g,n.uniqueID+"$divRate");o=o.replace("{RATEID}",d);o=o.replace("{RATE}",formatNumber(e,2,".",""));o=o.replace("{RATEDISP}",formatCurr((e*n.currRate),null,0));o=o.replace("{SELECTED}",f?"1":"0");o=o.replace("{ONCLICK}",g);o=o.replace("{CLASS}",f?n.rateTickedClass:n.rateUntickedClass);o=o.replace("{ALLOTCOUNT}",l);if(isNaN(h))o=o.replace("{RATEA}","");else o=o.replace("{RATEA}",formatNumber(h,2,".",""));if(isNaN(i))o=o.replace("{RATEC}","");else o=o.replace("{RATEC}",formatNumber(i,2,".",""));if(isNaN(j))o=o.replace("{RATEI}","");else o=o.replace("{RATEI}",formatNumber(j,2,".",""));break;default:o="X";break}a.innerHTML=o;var p="";if(n.showAvailTip){var q=c.getDate()+" "+n.monthNames[c.getMonth()]+" "+c.getFullYear();if(k==""){p=n.strAvailability+" ["+q+"]"}else{p="\""+k+"\" "+n.strAvailability+" ["+q+"]"}p+=": "+l.toString()}a.setAttribute("title",p)};this.set_rateStyle=function(a,b,c){var d=document[this.engineObjectID];if(a){if(b){a.className=d.rateSelectedClass}else{var d=document[r];switch(parseInt(c)){case d.availability.unavailable:a.className=d.rateNotAvailClass;break;case d.availability.available:a.className=d.rateAvailClass;break;case d.availability.onRequest:a.className=d.rateRequestClass;break;default:a.className=d.rateEmptyClass;break}}a.setAttribute("Avail",c)}};this.removeEmptyRateRows=function(){var a=document[r];var b=document.getElementById(D);var c=0;if(b){var d=0;c=b.rows.length;while(d<b.rows.length){var e=b.rows[d];var f=false;var g=1;while(g<e.cells.length&&f==false){var h=e.cells[g];var i=h.getAttribute("Avail");if(i==a.availability.onRequest||i==a.availability.available){f=true}g++}if(!f)b.deleteRow(d);else d++}return d}return 0};this.removeSelections=function(){var a=document[r];var b=a.get_serviceByID(u,w);var c=a.get_divRates();for(var i=0;i<c.length;i++){var d=new Rate(c[i]);if(d.ticked&&d.supplierID==b.supplierID&&d.serviceID==b.serviceID){a.rateClick(c[i],true,true)}}var e=a.get_selectState();e.remove(b.supplierID,b.serviceID,b.timeSlotID);a.set_selectState(e)};this.qtyChanging=function(a,e){var b=document[r];var c=b.get_serviceByID(u,w);var d=e.get_oldValue();var f=e.get_newValue();if(d>0&&f==0&&c.get_hasSelections()){var g=confirm(b.strConfirmDelSelections);if(g){c.removeSelections()}else{e.set_cancel(true);return}}else if(d<f&&f>1){if(f<a.get_minValue()||f>a.get_maxValue()){e.set_cancel(true)}else{}}};this.qtyChanged=function(a,e){var b=document[r];var c=e.get_oldValue();var d=e.get_newValue();if(!(c==0&&d==1)&&!(c==1&&d==0)){b.refreshServiceRates(u,w)}else{b.showSummary()}};this.tsClicked=function(a){this.oldTimeSlotID=a.value};this.tsChanged=function(a){var b=document[r];answer=true;if(this.get_hasSelections()){answer=confirm(b.strConfirmDelSelections)}if(answer){this.removeSelections();b.refreshServiceRates(u,w,true)}else{for(var i=0;i<a.length;i++){if(a[i].value==this.oldTimeSlotID){a.selectedIndex=i;break}}}};this.ACIPaxQtyChanging=function(a,e){var b=document[r];var c=b.get_serviceByID(u,w);var d=e.get_oldValue();var f=e.get_newValue();var g=b.get_selectState();var h=a._textBoxElement.getAttribute("RateRowID");var j=a._textBoxElement.getAttribute("ACI");var k=g.find(c.supplierID,c.serviceID,c.timeSlotID,h,undefined,undefined,undefined,undefined,j);if(d>0&&f==0&&k.length>0){var l=confirm(b.strConfirmDelSelections);if(l){var m=b.get_divRates();for(var i=0;i<m.length;i++){var n=new Rate(m[i]);if(n.ticked&&n.supplierID==c.supplierID&&n.serviceID==c.serviceID&&n.rateRowID==h&&n.ACI==j){b.rateClick(m[i],true,true)}}var g=b.get_selectState();g.remove(c.supplierID,c.serviceID,c.timeSlotID,h,undefined,undefined,undefined,undefined,j);b.set_selectState(g)}else{e.set_cancel(true);return}}else if(d<f&&f>1){if(f<a.get_minValue()||f>a.get_maxValue()){e.set_cancel(true)}else{}}};this.ACIPaxQtyChanged=function(a,e){var b=document[r];b.showSummary()}}function becoAjaxLoad(a,e){becoHideShowFunctions(false)}function becoToggleConfigMore(a,b,c,d,e){try{var f=document.getElementById(a);var g=document.getElementById(b);var h=document.getElementById(c);if(g&&f&&h){g.style.display=(g.style.display.toLowerCase()=="none")?"":"none";f.value=(g.style.display.toLowerCase()=="none")?"0":"1";h.src=(g.style.display.toLowerCase()=="none")?d:e}}finally{return false}}function becoValidateEmail(a){if(a&&validateEmailAddress(a.value,true))return;if(a)a.focus()}function becoOverrideChanged(a,b,d){var e=document.getElementById(d);var o=parseFloat(a.value);var c=parseFloat(b);if(e&&a.value==""){e.click()}else if(o.toString()==NaN.toString()){a.focus()}else if(e&&o!=c){e.click()}}function becoRedir(a,b,c){var d=null;try{if(c){d=document.getElementById(c);if(d){centerElement(d,true);d.style.display=""}}}catch(ex){}finally{if(a!=null&&a!=undefined&&a!="")alert(a);window.location.href=b;if(d){d.style.display="none"}}}function becoShowLogin(a,b,c){if(b&&c){var d=document.getElementById(b);if(d){centerElement(d,true);d.style.display=""}}if(a){var e=document.getElementById(a);if(e){if(c){centerElement(e);try{$telerik.$("#"+a).fadeIn("fast")}finally{e.style.display=""}}else{e.style.display=""}}}}function becoHideShowFunctions(a){if(beco_hideOnAjaxIDs&&beco_hideOnAjaxIDs.length!=undefined&&beco_hideOnAjaxIDs.length>0){for(var i=0;i<beco_hideOnAjaxIDs.length;i++){becoHideShowFunction(beco_hideOnAjaxIDs[i],a)}}}function becoHideShowFunction(a,b){try{if(a!=null&&a!=undefined){var c=document.getElementById(a);if(c){c.style.display=b?"":"none"}}}catch(ex){}}function becoPayNowClicked(a,b){becoHideShowFunctions(false);if(a!=null&&a!=undefined){var c=document.getElementById(a);if(c){if(!c.checked){alert(b);becoHideShowFunctions(true);return false}else{return true}}}return false}function becoCCValidated(a,b){if(!b.success){becoHideShowFunctions(true)}return b.success}function becoConfirmAction(a){var b=window[a];if(b)b.show()}function becoActionConfirmed(){becoHideShowFunctions()}function becoClearBedding(a){var b=document.getElementsByName(a);if(b){for(var i=0;i<b.length;i++){if(b[i].checked){b[i].checked=false;return}}}}function BookConfirm(h,i,j,k,l,m,n,o){this.show=function(){var a=$find(h);if(a)a.show()};this.wndShow=function(a,b){var c=document.getElementById(i);if(c){c.value=""}a.argument=o};this.wndClose=function(a,b){var c=document.getElementById(i);var d=document.getElementById(j);var e=null;var f=null;if(k!=null&&k!="")f=eval(k);if(l!=null&&l!="")e=eval(l);if(c&&d){var g=b.get_argument();if(g!=null){if(f!=null)f(this,g);if(m){c.value=g;d.click()}}else{if(e!=null)e(this,g);if(n){c.value="";d.click()}}}}}var niftyOk=(document.getElementById&&document.createElement&&Array.prototype.push);var niftyCss=false;String.prototype.find=function(a){return(this.indexOf(a)>=0?true:false)};var oldonload=window.onload;if(typeof(NiftyLoad)!='function')NiftyLoad=function(){};if(typeof(oldonload)=='function')window.onload=function(){oldonload();AddCss();NiftyLoad()};else window.onload=function(){AddCss();NiftyLoad()};function AddCss(){}function Nifty(a,b){if(niftyOk==false)return;if(niftyCss==false)AddCss();var i,v=a.split(","),h=0;if(b==null)b="";if(b.find("fixed-height"))h=getElementsBySelector(v[0])[0].offsetHeight;for(i=0;i<v.length;i++)Rounded(v[i],b);if(b.find("height"))SameHeight(a,h)}function Rounded(a,b){var i,top="",bottom="",v=new Array();if(b!=""){b=b.replace("left","tl bl");b=b.replace("right","tr br");b=b.replace("top","tr tl");b=b.replace("bottom","br bl");b=b.replace("transparent","alias");if(b.find("tl")){top="both";if(!b.find("tr"))top="left"}else if(b.find("tr"))top="right";if(b.find("bl")){bottom="both";if(!b.find("br"))bottom="left"}else if(b.find("br"))bottom="right"}if(top==""&&bottom==""&&!b.find("none")){top="both";bottom="both"}v=getElementsBySelector(a);for(i=0;i<v.length;i++){FixIE(v[i]);if(top!="")AddTop(v[i],top,b);if(bottom!="")AddBottom(v[i],bottom,b)}}function AddTop(a,b,c){var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;d.style.marginLeft="-"+getPadding(a,"Left")+"px";d.style.marginRight="-"+getPadding(a,"Right")+"px";if(c.find("alias")||(color=getBk(a))=="transparent"){color="transparent";bk="transparent";border=getParentBk(a);btype="t"}else{bk=getParentBk(a);border=Mix(color,bk)}d.style.background=bk;d.className="niftycorners";p=getPadding(a,"Top");if(c.find("small")){d.style.marginBottom=(p-2)+"px";btype+="s";lim=2}else if(c.find("big")){d.style.marginBottom=(p-10)+"px";btype+="b";lim=8}else d.style.marginBottom=(p-5)+"px";for(i=1;i<=lim;i++)d.appendChild(CreateStrip(i,b,color,border,btype));a.style.paddingTop="0";a.insertBefore(d,a.firstChild)}function AddBottom(a,b,c){var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;d.style.marginLeft="-"+getPadding(a,"Left")+"px";d.style.marginRight="-"+getPadding(a,"Right")+"px";if(c.find("alias")||(color=getBk(a))=="transparent"){color="transparent";bk="transparent";border=getParentBk(a);btype="t"}else{bk=getParentBk(a);border=Mix(color,bk)}d.style.background=bk;d.className="niftycorners";p=getPadding(a,"Bottom");if(c.find("small")){d.style.marginTop=(p-2)+"px";btype+="s";lim=2}else if(c.find("big")){d.style.marginTop=(p-10)+"px";btype+="b";lim=8}else d.style.marginTop=(p-5)+"px";for(i=lim;i>0;i--)d.appendChild(CreateStrip(i,b,color,border,btype));a.style.paddingBottom=0;a.appendChild(d)}function CreateStrip(a,b,c,d,e){var x=CreateEl("b");x.className=e+a;x.style.backgroundColor=c;x.style.borderColor=d;if(b=="left"){x.style.borderRightWidth="0";x.style.marginRight="0"}else if(b=="right"){x.style.borderLeftWidth="0";x.style.marginLeft="0"}return(x)}function CreateEl(x){return(document.createElement(x))}function FixIE(a){if(a.currentStyle!=null&&a.currentStyle.hasLayout!=null&&a.currentStyle.hasLayout==false)a.style.display="inline-block"}function SameHeight(a,b){var i,v=a.split(","),t,j,els=[],gap;for(i=0;i<v.length;i++){t=getElementsBySelector(v[i]);els=els.concat(t)}for(i=0;i<els.length;i++){if(els[i].offsetHeight>b)b=els[i].offsetHeight;els[i].style.height="auto"}for(i=0;i<els.length;i++){gap=b-els[i].offsetHeight;if(gap>0){t=CreateEl("b");t.className="niftyfill";t.style.height=gap+"px";nc=els[i].lastChild;if(nc.className=="niftycorners")els[i].insertBefore(t,nc);else els[i].appendChild(t)}}}function getElementsBySelector(b){var i,j,selid="",selclass="",tag=b,tag2="",v2,k,f,a,s=[],objlist=[],c;if(b.find("#")){if(b.find(" ")){s=b.split(" ");var d=s[0].split("#");if(d.length==1)return(objlist);f=document.getElementById(d[1]);if(f){v=f.getElementsByTagName(s[1]);for(i=0;i<v.length;i++)objlist.push(v[i])}return(objlist)}else{s=b.split("#");tag=s[0];selid=s[1];if(selid!=""){f=document.getElementById(selid);if(f)objlist.push(f);return(objlist)}}}if(b.find(".")){s=b.split(".");tag=s[0];selclass=s[1];if(selclass.find(" ")){s=selclass.split(" ");selclass=s[0];tag2=s[1]}}var v=document.getElementsByTagName(tag);if(selclass==""){for(i=0;i<v.length;i++)objlist.push(v[i]);return(objlist)}for(i=0;i<v.length;i++){c=v[i].className.split(" ");for(j=0;j<c.length;j++){if(c[j]==selclass){if(tag2=="")objlist.push(v[i]);else{v2=v[i].getElementsByTagName(tag2);for(k=0;k<v2.length;k++)objlist.push(v2[k])}}}}return(objlist)}function getParentBk(x){var a=x.parentNode,c;while(a.tagName.toUpperCase()!="HTML"&&(c=getBk(a))=="transparent")a=a.parentNode;if(c=="transparent")c="#FFFFFF";return(c)}function getBk(x){var c=getStyleProp(x,"backgroundColor");if(c==null||c=="transparent"||c.find("rgba(0, 0, 0, 0)"))return("transparent");if(c.find("rgb"))c=rgb2hex(c);return(c)}function getPadding(x,a){var p=getStyleProp(x,"padding"+a);if(p==null||!p.find("px"))return(0);return(parseInt(p))}function getStyleProp(x,a){if(x.currentStyle)return(x.currentStyle[a]);if(document.defaultView.getComputedStyle)return(document.defaultView.getComputedStyle(x,'')[a]);return(null)}function rgb2hex(a){var b="",v,h,i;var c=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;var h=c.exec(a);for(i=1;i<4;i++){v=parseInt(h[i]).toString(16);if(v.length==1)b+="0"+v;else b+=v}return("#"+b)}function Mix(a,b){var i,step1,step2,x,y,r=new Array(3);if(a.length==4)step1=1;else step1=2;if(b.length==4)step2=1;else step2=2;for(i=0;i<3;i++){x=parseInt(a.substr(1+step1*i,step1),16);if(step1==1)x=16*x+x;y=parseInt(b.substr(1+step2*i,step2),16);if(step2==1)y=16*y+y;r[i]=Math.floor((x*50+y*50)/100);r[i]=r[i].toString(16);if(r[i].length==1)r[i]="0"+r[i]}return("#"+r[0]+r[1]+r[2])}try{if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded()}catch(ex){}