
var firstCal;
var firstCallLeft;
firstCal=1;
firstCallLeft=1;


var FfirstCal=1;
var FfirstCallLeft=1;
var FHfirstCal=1;
var FHfirstCallLeft=1;

var HfirstCal=1;
var HfirstCallLeft=1;
//------------------------------------------------submit validation for different submit pages-------------

function setDMY(num)
{
	if(num=='FH')
		{
			setDatMonYear(document.FltHtlSearch.FHDptDateDDMMYY,document.FltHtlSearch.FHDptYr,document.FltHtlSearch.FHDptMon,document.FltHtlSearch.FHDptDate,document.FltHtlSearch.FHDptMonYr,document.FltHtlSearch.FHRetDateDDMMYY,document.FltHtlSearch.FHRetYr,document.FltHtlSearch.FHRetMon,document.FltHtlSearch.FHRetDate,document.FltHtlSearch.FHRetMonYr,document.FltHtlSearch.FHDptMonthName,document.FltHtlSearch.FHRetMonthName);
			
		}
		if(num=='F')
		{
			//alert(document.FlightSearch.FDptDateDDMMYY.value)
			//alert(document.FlightSearch.FRetDateDDMMYY.value)
			setDatMonYear(document.FlightSearch.FDptDateDDMMYY,document.FlightSearch.FDptYr,document.FlightSearch.FDptMon,document.FlightSearch.FDptDate,document.FlightSearch.FDptMonYr,document.FlightSearch.FRetDateDDMMYY,document.FlightSearch.FRetYr,document.FlightSearch.FRetMon,document.FlightSearch.FRetDate,document.FlightSearch.FRetMonYr,document.FlightSearch.FDptMonthName,document.FlightSearch.FRetMonthName);
			
			//setClassTypeIndex();
	
		}
		if(num=='H')
		{
			hDestFromToTxt();
			setDatMonYear(document.HotelSearch.HDptDateDDMMYY,document.HotelSearch.HDptYr,document.HotelSearch.HDptMon,document.HotelSearch.HDptDate,document.HotelSearch.HDptMonYr,document.HotelSearch.HRetDateDDMMYY,document.HotelSearch.HRetYr,document.HotelSearch.HRetMon,document.HotelSearch.HRetDate,document.HotelSearch.HRetMonYr,document.HotelSearch.HDptMonthName,document.HotelSearch.HRetMonthName);
		}
}

function setClassTypeIndex()
{
 if(document.FlightSearch.ClassCategory[1].checked)
	{
	document.getElementById("classTypeRequestIndex").value=1;
	}
	else if(document.FlightSearch.ClassCategory[2].checked)
	{
	document.getElementById("classTypeRequestIndex").value=2;
	}
	else if(document.FlightSearch.ClassCategory[3].checked)
	{
	document.getElementById("classTypeRequestIndex").value=3;
	}
	else
	{
	document.getElementById("classTypeRequestIndex").value=0;
	}
}

function setDatMonYear(DptDateDDMMYY,DptYr,DptMon,DptDate,DptMonYr,RetDateDDMMYY,RetYr,RetMon,RetDate,RetMonYr,DptMonName,RetMonName)
{
	
	var DepMMYY="";
	var RetMMYY="";
	var Dep=document.getElementById(DptDateDDMMYY.id).value;
	var Depdate=Dep.split("/");
	var year=Depdate[2];
	var mon=Depdate[1];
	var day=Depdate[0];
	
	monn=parseInt(mon);
	var monName=getMonthNameString(monn);
	document.getElementById(DptMonName.id).value=monName;
	
	var Ret=document.getElementById(RetDateDDMMYY.id).value;
	var Repdate=Ret.split("/");
	var year1=Repdate[2];
	var mon1=Repdate[1];
	var day1=Repdate[0];
	
	monnn=parseInt(mon1);
	var monName1=getMonthNameString(monnn);
	document.getElementById(RetMonName.id).value=monName1;
	
	
	if(mon<=10)
		{
		DepMMYY="0"+(mon-1)+year;
		
		document.getElementById(DptDate.id).value=day;
		document.getElementById(DptMonYr.id).value=DepMMYY;
		}
		else
		{
		DepMMYY=(mon-1)+year;
		document.getElementById(DptDate.id).value=day;
		document.getElementById(DptMonYr.id).value=DepMMYY;
		}
		document.getElementById(DptYr.id).value=year;
		document.getElementById(DptMon.id).value=mon;
	
	if(mon1<=10)
		{
		RetMMYY="0"+(mon1-1)+year1;
		document.getElementById(RetDate.id).value=day1
		document.getElementById(RetMonYr.id).value=RetMMYY;
		}
		else
		{
		RetMMYY=(mon1-1)+year1
		document.getElementById(RetDate.id).value=day1
		document.getElementById(RetMonYr.id).value=RetMMYY;
		}
		document.getElementById(RetYr.id).value=year1;
		document.getElementById(RetMon.id).value=mon1;
		
	
}

//FLight Hotel validation 

function fHValidateSearch() //for flight page fHValidateSearch
{
var DFrom=document.FltHtlSearch.FHDestFrom.selectedIndex;
var DTo=document.FltHtlSearch.FHDestTo.selectedIndex;
//		if(DFrom==0)
//			{
//			alert("Please select Departure airportname.");
//			document.FltHtlSearch.FHDestFrom.focus();
//			return false;
//			}
//		
//		if(DTo==0)
//			{
//			alert("Please select Destination airportname.");
//			document.FltHtlSearch.FHDestTo.focus();
//			return false;
//			}
		
		if(fHDateValidation()==false)
			{
			return false;
			}		
		
		/*if(FHDptValidDaysInOut()==false)
		{
		var ww=document.FltHtlSearch.FHDayMonth.value;
		ww=ww.toUpperCase();
		alert("Departure Flight not available on:"+ww)
		document.FltHtlSearch.FHDptDateDDMMYY.focus();
		return false;
		}	
		
		if(FHRetValidDaysInOut()==false)
			{
			var ww=document.FltHtlSearch.FHDayMonthRet.value;
			ww=ww.toUpperCase();
			alert("Return Flight not available on:"+ww)
			document.FltHtlSearch.FHRetDateDDMMYY.focus();
			return false;
			}
			*/
		if(FlightHotelSearch()==false)
		{
			return false;
		}
return true;
}
function FHDptValidDaysInOut()
{
	var flag=0;
	var DOutDay=document.getElementById("dOut1").innerHTML;
	var day=document.FltHtlSearch.FHDayMonth.value;
	
	var dayOut=DOutDay.split(",");
	if(DOutDay.toUpperCase()=="DAILY" || DOutDay.toUpperCase()=="--")
	{
		return true;
	}
	else
	{
		
	for(var i=0;i<dayOut.length;i++)
		{
			var dd=day.toUpperCase();
			var ddd="";
			if(i==0)
			{
			ddd=dayOut[i].toUpperCase();
			}
			else
			{
				dayOut[i]=dayOut[i].substr(1);
				ddd=dayOut[i].toUpperCase();
				
			}
		dd="\""+dd.substr(1)+"\"";
		ddd="\""+ddd+"\"";
		
		if(dd==ddd)
				{
					
					flag=1;
					break;
				}
		}
		if(flag==1)
		{
			return true;
		}
		else
		{
			return false;
		}
	
	} 
}

function FHRetValidDaysInOut()
{
	var flag=0;
	var DOutDay=document.getElementById("dIn1").innerHTML;
	var day=document.FltHtlSearch.FHDayMonthRet.value;
	var dayOut=DOutDay.split(",");
	if(DOutDay.toUpperCase()=="DAILY" || DOutDay.toUpperCase()=="--")
	{
	return true;
	}
	else
	{
		for(var i=0;i<dayOut.length;i++)
		{
		var dd=day.toUpperCase();
		var ddd="";
		if(i==0)
			{
			ddd=dayOut[i].toUpperCase();
			}
			else
			{
				dayOut[i]=dayOut[i].substr(1);
				ddd=dayOut[i].toUpperCase();
				
			}
		dd="\""+dd.substr(1)+"\"";
		ddd="\""+ddd+"\"";
		
		if(dd==ddd)
				{
					flag=1;
					break;
				}
		}
		if(flag==1)
		{
			return true;
		}
		else
		{
			return false;
		}
	
	} 
}


function fHDateValidation()
{

	var CurDate= new Date(document.FltHtlSearch.hFHBookYr.value, document.FltHtlSearch.hFHBookMon.value, document.FltHtlSearch.hFHBookDD.value);
	var Dptdate= new Date(document.FltHtlSearch.FHDptMonYr.value.substr(2,4), document.FltHtlSearch.FHDptMonYr.value.substr(0,2), document.FltHtlSearch.FHDptDate.value);
	var retDate= new Date(document.FltHtlSearch.FHRetMonYr.value.substr(2,4), document.FltHtlSearch.FHRetMonYr.value.substr(0,2), document.FltHtlSearch.FHRetDate.value);
//To Check the Valid Depart Dates

		if(validDate(document.FltHtlSearch.FHDptMonYr.value.substr(2,4), document.FltHtlSearch.FHDptMonYr.value.substr(0,2), document.FltHtlSearch.FHDptDate.value)==false)
		{
		alert("Please Select the Valid Depart date");
		document.FltHtlSearch.FHDptDateDDMMYY.focus();
		return false;
		}

//To Check the Valid Return Date

		if(validDate(document.FltHtlSearch.FHRetMonYr.value.substr(2,4), document.FltHtlSearch.FHRetMonYr.value.substr(0,2), document.FltHtlSearch.FHRetDate.value)==false)
		{
		alert("Please Select the Valid Return date");
		document.FltHtlSearch.FHRetDateDDMMYY.focus();
		return false;
		}

//To check Depart Date is not Less than the Current Date
		var DD=new Date();
		var D =new Date(DD.getFullYear(),DD.getMonth(),DD.getDate()+1);
		//var D = new Date(document.FltHtlSearch.hFHBookYr.value, document.FltHtlSearch.hFHBookMon.value, eval(document.FltHtlSearch.hFHBookDD.value) + 1);
		if(Dptdate<=D)
		{
			
		alert("IF DEPARTURE IS WITHIN 48 HOURS, PLEASE CONTACT OUR RESERVATIONS DEPARTMENT ON 0808 234 7340");
		document.FltHtlSearch.FHDptDateDDMMYY.focus();
		return false;
		}
//To Check the Return Date is greater Than the Depart Date
if(document.getElementById("JrnTypeR").checked==true)
{
		if(retDate<=Dptdate)
		{
		alert("Return Date Must be greater than Depart date");
		document.FltHtlSearch.FHRetDateDDMMYY.focus();
		return false;
		}
	}		
}
//room and no. of person validation
function FlightHotelSearch()  //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)
				{
				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;
				}
		}	

}

