<!--
function getmonthnum(mon)
{
if(mon=="JAN") return 1
if(mon=="FEB") return 2
if(mon=="MAR") return 3
if(mon=="APR") return 4
if(mon=="MAY") return 5
if(mon=="JUN") return 6
if(mon=="JUL") return 7
if(mon=="AUG") return 8
if(mon=="SEP") return 9
if(mon=="OCT") return 10
if(mon=="NOV") return 11
if(mon=="DEC") return 12
}

function getmonthname(mon)
{
if(mon=="0") return "January"
if(mon=="1") return "February"
if(mon=="2") return "March"
if(mon=="3") return "April"
if(mon=="4") return "May"
if(mon=="5") return "June"
if(mon=="6") return "July"
if(mon=="7") return "August"
if(mon=="8") return "September"
if(mon=="9") return "October"
if(mon=="10") return "November"
if(mon=="11") return "December"
}

function isdate(dtstr)
{
var d=dtstr.substr(0,2);
var m=getmonthnum(dtstr.substr(2,3));
var y=dtstr.substr(5,8);
if (d < 1 || d > 31) 
{
    alert("Day must be between 1 and 31"); //Days must be between 1 and 31
    return false;
}

if ((m==4 || m==6 || m==9 || m==11) && d==31) 
{
     alert("Month "+m+" doesn't have 31 days!"); // alert("Month "+m+" doesn't have 31 days!")
    return false;
}

if (m==2) 
{ // check for february 29th
    var isleap = (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));
    if (d > 29 || (d==29 && !isleap)) 
    {
         alert("February " + y + " doesn't have " + d + " days!"); // alert("February " + y + " doesn't have " + d + " days!");
        return false;
    }
}
return true; // date is valid
}

//-->

      var xmlDoc = null ;
  
  
      function load() {
//        alert('for dropdownlist');  
        if (typeof window.ActiveXObject != 'undefined' ) {
			//alert('in first if');  
          xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
          xmlDoc.onreadystatechange = process ;
        }
        else {
//        alert('in first else');  
          xmlDoc = new XMLHttpRequest();
          xmlDoc.onload = process ;
        }
        //<IndexQuery><CompanyId>UK</CompanyId><LangCode>GB</LangCode><UserId></UserId></IndexQuery>
        xmlDoc.open( "GET", "airlinepref.aspx?str=.6.IndexQuery.7..6.CompanyId.7.UK.6./CompanyId.7..6.LangCode.7.GB.6./LangCode.7..6.UserId.7..6./UserId.7..6./IndexQuery.7.", true );
        xmlDoc.send( null );
      }
  
      function process() {
        if ( xmlDoc.readyState != 4 ) return ;
        var result=xmlDoc.responseText;
        //alert(result);
        var arr1;
        var arr2;
        var i,j;
        var strAir=''
        //alert(strAir);
        arr1 = result.split("*")
        i=0;
        while (i < arr1.length-1)
		{
			arr2=arr1[i].split(",");	
			
			document.forms['fexp'].preair.options[i+1] = new Option(arr2[1],arr2[0]);
			//alert(arr2[1]);
			if (arr2[1].toLowerCase()==strAir.toLowerCase())
			{
			//alert(arr2[0]);			
			document.forms['fexp'].preair.value=arr2[0]
			}
			
			i++;		
		}
      }
  
      </script>



	


function checkinputtxt(objtxt,extra_char,msg)
{
    var valid_char ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + extra_char
	if (objtxt.value!="") 
	{
	for (var i=0;i<objtxt.value.length;i++)
        { 
        	var str = objtxt.value.charAt(i);
			if (valid_char.indexOf(str)==-1)
			   { 
			   alert(msg)
			   objtxt.focus();
			   objtxt.select();
			   return false;
			   }
    
         }
     }
    return true;
}

function checkinputnum(objnum,extra_char,msg)
{
    var valid_char ="0123456789" + extra_char
	if (objnum.value!="") 
	{
	for (var i=0;i<objnum.value.length;i++)
        { 
        	var str = objnum.value.charAt(i);
			if (valid_char.indexOf(str)==-1)
			   { 
			   alert(msg)
			   objnum.focus();
			   objnum.select();
			   return false;
			   }
    
         }
     }
     return true;
}

