function FHcheckrequired(which) {

if(document.FltHtlSearch.FHDestFrom.value=="Please Enter Departure Airport")
{
	alert("Enter Atleast Three Characters of Departure Airport Code Or Name.")
	document.FltHtlSearch.FHDestFrom.focus();
	return false;
}
else
{
	if(document.FltHtlSearch.FHDestFrom.value.length<3)
	{
			alert("Enter Atleast Three Characters of Departure Airport Code Or Name.")
			document.FltHtlSearch.FHDestFrom.focus();
			return false;
	}
}
if(document.FltHtlSearch.FHDestTo.value=="Please Enter Your Destination")
{
	alert("Enter Atleast Three Characters of Arrival Airport Code Or Name.")
	document.FltHtlSearch.FHDestTo.focus();
	return false;
}
else
{
	if(document.FltHtlSearch.FHDestTo.value.length<3)
	{
		alert("Enter Atleast Three Characters of Arrival Airport Code Or Name.")
		document.FltHtlSearch.FHDestTo.focus();
		return false;
	}
}

if(fHDateValidation()==false)
{
			return false;
}		
if(document.FltHtlSearch.FHrequiredFirstName.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.FltHtlSearch.FHrequiredFirstName.focus();
return false;
}
if(document.FltHtlSearch.FHrequiredLastName.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.FltHtlSearch.FHrequiredLastName.focus();
return false;
}
if(document.FltHtlSearch.FHrequiredPhone.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.FltHtlSearch.FHrequiredPhone.focus();
return false;
}
if(document.FltHtlSearch.FHrequiredEmail.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.FltHtlSearch.FHrequiredEmail.focus();
return false;
}
if(document.FltHtlSearch.FHrequiredConfEmail.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.FltHtlSearch.FHrequiredConfEmail.focus();
return false;
}
if (document.FltHtlSearch.FHrequiredConfEmail.value!="")
{
	if (document.FltHtlSearch.FHrequiredEmail.value!=document.FltHtlSearch.FHrequiredConfEmail.value)
	{
		alert("Email address must be same")
		document.FltHtlSearch.FHrequiredEmail.focus();
		return false;
	}
}
return emailCheck(document.FltHtlSearch.FHrequiredEmail.value);
}



function checkrequired(which) {

if(document.FlightSearch.FDestFrom.value=="Please Enter Departure Airport")
{
	alert("Enter Atleast Three Characters of Departure Airport Code Or Name.")
	document.FlightSearch.FDestFrom.focus();
	return false;
}
else
{
	if(document.FlightSearch.FDestFrom.value.length<3)
	{
			alert("Enter Atleast Three Characters of Departure Airport Code Or Name.")
			document.FlightSearch.FDestFrom.focus();
			return false;
	}
}
if(document.FlightSearch.FDestTo.value=="Please Enter Your Destination")
{
	alert("Enter Atleast Three Characters of Arrival Airport Code Or Name.")
	document.FlightSearch.FDestTo.focus();
	return false;
}
else
{
	if(document.FlightSearch.FDestTo.value.length<3)
	{
		alert("Enter Atleast Three Characters of Arrival Airport Code Or Name.")
		document.FlightSearch.FDestTo.focus();
		return false;
	}
}

if(fDateValidation()==false)
{
	return false;
}
if(document.FlightSearch.FrequiredFirstName.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.FlightSearch.FrequiredFirstName.focus();
return false;
}
if(document.FlightSearch.FrequiredLastName.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.FlightSearch.FrequiredLastName.focus();
return false;
}
if(document.FlightSearch.FrequiredPhone.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.FlightSearch.FrequiredPhone.focus();
return false;
}
if(document.FlightSearch.FrequiredEmail.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.FlightSearch.FrequiredEmail.focus();
return false;
}
if(document.FlightSearch.FrequiredConfEmail.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.FlightSearch.FrequiredConfEmail.focus();
return false;
}
if (document.FlightSearch.FrequiredConfEmail.value!="")
{
	if (document.FlightSearch.FrequiredEmail.value!=document.FlightSearch.FrequiredConfEmail.value)
	{
		alert("Email address must be same")
		document.FlightSearch.FrequiredEmail.focus();
		return false;
	}
}
return emailCheck(document.FlightSearch.FrequiredEmail.value);
}




