
function getCookieValue (cookieName) {
  var exp = new RegExp (escape(cookieName) + "=([^;]+)");
  if (exp.test (document.cookie + ";")) {
    exp.exec (document.cookie + ";");
    return unescape(RegExp.$1);
  }
  else return false;
}
function writePersistentCookie (CookieName, CookieValue, periodType, offset) {

  var expireDate = new Date ();
  offset = offset / 1;
  
  var myPeriodType = periodType;
  switch (myPeriodType.toLowerCase()) {
    case "years": 
     var year = expireDate.getYear();     
     // Note some browsers give only the years since 1900, and some since 0.
     if (year < 1000) year = year + 1900;     
     expireDate.setYear(year + offset);
     break;
    case "months":
      expireDate.setMonth(expireDate.getMonth() + offset);
      break;
    case "days":
      expireDate.setDate(expireDate.getDate() + offset);
      break;
    case "hours":
      expireDate.setHours(expireDate.getHours() + offset);
      break;
    case "minutes":
      expireDate.setMinutes(expireDate.getMinutes() + offset);
      break;
    default:
      alert ("Invalid periodType parameter for writePersistentCookie()");
      break;
  } 
  
  document.cookie = escape(CookieName ) + "=" + escape(CookieValue) + "; expires=" + expireDate.toGMTString() + "; path=/";
}  
function statuspp()
{newwindow=window.open('http://www.flightstats.com/go/weblet?guid=c228b59beca1b817:1fb62a4f:11502c4a893:6b48&imageColor=black&language=English&weblet=status&action=display','flightstatus','scrollbars=yes,height=444,width=500');}
function goToURL(url){newWin=window.open(url,'_self');}
function goToURLnew(url){newWin=window.open(url,'_blank');}
function openViriSignPopup()
{myWindow=window.open('http://www.verisign.com/ssl/index.html?sl=t31290225400000002&gclid=CM7q9J_wrYsCFQmJTAodG1sROg','myWindow','menubar=no,width=800,height=700,toolbar=no,directories=no,resizable=no,scrollbars=no,location=no,status=yes');}
function prepopulate(){var orginTypeObj1=document.getElementById("selorigin")
var orginTypeIndex1=orginTypeObj1.selectedIndex;var orginType11=orginTypeObj1[orginTypeIndex1].value;var destinationTypeObj1=document.getElementById("seldestination")
var destinationTypeIndex1=destinationTypeObj1.selectedIndex;var destinationType11=destinationTypeObj1[destinationTypeIndex1].value;var noofAdults1=document.getElementById("selnoOfAdults")
var noofAdultsIndex1=noofAdults1.selectedIndex;var noofAdults11=noofAdults1[noofAdultsIndex1].value;var noOfChildren1=document.getElementById("selnoOfChildren")
var noOfChildrenIndex1=noOfChildren1.selectedIndex;var noOfChildren11=noOfChildren1[noOfChildrenIndex1].value;var noOfInfants1=document.getElementById("selnoOfInfants")
var noOfInfantsIndex1=noOfInfants1.selectedIndex;var noOfInfants11=noOfInfants1[noOfInfantsIndex1].value;var homeDepatureDate
var homeReturnDate;if(document.getElementById("txtdeptDateRtrip").value!=null){homeDepatureDate=document.getElementById("txtdeptDateRtrip").value}
if(document.getElementById("txtretnDateRtrip").value!=null){homeReturnDate=document.getElementById("txtretnDateRtrip").value}
if(document.getElementById("txtdeptDateOway").value!=null){homeDepatureDateOneWay=document.getElementById("txtdeptDateOway").value}
var homedepttime;var homeretntime;var homedepttimeoneway;if(document.getElementById("seldeptTimeRtrip").value!=null){homedepttime=document.getElementById("seldeptTimeRtrip").value}
if(document.getElementById("selretnTimeRtrip").value!=null){homeretntime=document.getElementById("selretnTimeRtrip").value}
if(document.getElementById("seldeptTimeOway").value!=null){homedepttimeoneway=document.getElementById("seldeptTimeOway").value}
var chkResidentValue=true;var exp1=true;var addOption=1;if(trip=='R'){document.location.href="http://www.makemytrip.com/flights?&hometripType="+trip+"&homeOriginCity="+orginType11+"&homeDestinationCity="+destinationType11+"&homeDepatureDate="+homeDepatureDate+"&homeReturnDate="+homeReturnDate+"&homenoofAdults="+noofAdults11+"&homenoOfChildren="+noOfChildren11+"&homenoOfInfants="+noOfInfants11+"&homedepttime="+homedepttime+"&homeretntime="+homeretntime+"&exp="+exp1+"&addOption="+addOption+"&chkResidentValue="+chkResidentValue;}
else if(trip=='O'){document.location.href="http://www.makemytrip.com/flights?&hometripType="+trip+"&homeOriginCity="+orginType11+"&homeDestinationCity="+destinationType11+"&homeDepatureDateOneWay="+homeDepatureDateOneWay+"&homenoofAdults="+noofAdults11+"&homenoOfChildren="+noOfChildren11+"&homenoOfInfants="+noOfInfants11+"&homedepttimeoneway="+homedepttimeoneway+"&exp="+exp1+"&addOption="+addOption+"&chkResidentValue="+chkResidentValue;}
else if(trip=='M'){document.location.href="http://www.makemytrip.com/flights?&hometripType="+trip+"&homeOriginCity="+orginType11+"&homeDestinationCity="+destinationType11+"&homeDepatureDate="+homeDepatureDate+"&homeReturnDate="+homeReturnDate+"&homenoofAdults="+noofAdults11+"&homenoOfChildren="+noOfChildren11+"&homenoOfInfants="+noOfInfants11+"&homedepttime="+homedepttime+"&homeretntime="+homeretntime+"&exp="+exp1+"&addOption="+addOption+"&chkResidentValue="+chkResidentValue;}}
var deptdate;var retndate;function fphSearchFormSubmit(){var levfrom=document.getElementById("selorigin").value
if(levfrom==null||levfrom=="")
{alert("Please select a leaving from city")
document.getElementById("selorigin").focus();return;}
var goingto=document.getElementById("seldestination").value
if(goingto==null||goingto=="")
{alert("Please select a going to city")
document.getElementById("seldestination").focus();return;}
for(var i=0;i<document.forms[0].radtripType.length;i++){if(document.forms[0].radtripType[i].checked){var rad_val=document.forms[0].radtripType[i].value;if(rad_val=="O"){deptdate=document.forms[0].txtdeptDateOway.value;retndate="";}else{deptdate=document.forms[0].txtdeptDateRtrip.value;retndate=document.forms[0].txtretnDateRtrip.value;}}}
document.forms[0].depdate.value=deptdate;document.forms[0].retndate.value=retndate;var validat_returnvalue=true;validat_returnvalue=homeValidateOriginDestination();if(validat_returnvalue){document.forms[0].action="http://flightplushotels.makemytrip.co.in/makemytrip/fphSearchProgress.do?searchFrom=flight&HotelName=&StarRating=All";document.forms[0].submit();}}
function showSectors(num){if(num>0){addSectors(num);}else{remSectors(num);}}
function addSectors(num){var nextNum=num+1;document.getElementById("addSec"+num).style.display="none";document.getElementById("sec"+num).style.display="block";document.getElementById("addSec"+nextNum).style.display="block";document.getElementById("seloriginSector"+num).focus();}
function remSectors(num){num=-num;var prevNum=num-1;document.getElementById("addSec"+num).style.display="block";document.getElementById("sec"+num).style.display="none";document.getElementById("seloriginSector"+num).value="0";document.getElementById("seldestinationSector"+num).value="0";document.getElementById("txtdeptDateSector"+num).value="DD/MM/YYYY";if(prevNum==1){document.getElementById("selorigin").focus();}else{document.getElementById("seloriginSector"+prevNum).focus();}}
function multicitySectorCheck(){var validat_returnvalue=true;if(document.forms[0].txtdeptDateMcity.value=="DD/MM/YYYY"||document.forms[0].txtdeptDateMcity.value==""){alert('Please select a departure date');document.getElementById('deptDateMcityimgExact').onclick();return false;}
var sector2Avail=checkSector("seloriginSector2","seldestinationSector2","txtdeptDateSector2");var sector3Avail=checkSector("seloriginSector3","seldestinationSector3","txtdeptDateSector3");var sector4Avail=checkSector("seloriginSector4","seldestinationSector4","txtdeptDateSector4");var sector5Avail=checkSector("seloriginSector5","seldestinationSector5","txtdeptDateSector5");if(document.getElementById("sec2").style.display=="none"){}else{if(sector2Avail==false){if(confirm("Click 'OK' to search for one sector only, 'Cancel' to specify more")){document.getElementById("seloriginSector2").value="0";document.getElementById("seldestinationSector2").value="0";document.getElementById("txtdeptDateSector2").value="DD/MM/YYYY";validat_returnvalue=true;}else{setSectorFocus("seloriginSector2","seldestinationSector2","txtdeptDateSector2",2);validat_returnvalue=false;}}else{if(document.getElementById("sec3").style.display=="none"){}else{if(sector3Avail==false){if(confirm("Click 'OK' to search for two sector only, 'Cancel' to specify more")){document.getElementById("seloriginSector3").value="0";document.getElementById("seldestinationSector3").value="0";document.getElementById("txtdeptDateSector3").value="DD/MM/YYYY";validat_returnvalue=true;}else{setSectorFocus("seloriginSector3","seldestinationSector3","txtdeptDateSector3",3);validat_returnvalue=false;}}else{if(document.getElementById("sec4").style.display=="none"){}else{if(sector4Avail==false){if(confirm("Click 'OK' to search for three sector only, 'Cancel' to specify more")){document.getElementById("seloriginSector4").value="0";document.getElementById("seldestinationSector4").value="0";document.getElementById("txtdeptDateSector4").value="DD/MM/YYYY";validat_returnvalue=true;}else{setSectorFocus("seloriginSector4","seldestinationSector4","txtdeptDateSector4",4);validat_returnvalue=false;}}else{if(document.getElementById("sec5").style.display=="none"){}else{if(sector5Avail==false){if(confirm("Click 'OK' to search for four sector only, 'Cancel' to specify more")){document.getElementById("seloriginSector5").value="0";document.getElementById("seldestinationSector5").value="0";document.getElementById("txtdeptDateSector5").value="DD/MM/YYYY";validat_returnvalue=true;}else{setSectorFocus("seloriginSector5","seldestinationSector5","txtdeptDateSector5",5);validat_returnvalue=false;}}}}}}}}}
if(validat_returnvalue==true){if(sector5Avail==true){if(dateValidationMulti(document.getElementById("txtdeptDateMcity").value,document.getElementById("txtdeptDateSector2").value)){if(dateValidationMulti(document.getElementById("txtdeptDateSector2").value,document.getElementById("txtdeptDateSector3").value)){if(dateValidationMulti(document.getElementById("txtdeptDateSector3").value,document.getElementById("txtdeptDateSector4").value)){if(dateValidationMulti(document.getElementById("txtdeptDateSector4").value,document.getElementById("txtdeptDateSector5").value)){validat_returnvalue=true;}else{alert("Sector 5 departure date must be greater than sector 4 departure date");document.getElementById("txtdeptDateSector5").focus();validat_returnvalue=false;}}else{alert("Sector 4 departure date must be greater than sector 3 departure date");document.getElementById("txtdeptDateSector4").focus();validat_returnvalue=false;}}else{alert("Sector 3 departure date must be greater than sector 2 departure date");document.getElementById("txtdeptDateSector3").focus();validat_returnvalue=false;}}else{alert("Sector 2 departure date must be greater than sector 1 departure date");document.getElementById("txtdeptDateSector2").focus();validat_returnvalue=false;}}else if(sector4Avail==true){if(dateValidationMulti(document.getElementById("txtdeptDateMcity").value,document.getElementById("txtdeptDateSector2").value)){if(dateValidationMulti(document.getElementById("txtdeptDateSector2").value,document.getElementById("txtdeptDateSector3").value)){if(dateValidationMulti(document.getElementById("txtdeptDateSector3").value,document.getElementById("txtdeptDateSector4").value)){validat_returnvalue=true;}else{alert("Sector 4 departure date must be greater than sector 3 departure date");document.getElementById("txtdeptDateSector4").focus();validat_returnvalue=false;}}else{alert("Sector 3 departure date must be greater than sector 2 departure date");document.getElementById("txtdeptDateSector3").focus();validat_returnvalue=false;}}else{alert("Sector 2 departure date must be greater than sector 1 departure date");document.getElementById("txtdeptDateSector2").focus();validat_returnvalue=false;}}else if(sector3Avail==true){if(dateValidationMulti(document.getElementById("txtdeptDateMcity").value,document.getElementById("txtdeptDateSector2").value)){if(dateValidationMulti(document.getElementById("txtdeptDateSector2").value,document.getElementById("txtdeptDateSector3").value)){validat_returnvalue=true;}else{alert("Sector 3 departure date must be greater than sector 2 departure date");document.getElementById("txtdeptDateSector3").focus();validat_returnvalue=false;}}else{alert("Sector 2 departure date must be greater than sector 1 departure date");document.getElementById("txtdeptDateSector2").focus();validat_returnvalue=false;}}else if(sector2Avail==true){if(dateValidationMulti(document.getElementById("txtdeptDateMcity").value,document.getElementById("txtdeptDateSector2").value)){validat_returnvalue=true;}else{alert("Sector 2 departure date must be greater than sector 1 departure date");document.getElementById("txtdeptDateSector2").focus();validat_returnvalue=false;}}}
return validat_returnvalue;}
function checkSector(originfn,destinationfn,datefn){if(document.getElementById(originfn).value==""||document.getElementById(originfn).value=="0"){return false;}
if(document.getElementById(destinationfn).value==""||document.getElementById(destinationfn).value=="0"){return false;}
if(document.getElementById(originfn).value==document.getElementById(destinationfn).value){return false;}
if(!isDateMulti(document.getElementById(datefn).value,datefn)){return false;}
return true;}
function setSectorFocus(originfn,destinationfn,datefn,sectorNo){if(document.getElementById(originfn).value==""||document.getElementById(originfn).value=="0"){alert("Please select sector "+sectorNo+" leaving from city");document.getElementById(originfn).focus();}else if(document.getElementById(destinationfn).value==""||document.getElementById(destinationfn).value=="0"){alert("Please select sector "+sectorNo+" going to city")
document.getElementById(destinationfn).focus();}else if(document.getElementById(originfn).value==document.getElementById(destinationfn).value){alert("The Leaving from and Going to cities cannot be the same for sector "+sectorNo+".")
document.getElementById(destinationfn).focus();}else if(!isDateMulti(document.getElementById(datefn).value,datefn)){isDate(document.getElementById(datefn).value,datefn);}}
function isDateMulti(dtStr,fname){var todaydate=new Date();var daysInMonth=DaysArray(12);var pos1=dtStr.indexOf(dtCh);var pos2=dtStr.indexOf(dtCh,pos1+1);var strDay=dtStr.substring(0,pos1);var strMonth=dtStr.substring(pos1+1,pos2);var strYear=dtStr.substring(pos2+1);strYr=strYear;if(strDay.charAt(0)=="0"&&strDay.length>1)strDay=strDay.substring(1);if(strMonth.charAt(0)=="0"&&strMonth.length>1)strMonth=strMonth.substring(1);for(var i=1;i<=3;i++){if(strYr.charAt(0)=="0"&&strYr.length>1)strYr=strYr.substring(1);}
month=parseInt(strMonth);day=parseInt(strDay);year=parseInt(strYr);if(pos1==-1||pos2==-1){document.getElementById(fname).value="DD/MM/YYYY";return false;}
if(strMonth.length<1||month<1||month>12){if(isNaN(month)){}else{}
return false;}
if(strDay.length<1||day<1||day>31||(month==2&&day>daysInFebruary(year))||day>daysInMonth[month]){return false;}
if(strYear.length!=4||year==0||year<minYear||year>maxYear){return false;}
if(dtStr.indexOf(dtCh,pos2+1)!=-1||isInteger(stripCharsInBag(dtStr,dtCh))==false){return false;}
return true;}
function dateValidationMulti(deptdate,retndate){var flag=true;var fromdate=deptdate;var todate=retndate;if(flag==true){flag=false;fromdate=getDateObj(fromdate);fromdate.setDate(fromdate.getDate()+1);todate=getDateObj(todate);if(isPreviousDate(fromdate)){if(fromdate>todate.setHours(fromdate.getHours(),fromdate.getMinutes(),fromdate.getSeconds(),fromdate.getMilliseconds())){return flag;}else{flag=true;return flag;}}}
return flag;}
function homeValidateOriginDestination(){var orginTypeObj=document.getElementById("selorigin")
var orginTypeIndex=orginTypeObj.selectedIndex;var orginType=orginTypeObj[orginTypeIndex].text;var destinationTypeObj=document.getElementById("seldestination")
var destinationTypeIndex=destinationTypeObj.selectedIndex;var destinationType=destinationTypeObj[destinationTypeIndex].text;var validate_date=true;validate_date=homeValidDateRange();var field1=document.getElementById("selnoOfChildren").value;var field2=document.getElementById("selnoOfAdults").value;var noOfBookings=(field1/1)+(field2/1);var fromdate=deptdate;fromdate=getDateObj(fromdate);var currentDate=getDateObj_CurrentDate();if((document.getElementById("selorigin").value=="0")){alert(selectLeavingFromCity);return false;}
else if((document.getElementById("seldestination").value=="0")){alert(selectGoingTOCity);return false;}
else if((document.getElementById("selorigin").value==document.getElementById("seldestination").value)){alert(cityCheck);return false;}
if((document.getElementById("selorigin").value==document.getElementById("seldestination").value)){alert(cityCheck);document.getElementById("seldestination").focus();return false;}
else if(trip=="R"){var todate=getDateObj(retndate);if(dateFieldEmpty(deptdate)==false){alert(departureCheck);return false;}
else if(ValidateForm(deptdate,"txtdeptDateRtrip")==false){return false;}
else if(homeIsPreviousDate1(fromdate,"txtdeptDateRtrip")==false){alert(eventCheckDeparture);return false;}
else if(document.getElementById("txtdeptDateRtrip")!=null&&(document.getElementById("txtdeptDateRtrip").value=="DD/MM/YYYY")){alert(departureCheck);return false;}
else if(dateFieldEmpty(retndate)==false){alert(returnCheck);return false;}
else if(ValidateForm(retndate,"txtretnDateRtrip")==false){return false;}
else if(homeIsPreviousDate1(todate,"txtretnDateRtrip")==false){alert(eventCheckReturn);return false;}
else if(document.getElementById("txtretnDateRtrip")!=null&&(document.getElementById("txtretnDateRtrip").value=="DD/MM/YYYY")){alert(returnCheck);return false;}
else if(daysBetween(getDateObj_CurrentDate(),document.getElementById("txtretnDateRtrip").value)>331){alert(exactDaysRange);return false;}
else if((document.getElementById("txtdeptDateRtrip").value)==(document.getElementById("txtretnDateRtrip").value)){var deptTime=document.getElementById("seldeptTimeRtrip").value;var retnTime=document.getElementById("selretnTimeRtrip").value;if(((deptTime=="morning")||(deptTime=="day")||(deptTime=="evening")||(deptTime=="night"))&&(retnTime=="morning")){alert(departureTimeCheck);return false;}
else if(((deptTime=="night")||(deptTime=="day")||(deptTime=="evening"))&&(retnTime=="day")){alert(departureTimeCheck);return false;}
else if(((deptTime=="night")||(deptTime=="evening"))&&(retnTime=="evening")){alert(departureTimeCheck);return false;}
else if(((deptTime=="night"))&&(retnTime=="night")){alert(departureTimeCheck);return false;}
else if(homeIsPreviousDate1(todate,"txtretnDateRtrip")==false){alert(eventCheck);return false;}
else if(validate_date==false){alert(returnDateCheck);return false;}
else if((document.getElementById("selnoOfInfants").value=="0")&&(document.getElementById("selnoOfChildren").value=="0")&&(document.getElementById("selnoOfAdults").value=="0")){alert(travellerCheck);return false;}
else if((document.getElementById("selnoOfChildren").value=="0")&&(document.getElementById("selnoOfAdults").value=="0")){alert(infantCheck);return false;}
else if(noOfBookings>6){alert(bookingCheck);return false;}
else if(document.getElementById("selnoOfAdults").value<document.getElementById("selnoOfInfants").value){alert(ticketCheck);return false;}
else if(((document.getElementById("selnoOfChildren").value>0)&&(document.getElementById("selnoOfInfants").value>0))&&((document.getElementById("selnoOfAdults").value=="0"))){alert(infantAccompanyCheck);return false;}
else{return true;}}
else if(validate_date==false){alert(returnDateCheck);return false;}
else if((document.getElementById("selnoOfInfants").value=="0")&&(document.getElementById("selnoOfChildren").value=="0")&&(document.getElementById("selnoOfAdults").value=="0")){alert(travellerCheck);return false;}
else if((document.getElementById("selnoOfChildren").value=="0")&&(document.getElementById("selnoOfAdults").value=="0")){alert(infantCheck);return false;}
else if(noOfBookings>6){alert(bookingCheck);return false;}
else if(document.getElementById("selnoOfAdults").value<document.getElementById("selnoOfInfants").value){alert(ticketCheck);return false;}
else if((document.getElementById("selnoOfChildren").value>0)&&(document.getElementById("selnoOfAdults").value=="0")){alert(childAccompany);return false;}
else if(((document.getElementById("selnoOfChildren").value>0)&&(document.getElementById("selnoOfInfants").value>0))&&((document.getElementById("selnoOfAdults").value=="0"))){alert(infantAccompanyCheck);return false;}
else{return true;}}
else if(trip=="O"){if(dateFieldEmpty(deptdate)==false){alert(departureCheck);return false;}
else if(ValidateForm(deptdate,"txtdeptDateOway")==false){return false;}
else if(homeIsPreviousDate1(fromdate,"txtdeptDateOway")==false){alert(eventCheckDeparture);return false;}
else if((document.getElementById("txtdeptDateOway")!=null)&&(document.getElementById("txtdeptDateOway").value=="DD/MM/YYYY")){alert(departureCheck);return false;}
else if(daysBetween(getDateObj_CurrentDate(),document.getElementById("txtdeptDateOway").value)>331){alert(exactDaysRange);return false;}
else if((document.getElementById("selnoOfInfants").value=="0")&&(document.getElementById("selnoOfChildren").value=="0")&&(document.getElementById("selnoOfAdults").value=="0")){alert(travellerCheck);return false;}
else if((document.getElementById("selnoOfChildren").value=="0")&&(document.getElementById("selnoOfAdults").value=="0")){alert(infantCheck);return false;}
else if((document.getElementById("selnoOfChildren").value>0)&&(document.getElementById("selnoOfAdults").value=="0")){alert(childAccompany);return false;}
else if(((document.getElementById("selnoOfChildren").value>0)&&(document.getElementById("selnoOfInfants").value>0))&&((document.getElementById("selnoOfAdults").value=="0"))){alert(infantAccompanyCheck);return false;}
else if(noOfBookings>6){alert(bookingCheck);return false;}
else if(document.getElementById("selnoOfAdults").value<document.getElementById("selnoOfInfants").value){alert(ticketCheck);return false;}
else{return true;}}
else if(trip=="M"){if(dateFieldEmpty(deptdate)==false){alert(departureCheck);document.getElementById('deptDateMcityimgExact').onclick();return false;}else if(ValidateForm(deptdate,"txtdeptDateMcity")==false){return false;}else if(homeIsPreviousDate1(fromdate,"txtdeptDateMcity")==false){alert(eventCheckDeparture);return false;}else if((document.getElementById("txtdeptDateMcity")!=null)&&(document.getElementById("txtdeptDateMcity").value=="DD/MM/YYYY")){alert(departureCheck);return false;}else if(daysBetween(getDateObj_CurrentDate(),document.getElementById("txtdeptDateMcity").value)>331){alert(exactDaysRange);return false;}else if((document.getElementById("selnoOfInfants").value=="0")&&(document.getElementById("selnoOfChildren").value=="0")&&(document.getElementById("selnoOfAdults").value=="0")){alert(travellerCheck);return false;}else if((document.getElementById("selnoOfChildren").value=="0")&&(document.getElementById("selnoOfAdults").value=="0")){alert(infantCheck);return false;}else if((document.getElementById("selnoOfChildren").value>"0")&&(document.getElementById("selnoOfAdults").value=="0")){alert(childAccompany);return false;}else if(((document.getElementById("selnoOfChildren").value>"0")&&(document.getElementById("selnoOfInfants").value>"0"))&&((document.getElementById("selnoOfAdults").value=="0"))){alert(infantAccompanyCheck);return false;}else if(noOfBookings>6){alert(bookingCheck);return false;}else if(document.getElementById("selnoOfAdults").value<document.getElementById("selnoOfInfants").value){alert(ticketCheck);return false;}else{return true;}}
else if((document.getElementById("selnoOfInfants").value=="0")&&(document.getElementById("selnoOfChildren").value=="0")&&(document.getElementById("selnoOfAdults").value=="0")){alert(travellerCheck);return false;}
else if((document.getElementById("selnoOfChildren").value=="0")&&(document.getElementById("selnoOfAdults").value=="0")){alert(infantCheck);return false;}
else if((document.getElementById("selnoOfChildren").value>0)&&(document.getElementById("selnoOfAdults").value=="0")){alert(childAccompany);return false;}
else if(((document.getElementById("selnoOfChildren").value>0)&&(document.getElementById("selnoOfInfants").value>0))&&((document.getElementById("selnoOfAdults").value=="0"))){alert(infantAccompanyCheck);return false;}
else if(noOfBookings>6){alert(bookingCheck);return false;}
else if(document.getElementById("selnoOfAdults").value<document.getElementById("selnoOfInfants").value){alert(ticketCheck);return false;}
else if((document.getElementById("txtretnDateRtrip").value)>(document.getElementById("txtdeptDateRtrip").value)){alert(returnDateCheck);return false;}}
function homeValidDateRange(){var flag=true;var fromdate=deptdate;var todate=retndate;if(flag==true){flag=false;fromdate=getDateObj(fromdate);todate=getDateObj(todate);if(isPreviousDate(fromdate)){if(fromdate>todate.setHours(fromdate.getHours(),fromdate.getMinutes(),fromdate.getSeconds(),fromdate.getMilliseconds())){return flag;}else{flag=true;return flag;}}}
return flag;}
function homeIsPreviousDate1(inputdate,fname){var today=phpdate;inputdate.setHours(today.getHours(),today.getMinutes(),today.getSeconds(),today.getMilliseconds())
if(inputdate<today){document.getElementById(fname).value="DD/MM/YYYY";document.getElementById(fname).focus();return false;}else{return true;}}
function getDateObj(input){var dayfield=input.split("/")[0]
var monthfield=input.split("/")[1]
var yearfield=input.split("/")[2]
var dayobj=new Date(yearfield,monthfield-1,dayfield)
return dayobj;}
function dateFieldEmpty(id){if((id.length==0)||(id=="DD/MM/YYYY")){return false;}
else{return true;}}
function isPreviousDate(inputdate){var today=phpdate;inputdate.setHours(today.getHours(),today.getMinutes(),today.getSeconds(),today.getMilliseconds())
if(inputdate<today){return false;}else{return true;}}
function setCarrierVector(checkBoxType){var carrierVector=Vector.getInstance();var groupLength=document.getElementsByName(checkBoxType).length;for(var i=0;i<groupLength;i++){if(document.getElementsByName(checkBoxType)[i].checked==true){if(!carrierVector.contains(document.getElementsByName(checkBoxType)[i].value)){carrierVector.addElement(document.getElementsByName(checkBoxType)[i].value);}}}
return carrierVector;}
function getListAsString(vector)
{var id=null;var delimiter=","
for(var i=0;i<vector.size();i++)
{if(id==null)
{id=vector.elementAt(i);}
else
{id+=delimiter+vector.elementAt(i);}}
return id;}
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var dtCh="/";var minYear=1900;var maxYear=2100;function isInteger(s){var i;for(i=0;i<s.length;i++){var c=s.charAt(i);if(((c<"0")||(c>"9")))return false;}
return true;}
function stripCharsInBag(s,bag){var i;var returnString="";for(i=0;i<s.length;i++){var c=s.charAt(i);if(bag.indexOf(c)==-1)returnString+=c;}
return returnString;}
function daysInFebruary(year){return(((year%4==0)&&((!(year%100==0))||(year%400==0)))?29:28);}
function DaysArray(n){var noofdays=new Array();for(var i=1;i<=n;i++){noofdays[i]=31
if(i==4||i==6||i==9||i==11){noofdays[i]=30}
if(i==2){noofdays[i]=29}}
return noofdays;}
function isDate(dtStr,fname){var todaydate=new Date();var daysInMonth=DaysArray(12)
var pos1=dtStr.indexOf(dtCh)
var pos2=dtStr.indexOf(dtCh,pos1+1)
var strDay=dtStr.substring(0,pos1)
var strMonth=dtStr.substring(pos1+1,pos2)
var strYear=dtStr.substring(pos2+1)
strYr=strYear
if(strDay.charAt(0)=="0"&&strDay.length>1)strDay=strDay.substring(1)
if(strMonth.charAt(0)=="0"&&strMonth.length>1)strMonth=strMonth.substring(1)
for(var i=1;i<=3;i++){if(strYr.charAt(0)=="0"&&strYr.length>1)strYr=strYr.substring(1)}
month=parseInt(strMonth)
day=parseInt(strDay)
year=parseInt(strYr)
if(pos1==-1||pos2==-1){alert("The date format should be : DD/MM/YYYY")
document.getElementById(fname).value="DD/MM/YYYY";return false}
if(strMonth.length<1||month<1||month>12){if(isNaN(month)){alert("The date format should be : DD/MM/YYYY");document.getElementById(fname).focus();}else{alert("Please enter a valid month")
document.getElementById(fname).focus();}
return false}
if(strDay.length<1||day<1||day>31||(month==2&&day>daysInFebruary(year))||day>daysInMonth[month]){alert("Please enter a valid day")
document.getElementById(fname).focus();return false}
if(strYear.length!=4||year==0||year<minYear||year>maxYear){alert("Please enter a valid 4 digit year from "+todaydate.getYear())
document.getElementById(fname).focus();return false}
if(dtStr.indexOf(dtCh,pos2+1)!=-1||isInteger(stripCharsInBag(dtStr,dtCh))==false){alert("Please enter a valid date")
document.getElementById(fname).focus();return false}
return true}
function ValidateForm(id,fname){if(isDate(id,fname)==false){document.getElementById(fname).focus();document.getElementById(fname).value="DD/MM/YYYY";return false}
return true}
function getDateObj_CurrentDate(){var input=phpdate;var dayfield=input.getDate();var monthfield=input.getMonth();var yearfield=input.getFullYear();var months=new Array("0","1","2","3","4","5","6","7","8","9","10","11");switch(monthfield){case 0:monthfield="01";break;case 1:monthfield="02";break;case 2:monthfield="03";break;case 3:monthfield="04";break;case 4:monthfield="05";break;case 5:monthfield="06";break;case 6:monthfield="07";break;case 7:monthfield="08";break;case 8:monthfield="09";break;case 9:monthfield="10";break;case 10:monthfield="11";break;case 11:monthfield="12";break;}
switch(dayfield){case 1:dayfield="01";break;case 2:dayfield="02";break;case 3:dayfield="03";break;case 4:dayfield="04";break;case 5:dayfield="05";break;case 6:dayfield="06";break;case 7:dayfield="07";break;case 8:dayfield="08";break;case 9:dayfield="09";break;}
var dayobj=dayfield+"/"+monthfield+"/"+yearfield;return dayobj;}
function daysBetween(date1,date2){if(date1.indexOf("-")!=-1){date1=date1.split("-");}else if(date1.indexOf("/")!=-1){date1=date1.split("/");}else{return 0;}
if(date2.indexOf("-")!=-1){date2=date2.split("-");}else if(date2.indexOf("/")!=-1){date2=date2.split("/");}else{return 0;}
if(parseInt(date1[1],10)>=1000){var sDate=new Date(date1[1]+"/"+date1[0]+"/"+date1[2]);}else if(parseInt(date1[2],10)>=1000){var sDate=new Date(date1[2]+"/"+date1[1]+"/"+date1[0]);}else{return 0;}
if(parseInt(date2[1],10)>=1000){var eDate=new Date(date2[1]+"/"+date2[0]+"/"+date2[2]);}else if(parseInt(date2[2],10)>=1000){var eDate=new Date(date2[2]+"/"+date2[1]+"/"+date2[0]);}else{return 0;}
var one_day=1000*60*60*24;var daysApart=Math.abs(Math.ceil((sDate.getTime()-eDate.getTime())/one_day));return daysApart;}
Zapatec.Calendar.setup({showOthers:true,step:1,electric:false,inputField:"txtretnDateOway",button:"retnDateOwayimg",ifFormat:"%d/%m/%Y",daFormat:"%d/%m/%Y",numberMonths:2,displayArea:null,flat:null,multiple:null,numberMonths:2,monthsInRow:2,dateStatusFunc:dateInRange2,onUpdate:filterDates2,vertical:true});Zapatec.Calendar.setup({showOthers:true,step:1,electric:false,inputField:"txtdeptDateRtrip",button:"deptDateRtripimgExact",ifFormat:"%d/%m/%Y",daFormat:"%d/%m/%Y",date:phpdate,numberMonths:2,displayArea:null,flat:null,multiple:null,numberMonths:2,monthsInRow:2,dateStatusFunc:dateInRange1,onUpdate:filterDates1,vertical:true});Zapatec.Calendar.setup({showOthers:true,step:1,electric:false,inputField:"txtdeptDateMcity",button:"deptDateMcityimgExact",ifFormat:"%d/%m/%Y",daFormat:"%d/%m/%Y",date:phpdate,numberMonths:2,displayArea:null,flat:null,multiple:null,numberMonths:2,monthsInRow:2,dateStatusFunc:dateInRange1,onUpdate:filterDatesMulti,vertical:true});var mcityPrevDep=new Date();function mcity1DateField(prevSector,inputSector,inputImg){if(document.getElementById(prevSector).value!="DD/MM/YYYY"){document.getElementById(inputSector).disabled=false;var input=document.getElementById(prevSector).value;var mcityPrevDep
if(input!="DD/MM/YYYY"){var dayfield=input.split("/")[0]
var monthfield=input.split("/")[1]
var yearfield=input.split("/")[2]
mcityPrevDep=new Date(yearfield,monthfield-1,dayfield);mcityPrevDep.setDate(mcityPrevDep.getDate()+1);}
Zapatec.Calendar.setup({showOthers:true,step:1,electric:false,inputField:inputSector,button:inputImg,ifFormat:"%d/%m/%Y",daFormat:"%d/%m/%Y",date:mcityPrevDep,numberMonths:2,displayArea:null,flat:null,multiple:null,numberMonths:2,monthsInRow:2,dateStatusFunc:dateInRange1,onUpdate:filterDatesMulti,vertical:true});}}
var deptShowCalendar=new Date();var callbacks=0;function filterDatesMulti(cal){startDate=cal.date;startDate.setDate(startDate.getDate()+1);if(endDate==null){Zapatec.Calendar.setup({inputField:"arrivalDate",button:"button8b",ifFormat:"%Y-%m-%d ",timeFormat:"24",date:startDate,electric:false,showsTime:false,disableFunc:dateInRange2,onUpdate:filterDates2});}}
var checkInShowCalendar=new Date()
Zapatec.Calendar.setup({showOthers:true,step:1,electric:false,inputField:"arrDateOway",button:"arrDateOwayimg",ifFormat:"%d/%m/%Y",daFormat:"%d/%m/%Y",numberMonths:2,displayArea:null,flat:null,multiple:null,numberMonths:2,monthsInRow:2,dateStatusFunc:dateInRange3,onUpdate:filterDates3,vertical:true});var depthtlShowCalendar=new Date();returnDateField1();function returnDateField1(){var input=document.getElementById("arrDateOway").value;var depthtlShowCalendar
if(input.toUpperCase()!="DD/MM/YYYY"){var dayfield=parseInt(input.split("/")[0],10)+2
var monthfield=input.split("/")[1]
var yearfield=input.split("/")[2]
depthtlShowCalendar=new Date(yearfield,monthfield-1,dayfield);}else{depthtlShowCalendar=new Date();}
Zapatec.Calendar.setup({showOthers:true,step:1,electric:false,inputField:"HdeptDateOway",button:"HdeptDateOwayimg",ifFormat:"%d/%m/%Y",daFormat:"%d/%m/%Y",date:depthtlShowCalendar,numberMonths:2,displayArea:null,flat:null,multiple:null,numberMonths:2,monthsInRow:2,dateStatusFunc:dateInRange4,vertical:true});insertafter2date(depthtlShowCalendar,"HdeptDateOway");}

