var mylocation = window.location;

var sitename='IndianHoliday.com';

var siteURL='www.indianholiday.com';
//var siteURL='localhost/Indianholiday.com';

var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
///////////////////////////Country and country code Array
var ct_arr = Array(
Array('Country of Residence',''),
Array('Afghanistan',93), 
Array('Albania',355), 
Array('Algeria',213), 
Array('American Samoa',684), 
Array('Andorra',376), 
Array('Angola',244), 
Array('Anguilla',809), 
Array('Antarctica',672), 
Array('Antigua and Barbuda',1268), 
Array('Argentina',54), 
Array('Armenia',374), 
Array('Aruba',297), 
Array('Ascension',247), 
Array('Australia',61), 
Array('Austria',43), 
Array('Azerbaijan',994), 
Array('Bahamas',1242), 
Array('Bahrain',973), 
Array('Bangladesh',880), 
Array('Barbados',1246), 
Array('Belarus',375), 
Array('Belgium',32), 
Array('Belize',501), 
Array('Benin',229), 
Array('Bermuda',1441), 
Array('Bhutan',975), 
Array('Bolivia',591), 
Array('Bosnia and Herzegovina',387), 
Array('Botswana',267), 
Array('Brazil',55), 
Array('British Virgin Islands',284), 
Array('Brunei',673), 
Array('Bulgaria',359), 
Array('Burkina Faso',226), 
Array('Burundi',257), 
Array('Cambodia',855), 
Array('Cameroon',237), 
Array('Canada',1), 
Array('Cape Verde Islands',238), 
Array('Cayman Islands',345), 
Array('Central African Republic',236), 
Array('Chad',235), 
Array('Chatham Island (New Zealand)',64), 
Array('Chile',56), 
Array('China',86), 
Array('Christmas Island',672), 
Array('Cocos Islands',672), 
Array('Colombia',57), 
Array('Comoros',269), 
Array('Congo',242), 
Array('Cook Islands',682), 
Array('Costa Rica',506), 
Array('Croatia',385), 
Array('Cuba',53), 
Array('Cyprus',357), 
Array('Czech Republic',420), 
Array('Denmark',45), 
Array('Diego Garcia',246), 
Array('Djibouti',253), 
Array('Dominica',767), 
Array('Dominican Republic',809), 
Array('Easter Island',56), 
Array('Ecuador',593), 
Array('Egypt',20), 
Array('El Salvador',503), 
Array('Equatorial Guinea',240), 
Array('Eritrea',291), 
Array('Estonia',372), 
Array('Ethiopia',251), 
Array('Falkland Islands',500), 
Array('Faroe Islands',298), 
Array('Fiji',679), 
Array('Finland',358), 
Array('France',33), 
Array('French Antilles',596), 
Array('French Guyana',594), 
Array('French Polynesia',689), 
Array('Fyrom (Macedonia)',389), 
Array('Gabon',241), 
Array('Gambia',220), 
Array('Georgia',995), 
Array('Germany',49), 
Array('Ghana',233), 
Array('Gibraltar',350), 
Array('Greece',30), 
Array('Greenland',299), 
Array('Grenada and Carriacuou',473), 
Array('Grenadin Islands',784), 
Array('Guadeloupe',590), 
Array('Guam',671), 
Array('Guantanamo Bay',53), 
Array('Guatemala',502), 
Array('Guiana',594), 
Array('Guinea',224), 
Array('Guinea-Bissau',245), 
Array('Guyana',592), 
Array('Haiti',509), 
Array('Honduras',504), 
Array('Hong Kong',852), 
Array('Hungary',36), 
Array('Iceland',354), 
Array('India',91), 
Array('Indonesia',62), 
Array('Iran',98), 
Array('Iraq',964), 
Array('Ireland',353), 
Array('Israel',972), 
Array('Italy',39), 
Array('Ivory Coast',225), 
Array('Jamaica',876), 
Array('Japan',81), 
Array('Jerusalem',2), 
Array('Jordan',962), 
Array('Kazakhstan',7), 
Array('Kenya',254), 
Array('Kiribati',686), 
Array('South Korea',82), 
Array('Kuwait',965), 
Array('Kygyzstan',996), 
Array('Laos',856), 
Array('Latvia',371), 
Array('Lebanon',961), 
Array('Lesotho',266), 
Array('Liberia',231), 
Array('Libya',218), 
Array('Liechtenstein',41), 
Array('Lithuania',370), 
Array('Luxembourg',352), 
Array('Macau',853), 
Array('Macedonia',389), 
Array('Madagascar',261), 
Array('Malawi',265), 
Array('Malaysia',60), 
Array('Maldives',960), 
Array('Mali',223), 
Array('Malta',356), 
Array('Mariana Islands',670), 
Array('Marshall Islands',692), 
Array('Martinique',596), 
Array('Mauritania',222), 
Array('Mauritius',230), 
Array('Mayotte',269), 
Array('Mexico',52), 
Array('Micronesia,  Federated States',691), 
Array('Midway Islands',808), 
Array('Miquelon',508), 
Array('Moldova',373), 
Array('Monaco',377), 
Array('Mongolia',976), 
Array('Montserrat',664), 
Array('Morocco',212), 
Array('Mozambique',258), 
Array('Myanmar',95), 
Array('Namibia',264), 
Array('Nauru',674), 
Array('Nepal',977), 
Array('Netherlands',31), 
Array('Neth. Antilles',599), 
Array('Nevis',869), 
Array('New Caledonia',687), 
Array('New Zealand',64), 
Array('Nicaragua',505), 
Array('Niger',227), 
Array('Nigeria',234), 
Array('Niue',683), 
Array('Norfolk Island',672), 
Array('North Korea',850), 
Array('Norway',47), 
Array('Oman',968), 
Array('Pakistan',92), 
Array('Palau',680), 
Array('Panama',507), 
Array('Papua New Guinea',675), 
Array('Paraguay',595), 
Array('Peru',51), 
Array('Philippines',63), 
Array('Poland',48), 
Array('Portugal',351), 
Array('Principe',239), 
Array('Puerto Rico',1787), 
Array('Qatar',974), 
Array('Reunion Island',262), 
Array('Romania',40), 
Array('Russia',7), 
Array('Rwanda',250), 
Array('St. Helena',290), 
Array('St. Kitts',869), 
Array('St. Lucia',758), 
Array('St Pierre et Miquelon',508), 
Array('St. Vincent',784), 
Array('Saipan',670), 
Array('San Marino',378), 
Array('Sao Tome',239), 
Array('Saudi Arabia',966), 
Array('Senegal Republic',221), 
Array('Serbia',381), 
Array('Seychelles',248), 
Array('Sierra Leone',232), 
Array('Singapore',65), 
Array('Slovakia',421), 
Array('Slovenia',386), 
Array('Solomon Islands',677), 
Array('Somalia',252), 
Array('South Africa',27), 
Array('Spain',34), 
Array('Sri Lanka',94), 
Array('Sudan',249), 
Array('Suriname',597), 
Array('Swaziland',268), 
Array('Sweden',46), 
Array('Switzerland',41), 
Array('Syria',963), 
Array('Taiwan',886), 
Array('Tajikistan',7), 
Array('Tanzania',255), 
Array('Thailand',66), 
Array('Togo',228), 
Array('Tokelau',690), 
Array('Tonga',676), 
Array('Trinidad and Tobago',868), 
Array('Tunisia',216), 
Array('Turkey',90), 
Array('Turkmenistan',993), 
Array('Turks and Caicos Islands',649), 
Array('Tuvalu',688), 
Array('Uganda',256), 
Array('Ukraine',380), 
Array('United Arab Emirates',971), 
Array('United Kingdom',44), 
Array('United States',1), 
Array('Uruguay',598), 
Array('U.S. Virgin Islands',340), 
Array('Uzbekistan',7), 
Array('Vanuatu',678), 
Array('Vatican city',39), 
Array('Venezuela',58), 
Array('Vietnam',84), 
Array('Wake Island',808), 
Array('Wallis & Futuna Islands',681), 
Array('Western Samoa',685), 
Array('Yemen',967), 
Array('Yugoslavia',381), 
Array('Zaire',243), 
Array('Zambia',260), 
Array('Zanzibar',259), 
Array('Zimbabwe',263)
);

