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,_5){
var _6;
var _7;
if(_4){
var _8=new Date();
_8.setTime(_8.getTime()+(_4*24*60*60*1000));
_6="; expires="+_8.toGMTString();
}else{
_6="";
}
if(_5){
_7="; domain="+_5;
}else{
_7="";
}
document.cookie=_2+"="+_3+_6+_7+"; path=/";
},read:function(_9){
var _a=_9+"=";
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(_a)===0){
return c.substring(_a.length,c.length);
}
}
return null;
},erase:function(_e,_f){
ct.cookies.create(_e,"",-1,_f);
}},dates:{isValidDateString:function(_10){
var _11=/[0-9]+\/[0-9]+\/([0-9][0-9][0-9][0-9])+/;
return (_11.test(_10));
},fromString:function(_12){
var _13=_12;
var day=_13.substring(0,_13.indexOf("/"));
var _15=_13.substring(_13.indexOf("/")+1,_13.indexOf("/",_13.indexOf("/")+1));
var _16=_13.substring(_13.indexOf("/",_13.indexOf("/")+1)+1,_13.length);
if(_16.length==2){
_16="20"+_16;
}
var _17=new Date();
_17.setFullYear(parseInt(_16,10),parseInt(_15,10)-1,parseInt(day,10));
_17.setHours(0,0,0,0);
return _17;
},toString:function(_18,_19){
if(!_19){
return _18.getDate()+"/"+(_18.getMonth()+1)+"/"+_18.getFullYear();
}else{
return _18.getFullYear()+""+((_18.getMonth()+1<10)?"0"+(_18.getMonth()+1):(_18.getMonth()+1))+((_18.getDate()<10)?("0"+_18.getDate()):_18.getDate());
}
},isPast:function(_1a,_1b){
if(!_1b){
return (ct.dates.compare(_1a,new Date())===1);
}
return (ct.dates.compare(_1a,_1b)===1);
},compare:function(_1c,_1d){
if(_1c.getYear()<_1d.getYear()){
return 1;
}else{
if((_1c.getYear()==_1d.getYear())&&(_1c.getMonth()<_1d.getMonth())){
return 1;
}else{
if((_1c.getYear()==_1d.getYear())&&(_1c.getMonth()==_1d.getMonth())&&(_1c.getDate()<_1d.getDate())){
return 1;
}else{
if(_1c.getDate()==_1d.getDate()&&_1c.getMonth()==_1d.getMonth()&&_1c.getYear()==_1d.getYear()){
return 0;
}else{
return -1;
}
}
}
}
},monthNames:[ct_i18n.month.January,ct_i18n.month.February,ct_i18n.month.March,ct_i18n.month.April,ct_i18n.month.May,ct_i18n.month.June,ct_i18n.month.July,ct_i18n.month.August,ct_i18n.month.September,ct_i18n.month.October,ct_i18n.month.November,ct_i18n.month.December],monthShortNames:[ct_i18n.monthShort.January,ct_i18n.monthShort.February,ct_i18n.monthShort.March,ct_i18n.monthShort.April,ct_i18n.monthShort.May,ct_i18n.monthShort.June,ct_i18n.monthShort.July,ct_i18n.monthShort.August,ct_i18n.monthShort.September,ct_i18n.monthShort.October,ct_i18n.monthShort.November,ct_i18n.monthShort.December],dayShortNames:[ct_i18n.weekNames.tlSu,ct_i18n.weekNames.tlM,ct_i18n.weekNames.tlTu,ct_i18n.weekNames.tlW,ct_i18n.weekNames.tlTh,ct_i18n.weekNames.tlF,ct_i18n.weekNames.tlSa],getTimestamp:function(){
var _1e=new Date();
var ts=""+_1e.getHours()+_1e.getMinutes()+_1e.getSeconds()+_1e.getMilliseconds();
return ts;
},setMonth:function(_20,_21){
var _22=_20.getMonth();
_20.setMonth(_21);
_21%=12;
var _23=_20.getMonth();
if(_23===_21){
return _20;
}else{
_20.setDate(0);
return _20;
}
},fromApacheDirective:function(_24){
var _25=_24.split(" ")[1].split("-");
var _26=$A([]);
$A(ct.dates.monthNames).each(function(_27){
_27=_27.substr(0,3);
_26.push(_27);
});
return new Date(_25[2],$A(_26).indexOf(_25[1]),_25[0]);
}},isDebug:(window.location.hash.toLowerCase()==="#debug"),validator:{_attachedFields:$A([]),attachValidation:function(_28,_29,_2a,_2b){
ct.validator._attachedFields.push({field:$(_28),errorMessage:_29,condition:_2a,occuranceForms:_2b});
},_initializeForms:function(){
var _2c=$A(document.getElementsByTagName("form"));
_2c.each(function(_2d){
$(_2d).observe("submit",ct.validator._validateForm);
_2d.ct_validationFailed=true;
});
ct.validator.parseDomTree();
},classNames:{required:"required",number:"number",parsenumber:"parsenumber",password:"password",passwordOnly:"passwordOnly",email:"email",creditCardNumber:"creditCardNumber",cvvCodeCredit:"cvvCodeCredit",cvvCodeDebit:"cvvCodeDebit",calendarControl:"datePicker"},validationConditions:{requiredFieldCondition:function(_2e){
if(_2e.readAttribute("selfLabel")!==null){
return ($F(_2e)!==_2e.labelText&&$F(_2e).length!==0);
}else{
return ($F(_2e).length!==0);
}
},spaceCondition:function(_2f){
var _30=/^\s/;
var _31=_30.test($F(_2f));
return _31?false:true;
},validateNumber:function(_32){
if($F(_32)!==""){
if($(_32).readAttribute("selfLabel")===$F(_32)){
return true;
}
if(_32.readAttribute("max")||_32.readAttribute("min")){
var _33=true;
if(_32.readAttribute("max")){
_33=(parseFloat($F(_32),10)<=parseFloat(_32.readAttribute("max"),10));
}
if(_33===true&&_32.readAttribute("min")){
_33=($F(_32)>=parseFloat(_32.readAttribute("min"),10));
}
return _33;
}else{
return ($F(_32)>0);
}
}else{
return true;
}
},validateParseNumber:function(_34){
if($F(_34)!==""){
if($(_34).readAttribute("selfLabel")===$F(_34)){
return true;
}
return ($F(_34).replace(/[^0-9.]+/g,"").length==$F(_34).length);
}else{
return true;
}
},validateParseNumberDecimalLimit:function(_35){
if(($F(_35)!=="")&&($(_35).readAttribute("selfLabel")!==$F(_35))&&($F(_35).replace(/[^0-9.]+/g,"").length==$F(_35).length)){
var _36=parseInt($(_35).readAttribute("decimallimit"),10);
var _37=(($F(_35).split(".")[1])?$F(_35).split(".")[1]:"").length;
return (_37<=_36);
}else{
return true;
}
},emailCondition:function(_38){
if($F(_38)!==""){
if($F(_38)===""){
return false;
}
var _39=_38.value;
var _3a=_39.indexOf("@");
var _3b=_39.lastIndexOf(".");
var _3c=_39.indexOf(" ");
if(_3a<0||_3b<0||_3c!=-1){
return false;
}
var _3d=/^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,4}$/;
var _3e=_3d.test(_39);
return _3e?true:false;
}else{
return true;
}
},requiredDropdownCondition:function(_3f){
return (_3f.selectedIndex!==0&&_3f.selectedIndex!==-1);
},validCreditCardCondition:function(_40){
var _41=$F(_40),_42;
if(_41!==""){
if(cardtype=ct.helperFunctions.getCardType(_41)){
if(_40.readAttribute("cardtyperadio")&&(_40.readAttribute("cardtyperadio")=="true")){
if(_40.readAttribute("cardtyperadio")){
var _43=ct.dom.getParentByTagName(_40,"form")[_40.readAttribute("cardtypefieldname")];
var _44;
$A(_43).each(function(_45){
if(_45.checked){
_44=_45;
}
});
if(cardtype!=_44){
_42=false;
}
}
}
_42=true;
}else{
_42=false;
}
}else{
_42=true;
}
return _42;
},validateMobilePhoneNumberCondition:function(_46){
if($F(_46)!==""){
if(_46.readAttribute("selfLabel")===$F(_46)){
return true;
}else{
if(ct.stringFormatting.stripAlphaChars($F(_46)).length<10||ct.stringFormatting.stripAlphaChars($F(_46)).length>17){
return false;
}else{
var _47=/[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9]/;
var _48=_47.test($F(_46));
return (_48)?true:false;
}
}
}else{
return true;
}
},validateLandLanePhoneNumberCondition:function(_49){
if($F(_49)!==""){
if(_49.readAttribute("selfLabel")===$F(_49)){
return true;
}else{
if(ct.stringFormatting.stripAlphaChars($F(_49)).length>17){
return false;
}else{
var _4a=/[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9](.)*[0-9]/;
var _4b=_4a.test($F(_49));
return (_4b)?true:false;
}
}
}else{
return true;
}
},validateCvvCodeForCreditCard:function(_4c,_4d){
var _4e;
$A(document.getElementsByName(_4d)).each(function(_4f){
if(_4f.checked){
_4e=$F(_4f);
}
});
if($F(_4c)===""){
return true;
}
var re=null;
if(_4e!=="0"){
if(_4e=="3"){
re=/^\d{4}$/;
}else{
re=/^\d{3}$/;
}
return re.test($F(_4c));
}
return true;
},validateCvvCodeForDebitCard:function(_51){
if($F(_51)===""){
return true;
}
re=/^\d{3}$/;
return re.test($F(_51));
},validateDate:function(_52){
if($F(_52)!==""){
if(_52.readAttribute("selfLabel")===$F(_52)){
return true;
}else{
if((ct.dates.isValidDateString($F(_52)))){
var _53=true;
var mo,day,yy,_57;
var val=_52.value;
var _59="/";
var _5a=val.indexOf(_59);
var _5b=val.lastIndexOf(_59);
day=parseInt(val.substring(0,_5a),10);
mo=parseInt(val.substring(_5a+1,_5b),10)-1;
yy=parseInt(val.substring(_5b+1),10);
_57=new Date(yy,mo,day);
if(_57.getDate()==day){
if(_57.getMonth()==mo){
if(!_57.getFullYear()==yy){
_53=false;
}
}else{
_53=false;
}
}else{
_53=false;
}
return _53;
}else{
return false;
}
}
}else{
return true;
}
},validateMinDate:function(_5c,_5d){
if($F(_5c)===""||_5c.readAttribute("selfLabel")===$F(_5c)){
return true;
}else{
if(!_5d){
_5d=_5c.readAttribute("mindate");
}
if(_5d){
var _5e=ct.dates.fromString(_5d);
if(_5c.readAttribute("offsetdays")){
_5e.setDate(_5e.getDate()+parseInt(_5c.readAttribute("offsetdays"),10));
}
var _5f=ct.dates.compare(ct.dates.fromString($F(_5c)),_5e);
return (_5f===0)||(_5f===-1);
}else{
return true;
}
}
},validateMaxDate:function(_60){
if($F(_60)===""||_60.readAttribute("selfLabel")===$F(_60)){
return true;
}else{
if(_60.readAttribute("maxdate")){
var _61=ct.dates.fromString(_60.readAttribute("maxdate"));
var _62=ct.dates.compare(ct.dates.fromString($F(_60)),_61);
return (_62===0)||(_62===1);
}else{
return true;
}
}
}},parseDomTree:function(_63){
_63=$(_63?_63:document.body);
if(document.location.protocol==="https:"){
$(document.body).select("a.forceHttp").each(function(_64){
_64.href=_64.href.replace("https","http");
});
$(document.body).select("form.forceHttp").each(function(_65){
_65.action=_65.action.replace("https","http");
});
}
if(document.location.protocol==="http:"){
$(document.body).select("a.forceHttps").each(function(_66){
_66.href=_66.href.replace("http","https");
});
$(document.body).select("form.forceHttps").each(function(_67){
_67.action=_67.action.replace("http","https");
});
}
if($("offers_1")){
var _68=document.location.host.split(".");
if(_68[1]==="cleartripforbusiness"){
$("offers_1").select("a").each(function(_69){
if(_69.href.indexOf("javascript:void(0)")==-1){
_69.href=_69.href.replace(/.*\.cleartripforbusiness/,"http://www.cleartrip");
_69.href=_69.href+"?host="+document.location.host;
_69.target="_blank";
}
});
}
}
var _6a=$A($(_63).getElementsByTagName("input"));
_6a.each(function(_6b){
var _6c=ct.validator.attachValidation;
var _6d=ct.validator.validationConditions;
var _6e=ct.validator.classNames;
_6b=$(_6b);
if(((_6b.type.toLowerCase()==="text")||_6b.type.toLowerCase()==="password")&&_6b.hasClassName(_6e.required)){
_6c(_6b,ct_i18n.validate.requiredMsg.replace("${field}",_6b.title),_6d.requiredFieldCondition);
}
if(((_6b.type.toLowerCase()==="text")||_6b.type.toLowerCase()==="password")&&_6b.hasClassName(_6e.required)){
_6c(_6b,ct_i18n.validate.spaceStartMsg.replace("${field}",_6b.title),_6d.spaceCondition);
}
if(((_6b.type.toLowerCase()==="text")||_6b.type.toLowerCase()==="password")&&_6b.hasClassName(_6e.number)){
_6c(_6b,ct_i18n.validate.validNumberMsg.replace("${field}",_6b.title),_6d.validateNumber);
}
if(((_6b.type.toLowerCase()==="text")||_6b.type.toLowerCase()==="password")&&_6b.hasClassName(_6e.parsenumber)){
_6c(_6b,ct_i18n.validate.validNumberMsg.replace("${field}",_6b.title),_6d.validateParseNumber);
if($(_6b).readAttribute("decimallimit")){
_6c(_6b,ct_i18n.validate.validNumberDecimalLimitMsg.replace("${field}",_6b.title).replace("${decimallimit}",$(_6b).readAttribute("decimallimit")),_6d.validateParseNumberDecimalLimit);
}
}
if(_6b.type.toLowerCase()==="password"&&_6b.hasClassName(_6e.required)&&(_6b.hasClassName(_6e.password)||_6b.hasClassName(_6e.passwordOnly))){
_6c(_6b,(_6b.hasClassName(_6e.passwordOnly)?(ct_i18n.validate.passwordLengthOnlyMsg):(ct_i18n.validate.passwordLengthMsg)).replace("${field}",_6b.title),function(_6f){
if($F(_6f)===""){
return true;
}
return ($F(_6f).length>=6);
});
}
if(_6b.hasClassName(_6e.cvvCodeCredit)){
if(!_6b.readAttribute("cardtypefieldname")&&!$(_6b.readAttribute("cardtypefieldname"))){
throw new Error("cardtypefieldname attribute not specified for the cvv field. Could not attach validation.");
}else{
_6b.setAttribute("autocomplete","off");
_6c(_6b,ct_i18n.validate.ccvCodeMsg,function(_70){
return _6d.validateCvvCodeForCreditCard(_70,_70.readAttribute("cardtypefieldname"));
});
}
}
if(_6b.type.toLowerCase()==="password"&&_6b.hasClassName(_6e.cvvCodeDebit)){
_6b.setAttribute("autocomplete","off");
_6c(_6b,ct_i18n.validate.ccvCodeMsg,_6d.validateCvvCodeForDebitCard);
}
if(_6b.type.toLowerCase()==="text"&&_6b.hasClassName(_6e.email)){
_6c(_6b,ct_i18n.validate.validEmailMsg.replace("${field}",_6b.title),_6d.emailCondition);
}
if(_6b.type.toLowerCase()==="text"&&_6b.hasClassName(_6e.creditCardNumber)){
_6b.setAttribute("autocomplete","off");
_6c(_6b,ct_i18n.validate.validCcMsg.replace("${field}",_6b.title),_6d.validCreditCardCondition);
}
if(_6b.type.toLowerCase()==="text"&&_6b.hasClassName(_6e.calendarControl)){
_6c(_6b,ct_i18n.validate.validDateMsg.replace("${field}",_6b.title.toLowerCase()),_6d.validateDate);
if(_6b.readAttribute("mindate")){
var _71=ct_i18n.validate.validMinDateMsg;
_71=_71.replace("${field}",_6b.title.toLowerCase());
_71=_71.replace("${date}",_6b.readAttribute("mindate"));
_6c(_6b,_71,_6d.validateMinDate);
}else{
if(_6b.readAttribute("mindatefieldid")){
var _71;
var _72=_6b.readAttribute("offsetDays");
if(_72){
if(_72==1){
_71=ct_i18n.validate.minDateWithOffset1Msg;
}else{
_71=ct_i18n.validate.minDateWithOffsetMsg.replace("${noOfDays}",_72);
}
}else{
_71=ct_i18n.validate.validMinDateMsg;
}
_71=_71.replace("${dateField1}",_6b.title.toLowerCase());
_71=_71.replace("${dateField2}",$(_6b.readAttribute("mindatefieldid")).title.toLowerCase());
_71=_71.replace("${field}",_6b.title.toLowerCase());
_71=_71.replace("${date}",$(_6b.readAttribute("mindatefieldid")).value);
_6c(_6b,_71,function(_73){
return _6d.validateMinDate(_73,$(_6b.readAttribute("mindatefieldid")).value);
});
}
}
if(_6b.readAttribute("maxdate")){
var _71=ct_i18n.validate.validMaxDateMsg;
_71=_71.replace("${field}",_6b.title.toLowerCase());
_71=_71.replace("${date}",_6b.readAttribute("maxdate"));
_6c(_6b,_71,_6d.validateMaxDate);
}
}
if((_6b.type.toLowerCase()==="file")&&_6b.hasClassName(_6e.required)){
_6c(_6b,ct_i18n.validate.requiredMsg.replace("${field}",_6b.title),_6d.requiredFieldCondition);
}
});
var _74=$A(_63.getElementsByTagName("select"));
_74.each(function(_75){
_75=$(_75);
if(_75.hasClassName(ct.validator.classNames.required)){
ct.validator.attachValidation(_75,ct_i18n.validate.requiredMsg.replace("${field}",_75.title),ct.validator.validationConditions.requiredDropdownCondition);
}
});
var _76=$A(_63.getElementsByTagName("textarea"));
_76.each(function(_77){
_77=$(_77);
if(_77.hasClassName(ct.validator.classNames.required)){
ct.validator.attachValidation(_77,ct_i18n.validate.requiredMsg.replace("${field}",_77.title),ct.validator.validationConditions.requiredFieldCondition);
}
if((_77.type.toLowerCase()==="textarea")&&_77.hasClassName(ct.validator.classNames.required)){
ct.validator.attachValidation(_77,ct_i18n.validate.spaceStartMsg.replace("${field}",_77.title),ct.validator.validationConditions.spaceCondition);
}
});
},_validateForm:function(_78,_79){
var _7a=[],val=ct.validator;
if(_79){
var _7c=_79;
}else{
var _7c=$((this.nodeName.toLowerCase()==="form")?this:ct.dom.getParentByTagName(this,"form"));
}
$A(document.forms).each(function(_7d){
Form.getElements(_7d).each(ct.validator._hideErrorArrow);
});
_7c.ct_validationFailed=false;
var _7e=_7c.getElements();
ct.validator.errors=null;
if($("autocompleteOptionsContainer")){
_78.stop();
return;
}
_7e.each(function(_7f){
val._hideErrorArrow(_7f);
val._attachedFields.each(function(_80){
if(_80.field===_7f){
if(_80.field.disabled===true){
return;
}
if(!_80.condition(_80.field)){
_7a.push({field:_7f,message:_80.errorMessage});
_7c.ct_validationFailed=true;
val._showErrorArrow(_7f);
val.errors=_7a;
}
}
});
});
val._attachedFields.each(function(_81){
if(_81.field&&_81.field instanceof Array){
if($(_81.field[0]).up("form")&&$(_81.field[0]).up("form")==_7c){
if(_81.field.disabled!==true){
if(!_81.condition(_81.field)){
_7a.push({field:_81.field,message:_81.errorMessage});
_7c.ct_validationFailed=true;
_81.field.each(function(fld){
val._showErrorArrow(fld);
});
val.errors=_7a;
}
}
}
}
});
if(_7c.foreignValidation){
val._attachedFields.each(function(_83){
if(_83.occuranceForms&&_83.occuranceForms.indexOf(_7c)!==-1){
val._hideErrorArrow(_83.field);
if(_83.field.disabled!==true){
if(!_83.condition(_83.field)){
_7a.push({field:_83.field,message:_83.errorMessage});
_7c.ct_validationFailed=true;
val._showErrorArrow(_83.field);
val.errors=_7a;
}
}
}
});
}
if(_7c.ct_validationFailed){
if(_78.stop){
_78.stop();
}
_7c.errors=_7a;
val._showFormErrors(_7c);
}else{
_7c.errors=null;
val._hideFormErrors(_7c);
if((_7c.defaultValidationSubmit=="true")||(_7c.readAttribute("defaultValidationSubmit")=="true")||_7c.hasClassName("removeSelflabels")){
ct.selfLabels.parseDomTree(_7c,"remove");
}
}
},_showFormErrors:function(_84){
if(_84.readAttribute("errorblockid")&&$(_84.readAttribute("errorblockid"))){
var ol=$(_84.getAttribute("errorblockid")).getElementsByTagName("ol")[0];
while(ol.childNodes.length>0){
ol.removeChild(ol.childNodes[0]);
}
var _86=[];
var _87=[];
$A(_84.errors).each(function(_88){
_86.push(_88.message);
});
_87=_86.uniq();
$A(_87).each(function(_89){
ol.appendChild((new Element("li")).update(_89));
});
$(_84.readAttribute("errorblockid")).style.display="block";
if($(_84).readAttribute("noerrorfocus")!="true"&&$(_84.readAttribute("errorblockid")).positionedOffset&&$(_84.readAttribute("errorblockid")).positionedOffset()[1]){
window.scrollTo(0,$(_84.readAttribute("errorblockid")).positionedOffset()[1]);
}
}
},_hideFormErrors:function(_8a){
if(_8a.readAttribute("errorblockid")&&$(_8a.readAttribute("errorblockid"))){
$(_8a.readAttribute("errorblockid")).style.display="none";
}
},_showErrorArrow:function(_8b){
if(!_8b.previous()||!_8b.previous().hasClassName("err_arrow")){
var _8c=document.createElement("span");
$(_8c).addClassName("err_arrow");
$(_8c).innerHTML="&nbsp;";
_8b.parentNode.insertBefore(_8c,_8b);
}
},_hideErrorArrow:function(_8d){
if(_8d.previous()&&_8d.previous().hasClassName("err_arrow")){
_8d.previous().remove();
}
}},selfLabels:{addSelfLabel:function(_8e,_8f){
_8e=$(_8e);
_8e.labelText=_8f;
_8e.writeAttribute("selfLabel",_8f);
_8e.observe("focus",function(){
if($F(this)===_8f){
this.value="";
$(this).removeClassName("selflabel");
}
});
_8e.observe("blur",function(){
if($F(this)===""){
this.value=_8f;
$(this).addClassName("selflabel");
}
});
setTimeout(function(){
if($F(_8e)===""||$F(_8e)===_8f){
if(document.activeElement){
if(document.activeElement!==_8e){
_8e.value=_8f;
$(_8e).addClassName("selflabel");
}
}else{
_8e.value=_8f;
$(_8e).addClassName("selflabel");
}
}
},1000);
},removeSelfLabel:function(_90,_91){
if($F(_90)===_91){
$(_90).value="";
$(_90).removeClassName("selflabel");
}
},setSelfLabel:function(_92,_93){
if($F(_92)===""){
$(_92).value=_93;
if(!$(_92).hasClassName("selflabel")){
$(_92).addClassName("selflabel");
}
}
},parseDomTree:function(_94,_95){
_94=$(_94?_94:document.body);
if(_95){
_94.select("input[selfLabel]","textarea[selfLabel]","input[selflabel]","textarea[selflabel]").each(function(_96){
if(_95==="set"){
ct.selfLabels.setSelfLabel(_96,_96.getAttribute("selfLabel"));
}else{
ct.selfLabels.removeSelfLabel(_96,_96.getAttribute("selfLabel"));
}
});
}else{
_94.select("input[selfLabel]","textarea[selfLabel]","input[selflabel]","textarea[selflabel]").each(function(_97){
ct.selfLabels.addSelfLabel(_97,_97.getAttribute("selfLabel"));
});
}
}},bubbles:{addBehavior:function(_98,_99,_9a){
_9a=_9a?_9a:{};
_98=$(_98);
_98.href="javascript: void(0);";
var _9b;
_98.observe("click",function(_9c){
var _9d=false;
if($("ct_bubbleNode")){
if($("ct_bubbleNode").associatedLink==_98){
_9d=true;
}
ct.dom.removeIEIframeFix($("ct_bubbleNode"));
$("ct_bubbleNode").remove();
}
if(!_9d){
var _9e=new Element("a",{"class":"bubbleClose",href:"javascript: void(0);",title:ct_i18n.controls.close});
_9e.observe("click",function(){
ct.dom.removeIEIframeFix($("ct_bubbleNode"));
$(_9b).remove();
});
_9b=new Element("div",{"class":"bubble",id:"ct_bubbleNode"});
_9b.associatedLink=_98;
_9b.appendChild(new Element("div",{"class":"bubbleShadow"}));
_9b.appendChild(new Element("div",{"class":"bubbleArrow"}));
_9b.appendChild(_9e);
var _9f=new Element("div",{"class":"bubbleContentFrame"});
_9b.appendChild(_9f);
_9f.innerHTML=(new Template(_99)).evaluate(_9a);
_9b=$(_9b);
var pos=_98.cumulativeOffset();
var _a1;
if(self.innerWidth){
_a1=self.innerWidth;
}else{
if(document.documentElement&&document.documentElement.clientWidth){
_a1=document.documentElement.clientWidth;
}else{
if(document.body){
_a1=document.body.clientWidth;
}
}
}
if(parseInt(pos[0],10)>(_a1/2)){
_9b.addClassName("bubbleWrapperRight");
_9b.removeClassName("bubbleWrapperLeft");
_9b.setStyle({left:"auto",right:(_a1-parseInt(pos[0],10)-5)+"px",top:(parseInt(pos[1],10)-20)+"px"});
document.body.appendChild(_9b);
ct.dom.addIEIframeFix(_9b,[0,-10,0,10]);
}else{
_9b.addClassName("bubbleWrapperLeft");
_9b.removeClassName("bubbleWrapperRight");
_9b.setStyle({right:"auto",left:(parseInt(pos[0],10)+55)+"px",top:(parseInt(pos[1],10)-20)+"px"});
document.body.appendChild(_9b);
ct.dom.addIEIframeFix(_9b,[0,-10,0,0]);
}
_9b.observe("click",function(_a2){
if(_a2.target.tagName.toLowerCase()!=="a"){
_a2.stop();
}
});
}
_9c.stop();
});
},parseDomTree:function(_a3){
_a3=$(_a3?_a3:document.body);
_a3.getElementsBySelector("a[bubbleBlock]","a[bubbleblock]").each(function(_a4){
if($(_a4.getAttribute("bubbleBlock"))){
var _a5=$(_a4.getAttribute("bubbleBlock"));
var _a6=_a5.innerHTML;
_a5.style.display="none";
ct.bubbles.addBehavior(_a4,_a6,eval(_a4.readAttribute("substitutions")?"({"+_a4.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.",_a4);
}
});
}},dom:{getParentByTagName:function(_a7,_a8){
var _a9=Element.ancestors(_a7);
for(var i=0;i<_a9.length;i++){
if(_a9[i].nodeName.toLowerCase()===_a8.toLowerCase()){
return _a9[i];
}
}
return null;
},addIEIframeFix:function(_ab,_ac){
if(Prototype.Browser.IE&&!_ab._fixedIframe){
var _ad=document.createElement("iframe");
_ac=_ac||[0,0,0,0];
_ab=$(_ab);
_ad.frameBorder=0;
_ad.scrolling="no";
_ad.src=window.location.protocol==="https:"?"/blank.html":"about:blank";
_ad.style.position="absolute";
_ad.style.width=_ab.getWidth()+_ac[1]+"px";
_ad.style.height=_ab.getHeight()+_ac[2]+"px";
var _ae=_ab.cumulativeOffset();
_ad.style.top=_ae[1]+_ac[0]+"px";
_ad.style.left=_ae[0]+_ac[3]+"px";
_ab._fixedIframe=_ad;
document.body.appendChild(_ad);
}
},removeIEIframeFix:function(_af){
if(_af._fixedIframe){
document.body.removeChild(_af._fixedIframe);
_af._fixedIframe=null;
}
}},forms:{rememberCurrentValues:function(_b0){
$(_b0).getElements().each(function(_b1){
switch(_b1.nodeName.toLowerCase()){
case "input":
switch(_b1.type.toLowerCase()){
case "text":
_b1.oldValue=$F(_b1);
break;
case "checkbox":
case "radio":
_b1.oldValue=_b1.checked?"Y":"N";
break;
default:
break;
}
break;
case "textarea":
_b1.oldValue=$F(_b1);
break;
case "select":
_b1.oldValue=_b1.selectedIndex;
break;
}
});
},restoreOldValues:function(_b2){
$(_b2).getElements().each(function(_b3){
if(_b3.oldValue){
switch(_b3.nodeName.toLowerCase()){
case "input":
switch(_b3.type.toLowerCase()){
case "text":
_b3.value=_b3.oldValue;
break;
case "checkbox":
case "radio":
_b3.checked=(_b3.oldValue==="Y")?true:false;
break;
default:
break;
}
break;
case "textarea":
_b3.value=_b3.oldValue;
break;
case "select":
_b3.selectedIndex=_b3.oldValue;
break;
}
}
});
},populate:function(_b4,_b5){
var _b6=Form.getElements(_b4);
Object.keys(_b5).each(function(key){
_b6.each(function(_b8){
if(_b8.id===key&&_b5[key]){
if(_b8.nodeName.toLowerCase()==="input"){
switch(_b8.type.toLowerCase()){
case "text":
case "password":
case "hidden":
_b8.value=_b5[key];
break;
case "checkbox":
case "radio":
if(_b5[key].toString().toLowerCase()==="true"){
_b8.checked=true;
}else{
_b8.checked=false;
}
break;
}
}else{
if(_b8.nodeName.toLowerCase()==="select"){
for(var i=0;i<_b8.options.length;i++){
if(_b8.options[i].value.toLowerCase()===_b5[key].toString().toLowerCase()){
_b8.selectedIndex=i;
break;
}
}
}else{
if(_b8.nodeName.toLowerCase()==="textarea"){
_b8.value=_b5[key];
}
}
}
if($(_b8).hasClassName("selflabel")){
$(_b8).removeClassName("selflabel");
}
}
});
});
},addHiddenField:function(_ba,_bb,_bc,_bd){
if(_ba[_bb]&&_bd!="true"){
_ba[_bb].value=_bc;
}else{
_ba.appendChild(new Element("input",{type:"hidden",value:_bc,name:_bb}));
}
}},domIsLoaded:false,stringFormatting:{stripAlphaChars:function(_be){
var _bf=_be+"";
return _bf.replace(/[^0-9]/g,"");
},formatForCurrency:function(_c0,_c1){
var _c2="",num,dec;
var _c5="Rs.";
var _c6=1;
var _c7=1;
var _c8={ds:".",ts:",",gp:[3,2]};
function assignValues(){
if(ct.currentCurrency.symbol){
_c5=ct.currentCurrency.symbol;
}
if(ct.currentCurrency.ds){
_c8.ds=ct.currentCurrency.ds;
}
if(ct.currentCurrency.ts){
_c8.ts=ct.currentCurrency.ts;
}
if(ct.currentCurrency.gp){
_c8.gp=$A(ct.currentCurrency.gp.split(",")).each(function(_gp){
_gp=parseInt(_gp,10);
});
}
if(ct.currentCurrency.rate){
_c6=ct.currentCurrency.rate;
}
if(window.sell_currency&&window.currencies&&window.currencies.all){
$A(window.currencies.all).each(function(_ca){
if(_ca.code===window.sell_currency.code){
_c7=_ca.rate;
}
});
}
}
assignValues();
_c0=(_c0*_c7)/_c6;
if(_c1){
num=parseFloat(_c0);
num=parseInt(_c0*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(_c0),10)+"";
}
if(num.length>_c8.gp[0]){
_c2=num.substring(num.length-_c8.gp[0],num.length);
num=num.substring(0,num.length-_c8.gp[0]);
while(num.length>_c8.gp[_c8.gp.length-1]){
_c2=num.substring(num.length-_c8.gp[_c8.gp.length-1],num.length)+_c8.ts+_c2;
num=num.substring(0,num.length-_c8.gp[_c8.gp.length-1]);
}
num+=_c8.ts+_c2;
}
if(_c1){
num+=_c8.ds+dec;
}
return _c5+" "+num;
}},stickyBlocks:{_definedStickyBlocks:$A([]),makeBlockSticky:function(_cb){
ct["leftOffset"]=$(_cb).cumulativeOffset();
ct.stickyBlocks._definedStickyBlocks.push(_cb);
ct.stickyBlocks.recalculateTop(_cb);
_cb.style.zIndex="2";
},recalculateTop:function(_cc){
_cc.startTop=$(_cc).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(_cd){
var _ce=ct.stickyBlocks._calculateScrollTop();
return _ce+_cd.getDimensions().height+10>Element.cumulativeOffset($("Wrapper")).top+$("Wrapper").getDimensions().height;
},blockAtFooterHandler:function(_cf,_d0){
if(_cf.style.position!=="absolute"||_d0){
if(!Prototype.Browser.IE){
_cf.style.top=($("Wrapper").getDimensions().height-_cf.getDimensions().height-Element.cumulativeOffset($("Wrapper")).top)+"px";
}else{
_cf.style.top=($("Wrapper").getDimensions().height-_cf.getDimensions().height-Element.cumulativeOffset($("Wrapper")).top-25)+"px";
}
}
_cf.style.position="absolute";
},ifBlockIsAtTheTop:function(_d1){
var _d2=ct.stickyBlocks._calculateScrollTop();
return _d2+13<_d1.startTop;
},_previousBlockTop:0,parseDomTree:function(_d3){
_d3=$(_d3?_d3:document.body);
_d3=$(_d3?_d3:document.body);
var IE6=(navigator.userAgent.indexOf("MSIE 6")>=0)?true:false;
$A(_d3.select(".stickyBlock")).each(function(_d5){
ct.stickyBlocks.makeBlockSticky(_d5);
_d5.startTop=Element.cumulativeOffset(_d5).top;
_d5.windowResizeFix=document.viewport.getDimensions().height;
_d5.style.position="static";
_d5.observe("sticky:resize",function(){
if(ct.stickyBlocks.ifBlockIsAtTheBottom(this)){
ct.stickyBlocks.blockAtFooterHandler(this,true);
ct.stickyBlocks._previousBlockTop=(Element.cumulativeOffset(_d5).top);
}
});
Event.observe(window,"resize",function(){
if(_d5.windowResizeFix!==document.viewport.getDimensions().height){
_d5.windowResizeFix=document.viewport.getDimensions().height;
if(ct.stickyBlocks.ifBlockIsAtTheBottom(_d5)){
ct.stickyBlocks.blockAtFooterHandler(_d5,true);
ct.stickyBlocks._previousBlockTop=(Element.cumulativeOffset(_d5).top);
}
}
});
_d5.positionUpdate=function(){
stickyBlockWindowScrollHandler();
};
stickyBlockWindowScrollHandler();
fixpageshow(_d5);
});
function fixpageshow(_d6){
if(ct.stickyBlocks.ifBlockIsAtTheBottom(_d6)){
ct.stickyBlocks.blockAtFooterHandler(_d6);
window.setTimeout(function(){
ct.stickyBlocks._previousBlockTop=_d6.cumulativeOffset().top;
},20);
}
}
function _blockHeightGreater(_d7){
var _d8=($("Wrapper").cumulativeOffset().top+$("Wrapper").getDimensions().height);
var _d9=(_d7.startTop+_d7.getDimensions().height);
return (_d8<=_d9+25);
}
function _ifBlockFitsInViewPort(_da){
return _da.getDimensions().height+10<document.viewport.getHeight();
}
function stickyBlockWindowScrollHandler(){
var _db=ct.stickyBlocks._calculateScrollTop();
$A(ct.stickyBlocks._definedStickyBlocks).each(function(_dc){
if(ct.stickyBlocks.ifBlockIsAtTheTop(_dc)||_blockHeightGreater(_dc)){
_dc.style.position="static";
}else{
if(_ifBlockFitsInViewPort(_dc)){
if(ct.stickyBlocks.ifBlockIsAtTheBottom(_dc)){
ct.stickyBlocks.blockAtFooterHandler(_dc);
}else{
_dc.style.position="fixed";
_dc.style.top="0px";
if(_dc.hasClassName("bottomSticky")){
_dc.style.left=ct["leftOffset"][0]+"px";
}
if(IE6){
_dc.style.position="absolute";
_dc.style.top=(_db-$("Wrapper").cumulativeOffset().top-50)+"px";
_dc.style.left=(ct["leftOffset"][0]-45)+"px";
}
}
}else{
if(_dc.style.position==="static"){
}else{
if(ct.stickyBlocks._previousBlockTop>_db){
ct.stickyBlocks._previousBlockTop=$("filter").cumulativeScrollOffset().top;
_dc.style.top="0px";
_dc.style.position="fixed";
if(IE6){
_dc.style.position="absolute";
_dc.style.top=(_db-$("Wrapper").cumulativeOffset().top-50)+"px";
_dc.style.left=(ct["leftOffset"][0]-45)+"px";
}
}else{
if(_dc.style.position!=="absolute"){
ct.stickyBlocks._previousBlockTop=(Element.cumulativeScrollOffset(_dc).top);
_dc.style.top=(Element.cumulativeScrollOffset(_dc).top-Element.cumulativeOffset($("Wrapper")).top)+"px";
}
_dc.style.position="absolute";
}
}
}
}
});
}
Event.stopObserving(window,"scroll",stickyBlockWindowScrollHandler);
Event.observe(window,"scroll",stickyBlockWindowScrollHandler);
}},helperFunctions:{showCVVHintCc:function(_dd,_de){
$(_de).style.display="block";
switch(_dd.toLowerCase()){
case "3":
$(_de).innerHTML="<img src='/images/cvv_images/cc_amex.gif' alt='American Express Verification Code' />";
break;
default:
$(_de).innerHTML="<img src='/images/cvv_images/cvv_help.gif' alt='Credit Card Verification Code' />";
break;
}
},getCardType:function(_df){
var _e0=_df;
_e0=_df.replace(/-/g,"");
_e0=_df.replace(/ /g,"");
_df=_e0.valueOf();
if(_df===null||_df.length<13||_df.search(/[a-zA-Z]+/)!=-1){
return false;
}
var _e1=_df.split("");
_e1.reverse();
var _e2=0;
var tmp=0;
returnValue=true;
if(returnValue){
var _e4={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]},5:{identifier:[62201],length:[16,19]}};
if(typeof (maestro_bins)=="object"&&maestro_bins.length>0){
_e4["5"]["identifier"]=maestro_bins;
}
var _e5=false;
for(ruleId in _e4){
var _e6=_e4[ruleId];
if(_e6.length.indexOf(_df.length)!==-1){
for(i=0;i<_e6.identifier.length;i++){
if(_df.substr(0,(_e6.identifier[i]+"").length)==_e6.identifier[i]){
return ruleId;
break;
}
}
if(ruleId==5){
_e5="others";
}
}
}
if(_e5){
return _e5;
}else{
return false;
}
}
return false;
},showCVVHintDc:function(_e7,_e8){
$(_e8).innerHTML="<img src='/images/cvv_images/cc_visa.gif' alt='Visa Verification Code' />";
},toHomeForm:function(_e9,_ea){
ct.cookies.erase("tab");
ct.cookies.create("tab",_e9,365);
if(_ea){
window.location.href="http://"+location.host+"/index.shtml";
}
return false;
},addRooms:function(_eb,_ec,_ed){
var _ee=new Template("<tr class=\"rm_info\"><td><span class=\"roomCount\" style=\"padding-top:0px;\">Room #{num}:</span></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 _ef=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(_eb),10);
var _f1=document.getElementById("dynamic_rooms");
var tr,td,_f4,_f5,_f6;
var _f7=document.getElementsByClassName("rm_info",_f1);
var _f8=_f7.length+1;
var _f9;
var _fa;
if(_ec=="include"){
_fa=_ef;
}else{
_fa=_ee;
}
if(num>_f8){
for(var g=_f8+1;g<=num;g++){
_f9=_fa.evaluate({num:g});
if(_ed){
var _fc="";
for(var i=0;i<=_ed;i++){
_fc+="<td></td>";
}
_f9=_f9.replace("<td></td>",_fc);
}
new Insertion.Bottom(_f1,_f9);
}
}else{
if(num<_f8){
for(var h=_f8;h>num;h--){
Element.remove(_f7[h-2]);
}
}
}
},alterChildren:function(num){
var _100=$("children"+num);
var _101=_100.getElementsByTagName("option");
var _102=parseInt($F("adults"+num),10);
var _103=_101.length;
for(var q=0;q<_103;q++){
if(parseInt(_101[q].value,10)+_102>4){
_100.options[q]=null;
--_103;
--q;
}
}
var diff;
if((q-1)<(diff=4-_102)){
for(q;q<=diff;q++){
_100.options[q]=new Option(q,q);
}
}
},setSearchCookies:function(_106){
var type=_106.type;
var _108=_106.params;
var _109=Object.keys(_108);
var _10a="";
var _10b="";
var _10c="";
var _10d="";
if(type=="F"){
_10b="flight_sr";
_10d="false";
}else{
if(type=="MC_F"){
_10b="mc_flight_sr";
_10d="true";
}
}
$A(_109).each(function(key,_10f){
_10a+=((_10f==0)?"":"&")+key+"="+_108[key];
});
_10a=encodeURI(_10a);
if(window.productCode!="AG"&&window.productCode!="CP"&&(window.jsSetCookieDomain!=true)){
ct.cookies.erase(_10b);
if(_10d.length>0){
ct.cookies.erase("was_mc_search");
}
_10c=window.location.hostname;
_10c=_10c.substr(_10c.indexOf("."));
}
var _110="";
_110=window.location.hostname;
_110=_110.substr(_110.indexOf("."));
ct.cookies.erase(_10b,_110);
if(_10d.length>0){
ct.cookies.erase("was_mc_search",_110);
}
ct.cookies.create(_10b,_10a,365,_10c);
if(_10d.length>0){
ct.cookies.create("was_mc_search",_10d,365,_10c);
}
},showModalDialog:function(_111,_112,_113,_114){
var yPos;
var _116=window.pageYOffset||document.documentElement.scrollTop||0;
if(document.all){
if(self&&self.pageYOffset){
yPos=self.pageYOffset;
}else{
if(document.documentElement&&document.documentElement.scrollTop){
yPos=document.documentElement.scrollTop;
}else{
if(document.body){
yPos=document.body.scrollTop;
}
}
}
function prepareIE(_117,_118){
bod=window.top.document.getElementsByTagName("body")[0];
bod.style.height=_117;
bod.style.overflow=_118;
htm=window.top.document.getElementsByTagName("html")[0];
htm.style.height=_117;
htm.style.overflow=_118;
}
function toggleSelects(_119){
selects=window.top.document.getElementsByTagName("select");
for(i=0;i<selects.length;i++){
selects[i].style.visibility=_119;
}
}
prepareIE("100%","hidden");
window.scrollTo(0,0);
toggleSelects("hidden");
}
function resizeHandler(){
if(document.all){
try{
if(Prototype.Browser.IE){
$("TranslucentLayer").style.height=_11a+"px";
}else{
$("TranslucentLayer").style.height=(document.body.offsetHeight>_11a)?document.body.offsetHeight+"px":_11a+"px";
}
}
catch(e){
}
}
_11b.style.left=((document.body.offsetWidth-_11b.offsetWidth)/2)+"px";
}
Event.observe(window,"resize",resizeHandler);
function closePopup(){
if(document.all){
window.top.scrollTo(0,yPos);
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,_116);
}
}
ct.helperFunctions.hideModalDialog=closePopup;
var _11c=new Element("div",{id:"TranslucentLayer"});
$(_11c).observe("click",closePopup);
var _11b=new Element("div",{id:"ModalFrame"});
var _11d=new Element("div",{"class":"topBorder"});
var _11e=new Element("a",{id:"close",title:ct_i18n.controls.closeWindow});
_11d.appendChild(_11e);
_11b.appendChild(_11d);
_11b.appendChild(new Element("iframe",{src:_111,frameborder:0,framespacing:0,width:"100%",height:"100%",scrolling:_114?"no":"yes",name:"modal_window"}));
_11b.setStyle({width:(_112||"700px"),height:(_113||"70%")});
document.body.appendChild(_11c);
document.body.appendChild(_11b);
_11e.observe("click",function(){
window.top.ct.helperFunctions.hideModalDialog();
});
_11e.observe("mouseover",function(){
_11e.addClassName("over");
});
_11e.observe("mouseout",function(){
_11e.removeClassName("over");
});
_11b.style.left=((document.body.offsetWidth-_11b.offsetWidth)/2)+"px";
var _11f=_11b.getHeight();
var _11a=$(document).viewport.getHeight();
_11b.setStyle({top:(_11a-_11f)*100/(2*_11a)+"%"});
if(Prototype.Browser.IE){
_11c.style.height=_11a+"px";
}else{
_11c.style.height=(document.body.offsetHeight>_11a)?document.body.offsetHeight+"px":_11a+"px";
}
},openPopup:function(opts){
var _121=document.viewport.getDimensions();
opts=opts||{};
opts.height=opts.height||(_121.height/2);
opts.width=opts.width||(_121.width/2);
opts.left=opts.left||((_121.width-opts.width)/2);
opts.top=opts.top||((_121.height-opts.height)/2);
opts.toolbar=opts.toolbar?1:0;
opts.location=opts.location?1:0;
opts.status=opts.status?1:0;
opts.menubar=opts.menubar?1:0;
opts.scrollbars=opts.scrollbars?1:0;
opts.resizable=opts.resizable?1:0;
window.open(opts.url||"about:blank","wnd"+Math.round(Math.random()*1000),"toolbar="+opts.toolbar+",location="+opts.location+",status="+opts.status+",menubar="+opts.menubar+",scrollbars="+opts.scrollbars+",resizable="+opts.resizable+",width="+opts.width+",height="+opts.height+",left="+opts.left+",top="+opts.top);
},prefetchResources:function(){
$$("link[rel=prefetch]").each(function(link){
new Ajax.Request(link.href,{method:"get"});
});
},showThawteLogo:function(node){
var _124=new Element("iframe",{src:"/includes/thwarte-logo.html",frameBorder:0,width:"0",height:"0",scrolling:"no"});
function resizeIframe(){
var _125=_124.contentWindow.document||_124.document;
_124.style.width="100%";
_124.style.height=_125.body.scrollHeight+"px";
}
_124.onload=resizeIframe;
_124.onreadystatechange=function(){
if(_124.readyState==="complete"){
resizeIframe();
}
};
if(node){
node.appendChild(_124);
}
},logToServer:function(app,tag,data){
try{
new Ajax.Request("/urltrack/"+app+"_"+tag,{parameters:data||{},method:"get"});
}
catch(e){
}
try{
pageTracker._trackEvent(app,tag,Hash.toQueryParams(data||{}));
}
catch(e){
}
},resetCurrency:function(_129){
if(window.disp_currency){
function setDef(){
var curr=null;
if(window.currencies&&window.currencies.all&&window.sell_currency){
$A(window.currencies.all).each(function(_12b){
if(_12b.code===window.sell_currency.code){
curr=_12b;
}
});
}else{
curr={};
curr.name=window.disp_currency.code;
curr.code=window.disp_currency.code;
curr.rate=1;
curr.symbol=window.disp_currency.symbol;
if(window.disp_currency.ts&&window.disp_currency.ds&&window.disp_currency.gp){
curr.ts=window.disp_currency.ts;
curr.ds=window.disp_currency.ds;
curr.gp=window.disp_currency.gp;
}
}
return curr;
}
ct.currentCurrency=setDef();
}
if(ct.currentCurrency==null){
ct.currentCurrency={name:"Indian Rupees",code:"INR",rate:1,symbol:"Rs.",ts:",",ds:".",gp:"3,2"};
}
if(_129){
}
},trackLinkClick:function(_12c){
try{
pageTracker._trackEvent($(_12c).readAttribute("trackerCategory"),"click",$(_12c).readAttribute("tracker"));
setTimeout("window.top.location = \""+$(_12c).readAttribute("href")+"\"",100);
}
catch(err){
}
},spotNonCleartripReferrer:function(_12d){
try{
var _12e=window.location.hostname;
_12e=_12e.substr(_12e.indexOf("."));
if(_12d&&parent.document.referrer&&parent.document.referrer.indexOf("cleartrip")==-1){
ct.cookies.create("r_referer",encodeURIComponent(parent.document.referrer),null,_12e);
ct.cookies.create("r_params",encodeURIComponent(parent.window.location.search.substr(1)),null,_12e);
}else{
if(document.referrer&&document.referrer.indexOf("cleartrip")==-1){
ct.cookies.create("r_referer",encodeURIComponent(document.referrer),null,_12e);
ct.cookies.create("r_params",encodeURIComponent(window.location.search.substr(1)),null,_12e);
}
}
}
catch(e){
}
},ie9JumpList:{putUpJumpListBanner:function(_12f){
var _130="";
if(_12f){
if(window.ie9JumpListBannerMessaging){
_130=window.ie9JumpListBannerMessaging;
}else{
_130="Get closer to Cleartrip and a cool <strong>cash back of Rs.750</strong> by pinning Cleartrip to your task bar. <a href='http://marketing.cleartrip.com/offers/2011/12/mt-preview-c8db898c2aa2b5187a5970d86444af006ecb2537.php?161719' target='blank'>Click here</a> to know more.";
}
}else{
if(window.nonIe9JumpListBannerMessaging){
_130=window.nonIe9JumpListBannerMessaging;
}else{
_130="Download Internet Explorer 9 and make travel even more simple! With Internet Explorer 9 you can pin Cleartrip to your task bar and get <strong>Rs.750 cash back</strong> on your next trip! <a href='http://marketing.cleartrip.com/offers/2011/12/mt-preview-c8db898c2aa2b5187a5970d86444af006ecb2537.php?161719' target='blank'>Click here</a> to know more.";
}
}
var _131=new Element("div",{"class":"jumpListBanner Flash notice"}).update("<a href='javascript:void(0);' class='closeIt' style='float:right'>x</a><p><img src='/images/global/cleartrip_tick.gif' class='msPinSite' height='25'/><img width='18'  src='/images/elements/jl-point-arrow.png'  style='display:inline; margin:0; padding:0; padding-right:.8em;' />"+_130+"</p>");
$($$("body")[0]).insertBefore(_131,$$(".container_12")[0]);
$($(_131).select("a.closeIt")[0]).observe("click",function(){
ct.cookies.create("deleteJlBanner","true",365);
$$("div.jumpListBanner")[0].style.display="none";
});
},putUpJumpListOfferBanner:function(){
var url="/html/b2c/ie9Promo.html";
setTimeout(function(){
ct.helperFunctions.showModalDialog(url,"490px","380px","false");
},10);
},forFirstTimeJumpListUser:function(){
try{
var _133=window.location.hostname;
_133=_133.substr(_133.indexOf("."));
var _134=true;
var _135=ct.cookies.read("jlcookie");
var _136=ct.cookies.read("jlconfcookie");
if(_135&&_136){
_134=false;
}else{
if(_135==null){
ct.cookies.create("jlcookie","true",365);
}
}
if(_134){
ct.helperFunctions.ie9JumpList.putUpJumpListOfferBanner();
}
}
catch(e){
_134=false;
}
return _134;
},createBanners:function(){
try{
if(Prototype.Browser.IE&&window.external&&window.external.msIsSiteMode()==false){
if(!ct.cookies.read("deleteJlBanner")){
ct.helperFunctions.ie9JumpList.putUpJumpListBanner(true);
}
}else{
if(!ct.cookies.read("deleteJlBanner")){
ct.helperFunctions.ie9JumpList.putUpJumpListBanner();
}
}
}
catch(ex){
if(!ct.cookies.read("deleteJlBanner")){
ct.helperFunctions.ie9JumpList.putUpJumpListBanner();
}
}
},updateJumpList:function(){
try{
if(Prototype.Browser.IE&&window.external&&window.external.msIsSiteMode()==true){
var _137;
ct.helperFunctions.ie9JumpList.forFirstTimeJumpListUser();
if(window.ie9JumpListItems){
window.external.msSiteModeClearJumpList();
window.external.msSiteModeCreateJumpList(window.ie9JumpListItems.title);
$A(window.ie9JumpListItems.items).each(function(_138){
window.external.msSiteModeAddJumpListItem(_138.desc,_138.link,_138.favicon,_138.view);
});
}
}
}
catch(e){
}
}}},genericBlocks:{consentBlock:function(_139){
if($(_139).hasClassName("required")){
ct.validator.attachValidation($("consent"),ct_i18n.validate.bookPolicyMsg,function(_13a){
return (_13a.checked);
});
}
},signupBlock:function(_13b){
ct.validator.attachValidation($("confirmUname"),ct_i18n.validate.confirmEmailMsg,function(){
if($F("confirmUname")===""||$F("newUname")===""){
return true;
}
return ($F("confirmUname")===$F("newUname"));
});
},flightForm:function(_13c,_13d){
function isInternational(){
if(($F("origin_autocomplete").indexOf(", IN - ")>=0)&&($F("destination_autocomplete").indexOf(", IN - ")>=0)){
return false;
}
return true;
}
function modifyDropdowns(){
var _13e=$F("adults"),_13f=$F("children"),_140=$F("infants"),i,_142;
$A($("children").childNodes).each(Element.remove);
$A($("infants").childNodes).each(Element.remove);
for(i=0;i<=_13e;i++){
_142=new Element("option",{value:i}).update(i);
if(_140==i){
_142.setAttribute("selected","selected");
}
$("infants").appendChild(_142);
}
for(i=0;i<(10-_13e);i++){
_142=new Element("option",{value:i}).update(i);
if(_13f==i){
_142.setAttribute("selected","selected");
}
$("children").appendChild(_142);
}
}
function prepopulateForm(){
if(window.location.href.split("flights?")[1]&&window.productCode!="CP"&&window.productCode!="AG"){
var _143=decodeURIComponent(window.location.href.split("flights?")[1]);
_143=_143.gsub(/\+/," ");
var _144;
if(ct.cookies.read("flight_sr")){
_144=ct.cookies.read("flight_sr").toQueryParams("&");
}else{
_144={};
}
var _145="";
if(window.productCode!="AG"&&window.productCode!="CP"&&(window.jsSetCookieDomain!=true)){
ct.cookies.erase("flight_sr");
_145=window.location.hostname;
_145=_145.substr(_145.indexOf("."));
}
var _146="";
_146=window.location.hostname;
_146=_146.substr(_146.indexOf("."));
ct.cookies.erase("flight_sr",_146);
ct.cookies.create("flight_sr",_143,365,_145);
}
var _147=ct.cookies.read("flight_sr");
var _148=ct.cookies.read("was_oneway_click");
if(!$(_13c).hasClassName("no-action-change")){
if(window.productCode==="CP"){
_13c.action="/airInterstitial";
}else{
_13c.action="/flights/search";
}
}
if(_147){
function populateTextField(_149,_14a){
if(document.activeElement){
if(document.activeElement!==_149){
_149.value=_14a;
}
}else{
_149.value=_14a;
}
}
_147=_147.toQueryParams("&");
if((_148&&_148==="false")||(!(_148)&&((_147.rnd_one==="R")||(_147.rnd_one==="C")))){
if(_147.depart_date&&!ct.dates.isPast(ct.dates.fromString(_147.depart_date))){
populateTextField(_13c.depart_date,_147.depart_date);
}
if(_147.return_date&&!ct.dates.isPast(ct.dates.fromString(_147.return_date))){
populateTextField(_13c.return_date,_147.return_date);
}
$("rnd_trip").checked=true;
makeRoundTrip();
}else{
if((_148&&_148==="true")||(!(_148)&&(_147.rnd_one==="O"))){
$("one_way").checked=true;
makeOneWay();
if(_147.depart_date&&!ct.dates.isPast(ct.dates.fromString(_147.depart_date))){
populateTextField(_13c.depart_date,_147.depart_date);
}
}else{
if(!_147.rnd_one){
$("one_way").checked=true;
}
}
}
$(_13c.from).writeAttribute("preselect",_147.from);
if(_13c.origin){
_13c.origin.value=_147.origin||"";
}
_13c.from.value=_147.from||"";
_13c.destination.value=_147.destination||"";
_13c.to.value=_147.to||"";
_13c.adults.value=_147.adults||"1";
if(window.productCode==="AG"){
_13c.children.value=_147.children||"0";
}else{
_13c.childs.value=_147.childs||"0";
}
_13c.infants.value=_147.infants||"0";
}else{
if(_13c.origin.value===""||_13c.origin.value===_13c.origin.readAttribute("selflabel")){
if(_13c.style.display!="none"&&_13c.parentNode.style.display!="none"){
_13c.origin.focus();
}
}
if(_148){
if(_148&&_148==="false"){
$("rnd_trip").checked=true;
makeRoundTrip();
}else{
if(_148&&_148==="true"){
$("one_way").checked=true;
makeOneWay();
}
}
}else{
$("one_way").checked=true;
}
}
}
$("adults","children","infants").each(function(_14b){
$A(_14b.childNodes).each(Element.remove);
var _14c=(_14b.id==="adults")?1:0;
for(var i=_14c;i<10;i++){
_14b.appendChild(new Element("option",{value:i}).update(i));
}
});
$("adults").observe("change",modifyDropdowns);
if(!_13c.hasClassName("dontprepopulate")){
prepopulateForm();
modifyDropdowns();
}
var _14e=function(_14f,_150){
var dest=_150.destination.value;
var city=dest.split(",")[0],_153=((dest.split(",")[1]).split("-")[0]).strip();
var _154;
if($("rnd_trip").checked&&_150.return_date.value!==""&&_150.return_date.value!==_150.return_date.readAttribute("selflabel")){
if(_150.depart_date.value===_150.return_date.value){
var ret=ct.dates.fromString(_150.depart_date.value);
ret.setDate(ret.getDate()+1);
_154=ct.dates.toString(ret);
}else{
_154=_150.return_date.value;
}
}else{
var ret=ct.dates.fromString(_150.depart_date.value);
ret.setDate(ret.getDate()+2);
_154=ct.dates.toString(ret);
}
var adlt=parseInt(_150.adults.value,10);
var chld=(parseInt(_150.childs.value,10)+parseInt(_150.infants.value,10));
var _158={"city":city,"country":_153,"chk_in":_150.depart_date.value,"chk_out":_154,"num_rooms":"1","adults1":(adlt>2?2:adlt),"children1":(chld>2?2:chld)};
Object.keys(_158).each(function(key){
_14f.appendChild(new Element("input",{"type":"hidden","name":key,"value":_158[key]}));
});
ct.cookies.create("hotel_sr",$H(_158).toQueryString(),365);
};
$(_13c).observe("submit",function(_15a){
if(!(_13c.errors&&_13c.errors.length>0)&&!$(_13c).hasClassName("noCookie")){
if($("searchHotels")&&$("searchHotels").checked&&$("comboHotelSearch")&&window.productCode!=="CP"){
_14e($("comboHotelSearch"),_13c);
var _15b=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(_15b){
$("comboHotelSearch").submit();
_15b.focus();
}else{
alert("Oops.. Looks like your browser blocked our hotel search results window.");
}
}
ct.cookies.erase("was_oneway_click");
ct.cookies.create("was_mc_search","false",365);
var _15c=$(_13c).serialize();
var _15d;
if(ct.cookies.read("flight_sr")){
_15d=ct.cookies.read("flight_sr").toQueryParams("&");
}else{
_15d={};
}
var _15e="";
if(window.productCode!="AG"&&window.productCode!="CP"&&(window.jsSetCookieDomain!=true)){
ct.cookies.erase("flight_sr");
_15e=window.location.hostname;
_15e=_15e.substr(_15e.indexOf("."));
}
var _15f="";
_15f=window.location.hostname;
_15f=_15f.substr(_15f.indexOf("."));
ct.cookies.erase("flight_sr",_15f);
ct.cookies.create("flight_sr",_15c,365,_15e);
}
if(_13c.hasClassName("external_offers")&&window.productCode!=="CP"&&window.productCode!=="AG"){
_13c.action="http://www.cleartrip.com/flights/search";
}
});
if($("adv_link")){
$("adv_link").observe("click",function(_160){
setAdvCookie();
$("advanced_search1").toggle();
$("adv_link").toggleClassName("toggle_open");
$("adv_link").toggleClassName("toggle_closed");
});
}
(function(){
var _161=ct.cookies.read("adv1");
if($("adv_link")&&_161==="off"&&$("advanced_search1").style.display==="none"){
$("advanced_search1").toggle();
$("adv_link").toggleClassName("toggle_open");
$("adv_link").toggleClassName("toggle_closed");
}
})();
var _162=ct.validator.attachValidation;
_162($("destination_autocomplete"),ct_i18n.validate.orgDestSameMsg,function(){
if(($F("from")!=="")&&($F("to")!=="")){
return $F("from")!==$F("to");
}else{
return true;
}
});
_162($("infants"),ct_i18n.validate.infantAdultNumMsg,function(){
return $F("infants")<=$F("adults");
});
_162($("dpt_date"),ct_i18n.validate.intrFlightDepDate,function(){
if((!isInternational())||(!ct.validator.validationConditions.requiredFieldCondition($("origin_autocomplete"))||!ct.validator.validationConditions.requiredFieldCondition($("destination_autocomplete")))){
return true;
}else{
if(!ct.dates.isValidDateString($F("dpt_date"))){
return true;
}else{
var _163=ct.dates.fromString($("dpt_date").readAttribute("mindate"));
_163.setDate(_163.getDate()+0);
return (ct.dates.fromString($F("dpt_date"))-_163)>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($("mod_link")){
$("mod_link").observe("click",toggleModifySearch);
}
function savedSearch(){
if($("save_search")){
if($("save_search").innerHTML.length!=0){
$("save_search").remove();
}
$("save_search").toggle();
}
new Ajax.Request(savedSearchUrl,{method:"get",onSuccess:function(_164){
var _165;
eval("searchItem ="+_164.responseText);
$("Header").appendChild(new Element("div",{"id":"save_search","style":"top: 24px; left: 800px; *left: 850px;"}));
$("save_search").style.left=$("savedSearch").offsetLeft+"px";
for(var i=0;i<_165.records.length;i++){
if(_165.records[i].sc_return_date==="null"){
$("save_search").appendChild(new Element("a",{"href":"http://"+document.location.host+"/search/flights/"+_165.records[i].url}).update(_165.records[i].fromcity+" - "+_165.records[i].tocity+"<br />")).appendChild(new Element("span",{"style":"font-size:9px;color:#A3A3A3;"}).update(_165.records[i].sc_depart_date));
}else{
$("save_search").appendChild(new Element("a",{"href":"http://"+document.location.host+"/search/flights/"+_165.records[i].url}).update(_165.records[i].fromcity+" - "+_165.records[i].tocity+" - "+_165.records[i].fromcity+"<br />")).appendChild(new Element("span",{"style":"font-size:9px;color:#A3A3A3;"}).update(_165.records[i].sc_depart_date+" - "+_165.records[i].sc_return_date));
}
}
},onFailure:function(_167){
alert("Something went wrong");
}});
}
if($("savedSearch")){
$("savedSearch").observe("click",savedSearch);
}
if($("close_link")){
$("close_link").observe("click",toggleModifySearch);
}
if(!ct.genericBlocks.flightForm.helpers){
ct.genericBlocks.flightForm.helpers={};
}
var _168=ct.genericBlocks.flightForm.helpers;
function makeOneWay(){
$("rtn_date").setAttribute("disabled","disabled");
$("ret_time").setAttribute("disabled","disabled");
if($$(".Failure").length==0){
$A($("rtn_date").up("td").childNodes).each(function(elem){
if(elem.style){
elem.style.display="none";
}
});
$A($("ret_time").up("td").childNodes).each(function(elem){
if(elem.style){
elem.style.display="none";
}
});
}
}
function makeRoundTrip(){
$("rtn_date").removeAttribute("disabled");
$("ret_time").removeAttribute("disabled");
if($$(".Failure").length==0){
$A($("rtn_date").up("td").childNodes).each(function(elem){
if(elem.style){
elem.style.display="";
}
});
$A($("ret_time").up("td").childNodes).each(function(elem){
if(elem.style){
elem.style.display="";
}
});
}
}
_168.makeOneWay=makeOneWay;
_168.makeRoundTrip=makeRoundTrip;
if(_13d){
function prepareMcForm(){
if(_13d["rnd_one"][2]){
_13d["rnd_one"][2].checked=true;
}
if($$("body")[0].hasClassName("Home")){
$$("body")[0].addClassName("MultiCity");
}else{
$("modify_search_open").addClassName("MultiCity");
}
$(_13d).show();
$(_13c).hide();
$(_13c.readAttribute("errorblockid")).parentNode.style.display="none";
$(_13d.readAttribute("errorblockid")).parentNode.style.display="";
if($("offers_1")){
$("offers_1").hide();
}
if($("tipMessage")){
$("tipMessage").hide();
}
if($("alternateDates")){
$("alternateDates").hide();
}
}
_168.prepareMcForm=prepareMcForm;
if(_13c["rnd_one"][2]){
Event.observe(_13c["rnd_one"][2],"click",prepareMcForm);
}
}else{
if(_13c["rnd_one"][2]){
Event.observe(_13c["rnd_one"][2],"click",function(){
window.location.href="flights/multicity";
});
}
}
if($("one_way").checked){
makeOneWay();
}else{
if($("rnd_trip").checked){
makeRoundTrip();
}else{
makeOneWay();
}
}
function setAdvCookie(){
var _16d=ct.cookies.read("adv1");
if(_16d===""||_16d===null||_16d==="off"){
ct.cookies.erase("adv1");
ct.cookies.create("adv1","on",365);
}else{
ct.cookies.erase("adv1");
ct.cookies.create("adv1","off",365);
}
}
},MC_FlightForm:function(_16e,_16f){
if(!ct.genericBlocks.flightForm.helpers){
ct.genericBlocks.flightForm.helpers={};
}
var _170=ct.genericBlocks.flightForm.helpers;
function isInternational(){
for(var ind=1;ind<=5;ind++){
if(($("origin_autocomplete"+ind).value!=""&&$("origin_autocomplete"+ind).value!=$("origin_autocomplete"+ind).readAttribute("selflabel"))&&($("destination_autocomplete"+ind).value!=""&&$("destination_autocomplete"+ind).value!=$("destination_autocomplete"+ind).readAttribute("selflabel"))){
if((($F("origin_autocomplete"+ind).indexOf(", IN - ")>=0)&&($F("destination_autocomplete"+ind).indexOf(", IN - ")>=0))){
}else{
return true;
}
}
}
return false;
}
function isEmpty(_172){
if(_172.readAttribute("selflabel")){
if(_172.value===""||_172.value===_172.readAttribute("selflabel")){
return true;
}
}else{
if(_172.value===""){
return true;
}
}
return false;
}
function fromToBlurs(evt){
var ind=this.id.charAt(this.id.length-1);
if(isEmpty($("origin_autocomplete"+ind))&&isEmpty($("destination_autocomplete"+ind))){
$("dpt_date_"+ind).disabled=true;
}else{
$("dpt_date_"+ind).disabled=false;
}
}
function checkGroupedElements(ind,_176){
if(isEmpty($("origin_autocomplete"+ind))&&isEmpty($("destination_autocomplete"+ind))&&(isEmpty($("dpt_date_"+ind))||$("dpt_date_"+ind).disabled)){
if((ind==3)){
if(isEmpty($("origin_autocomplete"+(_176+1)))&&isEmpty($("destination_autocomplete"+(_176+1)))&&(isEmpty($("dpt_date_"+(_176+1)))||$("dpt_date_"+(_176+1)).disabled)&&isEmpty($("origin_autocomplete"+(_176+2)))&&isEmpty($("destination_autocomplete"+(_176+2)))&&(isEmpty($("dpt_date_"+(_176+2)))||$("dpt_date_"+(_176+2)).disabled)){
return true;
}else{
return false;
}
}else{
if(ind==4){
if(isEmpty($("origin_autocomplete"+(_176+1)))&&isEmpty($("destination_autocomplete"+(_176+1)))&&(isEmpty($("dpt_date_"+(_176+1)))||$("dpt_date_"+(_176+1)).disabled)){
return true;
}else{
return false;
}
}else{
return true;
}
}
}else{
return false;
}
}
function modifyDropdowns(){
var _177=$F("mc_adults"),_178=$F("mc_children"),_179=$F("mc_infants"),i,_17b;
$A($("mc_children").childNodes).each(Element.remove);
$A($("mc_infants").childNodes).each(Element.remove);
for(i=0;i<=_177;i++){
_17b=new Element("option",{value:i}).update(i);
if(_179==i){
_17b.setAttribute("selected","selected");
}
$("mc_infants").appendChild(_17b);
}
for(i=0;i<(10-_177);i++){
_17b=new Element("option",{value:i}).update(i);
if(_178==i){
_17b.setAttribute("selected","selected");
}
$("mc_children").appendChild(_17b);
}
}
function prepopulateForm(){
for(var i=3;i<=5;i++){
_16e["depart_date_"+i].disabled=true;
}
var _17d=ct.cookies.read("mc_flight_sr");
if(window.productCode=="AG"){
_16e.action="/flights/search";
}
if(_17d){
function populateTextField(_17e,_17f){
if(document.activeElement){
if(document.activeElement!==_17e){
_17e.value=_17f;
}
}else{
_17e.value=_17f;
}
}
_17d=_17d.toQueryParams("&");
for(var i=1;i<=5;i++){
if(_17d["depart_date_"+i]&&_17d["depart_date_"+i]!=_16e["depart_date_"+i].readAttribute("selflabel")&&!ct.dates.isPast(ct.dates.fromString(_17d["depart_date_"+i]))){
_16e["depart_date_"+i].disabled=false;
populateTextField(_16e["depart_date_"+i],_17d["depart_date_"+i]);
}
$(_16e["from"+i]).writeAttribute("preselect",_17d["from"+i]);
if(_16e["origin"+i]){
if(_17d["origin"+i]&&_17d["origin"+i]!=_16e["origin"+i].readAttribute("selflabel")){
_16e["origin"+i].value=_17d["origin"+i];
}
}
if(_17d["destination"+i]&&_17d["destination"+i]!=_16e["destination"+i].readAttribute("selflabel")){
_16e["destination"+i].value=_17d["destination"+i];
}
_16e["from"+i].value=_17d["from"+i]||"";
_16e["to"+i].value=_17d["to"+i]||"";
if(_17d["dpt_time_"+i]&&_16e["dpt_time_"+i]){
_16e["dpt_time_"+i].value=_17d["dpt_time_"+i];
}
}
_16e.adults.value=_17d.adults||"1";
_16e.childs.value=_17d.childs||"0";
_16e.infants.value=_17d.infants||"0";
if((!($$("body.Home")[0])||$("cities_error"))&&_16f&&ct.cookies.read("was_mc_search")==="true"){
_170.prepareMcForm();
}
}else{
if(_16e["origin1"].value===""||_16e["origin1"].value===_16e["origin1"].readAttribute("selflabel")){
if(_16e.style.display!="none"&&_16e.parentNode.style.display!="none"){
_16e["origin1"].focus();
}
}
}
}
$("mc_adults","mc_children","mc_infants").each(function(_180){
$A(_180.childNodes).each(Element.remove);
var _181=(_180.id==="mc_adults")?1:0;
for(var i=_181;i<10;i++){
_180.appendChild(new Element("option",{value:i}).update(i));
}
});
$("mc_adults").observe("change",modifyDropdowns);
if(_16f){
function prepareMainForm(_183){
_183.checked=true;
if($$("body")[0].hasClassName("Home")){
$$("body")[0].removeClassName("MultiCity");
}else{
$("modify_search_open").removeClassName("MultiCity");
}
$(_16e).hide();
$(_16f).show();
$(_16e.readAttribute("errorblockid")).style.display="none";
$(_16f.readAttribute("errorblockid")).style.display="";
if($("offers_1")){
$("offers_1").show();
}
if($("tipMessage")){
$("tipMessage").show();
}
if($("alternateDates")){
$("alternateDates").show();
}
}
_170.prepareMainForm=prepareMainForm;
Event.observe(_16e["rnd_one"][0],"click",function(){
prepareMainForm(_16f["rnd_one"][0]);
_170.makeRoundTrip();
});
Event.observe(_16e["rnd_one"][1],"click",function(){
prepareMainForm(_16f["rnd_one"][1]);
_170.makeOneWay();
});
}else{
Event.observe(_16e["rnd_one"][0],"click",function(){
ct.cookies.create("was_oneway_click","false",1);
window.location.href="../flights";
});
Event.observe(_16e["rnd_one"][1],"click",function(){
ct.cookies.create("was_oneway_click","true",1);
window.location.href="../flights";
});
}
if(!_16e.hasClassName("dontprepopulate")){
prepopulateForm();
modifyDropdowns();
}
$(_16e).observe("submit",function(_184){
if(!(_16e.errors&&_16e.errors.length>0)&&!$(_16e).hasClassName("noCookie")){
var _185="";
if(window.productCode!="AG"&&window.productCode!="CP"&&(window.jsSetCookieDomain!=true)){
ct.cookies.erase("mc_flight_sr");
_185=window.location.hostname;
_185=_185.substr(_185.indexOf("."));
}
var _186="";
_186=window.location.hostname;
_186=_186.substr(_186.indexOf("."));
ct.cookies.erase("mc_flight_sr",_186);
ct.cookies.create("mc_flight_sr",$(_16e).serialize(),365,_185);
ct.cookies.create("was_mc_search","true",365);
}
if(_16e.hasClassName("external_offers")&&(window.productCode!=="AG"&&window.productCode!=="CP")){
_16e.action="http://www.cleartrip.com/flights/search";
}
});
var _187=ct.validator.attachValidation;
for(var i=3;i<=5;i++){
_187($("origin_autocomplete"+i),ct_i18n.validate.requiredMsg.replace("${field}",$("origin_autocomplete"+i).title),function(_189){
var ind=_189.id.charAt(_189.id.length-1);
var _18b=parseInt(ind,10);
if(checkGroupedElements(ind,_18b)){
return true;
}else{
if(isEmpty($("origin_autocomplete"+ind))){
return false;
}
return true;
}
});
_187($("destination_autocomplete"+i),ct_i18n.validate.requiredMsg.replace("${field}",$("destination_autocomplete"+i).title),function(_18c){
var ind=_18c.id.charAt(_18c.id.length-1);
var _18e=parseInt(ind,10);
if(checkGroupedElements(ind,_18e)){
return true;
}else{
if(isEmpty($("destination_autocomplete"+ind))){
return false;
}
return true;
}
});
_187($("dpt_date_"+i),ct_i18n.validate.requiredMsg.replace("${field}",$("dpt_date_"+i).title),function(_18f){
var ind=_18f.id.charAt(_18f.id.length-1);
var _191=parseInt(ind,10);
if(checkGroupedElements(ind,_191)){
return true;
}else{
if(isEmpty($("dpt_date_"+ind))){
return false;
}
return true;
}
});
}
for(var i=1;i<=5;i++){
_187($("destination_autocomplete"+i),ct_i18n.validate.orgDestSameMsg,function(_192){
var ind=_192.id.charAt(_192.id.length-1);
if(($F("from"+ind)!=="")&&($F("to"+ind)!=="")){
return $F("from"+ind)!==$F("to"+ind);
}else{
return true;
}
});
_187($("dpt_date_"+i),ct_i18n.validate.intrFlightDepDate,function(_194){
var ind=_194.id.charAt(_194.id.length-1);
if(!ct.dates.isValidDateString($F("dpt_date_"+ind))){
return true;
}else{
var _196="";
if($("dpt_date_"+ind).readAttribute("mindate")){
_196=ct.dates.fromString($("dpt_date_"+ind).readAttribute("mindate"));
}else{
if($("dpt_date_"+ind).readAttribute("mindatefieldid")&&$($("dpt_date_"+ind).readAttribute("mindatefieldid"))&&$($("dpt_date_"+ind).readAttribute("mindatefieldid")).value!=""&&ct.dates.isValidDateString($($("dpt_date_"+ind).readAttribute("mindatefieldid")))&&!ct.dates.isPast($($("dpt_date_"+ind).readAttribute("mindatefieldid")))){
_196=ct.dates.fromString($($("dpt_date_"+ind).readAttribute("mindatefieldid")).value);
}
}
if(_196){
if(ind==1&&isInternational()){
_196.setDate(_196.getDate()+0);
this.message=ct_i18n.validate.intrFlightDepDate;
return (ct.dates.fromString($F("dpt_date_"+ind))-_196)>0;
}else{
if(ind!=1){
this.message=ct_i18n.validate.validMinDateMsg.replace("${field}",_194.title.toLowerCase()).replace("${date}",_194.readAttribute("mindate"));
return (ct.dates.fromString($F("dpt_date_"+ind))-_196)>=0;
}else{
return true;
}
}
}else{
return true;
}
}
});
if(i!=1){
Event.observe($("origin_autocomplete"+i),"focus",function(evt){
var ind=this.id.charAt(this.id.length-1);
var _199=$("destination_autocomplete"+(parseInt(ind,10)-1));
if((this.value==""||this.value===this.readAttribute("selflabel"))&&(_199&&_199.value!=""&&_199.value!=_199.readAttribute("selflabel"))){
Event.stop(evt);
this.value=_199.value;
$("from"+ind).value=$("to"+(parseInt(ind,10)-1)).value;
}
});
}
if(i!=1&&i!=2){
Event.observe($("origin_autocomplete"+i),"blur",fromToBlurs);
Event.observe($("destination_autocomplete"+i),"blur",fromToBlurs);
}
}
_187($("infants"),ct_i18n.validate.infantAdultNumMsg,function(){
return $F("infants")<=$F("adults");
});
},hotelForm:function(_19a){
ct.validator.attachValidation($("rooms"),ct_i18n.validate.noOfRoomsMsg,function(){
var _19b=parseInt($F("rooms"),10);
for(var i=0;i<_19b;i++){
if($("adults"+(i+1))===null||$("children"+(i+1))===null){
return false;
}
}
return true;
});
if(!_19a.hasClassName("dontprepopulate")){
(function(){
if(window.location.href.split("hotels/?")[1]){
var _19d=decodeURIComponent(window.location.href.split("hotels/?")[1]);
_19d=_19d.gsub(/\+/," ");
ct.cookies.create("hotel_sr",_19d,365);
}
if(ct.cookies.read("hotel_sr")&&!(_19a.id==="fetch_rates")){
var _19e=ct.cookies.read("hotel_sr").toQueryParams("&");
_19a.city.value=_19e.city||"";
_19a.state.value=_19e.state||"";
_19a.country.value=_19e.country||"";
_19a.dest_code.value=_19e.dest_code||"";
if(_19e.chk_in&&!ct.dates.isPast(ct.dates.fromString(_19e.chk_in))){
_19a.chk_in.value=_19e.chk_in;
}
if(_19e.chk_out&&!ct.dates.isPast(ct.dates.fromString(_19e.chk_out))){
_19a.chk_out.value=_19e.chk_out;
}
$("rooms").value=_19e.num_rooms||"1";
if($("showDebug")&&_19e.showDebug){
$("showDebug").checked=true;
}
if($("NonResident2")!==null&&$("NonResident2")!==undefined){
$("NonResident2").checked=false;
}
ct.helperFunctions.addRooms(_19a.num_rooms);
switch(_19e.num_rooms){
case "1":
case "2":
case "3":
case "4":
$("adults1").value=_19e.adults1||"1";
$("children1").value=_19e.children1||"0";
alterChildren("1");
if(_19e.num_rooms=="1"){
break;
}
case "2":
case "3":
case "4":
$("adults2").value=_19e.adults2||"1";
$("children2").value=_19e.children2||"0";
alterChildren("2");
if(_19e.num_rooms=="2"){
break;
}
case "3":
case "4":
$("adults3").value=_19e.adults3||"1";
$("children3").value=_19e.children3||"0";
alterChildren("3");
if(_19e.num_rooms=="3"){
break;
}
case "4":
$("adults4").value=_19e.adults4||"1";
$("children4").value=_19e.children4||"0";
alterChildren("4");
break;
}
}
})();
}
$(_19a).observe("submit",function(_19f){
if(!_19a.errors){
var _1a0=false;
if($("NonResident2")!==null&&$("NonResident2")!==undefined&&$("NonResident2").checked){
_1a0=true;
}
if(!$(_19a).hasClassName("no-action-change")){
if($F("dest_code")==="WCT"||_1a0){
if(window.productCode==="CP"){
_19a.action="hotelInterstitial";
}else{
_19a.action="/hotels/search";
}
}else{
if($("price_form")){
_19a.action=$("price_form").value;
}else{
if(window.productCode==="CP"){
_19a.action="hotelInterstitial";
}else{
_19a.action="/hotels/search";
}
}
if(_19a.readAttribute("campaign")){
_19a.action+="?campaign="+_19a.readAttribute("campaign");
}
}
}
if($F("dest_code")=="WCT"||_1a0){
var _1a1=$("checkin_date").value.split("/");
$("doa_dd").value=_1a1[0];
$("doa_mm").value=_1a1[1];
$("doa_yy").value=_1a1[2];
var _1a2=$("checkout_date").value.split("/");
$("dod_dd").value=_1a2[0];
$("dod_mm").value=_1a2[1];
$("dod_yy").value=_1a2[2];
var _1a3=$F("rooms");
var _1a4=0;
var _1a5=0;
for(var a=0;a<parseInt(_1a3,10);a++){
_1a4+=parseInt(_19a["adults"+(a+1)].value,10);
_1a5+=parseInt(_19a["children"+(a+1)].value,10);
}
$("num_adults").value=Math.ceil(_1a4/parseInt(_1a3,10));
$("num_children").value=Math.ceil(_1a5/parseInt(_1a3,10));
}
ct.cookies.create("hotel_sr",$(_19a).serialize(),365);
if(_19a.id==="fetch_rates"){
$("wait_img").show();
Event.stop(_19f);
var _1a7=window.location.href;
var _1a8="/hotels/roomrates";
if(_1a7.indexOf("allowed_form")!=-1){
_1a8=_1a8+"?allowed_form=true";
}
new Ajax.Request(_1a8,{method:"get",parameters:$(_19a.id).serialize()+"&ts="+ct.dates.getTimestamp(),onSuccess:function(_1a9){
_19a.enable();
$("wait_img").hide();
if(_1a9.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=_1a9.responseText;
_19a.hide();
}
if(window.Effect){
new Effect.Appear("RoomRatesTable");
}else{
$("RoomRatesTable").style.display="block";
}
},onFailure:function(_1aa){
$("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.");
}});
_19a.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(_1ab){
var _1ac=ct.validator.attachValidation;
_1ac($("train_adults"),ct_i18n.validate.maxPassengersMsg,function(){
return (+$F("train_adults")+(+$F("train_children"))+(+$F("train_male_seniors"))+(+$F("train_female_seniors")))<=6;
});
_1ac($("train_adults"),ct_i18n.validate.minPassengersMsg,function(){
return (+$F("train_adults")+(+$F("train_children"))+(+$F("train_male_seniors"))+(+$F("train_female_seniors")))>0;
});
_1ac($("to_station"),ct_i18n.validate.orgDestSameMsg,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 _1ad=decodeURIComponent(window.location.href.split("trains#")[1]);
_1ad=_1ad.gsub(/\+/," ");
ct.cookies.create("train_sr",_1ad,365);
}
var _1ae=ct.cookies.read("train_sr");
if(_1ae){
function populateTextField(_1af,_1b0){
if(document.activeElement){
if(document.activeElement!==_1af){
_1af.value=_1b0;
}
}else{
_1af.value=_1b0;
}
}
_1ae=_1ae.toQueryParams("&");
if(_1ae.from_station){
populateTextField(_1ab.from_station,_1ae.from_station);
}
if(_1ae.to_station){
populateTextField(_1ab.to_station,_1ae.to_station);
}
if(_1ae.depart_date&&!ct.dates.isPast(ct.dates.fromString(_1ae.depart_date))){
populateTextField(_1ab.depart_date,_1ae.depart_date);
}
_1ab.adults.value=_1ae.adults||"1";
_1ab.children.value=_1ae.children||"0";
_1ab.male_seniors.value=_1ae.male_seniors||"0";
_1ab.female_seniors.value=_1ae.female_seniors||"0";
_1ab["train[class]"].value=_1ae["train[class]"]||"";
}
}
if(!_1ab.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);
}
$(_1ab).observe("submit",function(){
ct.cookies.create("train_sr",$(_1ab).serialize(),365);
});
},primaryNavFlyoutMenu:function(){
if($("MainTabs")||$("PrimeMainTabs")){
if(window.productCode==="CP"){
var _1b1=$($("MainTabs").getElementsByTagName("li")[6]);
}else{
if(window.productCode==="AG"){
var _1b1=$($("PrimeMainTabs").getElementsByTagName("li")[2]);
}else{
var _1b1=$($("MainTabs").getElementsByTagName("li")[4]);
}
}
if($("more_menu")){
$("more_menu").setStyle({top:(_1b1.cumulativeOffset().top+_1b1.getHeight()+((window.productCode==="AG")?((Prototype.Browser.IE)?1:0):6))+"px",left:_1b1.cumulativeOffset().left+"px"});
$(_1b1.getElementsByTagName("a")[0]).observe("click",function(evt){
if($("more_menu").style.display==="none"){
$("more_menu").style.display="block";
$(_1b1).addClassName("show_menu");
ct.dom.addIEIframeFix($("more_menu"));
}else{
$("more_menu").style.display="none";
ct.dom.removeIEIframeFix($("more_menu"));
$(_1b1).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"));
$(_1b1).removeClassName("show_menu");
}
});
}
}
},accountFlyoutHTML:function(){
var _1b3=new Element("div",{"id":"AccountMenu"});
var _1b4=new Element("ul");
var _1b5=new Element("li").update("<a href=\"/account/trips/list\">Upcoming Trips</a>");
_1b4.appendChild(_1b5);
_1b5=new Element("li").update("<a href=\"/account/profile\">My Profile</a>");
_1b4.appendChild(_1b5);
_1b5=new Element("li").update("<a href=\"/account/preferences\">My Preferences</a>");
_1b4.appendChild(_1b5);
_1b3.appendChild(_1b4);
_1b3.insert("<hr/>");
_1b4=new Element("ul");
_1b5=new Element("li").update("<a href=\"/signout\">Sign out</a>");
_1b4.appendChild(_1b5);
_1b3.appendChild(_1b4);
return _1b3;
},accountFlyoutMenu:function(){
if($("global")){
if($("AccountMenuLink")){
var _1b6=$("AccountMenuLink");
document.body.appendChild(new Element("div",{"id":"AccountMenu","style":"display:none"}));
if($("PrimaryIconNavigation")){
$("AccountMenu").setStyle({top:($(_1b6).cumulativeOffset().top+$(_1b6).getHeight()+12)+"px",left:($(_1b6).cumulativeOffset().left+($("global").select("li")[1].getWidth()-25))+"px"});
}
var _1b7=ct.genericBlocks.accountFlyoutHTML();
$("AccountMenu").insert(_1b7.innerHTML);
$(_1b6).observe("click",function(evt){
if($("AccountMenu").style.display==="none"){
$("AccountMenu").style.display="block";
$(_1b6).addClassName("on");
ct.dom.addIEIframeFix($("AccountMenu"));
}else{
$(_1b6).removeClassName("on");
ct.dom.removeIEIframeFix($("AccountMenu"));
$("AccountMenu").style.display="none";
}
if($("DomainOptions")){
if($("DomainOptions").style.display=="block"){
$("DomainOptions").style.display="none";
ct.dom.removeIEIframeFix($("DomainOptions"));
$("SetDomain").removeClassName("on");
}
}
evt.stop();
});
Event.observe(document,"click",function(evt){
if($("AccountMenu").style.display==="block"){
$("AccountMenu").style.display="none";
ct.dom.removeIEIframeFix($("AccountMenu"));
$(_1b6).removeClassName("on");
}
});
Event.observe(window,"resize",function(){
if($("PrimaryIconNavigation")){
$("AccountMenu").setStyle({top:($(_1b6).cumulativeOffset().top+$(_1b6).getHeight()+12)+"px",left:($(_1b6).cumulativeOffset().left+($("global").select("li")[1].getWidth()-25))+"px"});
if($("AccountMenu").style.display=="block"){
$(_1b6).addClassName("on");
}
}
});
}
}
},languageFlyoutMenu:function(){
if($("SetDomain")){
var _1ba=document.location.hostname;
var flg="in";
var _1bc="";
var _1bd=["bh","qa","kw","om"];
var _1be=function(){
var url="/countryPicker?cn="+flg.toUpperCase();
if(window.sourceCountry){
url+="&preselect=true&sourceCountry="+window.sourceCountry;
window.sourceCountry=false;
}
setTimeout(function(){
ct.helperFunctions.showModalDialog(url,((Prototype.Browser.IE)?"541px":"540px"),"440px","false");
},10);
};
if(_1bd.indexOf(_1ba.split(".")[0].substr(0,2))!=-1){
_1bc=_1bd[_1bd.indexOf(_1ba.split(".")[0].substr(0,2))];
}
if(_1ba.split(".").length==3){
if(_1bc){
flg=_1bc;
}else{
if(_1ba.split(".")[2]=="com"){
flg="in";
}else{
flg=_1ba.split(".")[2];
}
}
}
$("SetDomain").className="flag "+flg.toUpperCase();
$("SetDomain").observe("click",_1be);
if(window.sourceCountry){
_1be();
}
}
},parseDomTree:function(_1c0){
_1c0=_1c0||document.body;
$(document.body).select(".consent").each(ct.genericBlocks.consentBlock);
$(document.body).select(".loginBlock").each(ct.genericBlocks.signupBlock);
if(window.searchCookieParams){
ct.helperFunctions.setSearchCookies(window.searchCookieParams);
}
if($("AirSearch")&&$("MC_AirSearch")){
ct.genericBlocks.flightForm($("AirSearch"),$("MC_AirSearch"));
ct.genericBlocks.MC_FlightForm($("MC_AirSearch"),$("AirSearch"));
}else{
if($("MC_AirSearch")){
ct.genericBlocks.MC_FlightForm($("MC_AirSearch"));
}else{
if($("AirSearch")){
ct.genericBlocks.flightForm($("AirSearch"));
}
}
}
if($("modify_air_search")&&$("modify_MC_AirSearch")){
ct.genericBlocks.flightForm($("modify_air_search"),$("modify_MC_AirSearch"));
ct.genericBlocks.MC_FlightForm($("modify_MC_AirSearch"),$("modify_air_search"));
}else{
if($("modify_MC_AirSearch")){
ct.genericBlocks.MC_FlightForm($("modify_MC_AirSearch"));
}else{
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);
setTimeout(ct.genericBlocks.languageFlyoutMenu,1);
setTimeout(ct.genericBlocks.accountFlyoutMenu,1);
}},controls:{Calendar:function(_1c1,_1c2){
var _1c3=$(document.createElement("a"));
var self=this,_1c5;
if(!_1c2){
_1c2={};
}
_1c2.firstDayOfWeek=_1c2.firstDayOfWeek||(_1c1.readAttribute("firstday")?parseInt(_1c1.readAttribute("firstday"),10):1);
_1c2.minDate=_1c2.minDate||(_1c1.readAttribute("mindate")?ct.dates.fromString(_1c1.readAttribute("mindate")):new Date());
_1c2.minDateField=_1c2.minDateField||(_1c1.readAttribute("mindatefieldid")?$(_1c1.readAttribute("mindatefieldid")):null);
_1c2.calendarCount=_1c2.calendarCount||(_1c1.readAttribute("calendarcount")?parseInt(_1c1.readAttribute("calendarcount"),10):2);
_1c2.maxDate=_1c2.maxDate||(_1c1.readAttribute("maxdate")?ct.dates.fromString(_1c1.readAttribute("maxdate")):(new Date(new Date(_1c2.minDate).setFullYear(_1c2.minDate.getFullYear()+1))));
_1c2.offsetDays=_1c2.offsetDays||(_1c1.readAttribute("offsetdays")?parseInt(_1c1.readAttribute("offsetdays"),10):0);
_1c2.defaultDate=_1c2.defaultDate||(_1c1.readAttribute("defaultdate")?ct.dates.fromString(_1c1.readAttribute("defaultdate")):null);
var _1c6=null;
(function(){
if(!_1c1.readAttribute("size")){
_1c1.writeAttribute("size",10);
}
_1c1.writeAttribute("maxdate",ct.dates.toString(_1c2.maxDate));
ct.selfLabels.addSelfLabel(_1c1,"dd/mm/yyyy");
if(_1c1.nextSibling){
_1c1.parentNode.insertBefore(_1c3,_1c1.nextSibling);
}else{
_1c1.parentNode.appendChild(_1c3);
}
_1c3.href="javascript: void(0);";
_1c3.className="cal_openLink";
var _1c7=document.createElement("img");
_1c7.alt="Calendar";
_1c7.title="Click to open calendar";
_1c7.src="/images/global/calendar_icon.gif";
_1c3.appendChild(_1c7);
_1c3.observe("click",function(_1c8){
self.showDatePicker();
Event.stop(_1c8);
});
_1c1.observe("focus",function(_1c9){
self.showDatePicker();
});
_1c1.observe("click",function(_1ca){
Event.stop(_1ca);
});
_1c6=getMinDate();
})();
if(_1c2.minDateField&&$(_1c2.minDateField)){
$(_1c2.minDateField).observe("ctCalendar:onChange",function(){
if(!_1c1.hasClassName("no_autochange")){
var _1cb=ct.dates.fromString($F(_1c2.minDateField));
_1cb.setDate(_1cb.getDate()+2);
_1c1.value=ct.dates.toString(_1cb);
}
});
}
function getCalendarTableMarkup(){
var doc=document,ce="createElement",sa="setAttribute",ac="appendChild";
function addCol(_1d0,_1d1){
for(var i=0;i<_1d1;i++){
_1d0[ac](doc[ce]("col"));
}
}
var _1d3=doc[ce]("table");
_1d3[sa]("cellpadding","0");
_1d3[sa]("cellspacing","0");
_1d3[sa]("border","0");
var _1d4=doc[ce]("colgroup");
addCol(_1d4,5);
_1d3[ac](_1d4);
_1d4=doc[ce]("colgroup");
_1d4.className="weekend";
addCol(_1d4,2);
_1d3[ac](_1d4);
var _1d5=doc[ce]("thead");
var _1d6=doc[ce]("tr");
var _1d7=[ct_i18n.weekNames.slSu,ct_i18n.weekNames.slM,ct_i18n.weekNames.slTu,ct_i18n.weekNames.slW,ct_i18n.weekNames.slTh,ct_i18n.weekNames.slF,ct_i18n.weekNames.slSa];
var _1d8=doc[ce]("tr");
var _1d9=_1c2.firstDayOfWeek;
var _1da=doc[ce]("th");
_1da[sa]("colSpan","7");
$(_1da).addClassName("month");
_1d6[ac](_1da);
for(var i=0;i<7;i++){
_1d9=_1d9%7;
var _1dc=doc[ce]("th");
if(i===5||i===6){
_1dc.className="weekend";
}
_1dc[ac](doc.createTextNode($A(_1d7)[_1d9]));
_1d8[ac](_1dc);
_1d9++;
}
_1d5[ac](_1d6);
_1d5[ac](_1d8);
_1d3[ac](_1d5);
var _1dd=doc[ce]("tbody");
var _1de=doc[ce]("tr");
for(i=0;i<7;i++){
var _1df=doc[ce]("td");
if(i===5||i===6){
_1df.className="weekend";
}
_1df[ac](doc.createTextNode(" "));
_1de[ac](_1df);
}
for(i=0;i<6;i++){
_1dd[ac](_1de.cloneNode(true));
}
_1d3[ac](_1dd);
return _1d3;
}
function getCalendarMarkupOutline(){
var doc=document,ce="createElement",sa="setAttribute",ac="appendChild";
var _1e4=doc[ce]("div");
_1e4[sa]("id","datePickerContainer");
_1e4.style.display="block";
var _1e5=doc[ce]("div");
_1e5.id="close";
$(_1e5).addClassName("dt_control");
var _1e6=doc[ce]("a");
_1e6[sa]("href","javascript: void(0);");
_1e6[sa]("id","cal_closeCalendar");
_1e6[sa]("title",ct_i18n.controls.close);
_1e6[ac](doc.createTextNode(" "));
_1e5[ac](_1e6);
_1e4[ac](_1e5);
var _1e7=doc[ce]("div");
_1e7.id="previous";
$(_1e7).addClassName("dt_control");
var _1e8=doc[ce]("a");
_1e8[ac](doc.createTextNode(" "));
_1e8[sa]("href","javascript: void(0);");
_1e8[sa]("id","cal_showPreviousMonth");
_1e8[sa]("title",ct_i18n.controls.prevMonth);
_1e7[ac](_1e8);
_1e4[ac](_1e7);
var _1e9=getCalendarTableMarkup();
var _1ea=doc[ce]("div");
_1ea.setAttribute("id","datePickerWrapper");
_1ea.style.overflow="hidden";
for(var i=0;i<_1c2.calendarCount;i++){
_1ea[ac](_1e9.cloneNode(true));
}
_1e4[ac](_1ea);
var _1ec=doc[ce]("div");
_1ec.id="next";
$(_1ec).addClassName("dt_control");
var _1ed=doc[ce]("a");
_1ed[ac](doc.createTextNode(" "));
_1ed[sa]("href","javascript: void(0);");
_1ed[sa]("id","cal_showNextMonth");
_1ed[sa]("title",ct_i18n.controls.nextMonth);
_1ec[ac](_1ed);
_1e4[ac](_1ec);
$(_1e4).observe("click",globalEventHandler);
return _1e4;
}
function globalEventHandler(_1ee){
try{
switch(Event.findElement(_1ee,"a").id){
case "cal_closeCalendar":
self.hideDatePicker();
break;
case "cal_showPreviousMonth":
if(!Event.findElement(_1ee,"a").hasClassName("disabled")){
showPreviousMonth();
}
break;
case "cal_showNextMonth":
if(!Event.findElement(_1ee,"a").hasClassName("disabled")){
showNextMonth();
}
break;
default:
selectDate(Event.findElement(_1ee,"a"));
}
}
catch(e){
}
Event.stop(_1ee);
}
function bodyClickHandler(_1ef){
self.hideDatePicker();
}
function selectDate(_1f0){
if(_1f0&&_1f0.timeStamp){
var _1f1=new Date(_1f0.timeStamp);
var _1f2=(_1f1.getDate())+"/";
_1f2+=(_1f1.getMonth()+1)+"/";
_1f2+=_1f1.getFullYear();
_1c1.value=_1f2;
self.hideDatePicker();
_1c6=new Date(_1f1);
if(_1c1.readAttribute("selflabel")){
_1c1.removeClassName("selflabel");
}
_1c1.fire("ctCalendar:onChange");
}
}
function adjustPreviousNextLinksDisplay(){
var _1f3=getMinDate();
var _1f4=new Date(_1f3);
var _1f5=_1c5;
while(_1f5<0){
_1f5+=12;
}
_1f4.setMonth(_1f5);
if(_1f4.getMonth()<=_1f3.getMonth()&&_1f4.getFullYear()<=_1f3.getFullYear()){
$("cal_showPreviousMonth").addClassName("disabled");
}else{
$("cal_showPreviousMonth").removeClassName("disabled");
}
var _1f6=getMaxDate();
_1f4=new Date(_1f3);
var _1f7=_1c5+_1c2.calendarCount-1;
while(_1f7>12){
_1f7-=12;
}
_1f4.setMonth(_1f7);
if(_1f4.getMonth()>=_1f6.getMonth()&&_1f4.getFullYear()>=_1f6.getFullYear()){
$("cal_showNextMonth").addClassName("disabled");
}else{
$("cal_showNextMonth").removeClassName("disabled");
}
}
function showPreviousMonth(){
var _1f8=getCalendarTableMarkup();
$("datePickerWrapper").insertBefore(_1f8,$("datePickerWrapper").firstChild);
populateCalendarTable(_1c5-1,_1f8,getMinDate(),getMaxDate());
_1c5--;
adjustPreviousNextLinksDisplay();
$($("datePickerWrapper").getElementsByTagName("table")[_1c2.calendarCount]).remove();
ct.dom.removeIEIframeFix($("datePickerContainer"));
ct.dom.addIEIframeFix($("datePickerContainer"));
}
function showNextMonth(){
var _1f9=getCalendarTableMarkup();
$("datePickerWrapper").appendChild(_1f9);
populateCalendarTable(_1c5+_1c2.calendarCount,_1f9,getMinDate(),getMaxDate());
_1c5++;
adjustPreviousNextLinksDisplay();
$($("datePickerWrapper").getElementsByTagName("table")[0]).remove();
ct.dom.removeIEIframeFix($("datePickerContainer"));
ct.dom.addIEIframeFix($("datePickerContainer"));
}
function getMinDate(){
var _1fa;
if(_1c2.minDateField){
if(ct.dates.isValidDateString($F(_1c2.minDateField))){
_1fa=ct.dates.fromString($F(_1c2.minDateField));
}else{
if($(_1c2.minDateField).readAttribute("mindate")){
_1fa=ct.dates.fromString($(_1c2.minDateField).readAttribute("mindate"));
}else{
_1fa=new Date();
}
}
}else{
_1fa=_1c2.minDate;
}
if(_1fa){
_1fa.setDate(_1fa.getDate()+_1c2.offsetDays);
}
return new Date(_1fa);
}
function getMaxDate(){
if(_1c2.maxDate){
return new Date(_1c2.maxDate);
}else{
maxDate=new Date(getMinDate());
maxDate.setFullYear(maxDate.getFullYear()+1);
return maxDate;
}
}
function populateCalendarTable(_1fb,_1fc,_1fd,_1fe){
var _1ff=new Date(_1fd);
var _200=ct.dates.monthNames;
ct.dates.setMonth(_1ff,_1fb);
_1ff.setDate(1);
_1fb%=12;
_1fc.getElementsByTagName("th")[0].appendChild(document.createTextNode(_200[_1fb<0?_1fb+12:_1fb]+" "+_1ff.getFullYear()));
var _201=_1fc.getElementsByTagName("tbody")[0].getElementsByTagName("td");
if(ct.dates.isValidDateString($F(_1c1))){
_1c6=ct.dates.fromString($F(_1c1));
}else{
_1c6=getMinDate();
}
var _202=_1c2.firstDayOfWeek;
$A(_201).each(function(cell){
if(_202===_1ff.getDay()&&_1ff.getMonth()===_1fb){
if(ct.dates.compare(_1ff,_1fd)===1||ct.dates.compare(_1ff,_1fe)===-1){
cell.appendChild(document.createTextNode(_1ff.getDate()));
}else{
var link=document.createElement("a");
link.href="javascript: void(0);";
link.timeStamp=_1ff.valueOf();
link.appendChild(document.createTextNode(_1ff.getDate()));
cell.appendChild(link);
}
if(_1c6.toString()==_1ff.toString()){
$(cell).addClassName("selected");
}
_1ff.setDate(_1ff.getDate()+1);
}else{
cell.appendChild(document.createTextNode(" "));
}
_202++;
_202%=7;
});
}
var _205=null;
this.showDatePicker=function(){
if(!_1c1.disabled){
this.hideDatePicker();
var _206=getCalendarMarkupOutline();
if(_1c2.minDateField&&ct.dates.isValidDateString($F(_1c2.minDateField))&&ct.dates.isValidDateString($F(_1c1))&&(Date.parse(ct.dates.fromString($F(_1c2.minDateField)))>Date.parse(ct.dates.fromString($F(_1c1))))){
_1c5=ct.dates.fromString($F(_1c2.minDateField)).getMonth()+(ct.dates.fromString($F(_1c2.minDateField)).getFullYear()-getMinDate().getFullYear())*12;
}else{
if(ct.dates.isValidDateString($F(_1c1))){
_1c5=ct.dates.fromString($F(_1c1)).getMonth()+(ct.dates.fromString($F(_1c1)).getFullYear()-getMinDate().getFullYear())*12;
}else{
if(_1c2.defaultDate){
_1c5=_1c2.defaultDate.getMonth()+(_1c2.defaultDate.getFullYear()-getMinDate().getFullYear())*12;
}else{
_1c5=getMinDate().getMonth();
}
}
}
document.body.appendChild(_206);
for(var i=0;i<_1c2.calendarCount;i++){
populateCalendarTable(_1c5+i,_206.getElementsByTagName("table")[i],getMinDate(),getMaxDate());
}
var pos=$(_1c1).cumulativeOffset();
var _209=document.viewport.getDimensions();
var _20a=_206.getDimensions();
_206.style.position="absolute";
if((_209.height-_20a.height-pos.top)>0){
_206.style.top=(pos.top+$(_1c1).getHeight())+"px";
}else{
_206.style.top=(pos.top-_20a.height)+"px";
}
if((_209.width-pos.left-_20a.width)>0){
_206.style.left=(pos.left)+"px";
}else{
_206.style.right=_209.width-pos.left-_1c1.getWidth()+"px";
}
adjustPreviousNextLinksDisplay();
ct.dom.addIEIframeFix(_206);
$(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(_20b,_20c){
var self=this;
if(!_20c){
_20c={};
}
_20c.showFeaturedAirports=_20c.showFeaturedAirports||(_20b.readAttribute("showfeatured")&&_20b.readAttribute("showfeatured").toLowerCase()==="no")?false:true;
_20c.preselectAirportCode=_20c.preselectAirportCode||(_20b.readAttribute("preselect")&&_20b.readAttribute("preselect")!=="")?_20b.readAttribute("preselect"):null;
_20c.cookieSelection=_20c.cookieSelection||(_20b.readAttribute("cookieselection")&&_20b.readAttribute("cookieselection")==="no")?false:true;
try{
_20c.extraValues=_20c.extraValues||(_20b.readAttribute("extras")&&_20b.readAttribute("extras").strip().length>0)?eval("({"+_20b.readAttribute("extras").strip()+"})"):null;
}
catch(e){
_20c.extraValues=null;
}
if(_20c.cookieSelection&&_20b.readAttribute("cookiename")){
if(_20b.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{
_20c.cookieName=_20b.readAttribute("cookiename");
}
ct.validator.attachValidation(_20b,ct_i18n.validate.autocompleteSelectMsg.replace("${list}",_20b.title.toLowerCase()),function(){
return $F(_20b)!=="";
});
this.populate=function(){
if(_20b.firstChild){
_20b.removeChild(_20b.firstChild);
}
var key;
if(_20c.extraValues){
Object.keys(_20c.extraValues).each(function(key){
var _210=new Element("option",{value:key}).update(_20c.extraValues[key]);
if(_20c.preselectAirportCode&&_20c.preselectAirportCode===_20c.extraValues[key]){
_210.setAttribute("selected","selected");
}
_20b.appendChild(_210);
});
}else{
_20b.appendChild(new Element("option",{value:""}).update(ct_i18n.controls.selectPlace));
}
_20b.appendChild(new Element("option",{value:""}).update("------------"));
if(_20c.showFeaturedAirports){
$A(ct.airports.featured).each(function(_211){
_20b.appendChild(new Element("option",{value:_211.k}).update(_211.v));
});
_20b.appendChild(new Element("option",{value:""}).update("------------"));
}
$A(ct.airports.all).each(function(_212){
var _213=new Element("option",{value:_212.k}).update(_212.v);
if(_20c.preselectAirportCode&&_20c.preselectAirportCode===_212.k){
_213.writeAttribute("selected","selected");
}
_20b.appendChild(_213);
});
};
self.populate();
},AutoCompleteTextbox:function(_214,_215){
var _216={up:38,down:40,enter:13,escape:27,tab:9,shift:16};
var _217=0,_218="autocompleteOptionsContainer",_219=[],_21a=null;
var _21b="/images/indicators/arrows_circle.gif";
if(!ct.controls.AutoCompleteTextboxCache){
ct.controls.AutoCompleteTextboxCache={};
}
_215=_215||{};
_215.queryUrl=_215.queryUrl||_214.getAttribute("queryurl")||null;
_215.valueOnly=_215.valueOnly||_214.hasClassName("valueOnly");
_215.includeKeys=_215.includeKeys||_214.hasClassName("includeKeys");
_215.idField=_215.idField||_214.getAttribute("idfield")||null;
_215.displayRowCount=parseInt(_215.displayRowCount||_214.getAttribute("displayrows")||10,10);
_215.minChars=parseInt(_215.minChars||_214.getAttribute("minchars")||3,10);
_215.selectionHandler=_215.selectionHandler||_214.getAttribute("selectionhandler")||null;
_215.jsfunction=_215.jsfunction||_214.getAttribute("jsfunction")||null;
_215.jsfunctionurl=_215.jsfunctionurl||_214.getAttribute("jsfunctionurl")||null;
_215.htmlIncluded=_215.htmlIncluded||_214.hasAttribute("htmlIncluded");
_215.callBack=_215.callBack||_214.getAttribute("callback")||null;
_215.nocache=_215.nocache||_214.getAttribute("nocache")||false;
_215.clicktoselect=_215.clicktoselect||_214.getAttribute("clicktoselect")||false;
_214.setQueryUrl=function(url){
_214.setAttribute("queryUrl",url);
_215.queryUrl=new Template(url);
};
if($(_214).hasClassName("forceKey")){
ct.validator.attachValidation(_214,ct_i18n.validate.autocompleteNotAvailMsg.replace("${entry}",_214.title.toLowerCase()),function(){
if($(_214).value===""){
return true;
}
if(_214.readAttribute("selfLabel")===$F(_214)){
return true;
}
return $(_215.idField).value;
});
}
if(typeof _215.selectionHandler==="string"){
try{
_215.selectionHandler=eval(_215.selectionHandler);
}
catch(e){
throw new Error("From ct.controls.AutoCompleteTextbox: Unable to understand the selectionhandler attribute.");
}
}
if(!_215.idField){
throw new Error("From ct.controls.AutoCompleteTextbox: idfield attribute not defined.");
}
if(!$(_215.idField)||$(_215.idField).id!==_215.idField){
_214.parentNode.appendChild(new Element("input",{type:"hidden",id:_215.idField,name:_215.idField}));
}
if(ct.dom.getParentByTagName(_214,"form")){
$(ct.dom.getParentByTagName(_214,"form")).observe("submit",function(_21d){
if($(_218)){
_21d.stop();
}
});
}
$(_214).observe("blur",function(){
if(!_215.clicktoselect){
if($(_218)){
keyEnterPress();
}
removeAutocompleteDropdown();
}else{
setTimeout(function(){
if($(_218)&&$(_218).getAttribute("referer")=="referer_"+_214.id){
removeAutocompleteDropdown();
}
},500);
}
});
$(_214).observe("keypress",function(_21e){
if($(_218)&&_21e.keyCode===_216.enter){
_21e.stop();
}
});
$(_214).observe("focus",function(_21f){
$(_214).select();
});
if(_215.queryUrl||_215.jsfunction){
if(_215.queryUrl){
_215.queryUrl=new Template(_215.queryUrl);
}
if(_215.clicktoselect){
$(_214).observe("keydown",function(_220){
_214.clicktoselect_oldValue=_214.value;
});
}
var _221=function(_222){
if($("autocompleteOptionsContainer")){
if(_222.keyCode==_216.up||_222.keyCode==_216.down||_222.keyCode==_216.enter||_222.keyCode==_216.escape){
return true;
}
}
return false;
};
$(_214).observe("keyup",function(_223){
if(_215.clicktoselect&&((_223.keyCode===_216.shift||_223.keyCode===_216.tab)||(_214.clicktoselect_oldValue&&_214.clicktoselect_oldValue==_214.value&&!_221(_223)))){
return false;
}
_214.clicktoselect_oldValue=_214.value;
var _224="#"+((_223.target.readAttribute("queryUrl"))||((_223.target.readAttribute("jsfunctionurl"))?(_223.target.readAttribute("jsfunction")+"#"+_223.target.readAttribute("jsfunctionurl")):_223.target.readAttribute("jsfunction")));
if(_223.keyCode!==_216.enter){
$(_215.idField).value="";
}
if($F(_214)===""){
removeAutocompleteDropdown();
}else{
if($F(_214).length>=_215.minChars){
var key=$F(_214).toLowerCase();
if(_215.nocache==false&&ct.controls.AutoCompleteTextboxCache[key+_224]){
keystrokeHandler(_223,ct.controls.AutoCompleteTextboxCache[key+_224]);
}else{
if(_219["#"+key]){
return;
}else{
clearTimeout(_21a);
_21a=setTimeout(function(){
_219.push("#"+key);
_214.setStyle({backgroundPosition:"center right",backgroundImage:"url(\""+_21b+"\")",backgroundRepeat:"no-repeat"});
if(_215.queryUrl){
new Ajax.Request(_215.queryUrl.evaluate({q:key}),{method:"get",onSuccess:function(_226){
ct.controls.AutoCompleteTextboxCache[key+_224]=eval(_226.responseText);
_219.splice("#"+key,1);
if(key===$F(_214).toLowerCase()){
keystrokeHandler(_223,ct.controls.AutoCompleteTextboxCache[key+_224]);
}
_214.setStyle({backgroundImage:"none"});
},onFailure:function(){
ct.controls.AutoCompleteTextboxCache.splice($A(ct.controls.AutoCompleteTextboxCache).indexOf(key+_224),1);
}});
}else{
if(_215.jsfunction){
function callback(_227){
ct.controls.AutoCompleteTextboxCache[key+_224]=_227;
_219.splice("#"+key,1);
if(key===$F(_214).toLowerCase()){
keystrokeHandler(_223,ct.controls.AutoCompleteTextboxCache[key+_224]);
}
_214.setStyle({backgroundImage:"none"});
}
var _228=eval(_215.jsfunction);
_228(key,callback,_214);
}
}
},200);
}
}
}
}
});
}
_214.setAttribute("autocomplete","off");
function keystrokeHandler(evt,data){
var _22b=null;
try{
_22b=evt.keyCode;
}
catch(e){
}
switch(_22b){
case _216.up:
keyUpPress();
Event.stop(evt);
break;
case _216.down:
keyDownPress();
Event.stop(evt);
break;
case _216.escape:
removeAutocompleteDropdown();
Event.stop(evt);
break;
case _216.enter:
if($("autocompleteOptionsContainer")){
keyEnterPress(evt);
Event.stop(evt);
}
break;
default:
showAutocompleteDropdown(filterDataset(data));
break;
}
}
function filterDataset(_22c){
return _22c;
}
function showAutocompleteDropdown(_22d){
if(_22d.length>0){
var _22e;
if($(_218)){
while($(_218).firstChild){
$($(_218).firstChild).remove();
}
_22e=$(_218);
ct.dom.removeIEIframeFix(_22e);
}else{
_22e=new Element("ul",{"class":"aa",style:"visibility: hidden",id:_218});
}
$(_22e).setAttribute("referer","referer_"+_214.id);
var _22f=(_215.displayRowCount<_22d.length)?_215.displayRowCount:_22d.length;
for(var i=0;i<_22f;i++){
var li=new Element("li",{keyName:_22d[i].k,index:i}).update(_22d[i].d||_22d[i].v);
li.dataObject=Object.clone(_22d[i]);
_22e.appendChild(li);
}
document.body.appendChild(_22e);
var _232=_214.cumulativeOffset();
_22e.setStyle({top:_232.top+_214.getHeight()+"px",left:_232.left+"px",position:"absolute",visibility:"visible",width:_214.getWidth()+"px"});
ct.dom.addIEIframeFix(_22e);
_22e.observe("click",mouseClickHandler);
_22e.observe("mouseover",mouseOverHandler);
highlightSelection();
}else{
$(_215.idField).value="";
removeAutocompleteDropdown();
if(_215.callBack){
_215.callBack();
}
}
}
function mouseClickHandler(_233){
var _234;
if(_233.findElement("li")&&_233.findElement("li").nodeName.toLowerCase()==="li"){
_234=_233.findElement("li");
}else{
if(_233.findElement("ul")&&_233.findElement("ul").nodeName.toLowerCase()==="ul"&&_233.findElement("ul").id===_218&&_215.clicktoselect){
_234=$(_218).select("li.highlight")[0];
}
}
if(_234){
_217=_234.getAttribute("index");
highlightSelection();
keyEnterPress();
}
_233.stop();
}
function mouseOverHandler(_235){
if(_235.findElement("li")&&_235.findElement("li").nodeName.toLowerCase()==="li"){
_217=_235.findElement("li").getAttribute("index");
highlightSelection();
}
_235.stop();
}
function removeAutocompleteDropdown(){
if($(_218)){
ct.dom.removeIEIframeFix($(_218));
$(_218).stopObserving("click",mouseClickHandler);
$(_218).remove();
_217=0;
}
if(window.isCalendarPage){
checkInternational();
constructReturn();
}
}
function keyDownPress(){
_217++;
highlightSelection();
}
function keyUpPress(){
_217--;
highlightSelection();
}
function keyEnterPress(evt){
if($(_218)&&$(_218).childNodes[_217]){
var _237=$(_218).childNodes[_217];
var _238="";
if(_215.htmlIncluded){
$A((new Element("div").update(_237.dataObject.v)).childNodes).each(function(_239){
if(_239.innerHTML){
_238+=_239.innerHTML;
}else{
if(_239.nodeValue){
_238+=_239.nodeValue;
}
}
});
}else{
_238=_237.dataObject.v;
}
$(_215.idField).value=_215.valueOnly?_238:_237.readAttribute("keyName");
_214.value=_238;
if(_215.selectionHandler){
_215.selectionHandler(_237.dataObject,_214);
}
if(evt){
evt.stop();
}
}
removeAutocompleteDropdown();
}
function highlightSelection(){
if($(_218)){
var _23a=$(_218).childNodes.length;
_217=parseInt(_217,10);
if(_217>=_23a){
_217=0;
}else{
if(_217<0){
_217=_23a-1;
}
}
$A($(_218).childNodes).each(function(li,_23c){
if(_23c===_217){
li.addClassName("highlight");
}else{
li.removeClassName("highlight");
}
});
}
}
},Slider:function(_23d){
var _23e=$(_23d).getElementsBySelector("input[type=text]");
var _23f=new Element("div",{"class":"track"});
_23d.appendChild(_23f);
var _240=new Element("div",{"class":"leftDisabled"}),_241=new Element("div",{"class":"rightDisabled"});
var _242=parseFloat($(_23d).readAttribute("minvalue")||0),_243=parseFloat($(_23d).readAttribute("maxvalue")||10),_244=parseFloat($(_23d).readAttribute("stepvalue")||1);
var _245=0,_246=_23f.getWidth();
var _247=(_246-_245)/(_243-_242);
var _248=Math.ceil(_244*_247);
function getSliderRange(){
var _249=[];
var _24a=_245;
while(_24a<_246){
_249.push(_24a);
_24a+=_248;
}
_249.push(_246);
return _249;
}
function scaleToInternal(_24b){
return ((_24b-_242)*_247);
}
function scaleToUser(_24c){
if(_24c===_245){
return _242;
}else{
if(_24c===_246){
return _243;
}
}
var _24d=(_24c/_247)+_242;
var _24e=_24d%_244;
if(_24e<_244/2){
return _24d-_24e;
}else{
return _24d+(_244-_24e);
}
}
_23d.minValue=_242;
_23d.maxValue=_243;
if(_23e.length===1){
if(_23d.readAttribute("highlight")&&_23d.readAttribute("highlight").toLowerCase()==="left"){
_23f.appendChild(_241);
}else{
_241=null;
}
if(_23d.readAttribute("highlight")&&_23d.readAttribute("highlight").toLowerCase()==="right"){
_23f.appendChild(_240);
}else{
_240=null;
}
var _24f=new Element("div",{"class":"leftHandle"});
_23f.appendChild(_24f);
_23d.sliderObj=new Control.Slider(_24f,_23f,{axis:"horizontal",range:$R(_245,_246),sliderValue:scaleToInternal(parseFloat(_23e[0].getAttribute("value"))),startSpan:_240,endSpan:_241,values:getSliderRange(),onChange:function(vals){
vals=scaleToUser(vals);
_23e[0].setAttribute("value",vals);
_23e[0].value=vals;
_23d.values=[vals];
_23d.fire("ctslider:onChange");
},onSlide:function(vals){
_23d.inSlideValues=scaleToUser(vals);
_23d.fire("ctslider:onSlide");
}});
_23d.sliderObj.setValue([scaleToInternal(parseFloat(_23e[0].getAttribute("value")))]);
_23d.inSlideValues=[parseFloat(_23e[0].value)];
}else{
if(_23e.length===2){
var _252=new Element("div",{id:"rangeHandleMin1","class":"leftHandle"});
var _253=new Element("div",{id:"rangeHandleMax1","class":"rightHandle"});
_23f.appendChild(_240);
_23f.appendChild(_241);
_23f.appendChild(_252);
_23f.appendChild(_253);
_23d.sliderObj=new Control.Slider([_252,_253],_23f,{axis:"horizontal",range:$R(_245,_246),sliderValue:[scaleToInternal(_23e[0].getAttribute("value")),scaleToInternal(_23e[1].getAttribute("value"))],startSpan:_240,endSpan:_241,values:getSliderRange(),restricted:true,onChange:function(vals){
var min=scaleToUser(vals[0]);
var max=scaleToUser(vals[1]);
var _257=_23d.values;
if(!_257||(_257[0]!==min||_257[1]!==max)){
_23e[0].setAttribute("value",min);
_23e[1].setAttribute("value",max);
_23e[0].value=min;
_23e[1].value=max;
_23d.values=[min,max];
_23d.fire("ctslider:onChange");
}
},onSlide:function(vals){
var _259=_23d.inSlideValues;
if(!_259||(_259[0]!==scaleToUser(vals[0])||_259[1]!==scaleToUser(vals[1]))){
_23d.inSlideValues=[scaleToUser(vals[0]),scaleToUser(vals[1])];
_23d.fire("ctslider:onSlide");
}
}});
_23d.setValues=function(){
var _25a=_23d.sliderObj;
var vals=[_23e[0].getAttribute("value"),_23e[1].getAttribute("value")];
_25a.setValue(scaleToInternal(vals[0]),0);
_25a.setValue(scaleToInternal(vals[1]),1);
_23d.inSlideValues=[vals[0],vals[1]];
_23d.fire("ctslider:onSlide");
};
_23d.setValues();
}
}
},CurrencyDropdown:function(_25c){
if(window.currencies&&!_25c.loaded){
var _25d=false;
var _25e=window.location.href.toQueryParams().currency||((window.sell_currency)?window.sell_currency.code:null)||ct.cookies.read("currency-pref");
function addCurrency(_25f){
var _260=new Element("option",{value:_25f.code,title:_25f.name}).update(_25f.code+" "+_25f.symbol+" - "+_25f.name);
if(_25f.code===_25e&&!_25d){
ct.currentCurrency=_25f;
_260.writeAttribute("selected","selected");
_25d=true;
}
_25c.appendChild(_260);
}
function sortCurrenciesfunction(a,b){
var _a=a.code;
var _b=b.code;
if(_a>_b){
return 1;
}else{
if(_a<_b){
return -1;
}else{
return 0;
}
}
}
function curr_symbol_convert(_num){
_num=_num.toUpperCase();
var uni="\"\\u"+_num+"\"";
if(/^[A-F\d]{4}$/.test(_num)){
return eval(uni);
}
return "";
}
var _267={"\\u5143":"\u5143","\\u20AC":"\u20ac","\\u00A3":"\xa3","\\u20AA":"\u20aa","\\u00A5":"\xa5","\\u20A9":"\u20a9","\\uFDFC":"\ufdfc","\\u20AC":"\u20ac","\\u00A3":"\xa3"};
if(!currencies.top){
currencies.notop=true;
currencies.top=[{"code":"AED","rate":"13.06","name":"UAE Dirham","symbol":"AED"},{"code":"EUR","rate":"66.860000380968","name":"Euro","symbol":"\u20ac"},{"code":"GBP","rate":"74.080000474112","name":"Pound Sterling","symbol":"\xa3"},{"code":"INR","rate":"1.00000","name":"Indian Rupee","symbol":"Rs."},{"code":"USD","rate":"45.870000053025","name":"United States Dollar","symbol":"$"}];
}
currencies.all.sort(sortCurrenciesfunction);
if(!currencies.notop){
$A(currencies.top).each(function(_268){
if(_268.symbol.indexOf("\\u")!=-1){
_268.symbol=curr_symbol_convert(_268.symbol.substr(2));
}
});
}
$A(currencies.all).each(function(_269){
if(_269.symbol.indexOf("\\u")!=-1){
_269.symbol=curr_symbol_convert(_269.symbol.substr(2));
}
if(currencies.notop){
$A(currencies.top).each(function(_26a){
if(_26a.code==_269.code){
_26a.rate=_269.rate;
_26a.symbol=_269.symbol;
}
});
}
});
$A(currencies.top).each(addCurrency);
_25c.appendChild(new Element("option",{value:"",title:""}).update("----------"));
$A(currencies.all).each(addCurrency);
if(!_25d){
var _26b=$(_25c).getElementsByTagName("option");
for(var i=0;i<_26b.length;i++){
if(_26b[i].value==="INR"){
_26b[i].writeAttribute("selected","selected");
break;
}
}
}
$(_25c).observe("change",function(){
var _26d=false;
$A(currencies.all).each(function(_26e){
if(_26e.code===$F(_25c)){
ct.currentCurrency=_26e;
_26d=true;
}
});
if(!_26d){
ct.helperFunctions.resetCurrency(true);
}else{
ct.helperFunctions.logToServer("currency","changed",{to:ct.currentCurrency.code});
}
$(_25c).fire("ctcurrency:change");
});
$(_25c).loaded=true;
}
},ToggleTabs:function(node,_270){
var _271=[];
if(!_270){
_270={};
}
_270.currentTabClass=_270.currentTabClass||(node.readAttribute("currentTabClass")?node.readAttribute("currentTabClass"):"");
_270.deactivatedTabClass=_270.deactivatedTabClass||(node.readAttribute("deactivatedTabClass")?node.readAttribute("deactivatedTabClass"):"");
_270.activeElement=_270.activeElement||(node.readAttribute("activeElement")?node.readAttribute("activeElement"):"");
$A(node.select("a[tabId]","a[tabid]")).each(function(tab){
_271.push(tab);
Event.observe(tab,"click",function(evt){
$A(_271).each(function(link){
if(_270.activeElement!=""){
link.up(_270.activeElement).removeClassName(_270.currentTabClass);
link.up(_270.activeElement).addClassName(_270.deactivatedTabClass);
}else{
link.removeClassName(_270.currentTabClass);
link.addClassName(_270.deactivatedTabClass);
}
$(link.readAttribute("tabId")).hide();
});
var _275=$(evt.target);
if(_275.tagName!=="A"){
_275=_275.up("a");
}
_275.addClassName(_270.currentTabClass);
_275.removeClassName(_270.deactivatedTabClass);
if(_270.activeElement!=""){
_275.up(_270.activeElement).addClassName(_270.currentTabClass);
_275.up(_270.activeElement).removeClassName(_270.deactivatedTabClass);
}
$(_275.readAttribute("tabId")).show();
});
});
},parseDomTree:function(_276){
_276=$(_276||document.body);
var _277=ct.controls;
_276.getElementsBySelector("input.datePicker").each(function(_278){
new _277.Calendar(_278);
});
_276.getElementsBySelector("select.airportsDropdown").each(function(_279){
new _277.AirportsDropdown(_279);
});
_276.getElementsBySelector("input.autocomplete").each(function(_27a){
new _277.AutoCompleteTextbox(_27a);
});
if(window.Control&&Control.Slider){
var _27b=new Date();
_276.select(".slider").each(function(_27c){
if(!_27c.sliderObj){
new _277.Slider(_27c);
}
});
console.log("Slider creation total time: ",new Date()-_27b);
}
if($("currency_dropdown")){
new ct.controls.CurrencyDropdown($("currency_dropdown"));
}
_276.getElementsBySelector("ul.toggleTabs").each(function(ul){
new ct.controls.ToggleTabs(ul);
});
}},carousel:function(node,_27f){
var _280=document.body.clientHeight;
var _281=document.body.clientWidth;
var ac="appendChild",self=this;
var _284=0;
_27f=_27f||{};
this.resizeFlag=false;
this.feature_slideshow;
this.attachSlideshowBehaviour=function(ele){
_284++;
$(ele).writeAttribute("style","visibility:hidden;");
var _286=$(ele).up();
var IE=(navigator.userAgent.indexOf("MSIE")>=0)?true:false;
var _288=ele.cloneNode(true);
var _289=$(ele).select(".slide");
var _28a=$(ele).readAttribute("navStyle");
var _28b=$(ele).readAttribute("widthType");
var _28c=$(ele).select(".slide")[0].getWidth()*parseInt($(ele).readAttribute("visibleSlides"));
var _28d=$(ele).select(".slide")[0].getWidth();
var _28e=$(ele).select(".slide")[0];
if(!IE){
var _28f=parseInt($(_28e).getStyle("margin-right").replace(/px/i,""))+parseInt($(_28e).getStyle("margin-left").replace(/px/i,""))+parseInt($(_28e).getStyle("border-right-width").replace(/px/i,""))+parseInt($(_28e).getStyle("border-left-width").replace(/px/i,""))+parseInt($(_28e).getStyle("padding-right").replace(/px/i,""))+parseInt($(_28e).getStyle("padding-left").replace(/px/i,""));
}
var _290=$(ele).select(".slide")[0].getHeight();
var loop=$(ele).readAttribute("loopSlides");
var _292=$(ele).readAttribute("keyscroll")||"no";
var _293=$(ele).readAttribute("autoslide")||"false";
var _294=$(ele).readAttribute("paginationType");
var _295=$(ele).readAttribute("trackerFunction");
var _296=new Element("div",{"id":"carouselWrapper"+_284});
$(_286)[ac](_296);
$(ele).remove();
$(_296)[ac](_288);
for(var _297=0;_297<$(_288).select(".slide").length;_297++){
$(_288).select(".slide")[_297].writeAttribute("id",_296.id+"_slide"+_297);
}
if(_28b=="fluid"){
$(_296).writeAttribute("style","height:"+_290+"px;overflow:hidden;position:relative");
}else{
if(_28b=="fixed"){
$(_296).writeAttribute("style","width:"+_28c+"px;height:"+_290+"px;overflow:hidden;position:relative");
}
}
if(_28b=="fluid"){
if(IE){
$(_296).up().writeAttribute("style","width:780px");
}
if(!IE){
var _298=Math.round(parseInt($(_296).getWidth())/parseInt($(_288).readAttribute("visibleSlides")))-_28f;
}else{
var _298=Math.round(parseInt($(_296).getWidth())/parseInt($(_288).readAttribute("visibleSlides")));
}
var _299=($(_288).select(".slide").length*_298)+_298;
$(_288).writeAttribute("style","width:"+_299+"px");
$(_288).select(".slide").each(function(_29a){
$(_29a).writeAttribute("style","width:"+(_298)+"px;");
});
}else{
if(_28b=="fixed"){
$(_288).writeAttribute("style","width:"+_28d*(_289.length+1)+"px");
}
}
var _29b=new Element("div",{"class":_28a||"","id":"navCount"+_284}),_29c;
var _297=$(_288).select(".slide").length;
var _29d=parseInt($(_288).readAttribute("visibleslides"));
if(_29d>_297){
_29c=Math.ceil(_297/_29d);
}else{
if(_297%_29d==0){
_29c=Math.round(_297/_29d);
}else{
if(_297%_29d!=0){
_29c=(_297/_29d)+"";
_29c=(parseInt(_29c.split(".")[0]))+1;
}
}
}
if(_294==null||_294!="text"){
var _29e=new Element("ul",{"class":"clearfix"});
var _29f=0;
for(i=0;i<_29c;i++){
if(i!=0){
_29f=_29f+(parseInt($(_288).readAttribute("visibleslides")));
}
var _2a0=new Element("li").update(new Element("a",{"rel":i==0?$(_288).select(".slide")[i].id:$(_288).select(".slide")[_29f].id,"href":"javascript:void(0)","count":i==0?i:_29f,"tracker":$(_288).select(".slide")[i].readAttribute("tracker")?$(_288).select(".slide")[i].readAttribute("tracker"):"","trackercategory":$(_288).select(".slide")[i].readAttribute("trackercategory")?$(_288).select(".slide")[i].readAttribute("trackercategory"):"","class":i==0?"slide-control slide-jump active":"slide-control slide-jump"}));
$(_288).select(".slide")[i==0?i:_29f].writeAttribute("count",i);
_29e[ac](_2a0);
}
var _2a1=new Element("a",{"href":"javascript:void(0)","class":"prev_feature slide-control disabledLeft","rel":"prev"});
_29b[ac](_29e);
_29b[ac](_2a1);
_2a1.addClassName("prev_feature slide-control disabledLeft");
var _2a2=new Element("a",{"href":"javascript:void(0)","class":"next_feature slide-control","rel":"next"});
_29b[ac](_2a2);
_2a2.addClassName("next_feature slide-control");
if(_29c==1){
$(_2a2).writeAttribute("style","visibility:hidden");
$(_2a1).writeAttribute("style","visibility:hidden");
$(_2a0).writeAttribute("style","visibility:hidden");
}
$(_296).insert({after:_29b});
if(loop=="yes"){
$(_2a1).removeClassName("disabledLeft");
}
if(_29c!=0){
var _2a3=parseInt($(_29b).select("li")[0].getWidth());
var _2a4=parseInt($(_29b).select("li")[0].getStyle("margin-left"));
_29c=_29c;
$(_29e).writeAttribute("style","width: auto;height: auto;");
$(_29b).writeAttribute("style","width:"+((_29c*_2a3)+(_29c*_2a4)+_2a3)+"px;height: auto;");
}
if(_28b=="fluid"){
$(_296).writeAttribute("style","height:"+_290+"px;overflow:hidden;position:relative");
}else{
if(_28b=="fixed"){
$(_296).writeAttribute("style","width:"+_28c+"px;height:"+_290+"px;overflow:hidden;");
}
}
}else{
if(_294=="text"){
var _29e=new Element("ul",{"class":"inline clearfix"});
var _2a0=new Element("li",{"class":"prevNavLink first"});
var _2a1=new Element("a",{"href":"javascript:void(0)","class":"slide-control","rel":"prev"}).update("&laquo; Prev");
_2a0[ac](_2a1);
_29e[ac](_2a0);
_2a0=new Element("li",{"class":"slide_count"}).update("1 of "+$(_288).select(".slide").length);
_29e[ac](_2a0);
_2a0=new Element("li",{"class":"nextNavLink"});
var _2a2=new Element("a",{"href":"javascript:void(0)","class":"slide-control","rel":"next"}).update("Next &raquo;");
_2a0[ac](_2a2);
_29e[ac](_2a0);
_29b[ac](_29e);
$(_296).insert({after:_29b});
}
}
$(_296).select(".carousel")[0].writeAttribute("offsetx",$(_296).select(".carousel")[0].cumulativeOffset()[0]);
$(_296).select(".carousel")[0].writeAttribute("offsety",$(_296).select(".carousel")[0].cumulativeOffset()[1]);
var _2a5=$(_29b).select(".slide_count")[0];
this.feature_slideshow=new Slideshow($(_288),$(_288).select(".slide"),$(_29b),$(_29b).select("a.slide-control"),{duration:2,autoslide:_293,scrollspeed:0.5,width:$$(".slide")[0].getWidth()*((_289.length)+1),visibleslides:parseInt($(_288).readAttribute("visibleSlides")),pointTo:_27f.st,loopScroll:loop,keyscroll:_292,paginationType:_294,textNode:_2a5});
$(_29b).select("a.slide-control").each(function(_2a6){
$(_2a6).observe("click",function(){
if(_295){
setTimeout("eval("+_295+")('"+$(_29b).id+"')",300);
}
});
});
if(_27f.oncomplete){
_27f.oncomplete();
}
if(_295){
setTimeout("eval("+_295+")('"+$(_29b).id+"')",200);
}
$(_29b).select("a.slide-jump").each(function(_2a7){
$(_2a7).observe("click",function(){
$(_29b).select("a.slide-jump").each(function(_2a8){
if(_2a8.hasClassName("active")){
_2a8.removeClassName("active");
}
_2a7.addClassName("active");
});
});
});
Event.observe(window,"resize",function(evt){
var _2aa=document.body.clientHeight;
var _2ab=document.body.clientWidth;
self.resizeFlag=true;
if(_280!=_2aa||_281!=_2ab){
reRenderDeals(evt);
_281=_2ab;
_280=_2aa;
}
});
reRenderDeals=function(_2ac){
var intr=window.setInterval(function(){
if(self.resizeFlag!=false){
var _2ae=self.feature_slideshow;
try{
var _2af=$(_288.id).cloneNode(true);
$(_29b.id).remove();
$(_296.id).remove();
$(_286).insert(_2af);
if(_27f.oncomplete){
ct.carousel(_2af,{st:_2ae.current,oncomplete:_27f.oncomplete});
}else{
ct.carousel(_2af,{st:_2ae.current});
}
var _2b0=$(_29b.id).select("a");
$(_2b0).each(function(link){
if($(link).hasClassName("active")){
$(link).removeClassName("active");
}
if(parseInt($(link).readAttribute("count"))==_2ae.current){
$(link).addClassName("active");
}
});
var _2b2=$(_296.id).select("ul")[0].readAttribute("visibleSlides");
var _2b3=$(_296.id).select("li.slide").length;
if((_2ae.current+parseInt(_2b2))>=(parseInt(_2b3)-1)&&$(_296.id).select("ul")[0].readAttribute("loopSlides")=="no"){
$(_29b.id).select("a.prev_feature")[0].removeClassName("disabledLeft");
$(_29b.id).select("a.next_feature")[0].addClassName("disabledRight");
}else{
if($(_296.id).select("ul")[0].readAttribute("loopSlides")=="yes"){
$(_29b.id).select("a.prev_feature")[0].removeClassName("disabledLeft");
$(_29b.id).select("a.next_feature")[0].removeClassName("disabledRight");
}else{
if(_2ae.current==0){
$(_29b.id).select("a.prev_feature")[0].addClassName("disabledLeft");
$(_29b.id).select("a.next_feature")[0].removeClassName("disabledRight");
}else{
$(_29b.id).select("a.prev_feature")[0].removeClassName("disabledLeft");
$(_29b.id).select("a.next_feature")[0].removeClassName("disabledRight");
}
}
}
self.resizeFlag=false;
}
catch(e){
}
self.resizeFlag=false;
}
},200);
};
};
if(node){
self.attachSlideshowBehaviour(node);
}else{
var _2b4=$$(".carousel");
$(_2b4).each(function(ele){
self.attachSlideshowBehaviour(ele);
});
}
},offerRenderForHomeRHS:function(_2b6){
function standardLi(i){
var _2b8=home_offers[i].HEADING;
var _2b9=home_offers[i].TITLE;
var _2ba=home_offers[i].DESC1;
var _2bb=home_offers[i].LINK1;
var _2bc=home_offers[i].TRACKER;
var _2bd=home_offers[i].TRACKERCAT;
var _2be=new Element("li",{"id":"feature_"+i,"class":"slide"});
if(_2bc){
_2be.writeAttribute("trackerCategory",_2bd);
_2be.writeAttribute("tracker",_2bc);
}
var _2bf=new Element("span",{"class":"caption"}).update(_2b8);
_2be.appendChild(_2bf);
var _2c0=new Element("a",{"href":_2bb}).update(_2b9);
if(_2bc){
_2c0.writeAttribute("trackerCategory",_2bd);
_2c0.writeAttribute("tracker",_2bc);
_2c0.writeAttribute("onclick","ct.helperFunctions.trackLinkClick(this);return false;");
}
var _2c1=new Element("h3").update(_2c0);
_2be.appendChild(_2c1);
var _2c2=new Element("p").update(_2ba);
var _2c3=new Element("a",{"href":_2bb}).update("Know More &raquo;");
if(_2bc){
_2c3.writeAttribute("trackerCategory",_2bd);
_2c3.writeAttribute("tracker",_2bc);
_2c3.writeAttribute("onclick","ct.helperFunctions.trackLinkClick(this);return false;");
}
if(_2bc){
offerUl.writeAttribute("trackerFunction","ct.trackerForTest");
}
_2c2.appendChild(_2c3);
_2be.appendChild(_2c2);
offerUl.appendChild(_2be);
}
function customLi(i){
var _2c5=home_offers[i].MARKUP;
var _2c6=decodeURIComponent(_2c5);
$("offerUl").innerHTML=$("offerUl").innerHTML+_2c6;
}
function jsonParser(){
var _2c7=new Element("div",{"id":"TopFeatures"});
offerUl=new Element("ul",{"class":"inline clearfix carousel","id":"offerUl","visibleSlides":"1","navStyle":"carouselNavigation","widthType":"fixed","loopSlides":"yes"});
_2c7.appendChild(offerUl);
$("offerDisplay").appendChild(_2c7);
for(var i=0;i<home_offers.length;i++){
if(home_offers[i].OFFERSTYLE=="STANDARD"){
standardLi(i);
}else{
customLi(i);
}
}
if(home_offers.length>1){
ct.carousel(offerUl);
}
}
try{
_2b6=_2b6.replace("http://www.cleartrip.com","");
new Ajax.Request(_2b6,{method:"get",onSuccess:function(_2c9){
try{
var resp;
if(_2c9.responseText){
eval(_2c9.responseText);
if(typeof home_offers!="undefined"){
window.home_offers=home_offers;
jsonParser();
}else{
window.home_offers=[];
}
}
}
catch(e){
console.log("error in offers JSON parsing");
}
},onFailure:function(){
}});
}
catch(e){
console.log("error in offers JSON");
}
},trackerForTest:function(_2cb){
$(_2cb).select("a.slide-jump").each(function(_2cc){
if(_2cc.hasClassName("active")){
if(pageTracker){
pageTracker._trackEvent(_2cc.readAttribute("trackerCategory"),"view",_2cc.readAttribute("tracker"));
}
}
});
},trackers:{page_count:function(){
try{
if(window.ct_ct_track){
var _2cd="/common/ctct";
var _2ce="ct_ct";
var _2cf=ct.cookies.read(_2ce)?ct.cookies.read(_2ce):"";
var _2d0=ct.cookies.read("Apache")?ct.cookies.read("Apache"):"";
var _2d1={"n":ct_ct_track.n,"s":_2cf,"p":ct_ct_track.p,"a":_2d0};
new Ajax.Request(_2cd,{method:"get",parameters:_2d1,requestHeaders:["Pragma","no-cache","Cache-Control","no-cache","Expires","0"],onSuccess:function(_2d2){
ct.cookies.create(_2ce,_2d2.responseText.trim(),365);
},onFailure:function(_2d3){
ct.console.log("error in ct tracking call");
}});
}
}
catch(e){
ct.console.log("error in ct tracking");
}
}},socialmedia:{facebook:function(_2d4){
_2d4=$(_2d4?_2d4:document.body);
var _2d5=$A($(_2d4).getElementsByTagName("a"));
var _2d6=[];
_2d5.each(function(_2d7){
if($(_2d7).hasClassName("facebookShare")||$(_2d7).hasClassName("facebookShare_small")){
if($(_2d7).readAttribute("jsModify")&&$(_2d7).readAttribute("jsModify")=="true"){
ct.socialmedia.bitly.compressorIt=false;
}
if($(_2d7).readAttribute("messageLink")){
if($(_2d7).readAttribute("messageLink")==="${documentUrl}"){
$(_2d7).writeAttribute("messagelink",window.location.href);
}else{
if($(_2d7).readAttribute("messageLink").toLowerCase().indexOf("http")!=0){
$(_2d7).writeAttribute("messagelink","http://"+$(_2d7).readAttribute("messageLink"));
}
}
_2d7.compressedUrl=$(_2d7).readAttribute("messageLink");
_2d7.toCompressUrl=$(_2d7).readAttribute("messageLink");
_2d6.push($(_2d7));
}
$(_2d7).observe("click",function(){
var _2d8=function(){
var link=_2d7.compressedUrl;
var desc=encodeURIComponent($(_2d7).readAttribute("messageDescription"));
var img=($(_2d7).readAttribute("dispImg"))?$(_2d7).readAttribute("dispImg"):"";
if(img.indexOf("http")!=0){
img=window.location.host+img;
}
img=encodeURIComponent(img);
if($(_2d7).readAttribute("messageId")){
var _2dc=encodeURIComponent($(_2d7.readAttribute("messageId")).value);
facebookwindow=window.open("http://www.facebook.com/sharer.php?s=100&p[title]="+_2dc+"&p[url]="+link+"&p[summary]="+desc+"&p[images][0]="+img,"facebookwindow","menubar=1,resizable=1,width=550,height=450,left=100,top=100,screenX=100,screenY=100");
if(facebookwindow){
facebookwindow.focus();
}
}else{
if($(_2d7).readAttribute("customMessage")){
var _2dc=encodeURIComponent($(_2d7).readAttribute("customMessage"));
var desc=encodeURIComponent($(_2d7).readAttribute("messageDescription"));
facebookwindow=window.open("http://www.facebook.com/sharer.php?s=100&p[title]="+_2dc+"&p[url]="+link+"&p[summary]="+desc+"&p[images][0]="+img,"facebookwindow","menubar=1,resizable=1,width=550,height=450,left=100,top=100,screenX=100,screenY=100");
if(facebookwindow){
facebookwindow.focus();
}
}
}
};
if(window.location.protocol==="http:"){
if(window.documentUrlshort){
$(_2d7).compressedUrl=window.documentUrlshort;
_2d8();
ct.console.log("social :: documentUrlshort");
}else{
$(_2d7).compressedUrl="";
ct.socialmedia.bitly.loadBitly(function(){
ct.socialmedia.bitly.compressor(_2d7,_2d8);
});
ct.console.log("social :: documentUrlshort null");
}
}else{
$(_2d7).compressedUrl=_2d7.toCompressUrl;
_2d8();
ct.console.log("social :: documentUrlshort https");
}
});
}
});
if(_2d6.length>0&&window.location.protocol==="http:"){
ct.socialmedia.bitly.loadBitly();
}
},twitter:function(_2dd){
_2dd=$(_2dd?_2dd:document.body);
var _2de=$A($(_2dd).getElementsByTagName("a"));
var _2df=[];
_2de.each(function(_2e0){
if($(_2e0).hasClassName("tweetThis")||$(_2e0).hasClassName("tweetThis_small")){
if($(_2e0).readAttribute("jsModify")&&$(_2e0).readAttribute("jsModify")=="true"){
ct.socialmedia.bitly.compressorIt=false;
}
if($(_2e0).readAttribute("messageLink")){
if($(_2e0).readAttribute("messageLink")==="${documentUrl}"){
$(_2e0).writeAttribute("messagelink",window.location.href);
}else{
if($(_2e0).readAttribute("messageLink").toLowerCase().indexOf("http")!=0){
$(_2e0).writeAttribute("messagelink","http://"+$(_2e0).readAttribute("messageLink"));
}
}
_2e0.compressedUrl=$(_2e0).readAttribute("messageLink");
_2e0.toCompressUrl=$(_2e0).readAttribute("messageLink");
_2df.push($(_2e0));
}
$(_2e0).observe("click",function(){
var _2e1=function(){
if($(_2e0).readAttribute("messageId")){
twitterwindow=window.open("http://twitter.com/home/?status="+$(_2e0).readAttribute("messageId")+" - "+$(_2e0).compressedUrl,"twitter","menubar=1,resizable=1,width=800,height=550,left=100,top=100,screenX=100,screenY=100");
if(twitterwindow){
twitterwindow.focus();
}
}else{
if($(_2e0).readAttribute("customMessage")){
var _2e2=encodeURIComponent($(_2e0).readAttribute("customMessage"));
twitterwindow=window.open("http://twitter.com/home/?status="+$(_2e0).readAttribute("customMessage")+" - "+$(_2e0).compressedUrl,"twitter","menubar=1,resizable=1,width=750,height=550,left=100,top=100,screenX=100,screenY=100");
if(twitterwindow){
twitterwindow.focus();
}
}
}
};
if(window.location.protocol==="http:"){
if(window.documentUrlshort){
$(_2e0).compressedUrl=window.documentUrlshort;
ct.console.log("social :: documentUrlshort");
_2e1();
}else{
$(_2e0).compressedUrl="";
ct.socialmedia.bitly.loadBitly(function(){
ct.socialmedia.bitly.compressor(_2e0,_2e1);
});
ct.console.log("social :: documentUrlshort null");
}
}else{
$(_2e0).compressedUrl=_2e0.toCompressUrl;
_2e1();
ct.console.log("social :: documentUrlshort https");
}
});
}
});
if(_2df.length>0&&window.location.protocol==="http:"){
ct.socialmedia.bitly.loadBitly();
}
},bitly:{bitlyLoaded:false,loadBitly:function(_2e3){
if(!ct.socialmedia.bitly.bitlyLoaded){
ct.socialmedia.bitly.bitlyLoaded=true;
var _2e4=new Element("script",{type:"text/javascript",charset:"utf-8",src:"http://bit.ly/javascript-api.js?version=latest&login=cleartripdev&apiKey=R_7a84981a7e378606bc8783874d9a0ffe"});
document.getElementsByTagName("head")[0].appendChild(_2e4);
}
var _2e5=setInterval(function(){
if(window.BitlyApiClient){
clearInterval(_2e5);
if(_2e3){
_2e3();
}
}
},500);
},compressorIt:true,pointer:-1,compressor:function(link,_2e7){
var _2e8=setInterval(function(){
if(ct.socialmedia.bitly.compressorIt){
clearInterval(_2e8);
ct.socialmedia.bitly.pointer++;
var _2e9="BitlyCB.renderResponse_"+ct.socialmedia.bitly.pointer;
BitlyCB["renderResponse_"+ct.socialmedia.bitly.pointer]=function(data){
var _2eb=Object.values(data.results)[0];
ct.console.log(link.id+" :: :: "+Object.keys(data.results)[0]+" :: :: "+_2eb.shortUrl);
if(_2eb.shortUrl){
link.compressedUrl=_2eb.shortUrl;
window.documentUrlshort=_2eb.shortUrl;
}else{
ct.console.log(link.id);
link.compressedUrl="http://www.cleartrip.com";
}
_2e7();
};
BitlyClient.call("shorten",{"longUrl":link.toCompressUrl},_2e9);
}
},100);
}}},ajaxTimeoutHandler:{onCreate:function(_2ec){
var _2ed=120000;
if(_2ec.options.timeOut){
_2ed=_2ec.options.timeOut;
}else{
if(window["customAjaxTimeout"]){
_2ed=customAjaxTimeout;
}
}
_2ec.timeoutId=window.setTimeout(function(){
if($A([1,2,3]).indexOf(parseInt(_2ec.transport.readyState,10))!==-1){
_2ec.transport.abort();
if((!_2ec.url.match("/urltrack/"))&&(!_2ec.url.match("fare-rules"))){
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(_2ec.options.onFailure){
_2ec.options.onFailure(_2ec.transport,_2ec.json);
}
}
},_2ed);
},onComplete:function(_2ee){
window.clearTimeout(_2ee.timeoutId);
}}};
String.prototype.trim=function(){
return this.replace(/^\s*/,"").replace(/\s*$/,"");
};
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();
if(!window.isCalendarPage){
ct.bubbles.parseDomTree();
}
ct.stickyBlocks.parseDomTree();
ct.genericBlocks.parseDomTree();
ct.controls.parseDomTree();
ct.carousel();
Event.observe(document,"click",function(){
if($("ct_bubbleNode")){
ct.dom.removeIEIframeFix($("ct_bubbleNode"));
$("ct_bubbleNode").remove();
}
});
setTimeout(ct.helperFunctions.prefetchResources,3000);
ct.socialmedia.twitter();
ct.socialmedia.facebook();
ct.trackers.page_count();
}
function startupLoad(){
if(window.placeIe9JumpListBanner==true){
ct.helperFunctions.ie9JumpList.createBanners();
}else{
if(window.updateIe9JumpList==true){
if(ct.helperFunctions.ie9JumpList){
ct.helperFunctions.ie9JumpList.updateJumpList();
}
}
}
if(window.rhsOfferUrl){
ct.offerRenderForHomeRHS(window.rhsOfferUrl);
}
setTimeout(function(){
var _2f0=document.location.toString();
_2f0=_2f0.toQueryParams();
if(_2f0.host){
var _2f1=$("AirSearch")?$("AirSearch"):$("home_hotels");
_2f1.action="http://"+_2f0.host+($("AirSearch")?"/airInterstitial":"/hotelInterstitial");
if($("offer_nav")){
$("offer_nav").select("a").each(function(link){
link.href=link.href+"?host="+_2f0.host;
});
}
}
},3000);
var _2f3=new Image();
var loc=window.location;
_2f3.src=loc.protocol+"//"+loc.host+"/images/elements/error_arrow.gif";
ct.cookies.erase("ct-dom-style");
if((!(location.search.toQueryParams("&").noGA=="true"))&&(($("noGA")&&$("noGA").value!="true")||(!($("noGA"))))){
var _2f5=new Date().getTime();
var _2f6=new Element("script",{type:"text/javascript",src:"/javascripts/ga.v"+_2f5+".js"});
document.getElementsByTagName("head")[0].appendChild(_2f6);
}
if(window.location.hostname=="www.cleartrip.com"||window.location.hostname=="staging.cleartrip.com"||window.location.hostname=="beta.cleartrip.com"){
if((!(location.search.toQueryParams("&").noWT=="true"))&&(($("noWT")&&$("noWT").value!="true")||(!($("noWT"))))){
var _2f5=new Date().getTime();
var _2f7=new Element("script",{type:"text/javascript",src:"/javascripts/webtrends.v"+_2f5+".js"});
document.getElementsByTagName("head")[0].appendChild(_2f7);
}
}
if(window.productCode!="CP"&&window.productCode!="AG"&&(!window.isWL)){
window._comscore=window._comscore||[];
window._comscore.push({c1:"2",c2:"7561529"});
var s=document.createElement("script"),el=document.getElementsByTagName("script")[0];
s.src=(document.location.protocol=="https:"?"https://sb":"http://b")+".scorecardresearch.com/beacon.js";
el.parentNode.insertBefore(s,el);
}
if(window.moverride_jsver!=null&&$("mobileLink")){
var _2fa=new Element("script",{type:"text/javascript",src:"/javascripts/mobile/m_override"+window.moverride_jsver+".js"});
document.getElementsByTagName("head")[0].appendChild(_2fa);
var _2fb=document.cookie;
if(_2fb!=null&&_2fb.indexOf("ct.mobile.override")!=-1){
$("mobileLink").style.display="";
}else{
$("mobileLink").parentNode.removeChild($("mobileLink"));
}
}
if(window.setprimarynavigation){
if(document.cookie){
usrname="";
var _2fc=document.cookie.split(";");
for(var c=0;c<_2fc.length;c++){
var _2fe=_2fc[c].split("=");
if(_2fe[0]==" userid"){
var _2ff=_2fc[c].split("=");
usrname=_2ff[1];
usrname=usrname.replace("%40","@");
var _300=new Element("a",{"class":"","title":"Your member page","id":"AccountMenuLink","href":"#"}).update(usrname);
$$(".first")[0].appendChild(_300);
}
}
}
if(usrname==""){
var _300=new Element("a",{"class":"","title":"Your member page","id":"signin","href":"/signin"}).update("Sign In");
_300.addClassName("forceHttps");
$$(".first")[0].appendChild(_300);
ct.validator.parseDomTree("signin");
}
}
}
if(window.ui_optm){
document.observe("dom:loaded",startupCode);
}else{
Event.observe(window,"load",startupCode);
}
Event.observe(window,"load",startupLoad);
Event.observe(window,"pageshow",function(evt){
if(evt.persisted){
startupCode();
}
});
})();
Ajax.Responders.register(ct.ajaxTimeoutHandler);

