var airport;
var selectedText;

function DisableOthers(value){ 
    if(value){              
        if(document.getElementById('compoText'))  document.getElementById('compoText').disabled=true;  
        if(document.getElementById('dvFlt')) document.getElementById('dvFlt').style.display='none';
        CheckAvailability();        
    }else{    
        if(document.getElementById('compoText')){ document.getElementById('compoText').disabled=false;} 
      if(document.getElementById('ChkRtnGDS')){
      document.getElementById('ChkRtnGDS').checked=false;}                
    }     
}
function NewsearchAfterRtnSplFareChecking(){
$("hidProcess").value='1'; 
var url='';
var tt='';
var dd='';
var lcc='';
var fbc='';
var frm='';
var to='';
var owd='';
var rtd='';
var owt='';
var rtt='';
var adt='';
var chd='';
var inf='';
var air='';
if ($('opt1W').checked==true)
tt='1';
else
tt='2';
dd='1';
lcc='0';
frm=$('selDeparture').value;
to=$('selArrival').value;
owd=$('theDate1').value;
rtd=$('theDate2').value;
owt=$('cmbOWTime').value;
rtt=$('cmbRTTime').value;
adt=$('cmbAdult').value;
chd=$('cmbChild').value;
inf=$('cmbInfant').value;
air=$('HidIntAirline').value;
url='type=new';
url=url+'&tt='+tt;
url=url+'&dd='+dd;
url=url+'&lcc='+lcc;
url=url+'&frm='+frm;
url=url+'&to='+to;
url=url+'&owd='+owd;
url=url+'&rtd='+rtd;
url=url+'&owt='+owt;
url=url+'&rtt='+rtt;
url=url+'&air=All';
url=url+'&adt='+adt;
url=url+'&chd='+chd;
url=url+'&inf='+inf;
$("tblprocess").style.display="";
$("tdOW").innerHTML='';
if (tt=='1')
{
fetchData3('dispdowrt.aspx?'+url+'&date='+new Date().getTime()+'', 'tdOW');   
return false;
}
fetchData3('dispdowrt.aspx?'+url+'&date='+new Date().getTime()+'', 'tdOW');
}

function fetchRtnSplFare(url,pageFrm){    
    var pageRequest = false;
    if (window.XMLHttpRequest)pageRequest = new XMLHttpRequest();
    else if (window.ActiveXObject) pageRequest = new ActiveXObject('MSXML2.XMLHTTP.3.0');
    else return false;
    pageRequest.onreadystatechange = function() {
    try
        {
            if (pageRequest.readyState > 3)
            {                
                if(pageRequest.responseText=='Y'){ 
                 if(pageFrm==''){                  
                    document.getElementById("imgloding").style.display='none'                    
                    document.getElementById("Available").style.display='';
                    document.getElementById("NotAvailable").style.display='none';                    
                    document.getElementById("Applicable").style.display='';
                    document.getElementById("NotApplicable").style.display='none';
                    RTAvail='Y'
                    ShowDia='Y'
                 }else{                 
                    NewsearchAfterRtnSplFareChecking();
                 }
                }else{                  
                    if(pageFrm==''){
                        RTAvail='N'
                        ShowDia='N'
                        document.getElementById("imgloding").style.display='none'                     
                        document.getElementById("Available").style.display='none';
                        document.getElementById("NotAvailable").style.display='';                    
                        document.getElementById("Applicable").style.display='none';
                        document.getElementById("NotApplicable").style.display='';  
                    }else{
                        alert('Return special fare is not applicable in the selected sector');                       
                    }
                } 
            }
         }
    catch(err)
    {}
    }    
    pageRequest.open('get',url,true);
    pageRequest.send(null);
}