///////////Function for country
function ShowCountryOption()
{
	for(var x=0;x<ct_arr.length;x++)
	{
		document.write('<option value="' + ct_arr[x][0] + '">' + ct_arr[x][0] + '</option>\n');
	}

}

//////////////////////Function for ISD code
function getISDCode(sCtry)
{
	for(var x=0;x<ct_arr.length;x++)
	{
		if (sCtry == ct_arr[x][0])
		{
			document.generalfrm.txiCountryCode.value = ct_arr[x][1];
		}
	}

}


///////////////////////////////////////////////////////////////////////////////////////////////////////

	var ref = document.referrer;
	
	//alert(ref);
//var ref='http://www.tourtoindia.com/rajasthan/pushkar-fair.html';
//var t1=ref.split("/")
//var  n=t1.length
//var t2=t1[n -1];
//alert  (t2);
//var  locat=t2.split(".")

//var  m=locat.length

//var l2=locat[0]
	
//alert (l2);

var mydate=new Date()

var year=mydate.getYear()



if (year < 1000)

year+=1900



var day=mydate.getDay()

var month=mydate.getMonth()



var daym=mydate.getDate()

if (daym<10)

daym="0"+daym

var hours=mydate.getHours()

var minutes=mydate.getMinutes()

var seconds=mydate.getSeconds()