function cancels()
{
	//var ans=window.confirm("Do you Want to cancel your booking?")
	var ans=window.confirm("Do you Want to cancel your booking?")
	if (ans)
	{
		document.cancelform.submit(); 
	}
}


function searchonkey()
{
	if(window.event.keyCode==13)
	{
	
		 if (window.event.srcElement.name !="button1")
		 {
			fexpcheck(document.fexp)		
		 }
	}
}


function fexpcheck(df)
{

	var count;
	count=0
  now= new Date()


	if (df.depapt.value=="")
	{
	//alert("Please enter the Departure name.")
		alert("Please enter the Departure name.");
		df.depapt.focus();
		return false;
	}
	
	
	if (df.ariapt.value=="")
	{
		//alert("Please enter the arrival airport name.")
		alert("Please enter the arrival airport name.");
		df.ariapt.focus();
		return false;
	}
	
	if((df.txtpickday.value=="")||(df.txtpickday.value.charAt(0)==" "))
		{
			//alert("Please enter a value for the Departure date.")
			alert("Please enter a value for the Departure date.");
		//	alert(df.selpickmonthyear.value);
		//now= new Date();

		//alert(now.getDate());
		//alert(now.getMinutes());	
			df.txtpickday.focus();
			return false;
		}
	
	/*if(df.txtpickday.value<=(now.getDate()+3)&&(df.selpickmonthyear.value==now.getYear()))
	{
	alert("d");
	 return false;
	}*/
	if (isNaN(df.txtpickday.value))
		{
			//alert("Please enter a numeric value for the Departure date.");
			alert("Please enter a numeric value for the Departure date.");
			df.txtpickday.focus();
			return false;
		}	

	if (parseFloat(df.txtpickday.value)<=0)
		{
			//alert("Please enter Departure date correctly.");
			alert("Please enter Departure date correctly.");
			df.txtpickday.focus();
			return false;
		}	

	if (df.oneret.item(1).checked==false)
	{
	if((df.txtdropday.value=="")||(df.txtdropday.value.charAt(0)==" "))
		{
			//alert("Please enter a value for the Return date.")
			alert("Please enter a value for the Return date.")
			df.txtdropday.focus();
			return false;
		}
	
	if (isNaN(df.txtdropday.value))
		{
			//alert("Please enter a numeric value for the Return date.");
			alert("Please enter a numeric value for the Return date.");
			df.txtdropday.focus();
			return false;
		}	

	if (parseFloat(df.txtdropday.value)<=0)
		{
			//alert("Please enter Return date correctly.");
			alert("Please enter Return date correctly.");
			df.txtdropday.focus();
			return false;
		}	
	}
	
	if(parseFloat(df.txtpickday.value)<10)
	{
		var txtpickday="0" + parseFloat(df.txtpickday.value);
		//var txtpickday=parseFloat(df.txtpickday.value);
	}
	else
	{
		var txtpickday=parseFloat(df.txtpickday.value);
	}
	
	if (df.oneret.item(1).checked==false)
	{
	if(parseFloat(df.txtdropday.value)<10)
	{
		var txtdropday="0" + parseFloat(df.txtdropday.value);
	}
	else
	{
		var txtdropday=parseFloat(df.txtdropday.value);
	}
	}
	

	df.depdt.value=txtpickday + "" + df.selpickmonthyear.value;

	if (df.oneret.item(1).checked==false)
	{
	  df.retdt.value=txtdropday + "" + df.seldropmonthyear.value;
	}
	
    if (df.oneret.item(1).checked==true)
	{
	 if(df.retdt.value.length<9)
	  {
	    df.retdt.value="0"+df.retdt.value;
	  }  	    
	} 
  
    
	if(isdate(df.depdt.value)==false)
	{
		return false;
	}

	if (df.oneret.item(1).checked==false)
	{
	if(isdate(df.retdt.value)==false)
	{
		return false;
	}
	}
	
	var currdate
	currdate = new Date();
	tdmon=currdate.getMonth()+1;
	
	//stripped=tdmon+'-'+currdate.getDate()+'-'+currdate.getYear();
	// note: In this format Date.parse doesn't works , so fetch month name's three character from Retrievecookies.aspx file   (change by santosh)
	stripped=currdate.getFullYear()+',' + getmonthname(tdmon-1).substring(0,3).toUpperCase()+','+currdate.getDate();
	currdate= new Date(stripped);
	var tmpdepdt=df.depdt.value;
	tmpdepdt=tmpdepdt.substring(5)+','+tmpdepdt.substring(2,5)+','+tmpdepdt.substring(0,2);
	tmpdepdt=new Date(tmpdepdt);
	
	
	
	
	
	
	//alert(Date.parse(tmpdepdt));
	//alert(Date.parse(currdate));
				
  if(Date.parse(tmpdepdt) < Date.parse(currdate))
	{
		//alert("Departure date can't be less than Current date.")
		alert("Departure date can't be less than Current date.");
		return false;
	} 
	
	
	  
		
	//Check Advance Booking Time  	
	var dayLimit;
	//dayLimit=parseInt(df.AdvBookingTime.value)/24;
	var today=new Date()
	var AdvBookingTimenew=72
	today.setHours(today.getHours()+AdvBookingTimenew)
	
	//today.setHours(today.getHours()+ parseInt(df.AdvBookingTime.value))
//	today.setDate(today.getDate()+ dayLimit)
	var theyear=today.getFullYear()
	var themonth=today.getMonth()+1
	var thetoday=today.getDate()
	//var thehr=today.getHours()+parseInt(df.AdvBookingTime.value)
	
	var thehr=today.getHours()+AdvBookingTimenew
	var newDate=new Date(theyear + "/" + themonth + "/" + thetoday)
	//alert(newDate);
	if (Date.parse(tmpdepdt) < Date.parse(newDate))
	{
//		alert("Travel date can not be within " + df.AdvBookingTime.value + " Hrs. Please select a later date.");
		//alert(" Travel date can not be within " + df.AdvBookingTime.value + "  Hrs. Please select a later date.");
		alert(" Travel date can not be within " + AdvBookingTimenew + "  Hrs. Please select a later date.");
		df.txtpickday.focus();
		return false;
	}

	if (df.oneret.item(1).checked==false)
	{
	  var tmpretdt=df.retdt.value;
		tmpretdt=tmpretdt.substring(5)+','+tmpretdt.substring(2,5)+','+tmpretdt.substring(0,2);
		tmpretdt=new Date(tmpretdt);
		//if(Date.parse(df.depdt.value) > Date.parse(df.retdt.value))
	   if(Date.parse(tmpdepdt) > Date.parse(tmpretdt))  
	
		{
				//alert("Departure date can't be more than Return date.")
			alert("Departure date can't be more than Return date.");
			return false;
		}
	}
    
	if ((document.fexp.noa.value=="") || isNaN(document.fexp.noa.value))
	{
		document.fexp.noa.value=0
	}
	if ((document.fexp.noc.value=="") || isNaN(document.fexp.noc.value))
	{
		document.fexp.noc.value=0
	}
	if ((document.fexp.noi.value=="") || isNaN(document.fexp.noi.value))
	{
		document.fexp.noi.value=0
	}

    if ((document.fexp.noa.value=="")||(parseInt(document.fexp.noa.value)<1))
    {
	  	//alert("Atleast One Adult Required")
	  	alert("Atleast One Adult Required");
	  	document.fexp.noa.focus();
	  	return false;
    }

    if ((parseInt(document.fexp.noa.value) + parseInt(document.fexp.noc.value) + parseInt(document.fexp.noi.value)) > 9)
    {
	  	  //	alert("Number of passengers should not exceed 9");
	  alert("Number of passengers should not exceed 9");
	  	document.fexp.noa.focus();
	  	return false;
    } 

	if(parseInt(document.fexp.noi.value)>parseInt(document.fexp.noa.value))
	{
		//var infcon=confirm("Number of Infant should not be greater than Number of Adult.\nSo extra infant should be considered as child.\nWant to proceed.....")
		var infcon=window.confirm("Number of Infant should not be greater than Number of Adult.\nSo extra infant should be considered as child.\nWant to proceed.....");
		if (infcon)
		{
		var chd=parseInt(document.fexp.noi.value)-parseInt(document.fexp.noa.value)
		document.fexp.noc.value=parseInt(document.fexp.noc.value)+parseInt(chd)
		document.fexp.noi.value=document.fexp.noa.value
		}
		else
		{
		return false;
		}
	}


	for(i=0;i<document.fexp.preair.length;i++)
	{
		if (document.fexp.preair.options[i].selected==true)
			count++;
	}	
	if (count > 3) 
	{
		if(prefdiv.style.visibility=="hidden")		
			hideshowpref()
			//alert("You can select upto three airlines")
			alert("You can select upto three airlines");
			return false;
	}

	//df.action="air_check.aspx"
	
	df.submit();
}

