function createNamespace(b){if(typeof(Ext)=="undefined"){if(typeof(b)=="undefined"){return}var a=b.split(".");var c=window;for(i=0;i<a.length;i++){var e=a[i];if(!c[e]){c[e]={}}c=c[e]}}else{Ext.namespace(b)}}createNamespace("ibibo.travel");createNamespace("ibibo.travel.ui");createNamespace("ibibo.travel.ui.constants");createNamespace("ibibo.utilities");createNamespace("ibibo.widget");createNamespace("ibibo.travel.widget");ibibo.travel.ui.constants.today=new Date();ibibo.travel.ui.constants.today.setHours(0);ibibo.travel.ui.constants.today.setMinutes(0);ibibo.travel.ui.constants.today.setSeconds(0);ibibo.travel.ui.constants.today.setMilliseconds(0);ibibo.travel.ui.constants.today.setFullYear(2009,(8-1),13);ibibo.travel.ui.winContactImg=null;ibibo.travel.util={callGA:function(){try{var a=_gat._getTracker("UA-9782412-2");a._initData();a._trackPageview();return}catch(b){}},addEvent:function(f,e,b,a){if(f.addEventListener){f.addEventListener(e,b,a);return true}else{if(f.attachEvent){var c=f.attachEvent("on"+e,b);return c}else{}}},loadGA:function(){var e=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");var c=unescape(e+"google-analytics.com/ga.js");var b=document.createElement("script");b.setAttribute("id","googleanalytics");b.setAttribute("src",c);b.setAttribute("type","text/javascript");ibibo.travel.util.addEvent(b,"readystatechange",function(){if((b.readyState=="complete")||(b.readyState=="loaded")){ibibo.travel.util.callGA()}});var a=this;ibibo.travel.util.addEvent(b,"load",ibibo.travel.util.callGA);document.getElementsByTagName("head").item(0).appendChild(b)},openwindow:function(a){mywindow=window.open(a,"Faq","location=1,status=1,scrollbars=1,width=500,height=500,resizable=yes");mywindow.moveTo(0,0)},validateUnwantedChar:function(a,c,e,f){var b="";if((a==""||a==" "||a==null)&&(f)){return true}if(a==" "||a==null){return"Please provide some value"}if(a.length>c){return"Length of code must be less than or equal to "+c.toString()+" characters"}a=ibibo.travel.util.Trim(a);if(e.test(a)){return true}else{return"Must not contain any special character or numeric values"}return true},TrimChar:function(a){a=a.replace(/&/g," ");a=a.replace(/"/g," ");a=a.replace(/'/g," ");a=a.replace(/`/g," ");a=a.replace(/~/g," ");a=a.replace(/^\s+/,"").replace(/\s+$/,"");return a},isEmpty:function(b){b=ibibo.travel.util.Trim(b);var a=/^[\s ]*$/gi;if(a.test(b)){return false}else{return true}},Trim:function(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")},opencontactwindow:function(a){mywindow=window.open(a,"mywindow","location=1,status=1,scrollbars=1,width=500,height=500,resizable=yes");mywindow.moveTo(0,0)}};Array.prototype.getUnique=function(){var c=new Array();o:for(var b=0,f=this.length;b<f;b++){for(var a=0,e=c.length;a<e;a++){if(c[a]==this[b]){continue o}}c[c.length]=this[b]}return c};Global_run_event_hook=true;Global_combo_array=new Array();Array.prototype.remove=function(a){if(isNaN(a)||a>this.length){self.status="Array_remove:invalid request-"+a;return false}for(var b=0,c=0;b<this.length;b++){if(this[b]!=this[a]){this[c++]=this[b]}}this.length-=1};function ComboBox_make(){var b,a;a=this.name+"txt";this.txtview=document.getElementById(this.name+"txt");this.valcon=document.getElementById(this.name+"hidden");tmp=document.getElementById(this.name+"actionCombo");tmp.onfocus=function(){this.blur()};tmp.onclick=new Function("",this.name+".toggle()")}function ComboBox_choose(b,a){this.value=b;var c="document.getElementById('"+this.name+"txt').value = '"+a+"'";window.setTimeout(c,1);this.valcon.value=b;this.listSelected=false;for(i=0;i<this.expops.length;i++){if(this.expops[i].value==b){this.pointer=i}}document.getElementById("comboFrame").style.display="none"}function ComboBox_mouseDown(e){try{var obj,len,el,i;el=e.target?e.target:e.srcElement;while(el.nodeType!=1){el=el.parentNode}var elcl=el.className;if(elcl.indexOf("combo-")!=0){len=Global_combo_array.length;for(i=0;i<len;i++){curobj=Global_combo_array[i];if(curobj.opslist){curobj.opslist.style.display="none";document.getElementById("comboFrame").style.display="none"}}}else{var id_arr=el.id.split("_");var text=el.innerHTML;eval(id_arr[0]+".listSelected=true;"+id_arr[0]+".choose('"+id_arr[1]+"','"+text+"');"+id_arr[0]+".opslist.style.display='none';")}}catch(e){}}function ComboBox_keyPress(h){var b,g,a,c,f;a=h;b=a.keyCode;c=h.target?h.target:h.srcElement;while(c.nodeType!=1){c=c.parentNode}elcl=c.className;if(elcl.indexOf("combo-")==0){if(elcl.split("-")[1].indexOf("input")==0){f=c.id.split("txt")[0];g=window[f];switch(b){case 38:g.pointer-=1;fixPointer(g);selectDiv(-1,g);if(g.pointer>3){c.parentNode.lastChild.scrollTop-=25}break;case 40:g.pointer+=1;fixPointer(g);selectDiv(1,g);if(g.pointer>3){c.parentNode.lastChild.scrollTop+=25}break;case 13:chooseDiv(g);document.getElementById("comboFrame").style.display="none"}}}fixPointer=function(e){if(e.pointer<0){e.pointer=0}else{if(e.pointer>=e.expops.length){e.pointer=e.expops.length-1}}};selectDiv=function(l,k){mainComboDiv=document.getElementById(k.name+"Div");divOptions=mainComboDiv.getElementsByTagName("a");divOptions[k.pointer].className="combo-hilite";try{divOptions[k.pointer-l].className="combo-item"}catch(j){}return};chooseDiv=function(e){e.choose(e.expops[e.pointer].value,e.expops[e.pointer].text);document.getElementById("comboFrame").style.display="none"}}function ComboBox_handleKey(j){var l,g,a,b,f;a=j;l=a.keyCode;b=j.target?j.target:j.srcElement;while(b.nodeType!=1){b=b.parentNode}elcl=b.className;if(elcl.indexOf("combo-")==0){if(elcl.split("-")[1].indexOf("input")==0){f=b.id.split("txt")[0];g=window[f];g.expops.length=0;g.update();var h=location.href;if((h.indexOf("international")!="-1")||(h.indexOf("cheap/flight-tickets")!="-1"&&document.getElementById("international"))||(h.indexOf("flight-searchresult")!="-1"&&document.getElementById("international"))){if((b.value.length>2)&&(b.id=="destSelecttxt")){var c=getInterAirports(b.value,g.options.length);g.expops=c;if(g.expops.length>1&&g.expops[0].text=="(No match)"){g.expops.remove(0)}}}if(l!=40&&l!=38&&l!=13){g.build(g.expops)}if(g.expops.length==1&&g.expops[0].text=="(No match)"){}else{var k=g.expops.length;hg=30*k;if(k==1){hg=40}if(hg>250){hg=250}else{g.opslist.style.overflowY="hidden"}hg+="px";try{document.getElementById("comboFrame").style.left=ibibo.travel.util.findPosX(g.opslist)+"px";document.getElementById("comboFrame").style.top=ibibo.travel.util.findPosY(g.opslist)+"px";document.getElementById("comboFrame").style.display="block"}catch(j){}g.opslist.style.display="block";g.opslist.style.height=hg}if(l!=13){g.value=b.value;g.valcon.value=b.value}}}}function ComboBox_update(){var h,c,f,e,b,a;a=false;var g=location.href;if((g.indexOf("flight-searchresult")!="-1")&&(this.txtview.id=="srcSelecttxt")){e=this.options.length}else{e=this.options.length}c=this.txtview.value.toLowerCase();f=c.length;if(f==0){for(b=0;b<e;b++){this.expops[this.expops.length]=this.options[b];a=true}}else{for(b=0;b<e;b++){h=this.options[b].text.toLowerCase().substring(0,f);if(c==h){this.expops[this.expops.length]=this.options[b];a=true}}}if(!a){this.expops[0]=new ComboBoxItem("(No match)","")}}function ComboBox_remove(a){this.options.remove(a)}function ComboBox_add(){var a,b;b=arguments.length;for(a=0;a<b;a++){this.options[this.options.length]=arguments[a]}}function ComboBox_build(a){var g,e;e=a.length;g='<div id="combo_new">';var f=new Array(e);if((/(src|dest)/.test(this.name))){var b="combo-item";var h="combo-hilite"}else{var b="combo-item combo-item-pass";var h="combo-hilite combo-hilite-pass"}for(var c=0;c<e;c++){f[c]='<a class="'+b+'" id="'+this.name+"_"+a[c].value+'" >'+a[c].text+"</a>"}g=g+f.join("")+"</div>";if(this.opslist){this.view.removeChild(this.opslist)}this.opslist=document.createElement("DIV");this.opslist.innerHTML=g;this.opslist.style.display="none";document.getElementById("comboFrame").style.display="none";this.pointer=-1;if((/(src|dest)/.test(this.name))){this.opslist.className="combo-list1";this.opslist.id="combo-list1"}else{this.opslist.className="combo-list2";this.opslist.id="combo-list2"}this.opslist.style.zIndex=ComboBox.prototype.COMBOBOXZINDEX;this.opslist.onselectstart=returnFalse;this.view.appendChild(this.opslist)}function ComboBox_toggle(){if(this.options.length>1){if(this.opslist){if(this.opslist.style.display=="block"){this.opslist.style.display="none";document.getElementById("comboFrame").style.display="none"}else{this.update();this.build(this.options);this.view.style.zIndex=++ComboBox.prototype.COMBOBOXZINDEX;this.opslist.style.display="block"}}else{this.update();this.build(this.options);this.view.style.zIndex=1006;this.opslist.style.display="block"}var a=25*this.options.length;if(a>250){a=250}a+="px";this.opslist.style.height=a}}function ComboBox(){if(arguments.length==0){self.status="ComboBox invalid - no name arg"}this.name=arguments[0];this.par=arguments[1]||document.body;this.view=document.getElementById(this.name+"Div");this.options=new Array();this.expops=new Array();this.value="";this.build=ComboBox_build;this.make=ComboBox_make;this.choose=ComboBox_choose;this.add=ComboBox_add;this.toggle=ComboBox_toggle;this.update=ComboBox_update;this.remove=ComboBox_remove;this.focusout=ComboBox_focusOut;this.listSelected=false;this.pointer=null;this.make();this.txtview=document.getElementById(this.name+"txt");this.valcon=document.getElementById(this.name+"hidden");if(document.addEventListener){this.txtview.addEventListener("blur",ComboBox_focusOut,100,false)}else{if(document.attachEvent){this.txtview.attachEvent("onblur",function(){ComboBox_focusOut(window.event)})}}Global_combo_array[Global_combo_array.length]=this;if(Global_run_event_hook){ComboBox_init(this.txtview)}}ComboBox.prototype.COMBOBOXZINDEX=9999;function ComboBox_focusOut(h){var b,g,a,c,f;a=h;b=a.keyCode;c=h.target?h.target:h.srcElement;while(c.nodeType!=1){c=c.parentNode}elcl=c.className;if(elcl.indexOf("combo-")==0){if(elcl.split("-")[1].indexOf("input")==0){var g,c,f;c=h.target?h.target:h.srcElement;f=c.id.split("txt")[0];g=window[f];if(g.expops.length>=1){if(g.expops.length==1){g.valcon.value=g.expops[0].value;g.value=g.expops[0].value;g.txtview.value=g.expops[0].text}else{if(g.pointer>-1){g.choose(g.expops[g.pointer].value,g.expops[g.pointer].text);document.getElementById("comboFrame").style.display="none"}}}g.expops.length=0;g.update();setTimeout(function(){if(!g.listSelected){if(g.opslist.style.display=="block"){g.opslist.style.display="none";document.getElementById("comboFrame").style.display="none"}}},200)}}}function ComboBox_init(){if(document.addEventListener){document.addEventListener("keyup",ComboBox_handleKey,false);document.addEventListener("mousedown",ComboBox_mouseDown,false);document.addEventListener("keydown",ComboBox_keyPress,false)}else{if(document.attachEvent){document.attachEvent("onkeyup",function(){ComboBox_handleKey(window.event)});document.attachEvent("onmousedown",function(){ComboBox_mouseDown(window.event)});document.attachEvent("onkeydown",function(){ComboBox_keyPress(window.event)})}}Global_run_event_hook=false}function returnFalse(){return false}function ComboBoxItem(b,a){this.text=b;this.value=a}function getInterAirports(a,b){return makeGetRequest(a,b)}function createRequestObject(){var a;if(window.XMLHttpRequest){a=new XMLHttpRequest()}else{if(window.ActiveXObject){a=new ActiveXObject("Microsoft.XMLHTTP")}}return a}var http=createRequestObject();function makeGetRequest(searchword,arrLen){http.open("get","/common/selectairports/?search="+searchword,false);http.send(null);var intArr=[];if(http.readyState==4){var resp=eval("("+http.responseText+")");if(resp&&resp.result=="failed"){}else{for(i=0;i<resp.length;i++){intArr.push(new ComboBoxItem(resp[i]["cityname"]+" ("+resp[i]["iatacode"]+"), "+resp[i]["countryname"],resp[i]["iatacode"]))}}}return intArr}function processResponse(){if(http.readyState==4){var a=http.responseText;return a}}ibibo.travel.airport_codes=[["New Delhi, India - Indira Gandhi Intl (DEL)","DEL",[0,38,3,10,16,18,25,32]],["Mumbai, India - Chhatrapati Shivaji International (BOM)","BOM",[0,50,7,13,15,27,35]],["Bangalore, India - Bangalore International Airport (BLR)","BLR",[0,51,10,16,18,28,42]],["Goa, India - Dabolim (GOI)","GOI",[0,21,4,10,12]],["Chennai, India - Madras International (Meenambakkam) (MAA)","MAA",[0,38,53,8,14,16,23]],["Hyderabad, India - Hyderabad Airport (HYD)","HYD",[0,37,10,16,18,28]],["Kolkata, India - Netaji Subhas Chandra (CCU)","CCU",[0,39,8,14,16,23,30]],["Pune, India - Lohegaon (PNQ)","PNQ",[0,23,5,11,13]],["---------","-",[0,0,0,0,0]],["Agartala, India - Singerbhil (IXA)","IXA",[0,29,9,15,17]],["Agatti Island, India (AGX)","AGX",[0,21,6,14]],["Agra, India - Kheria (AGR)","AGR",[0,21,5,11,13]],["Ahmedabad, India (AMD)","AMD",[0,17,10]],["Aizawl, India (AJL)","AJL",[0,14,7]],["Allahabad, India - Bamrauli (IXD)","IXD",[0,28,10,16,18]],["Along, India (IXV)","IXV",[0,13,6]],["Amritsar, India - Raja Sansi (ATQ)","ATQ",[0,29,9,15,17,22]],["Aurangabad, India - Chikkalthana (IXU)","IXU",[0,33,11,17,19]],["Bagdogra, India - Bagdogra (IXB)","IXB",[0,27,9,15,17]],["Bhubaneswar, India (BBI)","BBI",[0,19,12]],["Bareli, India (BEK)","BEK",[0,14,7]],["Belgaum, India - Sambre (IXG)","IXG",[0,24,8,14,16]],["Bhuj, India - Rudra Mata (BHJ)","BHJ",[0,25,5,11,13,19]],["Bhopal, India (BHO)","BHO",[0,14,7]],["Bhavnagar, India (BHU)","BHU",[0,17,10]],["Calicut, India - Kozhikode Airport (CCJ)","CCJ",[0,35,8,14,16,26]],["Cochin, India - Cochin International (COK)","COK",[0,36,6,12,14,21]],["Coimbatore, India - Peelamedu (CJB)","CJB",[0,30,11,17,19]],["Chandigarh, India (IXC)","IXC",[0,18,11]],["Dharamshala, India - Gaggal Airport (DHM)","DHM",[0,36,12,18,20,27]],["Dehra Dun, India (DED)","DED",[0,17,5,10]],["Dibrugarh, India - Mohanbari (DIB)","DIB",[0,29,10,16,18]],["Dimapur, India - Dimapur (DMU)","DMU",[0,15,8]],["Diu, India - Diu (DIU)","DIU",[0,15,8]],["Guwahati, India - Borjhar (GAU)","GAU",[0,26,9,15,17]],["Gaya, India (GAY)","GAY",[0,12,5]],["Gorakhpur, India (GOP)","GOP",[0,12,5]],["Gwalior, India (GWL)","GWL",[0,15,8]],["Hubli, India (HBX)","HBX",[0,13,6]],["Indore, India - Devi Ahilyabai Holkar (IDR)","IDR",[0,38,7,13,15,20,30]],["Imphal, India - Municipal (IMF)","IMF",[0,26,7,13,15]],["Jammu, India - Satwari (IXJ)","IXJ",[0,23,6,12,14]],["Jamshedpur, India - Sonari (IXW)","IXW",[0,27,11,17,19]],["Jaipur, India - Sanganeer (JAI)","JAI",[0,26,7,13,15]],["Jodhpur, India (JDH)","JDH",[0,15,8]],["Jamnagar, India - Govardhanpur (JGA)","JGA",[0,31,9,15,17]],["Jabalpur, India (JLR)","JLR",[0,16,9]],["Jorhat, India - Rowriah (JRH)","JRH",[0,24,7,13,15]],["Jaisalmer, India (JSA)","JSA",[0,17,10]],["Kailashahar, India (IXH)","IXH",[0,19,12]],["Kamalpur, India (IXQ)","IXQ",[0,16,9]],["Kandla, India (IXY)","IXY",[0,14,7]],["Kanpur, India (KNU)","KNU",[0,14,7]],["Keshod, India (IXK)","IXK",[0,14,7]],["Khajuraho, India (HJR)","HJR",[0,17,10]],["Khowai, India (IXN)","IXN",[0,14,7]],["Kochi, India - Cochin International (COK)","COK",[0,36,6,12,14,21]],["Kolhapur, India (KLH)","KLH",[0,16,9]],["Kulu, India (KUU)","KUU",[0,16,9]],["Latur, India - Latur Airport (LTU)","LTU",[0,29,4,10,12,19]],["Leh, India - Bakula Rimpoche (IXL)","IXL",[0,29,4,10,12,19]],["Lilabari, India (IXI)","IXI",[0,16,9]],["Lucknow, India - Amausi (LKO)","LKO",[0,24,8,14,16]],["Madurai, India (IXM)","IXM",[0,15,8]],["Mangalore, India - Bajpe (IXE)","IXE",[0,25,10,16,18]],["Nasik, India - Gandhinagar Arpt (ISK)","ISK",[0,32,6,12,14,26]],["Nagpur, India - Sonegaon (NAG)","NAG",[0,25,7,13,15]],["Nanded, India (NDC)","NDC",[0,14,7]],["Pantnagar, India - Pantnagar Airport (PGH)","PGH",[0,16,9]],["Pasighat, India (IXT)","IXT",[0,16,9]],["Pathankot, India (IXP)","IXP",[0,17,10]],["Patna, India (PAT)","PAT",[0,13,6]],["Porbandar, India (PBD)","PBD",[0,17,10]],["Port Blair, India (IXZ)","IXZ",[0,18,4,11]],["Ranchi, India - Birsa Munda International (IXR)","IXR",[0,42,7,13,15,21,27]],["Rajkot, India - Civil (RAJ)","RAJ",[0,22,7,13,15]],["Rajahmundry, India (RJA)","RJA",[0,19,12]],["Raipur, India (RPR)","RPR",[0,14,7]],["Rupsi, India (RUP)","RUP",[0,13,6]],["Silchar, India - Kumbhirgram (IXS)","IXS",[0,29,8,14,16]],["Siliguri(Bagdogra), India - Bagdogra (IXB)","IXB",[0,27,9,15,17]],["Shillong, India - Barapani (SHL)","SHL",[0,27,9,15,17]],["Simla, India (SLV)","SLV",[0,13,6]],["Surat, India (STV)","STV",[0,13,6]],["Srinagar, India (SXR)","SXR",[0,16,9]],["Tuticorin, India (TCR)","TCR",[0,17,10]],["Tezpur, India - Salonibari (TEZ)","TEZ",[0,27,7,13,15]],["Tirupati, India (TIR)","TIR",[0,16,9]],["Thiruvananthapuram, India - Thiruvananthapuram International (TRV)","TRV",[0,61,19,25,27,46]],["Trichy, India - Civil (TRZ)","TRZ",[0,22,7,13,15]],["Udaipur, India - Dabok (UDR)","UDR",[0,23,8,14,16]],["Vadodara, India (BDQ)","BDQ",[0,16,9]],["Varanasi, India (VNS)","VNS",[0,16,9]],["Vijayawada, India (VGA)","VGA",[0,18,11]],["Visakhapatnam, India - Vishakhapatnam (VTZ)","VTZ",[0,38,14,20,22]],["Vizag, India - Vishakhapatnam (VTZ)","VTZ",[0,38,14,20,22]],["Delhi, India - Indira Gandhi Intl (DEL)","DEL",[0,38,3,10,16,18,25,32]]];ibibo.travel.ui.SearchFrom=function(a){this.idStr="#"+this.id;this.travelmode="oneway"};ibibo.travel.ui.SearchFrom.prototype={initUI:function(b){b=false;if(!this.isWidget&&!this.isLanding){this.searchPanel=null}else{this.searchPanel=null}var f=this;document.getElementById("travelmode_oneway").onclick=f.setupTravelMode;document.getElementById("travelmode_twoway").onclick=f.setupTravelMode;try{var a="Search";if(this.isLanding&&!this.isWidget){a="SEARCH"}this.searchButton=new Ext.Button({applyTo:Ext.query(this.idStr+" .search-button")[0],cls:"search-button-wrap",text:a,handler:this.handler});this.searchButton.el.dom.tabIndex=11}catch(c){}},setupJourneySearch:function(){Ext.select(this.idStr+" div.travelmode").setVisibilityMode(Ext.Element.VISIBILITY).show(false);Ext.select(this.idStr+" div.travelmode").setVisibilityMode(Ext.Element.DISPLAY).show(false);Ext.select(this.idStr+" div.origin_city span").update("From");Ext.select(this.idStr+" div.destination_city").setVisibilityMode(Ext.Element.VISIBILITY).show(false);Ext.select(this.idStr+" div.destination_city").setVisibilityMode(Ext.Element.DISPLAY).show(false);Ext.select(this.idStr+" div.travel_class span").update("Class ")},setupTravelMode:function(){if(document.getElementById("searchfor").value!="hotels"){if(document.forms.commentForm.mode[0].checked){document.getElementById("id_traveldate_1_verbose").disabled="disabled";document.getElementById("arr_dt").className+=" alpha";document.getElementById("calendarbox1").className+=" alpha";this.travelmode="oneway";document.getElementById("calendarbox1layer").style.display="block";document.getElementById("calendarbox1layer").style.background="#ffffff"}else{this.travelmode="twoway";document.getElementById("id_traveldate_1_verbose").disabled=undefined;document.getElementById("arr_dt").className=document.getElementById("arr_dt").className.replace(" alpha","");document.getElementById("calendarbox1").className=document.getElementById("calendarbox1").className.replace(" alpha","");document.getElementById("calendarbox1layer").style.display="none"}}else{document.getElementById("id_traveldate_1_verbose").disabled=undefined;document.getElementById("arr_dt").className=document.getElementById("arr_dt").className.replace(" alpha","");document.getElementById("calendarbox1").className=document.getElementById("calendarbox1").className.replace(" alpha","");document.getElementById("calendarbox1layer").style.display="none"}},setupSearch:function(a){if(!a){a=Ext.query(this.idStr+" input.searchfor:checked")[0].value}else{Ext.query(this.idStr+" input.searchfor[value="+a+"]")[0].checked=true}Ext.select(this.idStr+" .validation-error").elements[0].style.display="none";this.setupTravellerFields(a);this.setupTravelMode(a);this.setupAirSearch()},setupAirSearch:function(){this.setupJourneySearch();var b=Ext.select(this.idStr+" select.travel_class");var a='<option value="business">Business</option><option value="economy">Economy</option>';b.update(a)},collapse:function(a){if(this.searchPanel){this.searchPanel.collapse(a)}},expand:function(a){if(this.searchPanel){this.searchPanel.expand(a)}},getFormValues:function(){var g=Array();try{if(document.getElementById("searchfor").value=="bus"){g.searchfor="bus"}else{g.searchfor="air"}}catch(f){g.searchfor="air"}if(document.getElementById("searchfor").value=="hotels"){g.searchfor="hotels"}else{if(document.forms.commentForm.mode[0].checked){g.travelmode="oneway"}else{g.travelmode="twoway"}}if(g.searchfor!="hotels"){srcid=srcSelect.value}destid=destSelect.value;if(g.searchfor=="bus"){g.srcData=ibibo.travel.city_codes[srcid];g.destData=ibibo.travel.city_codes[destid]}else{if(g.searchfor=="hotels"){g.destData=ibibo.travel.hotel_city[destid];g.rooms=document.getElementById("strRooms").value;for(var c=1;c<6;c++){var b="strAdultsRoom"+c;var k="strChildrenRoom"+c;g[b]=document.getElementById(b).value;g[k]=document.getElementById(k).value;for(var a=1;a<4;a++){var h="strAgeChild"+a+"Room"+c;g[h]=document.getElementById(h).value}}}else{g.srcData=ibibo.travel.airport_codes[srcid];if(g.srcData==undefined){g.srcData=[srcSelect.txtview.value,srcid]}g.destData=ibibo.travel.airport_codes[destid];if(g.destData==undefined){g.destData=[destSelect.txtview.value,destid]}g.travellerClass1=adultSelect.value;g.travellerClass2=childSelect.value;g.travellerClass3=infantSelect.value;g.travellerclass=classSelect.value}}tdep_arr=document.getElementById("id_traveldate_0").value.split("-");tarr_arr=document.getElementById("id_traveldate_1").value.split("-");try{if(tdep_arr[1].length==1){tdep_arr[1]="0"+tdep_arr[1]}if(tdep_arr[2].length==1){tdep_arr[2]="0"+tdep_arr[2]}if(tarr_arr[1].length==1){tarr_arr[1]="0"+tarr_arr[1]}if(tarr_arr[2].length==1){tarr_arr[2]="0"+tarr_arr[2]}g.arr_dt=tarr_arr[2]+"-"+tarr_arr[1]+"-"+tarr_arr[0]}catch(f){g.arr_dt=""}g.dep_dt=tdep_arr[2]+"-"+tdep_arr[1]+"-"+tdep_arr[0];return g},convertDateToQueryFormat:function(b){try{var a=b.split("-");return a[2]+a[1]+a[0]}catch(c){return""}},getQueryString:function(){try{var f=this.getFormValues();var a="";var c=this.convertDateToQueryFormat(f.dep_dt);var h=this.convertDateToQueryFormat(f.arr_dt);if(f.searchfor!="hotel"&&f.travelmode=="oneway"){h=""}if(f.searchfor=="bus"){var g=f.searchfor+"-"+f.srcData+"-"+a+"-"+c+"-"+h+"-1-0-0-"}else{if(f.destData){a=f.destData[1]}var g=f.searchfor+"-"+f.srcData+"-"+a+"-"+c+"-"+h+"-"+f.travellerClass1+"-"+f.travellerClass2+"-"+f.travellerClass3+"-"+f.travelclass}return g}catch(b){return null}},getCookie:function(a){if(document.cookie.length>0){c_start=document.cookie.indexOf(a+"=");if(c_start!=-1){c_start=c_start+a.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return""},setUpCalendar:function(a,b){DateTimeShortcuts.calendars[a].currentMonth=b.getMonth()+1;DateTimeShortcuts.calendars[a].currentYear=b.getCorrectYear();DateTimeShortcuts.calendars[a].drawCurrent();try{document.getElementById("calendarin"+a+"selecteddate").id="calendarin"+a+"_"+document.getElementById("calendarin"+a+"selecteddate").childNodes[0].innerHTML}catch(c){}document.getElementById("calendarin"+a+"_"+b.getDate()).id="calendarin"+a+"selecteddate"},setBusFormValues:function(g){if(!g){var h=this.getCookie("querybus");if(h){var a=h.split("-");var b=ibibo.travel.city_codes;var j=ibibo.travel.ui.Controller.getNameFromCode(a[1],b,true);var e=ibibo.travel.ui.Controller.getNameFromCode(a[2],b,true);srcSelect.choose(j[1],j[0].split(",")[0]);destSelect.choose(e[1],e[0].split(",")[0]);var f=new Date();var c=new Date(a[3].substr(0,4)+"/"+a[3].substr(4,2)+"/"+a[3].substr(6,2));if(c>f){document.getElementById("id_traveldate_0").value=a[3].substr(0,4)+"-"+a[3].substr(4,2)+"-"+a[3].substr(6,2);document.getElementById("id_traveldate_0_verbose").value=c.toDateString();this.setUpCalendar(0,c)}else{document.getElementById("id_traveldate_0").value=f.getFullYear()+"-"+(f.getMonth()+1)+"-"+f.getDate();document.getElementById("id_traveldate_0_verbose").value=f.toDateString();this.setUpCalendar(0,f)}if(a[4]!=""){var c=new Date(a[4].substr(0,4)+"/"+a[4].substr(4,2)+"/"+a[4].substr(6,2));if(c>f){document.getElementById("id_traveldate_1").value=a[4].substr(0,4)+"-"+a[4].substr(4,2)+"-"+a[4].substr(6,2);document.getElementById("id_traveldate_1_verbose").value=c.toDateString();this.setUpCalendar(1,c)}else{document.getElementById("id_traveldate_1").value=f.getFullYear()+"-"+(f.getMonth()+1)+"-"+f.getDate();document.getElementById("id_traveldate_1_verbose").value=f.toDateString();this.setUpCalendar(1,f)}document.getElementById("travelmode_twoway").checked=true;document.getElementById("travelmode_oneway").checked=false;document.getElementById("arr_dt").style.visibility="visible";if(window.location.pathname=="/searchwidget/"){document.getElementById("arr_dt").style.display="inline"}else{document.getElementById("arr_dt").style.display="block"}}else{document.getElementById("travelmode_twoway").checked=false;document.getElementById("travelmode_oneway").checked=true}}else{var h=new Date();h.setDate(h.getDate());document.getElementById("id_traveldate_0").value=h.getFullYear()+"-"+(h.getMonth()+1)+"-"+h.getDate();document.getElementById("id_traveldate_0_verbose").value=h.toLocaleDateString();srcSelect.choose(1,srcSelect.options[1].text);destSelect.choose(2,destSelect.options[2].text)}}else{}},setHotelFormValues:function(k){if(!k){var n=this.getCookie("queryhotel");if(n){var l=n.split("-");var a=ibibo.travel.hotel_city;var h=ibibo.travel.ui.Controller.getNameFromCode(l[1],a,true);destSelect.choose(h[1],h[0].split(",")[0]);var r=new Date();var t=new Date(l[2].substr(0,4)+"/"+l[2].substr(4,2)+"/"+l[2].substr(6,2));if(t>r){document.getElementById("id_traveldate_0").value=l[2].substr(0,4)+"-"+l[2].substr(4,2)+"-"+l[2].substr(6,2);document.getElementById("id_traveldate_0_verbose").value=t.toDateString();this.setUpCalendar(0,t)}else{document.getElementById("id_traveldate_0").value=r.getFullYear()+"-"+(r.getMonth()+1)+"-"+r.getDate();document.getElementById("id_traveldate_0_verbose").value=r.toDateString();this.setUpCalendar(0,r)}var t=new Date(l[3].substr(0,4)+"/"+l[3].substr(4,2)+"/"+l[3].substr(6,2));if(t>r){document.getElementById("id_traveldate_1").value=l[3].substr(0,4)+"-"+l[3].substr(4,2)+"-"+l[3].substr(6,2);document.getElementById("id_traveldate_1_verbose").value=t.toDateString();this.setUpCalendar(1,t)}else{document.getElementById("id_traveldate_1").value=r.getFullYear()+"-"+(r.getMonth()+1)+"-"+(r.getDate()+1);document.getElementById("id_traveldate_1_verbose").value=r.toDateString();this.setUpCalendar(1,r)}if(l[4]>0){var c=document.getElementById("strRooms").value=l[4];roomChange();for(var g=1;g<=c;g++){var q=l[4+g].split("_");var b="strAdultsRoom"+g;document.getElementById(b).value=q[0];var s="strChildrenRoom"+g;document.getElementById(s).value=q[1];countChildren();for(var f=1;f<=q[1];f++){var p="strAgeChild"+f+"Room"+g;document.getElementById(p).value=q[1+f]}}}}else{var n=new Date();n.setDate(n.getDate()+1);document.getElementById("id_traveldate_0").value=n.getFullYear()+"-"+(n.getMonth()+1)+"-"+n.getDate();document.getElementById("id_traveldate_0_verbose").value=n.toDateString();n.setDate(n.getDate()+2);document.getElementById("id_traveldate_1").value=n.getFullYear()+"-"+(n.getMonth()+1)+"-"+n.getDate();document.getElementById("id_traveldate_1_verbose").value=n.toDateString();try{destSelect.choose(0,destSelect.options[0].text)}catch(m){destSelect.choose("DEL","New Delhi(DEL), India")}}}else{}},setFormValues:function(f){if(!f){var j="";if(location.href.indexOf("international")!="-1"){j=this.getCookie("queryinter");var k=this.getCookie("intercitydetails");var b=k.split("-")}else{j=this.getCookie("query")}if(j){var g=j.split("-");var a=ibibo.travel.airport_codes;var c=ibibo.travel.ui.Controller.getNameFromCode(g[1],a,true);var m=ibibo.travel.ui.Controller.getNameFromCode(g[2],a,true);srcSelect.choose(c[1],c[0].split(",")[0]);if(location.href.indexOf("international")!="-1"){destSelect.choose(g[2],b[b.length-1])}else{destSelect.choose(m[1],m[0].split(",")[0])}var n=new Date();var p=new Date(g[3].substr(0,4)+"/"+g[3].substr(4,2)+"/"+g[3].substr(6,2));if(p>n){document.getElementById("id_traveldate_0").value=g[3].substr(0,4)+"-"+g[3].substr(4,2)+"-"+g[3].substr(6,2);document.getElementById("id_traveldate_0_verbose").value=p.toDateString();this.setUpCalendar(0,p)}else{document.getElementById("id_traveldate_0").value=n.getFullYear()+"-"+(n.getMonth()+1)+"-"+n.getDate();document.getElementById("id_traveldate_0_verbose").value=n.toDateString();this.setUpCalendar(0,n)}if(g[4]!=""){var p=new Date(g[4].substr(0,4)+"/"+g[4].substr(4,2)+"/"+g[4].substr(6,2));if(p>n){document.getElementById("id_traveldate_1").value=g[4].substr(0,4)+"-"+g[4].substr(4,2)+"-"+g[4].substr(6,2);document.getElementById("id_traveldate_1_verbose").value=p.toDateString();this.setUpCalendar(1,p)}else{document.getElementById("id_traveldate_1").value=n.getFullYear()+"-"+(n.getMonth()+1)+"-"+n.getDate();document.getElementById("id_traveldate_1_verbose").value=n.toDateString();this.setUpCalendar(1,n)}document.getElementById("travelmode_twoway").checked=true;document.getElementById("travelmode_oneway").checked=false;document.getElementById("arr_dt").style.visibility="visible";if(window.location.pathname=="/searchwidget/"){document.getElementById("arr_dt").style.display="inline"}else{document.getElementById("arr_dt").style.display="block"}}else{document.getElementById("travelmode_twoway").checked=false;document.getElementById("travelmode_oneway").checked=true}adultSelect.choose(g[5],g[5]);childSelect.choose(g[6],g[6]);infantSelect.choose(g[7],g[7]);var l={E:"Economy",B:"Business"};classSelect.choose(l[g[8]].toLowerCase(),l[g[8]])}else{var j=new Date();j.setDate(j.getDate()+1);document.getElementById("id_traveldate_0").value=j.getFullYear()+"-"+(j.getMonth()+1)+"-"+j.getDate();document.getElementById("id_traveldate_0_verbose").value=j.toDateString();try{srcSelect.choose(0,srcSelect.options[0].text)}catch(h){srcSelect.choose("DEL","New Delhi(DEL), India")}try{destSelect.choose(1,destSelect.options[1].text)}catch(h){destSelect.choose("JFK","New York(JFK), United States")}adultSelect.choose(1,1);childSelect.choose(0,0);infantSelect.choose(0,0);classSelect.choose("Economy","Economy")}}else{}},validate:function(b){if(!b){b=this.getFormValues()}var a=false;if(b.searchfor=="air"){a=this.validateAirSearch(b)}else{if(b.searchfor=="rail"){a=this.validateRailSearch(b)}else{if(b.searchfor=="bus"){a=this.validateBusSearch(b)}else{if(b.searchfor=="hotels"){a=this.validateHotelSearch(b)}}}}if(a){document.getElementById("validation-error").style.display="none"}else{document.getElementById("validation-error").style.display="block"}return a},validateHotelSearch:function(g){if(!g.destData){this.showValidationError("Please enter destination city");document.getElementById("destSelecttxt").focus();destSelect.listSelected=true;destSelect.toggle();return false}if(g.destData[1]=="-"){this.showValidationError("Enter Destination city");document.getElementById("destSelecttxt").focus();destSelect.listSelected=true;destSelect.toggle();return false}if(!this.dateStringValidation(g.dep_dt)){this.showValidationError("Please enter proper Check In Date");return false}if(!this.dateStringValidation(g.arr_dt)){this.showValidationError("Please enter proper Check Out Date");return false}var e=g.dep_dt.split("-");var b=new Date(parseInt(e[2]),parseInt(e[1],10)-1,parseInt(e[0],10));e=g.arr_dt.split("-");var h=new Date(parseInt(e[2]),parseInt(e[1],10)-1,parseInt(e[0],10));if(h<b){this.showValidationError("Check Out Date can not be before Check In Date");return false}var a=1000*60*60*24;if((h-b)/a<1){var m=new Date(h.getTime()+a);this.showValidationError("Check Out Date can not be same as Check In Date");document.getElementById("id_traveldate_1").focus();return false}var k=new RegExp(/[1-5]/);if(!k.test(g.rooms)){this.showValidationError("Please enter proper rooms count");document.getElementById("strRooms").focus();return false}if(g.rooms>0){for(var f=1;f<=g.rooms;f++){var k=new RegExp(/[1-4]/);var l="strAdultsRoom"+f;if(!k.test(g[l])){this.showValidationError("Please enter proper Adults count");document.getElementById(l).focus();return false}var k=new RegExp(/[0-3]/);var q="strChildrenRoom"+f;if(!k.test(g[q])){this.showValidationError("Please enter proper Child count");document.getElementById(q).focus();return false}if(g[q]>0){for(var c=1;c<=g[q];c++){var k=new RegExp(/([1-9][0-2]{0,1})/);var p="strAgeChild"+c+"Room"+f;if(!k.test(g[p])){var n="Please enter age of child "+c+" in room "+f;this.showValidationError(n);document.getElementById(p).focus();return false}}}}}return true},validateBusSearch:function(a){if(!this.validateJourneySearch(a,true)){return false}return true},validateJourneySearch:function(j,c){var b=0;var h=/^[a-zA-Z\u00C0-\u00ff\s]+$/;if(c){b=1}if(j.searchfor=="bus"){if(!j.srcData||!j.srcData[b]){this.showValidationError("Please enter source city");document.getElementById("srcSelecttxt").focus();srcSelect.listSelected=true;srcSelect.toggle();return false}if(!j.destData||!j.destData[b]){this.showValidationError("Please enter destination city");document.getElementById("destSelecttxt").focus();destSelect.listSelected=true;destSelect.toggle();return false}if(j.srcData[1]=="---------"){this.showValidationError("Enter Source city");document.getElementById("srcSelecttxt").focus();srcSelect.listSelected=true;srcSelect.toggle();return false}if(j.destData[1]=="---------"){this.showValidationError("Enter Destination city");document.getElementById("destSelecttxt").focus();destSelect.listSelected=true;destSelect.toggle();return false}if(j.srcData==j.destData){this.showValidationError("Source and destination cannot be the same");document.getElementById("destSelecttxt").focus();destSelect.listSelected=true;destSelect.toggle();return false}if(j.srcData[0].split(",")[0]==j.destData[0].split(",")[0]){this.showValidationError("Source and destination cannot be the same");document.getElementById("destSelecttxt").focus();destSelect.listSelected=true;destSelect.toggle();return false}}else{if(!j.srcData||!j.srcData[b]){this.showValidationError("Please enter source city");document.getElementById("srcSelecttxt").focus();srcSelect.listSelected=true;srcSelect.toggle();return false}if(!j.destData||!j.destData[b]){this.showValidationError("Please enter destination city");document.getElementById("destSelecttxt").focus();destSelect.listSelected=true;destSelect.toggle();return false}if(j.srcData[b]=="-"){this.showValidationError("Enter Source city");document.getElementById("srcSelecttxt").focus();srcSelect.listSelected=true;srcSelect.toggle();return false}if(j.destData[b]=="-"){this.showValidationError("Enter Destination city");document.getElementById("destSelecttxt").focus();destSelect.listSelected=true;destSelect.toggle();return false}if((location.href.indexOf("international")!="-1"&&j.destData.length>1)&&(ibibo.travel.util.validateUnwantedChar(j.destData[1],3,h,false)!=true||ibibo.travel.util.isEmpty(j.destData[1])==false)){this.showValidationError("Enter Proper Destination city");document.getElementById("destSelecttxt").focus();destSelect.listSelected=true;destSelect.toggle();return false}if(j.srcData[b]==j.destData[b]){this.showValidationError("Source and destination cannot be the same");document.getElementById("destSelecttxt").focus();destSelect.listSelected=true;destSelect.toggle();return false}}if(!this.dateStringValidation(j.dep_dt)){this.showValidationError("Please enter proper journey date");return false}if(j.travelmode=="twoway"){if(!this.dateStringValidation(j.arr_dt)){this.showValidationError("Please enter proper return date");return false}var f=j.dep_dt.split("-");var a=new Date(parseInt(f[2]),parseInt(f[1],10)-1,parseInt(f[0],10));f=j.arr_dt.split("-");var g=new Date(parseInt(f[2]),parseInt(f[1],10)-1,parseInt(f[0],10));if(g<a){this.showValidationError("Return date cannot be before journey date");return false}}if(j.searchfor!="bus"){var e=new RegExp(/[1-9]/);if(!e.test(j.travellerClass1)){this.showValidationError("Please enter proper adults count");document.getElementById("adultSelecttxt").focus();return false}var e=new RegExp(/[0-5]/);if(!e.test(j.travellerClass2)){this.showValidationError("Please enter proper child count");document.getElementById("childSelecttxt").focus();return false}var e=new RegExp(/[0-5]/);if(!e.test(j.travellerClass3)){this.showValidationError("Please enter proper infant count");document.getElementById("infantSelecttxt").focus();return false}var e=new RegExp(/(economy)/);if(!e.test(j.travellerclass.toLowerCase())){this.showValidationError("Please enter proper class, economy");document.getElementById("classSelecttxt").focus();return false}}return true},dateStringValidation:function(b){var a=b.split("-");var g=new Date();if(a.length!=3){return false}else{try{if(parseInt(a[2])>=g.getFullYear()&&parseInt(a[1],10)<=12&&parseInt(a[1],10)>0&&parseInt(a[0],10)<=31&&parseInt(a[0],10)>0){var c=new Date(parseInt(a[2]),parseInt(a[1],10)-1,parseInt(a[0],10)+1);if(c<new Date()){return false}return true}else{return false}}catch(f){return false}}},validateAirSearch:function(a){if(!this.validateJourneySearch(a,true)){return false}if(a.travellerClass3>a.travellerClass1){this.showValidationError("Number of infants cannot be more than the number of adults");document.getElementById("infantSelecttxt").focus();return false}if(parseInt(a.travellerClass1)+parseInt(a.travellerClass2)+parseInt(a.travellerClass3)<=0){this.showValidationError("No travellers selected");document.getElementById("adultSelecttxt").focus();return false}if(parseInt(a.travellerClass1)+parseInt(a.travellerClass2)+parseInt(a.travellerClass3)>9){this.showValidationError("Maximum of 9 travellers allowed to book at a time");document.getElementById("adultSelecttxt").focus();return false}return true},showValidationError:function(a){document.getElementById("validation-error").innerHTML=a},createComboBoxes:function(){srcSelect=new ComboBox("srcSelect",document.getElementById("srcComboDiv"));destSelect=new ComboBox("destSelect",document.getElementById("destComboDiv"));adultSelect=new ComboBox("adultSelect",document.getElementById("adultComboDiv"));childSelect=new ComboBox("childSelect",document.getElementById("childComboDiv"));infantSelect=new ComboBox("infantSelect",document.getElementById("infantComboDiv"));classSelect=new ComboBox("classSelect",document.getElementById("classComboDiv"));var c=ibibo.travel.airport_codes;var a=new Array();var e=location.href;if(e.indexOf("international")!="-1"){}else{for(var b=0;b<c.length;b++){srcSelect.add(new ComboBoxItem(c[b].toString().split(",")[0],b));destSelect.add(new ComboBoxItem(c[b].toString().split(",")[0],b))}}b=0;for(var b=0;b<6;b++){childSelect.add(new ComboBoxItem(b.toString(),b));infantSelect.add(new ComboBoxItem(b.toString(),b));if(b>0){adultSelect.add(new ComboBoxItem(b.toString(),b))}}classSelect.add(new ComboBoxItem("Economy","Economy"));classSelect.add(new ComboBoxItem("Business","Business"))}};ibibo.travel.ui._Controller=function(a){this.resultPane=null;this.toolbar=null};ibibo.travel.ui._Controller.prototype={initUI:function(){try{d=DateTimeShortcuts.init();this.createComboBoxes();DateTimeShortcuts.openCalendar(0);DateTimeShortcuts.openCalendar(1);this.switchToHomeView(true);if(document.getElementById("searchfor").value=="bus"){this.searchForm.setBusFormValues(false)}else{if(document.getElementById("searchfor").value=="hotels"){this.searchForm.setHotelFormValues(false)}else{this.searchForm.setFormValues(false)}}this.searchForm.setupTravelMode();var c=new Date(new Date().getTime()+(1000*60*60*24));this.cookieexpires=c;var a=document.location.href;qString+="-"+formValues.travellerClass1+"-"+formValues.travellerClass2+"-"+formValues.travellerClass3+"-"+tclass;return qString}catch(b){return null}},getNameFromCode:function(g,e,c){if(!g){return null}var b=g.toLowerCase();for(var f=e.length-1;f>=0;f--){if(e[f][1].toLowerCase()==b){if(c){var a=[];a.push(e[f][0]);a.push(f);return a}else{return e[f][0]}}}return[g,g]},switchToHomeView:function(b){var f=this;if(this.viewmode=="home"){return}this.stopSearch();var e=null;if(this.resultPane){this.resultPane.reset()}if(!this.homeForm){this.homeForm=this.searchForm=new ibibo.travel.ui.SearchFrom({handler:function(){f.startSearch()},id:"main-search-box",isLanding:true});this.searchForm.initUI()}else{this.searchForm=this.homeForm}var a=null;try{a=e.searchfor}catch(c){}if(!a){a="air"}this.viewmode="home"},convertToQueryString:function(c){try{var n="";n+=c.searchfor;var m="";if(c.searchfor!="hotels"){if(c.searchfor=="bus"){m=c.srcData[0].split(",")[0]}else{if(c.srcData){m=c.srcData[1]}}n+="-"+m;m=""}var m="";if(c.destData&&c.searchfor!="hotels"){if(c.searchfor=="bus"){m=c.destData[1]}else{m=c.destData[1]}}else{if(c.searchfor=="hotels"){m=c.destData[1]}}n+="-"+m;m="";if(c.dep_dt){var f=c.dep_dt.split("-");m=f[2]+f[1]+f[0]}n+="-"+m;m="";if(c.arr_dt&&(c.searchfor=="hotels"||c.travelmode=="twoway")){var f=c.arr_dt.split("-");m=f[2]+f[1]+f[0]}n+="-"+m;if(c.searchfor=="bus"){n+="-1-0-0-"}else{if(c.searchfor=="hotels"){m="";if(c.rooms){rooms=c.rooms;m=rooms}n+="-"+m;if(rooms>0){for(var b=1;b<=rooms;b++){m="";var h="strAdultsRoom"+b;var p="strChildrenRoom"+b;m=document.getElementById(h).value;child=document.getElementById(p).value;m+="_"+child;for(var a=1;a<=child;a++){var l="strAgeChild"+a+"Room"+b;age=document.getElementById(l).value;m+="_"+age}n+="-"+m}}}else{var k="";if(c.travelclass=="business"){k="B"}else{k="E"}n+="-"+c.travellerClass1+"-"+c.travellerClass2+"-"+c.travellerClass3+"-"+k}}return n}catch(g){return null}},searchClick:function(b){var a=null;if(!(b instanceof Array)){a=this.extractFormValues(b)}else{a=b}if(!a){return}if(a.searchfor=="bus"){this.searchForm.setBusFormValues(a)}else{if(a.searchfor=="hotels"){this.searchForm.setHotelFormValues(a)}else{this.searchForm.setFormValues(a)}}this.startSearch()},getCookie:function getCookie(a){if(document.cookie.length>0){c_start=document.cookie.indexOf(a+"=");if(c_start!=-1){c_start=c_start+a.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return""},setCookie:function(b,c,a){var e=new Date();e.setDate(e.getDate()+a);document.cookie=b+"="+escape(c)+((a==null)?"":";expires="+e.toUTCString())+";path=/"},startSearch:function(f){if(this.searchForm&&!this.searchForm.validate()){return}this.formValues=this.searchForm.getFormValues();queryString=this.convertToQueryString(this.formValues);try{if(this.formValues.searchfor=="bus"){this.setCookie("queryall",queryString,100)}else{if(this.formValues.searchfor=="hotels"){this.setCookie("queryhotel",queryString,100)}else{if(location.href.indexOf("international")!="-1"){try{var a=this.formValues.srcData[0]+"-"+this.formValues.destData[0];this.setCookie("intercitydetails",a,100)}catch(h){}this.setCookie("queryinter",queryString,100)}else{this.setCookie("query",queryString,100)}}}}catch(h){}formObj=document.getElementById("commentForm");if(this.formValues.searchfor=="bus"){formObj.method="POST";formObj.action="/bus-searchresult/#"+queryString;formObj.submit()}else{if(this.formValues.searchfor=="hotels"){formObj.method="POST";formObj.action="/hotels/hotel-searchresult/"+queryString;setTimeout("formObj.submit();",50)}else{formObj.method="POST";formObj.action="/flight-searchresult/#"+queryString;var b="/flight-searchresult/#"+queryString;if(window.location.pathname=="/searchwidget/"||window.location.pathname=="/searchwidget2/"||window.location.pathname=="/searchwidget160x600/"){try{var c=document.getElementById("clicktag").value}catch(h){var c=""}formObj.action=c+"http://goibibo.ibibo.com"+b;var g=window.open(formObj.action,"GoibiboResults")}else{formObj.submit()}}}},stopSearch:function(){if(this.resultPane){this.resultPane.stopSearch()}},createComboBoxes:function(){if(document.getElementById("searchfor").value!="hotels"){srcSelect=new ComboBox("srcSelect",document.getElementById("srcComboDiv"))}destSelect=new ComboBox("destSelect",document.getElementById("destComboDiv"));if(document.getElementById("searchfor").value=="bus"){var a=ibibo.travel.city_codes;for(var e=0;e<a.length;e++){srcSelect.add(new ComboBoxItem(a[e][1],e));destSelect.add(new ComboBoxItem(a[e][1],e))}}else{if(document.getElementById("searchfor").value=="hotels"){var f=ibibo.travel.hotel_city;for(var e=0;e<f.length;e++){var c=f[e][1];destSelect.add(new ComboBoxItem(c,e))}roomChange()}else{adultSelect=new ComboBox("adultSelect",document.getElementById("adultComboDiv"));childSelect=new ComboBox("childSelect",document.getElementById("childComboDiv"));infantSelect=new ComboBox("infantSelect",document.getElementById("infantComboDiv"));classSelect=new ComboBox("classSelect",document.getElementById("classComboDiv"));var g=ibibo.travel.airport_codes;var b=new Array();var h=location.href;if(h.indexOf("international")!="-1"){for(var e=0;e<g.length;e++){srcSelect.add(new ComboBoxItem(g[e].toString().split(",")[0],e))}}else{for(var e=0;e<g.length;e++){srcSelect.add(new ComboBoxItem(g[e].toString().split(",")[0],e));destSelect.add(new ComboBoxItem(g[e].toString().split(",")[0],e))}}e=0;for(var e=0;e<6;e++){childSelect.add(new ComboBoxItem(e.toString(),e));infantSelect.add(new ComboBoxItem(e.toString(),e))}for(var e=1;e<10;e++){adultSelect.add(new ComboBoxItem(e.toString(),e))}classSelect.add(new ComboBoxItem("Economy","economy"));adultSelect.build(adultSelect.options);childSelect.build(childSelect.options);classSelect.build(classSelect.options)}}if(document.getElementById("searchfor").value!="hotels"){srcSelect.build(srcSelect.options)}destSelect.build(destSelect.options)}};ibibo.travel.renderUI=function(){ibibo.travel.ui.Controller.initUI()};ibibo.travel.ui.Controller=new ibibo.travel.ui._Controller();ibibo.travel.ui.isLoaded=false;ibibo.travel.ui.onload=function(){if(!ibibo.travel.ui.isLoaded){ibibo.travel.renderUI()}ibibo.travel.util.loadGA();ibibo.travel.ui.isLoaded=true};