var dn="AM"

if (hours>=12)

dn="PM"

if (hours>12){

hours=hours-12

}

if (hours==0)

hours=12

if (minutes<=9)

minutes="0"+minutes

if (seconds<=9)

seconds="0"+seconds



var dateVal = daym + "-" + montharray[month] + "-" + year

var rtflg=true;

var pkflg=true;

var retmn = 0;

var pickmn = 0;



//////////////////////////////////////////////////////////event handling  for air booking
function checkIt(el) 
{
	//alert(el);
if (el.value == "air-booking" )  
{
	if(el.checked)
	{
	//alert ('hello1');
	//form.txaQuery.focus();  
	alert('Please mention:: \n\n Fly from & Fly to \n\n in Additional Requirements field');
	   generalfrm.txaQuery.focus();        
	//document.generalfrm["flight_from"].disabled=false;
	//document.generalfrm["flight_to"].disabled=false;
//document.getElementById('air').style.display = "block";
	}
	/*else
	{
	document.generalfrm["flight_from"].value='';
	document.generalfrm["flight_to"].value='';
	document.generalfrm["flight_from"].disabled=true;
	document.generalfrm["flight_to"].disabled=true;
//document.getElementById('air').style.display = "none";
	}*/
}
}
///////////////////////////////////////////////////////////




function frmtop(path,hdname){

}



function frmbtm(path){

document.write('</td> </tr> </table>');

}



///////////////////////




 /*****************************************general Form Validation******************************************/

 function commonFormValidate(form) {

var v=allBlanksCommon(form);
/*
    iscommonFrmArrival(form);
	iscommonFrmDepart(form);
	iscommonFrmDaysInHands(form);
	iscommonFrmAdults(form);
	iscommonFrmName(form);
    iscommonFrmCountry(form);

    iscommonFrmEmail(form);

iscommonFrmServices(form);
iscommonFrmAccomodation(form);


iscommonFrmPhone(form);

iscommonFrmCityCode(form);

iscommonFrmCountryCode(form);


iscommonFrmChildren(form);

//iscommonFrmTentArrival(form);

iscommonFrmQuery(form);

//iscommonFrmDestination(form)

//iscommonFrmCheckOut(form)
*/
return v ;  

}