function Hcheckrequired(which) {

if(document.HotelSearch.HDestTo.value=="Please Enter Your Destination")
{
	alert("Enter Atleast Three Characters of Arrival Airport Code Or Name.")
	document.HotelSearch.HDestTo.focus();
	return false;
}
else
{
	if(document.HotelSearch.HDestTo.value.length<3)
	{
		alert("Enter Atleast Three Characters of Arrival Airport Code Or Name.")
		document.HotelSearch.HDestTo.focus();
		return false;
	}
}

if(hValidateSearch()==false)
{
			return false;
}	

if(document.HotelSearch.HrequiredFirstName.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.HotelSearch.HrequiredFirstName.focus();
return false;
}
if(document.HotelSearch.HrequiredLastName.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.HotelSearch.HrequiredLastName.focus();
return false;
}
if(document.HotelSearch.HrequiredPhone.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.HotelSearch.HrequiredPhone.focus();
return false;
}
if(document.HotelSearch.HrequiredEmail.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.HotelSearch.HrequiredEmail.focus();
return false;
}
if(document.HotelSearch.HrequiredConfEmail.value=="")
{
alert("All fields marked * are mandatory.\nPlease ensure that mandatory information is properly entered.");
document.HotelSearch.HrequiredConfEmail.focus();
return false;
}
if (document.HotelSearch.HrequiredConfEmail.value!="")
{
	if (document.HotelSearch.HrequiredEmail.value!=document.HotelSearch.HrequiredConfEmail.value)
	{
		alert("Email address must be same")
		document.HotelSearch.HrequiredEmail.focus();
		return false;
	}
}
return emailCheck(document.HotelSearch.HrequiredEmail.value);
}