function hideshowpref()
{

if(document.getElementById("prefdiv").style.visibility=="hidden")
{
document.getElementById("prefdiv").style.position="" 
document.getElementById("prefdiv").style.visibility="visible"
document.getElementById("morebut").style.visibility="hidden"
document.getElementById("lessbut").style.visibility="visible"

}  
else
{

document.getElementById("prefdiv").style.top=-500
document.getElementById("prefdiv").style.left=-500 
document.getElementById("prefdiv").style.position="absolute" 
document.getElementById("prefdiv").style.visibility="hidden"
document.getElementById("morebut").style.visibility="visible"
document.getElementById("lessbut").style.visibility="hidden"

}

}

function opencalender(pth,frmdt,currdate,flag,track)
{
	var crdate
	crdate=currdate
	if(crdate.length==9)
	  crdate=crdate.substring(0,2)+" "+crdate.substring(2,5)+" " +crdate.substring(5);
	
	window.open(pth + "&frmdt=" + frmdt + "&curdate=" + crdate + "&flag=" + flag + "&track=" + track ,'Calender','height=194,width=186,left=160,top=232')
}

function searchcity(nav)
{
	if (nav=="from")
	{
		if (document.fexp.depapt.value!="")
		{
		citypath="http://193.203.73.147/skylorduk/asp/searchcity3.asp?language=GB&paste=from&onlycity=true&txtcity=" + document.fexp.depapt.value		
		}
		else
		{
		citypath="http://193.203.73.147/skylorduk/asp/searchcity1.asp?paste=from"
		}
		window.open(citypath,"searchcity","width=650,height=400,top=80,left=70,scrollbars=yes")
	}
	if (nav=="to")
	{
		if (document.fexp.ariapt.value!="")
		{
		citypath="http://193.203.73.147/skylorduk/asp/searchcity3.asp?language=GB&paste=to&onlycity=true&txtcity=" + document.fexp.ariapt.value		
		}
		else
		{
		
		citypath="http://193.203.73.147/skylorduk/asp/searchcity1.asp?paste=to"
		
		}
		window.open(citypath,"searchcity","width=650,height=400,top=80,left=70,scrollbars=yes")
		
	}

	if (nav=="ofrom")
	{
		if (document.fexp.odepapt.value!="")
		{
		citypath="http://193.203.73.147/skylorduk/asp/searchcity3.asp?language=GB&paste=ofrom&onlycity=true&txtcity=" + document.fexp.odepapt.value		
		}
		else
		{
		citypath="http://193.203.73.147/skylorduk/asp/searchcity1.asp?paste=ofrom"
		}
		window.open(citypath,"searchcity","width=650,height=400,top=80,left=70,scrollbars=yes")
	}
	if (nav=="oto")
	{
		if (document.fexp.oariapt.value!="")
		{
		citypath="http://193.203.73.147/skylorduk/asp/searchcity3.asp?language=GB&paste=oto&onlycity=true&txtcity=" + document.fexp.oariapt.value		
		}
		else
		{
		citypath="http://193.203.73.147/skylorduk/asp/searchcity1.asp?paste=oto"
		}
		window.open(citypath,"searchcity","width=650,height=400,top=80,left=70,scrollbars=yes")
	}
	if (nav=="stop")
	{
		citypath="http://193.203.73.147/skylorduk/asp/searchcity1.asp?paste=stop"
		window.open(citypath,"searchcity","width=650,height=400,top=80,left=70,scrollbars=yes")
	}


}

//-->

<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  document.getElementById("col").style.height=80;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
	if(v=='hidden')
	{
	 document.getElementById("col").style.height=0;
	}
}
//-->