/*
function allBlanksCommon(form) {

if((iscommonFrmCountry(form)&& iscommonFrmPhone(form))&&( iscommonFrmDaysInHands(form)&& iscommonFrmEmail(form) && iscommonFrmReEmail(form)) && (iscommonFrmCityCode(form) && iscommonFrmCountryCode(form)) && (iscommonFrmName(form) && iscommonFrmChildren(form)) && (iscommonFrmAdults(form)&&iscommonFrmArrival(form))&&(iscommonFrmQuery(form)&&iscommonFrmDepart(form))&&(iscommonFrmServices(form)&&iscommonFrmAccomodation(form))) {

 return true ; 
}



if((iscommonFrmCountry(form)==false || iscommonFrmPhone(form)==false) || (iscommonFrmAdults(form)==false || iscommonFrmEmail(form)==false) || iscommonFrmReEmail(form)==false || (iscommonFrmCityCode(form)==false || iscommonFrmCountryCode(form)==false) || (iscommonFrmName(form)==false || iscommonFrmArrival(form)==false) ||(iscommonFrmDaysInHands(form)==false ||iscommonFrmChildren(form)==false ) || (iscommonFrmQuery(form)==false||iscommonFrmDepart(form)==false) || (iscommonFrmServices(form)==false||iscommonFrmAccomodation(form)==false) ) {

composeform(form)

return false ; 

 }

}
*/

function allBlanksCommon(form) {

if(iscommonFrmArrival(form) && iscommonFrmDepart(form) && iscommonFrmServices(form) && iscommonFrmAdults(form) && iscommonFrmChildren(form) && iscommonFrmAccomodation(form) && iscommonFrmName(form) && iscommonFrmEmail(form) && iscommonFrmCountry(form) &&  iscommonFrmMobile(form) && iscommonFrmQuery(form)) {

 return true ; 
}



if((iscommonFrmArrival(form) == false) || (iscommonFrmDepart(form) == false) || (iscommonFrmServices(form) == false) || (iscommonFrmAdults(form) == false) || (iscommonFrmChildren(form) == false) || (iscommonFrmAccomodation(form) == false) || (iscommonFrmName(form) == false) || (iscommonFrmEmail(form) == false) || (iscommonFrmCountry(form) == false) || (iscommonFrmMobile(form) == false) || (iscommonFrmQuery(form) == false)) {

composeform(form)

return false ; 

 }

}

//Function to compose form error
function composeform(form) {
 var text = " You entered incorrectly or forgot to fill in ::\n"	

//Validate Arrival date
if(iscommonFrmArrival(form) == false) {
  text += "\nArrival Date -- cannot be earlier than today."
}

//Validate Departure date
if(iscommonFrmDepart(form)==false) {
  text += "\nDeparture date --is left or must be after arrival date "
}

//Validate Services field
if(iscommonFrmServices(form) == false) {
  text += "\nServices -- Either services or flight source destination left to be filled."
}

//Validate No. of adults field
if(iscommonFrmAdults(form) == false) {
  text += "\nNumber of Adults -- should be a number."
}

//Validate No. of children field
if(iscommonFrmChildren(form) == false) {
  text += "\nNumber of Children -- should be a number."
}

//Validate Accomodation field
if(iscommonFrmAccomodation(form) == false) {
  text += "\nAccomodationl -- Accomodation Type left for Hotel Booking."
}

//Validate Name field
if(iscommonFrmName(form) == false) {
  text += "\nName -- must be purely alphabetic"
}

//Validate Email field
if(iscommonFrmEmail(form) == false) {
  text += "\nEmail -- improper/incomplete e-mail ID."
}

//Validate Country field
if(iscommonFrmCountry(form) == false) {
  text += "\nCountry -- Not Selected Yet."
}

//Validate mobile no.
if(iscommonFrmMobile(form) == false){
  text += "\nMobile Number -- should be a number."
}

//Validate Query field
if(iscommonFrmQuery(form) == false) {
  text += "\nComment or Query --must have the services required."
}

//Alert final error out put
alert(text)
}