function FlightHotelSearch_groptravel()  //return for flthtlsearch.aspx 
{
		var adValue,twValue,doValue,siValue,triValue,total;
		adValue=new Number(document.FltHtlSearch.FHAdult.value);
		chValue=new Number(document.FltHtlSearch.FHChild.value);
		invalue=new Number(document.FltHtlSearch.FHInfant.value);
		siValue=new Number(document.FltHtlSearch.FHSngRoom.value);
		twValue=new Number(document.FltHtlSearch.FHTwnRoom.value);
		doValue=new Number(document.FltHtlSearch.FHDblRoom.value);
		triValue=new Number(document.FltHtlSearch.FHTplRoom.value);
		
		twValue=twValue*2
		doValue=doValue*2
		triValue=triValue*3
		total=(twValue+doValue+siValue+triValue)
		if(adValue == 0)
			{
			alert("Invalid Room Selection.")
			document.FltHtlSearch.FHAdult.focus();
			return false;
			}
			else if (chValue==0 && invalue==0)
			{
			 if(total!=adValue)
              {
              if((document.FltHtlSearch.FHDblRoom.value==adValue) && (document.FltHtlSearch.FHSngRoom.value==0) && (document.FltHtlSearch.FHTwnRoom.value==0) && (document.FltHtlSearch.FHTplRoom.value==0))
               {
                  return true;
               }
               else
               {
                  alert("Invalid Room Selection.")
                  document.FltHtlSearch.FHAdult.focus();
                  return false;
               }
              }
			}
			else if (chValue>0 && invalue==0)
			{ 
			var adchtotal=chValue+adValue
				if (adchtotal>9)
  				{
				alert("Total no of person should not be more than 9")
				document.FltHtlSearch.FHAdult.focus();
				return false;
				}
				
				if ((doValue==adValue || twValue==adValue || (twValue+doValue)==adValue || total==adValue ) && chValue<=adValue/2 )
				{
				if (total!=adValue )
					{
					alert("Invalid Room Selection.")
					document.FltHtlSearch.FHAdult.focus();
					return false;
					}
				}
				else if (total!=adchtotal)
 	 			{
				alert("Invalid Room Selection.")
				document.FltHtlSearch.FHAdult.focus();
				return false;
    	     	}
			}
			else if (chValue==0 && invalue>0)
			{
			var inadtotal=invalue+adValue
  			if (inadtotal>9)
  				{
				alert("Total no of person should not be more than 9")
				document.FltHtlSearch.FHAdult.focus();
				return false;
  				}

				if (invalue>adValue)
			  	{
				alert("Number of infants should be equal to or less then number of adults")
				document.FltHtlSearch.FHAdult.focus();
				return false;
			  	}
				else if(total!=adValue)
				{
				alert("Invalid Room Selection.")
				document.FltHtlSearch.FHAdult.focus();
				return false;
				}
			}
			else if (chValue>0 && invalue>0)
			{
			var chinadtotal=invalue+adValue+chValue
			if (chinadtotal>9)
  				{
				alert("Total no of person should not be more than 9")
				document.FltHtlSearch.FHAdult.focus();
				return false;
               }
			   
			if (invalue>adValue)
  				{
				alert("Number of infants should be equal to or less then number of adults")
				document.FltHtlSearch.FHAdult.focus();
				return false;
  				}


			if ((doValue==adValue || twValue==adValue || (twValue+doValue)==adValue || total==adValue) && chValue<=adValue/2 && invalue<=adValue)
				{
				if (total!=adValue )
					{
					alert("Invalid Room Selection.")
					document.FltHtlSearch.FHAdult.focus();
					return false;
					}
				}

		 if(total!=adValue+chValue)
				{
				alert("Invalid Room Selection.")
				document.FltHtlSearch.FHAdult.focus();
				return false;
				}
		}	
		if(document.FltHtlSearch.FHDestFrom.value==document.FltHtlSearch.FHDestTo.value)
			{
				alert(" Departure Airport and Destination Airport can't be same");
				document.FltHtlSearch.FHDestTo.focus();
				return false;
			}

}
function checkfields(event,in_id,validation_type) 
{
	var key = null;
	if (window.event) 
	{
		//ie
		key = window.event.keyCode;
	}
	 else if (event.which)
	 {	    
		//Mozilla,Safari
		key = event.which;
	 }

	if (key != null) 
	{
		if(validation_type=='string_data')
		{	
			if ((key  > 64 && key  < 91) || (key  > 96 && key  < 123) || (key==32)) 
			{
			event.returnValue = true; 
			} 
			else 
		{
			event.returnValue = false;
		}			
		}
		if(validation_type=='num_data')
		{
		
			if (key >= 48 && key <= 57)	 
			{
			event.returnValue = true; 
			} 
			else 
		    {			
			event.returnValue = false;
		     }
			
		}
		if(validation_type=='add_data')
		{
		
			if ((key > 32 && key < 48) || (key > 57 && key < 65) || (key > 90 && key < 97) || (key == 126) || (key == 124) || (key == 125) || (key == 123))
			{
			event.returnValue = false; 
			} 
			else 
		    {			
			event.returnValue = true;
		    }
			
		}

	}
}

function txtKeywordKeyPress(f,key)
{
 if(key=="num")
 {
  var re = /^[0-9]*$/;
  if (!re.test(f.value))
  {  
   f.value = f.value.replace(/[^0-9]/g,"");
  }
 }
 else if (key=="str")
 {
  var re = /^[a-z]*$/;
  if (!re.test(f.value))
  {  
   f.value = f.value.replace(/[^A-Z]/g,"");
  }
} 
}

function UperCase(Textboxid)
{
var txtval=Textboxid
var abc
abc=document.getElementById(txtval).value.toUpperCase()
document.getElementById(txtval).value=document.getElementById(txtval).value.toUpperCase()
}

function LowerCase(Textboxid)
{
var txtval=Textboxid
var abc
abc=document.getElementById(txtval).value.toLowerCase()
alert(abc);
document.getElementById(txtval).value=document.getElementById(txtval).value.toLowerCase()
}


