var counts=3;var thisdate=new Date();var returndate=new Date();var day=thisdate.getDate();var month=thisdate.getMonth();month=month+1;var year=thisdate.getFullYear();var currdate=day+'-'+month+'-'+year;jQuery(document).ready(function(){jQuery('#easyscroll').css('height',135);jQuery("#list").accordion({event:'mouseover'});jQuery("#tabset").tabs();jQuery('#departure_date_onward, #departure_date_return, #fromDate1, #fromDate2, #return_date_return').datepicker({showOn:'both',buttonImage:STATICURL+'/images/cal.gif',buttonImageOnly:true,buttonText:'Choose date',minDate:currdate,maxDate:false,changeMonth:false,changeYear:false,numberOfMonths:2,dateFormat:'dd/mm/y',firstDay:1,closeText:'',clearText:'',currentText:'',prevImage:STATICURL+'/images/double_prev.gif',nextImage:STATICURL+'/images/double_next.gif',beforeShow:customRange});jQuery('#fadeOutFormOverlay').ajaxStart(function(){if(jQuery.browser.msie){jQuery('#overlayForm').bgiframe({top:0,left:0});}
jQuery('#overlayForm').addClass('overlayForm').fadeTo('fast',0.5).css('display','block').css('height',jQuery(this).height()+"px").css('width',jQuery(this).width()+"px");jQuery('#loadingCalenderOverlay').removeClass('loadingCalenderHide').addClass('loadingCalender');});jQuery('#fadeOutFormOverlay').ajaxStop(function(){jQuery('#overlayForm').css('height',0+"px").css('width',0+"px").removeClass('overlayForm').fadeTo('fast',0.5).css('display','none');jQuery('#loadingCalenderOverlay').removeClass('loadingCalender').addClass('loadingCalenderHide');});jQuery('#airlinename').change(function(){var airlineName=$(this).attr("value");if(airlineName=="DJ")
{jQuery('#onward_class_virginblu').css("visibility","hidden");jQuery('#return_class_virginblu').css("visibility","hidden");}else{jQuery('#onward_class_virginblu').css("visibility","visible");jQuery('#return_class_virginblu').css("visibility","visible");}});jQuery("#orange").tooltip({position:"center right",events:{def:"click,mouseout"}});var errorMessages=new Array();errorMessages["from_onward"]="Please select from city.";errorMessages["to_onward"]="Please select to city.";$("#main_form_area").validator({errorInputEvent:null}).bind("onFail",function(e,els){var errorMessagesString="";$.each(els,function(index,els){errorMessagesString+="<li>"+errorMessages[els.input.attr("name")]+"</li>";});jQuery.facebox('<div style="width:400px;"><div class="floatr" style="margin:5px 5px 0 0; width:100px; "><a href="javascript:;" class="colorgrey bold text11 closeicon" style="text-decoration:none;float:right;" onclick="$(document).trigger(\'close.facebox\');" ></a> </div><div class="clear"><div class="error-page-alert"><span class="ezee">ezee</span><span class="alert">alert</span><br/><div class="alertimg padl20"> </div></div><div class="error-page-main_content"><div class="error_content"><ul class="error_content">'+errorMessagesString+'</ul></div></div><div class="clear"> </div></div></div>');}).bind("onSuccess",function(e,els){var validateErrors=next_location();if(validateErrors!="")
{jQuery.facebox('<div style="width:400px;"><div class="floatr" style="margin:5px 5px 0 0; width:100px; "><a href="javascript:;" class="colorgrey bold text11 closeicon" style="text-decoration:none;float:right;" onclick="$(document).trigger(\'close.facebox\');" ></a> </div><div class="clear"><div class="error-page-alert"><span class="ezee">ezee</span><span class="alert">alert</span><br/><div class="alertimg padl20"> </div></div><div class="error-page-main_content"><div class="error_content"><ul class="error_content">'+validateErrors+'</ul></div></div><div class="clear"> </div></div></div>');return false;}
else
{return true;}}).submit(function(e){if(!e.isDefaultPrevented()){jQuery("#main_form_area").append(jQuery("#productForm").html());}});jQuery("#flightSearchFormSubmit").click(function(){jQuery("#main_form_area").trigger("submit");return false;});$("#flowpanes").scrollable({circular:true}).navigator({navi:"#flowtabs",naviItem:'a',activeClass:'current',history:true}).autoscroll({interval:3000});jQuery(".jradio").click(function(){level=$("#selecttypeflights").val();type=$(this).val();showform($(this).val());load_fromto_fields(level,type);set_class_typefields(level,type);});jQuery('#max_count').val(counts);jQuery("#jtype1").attr("checked","checked");jQuery("#within").addClass('selectedjtype');jQuery("#outside").removeClass('selectedjtype');jQuery("#selecttypeflights").val("within");showform('onward');jQuery(".jtypeselectlink").click(function(){level=$(this).attr("id");jQuery("#selecttypeflights").val(level);jQuery(".jtypeselectlink").css('background-color','#f2f2f2');jQuery(".jtypeselectlink").toggleClass('selectedjtype');jQuery(this).css('background-color','#fbfbfb');if(level=='outside'){getAirlineList('International');jQuery("#multili").show();jQuery("#multiliradio").show();$("#jtype2").trigger("click");}
else{getAirlineList('domestic');jQuery("#multili").hide();jQuery("#multiliradio").hide();$("#jtype1").trigger("click");}
type=$(".jradio:checked").val();set_class_typefields(level,type);});jQuery("#list").accordion({event:'mouseover'});jQuery("#tabset").tabs();jQuery('a[rel*=facebox]').facebox({loading_image:'js/facebox/loading.gif',close_image:'js/facebox/closelabel.gif'});jQuery("#deletemore").click(function(){if(jQuery("#SectorCount").val()>2){jQuery("#sectorDiv div.sector:last").remove();}
jQuery('#max_count').val($("#SectorCount").val());jQuery("#SectorCount").val($("#SectorCount").val()-1);if(jQuery("#SectorCount").val()<=2){jQuery("#deletemore").parent().css("display","none");}});jQuery("#addmore").click(function(){var counts=jQuery('#max_count').val();var mincount=counts-1;var depdate=document.getElementById('fromDate'+mincount).value;var level=jQuery("#selecttypeflights").val();var type=jQuery(".jradio:checked").val();var newTabin=40+counts;var tablerow='<div class="sector"> <div class="horizontal_line" ></div><ol class="listing_horizontally" >';tablerow+='<li style="vertical-align:top;"><label ><strong>Sector '+counts+'</strong></label></li>';tablerow+='</ol><div class="clear_sides"></div><ol class="listing_horizontally" ><li class="padding_sectors"><table width="auto" border="0" cellspacing="0" cellpadding="0" style="display:inline;"><tr><td><label>From</label></td></tr><tr><td>';tablerow+='<select name="fromIATA'+counts+'" id="fromIATA'+counts+'" class="select90">';tablerow+=loadcitylist();tablerow+='</select><input type="hidden" name="fromIATAcode'+counts+'" id="fromIATAcode'+counts+'" /><input type="hidden" name="fromCityName'+counts+'" id="fromCityName'+counts+'" /></td></tr></table></li>';tablerow+='<li class="padding_sectors"><table width="auto" border="0" cellspacing="0" cellpadding="0" style="display:inline;"><tr><td><label>To</label></td></tr> <tr><td>';tablerow+='<select name="toIATA'+counts+'" id="toIATA'+counts+'" class="select90" onChange="selectfromval(this.value,\'1\')">';tablerow+=loadcitylist();tablerow+='</select><input  type="hidden" name="toIATAcode'+counts+'" id="toIATAcode'+counts+'" /><input type="hidden" name="toCityName'+counts+'" id="toCityName'+counts+'" /></td></tr></table></li><li class="padding_sectors"><table width="auto" border="0" cellspacing="0" cellpadding="0" style="display:inline;"><tr><td><label>Depart</label></td></tr><tr><td><input  tabindex="'+newTabin+'" value="dd/mm/yy" name="fromDate'+counts+'" id="fromDate'+counts+'" size="8" readonly="true" class="inpu70" type="text"></td></tr></table></li><li class="padding_sectors"><table width="auto" border="0" cellspacing="0" cellpadding="0" style="display:inline;"><tr><td><label>Time</label></td></tr><tr><td><select  tabindex="'+newTabin+'" name="time'+counts+'" class="select40"><option>Any</option><option>1:00</option><option>2:00</option><option>3:00</option><option>4:00</option><option>5:00</option><option>6:00</option><option>7:00</option><option>8:00</option><option>9:00</option><option>10:00</option><option>11:00</option><option>12:00</option><option>13:00</option><option>14:00</option><option>15:00</option><option>16:00</option><option>17:00</option><option>18:00</option><option>19:00</option><option>20:00</option><option>21:00</option><option>22:00</option><option>23:00</option></select></td></tr></table></li></ol> <div class="clear_sides"></div></div>';$("#sectorDiv").append(tablerow);var datevar="<script language='javascript'>"+"$('#fromDate"+counts+"').datepicker({showOn: 'both', buttonImage: '"+STATICURL+"/images/cal.gif', buttonImageOnly: true, buttonText: 'Choose date', minDate: currdate, maxDate: false, changeMonth: false, changeYear: false, numberOfMonths: 2, dateFormat: 'dd/mm/y', firstDay: 1, closeText: '', clearText: '', currentText:'', prevImage: '"+STATICURL+"/images/double_prev.gif', nextImage: '"+STATICURL+"/images/double_next.gif', beforeShow: customRange});";if(level=='outside'){datevar+="$('#fromIATA"+counts+"').replaceWith('<input tabindex="+newTabin+"  type=text name=fromIATA"+counts+" id=fromIATA"+counts+" style=\" width:75px;border:1px solid #007BB6 !important;\"   />');";datevar+="$('#fromIATA"+counts+"').autocomplete('"+HOSTURL+"flights/index.php?action=retrieveAirports&isdomestic=International&dom=true', {";datevar+="matchContains: true,";datevar+="minChars: 3,";datevar+="otherinput: '#fromIATAcode"+counts+"',";datevar+="width: 300";datevar+="});";datevar+="$('#fromIATA"+counts+"').val('Type City Here').css('color','#888').click(function(){ $(this).val('').css('color','#000'); });";datevar+="$('#toIATA"+counts+"').replaceWith('<input  tabindex="+newTabin+" type=text name=toIATA"+counts+" id=toIATA"+counts+" style=\"width:75px; border:1px solid #007BB6 !important;\"  class=\"select90\" />');";datevar+="$('#toIATA"+counts+"').autocomplete('"+HOSTURL+"flights/index.php?action=retrieveAirports&isdomestic=International&dom=true', {";datevar+="matchContains: true,";datevar+="minChars: 3,";datevar+="otherinput: '#toIATAcode"+counts+"',";datevar+="width: 300";datevar+="});";datevar+="$('#toIATA"+counts+"').val('Type City Here').css('color','#888').click(function(){ $(this).val('').css('color','#000'); }); ";}
datevar+="</script>";jQuery("#sectorDiv").append(datevar);jQuery("#fromIATA"+counts).find("option[value=ADL]").attr("selected","selected");jQuery("#toATA"+counts).find("option[value=SYD]").attr("selected","selected");document.getElementById('SectorCount').value=counts;counts++;jQuery('#max_count').val(counts);if(jQuery("#SectorCount").val()>2){jQuery("#deletemore").parent().css("display","block")}});jQuery('#departure_date_onward, #departure_date_return, #fromDate1, #fromDate2, #return_date_return').datepicker({showOn:'both',buttonImage:STATICURL+'/images/cal.gif',buttonImageOnly:true,buttonText:'Choose date',minDate:currdate,maxDate:false,changeMonth:false,changeYear:false,numberOfMonths:2,dateFormat:'dd/mm/y',firstDay:1,closeText:'',clearText:'',currentText:'',prevImage:STATICURL+'/images/double_prev.gif',nextImage:STATICURL+'/images/double_next.gif',beforeShow:customRange});function getmindate()
{var dateArray=new Array();var depdate=$('departure_date_return').val();if(depdate!="dd/mm/yy"){dateArray=depdate.split('/');var day1=dateArray[0];var month1=dateArray[1];var mymonth=trimNumber(month1);var year1="20"+dateArray[2];var minidate=new Date(year1,mymonth-1,day1);return{minDate:minidate};}else{return{minDate:0}}}
selectCityListOnward();fillRHSbookHotDealsimages(BookHotDeals,'bookHotDeals');jQuery(".web_trend_links").click(function(){var customvalue=jQuery(this).attr('src');dcsMultiTrack('DCS.dcsuri','/image.jpeg','WT.ad',customvalue);});jQuery(".web_trend_buttons").click(function(){dcsMultiTrack('DCS.dcsuri','/image.jpeg','WT.ac','flightsgo','WT.clk',customvalue);});});function next_location()
{var isErr=false;var alertStr="";$("#session_id").attr("name","session_id");$("#sc_bool").attr("name","sc_bool");$("#cust_name").attr("name","cust_name");$("#SERVERNO").attr("name","SERVERNO");$("#goto").attr("name","goto");$("#airlinename").attr("name","airline");$("#IndianRes").attr("name","IndianRes");$("#language").attr("name","language");var level_check=$(".selectedjtype").attr("id");if(level_check=='within'){if($("#jtype1").attr("checked")==true){if($("#from_onward").val()==""){alertStr+="<li>Please fill in suitable city in 'from' field.</li>"}
if($("#to_onward").val()==""){alertStr+="<li>Please fill in suitable city in 'to' field.</li>"}
if($("#departure_date_onward").val()==""||$("#departure_date_onward").val()=="dd/mm/yy"){alertStr+="<li>Please fill in suitable date in 'Depart' field.</li>"}
if($("#from_onward").val()==$("#to_onward").val()){alertStr+="<li>From city and To city can not be same.</li>"}
if($("#noOfAdults").val()=="0"){alertStr+="<li>Number Of Adults.</li>"}
if($("#airlinename").val()==""){alertStr+="<li>Select one airline or any.</li>"}
if($("#noOfInfantSeat").val()>$("#noOfAdults").val()){alertStr+="<li>Number of infant cannot be greater than number of adult.</li>";}
if(alertStr==""){removeobject(level_check);$("#jtype1").attr("name","tripType");$("#jtype1").attr("value","O");$("#dom").attr("name","dom");$("#dom").attr("value","Y");$("#onTime").attr("name","onTime");$("#from_onward").attr("name","fromIATA");$("#to_onward").attr("name","toIATA");$("#departure_date_onward").attr("name","fromDate");$("#noOfAdults").attr("name","noOfAdults");$("#noOfChild").attr("name","noOfChild");$("#noOfInfantSeat").attr("name","noOfInfantSeat");$("#LowCostCarrier").attr("name","LowCostCarrier");$("#NightFlightsOnly").attr("name","NightFlightsOnly");$("#directFlightFlagTemp").attr("name","directFlightFlagTemp");$("#class_onward").attr("name","classType");}}else if($("#jtype2").attr("checked")==true){if($("#from_return").val()==""){alertStr+="<li>Please fill in suitable city in 'from' field.</li>"}
if($("#to_return").val()==""){alertStr+="<li>Please fill in suitable city in 'to' field. </li>"}
if($("#departure_date_return").val()==""||$("#departure_date_return").val()=="dd/mm/yy"){alertStr+="<li>Please fill in suitable date in 'Depart' field.</li>"}
if($("#from_return").val()==$("#to_return").val()){alertStr+="<li>From city and To city can not be same.</li>"}
if($("#return_date_return").val()==""||$("#return_date_return").val()=="dd/mm/yy"){alertStr+="<li>Please fill in suitable date in 'Return' field.</li>"}
if($("#noOfAdults").val()=="0"){alertStr+="<li>Number Of Adults</li>"}
if($("#airlinename").val()==""){alertStr+="<li>Select one airline or any</li>"}
if($("#noOfInfantSeat").val()>$("#noOfAdults").val()){alertStr+="<li>Number of infant cannot be greater than number of adult.</li>";}
if(!validateReturnDate()){alertStr+="<li>Return journey date cant be greater than Leaving date.</li>"}
if(alertStr==""){removeobject(level_check);$("#jtype2").attr("name","tripType");$("#jtype2").attr("value","R");$("#dom").attr("name","dom");$("#dom").attr("value","Y");$("#onTime").attr("name","onTime");$("#returnTime").attr("name","returnTime");$("#from_return").attr("name","fromIATA");$("#to_return").attr("name","toIATA");$("#onwardReturnSep").attr("name","onwardReturnSep");$("#departure_date_return").attr("name","fromDate");$("#return_date_return").attr("name","returnDate");$("#noOfAdults").attr("name","noOfAdults");$("#noOfChild").attr("name","noOfChild");$("#noOfInfantSeat").attr("name","noOfInfantSeat");$("#LowCostCarrier").attr("name","LowCostCarrier");$("#NightFlightsOnly").attr("name","NightFlightsOnly");$("#directFlightFlagTemp").attr("name","directFlightFlagTemp");$("#class_return").attr("name","classType");}}}else{var fromCountry="";var toCountry="";if($("#jtype1").attr("checked")==true){var fromcityval=document.getElementById('from_onward').value;var tocityval=document.getElementById('to_onward').value;if(!(fromcityval=='- Type City Here -'||fromcityval=='')&&!(tocityval==''||tocityval=='- Type City Here -')){var fromListArray=new Array();fromListArray=fromcityval.split(",");var toListArray=tocityval.split(",");fromCountry=fromListArray[1];toCountry=toListArray[1];}
if($("#fromIATA").val()==""){alertStr+="<li>Please fill in suitable city in 'from' field.</li>"}
if($("#toIATA").val()==""){alertStr+="<li>Please fill in suitable city in 'to' field.</li>"}
if($("#departure_date_onward").val()==""||$("#departure_date_onward").val()=="dd/mm/yy"){alertStr+="<li>Please fill in suitable date in 'Depart' field</li>"}
if(fromCountry.indexOf('India')>0&&toCountry.indexOf('India')>0){alertStr+="<li>From and To city cannot be from within India.</li>"}
if($("#from_onward").val()==$("#to_onward").val()){alertStr+="<li>From city and To city can not be same.</li>"}
if($("#noOfAdults").val()=="0"){alertStr+="<li>Number Of Adults</li>"}
if($("#airlinename").val()==""){alertStr+=" Select one airline or any<br/> "}
if($("#noOfInfantSeat").val()>$("#noOfAdults").val()){alertStr+="<li>Number of infant cannot be greater than number of adult.</li>";}
if(alertStr==""){removeobject(level_check);$("#jtype1").attr("name","tripType");$("#jtype1").attr("value","O");$("#dom").attr("name","dom");$("#dom").attr("value","N");$("#onTime").attr("name","onTime");$("#fromIATA").attr("name","fromIATA");$("#toIATA").attr("name","toIATA");$("#departure_date_onward").attr("name","fromDate");$("#noOfAdults").attr("name","noOfAdults");$("#noOfChild").attr("name","noOfChild");$("#noOfInfantSeat").attr("name","noOfInfantSeat");$("#LowCostCarrier").attr("name","LowCostCarrier");$("#NightFlightsOnly").attr("name","NightFlightsOnly");$("#directFlightFlagTemp").attr("name","directFlightFlagTemp");$("#class_onward").attr("name","classType");}}else if($("#jtype2").attr("checked")==true){var fromcityval=document.getElementById('from_return').value;var tocityval=document.getElementById('to_return').value;if(!(fromcityval=='- Type City Here -'||fromcityval=='')&&!(tocityval==''||tocityval=='- Type City Here -')){var fromListArray=new Array();fromListArray=fromcityval.split(",");var toListArray=tocityval.split(",");fromCountry=fromListArray[1];toCountry=toListArray[1];}
if($("#fromIATA").val()==""){alertStr+="<li>Please fill in suitable city in 'from' field.</li>";}
if($("#toIATA").val()==""){alertStr+="<li>Please fill in suitable city in 'to' field.</li>";}
if($("#departure_date_return").val()==""||$("#departure_date_return").val()=="dd/mm/yy"){alertStr+="<li>Please fill in suitable date in 'Depart' field</li>";}
if(fromCountry.indexOf('India')>0&&toCountry.indexOf('India')>0){alertStr+="<li>From and To city cannot be from within India.</li>"}
if($("#from_return").val()==$("#to_return").val()){alertStr+="<li>From city and To city can not be same</li>";}
if($("#return_date_return").val()==""||$("#return_date_return").val()=="dd/mm/yy"){alertStr+="<li>Please fill in suitable date in 'Return' field.</li>";}
if($("#noOfAdults").val()=="0"){alertStr+="<li>Number Of Adults.</li>";}
if($("#airlinename").val()==""){alertStr+=" <li>Select one airline or any.</li>";}
if($("#noOfInfantSeat").val()>$("#noOfAdults").val()){alertStr+="<li>Number of infant cannot be greater than number of adult.</li>";}
if(!validateReturnDate()){alertStr+="<li>Return journey date cant be greater than Depart date.</li>"}
if(alertStr==""){removeobject(level_check);$("#jtype2").attr("name","tripType");$("#jtype2").attr("value","R");$("#dom").attr("name","dom");$("#dom").attr("value","N");$("#onTime").attr("name","onTime");$("#returnTime").attr("name","returnTime");$("#onwardReturnSep").attr("name","onwardReturnSep");$("#departure_date_return").attr("name","fromDate");$("#return_date_return").attr("name","returnDate");$("#noOfAdults").attr("name","noOfAdults");$("#noOfChild").attr("name","noOfChild");$("#noOfInfantSeat").attr("name","noOfInfantSeat");$("#LowCostCarrier").attr("name","LowCostCarrier");$("#NightFlightsOnly").attr("name","NightFlightsOnly");$("#directFlightFlagTemp").attr("name","directFlightFlagTemp");$("#class_return").attr("name","classType");$('#multicityairline').attr('name','airline');}}
else if($("#jtype3").attr("checked")==true){if($("#multicitymain_adults").val()=="0"){alertStr+="<li>Number Of Adults</li>"}
if($("#multicitymain_airline").val()==""){alertStr+=" <li>Select one airline or any</li> "}
if($("#multicitymain_infants").val()>$("#noOfAdults").val()){alertStr+="<li>Number of infant cannot be greater than number of adult.</li>";}
var fromInt=0;var toInt=0;var toFromInt=0;var dateInt=0;for(s=1;s<=jQuery("#sectorDiv").children().length;s++){if(jQuery("#fromIATA"+s).val()==""||jQuery("#fromIATA"+s).val()=="Type City Here"){fromInt++;}
if(jQuery("#toIATA"+s).val()==""||jQuery("#toIATA"+s).val()=="Type City Here"){toInt++;}
if((jQuery("#toIATA"+s).val()==jQuery("#fromIATA"+s).val())){toFromInt++;}
if(jQuery("#fromDate"+s).val()==""||jQuery("#fromDate"+s).val()=="dd/mm/yy"){dateInt++;}}
if(fromInt>0){alertStr+="<li>Please fill in suitable city in 'from' field.</li>";}
if(toInt>0){alertStr+="<li>Please fill in suitable city in 'to' field.</li>";}
if(toFromInt>0){alertStr+="<li>To and From cannot be same city.</li>";}
if(dateInt>0){alertStr+="<li>Please fill in suitable date in 'Depart' field.</li>";}
if(alertStr==""){removeobject(level_check);jQuery("#jtype3").attr("name","tripType");jQuery("#jtype3").attr("value","M");jQuery("#dom").attr("name","dom");jQuery("#dom").attr("value","N");jQuery("#LowCostCarrier").attr("name","LowCostCarrier");jQuery("#NightFlightsOnly").attr("name","NightFlightsOnly");jQuery("#directFlightFlagTemp").attr("name","directFlightFlagTemp");jQuery("#noOfAdults").attr("name","noOfAdults1");jQuery("#noOfChild").attr("name","noOfChild1");jQuery("#noOfInfantSeat").attr("name","noOfInfantSeat1");jQuery("#multicitymain_adults").attr("name","noOfAdults");jQuery("#multicitymain_children").attr("name","noOfChild");jQuery("#multicitymain_infants").attr("name","noOfInfantSeat");jQuery("#multicitymain_class").attr("name","classType");jQuery("#multicitymain_airline").attr("name","airline");}}}
if(alertStr==""){return"";}else{return alertStr;}}
function customRange(input){xDate=0;if($("#jtype3").attr("checked")==false){if(input.id=="return_date_return"){if($("#departure_date_return").val()!=""){xDate=$("#departure_date_return").datepicker("getDate");}}}else if($("#jtype3").attr("checked")){var xx=input.id;xx=xx.substr(xx.length-1,1);if(xx!=1){if(input.id!="fromDate"+parseInt(xx-1)){if($("#fromDate"+xx).val()!=""){xDate=$("#fromDate"+parseInt(xx-1)).datepicker("getDate");}}}}
return{minDate:xDate};}
function showform(id){if(id=='multicitymain'){$(".searchParam").hide();}
else{$(".searchParam").show();$(".form").hide();}
$("#"+id).show();}
function getAirlineList(type){var options='';options+='<option value="Any">All Airlines</option>';if(type=='domestic'){options+='<option value="AI">Air India - AI</option>';options+='<option value="IC">Air India - IC</option>';options+='<option value="GO">Go Air</option>';options+='<option value="6E">Indigo</option>';options+='<option value="9W">Jet Airways</option>';options+='<option value="S2">JetLite</option>';options+='<option value="IT">Kingfisher Airlines</option>';options+='<option value="9H">MDLR</option>';options+='<option value="I7">Paramount</option>';options+='<option value="SG">Spicejet</option>';}else{options+='<option value="SU">Aeroflot</option>';options+='<option value="VV">Aerosvit Airlines</option>';options+='<option value="KC">Air Astana</option>';options+='<option value="AC">Air Canada</option>';options+='<option value="CA">Air China</option>';options+='<option value="AF">Air France</option>';options+='<option value="AI">Air India - AI</option>';options+='<option value="IC">Air India - IC</option>';options+='<option value="MK">Air Mauritius</option>';options+='<option value="NZ">Air New-Zealand</option>';options+='<option value="HM">Air Seychelles</option>';options+='<option value="AB">AirBerlin</option>';options+='<option value="FL">Airlec</option>';options+='<option value="AZ">Alitalia</option>';options+='<option value="NH">All Nippon Airlines/Ana Airlines</option>';options+='<option value="AA">American Airlines </option>';options+='<option value="OZ">Asiana Airlines</option>';options+='<option value="OS">Austrian Airlines</option>';options+='<option value="BG">Biman Bangladesh Airlines</option>';options+='<option value="BA">British Airways</option>';options+='<option value="BD">Brtish Midland</option>';options+='<option value="SN">Brussels Airlines</option>';options+='<option value="CX">Cathay Pacific</option>';options+='<option value="CI">China Airlines</option>';options+='<option value="MU">China Eastern Airways</option>';options+='<option value="CZ">China Southern Air</option>';options+='<option value="XG">clickair</option>';options+='<option value="CO">Continental Airlines</option>';options+='<option value="OK">Czech Airlines</option>';options+='<option value="DL">Delta</option>';options+='<option value="U2">Easyjet</option>';options+='<option value="MS">Egypt Air</option>';options+='<option value="LY">El Al Israel Airlines</option>';options+='<option value="EK">Emirates</option>';options+='<option value="ET">Ethiopian Airways</option>';options+='<option value="EY">Etihad Airways</option>';options+='<option value="GJ">Eurofly S.P.A.</option>';options+='<option value="BR">Eva Airways</option>';options+='<option value="AY">Finn Air</option>';options+='<option value="LF">flynordic</option>';options+='<option value="SJ">freedom air</option>';options+='<option value="GA">Garuda Indonesia</option>';options+='<option value="Z5">Gmg Airlines</option>';options+='<option value="GF">Gulf Airways</option>';options+='<option value="HR">Hahn Air Lines</option>';options+='<option value="KA">HONG KONG DRAGON AIRLINES</option>';options+='<option value="IR">Iran Air</option>';options+='<option value="JL">Japan Air</option>';options+='<option value="9W">Jet Airways</option>';options+='<option value="S2">JetLite</option>';options+='<option value="KL">K.L.M</option>';options+='<option value="KQ">Kenya Airlines</option>';options+='<option value="IT">Kingfisher Airlines</option>';options+='<option value="KE">Korean Air</option>';options+='<option value="KU">Kuwait Airways</option>';options+='<option value="LH">Lufthansa</option>';options+='<option value="W5">Mahan Airlines</option>';options+='<option value="MH">Malaysia Airways</option>';options+='<option value="WY">Oman Air</option>';options+='<option value="QF">Qantas Airlines</option>';options+='<option value="QR">Qatar Airways</option>';options+='<option value="RT">Rak Airways</option>';options+='<option value="BI">Royal Brunei</option>';options+='<option value="RJ">Royal Jordanian</option>';options+='<option value="RA">Royal Nepal Airlines</option>';options+='<option value="SV">Saudi Arabian Airlines</option>';options+='<option value="SK">Scandinavian Airlines</option>';options+='<option value="FM">Shanghai Airlines</option>';options+='<option value="MI">Silk Air</option>';options+='<option value="SQ">Singapore Airlines</option>';options+='<option value="NE">Skyeurope</option>';options+='<option value="SA">South African Airways</option>';options+='<option value="UL">Sri Lankan Airlines</option>';options+='<option value="NB">Sterling Airways</option>';options+='<option value="LX">Swiss International</option>';options+='<option value="TG">Thai Airways</option>';options+='<option value="HV">Transavia Airlines</option>';options+='<option value="TK">Turkish Air </option>';options+='<option value="US">U.S Airways</option>';options+='<option value="UA">United Airlines</option>';options+='<option value="VN">Vietnam Airways</option>';options+='<option value="VS">Virgin Atlantic</option>';options+='<option value="DJ">VirginBlue</option>';options+='<option value="IV">VolaWindJet</option>';options+='<option value="VY">vueling</option>';options+='<option value="IY">Yemenia Yemen Airways</option>';}
$("#airlinename").html('');$("#airlinename").append(options);$("#multicitymain_airline").html('');$("#multicitymain_airline").append(options);options='';options+='<option selected value="Economy">Economy </option>';options+='<option  value="Business">Business /Club</option>';if(type!='domestic'){options+='<option  value="First">First</option>';}
$(".class_type_cs").html('');$(".class_type_cs").append(options);}
var load_fromto_fields=function(jlevel,jtype){if(jtype&&jlevel){populate_to_fields(jlevel,jtype);}}
var populate_to_fields=function(level,type){switch(level){case"within":if(type=='multicitymain'){var optionst=loadcitylist();var multicitycount=$("#SectorCount").val();for(var s=1;s<=parseInt(multicitycount);s++)
{$("#fromIATA"+s).replaceWith("<select name=fromIATA"+s+" id=fromIATA"+s+" style='width:95% !important;' ></select>");$("#fromIATA"+s).html(optionst).find("option[value=ADL]").attr("selected","selected");$("#toIATA"+s).replaceWith("<select name=toIATA"+s+" id=toIATA"+s+" style='width:95% !important;' ></select>");$("#toIATA"+s).html(optionst).find("option[value=SYD]").attr("selected","selected");}
jQuery("#jtype1").click();}else{var optionst=loadcitylist();$("#fromdiv_"+type).html("<select name=from_"+type+" id=from_"+type+" class='select115'></select>");$("#from_"+type).html(optionst);$("#todiv_"+type).html("<select name=to_"+type+" id=to_"+type+" class='select115'></select>");$("#to_"+type).html(optionst);selectCityListReturn();selectCityListOnward();}
break;case"outside":$("select.class_type_cs").html('<option value="Economy">Economy</option><option value="Business">Business</option><option value="First">First</option>');if(type=='multicitymain'){$("#multicitymain_class").css('display','block');var multicitycount=$("#SectorCount").val();for(var g=1;g<=parseInt(multicitycount);g++){var tabin=40+g;$("#fromDate"+g).attr("tabindex",tabin);$("#time"+g).attr("tabindex",tabin);$("#fromIATA"+g).replaceWith("<input tabindex='"+tabin+"' type=text name=fromIATA"+g+" id=fromIATA"+g+" style='width:75px!important;border:1px solid #007BB6 !important;'   />");$("#fromIATA"+g).autocomplete(HOSTURL+"flights/index.php?action=retrieveAirports&isdomestic=International&dom=true",{matchContains:true,minChars:3,otherinput:"#fromIATAcode"+g,width:300});$("#fromIATA"+g).val("Type City Here").css("color","#888").click(function(){$(this).val("").css("color","#000");});$("#toIATA"+g).replaceWith("<input tabindex='"+tabin+"'  type=text name=toIATA"+g+" id=toIATA"+g+" style=' width:75px!important;border:1px solid #007BB6 !important;'  />");$("#toIATA"+g).autocomplete(HOSTURL+"flights/index.php?action=retrieveAirports&isdomestic=International&dom=true",{matchContains:true,minChars:3,otherinput:"#toIATAcode"+g,width:300});$("#toIATA"+g).val("Type City Here").css("color","#888").click(function(){$(this).val("").css("color","#000");});}}else{if($("#fromIATA"))$("#fromIATA").remove();if($("#toIATA"))$("#toIATA").remove();$("#fromdiv_"+type).html("<input type=hidden name=fromIATA id=fromIATA /></select><input name='filterfromIATA' type='text' id=from_"+type+" style='border:1px solid #007BB6 !important;' />");$("#from_"+type).autocomplete(HOSTURL+"flights/index.php?action=retrieveAirports&isdomestic=International&dom=true",{matchContains:true,minChars:3,otherinput:"#fromIATA",width:300});$("#from_"+type).val("- Type City Here -").css("color","#888").click(function(){$(this).val("").css("color","#000");});$("#todiv_"+type).html("<input type=hidden name=toIATA id=toIATA /><input name='filtertoIATA' type=text id=to_"+type+" style='border:1px solid #007BB6 !important;' />");$("#to_"+type).autocomplete(HOSTURL+"flights/index.php?action=retrieveAirports&isdomestic=International&dom=true",{matchContains:true,minChars:3,otherinput:"#toIATA",width:300});$("#to_"+type).val("- Type City Here -").css("color","#888").click(function(){$(this).val("").css("color","#000");});$("#multicitymain_class").css('display','none');}
break;}}
function loadcitylist(){var optionst='';jQuery.ajax({type:"get",url:HOSTURL+"flights/index.php?action=retrieveCountryAirportsAjax&isdomestic=Domestic",dataType:'text',async:false,success:function(data){optionst=data;}});return optionst;}
function customRange(input){xDate=0;if($("#jtype3").attr("checked")==false){if(input.id=="return_date_return"){if($("#departure_date_return").val()!=""){xDate=$("#departure_date_return").datepicker("getDate");}}}else if($("#jtype3").attr("checked")){var xx=input.id;xx=xx.substr(xx.length-1,1);if(xx!=1){if(input.id!="fromDate"+parseInt(xx-1)){if($("#fromDate"+xx).val()!=""){xDate=$("#fromDate"+parseInt(xx-1)).datepicker("getDate");}}}}
return{minDate:xDate};}
function validateReturnDate(){var dateVd=false;var fromDate=$("#departure_date_return").val();var toDate=$("#return_date_return").val();var fromdtArray=fromDate.split("/");var toDateArray=toDate.split("/");var todd=fromdtArray[0];var tomm=fromdtArray[1];var toyy="20"+fromdtArray[2];var fmdd=toDateArray[0];var fmmm=toDateArray[1];var fmyy="20"+toDateArray[2];if(toyy==fmyy){if(tomm<fmmm){dateVd=true}
if(tomm==fmmm){if(todd<=fmdd){dateVd=true}}}
if(toyy<fmyy){dateVd=true}
return dateVd}
function removeobject(level_check){if(level_check=='within'&&$("#jtype1").attr("checked")==true){$("#selecttypeflights").remove();$(".products input").remove('');$("#from_return").remove();$("#to_return").remove();$("#departure_date_return").remove();$("#return_date_return").remove();$("#class_return").remove();$("#map_location").remove();$("#return_date_return").remove();$("#fromDate1").remove();$("#fromDate2").remove();$("#max_count").remove();$("#SectorCount").remove();$("#fromIATA1").remove();$("#toIATA1").remove();$("#from2").remove();$("#toIATA2").remove();$("#time1").remove();$("#time2").remove();$("#multicitymain_adults").remove();$("#multicitymain_children").remove();$("#multicitymain_infants").remove();$("#multicitymain_class").remove();$("#multicitymain_airline").remove();$("#returnTime").remove();$("#onwardReturnSep").remove();if($("#fromIATA"))$("#fromIATA").remove();if($("#toIATA"))$("#toIATA").remove();}else if(level_check=='within'&&$("#jtype2").attr("checked")==true){$("#selecttypeflights").remove();$(".products input").remove('');$("#from_onward").remove();$("#to_onward").remove();$("#departure_date_onward").remove();$("#class_onward").remove();$("#map_location").remove();$("#fromDate1").remove();$("#fromDate2").remove();$("#max_count").remove();$("#SectorCount").remove();$("#fromIATA1").remove();$("#toIATA1").remove();$("#fromIATA2").remove();$("#toIATA2").remove();$("#time1").remove();$("#time2").remove();$("#multicitymain_adults").remove();$("#multicitymain_children").remove();$("#multicitymain_infants").remove();$("#multicitymain_class").remove();$("#multicitymain_airline").remove();if($("#fromIATA"))$("#fromIATA").remove();if($("#toIATA"))$("#toIATA").remove();}else if(level_check=='within'&&$("#jtype3").attr("checked")==true){}
if(level_check!='within'&&$("#jtype1").attr("checked")==true){$("#selecttypeflights").remove();$(".products input").remove('');$("#from_return").remove();$("#to_return").remove();$("#departure_date_return").remove();$("#return_date_return").remove();$("#class_return").remove();$("#map_location").remove();$("#return_date_return").remove();$("#fromDate1").remove();$("#fromDate2").remove();$("#max_count").remove();$("#SectorCount").remove();$("#fromIATA1").remove();$("#toIATA1").remove();$("#fromIATA2").remove();$("#toIATA2").remove();$("#time1").remove();$("#time2").remove();$("#multicitymain_adults").remove();$("#multicitymain_children").remove();$("#multicitymain_infants").remove();$("#multicitymain_class").remove();$("#multicitymain_airline").remove();$("#returnTime").remove();$("#onwardReturnSep").remove();$("#from_onward").remove();$("#to_onward").remove();}else if(level_check!='within'&&$("#jtype2").attr("checked")==true){$("#selecttypeflights").remove();$(".products input").remove('');$("#from_onward").remove();$("#to_onward").remove();$("#departure_date_onward").remove();$("#class_onward").remove();$("#map_location").remove();$("div.elm #class_onward").hide();$("#fromDate1").remove();$("#fromDate2").remove();$("#max_count").remove();$("#SectorCount").remove();$("#fromIATA1").remove();$("#toIATA1").remove();$("#fromIATA2").remove();$("#toIATA2").remove();$("#time1").remove();$("#time2").remove();$("#multicitymain_adults").remove();$("#multicitymain_children").remove();$("#multicitymain_infants").remove();$("#multicitymain_class").remove();$("#multicitymain_airline").remove();}else if(level_check!='within'&&$("#jtype3").attr("checked")==true){jQuery('#domint').val('multicity');jQuery('#domvalue').val('multicity');var multicitycount=$("#SectorCount").val();for(var g=1;g<=parseInt(multicitycount);g++){var fromLocation=jQuery('#fromIATA'+g).val().split("(");var toLocation=jQuery('#toIATA'+g).val().split("(");jQuery('#fromCityName'+g).val(fromLocation[0]);jQuery('#toCityName'+g).val(toLocation[0]);jQuery("#fromIATA").remove();jQuery("#toIATA").remove();jQuery("#departure_date_onward").remove();jQuery("#return_date_return").remove();jQuery("#onTime").remove();jQuery("#LowCostCarrier").remove();jQuery("#NightFlightsOnly").remove();jQuery('#departure_date_return').remove();jQuery('#class_return').remove();}
jQuery('#from_onward').remove();jQuery('#to_onward').remove();jQuery('#class_onward').remove();jQuery('#class_onward').remove();jQuery("#LowCostCarrier").remove();jQuery("#NightFlightsOnly").remove();jQuery('#airlinename').remove();jQuery("#noOfAdults").remove();jQuery("#noOfChild").remove();jQuery("#noOfInfantSeat").remove();}}
function selectCityListOnward()
{var foundFrom=true;var foundto=true;jQuery("#from_onward").find("option[value=BOM]").each(function(i){if(foundFrom){jQuery(this).attr("selected","selected");foundFrom=false;}});jQuery("#to_onward").find("option[value=DEL]").each(function(i){if(foundto){jQuery(this).attr("selected","selected");foundto=false;}});}
function selectCityListReturn()
{var foundFromR=true;var foundtoR=true;jQuery("#from_return").find("option[value=BOM]").each(function(i){if(foundFromR){jQuery(this).attr("selected","selected");foundFromR=false;}});jQuery("#to_return").find("option[value=DEL]").each(function(i){if(foundtoR){jQuery(this).attr("selected","selected");foundtoR=false;}});}
function set_class_typefields(level,type){if(level=='outside'&&type=='multicitymain')
{jQuery("#multimain_elm4").html('<select name="multicitymain_class" id="multicitymain_class" class="class_type_cs" style="width:110px;"><option selected="selected">Economy</option><option>Business</option><option value="First">First</option></select>');}
else
{jQuery("#multimain_elm4").html('');}
if(type=='onward')
{if(level=='outside'){jQuery("select[name='class_onward']").html("");jQuery("select[name='class_onward']").append('<option value="Economy" selected >Economy</option><option value="Business">Business</option><option value="First">First</option>');}else
{jQuery("select[name='class_onward']").html("");jQuery("select[name='class_onward']").append('<option value="Economy" selected >Economy</option><option value="Business">Business</option>');}}
else
{if(level=='outside'){jQuery("#class_return").html("");jQuery("#class_return").append('<option value="Economy" selected >Economy</option><option value="Business">Business</option><option value="First">First </option>');}else
{jQuery("#class_return").html("");jQuery("#class_return").append('<option value="Economy" selected >Economy</option><option value="Business">Business</option>');}}
if(level=='outside'&&type!='multicitymain')
{jQuery("#airlinePopulate").html("");}
else
{jQuery("#airlinePopulate").html('<select name="airline" id="airlinename"><option value="Any">All Airlines</option><option value="AI">Air India</option><option value="IC">Indian Airlines</option><option value="G8">Go Air</option><option value="6E">Indigo</option><option value="9W">Jet Airways</option><option value="S2">JetLite</option><option value="IT">Kingfisher</option><option value="9H">MDLR</option><option value="I7">Paramount</option><option value="SG">Spicejet</option></select>');}}