var farematrix=null;var isReturn=false;var NUM_CENTYEAR=30;var BUL_TIMECOMPONENT=false;var BUL_YEARSCROLL=true;var calendars=[];var RE_NUM=/^\-?\d+$/;var monthAry=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var ARR_MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];var ARR_WEEKDAYS=["Sun","Mon","Tue","Wed","Thur","Fri","Sat"];var NUM_WEEKSTART=0;var currDate;var dt_current;var passedDate;var depdate;var dt_firstday;var curday;var curmon;year_scroll=BUL_YEARSCROLL;var sysDate="";var targetDisplayCol="";var targetDisplayColHidden="";var mflag=0;var ctflag=0;var airlineCode="ALL";var sortedFareMatrix=null;var lowestfaremonth=0;var rm=new Object();rm.tiptriptype="If you are facing problem to find your desider airport tou can use airport link to find nearest airport to your destination through maps.";rm.farecalanderoneway="The best fares found by MakeMyTrip users are for depatures are displayed for one year.You can change airline to find best fare found for that airline.";rm.farecalanderreturn="The best fares found by MakeMyTrip users are for depatures are displayed for one year.You can change airline to find best fare found for that airline.";rm.firstNameEmpty="First name of {paxdetails} cannot be empty";rm.lastNameEmpty="Last name of {paxdetails} cannot be empty";rm.email="Please enter valid email address";rm.phone="Please enter valid telephone number in the format of +91123456789";rm.title="Please select valid title of {paxdetails}";rm.bank="Please select valid title of {paxdetails}";rm.nameoncard="Name on card can not be empty";rm.cardtype="Name on card can not be empty";rm.cardnumber="Name on card can not be empty";rm.expirydate="Name on card can not be empty";rm.cvvnum="Name on card can not be empty";rm.billaddfname="Name on card can not be empty";rm.billaddmname="Name on card can not be empty";rm.billaddlname="Name on card can not be empty";rm.billaddr1="Name on card can not be empty";rm.billaddr2="Name on card can not be empty";rm.billaddrcity="Name on card can not be empty";rm.billaddrregion="Name on card can not be empty";rm.billaddrpincode="Name on card can not be empty";function resetHeading(C){$(".ui-accordion-content").hide();var A=".ui-accordion-content:eq("+C+")";$(A).show();var E=$(".ui-accordion-content");for(var D=0;D<E.length;D++){var H=document.getElementById("departure_"+D).value;var B=document.getElementById("arrival_"+D).value;var G=document.getElementById("dFrom_"+D).value;G=parseDate(G,"dd/MM/yyyy");G=formatDate(new Date(G),"dd NNN");if(H==""||B==""||G==""){}else{var F="<span>"+getAirportCode(H)+"-"+getAirportCode(B)+"&nbsp;&nbsp;"+G+"</span>";document.getElementById("heading"+D).innerHTML=F;}}}function getAirportCode(B){var C=B.indexOf(",");var D=B.indexOf("-");var A=B.indexOf("(");var E=B.indexOf(")");return B.substr(A+1,3);}function toggleAdditionOptions(){if($("#toggleAdditionOptions").hasClass("closedadditionaloptions")){$("#toggleAdditionOptions").removeClass("closedadditionaloptions");$("#toggleAdditionOptions").addClass("openedadditionaloptions");document.getElementById("additionoptions").style.display="block";}else{$("#toggleAdditionOptions").removeClass("openedadditionaloptions");$("#toggleAdditionOptions").addClass("closedadditionaloptions");document.getElementById("additionoptions").style.display="none";}}function selectAirport(A){document.forms[0].field.value=A;document.forms[0]._eventId.value="searchAirport";document.forms[0].submit();}function addflight(){document.forms[0]._eventId.value="addNewFlight";var url=document.forms[0].action;url=url+"&ajaxSource=true";var params=$("form").serialize();$.post(url,params,function(data){$("form").parent().get(0).innerHTML=data;eval($("#script").children("script").html());});}function changeTripType(){$("#fareCalHeader").hide();$("#fareCalBody").hide();$("#farecalanderborder").hide();$("#heroshot").show();try{getFareHistory();}catch(B){}var C;for(var A=0;A<document.forms[0].tt.length;A++){if(document.forms[0].tt[A].checked){C=document.forms[0].tt[A].value;}}if(C=="O"){document.getElementById('flexiSearchCheck').checked=false;setFlexiSearch();$(".itinerary").show();$(".ui-accordion-header").hide();$(".ui-accordion-content").hide();$(".ui-accordion-content:eq(0)").show();$(".returnSeg").hide();$("#depRangeCheck").show();}if(C=="R"){$(".itinerary").show();$(".ui-accordion-header").hide();$(".ui-accordion-content").hide();$(".ui-accordion-content:eq(0)").show();$(".returnSeg").show();$("#depRangeCheck").show();}if(C=="M"){document.getElementById('flexiSearchCheck').checked=false;setFlexiSearch();$(".itinerary").show();$(".ui-accordion-header").show();$(".returnSeg").hide();$(".ui-accordion-content").hide();$(".ui-accordion-content:eq(0)").show();$("#addFlight").show();$("#depRangeCheck").hide();}}function Set_Cookie(C,E,A,H,D,G){var B=new Date();B.setTime(B.getTime());if(A){A=A*1000*60*60*24;}var F=new Date(B.getTime()+(A));document.cookie=C+"="+escape(E)+((A)?";expires="+F.toGMTString():"")+((H)?";path="+H:"")+((D)?";domain="+D:"")+((G)?";secure":"");}function Get_Cookie(A){var F=document.cookie.split(";");var B="";var D="";var E="";var C=false;for(i=0;i<F.length;i++){B=F[i].split("=");D=B[0].replace(/^\s+|\s+$/g,"");if(D==A){C=true;if(B.length>1){E=unescape(B[1].replace(/^\s+|\s+$/g,""));}return E;break;}B=null;D="";}if(!C){return null;}}function Delete_Cookie(A,C,B){if(Get_Cookie(A)){document.cookie=A+"="+((C)?";path="+C:"")+((B)?";domain="+B:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT";}}function submitHomePage(){if(validateSearchCriteria()){document.forms[0].action="http://cheapfaresindia.makemytrip.com/international/international/direct";var A=document.forms[0].uniqueid.value;var B=new Date();B.setTime(B.getTime());if(Get_Cookie("userbehavior")){var C=Get_Cookie("userbehavior");C="@Search."+B.getTime()+":"+A;Delete_Cookie("userbehavior","/","");Set_Cookie("userbehavior",C,"30","/","","");}else{var C=B.getTime()+":"+A;Set_Cookie("userbehavior",C,"30","/","","");}Delete_Cookie("countdowntime","/","");document.forms[0].submit();}}function findPosX(A){var B=0;if(A.offsetParent){while(A.offsetParent){B+=A.offsetLeft;A=A.offsetParent;}}else{if(A.x){B+=A.x;}}return B;}function findPosY(B){var A=0;if(B.offsetParent){while(B.offsetParent){A+=B.offsetTop;B=B.offsetParent;}}else{if(B.y){A+=B.y;}}return A;}function getFareHistory(){setTimeout("getFareHistorySelected()",500);}function getFareHistorySelected(){var triptype="O";for(var i=0;i<document.forms[0].tt.length;i++){if(document.forms[0].tt[i].checked){triptype=document.forms[0].tt[i].value;}}if(triptype=="M"){$("#fareCalHeader").hide();$("#fareCalBody").hide();$("#farecalanderborder").hide();$("#heroshot").show();return ;}var fromCity=document.getElementById("departure_0").value;if(fromCity==""){return ;}var fromCityCode=fromCity.substr(fromCity.length-4,3);var arrCity=document.getElementById("arrival_0").value;if(arrCity==""){return ;}var arrCityCode=arrCity.substr(arrCity.length-4,3);sortedFareMatrix=null;var url="/intfarehistory.php?from="+fromCityCode+"&to="+arrCityCode+"&recentDate=today&triptype="+triptype;jQuery.ajax({url:url,success:function(data){try{eval("var farehistory="+data);farematrix=farehistory.data;var lowestAvailableDepart=null;var currentdatevalue=new Date().getTime();var noofdays=2;currentdatevalue=currentdatevalue+(noofdays>0?(60*60*(24*2)*1000):0);var newDate=new Date(currentdatevalue);lowestAvailableDepart=formatDate(newDate,"dd/MM/yyyy");var airlinecode={};for(var i=0;i<farehistory.data.length;i++){var fareObject=farehistory.data[i];var createdDate=fareObject.created;if(sortedFareMatrix==null){sortedFareMatrix={};}if(sortedFareMatrix[fareObject.departure]==null){var lowestPrice=0;$.each(fareObject,function(i,val){if(i=="from"||i=="to"||i=="departure"||i=="return"||i=="created"||i=="triptype"){}else{if(lowestPrice==0){lowestPrice=val;}else{if(lowestPrice>val){lowestPrice=val;}}airlinecode[i]=i;}});if(lowestAvailableDepart==null){lowestAvailableDepart=fareObject.departure;}else{var diff=compareDates(lowestAvailableDepart,"dd/MM/yyyy",fareObject.departure,"dd/MM/yyyy");if(diff==1){lowestAvailableDepart=fareObject.departure;}}sortedFareMatrix[fareObject.departure]={fareObject:fareObject,lowestfare:lowestPrice};}else{if(createdDate<sortedFareMatrix[fareObject.departure]["fareObject"]["created"]){var lowestPrice=0;$.each(fareObject,function(i,val){if(i=="from"||i=="to"||i=="departure"||i=="return"||i=="created"||i=="triptype"){}else{if(lowestPrice==0){lowestPrice=val;}else{if(lowestPrice>val){lowestPrice=val;}}airlinecode[i]=i;}});if(lowestAvailableDepart==null){lowestAvailableDepart=fareObject.departure;}else{var diff=compareDates(lowestAvailableDepart,"dd/MM/yyyy",fareObject.departure,"dd/MM/yyyy");if(diff==1){lowestAvailableDepart=fareObject.departure;}}sortedFareMatrix[fareObject.departure]={fareObject:fareObject,lowestfare:lowestPrice};}}}var airlineSelect="<select id='fareCalAirline' onchange='changeAirline(this)'><option value='ALL'>ALL</option>";$.each(airlinecode,function(i,val){airlineSelect=airlineSelect+"<option value='"+val+"'>"+val+"</option>";});airlineSelect=airlineSelect+"</select>";initDate(lowestAvailableDepart);airlineCode="ALL";var caldata="<table class='cal-nav' width='100%'><tr><th align='center' id='fareCalanderCityHeader'>"+fromCityCode+"-"+arrCityCode+"<input name='from' type='hidden' id='from' value='"+fromCity+"'/><input name='to' id='to' type='hidden' value='"+arrCity+"'/></th><th align='center' id='months'></th><th align='center' id='fareCalanderairlineHeader'>Airline:"+airlineSelect+"</th></tr></table>";if(triptype=="R"){caldata=caldata+"Note:Dates show below fare is the return date for that particular depature";}$("#fareCalHeader").html(caldata);displayCalendar();$("#heroshot").hide();$("#fareCalHeader").show();$("#fareCalBody").show();$("#farecalanderborder").show();if(triptype=="O"){$("#farecalanderhelp").bt(rm.farecalanderoneway,{titleSelector:"attr('href')",fill:"#FFFF99",cssStyles:{color:"black",fontWeight:"normal",width:"auto"},width:300,padding:10,cornerRadius:10,animate:false,spikeLength:15,spikeGirth:5,positions:["top","left"]});}else{$("#farecalanderhelp").bt(rm.farecalanderreturn,{titleSelector:"attr('href')",fill:"#FFFF99",cssStyles:{color:"black",fontWeight:"normal",width:"auto"},width:300,padding:10,cornerRadius:10,animate:false,spikeLength:15,spikeGirth:5,positions:["top","left"]});}}catch(e){}},error:function(textStatus,errorThrown){}});}function initDate(C){var B=0;var F="";if(C.indexOf("-")!=-1){F=C.split("-");}else{if(C.indexOf("/")!=-1){F=C.split("/");}}var E=new Date(F[2],Number(F[1])-1,F[0]);E=E.valueOf()+(B>0?(60*60*(24*B)*1000):0);var D=new Date().getTime();if(D>E){B=2;E=D+(B>0?(60*60*(24*B)*1000):0);}sysDate=new Date(E);currDate=new Date(sysDate);var A=currDate.valueOf()+((60*60*(24*0)*1000));currDate=new Date(A);dt_current=new Date(currDate);dt_firstday=new Date(dt_current);dt_firstday.setDate(1);dt_firstday.setDate(1-(7+dt_firstday.getDay()-NUM_WEEKSTART)%7);curday=currDate.getDate();curmon=currDate.getMonth();dt_current=new Date(currDate);dt_firstday=new Date(dt_current);dt_firstday.setDate(1);dt_firstday.setDate(1-(7+dt_firstday.getDay()-NUM_WEEKSTART)%7);curday=currDate.getDate();curmon=currDate.getMonth();passedDate=new Date(sysDate);}function getmontharray(){var A=currDate;var H=new Array();var E=new Array();var B=A.getMonth();var C=A.getFullYear();var D=0;for(var G=0;G<12;G++){H[G]=monthAry[B++];E[G]=C;if(B>=12){B=B-12;if(D==0){C=C+1;D++;}}}var I="<ul class='cal-m'>";for(var F=0;F<12;F++){if(H[F]==monthAry[dt_current.getMonth()]){I=I+'<li><a class="selected" href="javascript:changemonth(\''+H[F]+"','"+E[F]+"')\">"+H[F]+"</a></li>";}else{I=I+"<li><a href=\"javascript:changemonth('"+H[F]+"','"+E[F]+"')\">"+H[F]+"</a></li>";}}I=I+"</ul>";}function displayCalendar(){var L="";L=L+"<div>Note:&nbsp;This calendar displays the best fares found by other MakeMyTrip users over the past. Due to rapidly changing airline prices & seat availability, these fares may no longer be available.</div>";L=L+"<div>&nbsp</div>";var C=0;var I=0;lowestfaremonth=0;var E=currDate.getFullYear()+""+(Number(currDate.getMonth())<=9?"0"+currDate.getMonth():currDate.getMonth())+""+(Number(currDate.getDate())<=9?"0"+currDate.getDate():currDate.getDate());var G="<a href=javascript:set_newdate('prev_month','limited')><img src='/international/img/international/page-prev.gif' width='12' height='15' align='absmiddle' alt='back' border='0'/></a>&nbsp;";G=G+ARR_MONTHS[dt_current.getMonth()]+" "+dt_current.getFullYear();G=G+"&nbsp;<a href=javascript:set_newdate('next_month','limited')><img src='/international/img/international/page-next.gif' width='12' height='15' align='absmiddle' alt='forward' border='0'/></a>";$("#months").html(G);L=L+"<table class='cal-d' width='100%' class='fareCalander'  cellspacing='0' cellpadding='0' style='border:1px outset #A8C2FF'>";L=L+'<tr style="background-color: #EBF7FE;">';for(var M=0;M<7;M++){if(M==0||M==6){L=L+"<th scope='col' width=60 style='border:none;color:blue;background-color:#A8C2FF'>"+ARR_WEEKDAYS[(NUM_WEEKSTART+M)%7]+"</th>";}else{L=L+"<th scope='col' width=60 style='border:none;color:blue;background-color:#A8C2FF'>"+ARR_WEEKDAYS[(NUM_WEEKSTART+M)%7]+"</th>";}}L=L+"</tr>";var O=new Date(dt_firstday);var A=passedDate.getFullYear()+""+(Number(passedDate.getMonth())<=9?"0"+passedDate.getMonth():passedDate.getMonth())+""+(Number(passedDate.getDate())<=9?"0"+passedDate.getDate():passedDate.getDate());var P=0;while(O.getMonth()==dt_current.getMonth()||O.getMonth()==dt_firstday.getMonth()){L=L+'<tr style="background-color: #EBF7FE;">';for(var F=0;F<7;F++){C=O.getFullYear()+""+(Number(O.getMonth())<=9?"0"+O.getMonth():O.getMonth())+""+(Number(O.getDate())<=9?"0"+O.getDate():O.getDate());if(F==0){if(P==0){L=L+"<td width='60' height='50' style='border-left:1px solid gray;border-bottom:1px solid gray;border-top:1px solid gray;background-color:#D9E4FF' valign='top'>";}else{L=L+"<td width='60' height='50' style='border-left:1px solid gray;border-bottom:1px solid gray;background-color:#D9E4FF' valign='top'>";}}else{if(F==6){if(P==0){L=L+"<td width='60' height='50' style='border-left:1px solid gray;border-right:1px solid gray;border-bottom:1px solid gray;border-top:1px solid gray;background-color:#D9E4FF' valign='top'>";}else{L=L+"<td width='60' height='50' style='border-left:1px solid gray;border-right:1px solid gray;border-bottom:1px solid gray;background-color:#D9E4FF' valign='top'>";}}else{if(P==0){L=L+"<td width='60' height='50' style='border-left:1px solid gray;border-bottom:1px solid gray;border-top:1px solid gray;background-color:white' valign='top'>";}else{L=L+"<td width='60' height='50' style='border-left:1px solid gray;border-bottom:1px solid gray;background-color:white' valign='top'>";}}}if(O.getMonth()==curmon){if(C>E){if(C==A){L=L+"<a class='selected' title='"+ARR_MONTHS[passedDate.getMonth()]+" "+passedDate.getDate()+"'>";}else{L=L+"<a>";}}else{if(C==E){L=L+"<a class='today' title='"+ARR_MONTHS[currDate.getMonth()]+" "+currDate.getDate()+"'>";}else{L=L+"<a class='n-a'>";}}}else{if(C>E){if(C==A){L=L+"<a class='selected' title='"+ARR_MONTHS[passedDate.getMonth()]+" "+passedDate.getDate()+"'>";}else{L=L+"<a>";}}else{L=L+"<a class='n-a'>";}}if(O.getMonth()==dt_current.getMonth()){var R="";if(O.getDate()<10){R=R+"0"+O.getDate();}else{R=R+O.getDate();}if((O.getMonth()+1)<10){R=R+"/0"+(O.getMonth()+1);}else{R=R+"/"+(O.getMonth()+1);}R=R+"/"+O.getFullYear();if(C>E){}else{R="";}if(airlineCode=="ALL"){if(sortedFareMatrix[R]==null||sortedFareMatrix[R]["lowestfare"]==0){L=L+"<span style='color:black'>"+O.getDate()+"</span></a><br/></td>";}else{var H=sortedFareMatrix[R]["fareObject"]["created"];var D=H/1000;var B=parseInt(D/3600);D=D-B*3600;var J=parseInt(D/60);D=D-J*60;var K="";if(sortedFareMatrix[R]["fareObject"]["return"]==""){}else{var Q=$.datepicker.parseDate("dd/mm/yy",sortedFareMatrix[R]["fareObject"]["return"]);K=$.datepicker.formatDate("dd M",Q);}L=L+"<span style='color:black' class='"+sortedFareMatrix[R]["lowestfare"]+"'>"+O.getDate()+"</span></a><br/><br/>&nbsp;&nbsp;<a href='javascript:selectDate(\""+R+'","'+sortedFareMatrix[R]["fareObject"]["return"]+"\")'><span style='font-size:9px;font-family:Arial'>"+formatCurrency(sortedFareMatrix[R]["lowestfare"])+"</span></a>";if(K==""){L=L+"</td>";}else{L=L+"<div align='right'>"+K+"</div></td>";}if(lowestfaremonth==0){lowestfaremonth=sortedFareMatrix[R]["lowestfare"];}else{if(lowestfaremonth>sortedFareMatrix[R]["lowestfare"]){lowestfaremonth=sortedFareMatrix[R]["lowestfare"];}}}}else{if(sortedFareMatrix[R]==null||sortedFareMatrix[R]["lowestfare"]==0){L=L+"<span style='color:black'>"+O.getDate()+"</span></a><br/></td>";}else{if(sortedFareMatrix[R]["fareObject"][airlineCode]==null){L=L+"<span style='color:black'>"+O.getDate()+"</span></a><br/></td>";}else{var H=sortedFareMatrix[R]["fareObject"]["created"];var D=H/1000;var B=parseInt(D/3600);D=D-B*3600;var J=parseInt(D/60);D=D-J*60;var K="";if(sortedFareMatrix[R]["fareObject"]["return"]==""){}else{var Q=$.datepicker.parseDate("dd/mm/yy",sortedFareMatrix[R]["fareObject"]["return"]);K=$.datepicker.formatDate("dd M",Q);}L=L+"<span style='color:black' class='"+sortedFareMatrix[R]["fareObject"][airlineCode]+"'>"+O.getDate()+"</span></a><br/><br/>&nbsp;&nbsp;<a href='javascript:selectDate(\""+R+'","'+sortedFareMatrix[R]["fareObject"]["return"]+"\")'><span style='font-size:9px;font-family:Arial'>"+formatCurrency(sortedFareMatrix[R]["fareObject"][airlineCode])+"</span></a>";if(K==""){L=L+"</td>";}else{L=L+"<div align='right'>"+K+"</div></td>";}if(lowestfaremonth==0){lowestfaremonth=sortedFareMatrix[R]["fareObject"][airlineCode];}else{if(lowestfaremonth>sortedFareMatrix[R]["fareObject"][airlineCode]){lowestfaremonth=sortedFareMatrix[R]["fareObject"][airlineCode];}}}}}}else{if(C>E){L=L+"<font style='color:#cccccc;'>"+O.getDate()+"</font></a></td>";}}O.setDate(O.getDate()+1);}L=L+"</tr>";P++;}L=L+"</table>";L=L+'<div align="left"><table><tr><td width="5px" style="background-color:#FFFF66;border:1px outset gray;"></td><td style="font-size:10px;font-family:Arial">Shows lowest fare for the month.</td></tr></table></div>';L=L+'<div align="right"><span  id="farecalanderhelp">Help<img src="/international/img/international/icon-question.gif" width="15" height="15"/></span></div>';$("#fareCalBody").html(L);var N="span."+lowestfaremonth;$(N).each(function(){var S=$(this).parent().get(0);S=$(S).parent().get(0);$(S).css("background-color","#FFFF66");});}function set_newdate(A,E){var D=currDate.getFullYear()+""+(Number(currDate.getMonth())<=9?"0"+currDate.getMonth():currDate.getMonth());var B=0;if(A=="next_month"){B=dt_current.getFullYear()+""+((Number(dt_current.getMonth())+1)<=9?"0"+(dt_current.getMonth()+1):(dt_current.getMonth()+1));}else{if(A=="next_year"){B=(dt_current.getFullYear()+1)+""+(Number(dt_current.getMonth())<=9?"0"+dt_current.getMonth():dt_current.getMonth());}else{if(A=="next_5year"){B=(dt_current.getFullYear()+5)+""+(Number(dt_current.getMonth())<=9?"0"+dt_current.getMonth():dt_current.getMonth());}}}if(A=="prev_month"){B=dt_current.getFullYear()+""+((Number(dt_current.getMonth())-1)<=9?"0"+(dt_current.getMonth()-1):(dt_current.getMonth()-1));}else{if(A=="prev_year"){B=(dt_current.getFullYear()-1)+""+(Number(dt_current.getMonth())<=9?"0"+dt_current.getMonth():dt_current.getMonth());}else{if(A=="prev_5year"){B=(dt_current.getFullYear()-5)+""+(Number(dt_current.getMonth())<=9?"0"+dt_current.getMonth():dt_current.getMonth());}}}if((ctflag==0)||((ctflag==1)&&(B<=D))||((ctflag==2)&&(B>=D))){var F=new Date(dt_current);var C=new Date(currDate);if(E=="limited"){C.setMonth(C.getMonth()+11);}if(A=="prev_month"){if(E=="limited"){F.setMonth(F.getMonth()-1);if(Number(F.getFullYear()+""+(F.getMonth()<=9?"0"+F.getMonth():F.getMonth()))<D){F=new Date(C);}}else{F.setMonth(F.getMonth()-1);}}else{if(A=="prev_5year"){F.setFullYear(F.getFullYear()-5);}else{if(A=="prev_year"){F.setFullYear(F.getFullYear()-1);}else{if(A=="next_month"){if(E=="limited"){F.setMonth(F.getMonth()+1);if(Number(F.getFullYear()+""+(F.getMonth()<=9?"0"+F.getMonth():F.getMonth()))>Number(C.getFullYear()+""+(C.getMonth()<=9?"0"+C.getMonth():C.getMonth()))){F=new Date(currDate);}}else{F.setMonth(F.getMonth()+1);}}}}}}else{if(A=="next_5year"){F.setFullYear(F.getFullYear()+5);}else{if(A=="next_year"){F.setFullYear(F.getFullYear()+1);}}}setnewDate(F);}function setnewDate(A){var B=new Date(A);dt_current=B;dt_firstday=new Date(dt_current);dt_firstday.setDate(1);dt_firstday.setDate(1-(7+dt_firstday.getDay()-NUM_WEEKSTART)%7);curday=currDate.getDate();curmon=currDate.getMonth();set_datetime(B.valueOf());}function set_datetime(A,B){var C=new Date(A);displayCalendar();}function formatCurrency(A,C){A=A.toString().replace(/\$|\,/g,"");if(isNaN(A)){A="0";}sign=(A==(A=Math.abs(A)));A=Math.floor(A*100+0.50000000001);cents=A%100;A=Math.floor(A/100).toString();if(cents<10){cents="0"+cents;}for(var B=0;B<Math.floor((A.length-(1+B))/3);B++){A=A.substring(0,A.length-(4*B+3))+","+A.substring(A.length-(4*B+3));}if(C==null){return(((sign)?"":"-")+"Rs."+A);}else{return(((sign)?"":"-")+C+" "+A);}}function selectDate(D,C){var B="O";for(var A=0;A<document.forms[0].tripType.length;A++){if(document.forms[0].tripType[A].checked){B=document.forms[0].tripType[A].value;}}document.getElementById("departure_0").value=document.getElementById("from").value;document.getElementById("arrival_0").value=document.getElementById("to").value;document.getElementById("dFrom_0").value=D;if(B=="R"){document.getElementById("dTo_0").value=C;document.forms[0].tripType[0].checked=true;document.forms[0].tripType[1].checked=false;document.forms[0].tripType[2].checked=false;}else{if(B=="O"){document.forms[0].tripType[0].checked=false;document.forms[0].tripType[1].checked=true;document.forms[0].tripType[2].checked=false;}}submitHomePage();}function changeAirline(C){var A=C.selectedIndex;var B=C.options[C.selectedIndex].value;airlineCode=B;displayCalendar();}function validateSearchCriteria(){var P=true;var A="O";for(var G=0;G<document.forms[0].tt.length;G++){if(document.forms[0].tt[G].checked){A=document.forms[0].tt[G].value;}}if(A=="O"||A=="R"){var L=document.getElementById("departure_0").value;var M=document.getElementById("arrival_0").value;var N=getCountry(L);var F=getCountry(M);if(N=="Not Valid"){P=false;alert("Please select valid from city or airport code");}else{if(F=="Not Valid"){P=false;alert("Please select valid to city or airport code");}else{if(N=="India"&&F=="India"){turnOnModalAlert("<table height='100px'><tr><td style='padding-left:50px'>You are trying to book tickets within India if yes please click on continue else click on cancel to change your journey details.</td></tr></table>","http://www.makemytrip.co.in/makemytrip/flights.do");P=false;}}}}else{if(A=="M"){var D=$(".ui-accordion-content");var E=true;var I=true;var K=true;for(var G=0;G<D.length;G++){var O=document.getElementById("departure_"+G).value;var H=document.getElementById("arrival_"+G).value;if(O==""&&H==""){}else{I=false;var N=getCountry(O);var F=getCountry(H);if(N=="India"&&F=="India"){}else{E=false;if(N=="Not Valid"||F=="Not Valid"){}else{K=false;break;}}}}if(I){P=false;alert("Please enter valid from and to city.");}if(K){P=false;alert("Please enter valid from and to city.");}if(E){turnOnModalAlert("<table height='100px'><tr><td style='padding-left:50px'>You are trying to book tickets within India if yes please click on continue to go to www.makemytip.com else click on cancel to modify and search international flights.</td></tr></table>","http://www.makemytrip.co.in/makemytrip/flights.do");P=false;}}}if(P){var J=parseInt(document.forms[0].adt.value,10);var B=parseInt(document.forms[0].chd.value,10);var Q=parseInt(document.forms[0].inf.value,10);var C=J+B+Q;if(C>6){P=false;alert("Total number of travelers can not be more than 6.");}else{if(Q>J){P=false;alert("Number of infants can not be greater than adults");}}}return P;}function getCountry(A){var B=A.indexOf(",");var C=A.indexOf("-");if(B<0||C<0){return"Not Valid";}var D=A.substr(B+1,(C-B)-1);return D;}function turnOnModalAlert(B,A){createModalBox(B,A);}function createModalBox(C,A){if($("#alertcontent>*").length==0){$("#alertcontent").append(C);var B=document.createElement("ul");B.appendChild(createLi("Continue","continue",A,function(){turnOffModal();return true;}));B.appendChild(createLi("Cancel","cancel","#",function(){turnOffModal();return false;}));$("#buttonrow").append(B);}$("#confirm").jqm({overlay:80,modal:true,trigger:false});$("#confirm").jqmShow();}function createLi(E,F,D,C){var A=document.createElement("li");var B=A.appendChild(document.createElement("a"));B.appendChild(document.createTextNode(E));B.className="hrefbuttons";B.onclick=C;B.href=D;B.id=F;return A;}function turnOffModal(){$("#confirm").jqmHide();}(function(B){function A(){this.linenum=0;}B.extend(A.prototype,{init:function(){this.linenum=0;var D=document.createElement("div");var C=B(D);C.attr("id","weblogger");C.addClass("logger");B("#loggertext").append(C);B("#weblogger").addClass("logger");},debug:function(C){B("div.logger").append(this.linenum+":"+C+"<br/>");this.linenum++;},postweblog:function(){var D=B("div.logger").html();var C=document.forms[0].uniqueid.value;}});B.fn.logger=function(){B.logger.init();};B.logger=new A();})(jQuery);var persistclose=0;var startX=1000;if(screen.width==1152){startX=947;}else{if(screen.width==1024){startX=883;}else{if(screen.width==800){startX=720;}else{if(screen.width==1280){startX=1011;}}}}var startY=250;var verticalpos="fromtop";function iecompattest(){return(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;}function get_cookie(A){var B=A+"=";var C="";if(document.cookie.length>0){offset=document.cookie.indexOf(B);if(offset!=-1){offset+=B.length;end=document.cookie.indexOf(";",offset);if(end==-1){end=document.cookie.length;}C=unescape(document.cookie.substring(offset,end));}}return C;}function closebar(){if(persistclose){document.cookie="remainclosed=1";}document.getElementById("topbar").style.visibility="hidden";}function staticbar(){barheight=document.getElementById("topbar").offsetHeight;var A=(navigator.appName.indexOf("Netscape")!=-1)||window.opera;var B=document;function C(E){var D=B.getElementById(E);if(!persistclose||persistclose&&get_cookie("remainclosed")==""){D.style.visibility="visible";}if(B.layers){D.style=D;}D.sP=function(F,G){this.style.left=F+"px";this.style.top=G+"px";};D.x=startX;if(verticalpos=="fromtop"){D.y=startY;}else{D.y=A?pageYOffset+innerHeight:iecompattest().scrollTop+iecompattest().clientHeight;D.y-=startY;}return D;}window.stayTopLeft=function(){if(verticalpos=="fromtop"){var D=A?pageYOffset:iecompattest().scrollTop;ftlObj.y+=(D+startY-ftlObj.y)/8;}else{var D=A?pageYOffset+innerHeight-barheight:iecompattest().scrollTop+iecompattest().clientHeight-barheight;ftlObj.y+=(D-startY-ftlObj.y)/8;}ftlObj.sP(ftlObj.x,ftlObj.y);setTimeout("stayTopLeft()",10);};ftlObj=C("topbar");stayTopLeft();}function submitFeedback(){var D=document.getElementById("feedback_email").value;var C=document.getElementById("feedback_mobile").value;var F=document.getElementById("feedback_query").value;var A=$("form").serialize();var B=source;var E={from:D,phoneno:C,message:F,formparameters:A,source:B};$.post("/international/feedback",E);alert("Thank you for submitting your query. We will get back to you as soon as possible.");}