//end of validation

function fHDateValidationFltSearch(){

	var CurDate= new Date(document.FltHtlSearch.FHBookYr.value, document.FltHtlSearch.FHBookMon.value, document.FltHtlSearch.FHBookDD.value);
	var Dptdate= new Date(document.FltHtlSearch.FHDptMonYr.value.substring(2,7), document.FltHtlSearch.FHDptMonYr.value.substring(0,2), document.FltHtlSearch.FHdptDate.value);
//	var retDate= new Date(document.OnlineSearch.RetMonYr.value.substring(2,7), document.OnlineSearch.RetMonYr.value.substring(0,2), document.OnlineSearch.retDate.value);
//To Check the Valid Depart Dates

		if(validDate(document.FltHtlSearch.FHDptMonYr.value.substring(2,7), document.FltHtlSearch.FHDptMonYr.value.substring(0,2), document.FltHtlSearch.FHdptDate.value)==false)
		{
		alert("Please Select the Valid Depart date");
		document.FltHtlSearch.FHDptDateDDMMYY.focus();
		return false;
		}
//To check Depart Date is not Less than the Current Date

		if(Dptdate<=CurDate)
		{
		alert("Depart Date Must be greater than Current date");
		document.FltHtlSearch.FHDptDateDDMMYY.focus();
		return false;
		}
}


//End of Flight Hotel Validation
//==========================================================================================================================

//=======================================================================================================
//FLight form validation 
function fValidateSearch() //for flight page fHValidateSearch
{
	//var DAirline=document.FlightSearch.FAirLine.selectedIndex;
	var DFrom=document.FlightSearch.FDestFrom.selectedIndex;
	var DTo=document.FlightSearch.FDestTo.selectedIndex;
	var Adult,child,Infant,total
	Adult=new Number(document.FlightSearch.FAdult.value)
	child=new Number(document.FlightSearch.FChild.value)
	Infant=new Number(document.FlightSearch.FInfant.value)
	total=(Adult+child+Infant)

	//if(DAirline==0)
	//{
		//alert("Please select AirLine.");
		//document.FlightSearch.FAirLine.focus();
		//return false;
	//}
//	if(DFrom==0)
//	{
//		alert("Please select Departure airportname.");
//		document.FlightSearch.FDestFrom.focus();
//		return false;
//	}
//	if(DTo==0)
//	{
//		alert("Please select Destination airportname.");
//		document.FlightSearch.FDestTo.focus();
//		return false;
//	}
	
	
	/*
	if(document.FlightSearch.FAirLine.value=="ALL")
	{
			if(document.FlightSearch.FDestFrom.value=="")
			{
				alert("Please Select Departure Airport Name...");
				document.FlightSearch.FDestFrom.focus();
				return false;
			}
			if(document.FlightSearch.FDestTo.value=="")
			{
				alert("Please Select Destination Airport Name...");
				document.FlightSearch.FDestTo.focus();
				return false;
			}
	}*/
	
	if (Infant > Adult) 
	{
	alert("Number of infants should be equal to or less then number of adults")
	return false;
	}
	
	if(total>9)
	{
	alert("Total no of person should not be more than 9")
	return false;
	}
	if(fDateValidation()==false)
	{
	return false;
	}	
	/*if(FDptValidDaysInOut()==false)
	{
	var ww=document.FlightSearch.FDayMonth.value;
	ww=ww.toUpperCase();
	alert("Departure Flight not available on:"+ww)
	document.FlightSearch.FDptDateDDMMYY.focus();
	return false;
	}
	
	//*************************************************************
	if(document.getElementById('JrnTypeR').checked)
		{
		if(FRetValidDaysInOut()==false)
			{
			var ww=document.FlightSearch.FDayMonthRet.value;
			ww=ww.toUpperCase();
			alert("Return Flight not available on:"+ww)
			document.FlightSearch.FRetDateDDMMYY.focus();
			return false;
			}
		}*/
	//*************************************************************************
	
	/*
	try
	{
	alert("test");
	//if(document.FlightSearch.FjrnType(0).checked)
	if(document.FlightSearch.JrnType(0).checked)
		{
			alert("0");
				
		if(FRetValidDaysInOut()==false)
			{
				alert("1");
			var ww=document.FlightSearch.FDayMonthRet.value;
			ww=ww.toUpperCase();
			alert("Return Flight not available on:"+ww)
			document.FlightSearch.FRetDateDDMMYY.focus();
			return false;
			}
		}
	}
	catch(ex)
	{
		
		if(FRetValidDaysInOut()==false)
			{
				alert("2");
			var ww=document.FlightSearch.FDayMonthRet.value;
			ww=ww.toUpperCase();
			alert("Return Flight not available on:"+ww)
			document.FlightSearch.FRetDateDDMMYY.focus();
			return false;
			}
	}
	*/

return true;
}

function FDptValidDaysInOut()
{
	var flag=0;
	//var DOutDay=document.getElementById("dOut").innerHTML;
	var DOutDay=document.getElementById("DaysInRow").innerHTML;
	var day=document.FlightSearch.FDayMonth.value;
	
	var dayOut=DOutDay.split(",");
	if(DOutDay.toUpperCase()=="DAILY" || DOutDay.toUpperCase()=="--")
	{
		return true;
	}
	else
	{
		
	for(var i=0;i<dayOut.length;i++)
		{
			var dd=day.toUpperCase();
			var ddd="";
			if(i==0)
			{
			ddd=dayOut[i].toUpperCase();
			}
			else
			{
				dayOut[i]=dayOut[i].substr(1);
				ddd=dayOut[i].toUpperCase();
				
			}
		dd="\""+dd.substr(1)+"\"";
		ddd="\""+ddd+"\"";
		
		if(dd==ddd)
				{
					
					flag=1;
					break;
				}
		}
		if(flag==1)
		{
			return true;
		}
		else
		{
			return false;
		}
	
	} 
}

function FRetValidDaysInOut()
{
	var flag=0;
	//var DOutDay=document.getElementById("dIn").innerHTML;
	var DOutDay=document.getElementById("DaysOutRow").innerHTML;
	var day=document.FlightSearch.FDayMonthRet.value;
	var dayOut=DOutDay.split(",");
	if(DOutDay.toUpperCase()=="DAILY" || DOutDay.toUpperCase()=="--")
	{
	return true;
	}
	else
	{
		for(var i=0;i<dayOut.length;i++)
		{
		var dd=day.toUpperCase();
		var ddd="";
		if(i==0)
			{
			ddd=dayOut[i].toUpperCase();
			}
			else
			{
				dayOut[i]=dayOut[i].substr(1);
				ddd=dayOut[i].toUpperCase();
				
			}
		dd="\""+dd.substr(1)+"\"";
		ddd="\""+ddd+"\"";
		
		if(dd==ddd)
				{
					flag=1;
					break;
				}
		}
		if(flag==1)
		{
			return true;
		}
		else
		{
			return false;
		}
	
	} 
}




function fDateValidation(){

	currDate=new Date();
	
	var CurDate= new Date(document.FlightSearch.hFBookYr.value, document.FlightSearch.hFBookMon.value, document.FlightSearch.hFBookDD.value);
	var Dptdate= new Date(document.FlightSearch.FDptMonYr.value.substr(2,4), document.FlightSearch.FDptMonYr.value.substr(0,2), document.FlightSearch.FDptDate.value);
	var retDate= new Date(document.FlightSearch.FRetMonYr.value.substr(2,4), document.FlightSearch.FRetMonYr.value.substring(0,2), document.FlightSearch.FRetDate.value);
//To Check the Valid Depart Dates


		if(validDate(document.FlightSearch.FDptMonYr.value.substring(2,7), document.FlightSearch.FDptMonYr.value.substring(0,2), document.FlightSearch.FDptDate.value)==false)
		{
		alert("Please Select the Valid Depart date");
		document.FlightSearch.FDptDateDDMMYY.focus();
		return false;
		}

//To Check the Valid Return Date

		if(validDate(document.FlightSearch.FRetMonYr.value.substring(2,7), document.FlightSearch.FRetMonYr.value.substring(0,2), document.FlightSearch.FRetDate.value)==false)
		{
		alert("Please Select the Valid Return date");
		document.FlightSearch.FRetDateDDMMYY.focus();
		return false;
		}

		var DD=new Date();
		var D =new Date(DD.getFullYear(),DD.getMonth(),DD.getDate()+1);
		if(Dptdate<=D)
		{
		alert("IF DEPARTURE IS WITHIN 48 HOURS, PLEASE CONTACT OUR RESERVATIONS DEPARTMENT ON 0808 234 7340");
		document.FlightSearch.FDptDateDDMMYY.focus();
		return false;
		}
		

	
//To Check the Return Date is greater Than the Depart Date
if(document.getElementById("JrnTypeR").checked==true)
{
	if(document.getElementById("FareOnly").value=="1")
	{
		var one_day=1000*60*60*24;
		var strdiff=Math.ceil((retDate.getTime()-Dptdate.getTime())/(one_day))
	      if(strdiff<6) 
			  {
			  alert("The minimum diffenrence between the dates should be 6 days.If you want to search less than 6 days,please uncheck the 'My dates are flexible'")
			  return false;
			  } 
	}
	else
	{
		if(retDate<=Dptdate)
		{
		alert("Return Date Must be greater than Depart date");
		document.FlightSearch.FRetDateDDMMYY.focus();
		return false;
		}
	}
		
	}		
}