function swap(value,obj){ 
if(value){
if(obj==1){
 $("chkLCC").checked=''; 
}
}
}
function $(id){
var iid =document.getElementById(id);
return iid;
}
var sendmailok=0;
function SendMail(){
if (sendmailok==1){
alert('Mail sending in progress...');
return false;
}
sendmailok=1; 
var nme = $('txtname').value;
var msg=$('txtMessage').value;
var emailFrom=$('txtmyMail').value;
var emailTo=$('txtTomail').value;
var sub =$('txtSubject').value;
var cc;
if($('chksend').checked==true){
 cc="True";
}else{
 cc="false";
} 
if ($('txtname').value==''){
alert('Enter Name ');
sendmailok=0
return false;
}
 if ($('txtmyMail').value==''){
alert('Enter Your Mail ');
sendmailok=0
return false;
}
if ($('txtTomail').value==''){
alert('Enter Tomail ');
sendmailok=0
return false;
}
if ($('txtSubject').value==''){
alert('Enter Subject ');
sendmailok=0
return false;
}
SendMailData('/FlightBooking/pages/MailPage.aspx?Send=true&Msg='+ msg +'&EmailFrom='+ emailFrom +'&EmailTo='+ emailTo +'&Sub='+ sub +'&cc='+ cc +'&Nme='+ nme +'&date='+new Date().getTime()+'')
setTimeout("resetmail()",8000);
}
function SendMailData(url){
var pageRequest = false;
if (window.XMLHttpRequest)pageRequest = new XMLHttpRequest();
else if (window.ActiveXObject) pageRequest = new ActiveXObject('MSXML2.XMLHTTP.3.0');
else return false;
pageRequest.onreadystatechange = function() {
try {
if (pageRequest.readyState > 3){ 
 var resp=pageRequest.responseText; 
var tblFailed= $('tblFailed');
var tblSuccess=$('tblSuccess');
var tbldata= $('tbldata');
 if(resp=="y"){
 tblFailed.style.display='none';
 tblSuccess.style.display='';
 tbldata.style.display='none'; 
 }else{ 
 tbldata.style.display='none';
 tblFailed.style.display='';
 tblSuccess.style.display='none'; 
 }
}
}catch(err){} 
}
pageRequest.open('get',url,true);
pageRequest.send(null);
}
function resetmail(){
sendmailok=0;
}
function disableairline(value,domestic){
if(value){
 $("cmbAirline").selectedIndex=0;
 $("cmbAirline").disabled='disabled';
}else{
 $("cmbAirline").disabled='';
}
}
function setdate2(){
$("theDate2").value=$("theDate1").value;
}
function TravelerCount(type){
var adt=parseInt($("cmbAdult").value,10);
var inft=parseInt($("cmbInfant").value,10);
var chld=parseInt($("cmbChild").value,10);
var maxPax=$("cmbAdult").options.length;
if(SelectLength<(adt+chld)){
 alert("Your prefered airline allows only "+ SelectLength +" passengers in a single booking");
 $("cmbInfant").value=0;
 $("cmbChild").value=0;
 $("hidAdultTravCount").value=adt;
 $("hidInfantTravCount").value=0;
 $("hidChildTravCount").value=0;
 if($('chk_All'))
 SetAirlineAndAdult('chk_All');
 return;
}
if (type=='A'){
if(adt<inft){
 alert('Infant travelers cannot be more than Adult travelers because \neach Infant must be accompanied by an Adult.');
 $("hidAdultTravCount").value=adt;
 $("cmbInfant").value=0;
 $("hidInfantTravCount").value=0; 
 return false;
}else{
 $("hidAdultTravCount").value=adt;
}
 }
if (type=='C'){
$("hidChildTravCount").value=$("cmbChild").value;
}
if (type=='I'){
if(adt<inft){
 alert('Infant travelers cannot be more than Adult travelers because \neach Infant must be accompanied by an Adult.');
 $("cmbInfant").value=0;
 $("hidAdultTravCount").value=adt;
 $("hidInfantTravCount").value=0;
 $("hidInfantTravCount").value=0; 
 return false;
}else{
$("hidInfantTravCount").value=inft;
}}

}
function CheckDate(){
var date3=$('hiddate').value;
var date4=$('theDate1').value;
var date3arr=date3.split('/');
var date4arr=date4.split('/');
if (parseInt(date4arr[2],10) < parseInt(date3arr[2],10)){
 $('theDate1').value=date3;
 alert("Invalid date entered, try again");
 }
if (parseInt(date4arr[2],10) == parseInt(date3arr[2],10)){ 
 if (parseInt(date4arr[1],10) < parseInt(date3arr[1],10)){ 
 $('theDate1').value=date3; 
 alert("Invalid date entered, try again");
 } 
 if (parseInt(date4arr[1],10) == parseInt(date3arr[1],10)){ 
 if (parseInt(date4arr[0],10) < parseInt(date3arr[0],10)){ 
 $('theDate1').value=date3; 
 alert("Invalid date entered, try again");
 }
 } 
 }
if (document.getElementById	('optRT').checked==true){
var date1=$('theDate1').value;
var date2=$('theDate2').value;
var date1arr=date1.split('/');
var date2arr=date2.split('/');
if (parseInt(date2arr[2],10) > parseInt(date1arr[2],10))
if (parseInt(date2arr[2],10) < parseInt(date1arr[2],10)){ 
 $('theDate2').value=date1; 
 return;
 }
if (parseInt(date2arr[2],10) == parseInt(date1arr[2],10)){ 
 if (parseInt(date2arr[1],10) > parseInt(date1arr[1],10)) 
 return; 
 if (parseInt(date2arr[1],10) < parseInt(date1arr[1],10)){ 
 $('theDate2').value=date1; 
 return;
} 
if(parseInt(date2arr[1],10) == parseInt(date1arr[1],10)){ 
 if(parseInt(date2arr[0],10) > parseInt(date1arr[0],10))
return; 
 if(parseInt(date2arr[0],10) < parseInt(date1arr[0],10)){
$('theDate2').value=date1;
return;
} 
 if (parseInt(date2arr[0],10) == parseInt(date1arr[0],10))
 return;
 } 
 }
}
}
function enablerd(){
$("theDate2").disabled=false;
$("hiddirection").value='R';
$("cmbRTTime").disabled=false;
$("theDate2").value=$("theDate1").value;
}
function disablerd(){
$("theDate2").value=$("theDate1").value;
$("hiddirection").value='O';
$("theDate2").disabled=true;
$("cmbRTTime").disabled=true;
}
function setdate(){
$("theDate2").value=$("theDate1").value;
}
function checkcity1(){
if ($('cmbDeparture').value=='-----------'){
$('cmbDeparture').selectedIndex=1;
return;
}
if ($('cmbDeparture').value == $('cmbArrival').value){
$('cmbArrival').selectedIndex=$('cmbArrival').selectedIndex+1;
return;
}
}
function checkcity2(){
if ($('cmbArrival').value =='-----------'){
$('cmbArrival').selectedIndex=5;
return;
}
if ($('cmbDeparture').value == $('cmbArrival').value){
$('cmbDeparture').selectedIndex=$('cmbDeparture').selectedIndex-1;
return;
}
}
function checkpass(cmb){
var adlt=parseInt($('cmbAdult').value,10);
var infn=parseInt($('cmbInfant').value,10);
if (infn>adlt){
alert("Infants cannot be more than adult travelers.\nEach infant must be accompanied by an adult.");
$('cmbInfant').selectedIndex=0;
return;
}
var total = parseInt($('cmbAdult').value,10) + parseInt($('cmbChild').value,10);
switch (cmb){
case 'A':
if (total > 4){
$('cmbAdult').selectedIndex=1;
alert("The maximum travelers per booking is 4");
}
return;
case 'C':
if (total > 4){
$('cmbChild').selectedIndex=0;
alert("The maximum travelers per booking is 4");
}
return;
case 'I':
if (total > 4){
$('cmbInfant').selectedIndex=0;
alert("The maximum travelers per booking is 4");
}
return;
}
}
var optLen=3;
function filladult(ind){	
 temp=$("cmbAdult").selectedIndex;
 ind=$("cmbAirline").selectedIndex;		
		var cn=parseInt($("cmbAdult").length);	
	for (var i = cn; i >= 0; i--){
$("cmbAdult").options[i]=null;
 }			
switch (ind){
 case 0:{optLen=3;break;}
 case 1:{var cn=$("cmbAdult").length; optLen=8; break;} 
 case 2:{var cn=$("cmbAdult").length; optLen=6; break; }
 case 3:{var cn=$("cmbAdult").length; optLen=6; break;}
 case 4:{optLen=3; break; }
 case 5:{optLen=3; break;}
 case 6:{optLen=8; break;}
 case 7:{optLen=9;break; }
 case 8:{optLen=8; break; }
 default:{optLen=3; break;}
 }		
for(var i=0; i <=optLen; i++){					
 $("cmbAdult").options[i]= new Option(i+1, i+1);					
}
 $("cmbAdult").selectedIndex=temp;
}
function popup(){
window.open('/flightbooking/pages/airports.aspx','name','height=255,width=360,left=380,top=232,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes'); 
}
function ChangePanelD(){
$('divTo').style.display = 'none';
$('spn_int').style.display = 'none';
$('selArrival').style.display = 'none';
$('cmbArrival').style.display = '';
$('trAirDomestic').style.display = '';
$("chkDirectFlights").checked='checked';
$("chkDirectFlights").disabled='';
$("chkLCC").checked='';
$("chkLCC").disabled='';
try{
$("chkFullfare").checked='';
$("chkFullfare").disabled='disabled';
}catch(err){};
}
function ChangePanelI(){	
 $('divTo').style.display = '';
 $('spn_int').style.display = '';		
 $('selArrival').style.display = '';		
 $('cmbArrival').style.display = 'none';
 $('spn_int').style.display = '';
 $('trAirDomestic').style.display = 'none';
 $('trairinte').style.display = '';
 $("chkDirectFlights").checked='';
 $("chkDirectFlights").disabled='disabled';
 $("cmbAirlineInt").disabled='';
 $("chkLCC").checked='';
 try{
 $("chkFullfare").disabled='';
 }catch(err){};
}
var KeyID;
function preventKeydown(evnt) {
var ev = (evnt) ? evnt : event;
var sender = (ev.target) ? ev.target : ev.srcElement;
var kc = (ev.keyCode) ? ev.keyCode : ev.which; 
KeyID=kc;
if($("tblArr") && $("tblArr").style.display=='inline'){
 trnum=parseInt($('trcnt').innerHTML,10);
if(KeyID=="40"){ 
 
 for(var j=0; j<trnum; j++){				
 $("flt"+j).className="suggest";	
 $("spn"+j).className="suggest0";			 
 }
 knum=knum+1;
 if(knum>trnum-1)knum=trnum-1;			 	 	
	$("flt"+knum).className="suggest2";			
	$("spn"+knum).className="suggest3"; 
	if($('TextBoxFrom')){$('TextBoxFrom').innerHTML=$("flt"+knum).innerHTML; return;} 		
	airport=((($("flt"+knum).innerHTML).split(","))[0]);		 
	country_frm= airport +"- " +((($("flt"+knum).innerHTML).split(","))[1]).split("[")[0];
	country_frm=country_frm.replace("-","- ");
	$("selDeparture").value=country_frm.replace("&amp;","&");
 }
else if(KeyID=="38"){ 
 for(var j=0; j<trnum; j++){
 	$("flt"+j).className="suggest";	
			$("spn"+j).className="suggest0";	
}
	knum=knum-1;
 	if(knum<0)knum=0;
	$("flt"+knum).className="suggest2";			
	 	$("spn"+knum).className="suggest3";		 		
	 	airport=((($("flt"+knum).innerHTML).split(","))[0]);
		country_frm= airport +"- " +((($("flt"+knum).innerHTML).split(","))[1]).split("[")[0];
 country_frm=country_frm.replace("-","- ");
 $("selDeparture").value=country_frm.replace("&amp;","&");
	}else if(KeyID=="13"){ 	 	
		if(knum==-1)knum=0;			
		airport=((($("flt"+knum).innerHTML).split(","))[0]);
		country_frm= airport +"- " +((($("flt"+knum).innerHTML).split(","))[1]).split("[")[0];
		country_frm=country_frm.replace("-","- ");
		val2= $("spn"+knum).innerHTML; 
		callclickDep();
		$("tblArr").style.display='none';
	if($("pp") && $("pp").style.display==''){
		$("pp").style.display='none';
		}
		knum1=-1;
		knum=-1;			
 if(window.event){	 
 if(ev.stopPropagation) {
 ev.preventDefault();
 ev.stopPropagation();				
 }else{ 	
 ev.returnValue=false; 
 ev.cancel = true;
 }
 }else{ 
 ev.preventDefault();
 } 		
	}
}
if($("tblDep") && $("tblDep").style.display=="inline"){ 
trnum1=$('trcnt1').innerHTML;
 if(KeyID=="40"){ 
 		for(var j=0; j<trnum1; j++){
 			$("flt1"+j).className="suggest"; 		
			$("spn1"+j).className="suggest0";	
		 }
 knum1=knum1+1;			
 if(knum1>trnum1-1)knum1=trnum1-1;		
 $("flt1"+knum1).className="suggest2";	
		$("spn1"+knum1).className="suggest3";			 
		airport=((($("flt1"+knum1).innerHTML).split(","))[0])
		country_to= airport +"- " +((($("flt1"+knum1).innerHTML).split(","))[1]).split("[")[0];	
		country_to=country_to.replace("-","- ");	
$("selArrival").value=country_to.replace("&amp;","&");
 }else if(KeyID=="38"){ 			
for(var j=0; j<trnum1; j++){
	$("flt1"+j).className="suggest"; 		
			$("spn1"+j).className="suggest0";
	} 			
knum1=knum1-1;
if(knum1<0)knum1=0;
$("flt1"+knum1).className="suggest2";	
$("spn1"+knum1).className="suggest3";			 
airport=((($("flt1"+knum1).innerHTML).split(","))[0])
country_to=airport +"- " +((($("flt1"+knum1).innerHTML).split(","))[1]).split("[")[0];
country_to=country_to.replace("-","- ");
$("selArrival").value=country_to.replace("&amp;","&");																		 		
 }else if(KeyID=="13"){
if(knum1==-1)knum1=0;	
	airport=((($("flt1"+knum1).innerHTML).split(","))[0]);
	country_to= airport +"- " +((($("flt1"+knum1).innerHTML).split(","))[1]).split("[")[0];	
	country_to=country_to.replace("-","- ");
	country_to=country_to.replace("&amp;","&");		
	val2= $("spn1"+knum1).innerHTML;
	callclickArr(val2);
if($("tblDep")){
	$("tblDep").style.display='none'; 
	}
if($("pp") && $("pp").style.display==''){
	$("pp").style.display='none'; 
}
	knum1=-1;
	knum=-1;
	if(window.event){
 if(ev.stopPropagation) { 
ev.preventDefault();			
ev.stopPropagation();
	}else{						
	ev.returnValue=false; 
	ev.cancel = true;
	}
}else{
 ev.preventDefault();
} 
 }
}
}
function addKeyEventHandler(evnt) {
if (document.addEventListener) {
 document.addEventListener("keydown", preventKeydown, false);
}else {
 document.attachEvent("onkeydown", preventKeydown);
}
}
if (window.addEventListener) {
	 window.addEventListener("load", addKeyEventHandler, false);
}else {
	window.attachEvent("onload", addKeyEventHandler);
}
var txt_to;
var tx_name;
function GetCountry(Rid,e,dom){
if(Rid=='divFrom'){
txt_to=$("selDeparture");
tx_name="selDeparture";
}else{
tx_name="selArrival";
txt_to=$("selArrival");
 }
getleftPos(txt_to)
if(KeyID==40 || KeyID==38 ||KeyID==13 ){
}else{
if(Rid=='divFrom'){ 
key=$('selDeparture').value;
key=key.replace(/^\s+|\s+$/g, '');
if(key.length <3){ 
 if($('suggest')){$('suggest').style.display='none';}
 if($('tblArr')){ $('tblArr').style.display='none'};
 if($("pp")){ $("pp").style.display='none'; } 
 return '';
}else{
 fetchData('/FlightBooking/Pages/fillairports.aspx?date='+new Date().getTime()+'&type='+key+'&fgsec=from&stype=flt&dom='+dom+'', Rid);
}
}else {
key=$('selArrival').value; 
key=key.replace(/^\s+|\s+$/g, '');
if (key.length <3){	
 if($('suggest')){$('suggest').style.display='none';}
 if($('tblDep')){ $('tblDep').style.display='none';}				
 if($("pp1")){$("pp1").style.display='none';}
 return '';
}else{	
 if(key.length>2){
 fetchData('/FlightBooking/Pages/fillairports.aspx?type='+key+'&fgsec=to&stype=flt&dom='+dom+'', Rid);
 }else if(key.length==10000){
 }else if(key.length==10001){
 }else if(key.length==10001){
 }
}
}
}
}
function Eli_overDep(val, arn){
	country_frm="";
	var tarr=($("trcnt").innerHTML);	
	country_frm=val
	for(var j=0; j<tarr; j++){				
		$("flt"+j).className="suggest";			
		$("spn"+j).className="suggest0";					
	}
	$("flt"+arn).className="suggest2";
	$("spn"+arn).className="suggest3";
}
function Eli_overArr(val,arno){	
country_to="";
var tarr=($("trcnt1").innerHTML);
country_to=val;
for(var j=0; j<tarr; j++){				
		$("flt1"+j).className="suggest";	
		$("spn1"+j).className="suggest0";				
	}
 	$("flt1"+arno).className="suggest2";	
	$("spn1"+arno).className="suggest3";
}
var val2, val1;
function callclickArr(val2){ 
 if($('suggest')){
 $('suggest').style.display='none';
 } 
if(val2=='1'){//if val=1 selected dest-Domestic
    document.getElementById('optDom').checked=true;
    document.getElementById('optInt').checked=false;    
	if($("trAirDomestic")) $("trAirDomestic").style.display='';
	if($("trairint")){
	    $("trairint").style.display='none';
	}
	if($("spnOneway").style.display==''){
	        if($("tblRtnSplFare")){
	        if(document.getElementById('ChkRtnGDS'))
	            document.getElementById('ChkRtnGDS').style.display="";
	            $("tblRtnSplFare").style.display='';
	        }
	}else{
	        if($("tblRtnSplFare")){
	            $("tblRtnSplFare").style.display='none';
	        }
	}
}else{
    if(document.getElementById('optDom'))
    document.getElementById('optDom').checked=false;
    if(document.getElementById('optInt'))
    document.getElementById('optInt').checked=true; 	
/*if($('frmDisp')){
document.frmDisp.optDom.checked=false; 
	document.frmDisp.optInt.checked=true; 
}else{
    if(document.form1.optDom){
	document.form1.optDom.checked=false; 
	document.form1.optInt.checked=true; 
	}
}*/
if($('tblRtnSplFare'))
$("tblRtnSplFare").style.display='none';
if($("trairint"))$("trairint").style.display='';
if($("trAirDomestic"))$("trAirDomestic").style.display='none';		
}
if($('tblDep')){
$('tblDep').style.display='none';
}
if($("pp1") && $("pp1").style.display==''){		
$("pp1").style.display='none';
 }

$("selArrival").value=country_to;
$('selArrival').focus();
DisableOthers(false);
}
function callclickDep(val){
 if($('suggest')){
 $('suggest').style.display='none';
 }
$('tblArr').style.display='none';
if($("pp") && $("pp").style.display==''){		
	$("pp").style.display='none';
} 
 $("selDeparture").value=country_frm;
 $('selDeparture').focus();
 DisableOthers(false);
} 
var knum=-1, trnum=0, knum1=-1, trnum1=0;
var country_frm="", country_to="";
function oneway(){
$('spnOneway').style.display='none';
$('theDate2').value="dd/mm/yyyy";
$('opt1W').checked=true; 
$('optRT').checked=false;
$('cmbRTTime').disabled=true;
if($('tblRtnSplFare'))
$('tblRtnSplFare').style.display='none';
}
function getleftPos(inputObj){
var returnValue = inputObj.offsetLeft;
while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
$("divFrom").style.left=returnValue-1+"px";
$("divTo").style.left=returnValue-1+"px";
}
function hotelAdd(){
window.location.href="/hotelReservation/common/pages/hotels.aspx"
}
function fltAdd(){
if( $("cb_flights").checked){
	$("tblFlt").style.display='';
}else{
	$("tblFlt").style.display='none';	
}
}
function returnfalse(){
if($("hidChildTravCount")!=null)
 $("hidChildTravCount").value='0';
if($("hidInfantTravCount")!=null)
 $("hidInfantTravCount").value='0';
return false;
}
var ch=0;
var changeNames=new Array("Cochin:Kochi","Calcutta:Kolkata","Delhi:New Delhi","Bombay:Mumbai","Banglore:Bengalure","Kozhikode:Calicut","Madras:Chennai","Poona:Pune","Thiruchchirapalli:Tiruchirapalli","Thiruvananthapuram:Trivandrum");
function chkNames(txtName){
var changeCnt=0;
var airportName=($(txtName).value).split("-")[0]; 
for(changeCnt=0; changeCnt<changeNames.length; changeCnt++){
 if((changeNames[changeCnt].split(":")[0]).toUpperCase()==airportName.toUpperCase()){
 $(txtName).value=changeNames[changeCnt].split(":")[1]+"- India";
 break; 
 }
}
}
function ShowFlash(evt){ 
var mousex = evt.clientX;
if(mousex=='0'){ 
return false;
}
  if ($("optDom").checked==true){ 
        if ($("optRT").checked==true){   
            if($("ChkRtnGDS").checked==false){                
                if((ShowDia=="Y") || (ShowDia=='')){
                    var answer = confirm("You have not opted for return special fare, Opt return special fare for low attractive fares.")
                if(answer){	
                	return false;           		            
	            }
	            }	           
            }
        }
    }
    
if($("tblArr")){
if($("tblArr").style.display!='none'){ 
	if(knum==-1)knum=0;			
		airport=((($("flt"+knum).innerHTML).split(","))[0]);
		country_frm= airport +"- " +((($("flt"+knum).innerHTML).split(","))[1]).split("[")[0];
		country_frm=country_frm.replace("-","- ");
		val2= $("spn"+knum).innerHTML; 
		callclickDep();
		$("tblArr").style.display='none';
	if($("pp") && $("pp").style.display==''){
		$("pp").style.display='none';
		}
		if($("iframe1")){	 
			$("iframe1").style.display='none'; 
		}
		knum1=-1;
		knum=-1; 
return false;
} 
}
if($("tblDep")){ 
if($("tblDep").style.display!='none'){
if(knum1==-1)knum1=0;	
		airport=((($("flt1"+knum1).innerHTML).split(","))[0]);
		country_to= airport +"- " +((($("flt1"+knum1).innerHTML).split(","))[1]).split("[")[0];	
		country_to=country_to.replace("-","- ");
		country_to=country_to.replace("&amp;","&");		
		val2= $("spn1"+knum1).innerHTML;
		callclickArr(val2);
	if($("tblDep")){	 
			$("tblDep").style.display='none'; 
		}
		if($("tblArr")){	 
			$("tblArr").style.display='none'; 
		}
		if($("iframe1")){	 
			$("iframe1").style.display='none'; 
		}
	if($("pp") && $("pp").style.display==''){
			$("pp").style.display='none'; 
	}
		knum1=-1;
		knum=-1;
return false;
} 
}

if ($("selDeparture").value==""){
 alert("Invalid Departure city selected.");
 return returnfalse();
}
if ($("selArrival").value==""){
 alert("Invalid Arrival city selected");
 return returnfalse();
} 
setSector();
chkNames("selDeparture");
chkNames("selArrival");
if ($("theDate1")!=null){ 
if ($("theDate1").value=="dd/mm/yyyy"){
alert("Please select the Onward journey date");
return returnfalse();
}
} 
 if ($("optRT")!=null && $("optRT").checked) {
 if ($("theDate2")!=null){
if ($("theDate2").value=="dd/mm/yyyy"){
 alert("Please select the Return journey date");
 return false;
 }
 }
 } 
if ($("optDom").checked==true){
if ($("selDeparture").value==$("selArrival").value){
 alert("Departure and Arrival cities cannot be the same");
 return returnfalse();
} 
 }
var adlt=parseInt($('cmbAdult').value,10);
var infn=parseInt($('cmbInfant').value,10);
if (infn > adlt){
 alert("Infants cannot be more than adult travelers.\nEach infant must be accompanied by an adult.");
 $('cmbInfant').selectedIndex=0;
 return returnfalse();
}
var total = parseInt($('cmbAdult').value,10) + parseInt($('cmbChild').value,10);
if($("cmbAdult").options.length<total){
 alert("The maximum travelers allowed per booking is "+$("cmbAdult").options.length);
 $('cmbChild').selectedIndex=0;
 $('cmbInfant').selectedIndex=0;
 return returnfalse();
}
return true;
}
var flNames="";
var SelectLength=9;
function SetAirlineAndAdult(objid,repeat){ 
fltTmCnt=60; 				
if(objid=='chk_All'){
 $("chk_All").checked=true; $("chk_S2").checked=false;
 $("chk_9W").checked=false;$("chk_IT").checked=false;
 $("chk_AI").checked=false;$("chk_IC").checked=false;
 $("chk_SG").checked=false;$("chk_6E").checked=false;
 $("chk_G8").checked=false;$("chk_I7").checked=false;
 $("chk_9H").checked=false;$("chk_IX").checked=false;
 $('compoText').value='All';
 flNames="";
 $("HidIntAirline").value='All'; 
 $("chk_All").checked=true;
 return;
 }
	$("chk_All").checked=false;
var tot=0;
var airlines=''; 
$('compoText').value='';
if(document.getElementById(objid).checked==true){
flNames=flNames+objid.split("_")[1]+",";
}else{
 flNames=flNames.replace((objid.split("_")[1]+","),"") 
}
$("compoText").value=flNames; 
if ($("chk_S2").checked==true){
 airlines=airlines+'S2'+',';
 tot++;
}
if ($("chk_9W").checked==true){
 airlines=airlines+'9W'+',';
 tot++;
}
if ($("chk_IT").checked==true){
 airlines=airlines+'IT'+',';
 tot++;
}
if ($("chk_AI").checked==true){
 airlines=airlines+'AI'+',';
 tot++;
}
if ($("chk_IC").checked==true){
 airlines=airlines+'IC'+',';
 tot++;
}
if ($("chk_SG").checked==true){
 airlines=airlines+'SG'+',';
 tot++;
}
if ($("chk_6E").checked==true){
 airlines=airlines+'6E'+',';
 tot++;
}
if ($("chk_G8").checked==true){
 airlines=airlines+'G8'+',';
 tot++;
}
if ($("chk_I7").checked==true){
 airlines=airlines+'I7'+',';
 tot++;
}
if ($("chk_9H").checked==true){
 airlines=airlines+'9H'+',';
 tot++;
}
 if ($("chk_IX").checked==true){
 airlines=airlines+'IX'+',';
 tot++;
}
if(tot>0){
 if($("chk_All"))
 $("chk_All").checked=false;
 airlines=airlines.substring(0,airlines.length-1);
 $("HidIntAirline").value=airlines;
}else{
 if($("chk_All"))
 $("chk_All").checked=true;
 $("HidIntAirline").value='All';
 $("compoText").value='All';
 airlines='All';
} 
 var ind=objid.split("_")[1];
 var smlNo=9; 
 if(tot>1) {
 temp=0;
 }else{
 ind=airlines;
 }
 if($("compoText")){
 var airlineNo;
 airlineNo=($("compoText").value).split(",");
 if(airlineNo.length>2 && typeof repeat!='undefined'){
 smlNo=SelectLength;
 }
}
switch (ind){
 case 'All':{SelectLength=9; break;}
 case 'S2':{SelectLength=9;break;} 
 case '9W':{SelectLength=7;break;}
 case 'IT':{ SelectLength=7;break;}
 case 'IC':{SelectLength=10;break;}
 case 'AI':{SelectLength=4;break;}
 case 'SG':{SelectLength=9;break;}
 case 'G8':{SelectLength=10;break;}
 case '6E':{SelectLength=9;break;}
 case 'IX':{SelectLength=10;break; }
 case 'I7':{break;}
 case '9H':{SelectLength=8;break;}
 default: {break;} 
}
 if(typeof repeat!='undefined'){ 
return;
}if(smlNo>SelectLength){
 smlNo=SelectLength;
 }else{
 SelectLength=smlNo;
 }
var adt=parseInt($("cmbAdult").value,10);
var inft=parseInt($("cmbInfant").value,10);
var chld=parseInt($("cmbChild").value,10);
var maxPax=$("cmbAdult").options.length;
if(SelectLength<(adt+inft+chld)){
if($('chk_'+ind).checked==true)
 alert("Your prefered airline allows only "+ SelectLength +" passengers in a single booking");
$('chk_'+ind).checked=false;
 SetAirlineAndAdult('chk_'+ind,1);
}
}
