if((!this["console"])||(!console["firebug"])){
this.console={};
}
$A(["assert","count","debug","dir","dirxml","error","group","groupEnd","info","log","profile","profileEnd","time","timeEnd","trace","warn"]).each(function(_1){
if(!console[_1]){
console[_1]=function(){
};
}
});
var ct={console:console,cookies:{create:function(_2,_3,_4){
var _5;
if(_4){
var _6=new Date();
_6.setTime(_6.getTime()+(_4*24*60*60*1000));
_5="; expires="+_6.toGMTString();
}else{
_5="";
}
document.cookie=_2+"="+_3+_5+"; path=/";
},read:function(_7){
var _8=_7+"=";
var ca=document.cookie.split(";");
for(var i=0;i<ca.length;i++){
var c=ca[i];
while(c.charAt(0)==" "){
c=c.substring(1,c.length);
}
if(c.indexOf(_8)===0){
return c.substring(_8.length,c.length);
}
}
return null;
},erase:function(_c){
ct.cookies.create(_c,"",-1);
}},dates:{isValidDateString:function(_d){
var _e=/[0-9]+\/[0-9]+\/([0-9][0-9][0-9][0-9])+/;
return (_e.test(_d));
},fromString:function(_f){
var _10=_f;
var day=_10.substring(0,_10.indexOf("/"));
var _12=_10.substring(_10.indexOf("/")+1,_10.indexOf("/",_10.indexOf("/")+1));
var _13=_10.substring(_10.indexOf("/",_10.indexOf("/")+1)+1,_10.length);
if(_13.length==2){
_13="20"+_13;
}
var _14=new Date();
_14.setFullYear(parseInt(_13,10),parseInt(_12,10)-1,parseInt(day,10));
_14.setHours(0,0,0,0);
return _14;
},toString:function(_15,_16){
if(!_16){
return _15.getDate()+"/"+(_15.getMonth()+1)+"/"+_15.getFullYear();
}else{
return _15.getFullYear()+""+((_15.getMonth()+1<10)?"0"+(_15.getMonth()+1):(_15.getMonth()+1))+((_15.getDate()<10)?("0"+_15.getDate()):_15.getDate());
}
},isPast:function(_17,_18){
if(!_18){
return (ct.dates.compare(_17,new Date())===1);
}
return (ct.dates.compare(_17,_18)===1);
},compare:function(_19,_1a){
if(_19.getYear()<_1a.getYear()){
return 1;
}else{
if((_19.getYear()==_1a.getYear())&&(_19.getMonth()<_1a.getMonth())){
return 1;
}else{
if((_19.getYear()==_1a.getYear())&&(_19.getMonth()==_1a.getMonth())&&(_19.getDate()<_1a.getDate())){
return 1;
}else{
if(_19.getDate()==_1a.getDate()&&_19.getMonth()==_1a.getMonth()&&_19.getYear()==_1a.getYear()){
return 0;
}else{
return -1;
}
}
}
}
},monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],getTimestamp:function(){
var _1b=new Date();
var ts=""+_1b.getHours()+_1b.getMinutes()+_1b.getSeconds()+_1b.getMilliseconds();
return ts;
},setMonth:function(_1d,_1e){
var _1f=_1d.getMonth();
_1d.setMonth(_1e);
_1e%=12;
var _20=_1d.getMonth();
if(_20===_1e){
return _1d;
}else{
_1d.setDate(0);
return _1d;
}
},fromApacheDirective:function(_21){
var _22=_21.split(" ")[1].split("-");
var _23=$A([]);
$A(ct.dates.monthNames).each(function(_24){
_24=_24.substr(0,3);
_23.push(_24);
});
return new Date(_22[2],$A(_23).indexOf(_22[1]),_22[0]);
}},isDebug:(window.location.hash.toLowerCase()==="#debug"),validator:{_attachedFields:$A([]),attachValidation:function(_25,_26,_27){
ct.validator._attachedFields.push({field:$(_25),errorMessage:_26,condition:_27});
},_initializeForms:function(){
var _28=$A(document.getElementsByTagName("form"));
_28.each(function(_29){
$(_29).observe("submit",ct.validator._validateForm);
_29.ct_validationFailed=true;
});
ct.validator.parseDomTree();
},classNames:{required:"required",number:"number",password:"password",email:"email",creditCardNumber:"creditCardNumber",cvvCodeCredit:"cvvCodeCredit",cvvCodeDebit:"cvvCodeDebit",calendarControl:"datePicker"},validationConditions:{requiredFieldCondition:function(_2a){
if(_2a.readAttribute("selfLabel")!==null){
return ($F(_2a)!==_2a.labelText);
}else{
return ($F(_2a).length!==0);
}
},spaceCondition:function(_2b){
var _2c=/^\s/;
var _2d=_2c.test($F(_2b));
return _2d?false:true;
},validateNumber:function(_2e){
if($F(_2e)!==""){
if($(_2e).readAttribute("selfLabel")===$F(_2e)){
return true;
}
return ($F(_2e)>0);
}else{
return true;
}
},emailCondition:function(_2f){
if($F(_2f)!==""){
if($F(_2f)===""){
return false;
}
var _30=_2f.value;
var _31=_30.indexOf("@");
var _32=_30.lastIndexOf(".");
var _33=_30.indexOf(" ");
if(_31<0||_32<0||_33!=-1){
return false;
}
var _34=/^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,4}$/;
var _35=_34.test(_30);
return _35?true:false;
}else{
return true;
}
},requiredDropdownCondition:function(_36){
return (_36.selectedIndex!==0);
},validCreditCardCondition:function(_37){
var _38=$F(_37),_39;
if(_38!==""){
var _3a=_38;
_3a=_38.replace(/-/g,"");
_3a=_38.replace(/ /g,"");
_38=_3a.valueOf();
if(_38===null||_38.length<13||_38.search(/[a-zA-Z]+/)!=-1){
return false;
}
var _3b=_38.split("");
_3b.reverse();
var _3c=0;
var tmp=0;
for(var i=0;i<_3b.length;i++){
if((i%2)>0){
tmp=_3b[i]*2;
tmp=(tmp<9?tmp:(tmp-9));
_3c+=tmp;
}else{
_3c+=Number(_3b[i]);
}
}
_39=((_3c%10)===0);
if(_39&&_37.readAttribute("cardtypefieldname")){
var _3f={1:{identifier:[4],length:[13,16]},2:{identifier:[51,52,53,54,55],length:[16]},3:{identifier:[34,37],length:[15]},4:{identifier:[300,301,302,303,304,305,36,38],length:[14]}};
var _40=ct.dom.getParentByTagName(_37,"form")[_37.readAttribute("cardtypefieldname")];
var _41;
$A(_40).each(function(_42){
if(_42.checked){
_41=_42;
}
});
var _43=_3f[_41.value];
if(_43.length.indexOf(_38.length)===-1){
_39=false;
}else{
var _44=false;
for(i=0;i<_43.identifier.length;i++){
if(_38.substr(0,(_43.identifier[i]+"").length)==_43.identifier[i]){
_44=true;
break;
}
}
_39=_44;
}
}
}else{
_39=true;
}
return _39;
},validateMobilePhoneNumberCondition:function(_45){
if($F(_45)!==""){
if(_45.readAttribute("selfLabel")===$F(_45)){
return true;
}else{
if(ct.stringFormatting.stripAlphaChars($F(_45)).length<10){
return false;
}else{
var _46=/[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9]/;
var _47=_46.test($F(_45));
return (_47)?true:false;
}
}
}else{
return true;
}
},validateLandLanePhoneNumberCondition:function(_48){
if($F(_48)!==""){
if(_48.readAttribute("selfLabel")===$F(_48)){
return true;
}else{
var _49=/[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9]/;
var _4a=_49.test($F(_48));
return (_4a)?true:false;
}
}else{
return true;
}
},validateCvvCodeForCreditCard:function(_4b,_4c){
var _4d;
$A(document.getElementsByName(_4c)).each(function(_4e){
if(_4e.checked){
_4d=$F(_4e);
}
});
if($F(_4b)===""){
return true;
}
var re=null;
if(_4d!=="0"){
if(_4d=="3"){
re=/^\d{4}$/;
}else{
re=/^\d{3}$/;
}
return re.test($F(_4b));
}
return true;
},validateCvvCodeForDebitCard:function(_50){
if($F(_50)===""){
return true;
}
re=/^\d{3}$/;
return re.test($F(_50));
},validateDate:function(_51){
if($F(_51)!==""){
if(_51.readAttribute("selfLabel")===$F(_51)){
return true;
}else{
return (ct.dates.isValidDateString($F(_51)));
}
}else{
return true;
}
},validateMinDate:function(_52,_53){
if($F(_52)===""||_52.readAttribute("selfLabel")===$F(_52)){
return true;
}else{
if(!_53){
_53=_52.readAttribute("mindate");
}
if(_53){
var _54=ct.dates.fromString(_53);
if(_52.readAttribute("offsetdays")){
_54.setDate(_54.getDate()+parseInt(_52.readAttribute("offsetdays"),10));
}
var _55=ct.dates.compare(ct.dates.fromString($F(_52)),_54);
return (_55===0)||(_55===-1);
}else{
return true;
}
}
},validateMaxDate:function(_56){
if($F(_56)===""||_56.readAttribute("selfLabel")===$F(_56)){
return true;
}else{
if(_56.readAttribute("maxdate")){
var _57=ct.dates.fromString(_56.readAttribute("maxdate"));
var _58=ct.dates.compare(ct.dates.fromString($F(_56)),_57);
return (_58===0)||(_58===1);
}else{
return true;
}
}
}},parseDomTree:function(_59){
_59=$(_59?_59:document.body);
if(document.location.protocol==="https:"){
$(document.body).select("a.forceHttp").each(function(_5a){
_5a.href=_5a.href.replace("https","http");
});
$(document.body).select("form.forceHttp").each(function(_5b){
_5b.action=_5b.action.replace("https","http");
});
}
if($("offers_1")){
var _5c=document.location.host.split(".");
if(_5c[1]==="cleartripforbusiness"){
$("offers_1").select("a").each(function(_5d){
_5d.href=_5d.href.replace(/.*\.cleartripforbusiness/,"http://www.cleartrip");
_5d.href=_5d.href+"?host="+document.location.host;
_5d.target="_blank";
});
}
}
var _5e=$A($(_59).getElementsByTagName("input"));
_5e.each(function(_5f){
var _60=ct.validator.attachValidation;
var _61=ct.validator.validationConditions;
var _62=ct.validator.classNames;
_5f=$(_5f);
if(((_5f.type.toLowerCase()==="text")||_5f.type.toLowerCase()==="password")&&_5f.hasClassName(_62.required)){
_60(_5f,_5f.title+" is a required field.",_61.requiredFieldCondition);
}
if(((_5f.type.toLowerCase()==="text")||_5f.type.toLowerCase()==="password")&&_5f.hasClassName(_62.required)){
_60(_5f,_5f.title+" cannot start with a space.",_61.spaceCondition);
}
if(((_5f.type.toLowerCase()==="text")||_5f.type.toLowerCase()==="password")&&_5f.hasClassName(_62.number)){
_60(_5f,_5f.title+" is not a valid number.",_61.validateNumber);
}
if(_5f.type.toLowerCase()==="password"&&_5f.hasClassName(_62.required)&&_5f.hasClassName(_62.password)){
_60(_5f,_5f.title+" should be at least 6 characters long. If you have forgotten your password you can follow the link below the field.",function(_63){
if($F(_63)===""){
return true;
}
return ($F(_63).length>=6);
});
}
if(_5f.hasClassName(_62.cvvCodeCredit)){
if(!_5f.readAttribute("cardtypefieldname")&&!$(_5f.readAttribute("cardtypefieldname"))){
throw new Error("cardtypefieldname attribute not specified for the cvv field. Could not attach validation.");
}else{
_5f.setAttribute("autocomplete","off");
_60(_5f,"The CVV code entered is not valid",function(_64){
return _61.validateCvvCodeForCreditCard(_64,_64.readAttribute("cardtypefieldname"));
});
}
}
if(_5f.type.toLowerCase()==="password"&&_5f.hasClassName(_62.cvvCodeDebit)){
_5f.setAttribute("autocomplete","off");
_60(_5f,"The CVV code entered is not valid",_61.validateCvvCodeForDebitCard);
}
if(_5f.type.toLowerCase()==="text"&&_5f.hasClassName(_62.email)){
_60(_5f,_5f.title+" should be a valid email address.",_61.emailCondition);
}
if(_5f.type.toLowerCase()==="text"&&_5f.hasClassName(_62.creditCardNumber)){
_5f.setAttribute("autocomplete","off");
_60(_5f,_5f.title+" is not valid.",_61.validCreditCardCondition);
}
if(_5f.type.toLowerCase()==="text"&&_5f.hasClassName(_62.calendarControl)){
_60(_5f,"Please enter a valid "+_5f.title.toLowerCase()+" (dd/mm/yyyy)",_61.validateDate);
if(_5f.readAttribute("mindate")){
_60(_5f,"Please choose "+_5f.title.toLowerCase()+" on or after "+_5f.readAttribute("mindate")+" (dd/mm/yyyy).",_61.validateMinDate);
}else{
if(_5f.readAttribute("mindatefieldid")){
var _65="Please choose a "+_5f.title.toLowerCase();
var _66=_5f.readAttribute("offsetDays");
if(_66){
if(_66==1){
_65+=" at least a day";
}else{
_65+=" at least "+_66+" days";
}
}
_65+=" after the "+$(_5f.readAttribute("mindatefieldid")).title.toLowerCase()+" (dd/mm/yyyy).";
_60(_5f,_65,function(_67){
return _61.validateMinDate(_67,$(_5f.readAttribute("mindatefieldid")).value);
});
}
}
if(_5f.readAttribute("maxdate")){
_60(_5f,"Please choose "+_5f.title.toLowerCase()+" on or before "+_5f.readAttribute("maxdate")+" (dd/mm/yyyy).",_61.validateMaxDate);
}
}
if((_5f.type.toLowerCase()==="file")&&_5f.hasClassName(_62.required)){
_60(_5f,_5f.title+" is a required field.",_61.requiredFieldCondition);
}
});
var _68=$A(_59.getElementsByTagName("select"));
_68.each(function(_69){
_69=$(_69);
if(_69.hasClassName(ct.validator.classNames.required)){
ct.validator.attachValidation(_69,_69.title+" is a required field.",ct.validator.validationConditions.requiredDropdownCondition);
}
});
var _6a=$A(_59.getElementsByTagName("textarea"));
_6a.each(function(_6b){
_6b=$(_6b);
if(_6b.hasClassName(ct.validator.classNames.required)){
ct.validator.attachValidation(_6b,_6b.title+" is a required field.",ct.validator.validationConditions.requiredFieldCondition);
}
if((_6b.type.toLowerCase()==="textarea")&&_6b.hasClassName(ct.validator.classNames.required)){
ct.validator.attachValidation(_6b,_6b.title+" cannot start with a space.",ct.validator.validationConditions.spaceCondition);
}
});
},_validateForm:function(_6c){
var _6d=[],val=ct.validator;
var _6f=$((this.nodeName.toLowerCase()==="form")?this:ct.dom.getParentByTagName(this,"form"));
$A(document.forms).each(function(_70){
Form.getElements(_70).each(ct.validator._hideErrorArrow);
});
_6f.ct_validationFailed=false;
var _71=_6f.getElements();
ct.validator.errors=null;
if($("autocompleteOptionsContainer")){
_6c.stop();
return;
}
_71.each(function(_72){
val._hideErrorArrow(_72);
val._attachedFields.each(function(_73){
if(_73.field===_72){
if(_73.field.disabled===true){
return;
}
if(!_73.condition(_73.field)){
_6d.push({field:_72,message:_73.errorMessage});
_6f.ct_validationFailed=true;
val._showErrorArrow(_72);
val.errors=_6d;
}
}
});
});
if(_6f.ct_validationFailed){
_6c.stop();
_6f.errors=_6d;
val._showFormErrors(_6f);
}else{
_6f.errors=null;
val._hideFormErrors(_6f);
}
},_showFormErrors:function(_74){
if(_74.readAttribute("errorblockid")&&$(_74.readAttribute("errorblockid"))){
var ol=$(_74.getAttribute("errorblockid")).getElementsByTagName("ol")[0];
while(ol.childNodes.length>0){
ol.removeChild(ol.childNodes[0]);
}
$A(_74.errors).each(function(_76){
ol.appendChild((new Element("li")).update(_76.message));
});
$(_74.readAttribute("errorblockid")).style.display="block";
}
},_hideFormErrors:function(_77){
if(_77.readAttribute("errorblockid")&&$(_77.readAttribute("errorblockid"))){
$(_77.readAttribute("errorblockid")).style.display="none";
}
},_showErrorArrow:function(_78){
if(!_78.previous()||!_78.previous().hasClassName("err_arrow")){
var _79=document.createElement("span");
$(_79).addClassName("err_arrow");
$(_79).innerHTML="&nbsp;";
_78.parentNode.insertBefore(_79,_78);
}
},_hideErrorArrow:function(_7a){
if(_7a.previous()&&_7a.previous().hasClassName("err_arrow")){
_7a.previous().remove();
}
}},selfLabels:{addSelfLabel:function(_7b,_7c){
_7b=$(_7b);
_7b.labelText=_7c;
_7b.writeAttribute("selfLabel",_7c);
_7b.observe("focus",function(){
if($F(this)===_7c){
this.value="";
$(this).removeClassName("selflabel");
}
});
_7b.observe("blur",function(){
if($F(this)===""){
this.value=_7c;
$(this).addClassName("selflabel");
}
});
setTimeout(function(){
if($F(_7b)===""){
if(document.activeElement){
if(document.activeElement!==_7b){
_7b.value=_7c;
$(_7b).addClassName("selflabel");
}
}else{
_7b.value=_7c;
$(_7b).addClassName("selflabel");
}
}
},1000);
},parseDomTree:function(_7d){
_7d=$(_7d?_7d:document.body);
_7d.select("input[selfLabel]","textarea[selfLabel]","input[selflabel]","textarea[selflabel]").each(function(_7e){
ct.selfLabels.addSelfLabel(_7e,_7e.getAttribute("selfLabel"));
});
}},bubbles:{addBehavior:function(_7f,_80,_81){
_81=_81?_81:{};
_7f=$(_7f);
_7f.href="javascript: void(0);";
var _82;
_7f.observe("click",function(_83){
var _84=false;
if($("ct_bubbleNode")){
if($("ct_bubbleNode").associatedLink==_7f){
_84=true;
}
ct.dom.removeIEIframeFix($("ct_bubbleNode"));
$("ct_bubbleNode").remove();
}
if(!_84){
var _85=new Element("a",{"class":"bubbleClose",href:"javascript: void(0);",title:"Close"});
_85.observe("click",function(){
ct.dom.removeIEIframeFix($("ct_bubbleNode"));
$(_82).remove();
});
_82=new Element("div",{"class":"bubble",id:"ct_bubbleNode"});
_82.associatedLink=_7f;
_82.appendChild(new Element("div",{"class":"bubbleShadow"}));
_82.appendChild(new Element("div",{"class":"bubbleArrow"}));
_82.appendChild(_85);
var _86=new Element("div",{"class":"bubbleContentFrame"});
_82.appendChild(_86);
_86.innerHTML=(new Template(_80)).evaluate(_81);
_82=$(_82);
var pos=_7f.cumulativeOffset();
var _88;
if(self.innerWidth){
_88=self.innerWidth;
}else{
if(document.documentElement&&document.documentElement.clientWidth){
_88=document.documentElement.clientWidth;
}else{
if(document.body){
_88=document.body.clientWidth;
}
}
}
if(parseInt(pos[0],10)>(_88/2)){
_82.addClassName("bubbleWrapperRight");
_82.removeClassName("bubbleWrapperLeft");
_82.setStyle({left:"auto",right:(_88-parseInt(pos[0],10)-5)+"px",top:(parseInt(pos[1],10)-20)+"px"});
document.body.appendChild(_82);
ct.dom.addIEIframeFix(_82,[0,-10,0,10]);
}else{
_82.addClassName("bubbleWrapperLeft");
_82.removeClassName("bubbleWrapperRight");
_82.setStyle({right:"auto",left:(parseInt(pos[0],10)+55)+"px",top:(parseInt(pos[1],10)-20)+"px"});
document.body.appendChild(_82);
ct.dom.addIEIframeFix(_82,[0,-10,0,0]);
}
_82.observe("click",function(_89){
if(_89.target.tagName.toLowerCase()!=="a"){
_89.stop();
}
});
}
_83.stop();
});
},parseDomTree:function(_8a){
_8a=$(_8a?_8a:document.body);
_8a.getElementsBySelector("a[bubbleBlock]","a[bubbleblock]").each(function(_8b){
if($(_8b.getAttribute("bubbleBlock"))){
var _8c=$(_8b.getAttribute("bubbleBlock"));
var _8d=_8c.innerHTML;
_8c.style.display="none";
ct.bubbles.addBehavior(_8b,_8d,eval(_8b.readAttribute("substitutions")?"({"+_8b.readAttribute("substitutions")+"})":{}));
}else{
ct.console.error("Tried initializing a bubble block for link, but either the bubbleBlock attribute isn't specified, or it doesn't point to a valid block in the DOM.",_8b);
}
});
}},dom:{getParentByTagName:function(_8e,_8f){
var _90=Element.ancestors(_8e);
for(var i=0;i<_90.length;i++){
if(_90[i].nodeName.toLowerCase()===_8f.toLowerCase()){
return _90[i];
}
}
return null;
},addIEIframeFix:function(_92,_93){
if(Prototype.Browser.IE&&!_92._fixedIframe){
var _94=document.createElement("iframe");
_93=_93||[0,0,0,0];
_92=$(_92);
_94.frameBorder=0;
_94.scrolling="no";
_94.src=window.location.protocol==="https:"?"/blank.html":"about:blank";
_94.style.position="absolute";
_94.style.width=_92.getWidth()+_93[1]+"px";
_94.style.height=_92.getHeight()+_93[2]+"px";
var _95=_92.cumulativeOffset();
_94.style.top=_95[1]+_93[0]+"px";
_94.style.left=_95[0]+_93[3]+"px";
_92._fixedIframe=_94;
document.body.appendChild(_94);
}
},removeIEIframeFix:function(_96){
if(_96._fixedIframe){
document.body.removeChild(_96._fixedIframe);
_96._fixedIframe=null;
}
}},forms:{rememberCurrentValues:function(_97){
$(_97).getElements().each(function(_98){
switch(_98.nodeName.toLowerCase()){
case "input":
switch(_98.type.toLowerCase()){
case "text":
_98.oldValue=$F(_98);
break;
case "checkbox":
case "radio":
_98.oldValue=_98.checked?"Y":"N";
break;
default:
break;
}
break;
case "textarea":
_98.oldValue=$F(_98);
break;
case "select":
_98.oldValue=_98.selectedIndex;
break;
}
});
},restoreOldValues:function(_99){
$(_99).getElements().each(function(_9a){
if(_9a.oldValue){
switch(_9a.nodeName.toLowerCase()){
case "input":
switch(_9a.type.toLowerCase()){
case "text":
_9a.value=_9a.oldValue;
break;
case "checkbox":
case "radio":
_9a.checked=(_9a.oldValue==="Y")?true:false;
break;
default:
break;
}
break;
case "textarea":
_9a.value=_9a.oldValue;
break;
case "select":
_9a.selectedIndex=_9a.oldValue;
break;
}
}
});
},populate:function(_9b,_9c){
var _9d=Form.getElements(_9b);
Object.keys(_9c).each(function(key){
_9d.each(function(_9f){
if(_9f.id===key&&_9c[key]){
if(_9f.nodeName.toLowerCase()==="input"){
switch(_9f.type.toLowerCase()){
case "text":
case "password":
case "hidden":
_9f.value=_9c[key];
break;
case "checkbox":
case "radio":
if(_9c[key].toString().toLowerCase()==="true"){
_9f.checked=true;
}else{
_9f.checked=false;
}
break;
}
}else{
if(_9f.nodeName.toLowerCase()==="select"){
for(var i=0;i<_9f.options.length;i++){
if(_9f.options[i].value.toLowerCase()===_9c[key].toString().toLowerCase()){
_9f.selectedIndex=i;
break;
}
}
}else{
if(_9f.nodeName.toLowerCase()==="textarea"){
_9f.value=_9c[key];
}
}
}
if($(_9f).hasClassName("selflabel")){
$(_9f).removeClassName("selflabel");
}
}
});
});
},addHiddenField:function(_a1,_a2,_a3){
if(_a1[_a2]){
_a1[_a2].value=_a3;
}else{
_a1.appendChild(new Element("input",{type:"hidden",value:_a3,name:_a2}));
}
}},domIsLoaded:false,stringFormatting:{stripAlphaChars:function(_a4){
var _a5=_a4+"";
return _a5.replace(/[^0-9]/g,"");
},formatForCurrency:function(_a6,_a7){
var _a8="",num,dec;
var _ab=ct.currentCurrency.symbol?ct.currentCurrency.symbol:"Rs.";
_a6/=ct.currentCurrency.rate?ct.currentCurrency.rate:1;
if(_a7){
num=parseFloat(_a6);
num=parseInt(_a6*100,10)/100+"";
dec=num.split(".").length>1?num.split(".")[1]:"";
num=num.split(".")[0];
while(dec.length<2){
dec+="0";
}
}else{
num=parseInt(Math.round(_a6),10)+"";
}
if(num.length>3){
_a8=num.substring(num.length-3,num.length);
num=num.substring(0,num.length-3);
while(num.length>2){
_a8=num.substring(num.length-2,num.length)+","+_a8;
num=num.substring(0,num.length-2);
}
num+=","+_a8;
}
if(_a7){
num+="."+dec;
}
return _ab+" "+num;
}},stickyBlocks:{_definedStickyBlocks:$A([]),makeBlockSticky:function(_ac){
ct.stickyBlocks._definedStickyBlocks.push(_ac);
ct.stickyBlocks.recalculateTop(_ac);
_ac.style.zIndex="2";
},recalculateTop:function(_ad){
_ad.startTop=$(_ad).cumulativeOffset().top;
},_calculateScrollTop:function(){
if(self.pageYOffset){
return self.pageYOffset;
}else{
if(document.documentElement&&document.documentElement.scrollTop){
return document.documentElement.scrollTop;
}else{
if(document.body){
return document.body.scrollTop;
}else{
return 0;
}
}
}
},ifBlockIsAtTheBottom:function(_ae){
var _af=ct.stickyBlocks._calculateScrollTop();
return _af+_ae.getDimensions().height+10>Element.cumulativeOffset($("Wrapper")).top+$("Wrapper").getDimensions().height;
},blockAtFooterHandler:function(_b0,_b1){
if(_b0.style.position!=="absolute"||_b1){
if(!Prototype.Browser.IE){
_b0.style.top=($("Wrapper").getDimensions().height-_b0.getDimensions().height-Element.cumulativeOffset($("Wrapper")).top)+"px";
}else{
_b0.style.top=($("Wrapper").getDimensions().height-_b0.getDimensions().height-Element.cumulativeOffset($("Wrapper")).top-25)+"px";
}
}
_b0.style.position="absolute";
},ifBlockIsAtTheTop:function(_b2){
var _b3=ct.stickyBlocks._calculateScrollTop();
return _b3+13<_b2.startTop;
},_previousBlockTop:0,parseDomTree:function(_b4){
_b4=$(_b4?_b4:document.body);
_b4=$(_b4?_b4:document.body);
var IE6=(navigator.userAgent.indexOf("MSIE 6")>=0)?true:false;
$A(_b4.select(".stickyBlock")).each(function(_b6){
ct.stickyBlocks.makeBlockSticky(_b6);
_b6.startTop=Element.cumulativeOffset(_b6).top;
_b6.windowResizeFix=document.viewport.getDimensions().height;
_b6.style.position="static";
_b6.observe("sticky:resize",function(){
if(ct.stickyBlocks.ifBlockIsAtTheBottom(this)){
ct.stickyBlocks.blockAtFooterHandler(this,true);
ct.stickyBlocks._previousBlockTop=(Element.cumulativeOffset(_b6).top);
}
});
Event.observe(window,"resize",function(){
if(_b6.windowResizeFix!==document.viewport.getDimensions().height){
_b6.windowResizeFix=document.viewport.getDimensions().height;
if(ct.stickyBlocks.ifBlockIsAtTheBottom(_b6)){
ct.stickyBlocks.blockAtFooterHandler(_b6,true);
ct.stickyBlocks._previousBlockTop=(Element.cumulativeOffset(_b6).top);
}
}
});
_b6.positionUpdate=function(){
stickyBlockWindowScrollHandler();
};
fixpageshow(_b6);
});
function fixpageshow(_b7){
if(ct.stickyBlocks.ifBlockIsAtTheBottom(_b7)){
ct.stickyBlocks.blockAtFooterHandler(_b7);
window.setTimeout(function(){
ct.stickyBlocks._previousBlockTop=_b7.cumulativeOffset().top;
},20);
}
}
function _blockHeightGreater(_b8){
var _b9=($("Wrapper").cumulativeOffset().top+$("Wrapper").getDimensions().height);
var _ba=(_b8.startTop+_b8.getDimensions().height);
return (_b9<=_ba+25);
}
function _ifBlockFitsInViewPort(_bb){
return _bb.getDimensions().height+10<document.viewport.getHeight();
}
function stickyBlockWindowScrollHandler(){
var _bc=ct.stickyBlocks._calculateScrollTop();
$A(ct.stickyBlocks._definedStickyBlocks).each(function(_bd){
if(ct.stickyBlocks.ifBlockIsAtTheTop(_bd)||_blockHeightGreater(_bd)){
_bd.style.position="static";
}else{
if(_ifBlockFitsInViewPort(_bd)){
if(ct.stickyBlocks.ifBlockIsAtTheBottom(_bd)){
ct.stickyBlocks.blockAtFooterHandler(_bd);
}else{
_bd.style.position="fixed";
_bd.style.top="10px";
if(IE6){
_bd.style.position="absolute";
_bd.style.top=(_bc-$("Wrapper").cumulativeOffset().top+10)+"px";
}
}
}else{
if(_bd.style.position==="static"){
}else{
if(ct.stickyBlocks._previousBlockTop>_bc){
ct.stickyBlocks._previousBlockTop=$("filter").cumulativeScrollOffset().top;
_bd.style.top="10px";
_bd.style.position="fixed";
if(IE6){
_bd.style.position="absolute";
_bd.style.top=(_bc-$("Wrapper").cumulativeOffset().top+10)+"px";
}
}else{
if(_bd.style.position!=="absolute"){
ct.stickyBlocks._previousBlockTop=(Element.cumulativeScrollOffset(_bd).top);
_bd.style.top=(Element.cumulativeScrollOffset(_bd).top-Element.cumulativeOffset($("Wrapper")).top)+"px";
}
_bd.style.position="absolute";
}
}
}
}
});
}
Event.stopObserving(window,"scroll",stickyBlockWindowScrollHandler);
Event.observe(window,"scroll",stickyBlockWindowScrollHandler);
}},helperFunctions:{showCVVHintCc:function(_be,_bf){
$(_bf).style.display="block";
switch(_be.toLowerCase()){
case "3":
$(_bf).innerHTML="<img src='/images/cvv_images/cc_amex.gif' alt='American Express Verification Code' />";
break;
default:
$(_bf).innerHTML="<img src='/images/cvv_images/cvv_help.gif' alt='Credit Card Verification Code' />";
break;
}
},showCVVHintDc:function(_c0,_c1){
$(_c1).innerHTML="<img src='/images/cvv_images/cc_visa.gif' alt='Visa Verification Code' />";
},toHomeForm:function(_c2,_c3){
ct.cookies.erase("tab");
ct.cookies.create("tab",_c2,365);
if(_c3){
window.location.href="http://"+location.host+"/index.shtml";
}
return false;
},addRooms:function(_c4,_c5,_c6){
var _c7=new Template("<tr class=\"rm_info\"><td></td><td class=\"rm_num\">Room #{num}:</td><td><select id=\"adults#{num}\" name=\"adults#{num}\" size=\"1\" onchange=\"alterChildren('#{num}')\"><option value=\"1\">1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option></select></td><td><select id=\"children#{num}\" name=\"children#{num}\" size=\"1\"><option value=\"0\">0</option><option value=\"1\">1</option><option value=\"2\">2</option><option value=\"3\">3</option></select></td></tr>");
var _c8=new Template("<tr class=\"rm_info\"><td colspan=\"2\"><table><tr><td colspan=\"2\" class=\"room_no\"><label class=\"required\">Room #{num}:</label></td></tr><tr><td><label for=\"adults1\">Adults <span class=\"weak\">(12+ yrs)</span></label><select id=\"adults#{num}\" name=\"adults#{num}\" size=\"1\" onchange=\"alterChildren('#{num}')\"><option value=\"1\">1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option></select></td><td><label for=\"children1\">Children <span class=\"weak\">(0-11 yrs)</span></label><select id=\"children#{num}\" name=\"children#{num}\" size=\"1\"><option value=\"0\">0</option><option value=\"1\">1</option><option value=\"2\">2</option><option value=\"3\">3</option></select></td></tr></table></td></tr>");
var num=parseInt($F(_c4),10);
var _ca=document.getElementById("dynamic_rooms");
var tr,td,_cd,_ce,_cf;
var _d0=document.getElementsByClassName("rm_info",_ca);
var _d1=_d0.length+1;
var _d2;
var _d3;
if(_c5=="include"){
_d3=_c8;
}else{
_d3=_c7;
}
if(num>_d1){
for(var g=_d1+1;g<=num;g++){
_d2=_d3.evaluate({num:g});
if(_c6){
var _d5="";
for(var i=0;i<=_c6;i++){
_d5+="<td></td>";
}
_d2=_d2.replace("<td></td>",_d5);
}
new Insertion.Bottom(_ca,_d2);
}
}else{
if(num<_d1){
for(var h=_d1;h>num;h--){
Element.remove(_d0[h-2]);
}
}
}
},alterChildren:function(num){
var _d9=$("children"+num);
var _da=_d9.getElementsByTagName("option");
var _db=parseInt($F("adults"+num),10);
var _dc=_da.length;
for(var q=0;q<_dc;q++){
if(parseInt(_da[q].value,10)+_db>4){
_d9.options[q]=null;
--_dc;
--q;
}
}
var _de;
if((q-1)<(_de=4-_db)){
for(q;q<=_de;q++){
_d9.options[q]=new Option(q,q);
}
}
},showModalDialog:function(_df,_e0,_e1,_e2){
var _e3;
var _e4=window.pageYOffset||document.documentElement.scrollTop||0;
if(document.all){
if(self.pageYOffset){
_e3=self.pageYOffset;
}else{
if(document.documentElement&&document.documentElement.scrollTop){
_e3=document.documentElement.scrollTop;
}else{
if(document.body){
_e3=document.body.scrollTop;
}
}
}
function prepareIE(_e5,_e6){
bod=window.top.document.getElementsByTagName("body")[0];
bod.style.height=_e5;
bod.style.overflow=_e6;
htm=window.top.document.getElementsByTagName("html")[0];
htm.style.height=_e5;
htm.style.overflow=_e6;
}
function toggleSelects(_e7){
selects=window.top.document.getElementsByTagName("select");
for(i=0;i<selects.length;i++){
selects[i].style.visibility=_e7;
}
}
prepareIE("100%","hidden");
window.scrollTo(0,0);
toggleSelects("hidden");
}
function resizeHandler(){
if(document.all){
try{
if(Prototype.Browser.IE){
$("TranslucentLayer").style.height=_e8+"px";
}else{
$("TranslucentLayer").style.height=(document.body.offsetHeight>_e8)?document.body.offsetHeight+"px":_e8+"px";
}
}
catch(e){
}
}
_e9.style.left=((document.body.offsetWidth-_e9.offsetWidth)/2)+"px";
}
Event.observe(window,"resize",resizeHandler);
function closePopup(){
if(document.all){
window.top.scrollTo(0,_e3);
prepareIE("auto","auto");
toggleSelects("visible");
}
Event.stopObserving(window,"resize",resizeHandler);
window.top.document.getElementById("TranslucentLayer").remove();
window.top.document.getElementById("ModalFrame").remove();
if(Prototype.Browser.IE){
window.scrollTo(0,_e4);
}
}
ct.helperFunctions.hideModalDialog=closePopup;
var _ea=new Element("div",{id:"TranslucentLayer"});
$(_ea).observe("click",closePopup);
var _e9=new Element("div",{id:"ModalFrame"});
var _eb=new Element("div",{"class":"topBorder"});
var _ec=new Element("a",{id:"close",title:"Close window"});
_eb.appendChild(_ec);
_e9.appendChild(_eb);
_e9.appendChild(new Element("iframe",{src:_df,frameborder:0,framespacing:0,width:"100%",height:"100%",scrolling:_e2?"no":"yes",name:"modal_window"}));
_e9.setStyle({width:(_e0||"700px"),height:(_e1||"70%")});
document.body.appendChild(_ea);
document.body.appendChild(_e9);
_ec.observe("click",function(){
window.top.ct.helperFunctions.hideModalDialog();
});
_ec.observe("mouseover",function(){
_ec.addClassName("over");
});
_ec.observe("mouseout",function(){
_ec.removeClassName("over");
});
_e9.style.left=((document.body.offsetWidth-_e9.offsetWidth)/2)+"px";
var _ed=_e9.getHeight();
var _e8=$(document).viewport.getHeight();
_e9.setStyle({top:(_e8-_ed)*100/(2*_e8)+"%"});
if(Prototype.Browser.IE){
_ea.style.height=_e8+"px";
}else{
_ea.style.height=(document.body.offsetHeight>_e8)?document.body.offsetHeight+"px":_e8+"px";
}
},openPopup:function(_ee){
var _ef=document.viewport.getDimensions();
_ee=_ee||{};
_ee.height=_ee.height||(_ef.height/2);
_ee.width=_ee.width||(_ef.width/2);
_ee.left=_ee.left||((_ef.width-_ee.width)/2);
_ee.top=_ee.top||((_ef.height-_ee.height)/2);
_ee.toolbar=_ee.toolbar?1:0;
_ee.location=_ee.location?1:0;
_ee.status=_ee.status?1:0;
_ee.menubar=_ee.menubar?1:0;
_ee.scrollbars=_ee.scrollbars?1:0;
_ee.resizable=_ee.resizable?1:0;
window.open(_ee.url||"about:blank","wnd"+Math.round(Math.random()*1000),"toolbar="+_ee.toolbar+",location="+_ee.location+",status="+_ee.status+",menubar="+_ee.menubar+",scrollbars="+_ee.scrollbars+",resizable="+_ee.resizable+",width="+_ee.width+",height="+_ee.height+",left="+_ee.left+",top="+_ee.top);
},prefetchResources:function(){
$$("link[rel=prefetch]").each(function(_f0){
new Ajax.Request(_f0.href,{method:"get"});
});
},showThawteLogo:function(_f1){
var _f2=new Element("iframe",{src:"/includes/thwarte-logo.html",frameBorder:0,width:"0",height:"0",scrolling:"no"});
function resizeIframe(){
var _f3=_f2.contentWindow.document||_f2.document;
_f2.style.width="100%";
_f2.style.height=_f3.body.scrollHeight+"px";
}
_f2.onload=resizeIframe;
_f2.onreadystatechange=function(){
if(_f2.readyState==="complete"){
resizeIframe();
}
};
_f1.appendChild(_f2);
},logToServer:function(app,tag,_f6){
try{
new Ajax.Request("/urltrack/"+app+"_"+tag,{parameters:_f6||{},method:"get"});
}
catch(e){
}
try{
pageTracker._trackEvent(app,tag,Hash.toQueryParams(_f6||{}));
}
catch(e){
}
},resetCurrency:function(_f7){
ct.currentCurrency={name:"Indian Rupees",code:"INR",rate:1,symbol:"Rs."};
if(_f7){
ct.cookies.erase("currency-pref");
}
}},genericBlocks:{consentBlock:function(_f8){
if($(_f8).hasClassName("required")){
ct.validator.attachValidation($("consent"),"Please go through the booking policies and terms that are linked from below. Then mark the checkbox if you agree, we know it&rsquo;s boring but it&rsquo;s important.",function(_f9){
return (_f9.checked);
});
}
},signupBlock:function(_fa){
ct.validator.attachValidation($("confirmUname"),"The email addresses you have entered do not match. Please re-check these fields.",function(){
if($F("confirmUname")===""||$F("newUname")===""){
return true;
}
return ($F("confirmUname")===$F("newUname"));
});
},paymentBlock:function(_fb){
if($("CcExpirationMonth")&&$("CcExpirationYear")){
ct.validator.attachValidation($("CcExpirationMonth"),"Please check the credit card expiration date. The date you've entered seems to be in the past.",function(){
var _fc=new Date();
var _fd=_fc.getMonth()+1;
var _fe=_fc.getFullYear();
if($F("CcExpirationMonth")<_fd&&$F("CcExpirationYear")<=_fe){
return false;
}else{
return true;
}
});
}
if($("DcExpirationMonth")&&$("DcExpirationYear")){
ct.validator.attachValidation($("DcExpirationMonth"),"Please check the debit card expiration date. The date you've entered seems to be in the past.",function(){
var _ff=new Date();
var _100=_ff.getMonth()+1;
var _101=_ff.getFullYear();
if($F("DcExpirationMonth")<_100&&$F("DcExpirationYear")<=_101){
return false;
}else{
return true;
}
});
}
$A(document.getElementsByName("card_type")).each(function(_102){
Event.observe(_102,"click",function(){
ct.helperFunctions.showCVVHintCc($F(_102),"cvvImageCc");
});
var _103=$("cc_disclaimer"),_104=$("dt_cc_disclaimer");
if($("vTabs").getElementsByTagName("a")[1]&&_103){
Event.observe(_102,"click",function(){
if($F(_102)==3){
$(_103,_104).invoke("setStyle",{display:"block"});
_103.innerHTML="We accept only American Express cards issued in India";
if($("billAdressHelpText")){
$("billAdressHelpText").innerHTML="<strong>Why do we ask?</strong> The billing address is used to prevent fraud by matching it to your account information. Please enter it <span style='background-color: #FFCC00;'>exactly as it appears on your Amex card statement</span> to ensure that the payment is not rejected.";
}
}else{
if($F(_102)==4){
$(_103,_104).invoke("setStyle",{display:"block"});
_103.innerHTML="We accept only Citibank Diners cards issued in India";
if($("billAdressHelpText")){
$("billAdressHelpText").innerHTML="<strong>Why do we ask?</strong> The billing address is used to prevent fraud by matching it to your account information -- enter this as close to the way it appears on your card statement.";
}
}else{
$(_103,_104).invoke("setStyle",{display:"none"});
if($("billAdressHelpText")){
$("billAdressHelpText").innerHTML="<strong>Why do we ask?</strong> The billing address is used to prevent fraud by matching it to your account information -- enter this as close to the way it appears on your card statement.";
}
}
}
});
}else{
if(_103){
$(_103,_104).invoke("setStyle",{display:"block"});
_103.innerHTML="We accept only credit cards issued in India";
}
}
});
var tabs=$("vTabs").select("li");
var _106=0;
tabs.each(function(tab,_108){
if(tab.down("a").hasClassName("active")){
_106=_108;
}
});
tabs.each(function(tab,_10a){
if(_10a===_106){
$(tab).addClassName("active");
$(tab.id.split("_tab")[0]).style.display="block";
}
$(tab.getElementsByTagName("a")[0]).observe("click",function(){
tabs.each(function(tab1){
if(tab1===tab){
$(tab1).select("a")[0].addClassName("active");
$(tab1.id.split("_tab")[0]).style.display="block";
}else{
$(tab1).select("a")[0].removeClassName("active");
$(tab1.id.split("_tab")[0]).style.display="none";
}
});
});
});
$("CCNotAccepted","DCNotAccepted").invoke("hide");
if($("copyContactToBilling")){
$("copyContactToBilling").observe("click",function(){
try{
function populateField(_10c,_10d){
if($F(_10c)&&$F(_10c)!==$(_10c).readAttribute("selflabel")){
if($(_10c).id==="contactCountry"){
if($F(_10c).toLowerCase().strip()==="india"){
$(_10d).value="India";
$(_10d).removeClassName("selflabel");
$("billCountryCode").value="IN";
}else{
$(_10d).value=$(_10d).readAttribute("selflabel");
$("billCountryCode").value="";
}
}else{
$(_10d).value=$F(_10c);
$(_10d).removeClassName("selflabel");
}
}
}
var _10e=[{f:"contactFirstName",t:"billFirstName"},{f:"contactLastName",t:"billLastName"},{f:"contactAddress",t:"billAddress"},{f:"contactCity",t:"billCity"},{f:"contactState",t:"billState"},{f:"contactPin",t:"billPin"},{f:"contactCountry",t:"billCountry"}];
$A(_10e).each(function(_10f){
populateField(_10f.f,_10f.t);
});
}
catch(e){
console.log(e);
}
});
}
if(_fb.hasClassName("withVerification")){
function performVerification(_110){
var form=Event.findElement(_110,"form");
if(!form.ct_validationFailed){
var _112="product="+_fb.readAttribute("product")+"&";
var _113;
if(form.id=="credit_card"){
var _114;
$A(document.getElementsByName("card_type")).each(function(_115){
if(_115.checked){
_114=$F(_115);
}
});
_112+="payment_mode=C&card_type="+_114+"&card_number="+$F("creditCardNumber");
_113=$("CCNotAccepted");
}else{
_112+="payment_mode=D&issuing_bank="+$F("issuingBank")+"&card_number="+$F("debitCardNumber");
_113=$("DCNotAccepted");
}
if(_fb.readAttribute("product").toUpperCase()==="H"){
var _116=form.id;
var _117=document.forms[_116];
_112+="&userid="+_117.userid.value+"&title="+_117.title.value+"&firstName="+_117.firstName.value+"&lastName="+_117.lastName.value+"&username="+_117.username.value+"&contact1="+_117.contact1.value+"&contact2="+_117.contact2.value;
_112+="&cvv_code="+_117.cvv_code.value+"&bill_name="+_117.bill_name.value+"&card_expiration_month="+_117.card_expiration_month.value+"&card_expiration_year="+_117.card_expiration_year.value;
_112+="&hotelid="+_117.hotelid.value+"&bookingCode="+_117.bookingCode.value+"&roomtypecode="+_117.roomtypecode.value+"&bookParams="+escape(_117.bookParams.value);
var _118;
var _119=$("loyaltyCash").value;
_117.loyaltyCP.value=_119;
if(_119===""||parseInt(_119,10)===0){
_118="N";
}else{
if($("cleartripCashY").checked&&(_119!==""&&_119!=="0")){
_118="Y";
}else{
_118="N";
}
}
_117.loyaltyYN.value=_118;
_112+="&loyaltyYN="+_117.loyaltyYN.value+"&loyaltyCP="+_117.loyaltyCP.value;
}
_112+="&ts="+ct.dates.getTimestamp();
function failureHandler(){
_113.style.display="block";
$(form).enable();
}
$("progress_img").style.display="";
_113.style.display="none";
$(form).disable();
var _11a=false,_11b="";
if($("creditCardNumber")){
var ccNo=$F("creditCardNumber");
ccNo=ccNo.substring(ccNo.length-4);
if(form.id=="credit_card"&&!ct.cookies.read("ct-secure-"+ccNo)){
if(($("cc_visa")&&$("cc_visa").checked)){
_11a=true;
_11b="#VBV--"+ccNo;
}else{
if(($("cc_master")&&$("cc_master").checked)){
_11a=true;
_11b="#MSC--"+ccNo;
}
}
}
}
new Ajax.Request(_fb.readAttribute("verificationurl"),{method:(_fb.readAttribute("product").toUpperCase()==="H")?"post":"get",parameters:_112,onSuccess:function(_11d){
switch(_11d.responseText.toLowerCase()){
case "true":
$(form).enable();
if(_11a){
ct.helperFunctions.showModalDialog("/secure/secure-modal.shtml"+_11b,"50%","60%",false);
}else{
$(form).submit();
}
break;
default:
failureHandler();
break;
}
$("progress_img").style.display="none";
},onFailure:function(_11e){
$("progress_img").style.display="none";
$(form).enable();
if(_11a){
ct.helperFunctions.showModalDialog("/secure/secure-modal.shtml"+_11b,"50%","60%",false);
}else{
$(form).submit();
}
}});
Event.stop(_110);
}
}
if($("credit_card")){
$("credit_card").observe("submit",performVerification);
}
if($("debit_card")){
$("debit_card").observe("submit",performVerification);
}
$A(["credit_card","debit_card","net_banking","cash_card"]).each(function(_11f){
if($(_11f)){
$(_11f).setAttribute("autocomplete","off");
$(_11f).observe("submit",function(evt){
if($("cleartripCashY")){
ct.forms.addHiddenField(evt.findElement("form"),"redeem",($("cleartripCashY").checked?"true":"false"));
if((_11f==="net_banking"||_11f==="cash_card")&&!$(_11f).ct_validationFailed){
$(_11f).submit();
}
}
if($("coupon")){
ct.forms.addHiddenField(evt.findElement("form"),"coupon",$F("coupon"));
}
});
}
});
if($("deposit_acct")&&Prototype.Browser.IE){
$("deposit_acct").observe("submit",function(evt){
$("deposit_acct").submit();
});
}
}
},addPaymentBehaviorFromJSON:function(_122,_123){
_122.jsonData=_123;
$("cleartripCashApplicable").innerHTML=ct.stringFormatting.formatForCurrency(_122.jsonData.lp);
var _124=$A(["nb","cc","dc","kc"]),_125;
function paymentModeChanged(mode){
mode=(_124.indexOf(mode)!==-1)?mode:_125;
_125=mode;
var _127=getCurrentValue(mode),_128=_122.jsonData.availability,_129=_122.jsonData.tot,_12a=$A([]),_12b;
if(!_122.jsonData.err&&_122.jsonData.lp&&$("cleartripCashY").checked){
_129-=_122.jsonData.lp;
_12b=true;
if($("rtLoyaltyLabel")){
$("rtLoyaltyLabel","rtLoyaltyAmount").invoke("show");
$("rtLoyaltyAmount").innerHTML="("+ct.stringFormatting.formatForCurrency(_122.jsonData.lp)+")";
if($("loyaltyCash")){
$("loyaltyCash").value=_122.jsonData.lp;
}
_12a.push("rtLoyaltyLabel");
_12a.push("rtLoyaltyAmount");
}
}else{
if($("rtLoyaltyLabel")){
_12b=false;
$("rtLoyaltyLabel","rtLoyaltyAmount").invoke("hide");
}
}
if(_127===null||_127===undefined){
if($("rtProcessingLabel")){
$("rtProcessingLabel","rtProcessingAmount").invoke("hide");
}
$("ProcessingFee").hide();
}else{
if($("rtProcessingLabel")){
if(_122.jsonData[mode][_127].pc===0){
$("rtProcessingLabel","rtProcessingAmount").invoke("hide");
}else{
$("rtProcessingLabel","rtProcessingAmount").invoke("show");
$("rtProcessingAmount").innerHTML=ct.stringFormatting.formatForCurrency(_122.jsonData[mode][_127][(_12b?"wl":"xl")],true);
_12a.push("rtProcessingLabel");
_12a.push("rtProcessingAmount");
}
}
$("processingFeeAmount").innerHTML=_122.jsonData[mode][_127].pc;
if(_122.jsonData[mode][_127].pc===0){
$("ProcessingFee").hide();
}else{
$("ProcessingFee").show();
_12a.push("processingFeeAmount");
}
_129+=_122.jsonData[mode][_127][(_12b?"wl":"xl")];
}
_129=Math.round(_129);
if($("rtTotalLabel")){
_12a.push("rtTotalLabel");
_12a.push("rtTotalAmount");
$("rtTotalAmount").innerHTML=ct.stringFormatting.formatForCurrency(_129);
}
if($("trainsAvailability")&&_128){
$("trainsAvailability").show();
$("trainsAvailabilityValue").innerHTML=_128;
}
$("formTotal").innerHTML=ct.stringFormatting.formatForCurrency(_129);
_12a.push("formTotal");
if(window.Effect){
_12a.each(function(_12c){
new Effect.Highlight($(_12c));
});
}
if($("ItzSave")){
var _12d=Math.round(_129*(101.5/101.8));
var _12e=_129-_12d;
if(_12e>1){
$("ItzSave").update("<strong>Save "+ct.stringFormatting.formatForCurrency(_12e)+"</strong> on transaction fee by paying with ItzCash card. You will be charged "+ct.stringFormatting.formatForCurrency(_12d)+" only.");
}else{
$("ItzSave").update("You will be charged "+ct.stringFormatting.formatForCurrency(_129)+" only.");
}
}
}
function getCurrentValue(mode){
var _130;
switch(_124.indexOf(mode)){
case 0:
_130=$F("transferBank");
_130=(_130==="0")?null:_130;
break;
case 1:
$A(document.getElementsByName("card_type")).each(function(_131){
if(_131.checked){
_130=$F(_131);
}
});
break;
case 2:
_130=$F("issuingBank");
_130=(_130==="0")?null:_130;
break;
case 3:
_130=$F("cash_card_id");
_130=(_130==="0")?null:_130;
}
return _130;
}
if(!_122.eventsAttached){
$("vTabs").select("li a").each(function(tab,_133){
$(tab).observe("click",function(){
paymentModeChanged(_124[_133]);
});
if($(ct.dom.getParentByTagName(tab,"li")).hasClassName("active")){
paymentModeChanged(_124[_133]);
}
});
$A(document.getElementsByName("card_type")).invoke("observe","click",function(){
paymentModeChanged(_124[1]);
});
if($("issuingBank")){
$("issuingBank").observe("change",function(){
paymentModeChanged(_124[2]);
});
}
if($("transferBank")){
$("transferBank").observe("change",function(){
paymentModeChanged(_124[0]);
});
}
$("cleartripCashY","cleartripCashN").invoke("observe","click",paymentModeChanged);
if(_122.jsonData.lp===0||_122.jsonData.err){
$("CleartripCash").hide();
$("cleartripCashN").checked=false;
}else{
$("CleartripCash").show();
$("cleartripCashY").checked=true;
}
$("paymentSubmit").observe("click",function(){
var _134=$(["net_banking","credit_card","debit_card","cash_card"][_124.indexOf(_125)]),evt;
if(document.createEvent){
evt=document.createEvent("HTMLEvents");
evt.initEvent("submit",true,true);
evt.eventName="submit";
}else{
evt=document.createEventObject();
evt.eventType="onsubmit";
evt.eventName="submit";
}
if(document.createEvent){
_134.dispatchEvent(evt);
}else{
_134.fireEvent(evt.eventType,evt);
}
});
_122.eventsAttached=true;
}else{
$("vTabs").select("li a").each(function(tab,_137){
if($(ct.dom.getParentByTagName(tab,"li")).hasClassName("active")){
paymentModeChanged(_124[_137]);
}
});
}
},flightForm:function(_138){
function isInternational(){
if(($F("origin_autocomplete").indexOf(", IN - ")>=0)&&($F("destination_autocomplete").indexOf(", IN - ")>=0)){
return false;
}
return true;
}
function modifyDropdowns(){
var _139=$F("adults"),_13a=$F("children"),_13b=$F("infants"),i,_13d;
$A($("children").childNodes).each(Element.remove);
$A($("infants").childNodes).each(Element.remove);
for(i=0;i<=_139;i++){
_13d=new Element("option",{value:i}).update(i);
if(_13b==i){
_13d.setAttribute("selected","selected");
}
$("infants").appendChild(_13d);
}
for(i=0;i<(10-_139);i++){
_13d=new Element("option",{value:i}).update(i);
if(_13a==i){
_13d.setAttribute("selected","selected");
}
$("children").appendChild(_13d);
}
}
function prepopulateForm(){
if(window.location.href.split("flights?")[1]){
var _13e=decodeURIComponent(window.location.href.split("flights?")[1]);
_13e=_13e.gsub(/\+/," ");
ct.cookies.create("flight_sr",_13e,365);
}
var _13f=ct.cookies.read("flight_sr");
_138.action="/flights/search";
if(_13f){
function populateTextField(_140,_141){
if(document.activeElement){
if(document.activeElement!==_140){
_140.value=_141;
}
}else{
_140.value=_141;
}
}
_13f=_13f.toQueryParams("&");
if((_13f.rnd_one==="R")||(_13f.rnd_one==="C")){
if(_13f.depart_date&&!ct.dates.isPast(ct.dates.fromString(_13f.depart_date))){
populateTextField(_138.depart_date,_13f.depart_date);
}
if(_13f.return_date&&!ct.dates.isPast(ct.dates.fromString(_13f.return_date))){
populateTextField(_138.return_date,_13f.return_date);
}
$("rnd_trip").checked=true;
makeRoundTrip();
}else{
if(_13f.rnd_one==="O"){
$("one_way").checked=true;
makeOneWay();
if(_13f.depart_date&&!ct.dates.isPast(ct.dates.fromString(_13f.depart_date))){
populateTextField(_138.depart_date,_13f.depart_date);
}
}
}
$(_138.from).writeAttribute("preselect",_13f.from);
if(_138.origin){
_138.origin.value=_13f.origin||"";
}
_138.from.value=_13f.from||"";
_138.destination.value=_13f.destination||"";
_138.to.value=_13f.to||"";
_138.adults.value=_13f.adults||"1";
_138.childs.value=_13f.childs||"0";
_138.infants.value=_13f.infants||"0";
}else{
if(_138.origin.value===""||_138.origin.value===_138.origin.readAttribute("selflabel")){
_138.origin.focus();
}
}
}
$("adults","children","infants").each(function(_142){
$A(_142.childNodes).each(Element.remove);
var _143=(_142.id==="adults")?1:0;
for(var i=_143;i<10;i++){
_142.appendChild(new Element("option",{value:i}).update(i));
}
});
$("adults").observe("change",modifyDropdowns);
if(!_138.hasClassName("dontprepopulate")){
prepopulateForm();
modifyDropdowns();
_138.action="/flights/search";
}else{
_138.action="/flights/search";
}
var _145=function(_146,_147){
var dest=_147.destination.value;
var city=dest.split(",")[0],_14a=((dest.split(",")[1]).split("-")[0]).strip();
var _14b;
if($("rnd_trip").checked&&_147.return_date.value!==""&&_147.return_date.value!==_147.return_date.readAttribute("selflabel")){
if(_147.depart_date.value===_147.return_date.value){
var ret=ct.dates.fromString(_147.depart_date.value);
ret.setDate(ret.getDate()+1);
_14b=ct.dates.toString(ret);
}else{
_14b=_147.return_date.value;
}
}else{
var ret=ct.dates.fromString(_147.depart_date.value);
ret.setDate(ret.getDate()+2);
_14b=ct.dates.toString(ret);
}
var adlt=parseInt(_147.adults.value,10);
var chld=(parseInt(_147.childs.value,10)+parseInt(_147.infants.value,10));
var _14f={"city":city,"country":_14a,"chk_in":_147.depart_date.value,"chk_out":_14b,"num_rooms":"1","adults1":(adlt>2?2:adlt),"children1":(chld>2?2:chld)};
Object.keys(_14f).each(function(key){
_146.appendChild(new Element("input",{"type":"hidden","name":key,"value":_14f[key]}));
});
ct.cookies.create("hotel_sr",$H(_14f).toQueryString(),365);
};
$(_138).observe("submit",function(_151){
if(!(_138.errors&&_138.errors.length>0)&&!$(_138).hasClassName("noCookie")){
if($("searchHotels")&&$("searchHotels").checked&&$("comboHotelSearch")){
_145($("comboHotelSearch"),_138);
var _152=window.open("/hotels","hotelSearchPage","left=224,top=168,width=800,height=400,outerWidth=800,outerHeight=500,toolbar=yes,location=yes,scrollbars=yes,resizable=yes,directories=yes,personalbar=yes,status=yes");
if(_152){
$("comboHotelSearch").submit();
_152.focus();
}else{
alert("Oops.. Looks like your browser blocked our hotel search results window.");
}
}
ct.cookies.create("flight_sr",$(_138).serialize(),365);
}
if(_138.hasClassName("external_offers")){
_138.action="http://www.cleartrip.com/flights/search";
}
});
if($("adv_link")){
$("adv_link").observe("click",function(_153){
setAdvCookie();
$("advanced_search1").toggle();
$("adv_link").toggleClassName("toggle_open");
$("adv_link").toggleClassName("toggle_closed");
});
}
(function(){
var _154=ct.cookies.read("adv1");
if($("adv_link")&&_154==="off"&&$("advanced_search1").style.display==="none"){
$("advanced_search1").toggle();
$("adv_link").toggleClassName("toggle_open");
$("adv_link").toggleClassName("toggle_closed");
}
})();
var _155=ct.validator.attachValidation;
_155($("destination_autocomplete"),"Please choose a destination that is different from your origin.",function(){
if(($F("from")!=="")&&($F("to")!=="")){
return $F("from")!==$F("to");
}else{
return true;
}
});
_155($("infants"),"You cannot have more infants than adults travelling on a flight.",function(){
return $F("infants")<=$F("adults");
});
_155($("dpt_date"),"Please choose a departure date at least two days from today for international flights",function(){
if(!isInternational()){
return true;
}else{
if(!ct.dates.isValidDateString($F("dpt_date"))){
return true;
}else{
var _156=ct.dates.fromString($("dpt_date").readAttribute("mindate"));
_156.setDate(_156.getDate()+1);
return (ct.dates.fromString($F("dpt_date"))-_156)>0;
}
}
});
function toggleModifySearch(){
$("modify_search_open").toggle();
$("mod_link").toggleClassName("toggle_open");
$("mod_link").toggleClassName("toggle_closed");
ct.stickyBlocks.recalculateTop($("filter"));
}
$("rnd_trip").observe("click",makeRoundTrip);
$("one_way").observe("click",makeOneWay);
if($("multi_city")){
$("multi_city").observe("click",function(){
window.location.href="http://"+window.location.host+"/multicity.shtml";
});
}
if($("mod_link")){
$("mod_link").observe("click",toggleModifySearch);
}
if($("close_link")){
$("close_link").observe("click",toggleModifySearch);
}
if(!ct.genericBlocks.flightForm.helpers){
ct.genericBlocks.flightForm.helpers={};
}
var _157=ct.genericBlocks.flightForm.helpers;
function makeOneWay(){
$("rtn_date").setAttribute("disabled","disabled");
$("ret_time").setAttribute("disabled","disabled");
}
function makeRoundTrip(){
$("rtn_date").removeAttribute("disabled");
$("ret_time").removeAttribute("disabled");
}
_157.makeOneWay=makeOneWay;
_157.makeRoundTrip=makeRoundTrip;
if($("one_way").checked){
makeOneWay();
}else{
if($("rnd_trip").checked){
makeRoundTrip();
}else{
makeOneWay();
}
}
function setAdvCookie(){
var _158=ct.cookies.read("adv1");
if(_158===""||_158===null||_158==="off"){
ct.cookies.erase("adv1");
ct.cookies.create("adv1","on",365);
}else{
ct.cookies.erase("adv1");
ct.cookies.create("adv1","off",365);
}
}
},hotelForm:function(_159){
ct.validator.attachValidation($("rooms"),"Please check the number of rooms you have chosen.",function(){
var _15a=parseInt($F("rooms"),10);
for(var i=0;i<_15a;i++){
if($("adults"+(i+1))===null||$("children"+(i+1))===null){
return false;
}
}
return true;
});
if(!_159.hasClassName("dontprepopulate")){
(function(){
if(window.location.href.split("hotels/?")[1]){
var _15c=decodeURIComponent(window.location.href.split("hotels/?")[1]);
_15c=_15c.gsub(/\+/," ");
ct.cookies.create("hotel_sr",_15c,365);
}
if(ct.cookies.read("hotel_sr")&&!(_159.id==="fetch_rates")){
var _15d=ct.cookies.read("hotel_sr").toQueryParams("&");
_159.city.value=_15d.city||"";
_159.state.value=_15d.state||"";
_159.country.value=_15d.country||"";
_159.dest_code.value=_15d.dest_code||"";
if(_15d.chk_in&&!ct.dates.isPast(ct.dates.fromString(_15d.chk_in))){
_159.chk_in.value=_15d.chk_in;
}
if(_15d.chk_out&&!ct.dates.isPast(ct.dates.fromString(_15d.chk_out))){
_159.chk_out.value=_15d.chk_out;
}
$("rooms").value=_15d.num_rooms||"1";
if($("showDebug")&&_15d.showDebug){
$("showDebug").checked=true;
}
if($("NonResident2")!==null&&$("NonResident2")!==undefined){
$("NonResident2").checked=false;
}
ct.helperFunctions.addRooms(_159.num_rooms);
switch(_15d.num_rooms){
case "1":
case "2":
case "3":
case "4":
$("adults1").value=_15d.adults1||"1";
$("children1").value=_15d.children1||"0";
if(_15d.num_rooms=="1"){
break;
}
case "2":
case "3":
case "4":
$("adults2").value=_15d.adults2||"1";
$("children2").value=_15d.children2||"0";
if(_15d.num_rooms=="2"){
break;
}
case "3":
case "4":
$("adults3").value=_15d.adults3||"1";
$("children3").value=_15d.children3||"0";
if(_15d.num_rooms=="3"){
break;
}
case "4":
$("adults4").value=_15d.adults4||"1";
$("children4").value=_15d.children4||"0";
break;
}
}
})();
}
$(_159).observe("submit",function(_15e){
if(!_159.errors){
var _15f=false;
if($("NonResident2")!==null&&$("NonResident2")!==undefined&&$("NonResident2").checked){
_15f=true;
}
if($F("dest_code")==="WCT"||_15f){
_159.action="/hotels/search";
}else{
if($("price_form")){
_159.action=$("price_form").value;
}else{
_159.action="/hotels/search";
}
if(_159.readAttribute("campaign")){
_159.action+="?campaign="+_159.readAttribute("campaign");
}
}
if($F("dest_code")=="WCT"||_15f){
var _160=$("checkin_date").value.split("/");
$("doa_dd").value=_160[0];
$("doa_mm").value=_160[1];
$("doa_yy").value=_160[2];
var _161=$("checkout_date").value.split("/");
$("dod_dd").value=_161[0];
$("dod_mm").value=_161[1];
$("dod_yy").value=_161[2];
var _162=$F("rooms");
var _163=0;
var _164=0;
for(var a=0;a<parseInt(_162,10);a++){
_163+=parseInt(_159["adults"+(a+1)].value,10);
_164+=parseInt(_159["children"+(a+1)].value,10);
}
$("num_adults").value=Math.ceil(_163/parseInt(_162,10));
$("num_children").value=Math.ceil(_164/parseInt(_162,10));
}
ct.cookies.create("hotel_sr",$(_159).serialize(),365);
if(_159.id==="fetch_rates"){
$("wait_img").show();
Event.stop(_15e);
var _166=window.location.href;
var _167="/hotels/roomrates";
if(_166.indexOf("allowed_form")!=-1){
_167=_167+"?allowed_form=true";
}
new Ajax.Request(_167,{method:"get",parameters:$(_159.id).serialize()+"&ts="+ct.dates.getTimestamp(),onSuccess:function(_168){
_159.enable();
$("wait_img").hide();
if(_168.responseText==="NO HOTELS"){
$("RoomRatesTable").innerHTML="<p><strong>Sorry, we couldn't find any available rooms for the dates you picked.</p></strong><p>You can try again with different dates.</p>";
}else{
$("RoomRatesTable").innerHTML=_168.responseText;
_159.hide();
}
if(window.Effect){
new Effect.Appear("RoomRatesTable");
}else{
$("RoomRatesTable").style.display="block";
}
},onFailure:function(_169){
$("fetch_rates").enable();
$("wait_img").hide();
alert("Sorry, we weren't able to get room rates for this hotel at this time. Please try again later.");
}});
_159.disable();
}
}
});
function toggleModifySearch(){
$("modify_search_open").toggle();
$("mod_link").toggleClassName("toggle_open");
$("mod_link").toggleClassName("toggle_closed");
ct.stickyBlocks.recalculateTop($("filter"));
}
if($("mod_link")){
$("mod_link").observe("click",toggleModifySearch);
}
if($("close_link")){
$("close_link").observe("click",toggleModifySearch);
}
},trainForm:function(_16a){
var _16b=ct.validator.attachValidation;
_16b($("train_adults"),"You cannot search for more than a total of 6 passengers.",function(){
return (+$F("train_adults")+(+$F("train_children"))+(+$F("train_male_seniors"))+(+$F("train_female_seniors")))<=6;
});
_16b($("train_adults"),"You must have at least 1 passenger to search.",function(){
return (+$F("train_adults")+(+$F("train_children"))+(+$F("train_male_seniors"))+(+$F("train_female_seniors")))>0;
});
_16b($("to_station"),"Please choose a destination that is different from your origin.",function(){
if(ct.validator.validationConditions.requiredFieldCondition($("from_station"))&&ct.validator.validationConditions.requiredFieldCondition($("to_station"))){
return $F("from_station")!==$F("to_station");
}else{
return true;
}
});
function prepopulateForm(){
if(window.location.href.split("trains#")[1]){
var _16c=decodeURIComponent(window.location.href.split("trains#")[1]);
_16c=_16c.gsub(/\+/," ");
ct.cookies.create("train_sr",_16c,365);
}
var _16d=ct.cookies.read("train_sr");
if(_16d){
function populateTextField(_16e,_16f){
if(document.activeElement){
if(document.activeElement!==_16e){
_16e.value=_16f;
}
}else{
_16e.value=_16f;
}
}
_16d=_16d.toQueryParams("&");
if(_16d.from_station){
populateTextField(_16a.from_station,_16d.from_station);
}
if(_16d.to_station){
populateTextField(_16a.to_station,_16d.to_station);
}
if(_16d.depart_date&&!ct.dates.isPast(ct.dates.fromString(_16d.depart_date))){
populateTextField(_16a.depart_date,_16d.depart_date);
}
_16a.adults.value=_16d.adults||"1";
_16a.children.value=_16d.children||"0";
_16a.male_seniors.value=_16d.male_seniors||"0";
_16a.female_seniors.value=_16d.female_seniors||"0";
_16a["train[class]"].value=_16d["train[class]"]||"";
}
}
if(!_16a.hasClassName("dontprepopulate")){
prepopulateForm();
}
function toggleModifySearch(){
$("modify_search_open").toggle();
$("mod_link").toggleClassName("toggle_open");
$("mod_link").toggleClassName("toggle_closed");
ct.stickyBlocks.recalculateTop($("filter"));
}
if($("mod_link")){
$("mod_link").observe("click",toggleModifySearch);
}
if($("close_link")){
$("close_link").observe("click",toggleModifySearch);
}
$(_16a).observe("submit",function(){
ct.cookies.create("train_sr",$(_16a).serialize(),365);
});
},primaryNavFlyoutMenu:function(){
if($("MainTabs")){
var _170=$($("MainTabs").getElementsByTagName("li")[3]);
if($("more_menu")){
$("more_menu").setStyle({top:(_170.cumulativeOffset().top+_170.getHeight()+6)+"px",left:_170.cumulativeOffset().left+"px"});
$(_170.getElementsByTagName("a")[0]).observe("click",function(evt){
if($("more_menu").style.display==="none"){
$("more_menu").style.display="block";
$(_170).addClassName("show_menu");
ct.dom.addIEIframeFix($("more_menu"));
}else{
$("more_menu").style.display="none";
ct.dom.removeIEIframeFix($("more_menu"));
$(_170).removeClassName("show_menu");
}
evt.stop();
});
Event.observe(document,"click",function(){
if($("more_menu").style.display==="block"){
$("more_menu").style.display="none";
ct.dom.removeIEIframeFix($("more_menu"));
$(_170).removeClassName("show_menu");
}
});
}
}
},parseDomTree:function(_172){
_172=_172||document.body;
$(document.body).select(".consent").each(ct.genericBlocks.consentBlock);
$(document.body).select(".paymentBlock").each(ct.genericBlocks.paymentBlock);
$(document.body).select(".loginBlock").each(ct.genericBlocks.signupBlock);
if($("AirSearch")){
ct.genericBlocks.flightForm($("AirSearch"));
}
if($("modify_air_search")){
ct.genericBlocks.flightForm($("modify_air_search"));
}
if($("home_hotels")){
ct.genericBlocks.hotelForm($("home_hotels"));
}
if($("hotelModifySearch")){
ct.genericBlocks.hotelForm($("hotelModifySearch"));
}
if($("fetch_rates")){
ct.genericBlocks.hotelForm($("fetch_rates"));
}
if($("rail_search")){
ct.genericBlocks.trainForm($("rail_search"));
}
setTimeout(ct.genericBlocks.primaryNavFlyoutMenu,1);
}},controls:{Calendar:function(_173,_174){
var _175=$(document.createElement("a"));
var self=this,_177;
if(!_174){
_174={};
}
_174.firstDayOfWeek=_174.firstDayOfWeek||(_173.readAttribute("firstday")?parseInt(_173.readAttribute("firstday"),10):1);
_174.minDate=_174.minDate||(_173.readAttribute("mindate")?ct.dates.fromString(_173.readAttribute("mindate")):new Date());
_174.minDateField=_174.minDateField||(_173.readAttribute("mindatefieldid")?$(_173.readAttribute("mindatefieldid")):null);
_174.calendarCount=_174.calendarCount||(_173.readAttribute("calendarcount")?parseInt(_173.readAttribute("calendarcount"),10):2);
_174.maxDate=_174.maxDate||(_173.readAttribute("maxdate")?ct.dates.fromString(_173.readAttribute("maxdate")):(new Date(new Date(_174.minDate).setFullYear(_174.minDate.getFullYear()+1))));
_174.offsetDays=_174.offsetDays||(_173.readAttribute("offsetdays")?parseInt(_173.readAttribute("offsetdays"),10):0);
_174.defaultDate=_174.defaultDate||(_173.readAttribute("defaultdate")?ct.dates.fromString(_173.readAttribute("defaultdate")):null);
var _178=null;
(function(){
if(!_173.readAttribute("size")){
_173.writeAttribute("size",10);
}
_173.writeAttribute("maxdate",ct.dates.toString(_174.maxDate));
ct.selfLabels.addSelfLabel(_173,"dd/mm/yyyy");
if(_173.nextSibling){
_173.parentNode.insertBefore(_175,_173.nextSibling);
}else{
_173.parentNode.appendChild(_175);
}
_175.href="javascript: void(0);";
_175.className="cal_openLink";
var _179=document.createElement("img");
_179.alt="Calendar";
_179.title="Click to open calendar";
_179.src="skin1/images/caln.gif";
_175.appendChild(_179);
_175.observe("click",function(_17a){
self.showDatePicker();
Event.stop(_17a);
});
_173.observe("focus",function(_17b){
self.showDatePicker();
});
_173.observe("click",function(_17c){
Event.stop(_17c);
});
_178=getMinDate();
})();
if(_174.minDateField&&$(_174.minDateField)){
$(_174.minDateField).observe("ctCalendar:onChange",function(){
if(!_173.hasClassName("no_autochange")){
var _17d=ct.dates.fromString($F(_174.minDateField));
_17d.setDate(_17d.getDate()+2);
_173.value=ct.dates.toString(_17d);
}
});
}
function getCalendarTableMarkup(){
var doc=document,ce="createElement",sa="setAttribute",ac="appendChild";
function addCol(_182,_183){
for(var i=0;i<_183;i++){
_182[ac](doc[ce]("col"));
}
}
var _185=doc[ce]("table");
_185[sa]("cellpadding","0");
_185[sa]("cellspacing","0");
_185[sa]("border","0");
var _186=doc[ce]("colgroup");
addCol(_186,5);
_185[ac](_186);
_186=doc[ce]("colgroup");
_186.className="weekend";
addCol(_186,2);
_185[ac](_186);
var _187=doc[ce]("thead");
var _188=doc[ce]("tr");
var _189=["S","M","T","W","T","F","S"];
var _18a=doc[ce]("tr");
var _18b=_174.firstDayOfWeek;
var _18c=doc[ce]("th");
_18c[sa]("colSpan","7");
$(_18c).addClassName("month");
_188[ac](_18c);
for(var i=0;i<7;i++){
_18b=_18b%7;
var _18e=doc[ce]("th");
if(i===5||i===6){
_18e.className="weekend";
}
_18e[ac](doc.createTextNode($A(_189)[_18b]));
_18a[ac](_18e);
_18b++;
}
_187[ac](_188);
_187[ac](_18a);
_185[ac](_187);
var _18f=doc[ce]("tbody");
var _190=doc[ce]("tr");
for(i=0;i<7;i++){
var _191=doc[ce]("td");
if(i===5||i===6){
_191.className="weekend";
}
_191[ac](doc.createTextNode(" "));
_190[ac](_191);
}
for(i=0;i<6;i++){
_18f[ac](_190.cloneNode(true));
}
_185[ac](_18f);
return _185;
}
function getCalendarMarkupOutline(){
var doc=document,ce="createElement",sa="setAttribute",ac="appendChild";
var _196=doc[ce]("div");
_196[sa]("id","datePickerContainer");
_196.style.display="block";
var _197=doc[ce]("div");
_197.id="close";
$(_197).addClassName("dt_control");
var _198=doc[ce]("a");
_198[sa]("href","javascript: void(0);");
_198[sa]("id","cal_closeCalendar");
_198[sa]("title","Close");
_198[ac](doc.createTextNode(" "));
_197[ac](_198);
_196[ac](_197);
var _199=doc[ce]("div");
_199.id="previous";
$(_199).addClassName("dt_control");
var _19a=doc[ce]("a");
_19a[ac](doc.createTextNode(" "));
_19a[sa]("href","javascript: void(0);");
_19a[sa]("id","cal_showPreviousMonth");
_19a[sa]("title","Previous month");
_199[ac](_19a);
_196[ac](_199);
var _19b=getCalendarTableMarkup();
var _19c=doc[ce]("div");
_19c.setAttribute("id","datePickerWrapper");
_19c.style.overflow="hidden";
for(var i=0;i<_174.calendarCount;i++){
_19c[ac](_19b.cloneNode(true));
}
_196[ac](_19c);
var _19e=doc[ce]("div");
_19e.id="next";
$(_19e).addClassName("dt_control");
var _19f=doc[ce]("a");
_19f[ac](doc.createTextNode(" "));
_19f[sa]("href","javascript: void(0);");
_19f[sa]("id","cal_showNextMonth");
_19f[sa]("title","Next month");
_19e[ac](_19f);
_196[ac](_19e);
$(_196).observe("click",globalEventHandler);
return _196;
}
function globalEventHandler(_1a0){
try{
switch(Event.findElement(_1a0,"a").id){
case "cal_closeCalendar":
self.hideDatePicker();
break;
case "cal_showPreviousMonth":
if(!Event.findElement(_1a0,"a").hasClassName("disabled")){
showPreviousMonth();
}
break;
case "cal_showNextMonth":
if(!Event.findElement(_1a0,"a").hasClassName("disabled")){
showNextMonth();
}
break;
default:
selectDate(Event.findElement(_1a0,"a"));
}
}
catch(e){
}
Event.stop(_1a0);
}
function bodyClickHandler(_1a1){
self.hideDatePicker();
}
function selectDate(_1a2){
if(_1a2&&_1a2.timeStamp){
var _1a3=new Date(_1a2.timeStamp);
var _1a4=(_1a3.getDate())+"/";
_1a4+=(_1a3.getMonth()+1)+"/";
_1a4+=_1a3.getFullYear();
_173.value=_1a4;
self.hideDatePicker();
_178=new Date(_1a3);
if(_173.readAttribute("selflabel")){
_173.removeClassName("selflabel");
}
_173.fire("ctCalendar:onChange");
}
}
function adjustPreviousNextLinksDisplay(){
var _1a5=getMinDate();
var _1a6=new Date(_1a5);
var _1a7=_177;
while(_1a7<0){
_1a7+=12;
}
_1a6.setMonth(_1a7);
if(_1a6.getMonth()<=_1a5.getMonth()&&_1a6.getFullYear()<=_1a5.getFullYear()){
$("cal_showPreviousMonth").addClassName("disabled");
}else{
$("cal_showPreviousMonth").removeClassName("disabled");
}
var _1a8=getMaxDate();
_1a6=new Date(_1a5);
var _1a9=_177+_174.calendarCount-1;
while(_1a9>12){
_1a9-=12;
}
_1a6.setMonth(_1a9);
if(_1a6.getMonth()>=_1a8.getMonth()&&_1a6.getFullYear()>=_1a8.getFullYear()){
$("cal_showNextMonth").addClassName("disabled");
}else{
$("cal_showNextMonth").removeClassName("disabled");
}
}
function showPreviousMonth(){
var _1aa=getCalendarTableMarkup();
$("datePickerWrapper").insertBefore(_1aa,$("datePickerWrapper").firstChild);
populateCalendarTable(_177-1,_1aa,getMinDate(),getMaxDate());
_177--;
adjustPreviousNextLinksDisplay();
$($("datePickerWrapper").getElementsByTagName("table")[_174.calendarCount]).remove();
ct.dom.removeIEIframeFix($("datePickerContainer"));
ct.dom.addIEIframeFix($("datePickerContainer"));
}
function showNextMonth(){
var _1ab=getCalendarTableMarkup();
$("datePickerWrapper").appendChild(_1ab);
populateCalendarTable(_177+_174.calendarCount,_1ab,getMinDate(),getMaxDate());
_177++;
adjustPreviousNextLinksDisplay();
$($("datePickerWrapper").getElementsByTagName("table")[0]).remove();
ct.dom.removeIEIframeFix($("datePickerContainer"));
ct.dom.addIEIframeFix($("datePickerContainer"));
}
function getMinDate(){
var _1ac;
if(_174.minDateField){
if(ct.dates.isValidDateString($F(_174.minDateField))){
_1ac=ct.dates.fromString($F(_174.minDateField));
}else{
if($(_174.minDateField).readAttribute("mindate")){
_1ac=ct.dates.fromString($(_174.minDateField).readAttribute("mindate"));
}else{
_1ac=null;
}
}
}else{
_1ac=_174.minDate;
}
if(_1ac){
_1ac.setDate(_1ac.getDate()+_174.offsetDays);
}
return new Date(_1ac);
}
function getMaxDate(){
if(_174.maxDate){
return new Date(_174.maxDate);
}else{
maxDate=new Date(getMinDate());
maxDate.setFullYear(maxDate.getFullYear()+1);
return maxDate;
}
}
function populateCalendarTable(_1ad,_1ae,_1af,_1b0){
var _1b1=new Date(_1af);
var _1b2=ct.dates.monthNames;
ct.dates.setMonth(_1b1,_1ad);
_1b1.setDate(1);
_1ad%=12;
_1ae.getElementsByTagName("th")[0].appendChild(document.createTextNode(_1b2[_1ad<0?_1ad+12:_1ad]+" "+_1b1.getFullYear()));
var _1b3=_1ae.getElementsByTagName("tbody")[0].getElementsByTagName("td");
if(ct.dates.isValidDateString($F(_173))){
_178=ct.dates.fromString($F(_173));
}else{
_178=getMinDate();
}
var _1b4=_174.firstDayOfWeek;
$A(_1b3).each(function(cell){
if(_1b4===_1b1.getDay()&&_1b1.getMonth()===_1ad){
if(ct.dates.compare(_1b1,_1af)===1||ct.dates.compare(_1b1,_1b0)===-1){
cell.appendChild(document.createTextNode(_1b1.getDate()));
}else{
var link=document.createElement("a");
link.href="javascript: void(0);";
link.timeStamp=_1b1.valueOf();
link.appendChild(document.createTextNode(_1b1.getDate()));
cell.appendChild(link);
}
if(_178.toString()==_1b1.toString()){
$(cell).addClassName("selected");
}
_1b1.setDate(_1b1.getDate()+1);
}else{
cell.appendChild(document.createTextNode(" "));
}
_1b4++;
_1b4%=7;
});
}
var _1b7=null;
this.showDatePicker=function(){
if(!_173.disabled){
this.hideDatePicker();
var _1b8=getCalendarMarkupOutline();
if(_174.minDateField&&ct.dates.isValidDateString($F(_174.minDateField))&&ct.dates.isValidDateString($F(_173))&&(ct.dates.fromString($F(_174.minDateField)).toString()>ct.dates.fromString($F(_173)).toString())){
_177=ct.dates.fromString($F(_174.minDateField)).getMonth()+(ct.dates.fromString($F(_174.minDateField)).getFullYear()-getMinDate().getFullYear())*12;
}else{
if(ct.dates.isValidDateString($F(_173))){
_177=ct.dates.fromString($F(_173)).getMonth()+(ct.dates.fromString($F(_173)).getFullYear()-getMinDate().getFullYear())*12;
}else{
if(_174.defaultDate){
_177=_174.defaultDate.getMonth()+(_174.defaultDate.getFullYear()-getMinDate().getFullYear())*12;
}else{
_177=getMinDate().getMonth();
}
}
}
document.body.appendChild(_1b8);
for(var i=0;i<_174.calendarCount;i++){
populateCalendarTable(_177+i,_1b8.getElementsByTagName("table")[i],getMinDate(),getMaxDate());
}
var pos=$(_173).cumulativeOffset();
var _1bb=document.viewport.getDimensions();
var _1bc=_1b8.getDimensions();
_1b8.style.position="absolute";
if((_1bb.height-_1bc.height-pos.top)>0){
_1b8.style.top=(pos.top+$(_173).getHeight())+"px";
}else{
_1b8.style.top=(pos.top-_1bc.height)+"px";
}
if((_1bb.width-pos.left-_1bc.width)>0){
_1b8.style.left=(pos.left)+"px";
}else{
_1b8.style.right=_1bb.width-pos.left-_173.getWidth()+"px";
}
adjustPreviousNextLinksDisplay();
ct.dom.addIEIframeFix(_1b8);
$(document.body).observe("click",bodyClickHandler);
}
};
this.hideDatePicker=function(){
if($("datePickerContainer")){
$("datePickerContainer").stopObserving("click",globalEventHandler);
ct.dom.removeIEIframeFix($("datePickerContainer"));
$("datePickerContainer").remove();
$(document.body).stopObserving("click",bodyClickHandler);
}
};
},AirportsDropdown:function(_1bd,_1be){
var self=this;
if(!_1be){
_1be={};
}
_1be.showFeaturedAirports=_1be.showFeaturedAirports||(_1bd.readAttribute("showfeatured")&&_1bd.readAttribute("showfeatured").toLowerCase()==="no")?false:true;
_1be.preselectAirportCode=_1be.preselectAirportCode||(_1bd.readAttribute("preselect")&&_1bd.readAttribute("preselect")!=="")?_1bd.readAttribute("preselect"):null;
_1be.cookieSelection=_1be.cookieSelection||(_1bd.readAttribute("cookieselection")&&_1bd.readAttribute("cookieselection")==="no")?false:true;
try{
_1be.extraValues=_1be.extraValues||(_1bd.readAttribute("extras")&&_1bd.readAttribute("extras").strip().length>0)?eval("({"+_1bd.readAttribute("extras").strip()+"})"):null;
}
catch(e){
alert("here");
_1be.extraValues=null;
}
if(_1be.cookieSelection&&_1bd.readAttribute("cookiename")){
if(_1bd.readAttribute("cookiename")===""){
throw new Error("Error initializing the airports dropdown. There was no cookie name found to store the selection. Use cookiename=\"some_cookie_name\" to specify the cookie name or cookieselection=\"no\" to disable saving cookies.");
}
}else{
_1be.cookieName=_1bd.readAttribute("cookiename");
}
ct.validator.attachValidation(_1bd,"Please choose from the available "+_1bd.title.toLowerCase()+".",function(){
return $F(_1bd)!=="";
});
this.populate=function(){
if(_1bd.firstChild){
_1bd.removeChild(_1bd.firstChild);
}
var key;
if(_1be.extraValues){
Object.keys(_1be.extraValues).each(function(key){
var _1c2=new Element("option",{value:key}).update(_1be.extraValues[key]);
if(_1be.preselectAirportCode&&_1be.preselectAirportCode===_1be.extraValues[key]){
_1c2.setAttribute("selected","selected");
}
_1bd.appendChild(_1c2);
});
}else{
_1bd.appendChild(new Element("option",{value:""}).update("Select location"));
}
_1bd.appendChild(new Element("option",{value:""}).update("------------"));
if(_1be.showFeaturedAirports){
$A(ct.airports.featured).each(function(_1c3){
_1bd.appendChild(new Element("option",{value:_1c3.k}).update(_1c3.v));
});
_1bd.appendChild(new Element("option",{value:""}).update("------------"));
}
$A(ct.airports.all).each(function(_1c4){
var _1c5=new Element("option",{value:_1c4.k}).update(_1c4.v);
if(_1be.preselectAirportCode&&_1be.preselectAirportCode===_1c4.k){
_1c5.writeAttribute("selected","selected");
}
_1bd.appendChild(_1c5);
});
};
self.populate();
},AutoCompleteTextbox:function(_1c6,_1c7){
var _1c8={up:38,down:40,enter:13,escape:27};
var _1c9=0,_1ca="autocompleteOptionsContainer",_1cb=[],_1cc=null;
var _1cd="/images/indicators/arrows_circle.gif";
if(!ct.controls.AutoCompleteTextboxCache){
ct.controls.AutoCompleteTextboxCache={};
}
_1c7=_1c7||{};
_1c7.queryUrl=_1c7.queryUrl||_1c6.getAttribute("queryurl")||null;
_1c7.includeKeys=_1c7.includeKeys||_1c6.hasClassName("includeKeys");
_1c7.idField=_1c7.idField||_1c6.getAttribute("idfield")||null;
_1c7.displayRowCount=parseInt(_1c7.displayRowCount||_1c6.getAttribute("displayrows")||10,10);
_1c7.minChars=parseInt(_1c7.minChars||_1c6.getAttribute("minchars")||3,10);
_1c7.selectionHandler=_1c7.selectionHandler||_1c6.getAttribute("selectionhandler")||null;
_1c7.jsfunction=_1c7.jsfunction||_1c6.getAttribute("jsfunction")||null;
_1c6.setQueryUrl=function(url){
_1c6.setAttribute("queryUrl",url);
_1c7.queryUrl=new Template(url);
};
if($(_1c6).hasClassName("forceKey")){
ct.validator.attachValidation(_1c6,"We do not have the "+_1c6.title.toLowerCase()+" you entered on record. Please pick from one of the options that appear as you type.",function(){
if($(_1c6).value===""){
return true;
}
if(_1c6.readAttribute("selfLabel")===$F(_1c6)){
return true;
}
return $(_1c7.idField).value;
});
}
if(typeof _1c7.selectionHandler==="string"){
try{
_1c7.selectionHandler=eval(_1c7.selectionHandler);
}
catch(e){
throw new Error("From ct.controls.AutoCompleteTextbox: Unable to understand the selectionhandler attribute.");
}
}
if(!_1c7.idField){
throw new Error("From ct.controls.AutoCompleteTextbox: idfield attribute not defined.");
}
if(!$(_1c7.idField)||$(_1c7.idField).id!==_1c7.idField){
_1c6.parentNode.appendChild(new Element("input",{type:"hidden",id:_1c7.idField,name:_1c7.idField}));
}
if(ct.dom.getParentByTagName(_1c6,"form")){
$(ct.dom.getParentByTagName(_1c6,"form")).observe("submit",function(_1cf){
if($(_1ca)){
_1cf.stop();
}
});
}
$(_1c6).observe("blur",function(){
if($(_1ca)){
keyEnterPress();
}
removeAutocompleteDropdown();
});
$(_1c6).observe("keypress",function(_1d0){
if($(_1ca)&&_1d0.keyCode===_1c8.enter){
_1d0.stop();
}
});
$(_1c6).observe("focus",function(_1d1){
$(_1c6).select();
});
if(_1c7.queryUrl||_1c7.jsfunction){
if(_1c7.queryUrl){
_1c7.queryUrl=new Template(_1c7.queryUrl);
}
$(_1c6).observe("keyup",function(_1d2){
var _1d3="#"+_1d2.target.readAttribute("queryUrl");
if(_1d2.keyCode!==_1c8.enter){
$(_1c7.idField).value="";
}
if($F(_1c6)===""){
removeAutocompleteDropdown();
}else{
if($F(_1c6).length>=_1c7.minChars){
var key=$F(_1c6).toLowerCase();
if(ct.controls.AutoCompleteTextboxCache[key+_1d3]){
keystrokeHandler(_1d2,ct.controls.AutoCompleteTextboxCache[key+_1d3]);
}else{
if(_1cb["#"+key]){
return;
}else{
clearTimeout(_1cc);
_1cc=setTimeout(function(){
_1cb.push("#"+key);
if(_1c7.queryUrl){
_1c6.setStyle({backgroundPosition:"center right",backgroundImage:"url(\""+_1cd+"\")",backgroundRepeat:"no-repeat"});
new Ajax.Request(_1c7.queryUrl.evaluate({q:key}),{method:"get",onSuccess:function(_1d5){
ct.controls.AutoCompleteTextboxCache[key+_1d3]=eval(_1d5.responseText);
_1cb.splice("#"+key,1);
if(key===$F(_1c6).toLowerCase()){
keystrokeHandler(_1d2,ct.controls.AutoCompleteTextboxCache[key+_1d3]);
}
_1c6.setStyle({backgroundImage:"none"});
},onFailure:function(){
ct.controls.AutoCompleteTextboxCache.splice($A(ct.controls.AutoCompleteTextboxCache).indexOf(key+_1d3),1);
}});
}else{
if(_1c7.jsfunction){
function callback(_1d6){
ct.controls.AutoCompleteTextboxCache[key+_1d3]=_1d6;
_1cb.splice("#"+key,1);
if(key===$F(_1c6).toLowerCase()){
keystrokeHandler(_1d2,ct.controls.AutoCompleteTextboxCache[key+_1d3]);
}
_1c6.setStyle({backgroundImage:"none"});
}
var _1d7=eval(_1c7.jsfunction);
_1d7(key,callback);
}
}
},200);
}
}
}
}
});
}
_1c6.setAttribute("autocomplete","off");
function keystrokeHandler(evt,data){
var _1da=null;
try{
_1da=evt.keyCode;
}
catch(e){
}
switch(_1da){
case _1c8.up:
keyUpPress();
Event.stop(evt);
break;
case _1c8.down:
keyDownPress();
Event.stop(evt);
break;
case _1c8.escape:
removeAutocompleteDropdown();
Event.stop(evt);
break;
case _1c8.enter:
if($("autocompleteOptionsContainer")){
keyEnterPress(evt);
Event.stop(evt);
}
break;
default:
showAutocompleteDropdown(filterDataset(data));
break;
}
}
function filterDataset(_1db){
return _1db;
}
function showAutocompleteDropdown(_1dc){
if(_1dc.length>0){
var _1dd;
if($(_1ca)){
while($(_1ca).firstChild){
$($(_1ca).firstChild).remove();
}
_1dd=$(_1ca);
ct.dom.removeIEIframeFix(_1dd);
}else{
_1dd=new Element("ul",{"class":"aa",style:"visibility: hidden",id:_1ca});
}
var _1de=(_1c7.displayRowCount<_1dc.length)?_1c7.displayRowCount:_1dc.length;
for(var i=0;i<_1de;i++){
var li=new Element("li",{keyName:_1dc[i].k,index:i}).update(_1dc[i].d||_1dc[i].v);
li.dataObject=Object.clone(_1dc[i]);
_1dd.appendChild(li);
}
document.body.appendChild(_1dd);
var _1e1=_1c6.cumulativeOffset();
_1dd.setStyle({top:_1e1.top+_1c6.getHeight()+"px",left:_1e1.left+"px",position:"absolute",visibility:"visible",width:_1c6.getWidth()+"px"});
ct.dom.addIEIframeFix(_1dd);
_1dd.observe("click",mouseClickHandler);
_1dd.observe("mouseover",mouseOverHandler);
highlightSelection();
}else{
$(_1c7.idField).value="";
removeAutocompleteDropdown();
}
}
function mouseClickHandler(_1e2){
if(_1e2.findElement("li")&&_1e2.findElement("li").nodeName.toLowerCase()==="li"){
_1c9=_1e2.findElement("li").getAttribute("index");
highlightSelection();
keyEnterPress();
}
_1e2.stop();
}
function mouseOverHandler(_1e3){
if(_1e3.findElement("li")&&_1e3.findElement("li").nodeName.toLowerCase()==="li"){
_1c9=_1e3.findElement("li").getAttribute("index");
highlightSelection();
}
_1e3.stop();
}
function removeAutocompleteDropdown(){
if($(_1ca)){
ct.dom.removeIEIframeFix($(_1ca));
$(_1ca).stopObserving("click",mouseClickHandler);
$(_1ca).remove();
_1c9=0;
}
}
function keyDownPress(){
_1c9++;
highlightSelection();
}
function keyUpPress(){
_1c9--;
highlightSelection();
}
function keyEnterPress(evt){
if($(_1ca)&&$(_1ca).childNodes[_1c9]){
var _1e5=$(_1ca).childNodes[_1c9];
$(_1c7.idField).value=_1e5.readAttribute("keyName");
_1c6.value=_1e5.dataObject.v;
if(_1c7.selectionHandler){
_1c7.selectionHandler(_1e5.dataObject,_1c6);
}
if(evt){
evt.stop();
}
}
removeAutocompleteDropdown();
}
function highlightSelection(){
if($(_1ca)){
var _1e6=$(_1ca).childNodes.length;
_1c9=parseInt(_1c9,10);
if(_1c9>=_1e6){
_1c9=0;
}else{
if(_1c9<0){
_1c9=_1e6-1;
}
}
$A($(_1ca).childNodes).each(function(li,_1e8){
if(_1e8===_1c9){
li.addClassName("highlight");
}else{
li.removeClassName("highlight");
}
});
}
}
},Slider:function(_1e9){
var _1ea=$(_1e9).getElementsBySelector("input[type=text]");
var _1eb=new Element("div",{"class":"track"});
_1e9.appendChild(_1eb);
var _1ec=new Element("div",{"class":"leftDisabled"}),_1ed=new Element("div",{"class":"rightDisabled"});
var _1ee=parseFloat($(_1e9).readAttribute("minvalue")||0),_1ef=parseFloat($(_1e9).readAttribute("maxvalue")||10),_1f0=parseFloat($(_1e9).readAttribute("stepvalue")||1);
var _1f1=0,_1f2=_1eb.getWidth();
var _1f3=(_1f2-_1f1)/(_1ef-_1ee);
var _1f4=Math.ceil(_1f0*_1f3);
function getSliderRange(){
var _1f5=[];
var _1f6=_1f1;
while(_1f6<_1f2){
_1f5.push(_1f6);
_1f6+=_1f4;
}
_1f5.push(_1f2);
return _1f5;
}
function scaleToInternal(_1f7){
return ((_1f7-_1ee)*_1f3);
}
function scaleToUser(_1f8){
if(_1f8===_1f1){
return _1ee;
}else{
if(_1f8===_1f2){
return _1ef;
}
}
var _1f9=(_1f8/_1f3)+_1ee;
var _1fa=_1f9%_1f0;
if(_1fa<_1f0/2){
return _1f9-_1fa;
}else{
return _1f9+(_1f0-_1fa);
}
}
_1e9.minValue=_1ee;
_1e9.maxValue=_1ef;
if(_1ea.length===1){
if(_1e9.readAttribute("highlight")&&_1e9.readAttribute("highlight").toLowerCase()==="left"){
_1eb.appendChild(_1ed);
}else{
_1ed=null;
}
if(_1e9.readAttribute("highlight")&&_1e9.readAttribute("highlight").toLowerCase()==="right"){
_1eb.appendChild(_1ec);
}else{
_1ec=null;
}
var _1fb=new Element("div",{"class":"leftHandle"});
_1eb.appendChild(_1fb);
_1e9.sliderObj=new Control.Slider(_1fb,_1eb,{axis:"horizontal",range:$R(_1f1,_1f2),sliderValue:scaleToInternal(parseFloat(_1ea[0].getAttribute("value"))),startSpan:_1ec,endSpan:_1ed,values:getSliderRange(),onChange:function(vals){
vals=scaleToUser(vals);
_1ea[0].setAttribute("value",vals);
_1ea[0].value=vals;
_1e9.values=[vals];
_1e9.fire("ctslider:onChange");
},onSlide:function(vals){
_1e9.inSlideValues=scaleToUser(vals);
_1e9.fire("ctslider:onSlide");
}});
_1e9.sliderObj.setValue([scaleToInternal(parseFloat(_1ea[0].getAttribute("value")))]);
_1e9.inSlideValues=[parseFloat(_1ea[0].value)];
}else{
if(_1ea.length===2){
var _1fe=new Element("div",{id:"rangeHandleMin1","class":"leftHandle"});
var _1ff=new Element("div",{id:"rangeHandleMax1","class":"rightHandle"});
_1eb.appendChild(_1ec);
_1eb.appendChild(_1ed);
_1eb.appendChild(_1fe);
_1eb.appendChild(_1ff);
_1e9.sliderObj=new Control.Slider([_1fe,_1ff],_1eb,{axis:"horizontal",range:$R(_1f1,_1f2),sliderValue:[scaleToInternal(_1ea[0].getAttribute("value")),scaleToInternal(_1ea[1].getAttribute("value"))],startSpan:_1ec,endSpan:_1ed,values:getSliderRange(),restricted:true,onChange:function(vals){
var min=scaleToUser(vals[0]);
var max=scaleToUser(vals[1]);
var _203=_1e9.values;
if(!_203||(_203[0]!==min||_203[1]!==max)){
_1ea[0].setAttribute("value",min);
_1ea[1].setAttribute("value",max);
_1ea[0].value=min;
_1ea[1].value=max;
_1e9.values=[min,max];
_1e9.fire("ctslider:onChange");
}
},onSlide:function(vals){
var _205=_1e9.inSlideValues;
if(!_205||(_205[0]!==scaleToUser(vals[0])||_205[1]!==scaleToUser(vals[1]))){
_1e9.inSlideValues=[scaleToUser(vals[0]),scaleToUser(vals[1])];
_1e9.fire("ctslider:onSlide");
}
}});
_1e9.setValues=function(){
var _206=_1e9.sliderObj;
var vals=[_1ea[0].getAttribute("value"),_1ea[1].getAttribute("value")];
_206.setValue(scaleToInternal(vals[0]),0);
_206.setValue(scaleToInternal(vals[1]),1);
_1e9.inSlideValues=[vals[0],vals[1]];
_1e9.fire("ctslider:onSlide");
};
_1e9.setValues();
}
}
},CurrencyDropdown:function(_208){
if(window.currencies&&!_208.loaded){
var _209=false,_20a=window.location.href.toQueryParams().currency||ct.cookies.read("currency-pref");
function addCurrency(_20b){
var _20c=new Element("option",{value:_20b.code,title:_20b.name}).update(_20b.code+" "+_20b.symbol+" - "+_20b.name);
if(_20b.code===_20a&&!_209){
ct.currentCurrency=_20b;
_20c.writeAttribute("selected","selected");
_209=true;
}
_208.appendChild(_20c);
}
$A(currencies.top).each(addCurrency);
_208.appendChild(new Element("option",{value:"",title:""}).update("----------"));
$A(currencies.all).each(addCurrency);
if(!_209){
var _20d=$(_208).getElementsByTagName("option");
for(var i=0;i<_20d.length;i++){
if(_20d[i].value==="INR"){
_20d[i].writeAttribute("selected","selected");
break;
}
}
}
$(_208).observe("change",function(){
var _20f=false;
$A(currencies.all).each(function(_210){
if(_210.code===$F(_208)){
ct.currentCurrency=_210;
ct.cookies.create("currency-pref",_210.code,365);
_20f=true;
}
});
if(!_20f){
ct.helperFunctions.resetCurrency(true);
}else{
ct.helperFunctions.logToServer("currency","changed",{to:ct.currentCurrency.code});
}
$(_208).fire("ctcurrency:change");
});
$(_208).loaded=true;
}
},ToggleTabs:function(node,_212){
var _213=[];
if(!_212){
_212={};
}
_212.currentTabClass=_212.currentTabClass||(node.readAttribute("currentTabClass")?node.readAttribute("currentTabClass"):"");
_212.deactivatedTabClass=_212.deactivatedTabClass||(node.readAttribute("deactivatedTabClass")?node.readAttribute("deactivatedTabClass"):"");
$A(node.getElementsByTagName("a")).each(function(tab){
_213.push(tab);
Event.observe(tab,"click",function(evt){
Event.stop(evt);
$A(_213).each(function(link){
link.removeClassName(_212.currentTabClass);
link.addClassName(_212.deactivatedTabClass);
$(link.readAttribute("tabId")).hide();
});
var _217=evt.target;
_217.addClassName(_212.currentTabClass);
_217.removeClassName(_212.deactivatedTabClass);
$(_217.readAttribute("tabId")).show();
});
});
},parseDomTree:function(_218){
_218=$(_218||document.body);
var _219=ct.controls;
_218.getElementsBySelector("input.datePicker").each(function(_21a){
new _219.Calendar(_21a);
});
_218.getElementsBySelector("select.airportsDropdown").each(function(_21b){
new _219.AirportsDropdown(_21b);
});
_218.getElementsBySelector("input.autocomplete").each(function(_21c){
new _219.AutoCompleteTextbox(_21c);
});
if(window.Control&&Control.Slider){
var _21d=new Date();
_218.select(".slider").each(function(_21e){
if(!_21e.sliderObj){
new _219.Slider(_21e);
}
});
console.log("Slider creation total time: ",new Date()-_21d);
}
if($("currency_dropdown")){
new ct.controls.CurrencyDropdown($("currency_dropdown"));
}
_218.getElementsBySelector("ul.toggleTabs").each(function(ul){
new ct.controls.ToggleTabs(ul);
});
}},ajaxTimeoutHandler:{onCreate:function(_220){
_220.timeoutId=window.setTimeout(function(){
if($A([1,2,3]).indexOf(parseInt(_220.transport.readyState,10))!==-1){
_220.transport.abort();
alert("The server has taken too long to respond. This might be a problem with our servers, or your Internet connection.\n\nPlease try again later.");
if(_220.options.onFailure){
_220.options.onFailure(_220.transport,_220.json);
}
}
},window["customAjaxTimeout"]?customAjaxTimeout:90000);
},onComplete:function(_221){
window.clearTimeout(_221.timeoutId);
}}};
compareDates=ct.dates.compare;
toHomeForm=ct.helperFunctions.toHomeForm;
addRooms=ct.helperFunctions.addRooms;
alterChildren=ct.helperFunctions.alterChildren;
ct.genericBlocks.hotelForm.handleCitySelection=function(data){
$("country").writeAttribute("value",data.c?data.c:"");
$("state").writeAttribute("value",data.s?data.s:"");
};
ct.controls.Calendar._markupOutlineCache=null;
ct.helperFunctions.resetCurrency(false);
var pageTracker;
(function(){
function startupCode(){
ct.domIsLoaded=true;
ct.validator._initializeForms();
ct.selfLabels.parseDomTree();
ct.bubbles.parseDomTree();
ct.stickyBlocks.parseDomTree();
ct.genericBlocks.parseDomTree();
ct.controls.parseDomTree();
Event.observe(document,"click",function(){
if($("ct_bubbleNode")){
ct.dom.removeIEIframeFix($("ct_bubbleNode"));
$("ct_bubbleNode").remove();
}
});
setTimeout(ct.helperFunctions.prefetchResources,3000);
setTimeout(function(){
var _223=document.location.toString();
_223=_223.toQueryParams();
if(_223.host){
var _224=$("AirSearch")?$("AirSearch"):$("home_hotels");
_224.action="http://"+_223.host+($("AirSearch")?"/airInterstitial":"/hotelInterstitial");
if($("offer_nav")){
$("offer_nav").select("a").each(function(link){
link.href=link.href+"?host="+_223.host;
});
}
}
},3000);
var _226=new Image();
var loc=window.location;
_226.src=loc.protocol+"//"+loc.host+"/images/elements/error_arrow.gif";
ct.cookies.erase("ct-dom-style");
var _228=new Element("script",{type:"text/javascript",src:"/javascripts/ga.js"});
document.getElementsByTagName("head")[0].appendChild(_228);
var _229=setInterval(function(){
if(window._gat&&_gat._getTracker){
clearInterval(_229);
try{
pageTracker=_gat._getTracker("UA-8292447-1");
pageTracker._initData();
pageTracker._trackPageview();
}
catch(e){
}
}
},100);
}
Event.observe(window,"load",startupCode);
Event.observe(window,"pageshow",function(evt){
if(evt.persisted){
startupCode();
}
});
})();
Ajax.Responders.register(ct.ajaxTimeoutHandler);