function fDateValidationFltSearch(){

	var CurDate= new Date(document.FlightSearch.FBookYr.value, document.FlightSearch.FBookMon.value, document.FlightSearch.FBookDD.value);
	var Dptdate= new Date(document.FlightSearch.FDptMonYr.value.substring(2,7), document.FlightSearch.FDptMonYr.value.substring(0,2), document.FlightSearch.FdptDate.value);
//	var retDate= new Date(document.OnlineSearch.RetMonYr.value.substring(2,7), document.OnlineSearch.RetMonYr.value.substring(0,2), document.OnlineSearch.retDate.value);
//To Check the Valid Depart Dates

		if(validDate(document.FlightSearch.FDptMonYr.value.substring(2,7), document.FlightSearch.FDptMonYr.value.substring(0,2), document.FlightSearch.FdptDate.value)==false)
		{
		alert("Please Selet the Valid Depart date");
		document.FlightSearch.FDptDate.focus();
		return false;
		}
//To check Depart Date is not Less than the Current Date

		if(Dptdate<=CurDate)
		{
		alert("Depart Date Must be greater than Current date");
		document.FlightSearch.FDptDate.focus();
		return false;
		}
}


//End of Flight from Validation
//==========================================================================================================================




//=======================================================================================================
//Hotel form validation 
function hValidateSearch() 
{




//changes
var DFrom=document.HotelSearch.HDestTo.selectedIndex;

		if(DFrom==0)
			{
			alert("Please select Hotel City name.");
			document.HotelSearch.HDestTo.focus();
			return false;
			}




		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 CurDate= new Date(document.HotelSearch.hHBookYr.value, document.HotelSearch.hHBookMon.value, document.HotelSearch.hHBookDD.value);
	var Dptdate= new Date(document.HotelSearch.HDptMonYr.value.substring(2,7), document.HotelSearch.HDptMonYr.value.substring(0,2), document.HotelSearch.HDptDate.value);
	var RetDate= new Date(document.HotelSearch.HRetMonYr.value.substring(2,7), document.HotelSearch.HRetMonYr.value.substring(0,2), document.HotelSearch.HRetDate.value);
//To Check the Valid Depart Dates

		if(validDate(document.HotelSearch.HDptMonYr.value.substring(2,7), document.HotelSearch.HDptMonYr.value.substring(0,2), document.HotelSearch.HDptDate.value)==false)
		{
		alert("Please Select the Valid Depart date");
		document.HotelSearch.HDptDateDDMMYY.focus();
		return false;
		}

//To Check the Valid Return Date

		if(validDate(document.HotelSearch.HRetMonYr.value.substring(2,7), document.HotelSearch.HRetMonYr.value.substring(0,2), document.HotelSearch.HRetDate.value)==false)
		{
		alert("Please Select the Valid Return date");
		document.HotelSearch.HRetDateDDMMYY.focus();
		return false;
		}

//To check Depart Date is not Less than the Current Date
		var DD=new Date();
		var D =new Date(DD.getFullYear(),DD.getMonth(),DD.getDate()+1);
		//var D = new Date(document.HotelSearch.hHBookYr.value, document.HotelSearch.hHBookMon.value, eval(document.HotelSearch.hHBookDD.value) + 1);
		if(Dptdate<=D)
		{
		alert("IF DEPARTURE IS WITHIN 48 HOURS, PLEASE CONTACT OUR RESERVATIONS DEPARTMENT ON 0808 234 7340");
		document.HotelSearch.HDptDateDDMMYY.focus();
		return false;
		}
//To Check the Return Date is greater Than the Depart Date
if(document.getElementById("JrnTypeR").checked==true)
{
		if(RetDate<=Dptdate)
		{
		alert("Return Date Must be greater than Depart date");
		document.HotelSearch.HRetDateDDMMYY.focus();
		return false;
		}
		}	
}


function hDateValidationFltSearch(){

	var CurDate= new Date(document.HotelSearch.HBookYr.value, document.HotelSearch.HBookMon.value, document.HotelSearch.HBookDD.value);
	var Dptdate= new Date(document.HotelSearch.HDptMonYr.value.substring(2,7), document.HotelSearch.HDptMonYr.value.substring(0,2), document.HotelSearch.HdptDate.value);
//	var retDate= new Date(document.OnlineSearch.RetMonYr.value.substring(2,7), document.OnlineSearch.RetMonYr.value.substring(0,2), document.OnlineSearch.retDate.value);
//To Check the Valid Depart Dates

		if(validDate(document.HotelSearch.HDptMonYr.value.substring(2,7), document.HotelSearch.HDptMonYr.value.substring(0,2), document.HotelSearch.HdptDate.value)==false)
		{
		alert("Please Select the Valid Depart date");
		document.HotelSearch.HDptDate.focus();
		return false;
		}
//To check Depart Date is not Less than the Current Date

		if(Dptdate<=CurDate)
		{
		alert("Depart Date Must be greater than Current date");
		document.HotelSearch.HDptDate.focus();
		return false;
		}
}


//End of Hotel from Validation
//==========================================================================================================================


var multiHTMtext="";
var radioButtHTMtext="";
var hiddenJrn="";

function changeReturn()
{
	if(document.OnlineSearch.RdJrnType[0].checked)
	{
		document.OnlineSearch.JrnType.value="Return"
	}
	if(document.OnlineSearch.RdJrnType[1].checked)
	{
		document.OnlineSearch.JrnType.value="OneWay"
	}
}
function moreFlt()
{
	if(radioButtHTMtext=="")
	{
		radioButtHTMtext = document.getElementById("radioButtRow").innerHTML;
	}
	if(document.OnlineSearch.checkbox.checked)
	{
		document.getElementById("radioButtRow").innerHTML=radioButtHTMtext;
	}
	else
	{
		document.getElementById("radioButtRow").innerHTML=""
		document.OnlineSearch.JrnType.value="Return"
	}
}
function removeCheck()
{
	document.OnlineSearch.checkbox.checked=false
}
//----------------------------end of fltsearch.aspx
//-------------------------------begining of fltLeftSearch.aspx ------------------
function fltLeftValid() //for flight page
{
		if(datevalidation()==false)
		{
			
		return false;
		}
		
return true;
}
//----------------------------------------------------------------------

function hotelSearch() //for hotel search
{
		if(datevalidation()==false)
		{
		return false;
		}
		var twnRoom,dblRoom,sngRoom,tplRoom,total
		twnRoom=new Number(document.OnlineSearch.twnRoom.value)
		dblRoom=new Number(document.OnlineSearch.dblRoom.value)
		sngRoom=new Number(document.OnlineSearch.sngRoom.value)
		tplRoom=new Number(document.OnlineSearch.tplRoom.value)
		total=(twnRoom+dblRoom+sngRoom+tplRoom)
		if(total<1)
		{
		alert("Please select a room type")
		return false;
		}
}


function ValidateTravel() //for flight page
{
		if(document.OnlineSearch.package.value==0)
		{
		alert("Please Select a package")
		document.OnlineSearch.package.focus()
		return false;
		}

		if(datevalidation()==false)
		{
		return false;
		}
		
return true;
}



function readcondition()
{
	if(!document.localHotels.agree.checked)
	{
		alert("Please Read the Terms & Conditions before Booking !")
		return false;
	}
	window.parent.scroll(0,0);
}
//----------validation for htlsummary.asp page ends------------------------------------
//----------------ends for htlccinfo.asps----------------------------------------------
var Cards = new makeArray(8);
Cards[0] = new CardType("MasterCard", "51,52,53,54,55", "16");
var MasterCard = Cards[0];
Cards[1] = new CardType("VisaCard", "4", "13,16");
var VisaCard = Cards[1];
Cards[2] = new CardType("AmExCard", "34,37", "15");
var AmExCard = Cards[2];
Cards[3] = new CardType("DinersClubCard", "30,36,38", "14");
var DinersClubCard = Cards[3];
Cards[4] = new CardType("DiscoverCard", "6011", "16");
var DiscoverCard = Cards[4];
Cards[5] = new CardType("enRouteCard", "2014,2149", "15");
var enRouteCard = Cards[5];
Cards[6] = new CardType("JCBCard", "3088,3096,3112,3158,3337,3528", "16");
var JCBCard = Cards[6];
var LuhnCheckSum = Cards[7] = new CardType();

/*************************************************************************\
CheckCardNumber(form)
function called when users click the "check" button.
\*************************************************************************/
function remove_XS_whitespace(item)
{
  var tmp = "";
  var item_length = item.value.length;
  var item_length_minus_1 = item.value.length - 1;
  for (index = 0; index < item_length; index++)
  {
	if (item.value.charAt(index) != ' ')
	{
	  tmp += item.value.charAt(index);
	}
	else
	{
	  if (tmp.length > 0)
	  {
		if (item.value.charAt(index+1) != ' ' && index != item_length_minus_1)
		{
		  tmp += item.value.charAt(index);
		}
	  }
	}
  }
  item.value = tmp;
}
function validateHtlccinfo()
{
	RSpace();
	if(document.ThisForm.getElementByID("MPFname").value=="")
	{
		alert("Please Enter the First Name");
		document.ThisForm.MPFname.focus()

		return false;
	}
	else if(document.ThisForm.MPLname.value=="")
	{
		alert("Please Enter the Last Name");
		document.ThisForm.MPLname.focus()
		return false;
	}
		else if(document.ThisForm.txtAdd1.value=="")
		{
			alert("Please Enter the First Address");
			document.ThisForm.txtAdd1.focus()
			return false;
		}
		else if(document.ThisForm.txtCity.value=="")
		{
			alert("Please Enter the City");
			document.ThisForm.txtCity.focus()
			return false;
		}
		else if(document.ThisForm.txtCountry.value=="")
		{
			alert("Please Enter the Country");
			document.ThisForm.txtCountry.focus()
			return false;
		}
		else if(document.ThisForm.txtPostCode.value=="")
		{
			alert("Please Enter the Post code");
			document.ThisForm.txtPostCode.focus()
			return false;
		}
		x=CheckCardNumber(ThisForm)
	if(x==false)
	{
		return false;
	}
window.parent.scroll(0,0);
}
function RSpace()
{
	remove_XS_whitespace(document.ThisForm.MPFname);
	remove_XS_whitespace(document.ThisForm.MPLname);
	remove_XS_whitespace(document.ThisForm.txtAdd1);
	remove_XS_whitespace(document.ThisForm.txtAdd2);
	remove_XS_whitespace(document.ThisForm.txtCity);
	remove_XS_whitespace(document.ThisForm.txtCountry);
	remove_XS_whitespace(document.ThisForm.txtPostCode);
}
function Validate1()
{
	RSpace();
	var x;
	x=CheckCardNumber(ThisForm)
	if(x==false)
	{
		return false;
	}
	if(document.ThisForm.MPFname.value=="")
	{
		alert("Please Enter the First Name");
		document.ThisForm.MPFname.focus()
		return false;
	}
	else if(document.ThisForm.MPLname.value=="")
	{
		alert("Please Enter the Last Name");
		document.ThisForm.MPLname.focus()
		return false;
	}
		else if(document.ThisForm.IssueNo.value=="")
		{
			alert("Please Enter the Issue No.");
			document.ThisForm.IssueNo.focus()
			return false;
		}				
		else if(document.ThisForm.txtAdd1.value=="")
		{
			alert("Please Enter the First Address");
			document.ThisForm.txtAdd1.focus()
			return false;
		}
		else if(document.ThisForm.txtAdd2.value=="")
		{
			alert("Please Enter the Second Address");
			document.ThisForm.txtAdd2.focus()
			return false;
		}
		else if(document.ThisForm.txtCity.value=="")
		{
			alert("Please Enter the City");
			document.ThisForm.txtCity.focus()
			return false;
		}
		else if(document.ThisForm.txtCountry.value=="")
		{
			alert("Please Enter the Country");
			document.ThisForm.txtCountry.focus()
			return false;
		}
		else if(document.ThisForm.txtPostCode.value=="")
		{
			alert("Please Enter the Post code");
			document.ThisForm.txtPostCode.focus()
			return false;
		}
	}