//For Services
function iscommonFrmServices(form)
{ 
	//alert('hello there');
	
	if(form["Services[ ]"][0].checked==false && form["Services[ ]"][1].checked==false && form["Services[ ]"][2].checked==false && form["Services[ ]"][3].checked==false)
	{
	//		alert('hello there1');
		//form.Services[ ].focus();
		//form.flight_from.focus();
		return false;
	}
	
//else if(form["Services[ ]"][3].checked==true && (form["flight_from"].value== "" || form["flight_to"].value== ""))
else if(form["Services[ ]"][3].checked==true && form.txaQuery.value=="")
	{

		return false;
	}//end if

	return true; 	
}//end function

//// for services nd accomodation hotel booking
function iscommonFrmAccomodation(form)
{
//alert('hello there 1');
//if (form["Services[ ]"][1].checked==true && (form.accom[0].checked==false && form.accom[1].checked==false && form.accom[2].checked==false))
if (form["Services[ ]"][1].checked==true && form.accom.value== "NA")
	{
	//alert('hello there 2');
	return false;
	}
	//alert('hello there 3');
else 
	{
	return true;
	}
	return true;
}




//for country of residence

function iscommonFrmCountry(form)
{ 
	
	if(form.selCountry.value== "Country of Residence")
	{
		
		form.selCountry.focus();
		return false;

	}
	else
	{
		return true; 
	}//end if

}//end function



//FOR EMAIL

function iscommonFrmEmail(form) {

if (trim(form.txiEmail.value)== "")

	{

		form.txiEmail.focus();

		return false; // because it is not optional 

	}

else

	{

		var eid=form.txiEmail.value=trim(form.txiEmail.value);

		if (eid.indexOf(' ')!= -1)

			{

			form.txiEmail.focus();

			return false ; // no spaces

			} 

		if (eid.length < 6 ){

			form.txiEmail.focus();

			return false ; // at least j.a@in

			}

		at=eid.indexOf('@', 0); //check from first position ---- 

		if ( at == -1 || at == 0){ //should not be at first place

			form.txiEmail.focus();

			return false ;

			}

		else

			{

				var at1=eid.indexOf('@', (at + 1)); //looking for another at one place ahead

				if ( at1 == -1 ) // ie only one at is there

				{

					var dot=eid.indexOf('.',(at + 1));//looking for just next value

					if(dot == (at + 1)|| dot== -1){ //if dot is not there or in the next place

						form.txiEmail.focus();

						return false ;	

						}

					else

						{

						 if ( (dot + 2 ) < eid.length )

							return true ;

						 else

						 {

							form.txiEmail.focus();

							return false ;

							}

						}

				}

				else // two @ are there

				{

				form.txiEmail.focus();

				return false;

				}

			}	

	form.txiEmail.focus();

	return false ;

	}	
	
}

//FOR re-Type EMAIL
function iscommonFrmReEmail(form) {
	
	if (trim(form.txirEmail.value)== "")

	{

		form.txirEmail.focus();

		return false; // because it is not optional 

	}
	
	else
	{
	
		if (trim(form.txiEmail.value)!= trim(form.txirEmail.value))
	
		{
			
			form.txirEmail.focus();
	
			return false; // because it is not optional 
	
		}
	}
}



//FOR PHONE

function iscommonFrmPhone(form) {

if (trim(form.txiPhone.value) == "") {

form.txiPhone.value=trim(form.txiPhone.value);

//return true //because it is optional
return false
}

else {

			form.txiPhone.value=trim(form.txiPhone.value);

	 if(checkfornum(form.txiPhone.value)==0)

		 {

			form.txiPhone.focus();

			return(false);

			}

return true

 }

}

//FOR Mobile