function fHDateValidation()
{
var CurrDateTemp=document.getElementById("CurrDate").value;
var DeptDateTemp=document.getElementById("FHDptMMYear").value;


var CurrDate= new Date(parseInt(CurrDateTemp.substring(4,8),10),parseInt(parseInt(CurrDateTemp.substring(2,4),10)-1,10) , parseInt(parseInt(CurrDateTemp.substring(0,2),10)+1));
var Dptdate= new Date(parseInt(DeptDateTemp.substring(2,6),10),parseInt(parseInt(DeptDateTemp.substring(0,2),10)-1,10) , parseInt(document.getElementById("FHDptDate").value,10));
if(Dptdate<=CurrDate)
	{
	alert("IF DEPARTURE IS WITHIN 48 HOURS, PLEASE CONTACT OUR RESERVATIONS DEPARTMENT ON 020 8518 9708");
	document.getElementById("FHDptMMYear").focus();
	return false;
	}

	DeptDateTemp=document.getElementById("FHRetMMYear").value;
	var RetDate= new Date(parseInt(DeptDateTemp.substring(2,6),10),parseInt(parseInt(DeptDateTemp.substring(0,2),10)-1,10) , parseInt(document.getElementById("FHRetDate").value,10));
	if(RetDate<=Dptdate)
		{
		alert("Return Date Must be greater than Depart date");
		document.getElementById("FHRetMMYear").focus();
		return false;
		}
}


function hValidateSearch() 
{
        var DFrom=0
		var twnRoom,dblRoom,sngRoom,tplRoom,total
		if(hDateValidation()==false)
		{
			
			return false;
		}	
		twnRoom=new Number(document.HotelSearch.HTwnRoom.value)
		dblRoom=new Number(document.HotelSearch.HDblRoom.value)
		sngRoom=new Number(document.HotelSearch.HSngRoom.value)
		tplRoom=new Number(document.HotelSearch.HTplRoom.value)
		total=(twnRoom+dblRoom+sngRoom+tplRoom)
		if(total<1)
		{
		alert("Please select a room type")
		document.HotelSearch.HSngRoom.value;
		return false;
		}
return true;
}

function hDateValidation()
{
	var CurrDateTemp=document.getElementById("CurrDate").value;
var DeptDateTemp=document.getElementById("HDptMMYear").value;


var CurrDate= new Date(parseInt(CurrDateTemp.substring(4,8),10),parseInt(parseInt(CurrDateTemp.substring(2,4),10)-1,10) , parseInt(parseInt(CurrDateTemp.substring(0,2),10)+1));
var Dptdate= new Date(parseInt(DeptDateTemp.substring(2,6),10),parseInt(parseInt(DeptDateTemp.substring(0,2),10)-1,10) , parseInt(document.getElementById("HDptDate").value,10));
if(Dptdate<=CurrDate)
	{
	alert("IF DEPARTURE IS WITHIN 48 HOURS, PLEASE CONTACT OUR RESERVATIONS DEPARTMENT ON 020 8518 9708");
	document.getElementById("HDptMMYear").focus();
	return false;
	}

	DeptDateTemp=document.getElementById("HRetMMYear").value;
	var RetDate= new Date(parseInt(DeptDateTemp.substring(2,6),10),parseInt(parseInt(DeptDateTemp.substring(0,2),10)-1,10) , parseInt(document.getElementById("HRetDate").value,10));
	if(RetDate<=Dptdate)
		{
		alert("Return Date Must be greater than Depart date");
		document.getElementById("HRetMMYear").focus();
		return false;
		}
					
}




function getMonthNameString(num)
{
	var ll=num;
	if(ll==1)
	return "Jan"
	if(ll==2)
	return "Feb"
	if(ll==3)
	return "Mar"
	if(ll==4)
	return "Apr"
	if(ll==5)
	return "May"
	if(ll==6)
	return "Jun"
	if(ll==7)
	return "Jul"
	if(ll==8)
	return "Aug"
	if(ll==9)
	return "Sep"
	if(ll==10)
	return "Oct"
	if(ll==11)
	return "Nov"
	if(ll==12)
	return "Dec"
}