function RUSure()
{
	if(document.ThisForm.PC.checked==false)
		alert("We highly recommend you paying for your documents to be sent via special delivery postage.\n As any reissue costs for lost tickets/hotel vouchers will be payable by yourselves.");
}

function CheckCardNumber(form) 
{
	var tmpyear;

	if (form.CardType.selectedIndex == 1  && form.CardNumber.value == "4111111111111111" )
	{
		alert("Invalid card Number");
		form.CardNumber.select()	
		form.CardNumber.focus();
		return false;
	}
	if (form.CardNumber.value.length == 0) 
	{
		alert("Please enter a Card Number.");
		form.CardNumber.focus();
		return false;
	}
		if (form.CVVNo.value.length==0) 
		{
		alert("Please enter CVV No.");
		form.CVVNo.focus();
		return false;
		}
		else if(form.CVVNo.value.length < 3)
		{
		alert("It should have atleast three digit long. ");
		form.CVVNo.focus();
		return false;
		}
	
	if (form.requiredExpYear.value.length == 0) 
	{
		alert("Please enter the Expiration Year.");
		form.requiredExpYear.focus();
		return false;
	}
	if (form.requiredExpYear.value > 96)
		tmpyear = "19" + form.requiredExpYear.value;
	else if (form.requiredExpYear.value < 21)
		tmpyear = "20" + form.requiredExpYear.value;
	else
	{
		alert("The Expiration Year is not valid.");
		return false;
	}
	tmpmonth = form.ExpMon.options[form.ExpMon.selectedIndex].value;
// The following line doesn't work in IE3, you need to change it
// to something like "(new CardType())...".
// if (!CardType().isExpiryDate(tmpyear, tmpmonth)) {
	if (!(new CardType()).isExpiryDate(tmpyear, tmpmonth)) 
	{
		alert("This card has already expired.");
		return false;
	}
	if (form.CardType.selectedIndex == 4  && form.IssueNo.value.length == 0)
	{
		alert("Please enter Issue No. for Switch Cards.");
		form.IssueNo.focus();
		return false;
	}
	if (form.CardType.selectedIndex<4)
	{
		card = form.CardType.options[form.CardType.selectedIndex].value;
		var retval = eval(card + ".checkCardNumber(\"" + form.CardNumber.value +
		"\", " + tmpyear + ", " + tmpmonth + ");");
		cardname = "";
		if (retval)
		{
		// comment this out if used on an order form
		//alert("This card number appears to be valid.");
		}
		else 
		{
		// The cardnumber has the valid luhn checksum, but we want to know which
		// cardtype it belongs to.
			for (var n = 0; n < Cards.size; n++) 
			{
				if (Cards[n].checkCardNumber(form.CardNumber.value, tmpyear, tmpmonth)) 
				{
					cardname = Cards[n].getCardType();
					break;
		   		}
			}
			if (cardname.length > 0) 	
			{
				alert("This looks like a " + cardname + " number, not a " + card + " number.");
				return false;
			}
			else 
			{
				alert("This card number is not valid.");
				form.CardNumber.select()	
				form.CardNumber.focus();
				return false;
			}
		}
	}
//document.getElementById("flash").style.visibility="Visible";
	return true;
}
/*************************************************************************\
Object CardType([String cardtype, String rules, String len, int year, 
                                        int month])
cardtype    : type of card, eg: MasterCard, Visa, etc.
rules       : rules of the cardnumber, eg: "4", "6011", "34,37".
len         : valid length of cardnumber, eg: "16,19", "13,16".
year        : year of expiry date.
month       : month of expiry date.
eg:
var VisaCard = new CardType("Visa", "4", "16");
var AmExCard = new CardType("AmEx", "34,37", "15");
\*************************************************************************/

function CardType() 
{
	var n;
	var argv = CardType.arguments;
	var argc = CardType.arguments.length;

	this.objname = "object CardType";

	var tmpcardtype = (argc > 0) ? argv[0] : "CardObject";
	var tmprules = (argc > 1) ? argv[1] : "0,1,2,3,4,5,6,7,8,9";
	var tmplen = (argc > 2) ? argv[2] : "13,14,15,16,19";

	this.setCardNumber = setCardNumber;  // set CardNumber method.
	this.setCardType = setCardType;  // setCardType method.
	this.setLen = setLen;  // setLen method.
	this.setRules = setRules;  // setRules method.
	this.setExpiryDate = setExpiryDate;  // setExpiryDate method.
	this.setCardType(tmpcardtype);
	this.setLen(tmplen);
	this.setRules(tmprules);
	if (argc > 4)
	this.setExpiryDate(argv[3], argv[4]);
	this.checkCardNumber = checkCardNumber;  // checkCardNumber method.
	this.getExpiryDate = getExpiryDate;  // getExpiryDate method.
	this.getCardType = getCardType;  // getCardType method.
	this.isCardNumber = isCardNumber;  // isCardNumber method.
	this.isExpiryDate = isExpiryDate;  // isExpiryDate method.
	this.luhnCheck = luhnCheck;// luhnCheck method.
	return this;
}

/*************************************************************************\
boolean checkCardNumber([String cardnumber, int year, int month])
return true if cardnumber pass the luhncheck and the expiry date is
valid, else return false.
\*************************************************************************/
function checkCardNumber() 
{
	var argv = checkCardNumber.arguments;
	var argc = checkCardNumber.arguments.length;
	var cardnumber = (argc > 0) ? argv[0] : this.cardnumber;
	var year = (argc > 1) ? argv[1] : this.year;
	var month = (argc > 2) ? argv[2] : this.month;

	this.setCardNumber(cardnumber);
	this.setExpiryDate(year, month);
	if (!this.isCardNumber())
	return false;
	if (!this.isExpiryDate())
	return false;

	return true;
}
/*************************************************************************\
String getCardType()
return the cardtype.
\*************************************************************************/
function getCardType() 
{
	return this.cardtype;
}
/*************************************************************************\
String getExpiryDate()
return the expiry date.
\*************************************************************************/
function getExpiryDate() 
{
	return this.month + "/" + this.year;
}
/*************************************************************************\
boolean isCardNumber([String cardnumber])
return true if cardnumber pass the luhncheck and the rules, else return
false.
\*************************************************************************/
function isCardNumber() 
{
	var argv = isCardNumber.arguments;
	var argc = isCardNumber.arguments.length;
	var cardnumber = (argc > 0) ? argv[0] : this.cardnumber;
	if (!this.luhnCheck())
	return false;

	for (var n = 0; n < this.len.size; n++)
	if (cardnumber.toString().length == this.len[n]) 
	{
		for (var m = 0; m < this.rules.size; m++) 	
		{
			var headdigit = cardnumber.substring(0, this.rules[m].toString().length);
			if (headdigit == this.rules[m])
			return true;
		}
		return false;
	}
	return false;
}

/*************************************************************************\
boolean isExpiryDate([int year, int month])
return true if the date is a valid expiry date,
else return false.
\*************************************************************************/
function isExpiryDate() 	
{
	var argv = isExpiryDate.arguments;
	var argc = isExpiryDate.arguments.length;

	year = argc > 0 ? argv[0] : this.year;
	month = argc > 1 ? argv[1] : this.month;
	if (!isNum(year+""))
	return false;
	if (!isNum(month+""))
	return false;
	today = new Date();
	expiry = new Date(year, month);
	if (today.getTime() > expiry.getTime())
	return false;
	else
	return true;
}

/*************************************************************************\
boolean isNum(String argvalue)
return true if argvalue contains only numeric characters,
else return false.
\*************************************************************************/
function isNum(argvalue) 
{
	argvalue = argvalue.toString();

	if (argvalue.length == 0)
	return false;

	for (var n = 0; n < argvalue.length; n++)
	if (argvalue.substring(n, n+1) < "0" || argvalue.substring(n, n+1) > "9")
	return false;
	return true;
}

/*************************************************************************\
boolean luhnCheck([String CardNumber])
return true if CardNumber pass the luhn check else return false.
Reference: http://www.ling.nwu.edu/~sburke/pub/luhn_lib.pl
\*************************************************************************/
function luhnCheck() 
{
	var argv = luhnCheck.arguments;
	var argc = luhnCheck.arguments.length;

	var CardNumber = argc > 0 ? argv[0] : this.cardnumber;

	if (! isNum(CardNumber)) 
	{
		return false;
  	}

	var no_digit = CardNumber.length;
	var oddoeven = no_digit & 1;
	var sum = 0;

	for (var count = 0; count < no_digit; count++) 
	{
		var digit = parseInt(CardNumber.charAt(count));
		if (!((count & 1) ^ oddoeven)) 
		{
			digit *= 2;
			if (digit > 9)
			digit -= 9;
		}
	sum += digit;
	}	
	if (sum % 10 == 0)
	return true;
	else
	return false;
}

