
//---------setting height of the frame----------

//--end of setting height of the frame---------

//------------------------------------------------submit validation for different submit pages-------------

function ValidateSearch() //for flight page
{
remove_XS_whitespace(document.OnlineSearch.DestTo);



		if(document.OnlineSearch.DestTo.value=="")
		{
		alert("Please Enter the Destination Name");
		document.OnlineSearch.DestTo.focus();
		return false;
		}
		
		if(document.OnlineSearch.DestTo.value==parseInt(document.OnlineSearch.DestTo.value))
		{
		alert("Invalid Destination name");
		document.OnlineSearch.DestTo.focus();
		document.OnlineSearch.DestTo.select();
		return false;
		}

		if(document.OnlineSearch.checkbox.checked)
		{
			if(document.OnlineSearch.RdJrnType[0].checked)
			{	if(datevalidation()==false)
				{ return false;
				}
			}
			else if(document.OnlineSearch.RdJrnType[1].checked)
			{
				if(datevalidationfltSearch()==false)
				{ return false;}
			}

		}
	

		if(document.OnlineSearch.checkbox.checked==false)
		{
			if(datevalidation()==false)
			{ return false;	}
		}

		
		
		
return true;
}




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
{
remove_XS_whitespace(document.OnlineSearch.DestTo);
	
		if(document.OnlineSearch.DestTo.value=="")
		{
		alert("Please fill a destination");
		document.OnlineSearch.DestTo.focus();
		document.OnlineSearch.DestTo.select();
		return false;
		}

	
		if(document.OnlineSearch.DestTo.value==parseInt(document.OnlineSearch.DestTo.value))
		{
		alert("Invalid Destination name");
		document.OnlineSearch.DestTo.focus();
		document.OnlineSearch.DestTo.select();
		return false;
		}


		if(datevalidation()==false)
		{
			
		return false;
		}
		
				
return true;
}
//-----------------------------end of fltLeftSearch.aspx ------------------



function FlightHotelSearch()  //return for flthtlsearch.aspx 
{

		var D = new Date(document.OnlineSearch.BookYr.value, document.OnlineSearch.BookMon.value, document.OnlineSearch.BookDD.value + 1);
		alert(D);

		if(datevalidation()==false)
		{
		return false;
		}

		var adValue,twValue,doValue,siValue,triValue,total
		adValue=new Number(document.OnlineSearch.Adult.value)
		twValue=new Number(document.OnlineSearch.twnRoom.value)
		doValue=new Number(document.OnlineSearch.dblRoom.value)
		siValue=new Number(document.OnlineSearch.sngRoom.value)
		triValue=new Number(document.OnlineSearch.tplRoom.value)
	
		twValue=twValue*2
		doValue=doValue*2
		triValue=triValue*3
		total=(twValue+doValue+siValue+triValue)
		if(total!=adValue)
		{
		alert("Invalid Room Selection")
		document.OnlineSearch.sngRoom.focus();
		return false;
		}

		var sI
		sI=document.OnlineSearch.Destination.selectedIndex
		if(sI==0)
		{
		alert("Please choose a destination")
		document.OnlineSearch.Destination.focus()
		return false;
		}

		if(dateDiff()==false)
		{
		return false;
		}

}


function hotelSearch() //for hotel search
{
		if(datevalidation()==false)
		{
		return false;
		}
		
		var sI
		sI=document.OnlineSearch.Destination.selectedIndex
		if(sI==0)
		{
		alert("Please choose a destination")
		document.OnlineSearch.Destination.focus()
		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;
		}

}

// end of hotel search

//travel

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;
}



// endstravel


//----------validation for htlsummary.asp page------------------------------------

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();
		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.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;
		}

window.parent.scroll(0,0);
}



function RSpace()
{
	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.");
	//		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.");
}

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.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.all.item("IFrameSelectCountryInner").src=""
window.parent.document.all.item("selectCountry").style.visibility="hidden";
}


function showContinent()
{
window.document.all.item("selectCountry").style.visibility="visible";
}

function goBack()
{
document.all.item("IFrameSelectCountryInner").src=""
window.parent.document.all.item("selectCountry").style.visibility="hidden";
window.parent.document.all.item("selectContinent").style.visibility="visible";
}
function passValueflthtl(vCode,vDestName)
{

window.parent.window.parent.window.document.all.item("DestinationText").value=vDestName
window.parent.window.parent.window.document.all.item("Destination").value=vCode
window.parent.window.parent.window.document.all.item("selectCountry").style.visibility="hidden";
}