function emailCheck (emailStr) {
var checkTLD=1;
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);
if (matchArray==null) {
alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];
for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}
if (user.match(userPat)==null) {
alert("The username doesn't seem to be valid.");
return false;
}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
return false;
   }
}
if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}
if (len<2) {
alert("This address is missing a hostname!");
return false;
}
return true;
}


function fDateValidation()
{
var CurrDateTemp=document.getElementById("CurrDate").value;
var DeptDateTemp=document.getElementById("FDptMMYear").value;


var CurrDate= new Date(parseInt(CurrDateTemp.substring(4,8),10),parseInt(parseInt(CurrDateTemp.substring(2,4),10)-1,10) , parseInt(parseInt(CurrDateTemp.substring(0,2),10)+1));
var Dptdate= new Date(parseInt(DeptDateTemp.substring(2,6),10),parseInt(parseInt(DeptDateTemp.substring(0,2),10)-1,10) , parseInt(document.getElementById("FDptDate").value,10));
if(Dptdate<=CurrDate)
	{
	alert("IF DEPARTURE IS WITHIN 48 HOURS, PLEASE CONTACT OUR RESERVATIONS DEPARTMENT ON 020 8518 9708");
	document.getElementById("FDptMMYear").focus();
	return false;
	}
	DeptDateTemp=document.getElementById("FRetMMYear").value;
	var RetDate= new Date(parseInt(DeptDateTemp.substring(2,6),10),parseInt(parseInt(DeptDateTemp.substring(0,2),10)-1,10) , parseInt(document.getElementById("FRetDate").value,10));
	if(RetDate<=Dptdate)
			{
			alert("Return Date Must be greater than Depart date");
			document.getElementById("FRetMMYear").focus();
			return false;
			}

}

function MM_showHideLayers1(divflag)
{
if(divflag==1)
{
document.getElementById("flight").style.display="block";
document.getElementById("flthtl").style.display="none";
document.getElementById("hotel").style.display="none";
document.getElementById("Flight1").checked=true;}
else if(divflag==2)
{
document.getElementById("hotel").style.display="block";
document.getElementById("flthtl").style.display="none";
document.getElementById("flight").style.display="none";
document.getElementById("Hotel1").checked=true;
}
else
{
document.getElementById("flthtl").style.display="block";
document.getElementById("flight").style.display="none";
document.getElementById("hotel").style.display="none";
document.getElementById("Flighthotel1").checked=true;
}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}




function hValidateSearch(which) //
{
	var sngRoom,twnRoom,dblRoom,tplRoom,total;
	sngRoom=new Number(which.HSingle.value);
	twnRoom=new Number(which.HTwin.value);
	dblRoom=new Number(which.HDouble.value);
	tplRoom=new Number(which.HTriple.value);
	total=(twnRoom+dblRoom+sngRoom+tplRoom)
	if(hDateValidation(which)==false)
	{
	return false;
	}

	if(total<1)
	{
	alert("Please select a room type.")
	which.HSingle.focus();
	return false;
	}
return true;
}
function hDateValidation(which)
{

	var currDate=new Date(parseInt(which.CurrDate.value.substr(4,4),10),parseInt(parseInt(which.CurrDate.value.substr(2,2),10)-1,10),parseInt(which.CurrDate.value.substr(0,2),10));
	var DptDate= new Date(parseInt(which.HDptMMYear.value.substr(2,4),10),parseInt(parseInt(which.HDptMMYear.value.substr(0,2),10)-1,10),parseInt(which.HDptDate.value,10));
	var RetDate= new Date(parseInt(which.HRetMMYear.value.substr(2,4),10),parseInt(parseInt(which.HRetMMYear.value.substr(0,2),10)-1,10),parseInt(which.HRetDate.value,10));
	
	if(new Date(currDate.getFullYear(),currDate.getMonth(),currDate.getDate()+1)>=DptDate)
	{
		  alert("IF Check in IS WITHIN 48 HOURS, PLEASE CONTACT OUR RESERVATIONS DEPARTMENT ON 0871 666 0054");
		  return false;
	}
	
	if(DptDate>=RetDate)
	{
		  alert("Checkin date cannot be greater than or equal checkout date");
		  return false;
	}
	return true;
}