/*************************************************************************\
ArrayObject makeArray(int size)
return the array object in the size specified.
\*************************************************************************/
function makeArray(size) 	
{
	this.size = size;
	return this;	
}

/*************************************************************************\
CardType setCardNumber(cardnumber)
return the CardType object.
\*************************************************************************/
function setCardNumber(cardnumber) 
{
	this.cardnumber = cardnumber;
	return this;
}

/*************************************************************************\
CardType setCardType(cardtype)
return the CardType object.
\*************************************************************************/
function setCardType(cardtype) 
{
	this.cardtype = cardtype;
	return this;
}

/*************************************************************************\
CardType setExpiryDate(year, month)
return the CardType object.
\*************************************************************************/
function setExpiryDate(year, month) 
{
	this.year = year;
	this.month = month;
	return this;
}

/*************************************************************************\
CardType setLen(len)
return the CardType object.
\*************************************************************************/
function setLen(len) 	
{
// Create the len array.
	if (len.length == 0 || len == null)
	len = "13,14,15,16,19";
	var tmplen = len;
	n = 1;
	while (tmplen.indexOf(",") != -1) 
	{
		tmplen = tmplen.substring(tmplen.indexOf(",") + 1, tmplen.length);
		n++;
	}
	this.len = new makeArray(n);
	n = 0;
	while (len.indexOf(",") != -1) 
	{
		var tmpstr = len.substring(0, len.indexOf(","));
		this.len[n] = tmpstr;
		len = len.substring(len.indexOf(",") + 1, len.length);
		n++;
	}
	this.len[n] = len;
	return this;
}

/*************************************************************************\
CardType setRules()
return the CardType object.
\*************************************************************************/
function setRules(rules) 
{
	// Create the rules array.
	if (rules.length == 0 || rules == null)
	rules = "0,1,2,3,4,5,6,7,8,9";
	var tmprules = rules;
	n = 1;
	while (tmprules.indexOf(",") != -1) 
	{
		tmprules = tmprules.substring(tmprules.indexOf(",") + 1, tmprules.length);
		n++;
	}
	this.rules = new makeArray(n);
	n = 0;
	while (rules.indexOf(",") != -1) 
	{
		var tmpstr = rules.substring(0, rules.indexOf(","));
		this.rules[n] = tmpstr;
		rules = rules.substring(rules.indexOf(",") + 1, rules.length);
		n++;
	}
	this.rules[n] = rules;
	return this;
}
//document.getElementById("flash").style.visibility="visible";

function cValue()
{}

function RUSure()
	{
		if(document.ThisForm.PC.checked==false)
			alert("We highly recommend you paying for your documents to be sent via special delivery postage.\n As any reissue costs for lost tickets/hotel vouchers will be payable by yourselves.");
	//		alert("We cannot guarantee the delivery of your documents.\nAny lost documents will have to be reissued and \nall costs will have to be paid again.");
	}



//----------------ends for htlccinfo.asps----------------------------------------------

//----------------start of fltPaxDetail.asps----------------------------------------------

//----------------ends for fltPaxDetails.asps----------------------------------------------
function remove_XS_whitespace(item)
{
  var tmp = "";
  var item_length = item.value.length;
  var item_length_minus_1 = item.value.length - 1;
  for (index = 0; index < item_length; index++)
  {
    if (item.value.charAt(index) != ' ')
    {
      tmp += item.value.charAt(index);
    }
    else
    {
      if (tmp.length > 0)
      {
        if (item.value.charAt(index+1) != ' ' && index != item_length_minus_1)
        {
          tmp += item.value.charAt(index);
        }
      }
    }
  }
  item.value = tmp;
}

function checkrequired(which) {

var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if(tempobj.type=="text"||tempobj.type=="textarea"){
	remove_XS_whitespace(tempobj);
}

if (tempobj.name.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea") && tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s" && tempobj.selectedIndex==0)) {
	pass=false;
	break;
         }
      }
   }
}
if (!pass) {
	shortFieldName=tempobj.name.substring(8,30).toUpperCase();
	alert("Please make sure all fields have been completed.");
	tempobj.focus();
	return false;
}
else
	if(emailCheck(which.elements['requiredEMail'].value)){
		return true;
	}
	else{
		return false;
	}

}

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;
}
//----------------validation ends for htlPaxinfo.js-----------------




function ValidateSearchLeft() //for left_navbot.aspx
{
		if(datevalidation()==false)
		{
		return false;
		}
		
		var Adult,child,Infant,total
		Adult=new Number(document.OnlineSearch.Adult.value)
		child=new Number(document.OnlineSearch.Child.value)
		Infant=new Number(document.OnlineSearch.Infant.value)
		total=(Adult+child+Infant)
		if(total>9)
		{
		alert("Total no of person should be less than 9")
		return false;
		}
		
return true;
}
//------end of left_navbot.aspx



//------------------------------------------------submit validation for different submit pages ends

//--------------------------------------- select a city validation
function htlSelDestValid()
{

if(datevalidation()==false)
		{
		return false;
		}

		var twnRoom,dblRoom,sngRoom,tplRoom,total
		twnRoom=new Number(document.OnlineSearch.twnRoom.value)
		dblRoom=new Number(document.OnlineSearch.dblRoom.value)
		sngRoom=new Number(document.OnlineSearch.sngRoom.value)
		tplRoom=new Number(document.OnlineSearch.tplRoom.value)
		total=(twnRoom+dblRoom+sngRoom+tplRoom)

		if(total<1)
		{
		alert("Please select a room type")
		return false;
		}

		if(dateDiff()==false)
		{
		return false;
		}

}





function goToBookMarkflthtl(pp)
{
var d,f,pos,nn
locationName=document.getElementById("IFrameSelectCountryInner").src

pos=locationName.indexOf('?')
nn=locationName.substring(0,pos)
d=document.MainForm.select.selectedIndex
f=document.MainForm.select.options[d].text

	if(nn=="countryInnerflthtl.aspx")
	document.IFrameSelectCountryInner.location.href = "countryInnerflthtl.aspx?CN="+f+"";
	else
	document.IFrameSelectCountryInner.location.href = "countryInnerflthtlleft.aspx?CN="+f+"";
	
}



function closeWin1()
{
document.getElementById("IFrameSelectCountryInner").src=""
window.parent.document.getElementById("selectCountry").style.visibility="hidden";
}


function showContinent()
{
window.document.getElementById("selectCountry").style.visibility="visible";
}

function goBack()
{
document.getElementById("IFrameSelectCountryInner").src=""
window.parent.document.getElementById("selectCountry").style.visibility="hidden";
window.parent.document.getElementById("selectContinent").style.visibility="visible";
}
function passValueflthtl(vCode,vDestName)
{

window.parent.window.parent.window.document.getElementById("DestinationText").value=vDestName
window.parent.window.parent.window.document.getElementById("Destination").value=vCode
window.parent.window.parent.window.document.getElementById("selectCountry").style.visibility="hidden";
}



function setConLayer()
{
window.parent.document.getElementById("IFrameSelect").width="267"
window.parent.document.getElementById("IFrameSelect").scrolling="yes"
}

function DropSelCity(ll)
{


var d,f
d=document.MainForm.select.selectedIndex
f=document.MainForm.select.options[d].text
location.href="country.aspx?CN="+f+""
}
	

//-------------------end of select a city validation on search.asp continent

function datevalidation(){

	var CurDate= new Date(document.OnlineSearch.BookYr.value, document.OnlineSearch.BookMon.value, document.OnlineSearch.BookDD.value);
	var Dptdate= new Date(document.OnlineSearch.DptMonYr.value.substring(2,7), document.OnlineSearch.DptMonYr.value.substring(0,2), document.OnlineSearch.dptDate.value);
	var retDate= new Date(document.OnlineSearch.RetMonYr.value.substring(2,7), document.OnlineSearch.RetMonYr.value.substring(0,2), document.OnlineSearch.retDate.value);
//To Check the Valid Depart Dates

		if(validDate(document.OnlineSearch.DptMonYr.value.substring(2,7), document.OnlineSearch.DptMonYr.value.substring(0,2), document.OnlineSearch.dptDate.value)==false)
		{
		alert("Please Selet the Valid Depart date");
		document.OnlineSearch.dptDate.focus();
		return false;
		}

//To Check the Valid Return Date

		if(validDate(document.OnlineSearch.RetMonYr.value.substring(2,7), document.OnlineSearch.RetMonYr.value.substring(0,2), document.OnlineSearch.retDate.value)==false)
		{
		alert("Please Selet the Valid Return date");
		document.OnlineSearch.retDate.focus();
		return false;
		}

//To check Depart Date is not Less than the Current Date

		var D = new Date(document.OnlineSearch.BookYr.value, document.OnlineSearch.BookMon.value, eval(document.OnlineSearch.BookDD.value) + 1);
		if(Dptdate<=D)
		{
		alert("IF DEPARTURE IS WITHIN 48 HOURS, PLEASE CONTACT OUR RESERVATIONS DEPARTMENT ON 0808 234 7340");
		document.OnlineSearch.dptDate.focus();
		return false;
		}
//To Check the Return Date is greater Than the Depart Date
if(document.getElementById("JrnTypeR").checked==true)
{
		if(retDate<=Dptdate)
		{
		alert("Return Date Must be greater than Depart date");
		document.OnlineSearch.retDate.focus();
		return false;
		}
	}		
}



// Function to Check the Dates r Valid or Not

function validDate(YYYY,MM,DD)
{
	var gg
	gg=new Number(MM)
	MM=gg + 1

		if(MM==4 || MM==6 || MM==9 || MM==11 )
		{
			if(parseInt(DD)>=31)
			{				
				return false;
			}
		}
		
		else if(MM==2 && YYYY%4 ==0)
		{
			if(DD>=30)
			return false;
		}
		
		else if(MM==2)
		{
			if(DD>=29)
			return false;
		}
return true;
}


//Function to remove the White Space from the Control

function remove_XS_whitespace(item)
{
	  var tmp = "";
	  var item_length = item.value.length;
	  var item_length_minus_1 = item.value.length - 1;

		for (index = 0; index < item_length; index++)
		{
			if (item.value.charAt(index) != ' ')
			{
			  tmp += item.value.charAt(index);
			}
			else
			{
				  if (tmp.length > 0)
				  {
						if (item.value.charAt(index+1) != ' ' && index != item_length_minus_1)
						{
						  tmp += item.value.charAt(index);
						}
		  		  }
		    }
	   }

	item.value = tmp;
}