function iscommonFrmMobile(form) {

if (trim(form.mob.value) == "") {

form.mob.value=trim(form.mob.value);
form.mob.focus();
//return true //because it is optional
return false
}

else {

			form.mob.value=trim(form.mob.value);

	 if(checkfornum(form.mob.value)==0)

		 {

			form.mob.focus();

			return(false);

			}

return true

 }

}

//FOR CITY CODE OF PHONE



function iscommonFrmCityCode(form) {

if (trim(form.txiCityCode.value) == "") {

form.txiCityCode.value=trim(form.txiCityCode.value);

//return true //because it is optional
return false

}

else {

			form.txiCityCode.value=trim(form.txiCityCode.value);

	 if(checkfornum(form.txiCityCode.value)==0)

		 {

			form.txiCityCode.focus();

			return(false);

			}

return true

 }

}



//for country code of phone

function iscommonFrmCountryCode(form) {

	form.txiCountryCode.value = trim(form.txiCountryCode.value);

 if(checkfornum(form.txiCountryCode.value)==0)

	{

		form.txiCountryCode.focus();

		return false;

	}

	else

		return true;

}



//FOR No. of Adults

function iscommonFrmAdults(form) {
if(form.txiAdults.value== "NA")

		{

			form.selTentMonth.focus();

			return false;

		}
		else
	{
		return true;
		}
		}
/*function iscommonFrmAdults(form) {

if (trim(form.txiAdults.value) == "" ) {

//form.adults.value=trim(form.adults.value);

form.txiAdults.focus();

return(false); //because it is optional

}

else {

			//form.adults.value=trim(form.adults.value);

	 if(checkfornum(form.txiAdults.value)==0)

		 {

			form.txiAdults.focus();

			return(false);

			}

return true;

 }

}
*/







//FOR Days in hands

function iscommonFrmDaysInHands(form) {

//if (trim(form.txiDaysInHands.value) == "" ||trim(form.txiDaysInHands.value)<1 ) {

//form.hands.value=trim(form.hands.value);

//form.txiDaysInHands.focus();

return(true); //because it is optional

/*}

else {

			form.txiDaysInHands.value=trim(form.txiDaysInHands.value);

	 if(checkfornum(form.txiDaysInHands.value)==0)

		 {

			form.txiDaysInHands.focus();

			return(false);

			}

return true

 }
 */

}



function iscommonFrmArrival(form)

{ 

	if ((form.selTentMonth.value== "NA") || (form.selTentDate.value== "NA") || (form.selTentYear.value== "NA"))

	{

		if(form.selTentMonth.value== "NA")

		{

			form.selTentMonth.focus();

			return false;

		}

		if(form.selTentDate.value== "NA")

			

		{

			form.selTentDate.focus();

			return false; 

		}

		if(form.selTentYear.value== "NA")

			form.selTentYear.focus()

			return false;

	}

	else{

		if (iscommonFrmArrDate(form)==false)

		{

			return false;

		}

		else

			return true;

	}

}



function iscommonFrmArrDate(form)

{

	for(i=0;i<=montharray.length;i++)

	{

		if (montharray[i]==form.selTentMonth.value)

		{

			dgt=i;

			break;

		}

	}

	//alert(dgt)

if(form.selTentYear.value < year)

{

	//alert("Invalid date. It must be a future date.");

	pkflg = false;

	form.selTentYear.focus(); 

	return false; //presently used

 } 

 else

	{

		if((form.selTentYear.value == year) && (dgt < month))

		{

			//alert("Invalid date. It must be a future date.");

			pkflg = false;

			form.selTentMonth.focus();

			return false;

		}

		else

		{

			if((form.selTentYear.value == year) && (dgt == month))

			{

				if (form.selTentDate.value < daym)

				{

				//alert("Invalid date. It must be a future date.");

				pkflg = false;

				form.selTentDate.focus();

				return false;

				}

				else

					return true;

			}

			else

				return true;

		}

	}

 }

 function iscommonFrmDepart(form)