function insertafter2date(dt,txtbox)
{
var dy=dt.getDate()+"";	

if(dy.length==1) {dy="0"+dy;}
var mt=parseInt(dt.getMonth())+1+"";
if(mt.length==1) {mt="0"+mt;}
var yr=dt.getFullYear();
document.getElementById(txtbox).value=dy+"/"+mt+"/"+yr;
}

var controlDate=0;var htlstartDate;var htlendDate;var htlcallbacks=0;function filterDates3(cal){htlstartDate=cal.date;htlstartDate.setDate(htlstartDate.getDate()+1)
if(htlendDate==null){Zapatec.Calendar.setup({inputField:"arrivalDate",button:"button8b",ifFormat:"%Y-%m-%d ",timeFormat:"24",date:htlstartDate,electric:false,showsTime:false,disableFunc:dateInRange4,onUpdate:filterDates4});}}
function filterDates4(cal){htlendDate=cal.date;htlendDate.setDate(htlendDate.getDate()-1)}
function dateInRange3(date){if(htlendDate!=null){var compareEnd=compareDatesOnly(date,htlendDate);if(compareEnd<0){return(true);}
if(compareEnd==0){{return"edges";}}
if(htlstartDate!=null){var compareStart=compareDatesOnly(date,htlstartDate);if(compareStart<0){return"between";}}}
var today=phpdate;today.setDate(today.getDate()+controlDate)
var compareToday=compareDatesOnly(date,today);if(compareToday>0){return(true);}
return false;return(ret);}
function dateInRange4(date){if(htlstartDate!=null){var compareDays=compareDatesOnly(htlstartDate,date);if(compareDays<0){return(true);}
if(compareDays==0){{return"edges";}}
if((htlendDate!=null)&&(date>htlstartDate)&&(date<htlendDate)){return"between";}}
var now=phpdate;now.setDate(now.getDate()+controlDate)
if(compareDatesOnly(now,date)<0){return(true);}
return false;}
var selectLeavingFromCity="Please select a leaving from city";var selectGoingTOCity="Please select a going to city";var eventCheck="events of previous days cannot be entered";var exactDaysRange="You can search upto 331 days from the current date."
var cityCheck="The Leaving from and Going to cities cannot be the same.";var departureCheck="Please specify a Departure date.";var returnCheck="Please specify a Return date.";var departureTimeCheck="The Departure time needs to be prior to the Return time.";var travellerCheck="Kindly specify at least one traveller.";var infantCheck="An Infant cannot travel without an Adult passenger.";var bookingCheck="A maximum of 6 Adult passengers can be booked at a time.";var ticketCheck="The total number of Infant passengers cannot exceed the total number of Adult passengers.";var infantAccompanyCheck="An Infant cannot travel without an Adult passenger.";var returnDateCheck="The Return date cannot be before the Departure date.";var eventCheckFlexiDepartFrom="The Departure date cannot be prior to the current date.";var eventCheckFlexiDepartTo="The Departure to date cannot be prior to the Departure from date.";var eventCheckFlexiReturnFrom="The Retun from date cannot be prior to the Departure from date.";var eventCheckFlexiReturnTo="The Retun to date cannot be prior to the Return from date.";var eventCheckDeparture="The Departure date cannot be prior to the current date.";var eventCheckReturn="The Return to date cannot be after the Departure from date.";var airlineCheck="Please check at least one Airline.";var flexiDeptFromDate="Please specify a Departure from date.";var flexiDeptToDate="Please specify a Departure to date.";var flexiReturnFromDate="Please specify a Return from date.";var flexiReturnToDate="Please specify a Return to date.";var daysRange="You can search upto a maximum of 60 days from the current date.";var presentDayForFlexi="The Flexible Dates\' search is applicable after the current date. ";var equalDaysForFlexi="The Departure from date cannot be the same as the Return from date.";var flexiDeptFromDateCheck="The Departure to date should be after the Departure from date.";var flexiRetnFromDateCheck="The Return from date cannot be prior to the Return to date.";var flexiRetnToDateCheck="The Return to day has to be after the Departure to date.";var flexiRetnFromDateCheck="The Return from date cannot be prior to the Departure from date.";var varEmailId="Please specify your Email address";var varPassword="Kindly enter password";var varPasswordLength="Password should be minimum of 6 characters";var varEmail="Invalid E-mail ID";var childAccompany="A child cannot travel without an Adult passenger";var enterCity="Please enter a City name.";var invalidCity="Invalid City name. Please try again.";var validDate="Please enter a valid date.";var checkInDate="The Check-in date cannot be prior to the current date.";var checkIn_CheckOut="The Check-in date cannot be after the Check-out date.";var checkOutDate="The Check-in date cannot be before the current date.";var same_check_in_out="The Check-in and Check-out dates cannot be the same.";var days_diff="The Check-out date needs to be within 15 days from the Check-in date.";var year_days="The Check-in and Check-out dates need to be within 365 days from the current date.";var enterDates="Please select Check-in and Check-out dates.";var enterCheckIn="Please select a Check-in date.";var enterCheckOut="Please select a Check-out date.";var dateFormat="The Date format should be DD/MM/YYYY.";var valid4Digit="Please enter a valid 4 digit year from ";var hotelNameInvalid="The Hotel you are trying to find is not available.";var hotelChainSelect="Sorry, this Hotel Chain is not available in this city. Please make a new selection.";var noResults="Sorry, no results were found that matched your search criteria. Please search again.";var dateRetrieveFialed="Sorry, the data could not be retreived. Please try again.";var noRoomsAailable="Sorry, there are no rooms available in this hotel.";var loadingHotels="Loading hotel details…";var rooms_rates_no="Sorry, there are no rooms available.";var no_images="Sorry, there are no images available for this hotel.";var validEmail="Kindly enter a valid Email address.";var enterPwd="Kindly enter a Password.";var validPwd="The Password needs to have a minimum of 6 characters. Please re-enter.";var invalidUser="Invalid Username. Please re-enter.";var invalidPwd="Invalid Password. Please re-enter.";var title="Kindly select a <strong>Title</strong>.";var firstName="Please  specify your <strong> First Name </strong>.";var lastName="Please specify your <strong>Last Name</strong>.";var age="Please specify your <strong>Age</strong>.";var address="Please specify your <strong>Address1</strong>.";var cityName="Please specify your <strong>City/Town</strong>.";var countryName="Please specify your <strong>Country</strong>.";var stateName="Please specify your <strong>Province/State/Region</strong>.";var pinCode="Please specify your <strong>Pin/Postal Code</strong>.";var telephoneType="Please specify your <strong>Telephone type </strong>.";var altTelephoneType="Please specify your <strong>Alternate Telephone type </strong>.";var telephoneNum="Please specify your <strong>Telephone number </strong>.";var altTelephoneNum="Please specify your <strong>Alternate Telephone number </strong>.";var validTelephoneNum="Kindly enter a valid <strong>Telephone number </strong>.";var validTelephoneNum1="Kindly enter a valid Telephone number.";var validAltTelephoneNum="Kindly enter a valid <strong>Alternate Telephone number </strong>.";var emailAddress="Please specify your <strong> Email Address</strong>.";var emailAddresss="Please specify your Email Address.";var adultTitle="Please specify <strong>Adult Primary Passenger Title</strong>. ";var adultFirstName="Please specify <strong> Adult Primary Passenger First Name</strong> . ";var adultLastName="Please specify <strong>Adult Primary Passenger Last Name</strong>.";var childTitle="Please specify <strong>Child Title</strong>.";var childFirstName="Please specify <strong>Child First Name</strong>.";var childLastName="Please specify <strong>Child Last Name</strong>.";var infantAge="Please specify <strong>Infant Age</strong>. ";var infantFristName="Please specify <strong>Infant First Name</strong>.";var infantLastName="Please specify <strong>Infant Last Name</strong>.";var creidtCardName="Please specify the Name on the Credit Card.";var creidtCardType="Please specify the Credit Card Type.";var limit_20="Kindly limit to 20 characters.";var cardNumber="Please enter the Credit Card Number."
var cardNum_16_digit="Please enter the 15 or 16 digit Credit Card Number.";var cardExpDate="Please enter the Expiry Date.";var CVV_Num="Please enter the CVV Number.";var CVV_3_Digit="Please enter the 3 digit CVV Number.";var fname_Billing_Add="Please specify the First Name in the Billing Address.";var lname_Billing_Add="Please specify the Last Name in the Billing Address.";var billingAddress="Please specify Address1 in the Billing Address.";var limit_100="Kindly limit to 100 characters.";var city_Billing_Add="Please specify the City/Town in the Billing Address.";var limit_50="Kindly limit to 50 characters.";var country_Billing_Add="Please specify the Country in the Billing Address.";var state_Billing_Add="Please specify the Province/State/Region in the Billing Address.";var pinCode_Billing_Add="Please specify the Pin/Postal Code in the Billing Address.";var pinCode_Delivery_Add="Please specify the Pin/Postal Code in the Delivery Address.";var auto_EMail="An auto-generated email has been sent to (email address). Please check your inbox for this message as it contains your MakeMyTrip.com Account Information. If you have not received the email, we recommend you check your junk or bulk mail folder."
var emailExists="Sorry, this Email address already exists. Please select another valid Email address.";var pwdMatch="Sorry, your Password did not match. Kindly re-enter."
var pwd_6_char="The Password needs to have a minimum of 6 characters. Please re-enter.";var resigtrationMandatory="To complete your Registration, kindly enter information in the Mandatory Fields.";var validEmailAdd="Kindly enter a valid Email address.";var validEmailAdd1="Kindly enter a valid <strong>Email address</strong>.";var payment_delivery_alert="Now that you have selected your hotel, we require passenger, payment and delivery details. Before completing your booking, you will have an opportunity to review your final itinerary. ";var apologise="Your login session has expired. You may either close this browser window and login again or wait for a few minutes to be automatically redirected  to the Homepage. We apologise for the inconvenience.";var sessionExp="Your login session has expired. You may either close this browser window and login again or wait for a few minutes to be automatically redirected  to the Homepage. We apologise for the inconvenience.";