// veerus function starts from here
// on change of departure date
//==============================================================================================================


function dptValid()
{

	var Dptdate= new Date(document.OnlineSearch.DptMonYr.value.substring(2,7), document.OnlineSearch.DptMonYr.value.substring(0,2), document.OnlineSearch.dptDate.value);
	var retDate= new Date(document.OnlineSearch.RetMonYr.value.substring(2,7), document.OnlineSearch.RetMonYr.value.substring(0,2), document.OnlineSearch.retDate.value);

		if(validDate(document.OnlineSearch.DptMonYr.value.substring(2,7), document.OnlineSearch.DptMonYr.value.substring(0,2), document.OnlineSearch.dptDate.value)==false)
		{
		alert("Please Selet the Valid Depart date");
		document.OnlineSearch.dptDate.focus();
		return false;
		}


//if(retDate<=Dptdate)
//{
		//retDate.setDate(Dptdate.getDate()+3)
		var dDpt,mDpt,yDpt,dRet,mRet,yRet
		dDpt=Dptdate.getDate()   //departure date
		mDpt=Dptdate.getMonth()	 //departure month
		yDpt=Dptdate.getFullYear() //departure year
		dRet=retDate.getDate()	 //return date
		mRet=retDate.getDate()	 //return month
		yRet=retDate.getFullYear()	 //return month
		mDpt=mDpt+1

		if(mDpt==4 || mDpt==6 || mDpt==9 || mDpt==11 )
		{
				if(dDpt>28)
				{
					var I,l
					I=document.OnlineSearch.DptMonYr.length
					l=document.OnlineSearch.DptMonYr.selectedIndex
	
					if(l<10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l+1].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l].selected=true;
					return false;
					}
				}
				else if(dDpt<=28)
				{
					document.getElementById("retDate").options[mRet-1].selected=true;
					l=document.OnlineSearch.DptMonYr.selectedIndex
						document.OnlineSearch.RetMonYr.options[l].selected=true;
					return false;
				}
				return false;
		} // end of months of 30 days validation

		if(mDpt==1 ||  mDpt==3 || mDpt==5 || mDpt==7 || mDpt==8 || mDpt==10 || mDpt==12 )
		{
				if(dDpt>29)
				{
					var I,l
					I=document.OnlineSearch.DptMonYr.length
					l=document.OnlineSearch.DptMonYr.selectedIndex
					
					if(l<10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l+1].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l].selected=true;
					return false;
					}
				}
				else if(dDpt<29)
				{
					document.getElementById("retDate").options[mRet-1].selected=true;
					l=document.OnlineSearch.DptMonYr.selectedIndex
					document.OnlineSearch.RetMonYr.options[l].selected=true;
				}
				return false;
				
          }// end of months of 31 days validation


  		if(mDpt==2)
		{			
			 if(yDpt%4 ==0)
			{
				if(dDpt>=29)
					{
						var I,l
						I=document.OnlineSearch.DptMonYr.length
						l=document.OnlineSearch.DptMonYr.selectedIndex
					
							if(l<10)
							{
							document.getElementById("retDate").options[mRet-1].selected=true;
							document.OnlineSearch.RetMonYr.options[l+1].selected=true;
							return false;
							}
							else if(l==10)
							{
							document.getElementById("retDate").options[mRet-1].selected=true;
							document.OnlineSearch.RetMonYr.options[l].selected=true;
							return false;
							}
					} //end of Dtp > than 30
					
					else if(dDpt<=28)
					{
						document.getElementById("retDate").options[mRet-1].selected=true;
						return false;
					} //end of Dtp < than 30

			} //end of if month is a leap year 

			 if(yDpt%4 !=0)
			{
					if(dDpt>=28)
					{
						var I,l
						I=document.OnlineSearch.DptMonYr.length
						l=document.OnlineSearch.DptMonYr.selectedIndex
					
							if(l<10)
							{
							document.getElementById("retDate").options[mRet-1].selected=true;
							document.OnlineSearch.RetMonYr.options[l+1].selected=true;
							return false;
							}
							else if(l==10)
							{
							document.getElementById("retDate").options[mRet-1].selected=true;
							document.OnlineSearch.RetMonYr.options[l].selected=true;
							return false;
							}
					} //end of Dtp > than 30
					
					else if(dDpt<28)
					{
						document.getElementById("retDate").options[mRet-1].selected=true;
						l=document.OnlineSearch.DptMonYr.selectedIndex
						document.OnlineSearch.RetMonYr.options[l].selected=true;
						return false;
					} //end of Dtp < than 30

			} //end of not a leap year

          }// end of months of feburary  validation

//} //end of function if return date is less than depart date


//To Check the Valid Depart Dates

		if(validDate(document.OnlineSearch.DptMonYr.value.substring(2,7), document.OnlineSearch.DptMonYr.value.substring(0,2), document.OnlineSearch.dptDate.value)==false)
		{
		alert("Please Selet the Valid Depart date");
		document.OnlineSearch.dptDate.focus();
		return false;
		}

//To Check the Valid Return Date

		if(validDate(document.OnlineSearch.RetMonYr.value.substring(2,7), document.OnlineSearch.RetMonYr.value.substring(0,2), document.OnlineSearch.retDate.value)==false)
		{
		alert("Please Selet the Valid Return date");
		document.OnlineSearch.retDate.focus();
		return false;
		}
	
}// end of departure date change function






//departure month validation begin here==================================================================

function dptMonthValid()
{

	var Dptdate= new Date(document.OnlineSearch.DptMonYr.value.substring(2,7), document.OnlineSearch.DptMonYr.value.substring(0,2), document.OnlineSearch.dptDate.value);
	var retDate= new Date(document.OnlineSearch.RetMonYr.value.substring(2,7), document.OnlineSearch.RetMonYr.value.substring(0,2), document.OnlineSearch.retDate.value);



		if(validDate(document.OnlineSearch.DptMonYr.value.substring(2,7), document.OnlineSearch.DptMonYr.value.substring(0,2), document.OnlineSearch.dptDate.value)==false)
		{
		alert("Please Selet the Valid Depart date");
//		document.getElementById("dptDate").options[29].selected=true;
		document.OnlineSearch.dptDate.focus();
		return false;
		}

//To Check the Valid Return Date

		if(validDate(document.OnlineSearch.RetMonYr.value.substring(2,7), document.OnlineSearch.RetMonYr.value.substring(0,2), document.OnlineSearch.retDate.value)==false)
		{
		//alert("Please Selet the Valid Return date");
//		document.OnlineSearch.retDate.focus();
		return false;
		}



//if(retDate<=Dptdate)
//{
		retDate.setDate(Dptdate.getDate()+3)
		var dDpt,mDpt,yDpt,dRet,mRet,yRet
		dDpt=Dptdate.getDate()   //departure date
		mDpt=Dptdate.getMonth()	 //departure month
		yDpt=Dptdate.getFullYear() //departure year
		dRet=retDate.getDate()	 //return date
		mRet=retDate.getDate()	 //return month
		yRet=retDate.getFullYear()	 //return month
		mDpt=mDpt+1

			if(mDpt==4 || mDpt==6 || mDpt==9 || mDpt==11 )   //for months having 30 days
			{
			
				if(dDpt>=30)
				{
					var I,l
					I=document.OnlineSearch.DptMonYr.length
					l=document.OnlineSearch.DptMonYr.selectedIndex
		
					if(l<10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l+1].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l].selected=true;
					return false;
					}
				} // end of if dDpt >=30
				
			else if(dDpt<30)
				{
					document.getElementById("retDate").options[mRet-1].selected=true;
					var I,l
					I=document.OnlineSearch.DptMonYr.length
					l=document.OnlineSearch.DptMonYr.selectedIndex
					
					if(l<10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l].selected=true;
					return false;
					}
				return false;
				}
				return false;
			} // end of months of 30 days validation


		if(mDpt==1 ||  mDpt==3 || mDpt==5 || mDpt==7 || mDpt==8 || mDpt==10 || mDpt==12 ) // for months having 31 days
		{
			if(dDpt>=30)
			{
				var I,l
				I=document.OnlineSearch.DptMonYr.length
				l=document.OnlineSearch.DptMonYr.selectedIndex
					if(l<10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l+1].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l].selected=true;
					return false;
					}
			}
			else if(dDpt<30)
			{
				document.getElementById("retDate").options[mRet-1].selected=true;
				var I,l
				I=document.OnlineSearch.DptMonYr.length
				l=document.OnlineSearch.DptMonYr.selectedIndex
					if(l<10)
					{
					document.getElementById("retDate").options[dDpt].selected=true;						
					document.getElementById("retDate").options[dDpt].selected=true;						
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l].selected=true;
					return false;
					}
			}
			return false;
      }// end of months of 31 days validation
	  
		  
	if(mDpt==2)  //for month of feburary
	{
		 if(yDpt%4 ==0) //for leap year
		{
			if(dDpt>=29)
			{
				var I,l
				I=document.OnlineSearch.DptMonYr.length
				l=document.OnlineSearch.DptMonYr.selectedIndex
					if(l<10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l+1].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.getElementById("retDate").options[mRet-1].selected=true;
					document.OnlineSearch.RetMonYr.options[l].selected=true;
					return false;
					}
   			 } //end of Dtp > than 29
					
			else if(dDpt<=28)
			{
				document.getElementById("retDate").options[mRet-1].selected=true;
				return false;
			} //end of Dtp < than 30

	} //end of if month is a leap year 

		 if(yDpt%4 !=0)  // for a year which is not leap year
			{
				if(dDpt>=28)
				{
					var I,l
					I=document.OnlineSearch.DptMonYr.length
					l=document.OnlineSearch.DptMonYr.selectedIndex
					if(l<10)
					{
					document.getElementById("retDate").options[2].selected=true;
					document.OnlineSearch.RetMonYr.options[l+1].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.getElementById("retDate").options[2].selected=true;
					document.OnlineSearch.RetMonYr.options[l].selected=true;
					return false;
					}
				} //end of Dtp >= than 28
					
			else if(dDpt<=27)
				{
					document.getElementById("retDate").options[mRet-1].selected=true;
					var I,l
					I=document.OnlineSearch.DptMonYr.length
					l=document.OnlineSearch.DptMonYr.selectedIndex
						if(dDpt==26)
						{
							var I,l
							I=document.OnlineSearch.DptMonYr.length
							l=document.OnlineSearch.DptMonYr.selectedIndex
								if(l<10)
								{
								document.getElementById("retDate").options[1].selected=true;						
								document.OnlineSearch.RetMonYr.options[l+1].selected=true;
								return false;
								}
								else if(l==10)
								{
								document.getElementById("retDate").options[mRet-1].selected=true;
								document.OnlineSearch.RetMonYr.options[l].selected=true;
								return false;
								}
						}// end of dDpt==26
						if(l<10)
						{
						document.getElementById("retDate").options[dDpt].selected=true;						
						document.getElementById("retDate").options[dDpt].selected=true;						
						document.getElementById("retDate").options[mRet-1].selected=true;
						document.OnlineSearch.RetMonYr.options[l].selected=true;
						return false;
						}
							
						else if(l==10)
						{
						document.getElementById("retDate").options[mRet-1].selected=true;
						document.OnlineSearch.RetMonYr.options[l].selected=true;
						return false;
						}

						return false;
			} //end of Dtp < than 27

		} //end of year not a leap year

     }// end of months of feburary  validation mDpt==2