{
	//alert('hello there');
/*if ((form.selTentDepMonth.value== "NA")&&(form.selTentDepDate.value== "NA")  && (form.selTentDepYear.value== "NA"))
	{
		return true;
	}  */

	if ((form.selTentDepMonth.value== "NA")||(form.selTentDepDate.value== "NA")  || (form.selTentDepYear.value== "NA"))

	{

		

		if(form.selTentDepMonth.value== "NA")

		{

			form.selTentDepMonth.focus();

			return false;

		}

		if(form.selTentDepDate.value== "NA")

		{

			form.selTentDepDate.focus();

			return false; 

		}

		if(form.selTentDepYear.value== "NA")

		{

			form.selTentDepYear.focus()

			return false;

		}

	}

	else{

		if (iscommonFrmRetDate(form)==false)

		{

			return false;

		}

		else

			return true;

	}

}



function iscommonFrmRetDate(form)

{

	if(form.selTentDepYear.value < form.selTentYear.value)

	{

		//alert("1")

		//alert("Return Date cannot be Earlier than Picking Date");

		rtflg = false;

		form.selTentDepYear.focus(); 

		return false; //presently used

	}

	else

	{

		for(i=0;i<=montharray.length;i++)

		{

			if (montharray[i]==form.selTentDepMonth.value)

			{

				retmn=i+1;

				break;

			}

		}

		for(i=0;i<=montharray.length;i++)

		{

			if (montharray[i]==form.selTentMonth.value)

			{

				pickmn=i+1;

				break;

			}

		}

		//alert(retmn)

		//alert(pickmn)

		if((form.selTentDepYear.value == form.selTentYear.value) && (retmn<pickmn))

		{

			//alert("2")

			//alert("Return Date cannot be Earlier than Picking Date");

			rtflg = false;

			form.selTentDepMonth.focus();

			return false;

		}

		else

		{

			if((form.selTentDepYear.value == form.selTentYear.value) && (retmn==pickmn))

			{

				//alert("hello")

				//alert(form.selOutDate.value)

				//alert(form.d_arrival.value)

				//alert((form.selTentDepDate.value));

				//alert((form.selTentDate.value));

				if ((form.selTentDepDate.value)< (form.selTentDate.value))

				{

					//alert("3")

					//alert("Return Date cannot be Earlier than Picking Date");

					

					rtflg = false;

					form.selTentDepDate.focus();

					return false;

				}

				else

					return true;

			}

			else

				return true;

		}

	}

 }



//FOR No. of Children if any
function iscommonFrmChildren(form) {

if(form.txiChildren.value== "NA")

		{

			form.txiChildren.focus();

			return true;

		}
		else
	{
			return true;
	}
}

/*function iscommonFrmChildren(form) {

if (trim(form.txiChildren.value) == "NA" ) { //since children are optional so it doesn't include checkforzero

//form.txiChildren.focus();

return(true); //because it is optional

}

else {

			form.txiChildren.value=trim(form.txiChildren.value);

	 if(checkfornum(form.txiChildren.value)==0)

		 {

			form.txiChildren.focus();

			return(false);

			}

return true

 }

}
*/


//FOR Query

function iscommonFrmQuery(form) {
 form.txaQuery.value=trim(form.txaQuery.value);
 if (trim(form.txaQuery.value) == "") {
 //form.txaQuery.focus();
 return true;
}

else {

			

	 if(checkfornum(form.txaQuery.value)==1)// i. e, it is a pure number that is invalid

		 {

			form.txaQuery.focus();

			return(false);

			}

		qry=trim(form.txaQuery.value);

		if(qry.length <= 6 )// if it is too short

			{

			 form.txaQuery.focus();

			 return(false);

			}	

return true ;

 }

}





//FOR NAME

function iscommonFrmName(form) {

if (trim(form.txiName.value) == "") {

form.txiName.focus();

return false

}

else {

			form.txiName.value=trim(form.txiName.value);

	 if(checkforchar(form.txiName.value)== 0)

		 {

			form.txiName.focus();

			return(false);

			}

return true ;

 }

}





