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><option value=\"5\">5</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><option value=\"4\">4</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><option value=\"5\">5</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><option value=\"4\">4</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>5){
_100.options[q]=null;
--_103;
--q;
}
}
var diff;
if((q-1)<(diff=5-_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.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){
}
}},genericBlocks:{consentBlock:function(_12f){
if($(_12f).hasClassName("required")){
ct.validator.attachValidation($("consent"),ct_i18n.validate.bookPolicyMsg,function(_130){
return (_130.checked);
});
}
},signupBlock:function(_131){
ct.validator.attachValidation($("confirmUname"),ct_i18n.validate.confirmEmailMsg,function(){
if($F("confirmUname")===""||$F("newUname")===""){
return true;
}
return ($F("confirmUname")===$F("newUname"));
});
},flightForm:function(_132,_133){
function isInternational(){
if(($F("origin_autocomplete").indexOf(", IN - ")>=0)&&($F("destination_autocomplete").indexOf(", IN - ")>=0)){
return false;
}
return true;
}
function modifyDropdowns(){
var _134=$F("adults"),_135=$F("children"),_136=$F("infants"),i,_138;
$A($("children").childNodes).each(Element.remove);
$A($("infants").childNodes).each(Element.remove);
for(i=0;i<=_134;i++){
_138=new Element("option",{value:i}).update(i);
if(_136==i){
_138.setAttribute("selected","selected");
}
$("infants").appendChild(_138);
}
for(i=0;i<(10-_134);i++){
_138=new Element("option",{value:i}).update(i);
if(_135==i){
_138.setAttribute("selected","selected");
}
$("children").appendChild(_138);
}
}
function prepopulateForm(){
if(window.location.href.split("flights?")[1]&&window.productCode!="CP"&&window.productCode!="AG"){
var _139=decodeURIComponent(window.location.href.split("flights?")[1]);
_139=_139.gsub(/\+/," ");
var _13a;
if(ct.cookies.read("flight_sr")){
_13a=ct.cookies.read("flight_sr").toQueryParams("&");
}else{
_13a={};
}
var _13b="";
if(window.productCode!="AG"&&window.productCode!="CP"&&(window.jsSetCookieDomain!=true)){
ct.cookies.erase("flight_sr");
_13b=window.location.hostname;
_13b=_13b.substr(_13b.indexOf("."));
}
var _13c="";
_13c=window.location.hostname;
_13c=_13c.substr(_13c.indexOf("."));
ct.cookies.erase("flight_sr",_13c);
ct.cookies.create("flight_sr",_139,365,_13b);
}
var _13d=ct.cookies.read("flight_sr");
var _13e=ct.cookies.read("was_oneway_click");
if(!$(_132).hasClassName("no-action-change")){
if(window.productCode==="CP"){
_132.action="/airInterstitial";
}else{
_132.action="/flights/search";
}
}
if(_13d){
function populateTextField(_13f,_140){
if(document.activeElement){
if(document.activeElement!==_13f){
_13f.value=_140;
}
}else{
_13f.value=_140;
}
}
_13d=_13d.toQueryParams("&");
if((_13e&&_13e==="false")||(!(_13e)&&((_13d.rnd_one==="R")||(_13d.rnd_one==="C")))){
if(_13d.depart_date&&!ct.dates.isPast(ct.dates.fromString(_13d.depart_date))){
populateTextField(_132.depart_date,_13d.depart_date);
}
if(_13d.return_date&&!ct.dates.isPast(ct.dates.fromString(_13d.return_date))){
populateTextField(_132.return_date,_13d.return_date);
}
$("rnd_trip").checked=true;
makeRoundTrip();
}else{
if((_13e&&_13e==="true")||(!(_13e)&&(_13d.rnd_one==="O"))){
$("one_way").checked=true;
makeOneWay();
if(_13d.depart_date&&!ct.dates.isPast(ct.dates.fromString(_13d.depart_date))){
populateTextField(_132.depart_date,_13d.depart_date);
}
}else{
if(!_13d.rnd_one){
$("one_way").checked=true;
}
}
}
$(_132.from).writeAttribute("preselect",_13d.from);
if(_132.origin){
_132.origin.value=_13d.origin||"";
}
_132.from.value=_13d.from||"";
_132.destination.value=_13d.destination||"";
_132.to.value=_13d.to||"";
_132.adults.value=_13d.adults||"1";
if(window.productCode==="AG"){
_132.children.value=_13d.children||"0";
}else{
_132.childs.value=_13d.childs||"0";
}
_132.infants.value=_13d.infants||"0";
}else{
if(_132.origin.value===""||_132.origin.value===_132.origin.readAttribute("selflabel")){
if(_132.style.display!="none"&&_132.parentNode.style.display!="none"){
_132.origin.focus();
}
}
if(_13e){
if(_13e&&_13e==="false"){
$("rnd_trip").checked=true;
makeRoundTrip();
}else{
if(_13e&&_13e==="true"){
$("one_way").checked=true;
makeOneWay();
}
}
}else{
$("one_way").checked=true;
}
}
}
$("adults","children","infants").each(function(_141){
$A(_141.childNodes).each(Element.remove);
var _142=(_141.id==="adults")?1:0;
for(var i=_142;i<10;i++){
_141.appendChild(new Element("option",{value:i}).update(i));
}
});
$("adults").observe("change",modifyDropdowns);
if(!_132.hasClassName("dontprepopulate")){
prepopulateForm();
modifyDropdowns();
}
var _144=function(_145,_146){
var dest=_146.destination.value;
var city=dest.split(",")[0],_149=((dest.split(",")[1]).split("-")[0]).strip();
var _14a;
if($("rnd_trip").checked&&_146.return_date.value!==""&&_146.return_date.value!==_146.return_date.readAttribute("selflabel")){
if(_146.depart_date.value===_146.return_date.value){
var ret=ct.dates.fromString(_146.depart_date.value);
ret.setDate(ret.getDate()+1);
_14a=ct.dates.toString(ret);
}else{
_14a=_146.return_date.value;
}
}else{
var ret=ct.dates.fromString(_146.depart_date.value);
ret.setDate(ret.getDate()+2);
_14a=ct.dates.toString(ret);
}
var adlt=parseInt(_146.adults.value,10);
var chld=(parseInt(_146.childs.value,10)+parseInt(_146.infants.value,10));
var _14e={"city":city,"country":_149,"chk_in":_146.depart_date.value,"chk_out":_14a,"num_rooms":"1","adults1":(adlt>2?2:adlt),"children1":(chld>2?2:chld)};
Object.keys(_14e).each(function(key){
_145.appendChild(new Element("input",{"type":"hidden","name":key,"value":_14e[key]}));
});
ct.cookies.create("hotel_sr",$H(_14e).toQueryString(),365);
};
$(_132).observe("submit",function(_150){
if(!(_132.errors&&_132.errors.length>0)&&!$(_132).hasClassName("noCookie")){
if($("searchHotels")&&$("searchHotels").checked&&$("comboHotelSearch")&&window.productCode!=="CP"){
_144($("comboHotelSearch"),_132);
var _151=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(_151){
$("comboHotelSearch").submit();
_151.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 _152=$(_132).serialize();
var _153;
if(ct.cookies.read("flight_sr")){
_153=ct.cookies.read("flight_sr").toQueryParams("&");
}else{
_153={};
}
var _154="";
if(window.productCode!="AG"&&window.productCode!="CP"&&(window.jsSetCookieDomain!=true)){
ct.cookies.erase("flight_sr");
_154=window.location.hostname;
_154=_154.substr(_154.indexOf("."));
}
var _155="";
_155=window.location.hostname;
_155=_155.substr(_155.indexOf("."));
ct.cookies.erase("flight_sr",_155);
ct.cookies.create("flight_sr",_152,365,_154);
}
if(_132.hasClassName("external_offers")&&window.productCode!=="CP"&&window.productCode!=="AG"){
_132.action="http://www.cleartrip.com/flights/search";
}
});
if($("adv_link")){
$("adv_link").observe("click",function(_156){
setAdvCookie();
$("advanced_search1").toggle();
$("adv_link").toggleClassName("toggle_open");
$("adv_link").toggleClassName("toggle_closed");
});
}
(function(){
var _157=ct.cookies.read("adv1");
if($("adv_link")&&_157==="off"&&$("advanced_search1").style.display==="none"){
$("advanced_search1").toggle();
$("adv_link").toggleClassName("toggle_open");
$("adv_link").toggleClassName("toggle_closed");
}
})();
var _158=ct.validator.attachValidation;
_158($("destination_autocomplete"),ct_i18n.validate.orgDestSameMsg,function(){
if(($F("from")!=="")&&($F("to")!=="")){
return $F("from")!==$F("to");
}else{
return true;
}
});
_158($("infants"),ct_i18n.validate.infantAdultNumMsg,function(){
return $F("infants")<=$F("adults");
});
_158($("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 _159=ct.dates.fromString($("dpt_date").readAttribute("mindate"));
_159.setDate(_159.getDate()+0);
return (ct.dates.fromString($F("dpt_date"))-_159)>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(_15a){
var _15b;
eval("searchItem ="+_15a.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<_15b.records.length;i++){
if(_15b.records[i].sc_return_date==="null"){
$("save_search").appendChild(new Element("a",{"href":"http://"+document.location.host+"/search/flights/"+_15b.records[i].url}).update(_15b.records[i].fromcity+" - "+_15b.records[i].tocity+"<br />")).appendChild(new Element("span",{"style":"font-size:9px;color:#A3A3A3;"}).update(_15b.records[i].sc_depart_date));
}else{
$("save_search").appendChild(new Element("a",{"href":"http://"+document.location.host+"/search/flights/"+_15b.records[i].url}).update(_15b.records[i].fromcity+" - "+_15b.records[i].tocity+" - "+_15b.records[i].fromcity+"<br />")).appendChild(new Element("span",{"style":"font-size:9px;color:#A3A3A3;"}).update(_15b.records[i].sc_depart_date+" - "+_15b.records[i].sc_return_date));
}
}
},onFailure:function(_15d){
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 _15e=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="";
}
});
}
}
_15e.makeOneWay=makeOneWay;
_15e.makeRoundTrip=makeRoundTrip;
if(_133){
function prepareMcForm(){
if(_133["rnd_one"][2]){
_133["rnd_one"][2].checked=true;
}
if($$("body")[0].hasClassName("Home")){
$$("body")[0].addClassName("MultiCity");
}else{
$("modify_search_open").addClassName("MultiCity");
}
$(_133).show();
$(_132).hide();
$(_132.readAttribute("errorblockid")).parentNode.style.display="none";
$(_133.readAttribute("errorblockid")).parentNode.style.display="";
if($("offers_1")){
$("offers_1").hide();
}
if($("tipMessage")){
$("tipMessage").hide();
}
if($("alternateDates")){
$("alternateDates").hide();
}
}
_15e.prepareMcForm=prepareMcForm;
if(_132["rnd_one"][2]){
Event.observe(_132["rnd_one"][2],"click",prepareMcForm);
}
}else{
if(_132["rnd_one"][2]){
Event.observe(_132["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 _163=ct.cookies.read("adv1");
if(_163===""||_163===null||_163==="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(_164,_165){
if(!ct.genericBlocks.flightForm.helpers){
ct.genericBlocks.flightForm.helpers={};
}
var _166=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(_168){
if(_168.readAttribute("selflabel")){
if(_168.value===""||_168.value===_168.readAttribute("selflabel")){
return true;
}
}else{
if(_168.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,_16c){
if(isEmpty($("origin_autocomplete"+ind))&&isEmpty($("destination_autocomplete"+ind))&&(isEmpty($("dpt_date_"+ind))||$("dpt_date_"+ind).disabled)){
if((ind==3)){
if(isEmpty($("origin_autocomplete"+(_16c+1)))&&isEmpty($("destination_autocomplete"+(_16c+1)))&&(isEmpty($("dpt_date_"+(_16c+1)))||$("dpt_date_"+(_16c+1)).disabled)&&isEmpty($("origin_autocomplete"+(_16c+2)))&&isEmpty($("destination_autocomplete"+(_16c+2)))&&(isEmpty($("dpt_date_"+(_16c+2)))||$("dpt_date_"+(_16c+2)).disabled)){
return true;
}else{
return false;
}
}else{
if(ind==4){
if(isEmpty($("origin_autocomplete"+(_16c+1)))&&isEmpty($("destination_autocomplete"+(_16c+1)))&&(isEmpty($("dpt_date_"+(_16c+1)))||$("dpt_date_"+(_16c+1)).disabled)){
return true;
}else{
return false;
}
}else{
return true;
}
}
}else{
return false;
}
}
function modifyDropdowns(){
var _16d=$F("mc_adults"),_16e=$F("mc_children"),_16f=$F("mc_infants"),i,_171;
$A($("mc_children").childNodes).each(Element.remove);
$A($("mc_infants").childNodes).each(Element.remove);
for(i=0;i<=_16d;i++){
_171=new Element("option",{value:i}).update(i);
if(_16f==i){
_171.setAttribute("selected","selected");
}
$("mc_infants").appendChild(_171);
}
for(i=0;i<(10-_16d);i++){
_171=new Element("option",{value:i}).update(i);
if(_16e==i){
_171.setAttribute("selected","selected");
}
$("mc_children").appendChild(_171);
}
}
function prepopulateForm(){
for(var i=3;i<=5;i++){
_164["depart_date_"+i].disabled=true;
}
var _173=ct.cookies.read("mc_flight_sr");
if(window.productCode=="AG"){
_164.action="/flights/search";
}
if(_173){
function populateTextField(_174,_175){
if(document.activeElement){
if(document.activeElement!==_174){
_174.value=_175;
}
}else{
_174.value=_175;
}
}
_173=_173.toQueryParams("&");
for(var i=1;i<=5;i++){
if(_173["depart_date_"+i]&&_173["depart_date_"+i]!=_164["depart_date_"+i].readAttribute("selflabel")&&!ct.dates.isPast(ct.dates.fromString(_173["depart_date_"+i]))){
_164["depart_date_"+i].disabled=false;
populateTextField(_164["depart_date_"+i],_173["depart_date_"+i]);
}
$(_164["from"+i]).writeAttribute("preselect",_173["from"+i]);
if(_164["origin"+i]){
if(_173["origin"+i]&&_173["origin"+i]!=_164["origin"+i].readAttribute("selflabel")){
_164["origin"+i].value=_173["origin"+i];
}
}
if(_173["destination"+i]&&_173["destination"+i]!=_164["destination"+i].readAttribute("selflabel")){
_164["destination"+i].value=_173["destination"+i];
}
_164["from"+i].value=_173["from"+i]||"";
_164["to"+i].value=_173["to"+i]||"";
if(_173["dpt_time_"+i]&&_164["dpt_time_"+i]){
_164["dpt_time_"+i].value=_173["dpt_time_"+i];
}
}
_164.adults.value=_173.adults||"1";
_164.childs.value=_173.childs||"0";
_164.infants.value=_173.infants||"0";
if((!($$("body.Home")[0])||$("cities_error"))&&_165&&ct.cookies.read("was_mc_search")==="true"){
_166.prepareMcForm();
}
}else{
if(_164["origin1"].value===""||_164["origin1"].value===_164["origin1"].readAttribute("selflabel")){
if(_164.style.display!="none"&&_164.parentNode.style.display!="none"){
_164["origin1"].focus();
}
}
}
}
$("mc_adults","mc_children","mc_infants").each(function(_176){
$A(_176.childNodes).each(Element.remove);
var _177=(_176.id==="mc_adults")?1:0;
for(var i=_177;i<10;i++){
_176.appendChild(new Element("option",{value:i}).update(i));
}
});
$("mc_adults").observe("change",modifyDropdowns);
if(_165){
function prepareMainForm(_179){
_179.checked=true;
if($$("body")[0].hasClassName("Home")){
$$("body")[0].removeClassName("MultiCity");
}else{
$("modify_search_open").removeClassName("MultiCity");
}
$(_164).hide();
$(_165).show();
$(_164.readAttribute("errorblockid")).style.display="none";
$(_165.readAttribute("errorblockid")).style.display="";
if($("offers_1")){
$("offers_1").show();
}
if($("tipMessage")){
$("tipMessage").show();
}
if($("alternateDates")){
$("alternateDates").show();
}
}
_166.prepareMainForm=prepareMainForm;
Event.observe(_164["rnd_one"][0],"click",function(){
prepareMainForm(_165["rnd_one"][0]);
_166.makeRoundTrip();
});
Event.observe(_164["rnd_one"][1],"click",function(){
prepareMainForm(_165["rnd_one"][1]);
_166.makeOneWay();
});
}else{
Event.observe(_164["rnd_one"][0],"click",function(){
ct.cookies.create("was_oneway_click","false",1);
window.location.href="../flights";
});
Event.observe(_164["rnd_one"][1],"click",function(){
ct.cookies.create("was_oneway_click","true",1);
window.location.href="../flights";
});
}
if(!_164.hasClassName("dontprepopulate")){
prepopulateForm();
modifyDropdowns();
}
$(_164).observe("submit",function(_17a){
if(!(_164.errors&&_164.errors.length>0)&&!$(_164).hasClassName("noCookie")){
var _17b="";
if(window.productCode!="AG"&&window.productCode!="CP"&&(window.jsSetCookieDomain!=true)){
ct.cookies.erase("mc_flight_sr");
_17b=window.location.hostname;
_17b=_17b.substr(_17b.indexOf("."));
}
var _17c="";
_17c=window.location.hostname;
_17c=_17c.substr(_17c.indexOf("."));
ct.cookies.erase("mc_flight_sr",_17c);
ct.cookies.create("mc_flight_sr",$(_164).serialize(),365,_17b);
ct.cookies.create("was_mc_search","true",365);
}
if(_164.hasClassName("external_offers")&&(window.productCode!=="AG"&&window.productCode!=="CP")){
_164.action="http://www.cleartrip.com/flights/search";
}
});
var _17d=ct.validator.attachValidation;
for(var i=3;i<=5;i++){
_17d($("origin_autocomplete"+i),ct_i18n.validate.requiredMsg.replace("${field}",$("origin_autocomplete"+i).title),function(_17f){
var ind=_17f.id.charAt(_17f.id.length-1);
var _181=parseInt(ind,10);
if(checkGroupedElements(ind,_181)){
return true;
}else{
if(isEmpty($("origin_autocomplete"+ind))){
return false;
}
return true;
}
});
_17d($("destination_autocomplete"+i),ct_i18n.validate.requiredMsg.replace("${field}",$("destination_autocomplete"+i).title),function(_182){
var ind=_182.id.charAt(_182.id.length-1);
var _184=parseInt(ind,10);
if(checkGroupedElements(ind,_184)){
return true;
}else{
if(isEmpty($("destination_autocomplete"+ind))){
return false;
}
return true;
}
});
_17d($("dpt_date_"+i),ct_i18n.validate.requiredMsg.replace("${field}",$("dpt_date_"+i).title),function(_185){
var ind=_185.id.charAt(_185.id.length-1);
var _187=parseInt(ind,10);
if(checkGroupedElements(ind,_187)){
return true;
}else{
if(isEmpty($("dpt_date_"+ind))){
return false;
}
return true;
}
});
}
for(var i=1;i<=5;i++){
_17d($("destination_autocomplete"+i),ct_i18n.validate.orgDestSameMsg,function(_188){
var ind=_188.id.charAt(_188.id.length-1);
if(($F("from"+ind)!=="")&&($F("to"+ind)!=="")){
return $F("from"+ind)!==$F("to"+ind);
}else{
return true;
}
});
_17d($("dpt_date_"+i),ct_i18n.validate.intrFlightDepDate,function(_18a){
var ind=_18a.id.charAt(_18a.id.length-1);
if(!ct.dates.isValidDateString($F("dpt_date_"+ind))){
return true;
}else{
var _18c="";
if($("dpt_date_"+ind).readAttribute("mindate")){
_18c=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")))){
_18c=ct.dates.fromString($($("dpt_date_"+ind).readAttribute("mindatefieldid")).value);
}
}
if(_18c){
if(ind==1&&isInternational()){
_18c.setDate(_18c.getDate()+0);
this.message=ct_i18n.validate.intrFlightDepDate;
return (ct.dates.fromString($F("dpt_date_"+ind))-_18c)>0;
}else{
if(ind!=1){
this.message=ct_i18n.validate.validMinDateMsg.replace("${field}",_18a.title.toLowerCase()).replace("${date}",_18a.readAttribute("mindate"));
return (ct.dates.fromString($F("dpt_date_"+ind))-_18c)>=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 _18f=$("destination_autocomplete"+(parseInt(ind,10)-1));
if((this.value==""||this.value===this.readAttribute("selflabel"))&&(_18f&&_18f.value!=""&&_18f.value!=_18f.readAttribute("selflabel"))){
Event.stop(evt);
this.value=_18f.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);
}
}
_17d($("infants"),ct_i18n.validate.infantAdultNumMsg,function(){
return $F("infants")<=$F("adults");
});
},hotelForm:function(_190){
ct.validator.attachValidation($("rooms"),ct_i18n.validate.noOfRoomsMsg,function(){
var _191=parseInt($F("rooms"),10);
for(var i=0;i<_191;i++){
if($("adults"+(i+1))===null||$("children"+(i+1))===null){
return false;
}
}
return true;
});
if(!_190.hasClassName("dontprepopulate")){
(function(){
if(window.location.href.split("hotels/?")[1]){
var _193=decodeURIComponent(window.location.href.split("hotels/?")[1]);
_193=_193.gsub(/\+/," ");
ct.cookies.create("hotel_sr",_193,365);
}
if(ct.cookies.read("hotel_sr")&&!(_190.id==="fetch_rates")){
var _194=ct.cookies.read("hotel_sr").toQueryParams("&");
_190.city.value=_194.city||"";
_190.state.value=_194.state||"";
_190.country.value=_194.country||"";
_190.dest_code.value=_194.dest_code||"";
if(_194.chk_in&&!ct.dates.isPast(ct.dates.fromString(_194.chk_in))){
_190.chk_in.value=_194.chk_in;
}
if(_194.chk_out&&!ct.dates.isPast(ct.dates.fromString(_194.chk_out))){
_190.chk_out.value=_194.chk_out;
}
$("rooms").value=_194.num_rooms||"1";
if($("showDebug")&&_194.showDebug){
$("showDebug").checked=true;
}
if($("NonResident2")!==null&&$("NonResident2")!==undefined){
$("NonResident2").checked=false;
}
ct.helperFunctions.addRooms(_190.num_rooms);
switch(_194.num_rooms){
case "1":
case "2":
case "3":
case "4":
$("adults1").value=_194.adults1||"1";
$("children1").value=_194.children1||"0";
alterChildren("1");
if(_194.num_rooms=="1"){
break;
}
case "2":
case "3":
case "4":
$("adults2").value=_194.adults2||"1";
$("children2").value=_194.children2||"0";
alterChildren("2");
if(_194.num_rooms=="2"){
break;
}
case "3":
case "4":
$("adults3").value=_194.adults3||"1";
$("children3").value=_194.children3||"0";
alterChildren("3");
if(_194.num_rooms=="3"){
break;
}
case "4":
$("adults4").value=_194.adults4||"1";
$("children4").value=_194.children4||"0";
alterChildren("4");
break;
}
}
})();
}
$(_190).observe("submit",function(_195){
if(!_190.errors){
var _196=false;
if($("NonResident2")!==null&&$("NonResident2")!==undefined&&$("NonResident2").checked){
_196=true;
}
if(!$(_190).hasClassName("no-action-change")){
if($F("dest_code")==="WCT"||_196){
if(window.productCode==="CP"){
_190.action="hotelInterstitial";
}else{
_190.action="/hotels/search";
}
}else{
if($("price_form")){
_190.action=$("price_form").value;
}else{
if(window.productCode==="CP"){
_190.action="hotelInterstitial";
}else{
_190.action="/hotels/search";
}
}
if(_190.readAttribute("campaign")){
_190.action+="?campaign="+_190.readAttribute("campaign");
}
}
}
if($F("dest_code")=="WCT"||_196){
var _197=$("checkin_date").value.split("/");
$("doa_dd").value=_197[0];
$("doa_mm").value=_197[1];
$("doa_yy").value=_197[2];
var _198=$("checkout_date").value.split("/");
$("dod_dd").value=_198[0];
$("dod_mm").value=_198[1];
$("dod_yy").value=_198[2];
var _199=$F("rooms");
var _19a=0;
var _19b=0;
for(var a=0;a<parseInt(_199,10);a++){
_19a+=parseInt(_190["adults"+(a+1)].value,10);
_19b+=parseInt(_190["children"+(a+1)].value,10);
}
$("num_adults").value=Math.ceil(_19a/parseInt(_199,10));
$("num_children").value=Math.ceil(_19b/parseInt(_199,10));
}
ct.cookies.create("hotel_sr",$(_190).serialize(),365);
if(_190.id==="fetch_rates"){
$("wait_img").show();
Event.stop(_195);
var _19d=window.location.href;
var _19e="/hotels/roomrates";
if(_19d.indexOf("allowed_form")!=-1){
_19e=_19e+"?allowed_form=true";
}
new Ajax.Request(_19e,{method:"get",parameters:$(_190.id).serialize()+"&ts="+ct.dates.getTimestamp(),onSuccess:function(_19f){
_190.enable();
$("wait_img").hide();
if(_19f.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=_19f.responseText;
_190.hide();
}
if(window.Effect){
new Effect.Appear("RoomRatesTable");
}else{
$("RoomRatesTable").style.display="block";
}
},onFailure:function(_1a0){
$("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.");
}});
_190.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(_1a1){
var _1a2=ct.validator.attachValidation;
_1a2($("train_adults"),ct_i18n.validate.maxPassengersMsg,function(){
return (+$F("train_adults")+(+$F("train_children"))+(+$F("train_male_seniors"))+(+$F("train_female_seniors")))<=6;
});
_1a2($("train_adults"),ct_i18n.validate.minPassengersMsg,function(){
return (+$F("train_adults")+(+$F("train_children"))+(+$F("train_male_seniors"))+(+$F("train_female_seniors")))>0;
});
_1a2($("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 _1a3=decodeURIComponent(window.location.href.split("trains#")[1]);
_1a3=_1a3.gsub(/\+/," ");
ct.cookies.create("train_sr",_1a3,365);
}
var _1a4=ct.cookies.read("train_sr");
if(_1a4){
function populateTextField(_1a5,_1a6){
if(document.activeElement){
if(document.activeElement!==_1a5){
_1a5.value=_1a6;
}
}else{
_1a5.value=_1a6;
}
}
_1a4=_1a4.toQueryParams("&");
if(_1a4.from_station){
populateTextField(_1a1.from_station,_1a4.from_station);
}
if(_1a4.to_station){
populateTextField(_1a1.to_station,_1a4.to_station);
}
if(_1a4.depart_date&&!ct.dates.isPast(ct.dates.fromString(_1a4.depart_date))){
populateTextField(_1a1.depart_date,_1a4.depart_date);
}
_1a1.adults.value=_1a4.adults||"1";
_1a1.children.value=_1a4.children||"0";
_1a1.male_seniors.value=_1a4.male_seniors||"0";
_1a1.female_seniors.value=_1a4.female_seniors||"0";
_1a1["train[class]"].value=_1a4["train[class]"]||"";
}
}
if(!_1a1.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);
}
$(_1a1).observe("submit",function(){
ct.cookies.create("train_sr",$(_1a1).serialize(),365);
});
},primaryNavFlyoutMenu:function(){
if($("MainTabs")){
if(window.productCode==="CP"||window.productCode==="AG"){
var _1a7=$($("MainTabs").getElementsByTagName("li")[3]);
}else{
var _1a7=$($("MainTabs").getElementsByTagName("li")[4]);
}
if($("more_menu")){
$("more_menu").setStyle({top:(_1a7.cumulativeOffset().top+_1a7.getHeight()+6)+"px",left:_1a7.cumulativeOffset().left+"px"});
$(_1a7.getElementsByTagName("a")[0]).observe("click",function(evt){
if($("more_menu").style.display==="none"){
$("more_menu").style.display="block";
$(_1a7).addClassName("show_menu");
ct.dom.addIEIframeFix($("more_menu"));
}else{
$("more_menu").style.display="none";
ct.dom.removeIEIframeFix($("more_menu"));
$(_1a7).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"));
$(_1a7).removeClassName("show_menu");
}
});
}
}
},accountFlyoutHTML:function(){
var _1a9=new Element("div",{"id":"AccountMenu"});
var _1aa=new Element("ul");
var _1ab=new Element("li").update("<a href=\"/account/trips/list\">Upcoming Trips</a>");
_1aa.appendChild(_1ab);
_1ab=new Element("li").update("<a href=\"/account/profile\">My Profile</a>");
_1aa.appendChild(_1ab);
_1ab=new Element("li").update("<a href=\"/account/preferences\">My Preferences</a>");
_1aa.appendChild(_1ab);
_1a9.appendChild(_1aa);
_1a9.insert("<hr/>");
_1aa=new Element("ul");
_1ab=new Element("li").update("<a href=\"/signout\">Sign out</a>");
_1aa.appendChild(_1ab);
_1a9.appendChild(_1aa);
return _1a9;
},accountFlyoutMenu:function(){
if($("global")){
if($("AccountMenuLink")){
var _1ac=$("AccountMenuLink");
document.body.appendChild(new Element("div",{"id":"AccountMenu","style":"display:none"}));
if($("PrimaryIconNavigation")){
$("AccountMenu").setStyle({top:($(_1ac).cumulativeOffset().top+$(_1ac).getHeight()+12)+"px",left:($(_1ac).cumulativeOffset().left+($("global").select("li")[1].getWidth()-25))+"px"});
}
var _1ad=ct.genericBlocks.accountFlyoutHTML();
$("AccountMenu").insert(_1ad.innerHTML);
$(_1ac).observe("click",function(evt){
if($("AccountMenu").style.display==="none"){
$("AccountMenu").style.display="block";
$(_1ac).addClassName("on");
ct.dom.addIEIframeFix($("AccountMenu"));
}else{
$(_1ac).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"));
$(_1ac).removeClassName("on");
}
});
Event.observe(window,"resize",function(){
if($("PrimaryIconNavigation")){
$("AccountMenu").setStyle({top:($(_1ac).cumulativeOffset().top+$(_1ac).getHeight()+12)+"px",left:($(_1ac).cumulativeOffset().left+($("global").select("li")[1].getWidth()-25))+"px"});
if($("AccountMenu").style.display=="block"){
$(_1ac).addClassName("on");
}
}
});
}
}
},languageFlyoutMenu:function(){
if($("SetDomain")){
var _1b0=document.location.hostname;
var flg="in";
var _1b2="";
var _1b3=["bh","qa","kw","om"];
var _1b4=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(_1b3.indexOf(_1b0.split(".")[0].substr(0,2))!=-1){
_1b2=_1b3[_1b3.indexOf(_1b0.split(".")[0].substr(0,2))];
}
if(_1b0.split(".").length==3){
if(_1b2){
flg=_1b2;
}else{
if(_1b0.split(".")[2]=="com"){
flg="in";
}else{
flg=_1b0.split(".")[2];
}
}
}
$("SetDomain").className="flag "+flg.toUpperCase();
$("SetDomain").observe("click",_1b4);
if(window.sourceCountry){
_1b4();
}
}
},parseDomTree:function(_1b6){
_1b6=_1b6||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(_1b7,_1b8){
var _1b9=$(document.createElement("a"));
var self=this,_1bb;
if(!_1b8){
_1b8={};
}
_1b8.firstDayOfWeek=_1b8.firstDayOfWeek||(_1b7.readAttribute("firstday")?parseInt(_1b7.readAttribute("firstday"),10):1);
_1b8.minDate=_1b8.minDate||(_1b7.readAttribute("mindate")?ct.dates.fromString(_1b7.readAttribute("mindate")):new Date());
_1b8.minDateField=_1b8.minDateField||(_1b7.readAttribute("mindatefieldid")?$(_1b7.readAttribute("mindatefieldid")):null);
_1b8.calendarCount=_1b8.calendarCount||(_1b7.readAttribute("calendarcount")?parseInt(_1b7.readAttribute("calendarcount"),10):2);
_1b8.maxDate=_1b8.maxDate||(_1b7.readAttribute("maxdate")?ct.dates.fromString(_1b7.readAttribute("maxdate")):(new Date(new Date(_1b8.minDate).setFullYear(_1b8.minDate.getFullYear()+1))));
_1b8.offsetDays=_1b8.offsetDays||(_1b7.readAttribute("offsetdays")?parseInt(_1b7.readAttribute("offsetdays"),10):0);
_1b8.defaultDate=_1b8.defaultDate||(_1b7.readAttribute("defaultdate")?ct.dates.fromString(_1b7.readAttribute("defaultdate")):null);
var _1bc=null;
(function(){
if(!_1b7.readAttribute("size")){
_1b7.writeAttribute("size",10);
}
_1b7.writeAttribute("maxdate",ct.dates.toString(_1b8.maxDate));
ct.selfLabels.addSelfLabel(_1b7,"dd/mm/yyyy");
if(_1b7.nextSibling){
_1b7.parentNode.insertBefore(_1b9,_1b7.nextSibling);
}else{
_1b7.parentNode.appendChild(_1b9);
}
_1b9.href="javascript: void(0);";
_1b9.className="cal_openLink";
var _1bd=document.createElement("img");
_1bd.alt="Calendar";
_1bd.title="Click to open calendar";
_1bd.src="/images/global/calendar_icon.gif";
_1b9.appendChild(_1bd);
_1b9.observe("click",function(_1be){
self.showDatePicker();
Event.stop(_1be);
});
_1b7.observe("focus",function(_1bf){
self.showDatePicker();
});
_1b7.observe("click",function(_1c0){
Event.stop(_1c0);
});
_1bc=getMinDate();
})();
if(_1b8.minDateField&&$(_1b8.minDateField)){
$(_1b8.minDateField).observe("ctCalendar:onChange",function(){
if(!_1b7.hasClassName("no_autochange")){
var _1c1=ct.dates.fromString($F(_1b8.minDateField));
_1c1.setDate(_1c1.getDate()+2);
_1b7.value=ct.dates.toString(_1c1);
}
});
}
function getCalendarTableMarkup(){
var doc=document,ce="createElement",sa="setAttribute",ac="appendChild";
function addCol(_1c6,_1c7){
for(var i=0;i<_1c7;i++){
_1c6[ac](doc[ce]("col"));
}
}
var _1c9=doc[ce]("table");
_1c9[sa]("cellpadding","0");
_1c9[sa]("cellspacing","0");
_1c9[sa]("border","0");
var _1ca=doc[ce]("colgroup");
addCol(_1ca,5);
_1c9[ac](_1ca);
_1ca=doc[ce]("colgroup");
_1ca.className="weekend";
addCol(_1ca,2);
_1c9[ac](_1ca);
var _1cb=doc[ce]("thead");
var _1cc=doc[ce]("tr");
var _1cd=[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 _1ce=doc[ce]("tr");
var _1cf=_1b8.firstDayOfWeek;
var _1d0=doc[ce]("th");
_1d0[sa]("colSpan","7");
$(_1d0).addClassName("month");
_1cc[ac](_1d0);
for(var i=0;i<7;i++){
_1cf=_1cf%7;
var _1d2=doc[ce]("th");
if(i===5||i===6){
_1d2.className="weekend";
}
_1d2[ac](doc.createTextNode($A(_1cd)[_1cf]));
_1ce[ac](_1d2);
_1cf++;
}
_1cb[ac](_1cc);
_1cb[ac](_1ce);
_1c9[ac](_1cb);
var _1d3=doc[ce]("tbody");
var _1d4=doc[ce]("tr");
for(i=0;i<7;i++){
var _1d5=doc[ce]("td");
if(i===5||i===6){
_1d5.className="weekend";
}
_1d5[ac](doc.createTextNode(" "));
_1d4[ac](_1d5);
}
for(i=0;i<6;i++){
_1d3[ac](_1d4.cloneNode(true));
}
_1c9[ac](_1d3);
return _1c9;
}
function getCalendarMarkupOutline(){
var doc=document,ce="createElement",sa="setAttribute",ac="appendChild";
var _1da=doc[ce]("div");
_1da[sa]("id","datePickerContainer");
_1da.style.display="block";
var _1db=doc[ce]("div");
_1db.id="close";
$(_1db).addClassName("dt_control");
var _1dc=doc[ce]("a");
_1dc[sa]("href","javascript: void(0);");
_1dc[sa]("id","cal_closeCalendar");
_1dc[sa]("title",ct_i18n.controls.close);
_1dc[ac](doc.createTextNode(" "));
_1db[ac](_1dc);
_1da[ac](_1db);
var _1dd=doc[ce]("div");
_1dd.id="previous";
$(_1dd).addClassName("dt_control");
var _1de=doc[ce]("a");
_1de[ac](doc.createTextNode(" "));
_1de[sa]("href","javascript: void(0);");
_1de[sa]("id","cal_showPreviousMonth");
_1de[sa]("title",ct_i18n.controls.prevMonth);
_1dd[ac](_1de);
_1da[ac](_1dd);
var _1df=getCalendarTableMarkup();
var _1e0=doc[ce]("div");
_1e0.setAttribute("id","datePickerWrapper");
_1e0.style.overflow="hidden";
for(var i=0;i<_1b8.calendarCount;i++){
_1e0[ac](_1df.cloneNode(true));
}
_1da[ac](_1e0);
var _1e2=doc[ce]("div");
_1e2.id="next";
$(_1e2).addClassName("dt_control");
var _1e3=doc[ce]("a");
_1e3[ac](doc.createTextNode(" "));
_1e3[sa]("href","javascript: void(0);");
_1e3[sa]("id","cal_showNextMonth");
_1e3[sa]("title",ct_i18n.controls.nextMonth);
_1e2[ac](_1e3);
_1da[ac](_1e2);
$(_1da).observe("click",globalEventHandler);
return _1da;
}
function globalEventHandler(_1e4){
try{
switch(Event.findElement(_1e4,"a").id){
case "cal_closeCalendar":
self.hideDatePicker();
break;
case "cal_showPreviousMonth":
if(!Event.findElement(_1e4,"a").hasClassName("disabled")){
showPreviousMonth();
}
break;
case "cal_showNextMonth":
if(!Event.findElement(_1e4,"a").hasClassName("disabled")){
showNextMonth();
}
break;
default:
selectDate(Event.findElement(_1e4,"a"));
}
}
catch(e){
}
Event.stop(_1e4);
}
function bodyClickHandler(_1e5){
self.hideDatePicker();
}
function selectDate(_1e6){
if(_1e6&&_1e6.timeStamp){
var _1e7=new Date(_1e6.timeStamp);
var _1e8=(_1e7.getDate())+"/";
_1e8+=(_1e7.getMonth()+1)+"/";
_1e8+=_1e7.getFullYear();
_1b7.value=_1e8;
self.hideDatePicker();
_1bc=new Date(_1e7);
if(_1b7.readAttribute("selflabel")){
_1b7.removeClassName("selflabel");
}
_1b7.fire("ctCalendar:onChange");
}
}
function adjustPreviousNextLinksDisplay(){
var _1e9=getMinDate();
var _1ea=new Date(_1e9);
var _1eb=_1bb;
while(_1eb<0){
_1eb+=12;
}
_1ea.setMonth(_1eb);
if(_1ea.getMonth()<=_1e9.getMonth()&&_1ea.getFullYear()<=_1e9.getFullYear()){
$("cal_showPreviousMonth").addClassName("disabled");
}else{
$("cal_showPreviousMonth").removeClassName("disabled");
}
var _1ec=getMaxDate();
_1ea=new Date(_1e9);
var _1ed=_1bb+_1b8.calendarCount-1;
while(_1ed>12){
_1ed-=12;
}
_1ea.setMonth(_1ed);
if(_1ea.getMonth()>=_1ec.getMonth()&&_1ea.getFullYear()>=_1ec.getFullYear()){
$("cal_showNextMonth").addClassName("disabled");
}else{
$("cal_showNextMonth").removeClassName("disabled");
}
}
function showPreviousMonth(){
var _1ee=getCalendarTableMarkup();
$("datePickerWrapper").insertBefore(_1ee,$("datePickerWrapper").firstChild);
populateCalendarTable(_1bb-1,_1ee,getMinDate(),getMaxDate());
_1bb--;
adjustPreviousNextLinksDisplay();
$($("datePickerWrapper").getElementsByTagName("table")[_1b8.calendarCount]).remove();
ct.dom.removeIEIframeFix($("datePickerContainer"));
ct.dom.addIEIframeFix($("datePickerContainer"));
}
function showNextMonth(){
var _1ef=getCalendarTableMarkup();
$("datePickerWrapper").appendChild(_1ef);
populateCalendarTable(_1bb+_1b8.calendarCount,_1ef,getMinDate(),getMaxDate());
_1bb++;
adjustPreviousNextLinksDisplay();
$($("datePickerWrapper").getElementsByTagName("table")[0]).remove();
ct.dom.removeIEIframeFix($("datePickerContainer"));
ct.dom.addIEIframeFix($("datePickerContainer"));
}
function getMinDate(){
var _1f0;
if(_1b8.minDateField){
if(ct.dates.isValidDateString($F(_1b8.minDateField))){
_1f0=ct.dates.fromString($F(_1b8.minDateField));
}else{
if($(_1b8.minDateField).readAttribute("mindate")){
_1f0=ct.dates.fromString($(_1b8.minDateField).readAttribute("mindate"));
}else{
_1f0=new Date();
}
}
}else{
_1f0=_1b8.minDate;
}
if(_1f0){
_1f0.setDate(_1f0.getDate()+_1b8.offsetDays);
}
return new Date(_1f0);
}
function getMaxDate(){
if(_1b8.maxDate){
return new Date(_1b8.maxDate);
}else{
maxDate=new Date(getMinDate());
maxDate.setFullYear(maxDate.getFullYear()+1);
return maxDate;
}
}
function populateCalendarTable(_1f1,_1f2,_1f3,_1f4){
var _1f5=new Date(_1f3);
var _1f6=ct.dates.monthNames;
ct.dates.setMonth(_1f5,_1f1);
_1f5.setDate(1);
_1f1%=12;
_1f2.getElementsByTagName("th")[0].appendChild(document.createTextNode(_1f6[_1f1<0?_1f1+12:_1f1]+" "+_1f5.getFullYear()));
var _1f7=_1f2.getElementsByTagName("tbody")[0].getElementsByTagName("td");
if(ct.dates.isValidDateString($F(_1b7))){
_1bc=ct.dates.fromString($F(_1b7));
}else{
_1bc=getMinDate();
}
var _1f8=_1b8.firstDayOfWeek;
$A(_1f7).each(function(cell){
if(_1f8===_1f5.getDay()&&_1f5.getMonth()===_1f1){
if(ct.dates.compare(_1f5,_1f3)===1||ct.dates.compare(_1f5,_1f4)===-1){
cell.appendChild(document.createTextNode(_1f5.getDate()));
}else{
var link=document.createElement("a");
link.href="javascript: void(0);";
link.timeStamp=_1f5.valueOf();
link.appendChild(document.createTextNode(_1f5.getDate()));
cell.appendChild(link);
}
if(_1bc.toString()==_1f5.toString()){
$(cell).addClassName("selected");
}
_1f5.setDate(_1f5.getDate()+1);
}else{
cell.appendChild(document.createTextNode(" "));
}
_1f8++;
_1f8%=7;
});
}
var _1fb=null;
this.showDatePicker=function(){
if(!_1b7.disabled){
this.hideDatePicker();
var _1fc=getCalendarMarkupOutline();
if(_1b8.minDateField&&ct.dates.isValidDateString($F(_1b8.minDateField))&&ct.dates.isValidDateString($F(_1b7))&&(Date.parse(ct.dates.fromString($F(_1b8.minDateField)))>Date.parse(ct.dates.fromString($F(_1b7))))){
_1bb=ct.dates.fromString($F(_1b8.minDateField)).getMonth()+(ct.dates.fromString($F(_1b8.minDateField)).getFullYear()-getMinDate().getFullYear())*12;
}else{
if(ct.dates.isValidDateString($F(_1b7))){
_1bb=ct.dates.fromString($F(_1b7)).getMonth()+(ct.dates.fromString($F(_1b7)).getFullYear()-getMinDate().getFullYear())*12;
}else{
if(_1b8.defaultDate){
_1bb=_1b8.defaultDate.getMonth()+(_1b8.defaultDate.getFullYear()-getMinDate().getFullYear())*12;
}else{
_1bb=getMinDate().getMonth();
}
}
}
document.body.appendChild(_1fc);
for(var i=0;i<_1b8.calendarCount;i++){
populateCalendarTable(_1bb+i,_1fc.getElementsByTagName("table")[i],getMinDate(),getMaxDate());
}
var pos=$(_1b7).cumulativeOffset();
var _1ff=document.viewport.getDimensions();
var _200=_1fc.getDimensions();
_1fc.style.position="absolute";
if((_1ff.height-_200.height-pos.top)>0){
_1fc.style.top=(pos.top+$(_1b7).getHeight())+"px";
}else{
_1fc.style.top=(pos.top-_200.height)+"px";
}
if((_1ff.width-pos.left-_200.width)>0){
_1fc.style.left=(pos.left)+"px";
}else{
_1fc.style.right=_1ff.width-pos.left-_1b7.getWidth()+"px";
}
adjustPreviousNextLinksDisplay();
ct.dom.addIEIframeFix(_1fc);
$(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(_201,_202){
var self=this;
if(!_202){
_202={};
}
_202.showFeaturedAirports=_202.showFeaturedAirports||(_201.readAttribute("showfeatured")&&_201.readAttribute("showfeatured").toLowerCase()==="no")?false:true;
_202.preselectAirportCode=_202.preselectAirportCode||(_201.readAttribute("preselect")&&_201.readAttribute("preselect")!=="")?_201.readAttribute("preselect"):null;
_202.cookieSelection=_202.cookieSelection||(_201.readAttribute("cookieselection")&&_201.readAttribute("cookieselection")==="no")?false:true;
try{
_202.extraValues=_202.extraValues||(_201.readAttribute("extras")&&_201.readAttribute("extras").strip().length>0)?eval("({"+_201.readAttribute("extras").strip()+"})"):null;
}
catch(e){
_202.extraValues=null;
}
if(_202.cookieSelection&&_201.readAttribute("cookiename")){
if(_201.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{
_202.cookieName=_201.readAttribute("cookiename");
}
ct.validator.attachValidation(_201,ct_i18n.validate.autocompleteSelectMsg.replace("${list}",_201.title.toLowerCase()),function(){
return $F(_201)!=="";
});
this.populate=function(){
if(_201.firstChild){
_201.removeChild(_201.firstChild);
}
var key;
if(_202.extraValues){
Object.keys(_202.extraValues).each(function(key){
var _206=new Element("option",{value:key}).update(_202.extraValues[key]);
if(_202.preselectAirportCode&&_202.preselectAirportCode===_202.extraValues[key]){
_206.setAttribute("selected","selected");
}
_201.appendChild(_206);
});
}else{
_201.appendChild(new Element("option",{value:""}).update(ct_i18n.controls.selectPlace));
}
_201.appendChild(new Element("option",{value:""}).update("------------"));
if(_202.showFeaturedAirports){
$A(ct.airports.featured).each(function(_207){
_201.appendChild(new Element("option",{value:_207.k}).update(_207.v));
});
_201.appendChild(new Element("option",{value:""}).update("------------"));
}
$A(ct.airports.all).each(function(_208){
var _209=new Element("option",{value:_208.k}).update(_208.v);
if(_202.preselectAirportCode&&_202.preselectAirportCode===_208.k){
_209.writeAttribute("selected","selected");
}
_201.appendChild(_209);
});
};
self.populate();
},AutoCompleteTextbox:function(_20a,_20b){
var _20c={up:38,down:40,enter:13,escape:27,tab:9,shift:16};
var _20d=0,_20e="autocompleteOptionsContainer",_20f=[],_210=null;
var _211="/images/indicators/arrows_circle.gif";
if(!ct.controls.AutoCompleteTextboxCache){
ct.controls.AutoCompleteTextboxCache={};
}
_20b=_20b||{};
_20b.queryUrl=_20b.queryUrl||_20a.getAttribute("queryurl")||null;
_20b.valueOnly=_20b.valueOnly||_20a.hasClassName("valueOnly");
_20b.includeKeys=_20b.includeKeys||_20a.hasClassName("includeKeys");
_20b.idField=_20b.idField||_20a.getAttribute("idfield")||null;
_20b.displayRowCount=parseInt(_20b.displayRowCount||_20a.getAttribute("displayrows")||10,10);
_20b.minChars=parseInt(_20b.minChars||_20a.getAttribute("minchars")||3,10);
_20b.selectionHandler=_20b.selectionHandler||_20a.getAttribute("selectionhandler")||null;
_20b.jsfunction=_20b.jsfunction||_20a.getAttribute("jsfunction")||null;
_20b.jsfunctionurl=_20b.jsfunctionurl||_20a.getAttribute("jsfunctionurl")||null;
_20b.htmlIncluded=_20b.htmlIncluded||_20a.hasAttribute("htmlIncluded");
_20b.callBack=_20b.callBack||_20a.getAttribute("callback")||null;
_20b.nocache=_20b.nocache||_20a.getAttribute("nocache")||false;
_20b.clicktoselect=_20b.clicktoselect||_20a.getAttribute("clicktoselect")||false;
_20a.setQueryUrl=function(url){
_20a.setAttribute("queryUrl",url);
_20b.queryUrl=new Template(url);
};
if($(_20a).hasClassName("forceKey")){
ct.validator.attachValidation(_20a,ct_i18n.validate.autocompleteNotAvailMsg.replace("${entry}",_20a.title.toLowerCase()),function(){
if($(_20a).value===""){
return true;
}
if(_20a.readAttribute("selfLabel")===$F(_20a)){
return true;
}
return $(_20b.idField).value;
});
}
if(typeof _20b.selectionHandler==="string"){
try{
_20b.selectionHandler=eval(_20b.selectionHandler);
}
catch(e){
throw new Error("From ct.controls.AutoCompleteTextbox: Unable to understand the selectionhandler attribute.");
}
}
if(!_20b.idField){
throw new Error("From ct.controls.AutoCompleteTextbox: idfield attribute not defined.");
}
if(!$(_20b.idField)||$(_20b.idField).id!==_20b.idField){
_20a.parentNode.appendChild(new Element("input",{type:"hidden",id:_20b.idField,name:_20b.idField}));
}
if(ct.dom.getParentByTagName(_20a,"form")){
$(ct.dom.getParentByTagName(_20a,"form")).observe("submit",function(_213){
if($(_20e)){
_213.stop();
}
});
}
$(_20a).observe("blur",function(){
if(!_20b.clicktoselect){
if($(_20e)){
keyEnterPress();
}
removeAutocompleteDropdown();
}else{
setTimeout(function(){
if($(_20e)&&$(_20e).getAttribute("referer")=="referer_"+_20a.id){
removeAutocompleteDropdown();
}
},500);
}
});
$(_20a).observe("keypress",function(_214){
if($(_20e)&&_214.keyCode===_20c.enter){
_214.stop();
}
});
$(_20a).observe("focus",function(_215){
$(_20a).select();
});
if(_20b.queryUrl||_20b.jsfunction){
if(_20b.queryUrl){
_20b.queryUrl=new Template(_20b.queryUrl);
}
if(_20b.clicktoselect){
$(_20a).observe("keydown",function(_216){
_20a.clicktoselect_oldValue=_20a.value;
});
}
var _217=function(_218){
if($("autocompleteOptionsContainer")){
if(_218.keyCode==_20c.up||_218.keyCode==_20c.down||_218.keyCode==_20c.enter||_218.keyCode==_20c.escape){
return true;
}
}
return false;
};
$(_20a).observe("keyup",function(_219){
if(_20b.clicktoselect&&((_219.keyCode===_20c.shift||_219.keyCode===_20c.tab)||(_20a.clicktoselect_oldValue&&_20a.clicktoselect_oldValue==_20a.value&&!_217(_219)))){
return false;
}
_20a.clicktoselect_oldValue=_20a.value;
var _21a="#"+((_219.target.readAttribute("queryUrl"))||((_219.target.readAttribute("jsfunctionurl"))?(_219.target.readAttribute("jsfunction")+"#"+_219.target.readAttribute("jsfunctionurl")):_219.target.readAttribute("jsfunction")));
if(_219.keyCode!==_20c.enter){
$(_20b.idField).value="";
}
if($F(_20a)===""){
removeAutocompleteDropdown();
}else{
if($F(_20a).length>=_20b.minChars){
var key=$F(_20a).toLowerCase();
if(_20b.nocache==false&&ct.controls.AutoCompleteTextboxCache[key+_21a]){
keystrokeHandler(_219,ct.controls.AutoCompleteTextboxCache[key+_21a]);
}else{
if(_20f["#"+key]){
return;
}else{
clearTimeout(_210);
_210=setTimeout(function(){
_20f.push("#"+key);
_20a.setStyle({backgroundPosition:"center right",backgroundImage:"url(\""+_211+"\")",backgroundRepeat:"no-repeat"});
if(_20b.queryUrl){
new Ajax.Request(_20b.queryUrl.evaluate({q:key}),{method:"get",onSuccess:function(_21c){
ct.controls.AutoCompleteTextboxCache[key+_21a]=eval(_21c.responseText);
_20f.splice("#"+key,1);
if(key===$F(_20a).toLowerCase()){
keystrokeHandler(_219,ct.controls.AutoCompleteTextboxCache[key+_21a]);
}
_20a.setStyle({backgroundImage:"none"});
},onFailure:function(){
ct.controls.AutoCompleteTextboxCache.splice($A(ct.controls.AutoCompleteTextboxCache).indexOf(key+_21a),1);
}});
}else{
if(_20b.jsfunction){
function callback(_21d){
ct.controls.AutoCompleteTextboxCache[key+_21a]=_21d;
_20f.splice("#"+key,1);
if(key===$F(_20a).toLowerCase()){
keystrokeHandler(_219,ct.controls.AutoCompleteTextboxCache[key+_21a]);
}
_20a.setStyle({backgroundImage:"none"});
}
var _21e=eval(_20b.jsfunction);
_21e(key,callback,_20a);
}
}
},200);
}
}
}
}
});
}
_20a.setAttribute("autocomplete","off");
function keystrokeHandler(evt,data){
var _221=null;
try{
_221=evt.keyCode;
}
catch(e){
}
switch(_221){
case _20c.up:
keyUpPress();
Event.stop(evt);
break;
case _20c.down:
keyDownPress();
Event.stop(evt);
break;
case _20c.escape:
removeAutocompleteDropdown();
Event.stop(evt);
break;
case _20c.enter:
if($("autocompleteOptionsContainer")){
keyEnterPress(evt);
Event.stop(evt);
}
break;
default:
showAutocompleteDropdown(filterDataset(data));
break;
}
}
function filterDataset(_222){
return _222;
}
function showAutocompleteDropdown(_223){
if(_223.length>0){
var _224;
if($(_20e)){
while($(_20e).firstChild){
$($(_20e).firstChild).remove();
}
_224=$(_20e);
ct.dom.removeIEIframeFix(_224);
}else{
_224=new Element("ul",{"class":"aa",style:"visibility: hidden",id:_20e});
}
$(_224).setAttribute("referer","referer_"+_20a.id);
var _225=(_20b.displayRowCount<_223.length)?_20b.displayRowCount:_223.length;
for(var i=0;i<_225;i++){
var li=new Element("li",{keyName:_223[i].k,index:i}).update(_223[i].d||_223[i].v);
li.dataObject=Object.clone(_223[i]);
_224.appendChild(li);
}
document.body.appendChild(_224);
var _228=_20a.cumulativeOffset();
_224.setStyle({top:_228.top+_20a.getHeight()+"px",left:_228.left+"px",position:"absolute",visibility:"visible",width:_20a.getWidth()+"px"});
ct.dom.addIEIframeFix(_224);
_224.observe("click",mouseClickHandler);
_224.observe("mouseover",mouseOverHandler);
highlightSelection();
}else{
$(_20b.idField).value="";
removeAutocompleteDropdown();
if(_20b.callBack){
_20b.callBack();
}
}
}
function mouseClickHandler(_229){
var _22a;
if(_229.findElement("li")&&_229.findElement("li").nodeName.toLowerCase()==="li"){
_22a=_229.findElement("li");
}else{
if(_229.findElement("ul")&&_229.findElement("ul").nodeName.toLowerCase()==="ul"&&_229.findElement("ul").id===_20e&&_20b.clicktoselect){
_22a=$(_20e).select("li.highlight")[0];
}
}
if(_22a){
_20d=_22a.getAttribute("index");
highlightSelection();
keyEnterPress();
}
_229.stop();
}
function mouseOverHandler(_22b){
if(_22b.findElement("li")&&_22b.findElement("li").nodeName.toLowerCase()==="li"){
_20d=_22b.findElement("li").getAttribute("index");
highlightSelection();
}
_22b.stop();
}
function removeAutocompleteDropdown(){
if($(_20e)){
ct.dom.removeIEIframeFix($(_20e));
$(_20e).stopObserving("click",mouseClickHandler);
$(_20e).remove();
_20d=0;
}
if(window.isCalendarPage){
checkInternational();
constructReturn();
}
}
function keyDownPress(){
_20d++;
highlightSelection();
}
function keyUpPress(){
_20d--;
highlightSelection();
}
function keyEnterPress(evt){
if($(_20e)&&$(_20e).childNodes[_20d]){
var _22d=$(_20e).childNodes[_20d];
var _22e="";
if(_20b.htmlIncluded){
$A((new Element("div").update(_22d.dataObject.v)).childNodes).each(function(_22f){
if(_22f.innerHTML){
_22e+=_22f.innerHTML;
}else{
if(_22f.nodeValue){
_22e+=_22f.nodeValue;
}
}
});
}else{
_22e=_22d.dataObject.v;
}
$(_20b.idField).value=_20b.valueOnly?_22e:_22d.readAttribute("keyName");
_20a.value=_22e;
if(_20b.selectionHandler){
_20b.selectionHandler(_22d.dataObject,_20a);
}
if(evt){
evt.stop();
}
}
removeAutocompleteDropdown();
}
function highlightSelection(){
if($(_20e)){
var _230=$(_20e).childNodes.length;
_20d=parseInt(_20d,10);
if(_20d>=_230){
_20d=0;
}else{
if(_20d<0){
_20d=_230-1;
}
}
$A($(_20e).childNodes).each(function(li,_232){
if(_232===_20d){
li.addClassName("highlight");
}else{
li.removeClassName("highlight");
}
});
}
}
},Slider:function(_233){
var _234=$(_233).getElementsBySelector("input[type=text]");
var _235=new Element("div",{"class":"track"});
_233.appendChild(_235);
var _236=new Element("div",{"class":"leftDisabled"}),_237=new Element("div",{"class":"rightDisabled"});
var _238=parseFloat($(_233).readAttribute("minvalue")||0),_239=parseFloat($(_233).readAttribute("maxvalue")||10),_23a=parseFloat($(_233).readAttribute("stepvalue")||1);
var _23b=0,_23c=_235.getWidth();
var _23d=(_23c-_23b)/(_239-_238);
var _23e=Math.ceil(_23a*_23d);
function getSliderRange(){
var _23f=[];
var _240=_23b;
while(_240<_23c){
_23f.push(_240);
_240+=_23e;
}
_23f.push(_23c);
return _23f;
}
function scaleToInternal(_241){
return ((_241-_238)*_23d);
}
function scaleToUser(_242){
if(_242===_23b){
return _238;
}else{
if(_242===_23c){
return _239;
}
}
var _243=(_242/_23d)+_238;
var _244=_243%_23a;
if(_244<_23a/2){
return _243-_244;
}else{
return _243+(_23a-_244);
}
}
_233.minValue=_238;
_233.maxValue=_239;
if(_234.length===1){
if(_233.readAttribute("highlight")&&_233.readAttribute("highlight").toLowerCase()==="left"){
_235.appendChild(_237);
}else{
_237=null;
}
if(_233.readAttribute("highlight")&&_233.readAttribute("highlight").toLowerCase()==="right"){
_235.appendChild(_236);
}else{
_236=null;
}
var _245=new Element("div",{"class":"leftHandle"});
_235.appendChild(_245);
_233.sliderObj=new Control.Slider(_245,_235,{axis:"horizontal",range:$R(_23b,_23c),sliderValue:scaleToInternal(parseFloat(_234[0].getAttribute("value"))),startSpan:_236,endSpan:_237,values:getSliderRange(),onChange:function(vals){
vals=scaleToUser(vals);
_234[0].setAttribute("value",vals);
_234[0].value=vals;
_233.values=[vals];
_233.fire("ctslider:onChange");
},onSlide:function(vals){
_233.inSlideValues=scaleToUser(vals);
_233.fire("ctslider:onSlide");
}});
_233.sliderObj.setValue([scaleToInternal(parseFloat(_234[0].getAttribute("value")))]);
_233.inSlideValues=[parseFloat(_234[0].value)];
}else{
if(_234.length===2){
var _248=new Element("div",{id:"rangeHandleMin1","class":"leftHandle"});
var _249=new Element("div",{id:"rangeHandleMax1","class":"rightHandle"});
_235.appendChild(_236);
_235.appendChild(_237);
_235.appendChild(_248);
_235.appendChild(_249);
_233.sliderObj=new Control.Slider([_248,_249],_235,{axis:"horizontal",range:$R(_23b,_23c),sliderValue:[scaleToInternal(_234[0].getAttribute("value")),scaleToInternal(_234[1].getAttribute("value"))],startSpan:_236,endSpan:_237,values:getSliderRange(),restricted:true,onChange:function(vals){
var min=scaleToUser(vals[0]);
var max=scaleToUser(vals[1]);
var _24d=_233.values;
if(!_24d||(_24d[0]!==min||_24d[1]!==max)){
_234[0].setAttribute("value",min);
_234[1].setAttribute("value",max);
_234[0].value=min;
_234[1].value=max;
_233.values=[min,max];
_233.fire("ctslider:onChange");
}
},onSlide:function(vals){
var _24f=_233.inSlideValues;
if(!_24f||(_24f[0]!==scaleToUser(vals[0])||_24f[1]!==scaleToUser(vals[1]))){
_233.inSlideValues=[scaleToUser(vals[0]),scaleToUser(vals[1])];
_233.fire("ctslider:onSlide");
}
}});
_233.setValues=function(){
var _250=_233.sliderObj;
var vals=[_234[0].getAttribute("value"),_234[1].getAttribute("value")];
_250.setValue(scaleToInternal(vals[0]),0);
_250.setValue(scaleToInternal(vals[1]),1);
_233.inSlideValues=[vals[0],vals[1]];
_233.fire("ctslider:onSlide");
};
_233.setValues();
}
}
},CurrencyDropdown:function(_252){
if(window.currencies&&!_252.loaded){
var _253=false;
var _254=window.location.href.toQueryParams().currency||((window.sell_currency)?window.sell_currency.code:null)||ct.cookies.read("currency-pref");
function addCurrency(_255){
var _256=new Element("option",{value:_255.code,title:_255.name}).update(_255.code+" "+_255.symbol+" - "+_255.name);
if(_255.code===_254&&!_253){
ct.currentCurrency=_255;
_256.writeAttribute("selected","selected");
_253=true;
}
_252.appendChild(_256);
}
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 _25d={"\\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(_25e){
if(_25e.symbol.indexOf("\\u")!=-1){
_25e.symbol=curr_symbol_convert(_25e.symbol.substr(2));
}
});
}
$A(currencies.all).each(function(_25f){
if(_25f.symbol.indexOf("\\u")!=-1){
_25f.symbol=curr_symbol_convert(_25f.symbol.substr(2));
}
if(currencies.notop){
$A(currencies.top).each(function(_260){
if(_260.code==_25f.code){
_260.rate=_25f.rate;
_260.symbol=_25f.symbol;
}
});
}
});
$A(currencies.top).each(addCurrency);
_252.appendChild(new Element("option",{value:"",title:""}).update("----------"));
$A(currencies.all).each(addCurrency);
if(!_253){
var _261=$(_252).getElementsByTagName("option");
for(var i=0;i<_261.length;i++){
if(_261[i].value==="INR"){
_261[i].writeAttribute("selected","selected");
break;
}
}
}
$(_252).observe("change",function(){
var _263=false;
$A(currencies.all).each(function(_264){
if(_264.code===$F(_252)){
ct.currentCurrency=_264;
_263=true;
}
});
if(!_263){
ct.helperFunctions.resetCurrency(true);
}else{
ct.helperFunctions.logToServer("currency","changed",{to:ct.currentCurrency.code});
}
$(_252).fire("ctcurrency:change");
});
$(_252).loaded=true;
}
},ToggleTabs:function(node,_266){
var _267=[];
if(!_266){
_266={};
}
_266.currentTabClass=_266.currentTabClass||(node.readAttribute("currentTabClass")?node.readAttribute("currentTabClass"):"");
_266.deactivatedTabClass=_266.deactivatedTabClass||(node.readAttribute("deactivatedTabClass")?node.readAttribute("deactivatedTabClass"):"");
_266.activeElement=_266.activeElement||(node.readAttribute("activeElement")?node.readAttribute("activeElement"):"");
$A(node.select("a[tabId]","a[tabid]")).each(function(tab){
_267.push(tab);
Event.observe(tab,"click",function(evt){
$A(_267).each(function(link){
if(_266.activeElement!=""){
link.up(_266.activeElement).removeClassName(_266.currentTabClass);
link.up(_266.activeElement).addClassName(_266.deactivatedTabClass);
}else{
link.removeClassName(_266.currentTabClass);
link.addClassName(_266.deactivatedTabClass);
}
$(link.readAttribute("tabId")).hide();
});
var _26b=$(evt.target);
if(_26b.tagName!=="A"){
_26b=_26b.up("a");
}
_26b.addClassName(_266.currentTabClass);
_26b.removeClassName(_266.deactivatedTabClass);
if(_266.activeElement!=""){
_26b.up(_266.activeElement).addClassName(_266.currentTabClass);
_26b.up(_266.activeElement).removeClassName(_266.deactivatedTabClass);
}
$(_26b.readAttribute("tabId")).show();
});
});
},parseDomTree:function(_26c){
_26c=$(_26c||document.body);
var _26d=ct.controls;
_26c.getElementsBySelector("input.datePicker").each(function(_26e){
new _26d.Calendar(_26e);
});
_26c.getElementsBySelector("select.airportsDropdown").each(function(_26f){
new _26d.AirportsDropdown(_26f);
});
_26c.getElementsBySelector("input.autocomplete").each(function(_270){
new _26d.AutoCompleteTextbox(_270);
});
if(window.Control&&Control.Slider){
var _271=new Date();
_26c.select(".slider").each(function(_272){
if(!_272.sliderObj){
new _26d.Slider(_272);
}
});
console.log("Slider creation total time: ",new Date()-_271);
}
if($("currency_dropdown")){
new ct.controls.CurrencyDropdown($("currency_dropdown"));
}
_26c.getElementsBySelector("ul.toggleTabs").each(function(ul){
new ct.controls.ToggleTabs(ul);
});
}},carousel:function(node,_275){
var _276=document.body.clientHeight;
var _277=document.body.clientWidth;
var ac="appendChild",self=this;
var _27a=0;
_275=_275||{};
this.resizeFlag=false;
this.feature_slideshow;
this.attachSlideshowBehaviour=function(ele){
_27a++;
$(ele).writeAttribute("style","visibility:hidden;");
var _27c=$(ele).up();
var IE=(navigator.userAgent.indexOf("MSIE")>=0)?true:false;
var _27e=ele.cloneNode(true);
var _27f=$(ele).select(".slide");
var _280=$(ele).readAttribute("navStyle");
var _281=$(ele).readAttribute("widthType");
var _282=$(ele).select(".slide")[0].getWidth()*parseInt($(ele).readAttribute("visibleSlides"));
var _283=$(ele).select(".slide")[0].getWidth();
var _284=$(ele).select(".slide")[0];
if(!IE){
var _285=parseInt($(_284).getStyle("margin-right").replace(/px/i,""))+parseInt($(_284).getStyle("margin-left").replace(/px/i,""))+parseInt($(_284).getStyle("border-right-width").replace(/px/i,""))+parseInt($(_284).getStyle("border-left-width").replace(/px/i,""))+parseInt($(_284).getStyle("padding-right").replace(/px/i,""))+parseInt($(_284).getStyle("padding-left").replace(/px/i,""));
}
var _286=$(ele).select(".slide")[0].getHeight();
var loop=$(ele).readAttribute("loopSlides");
var _288=$(ele).readAttribute("keyscroll")||"no";
var _289=$(ele).readAttribute("autoslide")||"false";
var _28a=$(ele).readAttribute("paginationType");
var _28b=$(ele).readAttribute("trackerFunction");
var _28c=new Element("div",{"id":"carouselWrapper"+_27a});
$(_27c)[ac](_28c);
$(ele).remove();
$(_28c)[ac](_27e);
for(var _28d=0;_28d<$(_27e).select(".slide").length;_28d++){
$(_27e).select(".slide")[_28d].writeAttribute("id",_28c.id+"_slide"+_28d);
}
if(_281=="fluid"){
$(_28c).writeAttribute("style","height:"+_286+"px;overflow:hidden;position:relative");
}else{
if(_281=="fixed"){
$(_28c).writeAttribute("style","width:"+_282+"px;height:"+_286+"px;overflow:hidden;position:relative");
}
}
if(_281=="fluid"){
if(IE){
$(_28c).up().writeAttribute("style","width:780px");
}
if(!IE){
var _28e=Math.round(parseInt($(_28c).getWidth())/parseInt($(_27e).readAttribute("visibleSlides")))-_285;
}else{
var _28e=Math.round(parseInt($(_28c).getWidth())/parseInt($(_27e).readAttribute("visibleSlides")));
}
var _28f=($(_27e).select(".slide").length*_28e)+_28e;
$(_27e).writeAttribute("style","width:"+_28f+"px");
$(_27e).select(".slide").each(function(_290){
$(_290).writeAttribute("style","width:"+(_28e)+"px;");
});
}else{
if(_281=="fixed"){
$(_27e).writeAttribute("style","width:"+_283*(_27f.length+1)+"px");
}
}
var _291=new Element("div",{"class":_280||"","id":"navCount"+_27a}),_292;
var _28d=$(_27e).select(".slide").length;
var _293=parseInt($(_27e).readAttribute("visibleslides"));
if(_293>_28d){
_292=Math.ceil(_28d/_293);
}else{
if(_28d%_293==0){
_292=Math.round(_28d/_293);
}else{
if(_28d%_293!=0){
_292=(_28d/_293)+"";
_292=(parseInt(_292.split(".")[0]))+1;
}
}
}
if(_28a==null||_28a!="text"){
var _294=new Element("ul",{"class":"clearfix"});
var _295=0;
for(i=0;i<_292;i++){
if(i!=0){
_295=_295+(parseInt($(_27e).readAttribute("visibleslides")));
}
var _296=new Element("li").update(new Element("a",{"rel":i==0?$(_27e).select(".slide")[i].id:$(_27e).select(".slide")[_295].id,"href":"javascript:void(0)","count":i==0?i:_295,"tracker":$(_27e).select(".slide")[i].readAttribute("tracker")?$(_27e).select(".slide")[i].readAttribute("tracker"):"","trackercategory":$(_27e).select(".slide")[i].readAttribute("trackercategory")?$(_27e).select(".slide")[i].readAttribute("trackercategory"):"","class":i==0?"slide-control slide-jump active":"slide-control slide-jump"}));
$(_27e).select(".slide")[i==0?i:_295].writeAttribute("count",i);
_294[ac](_296);
}
var _297=new Element("a",{"href":"javascript:void(0)","class":"prev_feature slide-control disabledLeft","rel":"prev"});
_291[ac](_294);
_291[ac](_297);
_297.addClassName("prev_feature slide-control disabledLeft");
var _298=new Element("a",{"href":"javascript:void(0)","class":"next_feature slide-control","rel":"next"});
_291[ac](_298);
_298.addClassName("next_feature slide-control");
if(_292==1){
$(_298).writeAttribute("style","visibility:hidden");
$(_297).writeAttribute("style","visibility:hidden");
$(_296).writeAttribute("style","visibility:hidden");
}
$(_28c).insert({after:_291});
if(loop=="yes"){
$(_297).removeClassName("disabledLeft");
}
if(_292!=0){
var _299=parseInt($(_291).select("li")[0].getWidth());
var _29a=parseInt($(_291).select("li")[0].getStyle("margin-left"));
_292=_292;
$(_294).writeAttribute("style","width: auto;height: auto;");
$(_291).writeAttribute("style","width:"+((_292*_299)+(_292*_29a)+_299)+"px;height: auto;");
}
if(_281=="fluid"){
$(_28c).writeAttribute("style","height:"+_286+"px;overflow:hidden;position:relative");
}else{
if(_281=="fixed"){
$(_28c).writeAttribute("style","width:"+_282+"px;height:"+_286+"px;overflow:hidden;");
}
}
}else{
if(_28a=="text"){
var _294=new Element("ul",{"class":"inline clearfix"});
var _296=new Element("li",{"class":"prevNavLink first"});
var _297=new Element("a",{"href":"javascript:void(0)","class":"slide-control","rel":"prev"}).update("&laquo; Prev");
_296[ac](_297);
_294[ac](_296);
_296=new Element("li",{"class":"slide_count"}).update("1 of "+$(_27e).select(".slide").length);
_294[ac](_296);
_296=new Element("li",{"class":"nextNavLink"});
var _298=new Element("a",{"href":"javascript:void(0)","class":"slide-control","rel":"next"}).update("Next &raquo;");
_296[ac](_298);
_294[ac](_296);
_291[ac](_294);
$(_28c).insert({after:_291});
}
}
$(_28c).select(".carousel")[0].writeAttribute("offsetx",$(_28c).select(".carousel")[0].cumulativeOffset()[0]);
$(_28c).select(".carousel")[0].writeAttribute("offsety",$(_28c).select(".carousel")[0].cumulativeOffset()[1]);
var _29b=$(_291).select(".slide_count")[0];
this.feature_slideshow=new Slideshow($(_27e),$(_27e).select(".slide"),$(_291),$(_291).select("a.slide-control"),{duration:2,autoslide:_289,scrollspeed:0.5,width:$$(".slide")[0].getWidth()*((_27f.length)+1),visibleslides:parseInt($(_27e).readAttribute("visibleSlides")),pointTo:_275.st,loopScroll:loop,keyscroll:_288,paginationType:_28a,textNode:_29b});
$(_291).select("a.slide-control").each(function(_29c){
$(_29c).observe("click",function(){
if(_28b){
setTimeout("eval("+_28b+")('"+$(_291).id+"')",300);
}
});
});
if(_275.oncomplete){
_275.oncomplete();
}
if(_28b){
setTimeout("eval("+_28b+")('"+$(_291).id+"')",200);
}
$(_291).select("a.slide-jump").each(function(_29d){
$(_29d).observe("click",function(){
$(_291).select("a.slide-jump").each(function(_29e){
if(_29e.hasClassName("active")){
_29e.removeClassName("active");
}
_29d.addClassName("active");
});
});
});
Event.observe(window,"resize",function(evt){
var _2a0=document.body.clientHeight;
var _2a1=document.body.clientWidth;
self.resizeFlag=true;
if(_276!=_2a0||_277!=_2a1){
reRenderDeals(evt);
_277=_2a1;
_276=_2a0;
}
});
reRenderDeals=function(_2a2){
var intr=window.setInterval(function(){
if(self.resizeFlag!=false){
var _2a4=self.feature_slideshow;
try{
var _2a5=$(_27e.id).cloneNode(true);
$(_291.id).remove();
$(_28c.id).remove();
$(_27c).insert(_2a5);
if(_275.oncomplete){
ct.carousel(_2a5,{st:_2a4.current,oncomplete:_275.oncomplete});
}else{
ct.carousel(_2a5,{st:_2a4.current});
}
var _2a6=$(_291.id).select("a");
$(_2a6).each(function(link){
if($(link).hasClassName("active")){
$(link).removeClassName("active");
}
if(parseInt($(link).readAttribute("count"))==_2a4.current){
$(link).addClassName("active");
}
});
var _2a8=$(_28c.id).select("ul")[0].readAttribute("visibleSlides");
var _2a9=$(_28c.id).select("li.slide").length;
if((_2a4.current+parseInt(_2a8))>=(parseInt(_2a9)-1)&&$(_28c.id).select("ul")[0].readAttribute("loopSlides")=="no"){
$(_291.id).select("a.prev_feature")[0].removeClassName("disabledLeft");
$(_291.id).select("a.next_feature")[0].addClassName("disabledRight");
}else{
if($(_28c.id).select("ul")[0].readAttribute("loopSlides")=="yes"){
$(_291.id).select("a.prev_feature")[0].removeClassName("disabledLeft");
$(_291.id).select("a.next_feature")[0].removeClassName("disabledRight");
}else{
if(_2a4.current==0){
$(_291.id).select("a.prev_feature")[0].addClassName("disabledLeft");
$(_291.id).select("a.next_feature")[0].removeClassName("disabledRight");
}else{
$(_291.id).select("a.prev_feature")[0].removeClassName("disabledLeft");
$(_291.id).select("a.next_feature")[0].removeClassName("disabledRight");
}
}
}
self.resizeFlag=false;
}
catch(e){
}
self.resizeFlag=false;
}
},200);
};
};
if(node){
self.attachSlideshowBehaviour(node);
}else{
var _2aa=$$(".carousel");
$(_2aa).each(function(ele){
self.attachSlideshowBehaviour(ele);
});
}
},trackerForTest:function(_2ac){
$(_2ac).select("a.slide-jump").each(function(_2ad){
if(_2ad.hasClassName("active")){
if(pageTracker){
pageTracker._trackEvent(_2ad.readAttribute("trackerCategory"),"view",_2ad.readAttribute("tracker"));
}
}
});
},trackers:{page_count:function(){
try{
if(window.ct_ct_track){
var _2ae="/common/ctct";
var _2af="ct_ct";
var _2b0=ct.cookies.read(_2af)?ct.cookies.read(_2af):"";
var _2b1={"n":ct_ct_track.n,"s":_2b0,"p":ct_ct_track.p};
new Ajax.Request(_2ae,{method:"get",parameters:_2b1,requestHeaders:["Pragma","no-cache","Cache-Control","no-cache","Expires","0"],onSuccess:function(_2b2){
ct.cookies.create(_2af,_2b2.responseText.trim(),365);
},onFailure:function(_2b3){
ct.console.log("error in ct tracking call");
}});
}
}
catch(e){
ct.console.log("error in ct tracking");
}
}},socialmedia:{facebook:function(_2b4){
_2b4=$(_2b4?_2b4:document.body);
var _2b5=$A($(_2b4).getElementsByTagName("a"));
var _2b6=[];
_2b5.each(function(_2b7){
if($(_2b7).hasClassName("facebookShare")||$(_2b7).hasClassName("facebookShare_small")){
if($(_2b7).readAttribute("jsModify")&&$(_2b7).readAttribute("jsModify")=="true"){
ct.socialmedia.bitly.compressorIt=false;
}
if($(_2b7).readAttribute("messageLink")){
if($(_2b7).readAttribute("messageLink")==="${documentUrl}"){
$(_2b7).writeAttribute("messagelink",window.location.href);
}else{
if($(_2b7).readAttribute("messageLink").toLowerCase().indexOf("http")!=0){
$(_2b7).writeAttribute("messagelink","http://"+$(_2b7).readAttribute("messageLink"));
}
}
_2b7.compressedUrl=$(_2b7).readAttribute("messageLink");
_2b7.toCompressUrl=$(_2b7).readAttribute("messageLink");
_2b6.push($(_2b7));
}
$(_2b7).observe("click",function(){
var _2b8=function(){
var link=_2b7.compressedUrl;
var desc=encodeURIComponent($(_2b7).readAttribute("messageDescription"));
var img=($(_2b7).readAttribute("dispImg"))?$(_2b7).readAttribute("dispImg"):"";
if(img.indexOf("http")!=0){
img=window.location.host+img;
}
img=encodeURIComponent(img);
if($(_2b7).readAttribute("messageId")){
var _2bc=encodeURIComponent($(_2b7.readAttribute("messageId")).value);
facebookwindow=window.open("http://www.facebook.com/sharer.php?s=100&p[title]="+_2bc+"&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($(_2b7).readAttribute("customMessage")){
var _2bc=encodeURIComponent($(_2b7).readAttribute("customMessage"));
var desc=encodeURIComponent($(_2b7).readAttribute("messageDescription"));
facebookwindow=window.open("http://www.facebook.com/sharer.php?s=100&p[title]="+_2bc+"&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){
$(_2b7).compressedUrl=window.documentUrlshort;
_2b8();
ct.console.log("social :: documentUrlshort");
}else{
$(_2b7).compressedUrl="";
ct.socialmedia.bitly.loadBitly(function(){
ct.socialmedia.bitly.compressor(_2b7,_2b8);
});
ct.console.log("social :: documentUrlshort null");
}
}else{
$(_2b7).compressedUrl=_2b7.toCompressUrl;
_2b8();
ct.console.log("social :: documentUrlshort https");
}
});
}
});
if(_2b6.length>0&&window.location.protocol==="http:"){
ct.socialmedia.bitly.loadBitly();
}
},twitter:function(_2bd){
_2bd=$(_2bd?_2bd:document.body);
var _2be=$A($(_2bd).getElementsByTagName("a"));
var _2bf=[];
_2be.each(function(_2c0){
if($(_2c0).hasClassName("tweetThis")||$(_2c0).hasClassName("tweetThis_small")){
if($(_2c0).readAttribute("jsModify")&&$(_2c0).readAttribute("jsModify")=="true"){
ct.socialmedia.bitly.compressorIt=false;
}
if($(_2c0).readAttribute("messageLink")){
if($(_2c0).readAttribute("messageLink")==="${documentUrl}"){
$(_2c0).writeAttribute("messagelink",window.location.href);
}else{
if($(_2c0).readAttribute("messageLink").toLowerCase().indexOf("http")!=0){
$(_2c0).writeAttribute("messagelink","http://"+$(_2c0).readAttribute("messageLink"));
}
}
_2c0.compressedUrl=$(_2c0).readAttribute("messageLink");
_2c0.toCompressUrl=$(_2c0).readAttribute("messageLink");
_2bf.push($(_2c0));
}
$(_2c0).observe("click",function(){
var _2c1=function(){
if($(_2c0).readAttribute("messageId")){
twitterwindow=window.open("http://twitter.com/home/?status="+$(_2c0).readAttribute("messageId")+" - "+$(_2c0).compressedUrl,"twitter","menubar=1,resizable=1,width=800,height=550,left=100,top=100,screenX=100,screenY=100");
if(twitterwindow){
twitterwindow.focus();
}
}else{
if($(_2c0).readAttribute("customMessage")){
var _2c2=encodeURIComponent($(_2c0).readAttribute("customMessage"));
twitterwindow=window.open("http://twitter.com/home/?status="+$(_2c0).readAttribute("customMessage")+" - "+$(_2c0).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){
$(_2c0).compressedUrl=window.documentUrlshort;
ct.console.log("social :: documentUrlshort");
_2c1();
}else{
$(_2c0).compressedUrl="";
ct.socialmedia.bitly.loadBitly(function(){
ct.socialmedia.bitly.compressor(_2c0,_2c1);
});
ct.console.log("social :: documentUrlshort null");
}
}else{
$(_2c0).compressedUrl=_2c0.toCompressUrl;
_2c1();
ct.console.log("social :: documentUrlshort https");
}
});
}
});
if(_2bf.length>0&&window.location.protocol==="http:"){
ct.socialmedia.bitly.loadBitly();
}
},bitly:{bitlyLoaded:false,loadBitly:function(_2c3){
if(!ct.socialmedia.bitly.bitlyLoaded){
ct.socialmedia.bitly.bitlyLoaded=true;
var _2c4=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(_2c4);
}
var _2c5=setInterval(function(){
if(window.BitlyApiClient){
clearInterval(_2c5);
if(_2c3){
_2c3();
}
}
},500);
},compressorIt:true,pointer:-1,compressor:function(link,_2c7){
var _2c8=setInterval(function(){
if(ct.socialmedia.bitly.compressorIt){
clearInterval(_2c8);
ct.socialmedia.bitly.pointer++;
var _2c9="BitlyCB.renderResponse_"+ct.socialmedia.bitly.pointer;
BitlyCB["renderResponse_"+ct.socialmedia.bitly.pointer]=function(data){
var _2cb=Object.values(data.results)[0];
ct.console.log(link.id+" :: :: "+Object.keys(data.results)[0]+" :: :: "+_2cb.shortUrl);
if(_2cb.shortUrl){
link.compressedUrl=_2cb.shortUrl;
window.documentUrlshort=_2cb.shortUrl;
}else{
ct.console.log(link.id);
link.compressedUrl="http://www.cleartrip.com";
}
_2c7();
};
BitlyClient.call("shorten",{"longUrl":link.toCompressUrl},_2c9);
}
},100);
}}},ajaxTimeoutHandler:{onCreate:function(_2cc){
_2cc.timeoutId=window.setTimeout(function(){
if($A([1,2,3]).indexOf(parseInt(_2cc.transport.readyState,10))!==-1){
_2cc.transport.abort();
if(!_2cc.url.match("/urltrack/")){
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(_2cc.options.onFailure){
_2cc.options.onFailure(_2cc.transport,_2cc.json);
}
}
},window["customAjaxTimeout"]?customAjaxTimeout:120000);
},onComplete:function(_2cd){
window.clearTimeout(_2cd.timeoutId);
}}};
compareDates=ct.dates.compare;
toHomeForm=ct.helperFunctions.toHomeForm;
addRooms=ct.helperFunctions.addRooms;
alterChildren=ct.helperFunctions.alterChildren;
ct.genericBlocks.hotelForm.handleCitySelection=function(data){
$("country").writeAttribute("value",data.c?data.c:"");
$("state").writeAttribute("value",data.s?data.s:"");
};
ct.controls.Calendar._markupOutlineCache=null;
ct.helperFunctions.resetCurrency(false);
var pageTracker;
(function(){
function startupCode(){
ct.domIsLoaded=true;
ct.validator._initializeForms();
ct.selfLabels.parseDomTree();
if(typeof isCalendarPage=="undefined"){
ct.bubbles.parseDomTree();
}
ct.stickyBlocks.parseDomTree();
ct.genericBlocks.parseDomTree();
ct.controls.parseDomTree();
Event.observe(document,"click",function(){
if($("ct_bubbleNode")){
ct.dom.removeIEIframeFix($("ct_bubbleNode"));
$("ct_bubbleNode").remove();
}
});
setTimeout(ct.helperFunctions.prefetchResources,3000);
setTimeout(function(){
var _2cf=document.location.toString();
_2cf=_2cf.toQueryParams();
if(_2cf.host){
var _2d0=$("AirSearch")?$("AirSearch"):$("home_hotels");
_2d0.action="http://"+_2cf.host+($("AirSearch")?"/airInterstitial":"/hotelInterstitial");
if($("offer_nav")){
$("offer_nav").select("a").each(function(link){
link.href=link.href+"?host="+_2cf.host;
});
}
}
},3000);
var _2d2=new Image();
var loc=window.location;
_2d2.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 _2d4=new Date().getTime();
var _2d5=new Element("script",{type:"text/javascript",src:"/javascripts/ga.v"+_2d4+".js"});
document.getElementsByTagName("head")[0].appendChild(_2d5);
}
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 _2d4=new Date().getTime();
var _2d6=new Element("script",{type:"text/javascript",src:"/javascripts/webtrends.v"+_2d4+".js"});
document.getElementsByTagName("head")[0].appendChild(_2d6);
}
}
ct.carousel();
ct.socialmedia.twitter();
ct.socialmedia.facebook();
ct.trackers.page_count();
}
Event.observe(window,"load",startupCode);
Event.observe(window,"pageshow",function(evt){
if(evt.persisted){
startupCode();
}
});
Event.observe(window,"unload",function(){
$A($$(".autocomplete")).each(function(_2d8){
_2d8.setAttribute("autocomplete","on");
});
});
Event.observe(window,"load",function(){
if(window.setprimarynavigation){
if(document.cookie){
usrname="";
var _2d9=document.cookie.split(";");
for(var c=0;c<_2d9.length;c++){
var _2db=_2d9[c].split("=");
if(_2db[0]==" userid"){
var _2dc=_2d9[c].split("=");
usrname=_2dc[1];
usrname=usrname.replace("%40","@");
var _2dd=new Element("a",{"class":"","title":"Your member page","id":"AccountMenuLink","href":"#"}).update(usrname);
$$(".first")[0].appendChild(_2dd);
}
}
}
if(usrname==""){
var _2dd=new Element("a",{"class":"","title":"Your member page","id":"signin","href":"/signin"}).update("Sign In");
_2dd.addClassName("forceHttps");
$$(".first")[0].appendChild(_2dd);
ct.validator.parseDomTree("signin");
}
}
});
})();
Ajax.Responders.register(ct.ajaxTimeoutHandler);