//} //end of function if return date is less than depart date

} // end of on change of month of departure date


//=======================================================================
















//---------end of month change of return date
function  retMonthChange()
{}
//---------end of month change of return date---------

function dateDiff()
{
	
	var CurDate= new Date(document.OnlineSearch.BookYr.value, document.OnlineSearch.BookMon.value, document.OnlineSearch.BookDD.value);
	var Dptdate= new Date(document.OnlineSearch.DptMonYr.value.substring(2,7), document.OnlineSearch.DptMonYr.value.substring(0,2), document.OnlineSearch.dptDate.value);
	var retDate= new Date(document.OnlineSearch.RetMonYr.value.substring(2,7), document.OnlineSearch.RetMonYr.value.substring(0,2), document.OnlineSearch.retDate.value);
	var vdiff

	if(document.OnlineSearch.rdotype(0).checked == true || document.OnlineSearch.rdotype(2).checked == true )
	{
		vdiff=((retDate-Dptdate)/86400)/1000
		if (vdiff>30)
		{
			alert("The return dates must be within 1 months from the depart date, please adjust.");
			return false;
		}
	}

return true;
}
//---------------end of date validation-------------------------------------

//------------------- option buttons on search page validation--------------------

function call_page()
{
	window.location.href="htlSearch.aspx";
}

function call_Car()
{
		document.car_rent.submit();
		//window.location.href="car_rental.aspx";
}

function call_page1()
{
	window.location.href="flthtlsearch.aspx";
}

function opTravel()
{
	window.location.href="travelinsurance1.aspx";
}
					
function opAPT()
{
	  document.Apt_Exp.submit();

}

function call_Flights()
{
	window.location.href="fltsearch.aspx";
}

//---------------------------------------end of option buttons on search page validation-------------------------------

//--------------showing and hiding of calender on home page validation-----------------------------------------------------


function ShowHideLayer(x,Fr)
{
	if(firstCal==1)
	{
		window.document.getElementById("IFrameCalander").src="calender.htm"
		resizeCaller1();
		window.document.getElementById("calander").style.visibility="visible";
		window.document.getElementById("calType").value=Fr
	}
	else
	{
		window.document.getElementById("calander").style.visibility="visible";
		resizeCaller1();
		window.document.getElementById("calType").value=Fr
	}
firstCal=0;
}
//-------------- end showing and hiding of calender on home page validation-----------------------------------------------------

//--------------showing and hiding of left calender on left page validation-----------------------------------------------------
//==========================================================================
//Flight Hotel Clander
function fHShowHideLayerLeft(x,Fr)
{
	if(FHfirstCallLeft==1)
	{
		window.document.getElementById("FHIFrameCalander").src="fhcalender.htm"
		window.document.getElementById("FHCalander").style.visibility="visible";
		window.document.getElementById("hFHCalType").value=Fr
	}
	else
	{
		window.document.getElementById("FHCalander").style.visibility="visible";
		window.document.getElementById("hFHCalType").value=Fr
	}
FHfirstCallLeft=0;
}

function fHShowHideLayer(x,Fr)
{
	if(FHfirstCal==1)
	{
		window.document.getElementById("FHIFrameCalander").src="fhcalender.htm"
		window.document.getElementById("FHCalander").style.visibility="visible";
		window.document.getElementById("hFHCalType").value=Fr
	}
	else
	{
		window.document.getElementById("FHCalander").style.visibility="visible";
		resizeCaller1();
		window.document.getElementById("hFHCalType").value=Fr
	}
FHfirstCal=0;
}
//End Flight Hotel Clander
//==========================================================================

//==========================================================================
//Hotel Clander
function hShowHideLayerLeft(x,Fr)
{
	
	if(HfirstCallLeft==1)
	{
		window.document.getElementById("HIFrameCalander").src="hcalender.htm"
		window.document.getElementById("HCalander").style.visibility="visible";
		window.document.getElementById("hHCalType").value=Fr
	}
	else
	{
		window.document.getElementById("HCalander").style.visibility="visible";
		window.document.getElementById("hHCalType").value=Fr
	}
HfirstCallLeft=0;
}
function hShowHideLayer(x,Fr)
{
	if(HfirstCal==1)
	{
		window.document.getElementById("HIFrameCalander").src="hcalender.htm"
		window.document.getElementById("HCalander").style.visibility="visible";
		window.document.getElementById("hHCalType").value=Fr
	}
	else
	{
		window.document.getElementById("HCalander").style.visibility="visible";
		resizeCaller1();
		window.document.getElementById("hHCalType").value=Fr
	}
HfirstCal=0;
}
//End Hotel Clander
//==========================================================================

//==========================================================================
//Flight Clander
function fShowHideLayerLeft(x,Fr)
{
	
	if(FfirstCallLeft==1)
	{
		window.document.getElementById("FIFrameCalander").src="fcalender.htm"
		window.document.getElementById("FCalander").style.visibility="visible";
		window.document.getElementById("hFCalType").value=Fr
	}
	else
	{
		window.document.getElementById("FCalander").style.visibility="visible";
		window.document.getElementById("hFCalType").value=Fr
	}
FfirstCallLeft=0;
}
function hShowHideLayer(x,Fr)
{
	if(FfirstCal==1)
	{
		window.document.getElementById("FIFrameCalander").src="fcalender.htm"
		window.document.getElementById("FCalander").style.visibility="visible";
		window.document.getElementById("hFCalType").value=Fr
	}
	else
	{
		window.document.getElementById("FCalander").style.visibility="visible";
		window.document.getElementById("hFCalType").value=Fr
	}
FfirstCal=0;
}
//End Flight Clander
//==========================================================================




function ShowHideLayerLeft(x,Fr)
{
	if(firstCallLeft==1)
	{
		window.document.getElementById("IFrameCalander").src="calender.htm"
		resizeCaller1();
		window.document.getElementById("calander").style.visibility="visible";
		window.document.getElementById("calType").value=Fr
	}
	else
	{
		window.document.getElementById("calander").style.visibility="visible";
		resizeCaller1();
		window.document.getElementById("calType").value=Fr
	}
firstCallLeft=0;
}
//-----------------------------end of reseting of tabs in different pages-----------------------------------------------------------

function commonValidate()
{
	if(document.mailform.txtname.value=="")
	{	
	alert("Please enter your name.")
	document.mailform.txtname.focus()
	return false
	}
	else if(document.mailform.txtname.value==parseInt(document.mailform.txtname.value))
	{
	alert("Your name is invalid")
	document.mailform.txtname.focus()
	document.mailform.txtname.select()
	return false
	}
	else if(document.mailform.txtmail.value=="")
	{
	alert("Please enter your E-mail address.")
	document.mailform.txtmail.focus()
	return false
	}
	else if(document.mailform.txtmail.value.indexOf("@")==-1)
	{
	alert("Please enter your valid E-mail address.")
	document.mailform.txtmail.focus()
	document.mailform.txtmail.select()
	return false
	}
	else if(document.mailform.txtmail.value.indexOf(".")==-1)
	{
	alert("Please enter your valid E-mail address.")
	document.mailform.txtmail.focus()
	document.mailform.txtmail.select()
	return false
	}
}
//---------------------------------end of common submit function checking email,name,etc.----------------------------------


//-----------------converter validation------------------------------
//-----------------converter validation------------------------------

//---------for booking.asp reset button-----------

//---------for booking.asp reset button-----------

function test()
{
}


//----------------validation for city offer cmg.aspx file-----------------------------

//----------------validation ends for city offer cmg.aspx file-----------------------------	

//--------------------------select validation


function goToBookMark(pp)
{

var d,f
d=document.MainForm.select.selectedIndex
f=document.MainForm.select.options[d].text
document.IFrameSelectCountryInner.location.hash = f;
}

function hideContinentLayer(dd)
{

window.parent.window.parent.window.document.getElementById("selectContinent").style.visibility="hidden";
window.parent.window.parent.window.document.getElementById("selectCountry").style.visibility="visible";
window.parent.window.parent.window.document.getElementById("IFrameSelectCountry").src="country.aspx?CN="+dd+""
window.parent.window.parent.window.document.getElementById("IFrameSelectCountry").height=340
}

function passValue(ff)
{

window.parent.window.parent.window.document.getElementById("DestTo").value=ff

window.parent.window.parent.window.document.getElementById("selectCountry").style.visibility="hidden";
}

function CloseWind()
{

window.parent.document.getElementById("selectContinent").style.visibility="hidden";
}

function setConLayer()
{
window.parent.document.getElementById("IFrameSelect").width="267"
window.parent.document.getElementById("IFrameSelect").height="133"
window.parent.document.getElementById("IFrameSelect").scrolling="yes"
}

function DropSelCity(ll)
{

var d,f
d=document.MainForm.select.selectedIndex
f=document.MainForm.select.options[d].text
location.href="country.aspx?CN="+f+""
}
//end of select validation	