function setConLayer()
{
window.parent.document.all.item("IFrameSelect").width="267"
window.parent.document.all.item("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(){

	alert("hi i am in 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);
var D = new Date(document.OnlineSearch.BookYr.value, document.OnlineSearch.BookMon.value, document.OnlineSearch.BookDD.value + 1);
//with (D) setDate(getDate(document.OnlineSearch.BookYr.value, document.OnlineSearch.BookMon.value, document.OnlineSearch.BookDD.value)+1);
//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();
		alert(D);
		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();
alert(D);
		return false;
		}

//To check Depart Date is not Less than the Current Date

//var D ;
// with (D = new Date()) setDate(getDate()+1)
		if(Dptdate<=D)
		{
alert(D);
		alert("Depart Date Must be greater than Current date");
		document.OnlineSearch.dptDate.focus();
		return false;
		}

//To Check the Return Date is greater Than the Depart Date

		if(Retdate<Dptdate)
		{
		alert("Return Date Must be greater than Depart date");
		document.OnlineSearch.retDate.focus();
alert(D);
		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.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("RetMonYr").options[l+1].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("RetMonYr").options[l].selected=true;
					return false;
					}
				}
				else if(dDpt<=28)
				{
					document.all.item("RetDate").options[mRet-1].selected=true;
					l=document.OnlineSearch.DptMonYr.selectedIndex
						document.all.item("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.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("RetMonYr").options[l+1].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("RetMonYr").options[l].selected=true;
					return false;
					}
				}
				else if(dDpt<29)
				{
					document.all.item("RetDate").options[mRet-1].selected=true;
					l=document.OnlineSearch.DptMonYr.selectedIndex
					document.all.item("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.all.item("RetDate").options[mRet-1].selected=true;
							document.all.item("RetMonYr").options[l+1].selected=true;
							return false;
							}
							else if(l==10)
							{
							document.all.item("RetDate").options[mRet-1].selected=true;
							document.all.item("RetMonYr").options[l].selected=true;
							return false;
							}
					} //end of Dtp > than 30
					
					else if(dDpt<=28)
					{
						document.all.item("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.all.item("RetDate").options[mRet-1].selected=true;
							document.all.item("RetMonYr").options[l+1].selected=true;
							return false;
							}
							else if(l==10)
							{
							document.all.item("RetDate").options[mRet-1].selected=true;
							document.all.item("RetMonYr").options[l].selected=true;
							return false;
							}
					} //end of Dtp > than 30
					
					else if(dDpt<28)
					{
						document.all.item("RetDate").options[mRet-1].selected=true;
						l=document.OnlineSearch.DptMonYr.selectedIndex
						document.all.item("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.all.item("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.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("RetMonYr").options[l+1].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("RetMonYr").options[l].selected=true;
					return false;
					}
				} // end of if dDpt >=30
				
			else if(dDpt<30)
				{
					document.all.item("RetDate").options[mRet-1].selected=true;
					var I,l
					I=document.OnlineSearch.DptMonYr.length
					l=document.OnlineSearch.DptMonYr.selectedIndex
					
					if(l<10)
					{
					document.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("RetMonYr").options[l].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("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.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("RetMonYr").options[l+1].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("RetMonYr").options[l].selected=true;
					return false;
					}
			}
			else if(dDpt<30)
			{
				document.all.item("RetDate").options[mRet-1].selected=true;
				var I,l
				I=document.OnlineSearch.DptMonYr.length
				l=document.OnlineSearch.DptMonYr.selectedIndex
					if(l<10)
					{
					document.all.item("RetDate").options[dDpt].selected=true;						
					document.all.item("RetDate").options[dDpt].selected=true;						
					document.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("RetMonYr").options[l].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("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.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("RetMonYr").options[l+1].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.all.item("RetDate").options[mRet-1].selected=true;
					document.all.item("RetMonYr").options[l].selected=true;
					return false;
					}
   			 } //end of Dtp > than 29
					
			else if(dDpt<=28)
			{
				document.all.item("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.all.item("RetDate").options[2].selected=true;
					document.all.item("RetMonYr").options[l+1].selected=true;
					return false;
					}
					else if(l==10)
					{
					document.all.item("RetDate").options[2].selected=true;
					document.all.item("RetMonYr").options[l].selected=true;
					return false;
					}
				} //end of Dtp >= than 28
					
			else if(dDpt<=27)
				{
					document.all.item("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.all.item("RetDate").options[1].selected=true;						
								document.all.item("RetMonYr").options[l+1].selected=true;
								return false;
								}
								else if(l==10)
								{
								document.all.item("RetDate").options[mRet-1].selected=true;
								document.all.item("RetMonYr").options[l].selected=true;
								return false;
								}
						}// end of dDpt==26
						if(l<10)
						{
						document.all.item("RetDate").options[dDpt].selected=true;						
						document.all.item("RetDate").options[dDpt].selected=true;						
						document.all.item("RetDate").options[mRet-1].selected=true;
						document.all.item("RetMonYr").options[l].selected=true;
						return false;
						}
							
						else if(l==10)
						{
						document.all.item("RetDate").options[mRet-1].selected=true;
						document.all.item("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 + 1);
	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
	vdiff=((Retdate-Dptdate)/86400)/1000
	if (vdiff>14)
	{
	alert("The return dates must be within 2 weeks 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(x==1)
	{
		window.document.all.item("calander").style.visibility="visible";
		window.document.all.item("IFrameCalander").src="Calander.aspx?fro='" + Fr + "'";
	}
	else if(x==0)
	{
		window.document.all.item("calander").style.visibility="hidden";
	}
}
//-------------- end showing and hiding of calender on home page validation-----------------------------------------------------

//--------------showing and hiding of left calender on left page validation-----------------------------------------------------

function ShowHideLayerLeft(x,Fr)
{
		window.document.all.item("calander").style.visibility="visible";
		resizeCaller1();
		window.document.all.item("calType").value=Fr
}

//-------------- end showing and hiding of calender on home page validation-----------------------------------------------------


function resetTabs() //where all tabs are to be set as deactivated
{
window.parent.document.home.src="images/top_home1.jpg"
window.parent.document.map.src="images/top_map2.jpg"
window.parent.document.travel.src="images/top_mytravelguide1.jpg"
window.parent.document.company.src="images/top_ourcompany1.jpg"
window.parent.document.contact.src="images/top_contactus1.jpg"
}

function setHomeTab()  //for search page
{
window.parent.document.home.src="images/top_home2.jpg"
}
//-----------------------------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.all.item("selectContinent").style.visibility="hidden";
window.parent.window.parent.window.document.all.item("selectCountry").style.visibility="visible";
window.parent.window.parent.window.document.all.item("IFrameSelectCountry").src="country.aspx?CN="+dd+""
window.parent.window.parent.window.document.all.item("IFrameSelectCountry").height=340
}

function passValue(ff)
{

window.parent.window.parent.window.document.all.item("DestTo").value=ff

window.parent.window.parent.window.document.all.item("selectCountry").style.visibility="hidden";
}

function CloseWind()
{

window.parent.document.all.item("selectContinent").style.visibility="hidden";
}

function setConLayer()
{
window.parent.document.all.item("IFrameSelect").width="267"
window.parent.document.all.item("IFrameSelect").height="133"
window.parent.document.all.item("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 datevalidationfltSearch(){

	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"
}



//---------------end of headder inner------------------------------------
function ChangeDay()
{
	var gDeptDate= new Date(document.OnlineSearch.DptMonYr.value.substring(2,7), document.OnlineSearch.DptMonYr.value.substring(0,2), document.OnlineSearch.dptDate.value);
	var dValue=gDeptDate.getDay();
	var dayName
if(dValue=="0")
dayName="Sun"
else if(dValue=="1")
dayName="Mon"
else if(dValue=="2")
dayName="Tue"
else if(dValue=="3")
dayName="Wed"
else if(dValue=="4")
dayName="Thu"
else if(dValue=="5")
dayName="Fri"
else if(dValue=="6")
dayName="Sat"

	document.all.item("dayMonth").value=" "+dayName
	ChangeDayRet();
}

function ChangeDayRet()
{
	var gDeptDate= new Date(document.OnlineSearch.RetMonYr.value.substring(2,7), document.OnlineSearch.RetMonYr.value.substring(0,2), document.OnlineSearch.retDate.value);
	var dValue=gDeptDate.getDay();
	var dayName
	if(dValue=="0")
	dayName="Sun"
	else if(dValue=="1")
	dayName="Mon"
	else if(dValue=="2")
	dayName="Tue"
	else if(dValue=="3")
	dayName="Wed"
	else if(dValue=="4")
	dayName="Thu"
	else if(dValue=="5")
	dayName="Fri"
	else if(dValue=="6")
	dayName="Sat"

	document.all.item("dayMonthRet").value=" "+dayName
window.parent.scroll(0,0);
}