//FOR Destination

function iscommonFrmDestination(form) {

if (trim(form.dest.value) == "") {

form.dest.focus();

return false

}

else {

			form.dest.value=trim(form.dest.value);

	 if(checkforchar(form.dest.value)== 0)

		 {

			form.dest.focus();

			return(false);

			}

return true ;

 }

}



function iscommonFrmTentArrival(form)

{

	if ((form.selTentMonth.value== "NA") || (form.selTentDate.value== "NA") || (form.selTentYear.value== "NA"))

	{

		if(form.selTentMonth.value== "NA")

		{

			form.selTentMonth.focus();

			return false;

		}

		if(form.selTentDate.value== "NA")

		{

			form.selTentDate.focus();

			return false; 

		}

		if(form.selTentYear.value== "NA")

		{

			form.selTentYear.focus();

			return false;

		}

	}

	else{

		if (iscommonFrmTentDate(form)==false)

		{

			return false;

		}

		else

			return true;

	}

}



function iscommonFrmTentDate(form)

{

	for(i=0;i<=montharray.length;i++)

	{

		if (montharray[i]==form.selTentMonth.value)

		{

			dgt=i;

			break;

		}

	}

	//alert(dgt)

if(form.selTentYear.value < year)

{

	//alert("Invalid date. It must be a future date.");

	pkflg = false;

	form.selTentYear.focus(); 

	return false; //presently used

 } 

 else

	{

		if((form.selTentYear.value == year) && (dgt < month))

		{

			//alert("Invalid date. It must be a future date.");

			pkflg = false;

			form.selTentMonth.focus();

			return false;

		}

		else

		{

			if((form.selTentYear.value == year) && (dgt == month))

			{

				if (form.selTentDate.value < daym)

				{

				//alert("Invalid date. It must be a future date.");

				pkflg = false;

				form.selTentDate.focus();

				return false;

				}

				else

					return true;

			}

		}

	}

 }





////////////////////////////////////////////Common Functions////////////////////////////////////////



function trim(str1)

{

// This function trims any given field value for blank spaces.

 var intCtr=0

 for(intCtr=0;str1.charAt(intCtr)==" ";intCtr++);

 str1=str1.substring(intCtr,str1.length);

 return str1; 

}



function checkforchar(strdate)

{

//This function checks for string values

var validdate = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";

	

	var strlength = strdate.length;

	for(var i=0; i<=strlength; i++)

	{

		var unitstr = strdate.substr(i,1);

		if (validdate.indexOf(unitstr)==-1)

		{

			return false;

		}

	}

	return true;

}



function checkfornum(str1) 

{

//This function checks for numeric values

 var numstr="1234567890 ,";

 var intctr,intLen;

 intLen=str1.length;

 for(intCtr=0;intCtr <= intLen && numstr.indexOf(str1.charAt(intCtr))>=0 ;intCtr++);

 if(intCtr > intLen)

 {

 return 1;

 }

 else

 {

 return 0;

 }

}



function checkforzero(str1) 

{

//This function checks for all zero with spaces

 var numstr=" 0";

 var intctr,intLen;

 intLen=str1.length;

 for(intCtr=0;intCtr <= intLen && numstr.indexOf(str1.charAt(intCtr))>=0 ;intCtr++);

 if(intCtr > intLen)

 {

 return 1; // return true if all zero and spaces are there

 }

 else

 {

 return 0;//otherwise return false

 }

}



function checkfordate(str1) 

{

//This function checks for date Type of data

 var numstr="1234567890//";

 var intctr,intLen;

 intLen=str1.length;

 for(intCtr=0;intCtr <= intLen && numstr.indexOf(str1.charAt(intCtr))>=0 ;intCtr++);

 if(intCtr > intLen)

 {

 return 1;

 }

 else

 {

 return 0;

 }

}



function GoBack() 

{ 

	history.back(); 

}