//------for fltsummary.aspx-----and flthtlsummary.aspx----------
function checkCheckBox(f){

if (f.agree.checked == false )
{
alert('Please read the Terms and Conditions and check box to acknowledge them.');
return false;
}else
return true;
}
//------for fltsummary.aspx---------------

//travel insuarence page validation for help tec

var buts = new Array();
 buts[0] = 'next';
 buts[1] = 'next_on';
 buts[2] = 'back';
 buts[3] = 'back_on';
 buts[4] = 'help';
 buts[5] = 'help_on';
 buts[6] = 'purchase';
 buts[7] = 'purchase_on';
 buts[8] = 'emailquote';
 buts[9] = 'emailquote_on';
 buts[10] = 'covertable';
 buts[11] = 'covertable_on';
 buts[12] = 'delproc';
 buts[13] = 'delproc_on';

var but = new Array();

function sWap(butName,arrNo) {
 window.document[butName].src = but[arrNo].src;
}
 
function popUpHelp(){
     
 var CenW=(screen.width - 700) /2; 
  var CenH=(screen.height - 360) /2;
   Help=window.open("https://www.ahrisk.net/otis_v3/clientvault/IGL/help/index.htm","Help","width=700,height=360,top="+CenH+",left="+CenW+",toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes");
}

function eMail()	{
 var CenW    = (screen.width - 390) /2;   
 var CenH    = (screen.height - 160) /2; 

 eMailWin=window.open("email.asp","eMailWin","width=390,height=160,top="+CenH+",left="+CenW+",toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes");
}

function coverTable()	{
 var CenW    = (screen.width - 540) /2;   
 var CenH    = (screen.height - 360) /2; 

coverTab=window.open("https://www.ahrisk.net/otis_v3/clientvault/IGL/help/covertable.htm","coverTab","width=540,height=360,top="+CenH+",left="+CenW+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
}

function gothere()
{
	alert('got here step 4');
}


function popUpGlos(i){
 CenW    = (screen.width - 500) /2;   
 CenH    = (screen.height - 300) /2; 
 url='https://www.ahrisk.net/otis_v3/clientvault/IGL/help/glossary.htm#'+i;

 Glos=window.open(url,"Glos","width=500,height=300,top="+CenH+",left="+CenW+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
}
//------------validation of travle insurance ends-----------------------


//------------------function used in booking.aspx------------------
function monthNameString(ll)
{
	if(ll==00)
	{
	return "Jan"
	}
	if(ll==01)
	{
	return "Feb"
	}
	if(ll==02)
	{
	return "Mar"
	}
	if(ll==03)
	{
	return "Apr"
	}
	if(ll==04)
	{
	return "May"
	}
	if(ll==05)
	{
	return "Jun"
	}
	if(ll==06)
	{
	return "Jul"
	}
	if(ll==07)
	{
	return "Aug"
	}
	if(ll==08)
	{
	return "Sep"
	}
	if(ll==09)
	{
	return "Oct"
	}
	if(ll==10)
	{
	return "Nov"
	}
	if(ll==11)
	{
	return "Dec"
	}
}

function monthName(ll)
{
	if(ll=="JAN")
	{
	return 00
	}
	if(ll=="FEB")
	{
	return 01
	}
	if(ll=="MAR")
	{
	return 02
	}
	if(ll=="APR")
	{
	return 03
	}
	if(ll=="MAY")
	{
	return 04
	}
	if(ll=="JUN")
	{
	return 05
	}
	if(ll=="JUL")
	{
	return 06
	}
	if(ll=="AUG")
	{		
	return 07
	}
	if(ll=="SEP")
	{
	return 08
	}
	if(ll=="OCT")
	{
	return 09
	}
	if(ll=="NOV")
	{
	return 10
	}
	if(ll=="DEC")
	{
	return 11
	}
}
//-------------------end of function used in booking.aspx-------------

//---onSubmit of travel insurance----------------------------------------------------


function travelSubmit()
{
	if(validDate(document.OnlineSearch.Year0.value, document.OnlineSearch.month0.value, document.OnlineSearch.date0.value)==false)
	{
		alert("Please Selet the Valid date");
		document.OnlineSearch.date0.focus();
		return false;
	}
	if(document.OnlineSearch.Initial0.value=="")
	{	
		alert("Please enter your first name.")
		document.OnlineSearch.Initial0.focus()
		return false
	}
	else if(document.OnlineSearch.Surname0.value=="")
	{	
		alert("Please enter your Surname.")
		document.OnlineSearch.Surname0.focus()
		return false
	}	
	else if(document.OnlineSearch.address1.value=="")
	{	
		alert("Please enter your Address.")
		document.OnlineSearch.address1.focus()
		return false
	}
	else if(document.OnlineSearch.city.value=="")
	{	
		alert("Please enter your City name.")
		document.OnlineSearch.city.focus()
		return false
	}
	else if(document.OnlineSearch.postcode.value=="")
	{	
		alert("Please enter your Post Code.")
		document.OnlineSearch.postcode.focus()
		return false
	}	
	else if(document.OnlineSearch.telephone.value=="")
	{	
		alert("Please enter your Telephone no.")
		document.OnlineSearch.telephone.focus()
		return false
	}
	else if(document.OnlineSearch.email.value=="")
	{
		alert("Please enter your E-mail address.")
		document.OnlineSearch.email.focus()
		return false
	}
	else if(document.OnlineSearch.email.value.indexOf("@")==-1)
	{
		alert("Please enter your valid E-mail address.")
		document.OnlineSearch.email.focus()
		document.OnlineSearch.email.select()
		return false
	}
	else if(document.OnlineSearch.email.value.indexOf(".")==-1)
	{
		alert("Please enter your valid E-mail address.")
		document.OnlineSearch.email.focus()
		document.OnlineSearch.email.select()
		return false
	}
	else if(!document.OnlineSearch.checkbox.checked)
	{
		alert("Please Read the Terms & Conditions before Booking !")
		document.OnlineSearch.checkbox.focus()		
		return false;
	}
}

//----------------end of trabel insurance on submit------------------------------


//---------date validation where there is only on date either departure or return
function datevalidationfltSearFch(){

	var CurDate= new Date(document.OnlineSearch.BookYr.value, document.OnlineSearch.BookMon.value, document.OnlineSearch.BookDD.value);
	var Dptdate= new Date(document.OnlineSearch.DptMonYr.value.substring(2,7), document.OnlineSearch.DptMonYr.value.substring(0,2), document.OnlineSearch.dptDate.value);
//	var retDate= new Date(document.OnlineSearch.RetMonYr.value.substring(2,7), document.OnlineSearch.RetMonYr.value.substring(0,2), document.OnlineSearch.retDate.value);
//To Check the Valid Depart Dates

		if(validDate(document.OnlineSearch.DptMonYr.value.substring(2,7), document.OnlineSearch.DptMonYr.value.substring(0,2), document.OnlineSearch.dptDate.value)==false)
		{
		alert("Please Selet the Valid Depart date");
		document.OnlineSearch.dptDate.focus();
		return false;
		}
//To check Depart Date is not Less than the Current Date

		if(Dptdate<=CurDate)
		{
		alert("Depart Date Must be greater than Current date");
		document.OnlineSearch.dptDate.focus();
		return false;
		}
}
//-------------end of date validation whre there is only one date---------------------
//--------for headder innerPage result car_hire etc...-------------------

function headInnHome()
{
	window.parent.document.location.href="default.aspx"
}

function headInnMap()
{
	window.parent.document.location.href="default.aspx?PG=MG"
}

function headInnTravel()
{
	window.parent.document.location.href="default.aspx?PG=TR"
}

function headInnCompany()
{
	window.parent.document.location.href="default.aspx?PG=OC"
}

function headInnContact()
{
	window.parent.document.location.href="default.aspx?PG=CU"
}


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"
}
//---------------end of headder inner------------------------------------
function sendValue(DestTo,Destination,DestFrom,dptDate,DptMonYr,retDate,RetMonYr,Adult,Child,infant,sngRoom,twnRoom,dblRoom,tplRoom,AirLine,RequestType,JrnType,rdotype,conDesName,allCountry,desIndex,fulldestination,desttoindex,fromdest,FHDptDate,FHDptMon,FHDptYr,FHRetDate,FHRetMon,FHRetYr)
	{
	document.flthtlSearch.DestTo.value=DestTo;
	document.flthtlSearch.Destination.value=Destination;
	document.flthtlSearch.DestFrom.value=DestFrom;
	document.flthtlSearch.dptDate.value=dptDate;
	document.flthtlSearch.DptMonYr.value=DptMonYr;
	document.flthtlSearch.retDate.value=retDate;
	document.flthtlSearch.RetMonYr.value=RetMonYr;
	document.flthtlSearch.Adult.value=Adult;
	document.flthtlSearch.Child.value=Child;
	document.flthtlSearch.infant.value=infant;
	document.flthtlSearch.sngRoom.value=sngRoom;
	document.flthtlSearch.twnRoom.value=twnRoom;
	document.flthtlSearch.dblRoom.value=dblRoom;
	document.flthtlSearch.tplRoom.value=tplRoom;
	document.flthtlSearch.AirLine.value=AirLine;
	document.flthtlSearch.RequestType.value=RequestType;
	document.flthtlSearch.JrnType.value=JrnType;
	document.flthtlSearch.rdotype.value=rdotype;
	document.flthtlSearch.conDesName.value=conDesName;
	document.flthtlSearch.allCountry.value=allCountry;
	document.flthtlSearch.desIndex.value=desIndex;
	document.flthtlSearch.fulldestination.value=fulldestination;
	document.flthtlSearch.desttoindex.value=desttoindex;
	document.flthtlSearch.fromdest.value=fromdest;
	document.flthtlSearch.FHDptDate.value=FHDptDate;
	document.flthtlSearch.FHDptMon.value=FHDptMon;
	document.flthtlSearch.FHDptYr.value=FHDptYr;
	document.flthtlSearch.FHRetDate.value=FHRetDate;
	document.flthtlSearch.FHRetMon.value=FHRetMon;
	document.flthtlSearch.FHRetYr.value=FHRetYr;
	document.flthtlSearch.method="post";
	document.flthtlSearch.target="_top";
	document.flthtlSearch.action="result.aspx";
	document.flthtlSearch.submit();
	
	}
