//////////////////New Tech. General Hotel Booking Form //////////////
////////////////////////////////////////////////////////////////////

function generalqueryform(appendALine)
{
var mylocation = window.location;
var sitename='delhi-mumbai-hotels.net';
var siteURL='www.delhi-mumbai-hotels.net';
//var siteURL='localhost/delhi-mumbai-hotels.net';
//var sitename='localhost';
document.write('<a name="generalform"></a><div align="center"><form name="generalfrm" action="http://'+siteURL+'/php-bin/new_insert.php" method="post"> <input type="hidden" name="referer" value="'+window.location+'"><input type="hidden" name="frm_name" value="tour"><input type="hidden" name="sitename" value="'+sitename+'"><input type="hidden" name="siteURL" value="'+siteURL+'">')
document.write('<br><br><TABLE bgcolor="#7088C8" WIDTH="540" CELLPADDING=0 CELLSPACING=0 border=6 bordercolor="navy"><tr><td align="center" height="40"><FONT SIZE=4  COLOR="#FFFFFF"  FACE="Verdana"><B>General Query Form</b><BR></font><FONT SIZE=2  COLOR="#FFFFFF"  FACE="Verdana">We at Delhi-Mumbai-Hotels offer online hotel booking for <b>'+appendALine+'</b>. Please let us know your requirements by filling in the following form and we will revert with the best possible deal.</B></FONT></td></tr><tr><td><TABLE bgcolor="#CACDE6" WIDTH="540" CELLPADDING=5 CELLSPACING=0 border=0>')
document.write('<TR>')
	document.write('<TD><FONT SIZE=2 FACE="Arial">Title</FONT></TD>')
	document.write('<TD>')
	document.write('<SELECT NAME="title">')			
	document.write('<OPTION SELECTED VALUE="Mr">Mr')
	document.write('<OPTION  VALUE="Mrs">Mrs')
	document.write('<OPTION  VALUE="Ms">Ms')
	document.write('<OPTION  VALUE="Dr">Dr')
	document.write('</SELECT>')
	document.write('</TD>')
	document.write('</TR>')
	document.write('<TR>')
	document.write('<TD><FONT SIZE=2 FACE="Arial">Your Name</FONT></TD>')
	document.write('<TD><INPUT TYPE="text" NAME="txiName" SIZE="32" MAXLENGTH="100"><font 	color="red">*</font></TD>')
	document.write('</TR>')
	document.write('<TR>')
	document.write('<TD><FONT SIZE=2 FACE="Arial">Your Email</FONT></TD>')
	document.write('<TD><INPUT TYPE="text" NAME="txiEmail" SIZE="32" MAXLENGTH="50"><font color="red">*</font></TD>')
	document.write('</TR>')
	document.write('<TR>')
	document.write('<TD><FONT color=black face="Verdana, arial" size=2>Country </FONT></TD>')
	document.write('<TD><SELECT name="selCountry" size=1> <OPTION selected value="NA">--Select Your Country of Residence--<OPTION value=Afghanistan>Afghanistan<OPTION value=Albania>Albania<OPTION value=Algeria>Algeria<OPTION value="American Samoa">American Samoa<OPTION value=Andorra>Andorra<OPTION value=Angola>Angola<OPTION value=Anguilla>Anguilla<OPTION value=Anguilla>Antarctica<OPTION value="Antigua and Barbuda">Antigua and Barbuda<OPTION value=Argentina>Argentina<OPTION value=Armenia>Armenia<OPTION value=Aruba>Aruba<OPTION value=Australia>Australia<OPTION value=Austria>Austria<OPTION value=Azerbaijan>Azerbaijan<OPTION value=Bahamas>Bahamas<OPTION value=Bahrain>Bahrain<OPTION value=Bangladesh>Bangladesh<OPTION value=Barbados>Barbados<OPTION value=Belarus>Belarus<OPTION value=Belgium>Belgium<OPTION   value=Belize>Belize<OPTION value=Benin>Benin<OPTION value=Bermuda>Bermuda<OPTION value=Bhutan>Bhutan<OPTION value=Bolivia>Bolivia<OPTION value="Bosnia and Herzegovina">Bosnia and Herzegovina<OPTION value=Botswana>Botswana<OPTION value=Brazil>Brazil<OPTION value="British Indian Ocean Territory">British Indian Ocean Territory<OPTION value="British Virgin Islands">British Virgin Islands<OPTION value=Brunei>Brunei<OPTION value=Bulgaria>Bulgaria<OPTION value="Burkina Faso">Burkina Faso<OPTION value=Burundi>Burundi<OPTION value=Cambodia>Cambodia<OPTION value=Cameroon>Cameroon<OPTION value=Canada>Canada<OPTION value="Cape Verde">Cape Verde<OPTION value="Cayman Islands">Cayman Islands<OPTION value="Central African Republic">Central African Republic<OPTION value=Chad>Chad<OPTION value=Chile>Chile<OPTION value=China>China<OPTION value="Christmas Island">Christmas Island<OPTION value="Cocos Islands">Cocos Islands<OPTION value=Colombia>Colombia<OPTION value=Comoros>Comoros<OPTION value=Congo>Congo<OPTION value="Cook Islands">Cook Islands<OPTION   value="Costa Rica">Costa Rica<OPTION value=Croatia>Croatia<OPTION value=Cuba>Cuba<OPTION value=Cyprus>Cyprus<OPTION value="Czech Republic">Czech Republic<OPTION value=Denmark>Denmark<OPTION value=Djibouti>Djibouti<OPTION value=Dominica>Dominica<OPTION value="Dominican Republic">Dominican   Republic<OPTION value="East Timor">East Timor<OPTION value=Ecuador>Ecuador<OPTION value=Egypt>Egypt<OPTION  value="El Salvador">El Salvador<OPTION value="Equatorial Guinea">Equatorial Guinea<OPTION   value=Eritrea>Eritrea<OPTION value=Estonia>Estonia<OPTION value=Ethiopia>Ethiopia<OPTION value="Falkland Islands">Falkland Islands<OPTION value="Faroe Islands">Faroe Islands<OPTION value=Fiji>Fiji<OPTION value=Finland>Finland<OPTION value=France>France<OPTION value="French Guiana">French Guiana<OPTION  value="French Polynesia">French Polynesia<OPTION value="French Southern Territories">French Southern Territories<OPTION value=Gabon>Gabon<OPTION value=Gambia>Gambia<OPTION value=Georgia>Georgia<OPTION value=Germany>Germany<OPTION value=Ghana>Ghana<OPTION value=Gibraltar>Gibraltar<OPTION   value=Greece>Greece<OPTION value=Greenland>Greenland<OPTION value=Grenada>Grenada<OPTION value=Guadeloupe>Guadeloupe<OPTION value=Guam>Guam<OPTION value=Guatemala>Guatemala<OPTION   value=Guinea>Guinea<OPTION value=Guinea-Bissau>Guinea-Bissau<OPTION value=Guyana>Guyana<OPTION value=Haiti>Haiti<OPTION value="Heard and McDonald Islands">Heard and McDonald Islands<OPTION     value=Honduras>Honduras<OPTION value="Hong Kong">Hong Kong<OPTION value=Hungary>Hungary<OPTION value=Iceland>Iceland<OPTION value=India>India<OPTION value=Indonesia>Indonesia<OPTION   value=Iran>Iran<OPTION value=Iraq>Iraq<OPTION value=Ireland>Ireland<OPTION value=Israel>Israel<OPTION   value=Italy>Italy<OPTION value="Ivory Coast">Ivory Coast<OPTION value=Jamaica>Jamaica<OPTION value=Japan>Japan<OPTION value=Jordan>Jordan<OPTION value=Kazakhstan>Kazakhstan<OPTION   value=Kenya>Kenya<OPTION value=Kiribati>Kiribati<OPTION value="Korea, North">Korea, North<OPTION value="Korea, South">Korea, South<OPTION value=Kuwait>Kuwait<OPTION value=Kyrgyzstan>Kyrgyzstan<OPTION value=Laos>Laos<OPTION   value=Latvia>Latvia<OPTION value=Lebanon>Lebanon<OPTION value=Lesotho>Lesotho<OPTION value=Liberia>Liberia<OPTION   value=Libya>Libya<OPTION value=Liechtenstein>Liechtenstein<OPTION value=Lithuania>Lithuania<OPTION value=Luxembourg>Luxembourg<OPTION value=Macau>Macau<OPTION value=Madagascar>Madagascar<OPTION  value=Malawi>Malawi<OPTION value=Malaysia>Malaysia<OPTION value=Maldives>Maldives<OPTION value=Mali>Mali<OPTION   value=Malta>Malta<OPTION value="Marshall Islands">Marshall Islands<OPTION value=Martinique>Martinique<OPTION   value=Mauritania>Mauritania<OPTION value=Mauritius>Mauritius<OPTION value=Mayotte>Mayotte<OPTION value=Mexico>Mexico<OPTION value="Micronesia, Federated States of">Micronesia, Federated States   of,<OPTION value=Moldova>Moldova<OPTION value=Monaco>Monaco<OPTION value=Mongolia>Mongolia<OPTION value=Montserrat>Montserrat<OPTION value=Morocco>Morocco<OPTION value=Mozambique>Mozambique<OPTION   value=Myanmar>Myanmar<OPTION value=Namibia>Namibia<OPTION value=Nauru>Nauru<OPTION value=Nepal>Nepal<OPTION   value=Netherlands>Netherlands<OPTION value="Netherlands Antilles">Netherlands Antilles<OPTION value="New Caledonia">New Caledonia<OPTION value="New Zealand">New Zealand<OPTION value=Nicaragua>Nicaragua<OPTION value=Niger>Niger<OPTION value=Nigeria>Nigeria<OPTION value=Niue>Niue<OPTION value="Norfolk Island">Norfolk Island<OPTION value="Northern Mariana Islands">Northern Mariana Islands<OPTION value=Norway>Norway<OPTION value=Oman>Oman<OPTION value=Pakistan>Pakistan<OPTION value=Palau>Palau<OPTION value=Panama>Panama<OPTION value="Papua New Guinea">Papua New Guinea<OPTION value=Paraguay>Paraguay<OPTION value=Peru>Peru<OPTION value=Philippines>Philippines<OPTION value="Pitcairn Island">Pitcairn Island<OPTION value=Poland>Poland<OPTION value=Portugal>Portugal<OPTION value="Puerto Rico">Puerto Rico<OPTION value=Qatar>Qatar<OPTION value=Reunion>Reunion<OPTION value=Romania>Romania<OPTION   value=Russia>Russia<OPTION value=Rwanda>Rwanda<OPTION value="S. Georgia and S. Sandwich Isls.">S. Georgia and S. Sandwich Isls<OPTION value="Saint Kitts &amp; Nevis">Saint Kitts &amp; Nevis<OPTION value="Saint Lucia">Saint Lucia<OPTION value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines<OPTION value=Samoa>Samoa<OPTION value="San Marino">San Marino<OPTION value="Sao Tome and Principe">Sao Tome and Principe<OPTION value="Saudi Arabia">Saudi Arabia<OPTION value=Senegal>Senegal<OPTION   value=Seychelles>Seychelles<OPTION value=Seychelles>Seychelles<OPTION value=Singapore>Singapore<OPTION value=Slovakia>Slovakia<OPTION value=Slovenia>Slovenia<OPTION value=Somalia>Somalia<OPTION value="South Africa">South Africa<OPTION value=Spain>Spain<OPTION value="Sri Lanka">Sri Lanka<OPTION value="St. Helena">St. Helena<OPTION value="St. Pierre and Miquelon">St. Pierre and Miquelon<OPTION value=Sudan>Sudan<OPTION value=Suriname>Suriname<OPTION value="Svalbard and Jan Mayen Islands">Svalbard and Jan Mayen  Islands<OPTION value=Swaziland>Swaziland<OPTION value=Sweden>Sweden<OPTION value=Switzerland>Switzerland<OPTION   value=Syria>Syria<OPTION value=Taiwan>Taiwan<OPTION value=Tajikistan>Tajikistan<OPTION value=Tanzania>Tanzania<OPTION value=Thailand>Thailand<OPTION value=Togo>Togo<OPTION   value=Tokelau>Tokelau<OPTION value=Tonga>Tonga<OPTION value="Trinidad and Tobago">Trinidad and Tobago<OPTION   value=Tunisia>Tunisia<OPTION value=Turkey>Turkey<OPTION value=Turkmenistan>Turkmenistan<OPTION   value="Turks and Caicos Islands">Turks and Caicos Islands<OPTION value=Tuvalu>Tuvalu<OPTION value="U.S. Minor Outlying Islands">U.S. Minor Outlying Islands<OPTION value=Uganda>Uganda<OPTION   value=Ukraine>Ukraine<OPTION value="United Arab Emirates">United Arab Emirates<OPTION value="United Kingdom">United Kingdom<OPTION value="United States of America">United States of America<OPTION value=Uruguay>Uruguay<OPTION value=Uzbekistan>Uzbekistan<OPTION value=Vanuatu>Vanuatu<OPTION value="Vatican City">Vatican City<OPTION value=Venezuela>Venezuela<OPTION value=Vietnam>Vietnam<OPTION value="Virgin Islands">Virgin Islands<OPTION value="Wallis and Futuna Islands">Wallis and Futuna Islands<OPTION   value="Western Sahara">Western Sahara<OPTION value=Yemen>Yemen<OPTION value="Yugoslavia (Former)">Yugoslavia (Former)<OPTION value=Zaire>Zaire<OPTION value=Zambia>Zambia<OPTION  value=Zimbabwe>Zimbabwe</OPTION></SELECT><FONT color=red>*</FONT></TD>')
	document.write('</TR>')
	document.write('<TR><TD vAlign=center width="40%"><FONT color=black face="verdana, Arial" size=2>Telephone Number : </FONT>&nbsp;</TD> <TD align=left><TABLE><TBODY> <TR><TD align=middle><FONT face=Arial size=-2>Country</FONT><BR><INPUT type="Text" maxLength=50 name="txiCountryCode" size=5></TD><TD align=middle><FONT face=Arial size=-2>Area</FONT><BR>&nbsp;&nbsp;<INPUT type="Text" maxLength=50 name="txiCityCode" size=5></TD><TD align=middle><FONT face=Arial size=-2>Phone</FONT><BR>&nbsp;&nbsp;<INPUT type="Text" maxLength=50 name="txiPhone" size=20></TD></TR></TBODY></TABLE></TD></TR>')
	document.write('<TR><TD align=left vAlign=top width="40%"><FONT color=black face="verdana, Arial" size=2>Tentative Date:</FONT></td><td>');
	
	
	document.write('<SELECT NAME="check_month" STYLE="background:#FFFFFF">                <OPTION VALUE="NA" SELECTED >MM</OPTION>                <OPTION VALUE="January">Jan</OPTION>                <OPTION VALUE="February">Feb</OPTION>                <OPTION VALUE="March">Mar</OPTION>                <OPTION VALUE="April">Apr</OPTION>              <OPTION VALUE="May">May</OPTION>                <OPTION VALUE="June">Jun</OPTION>                <OPTION VALUE="July">Jul</OPTION>                <OPTION VALUE="August">Aug</OPTION>                <OPTION VALUE="September">Sep</OPTION>                <OPTION VALUE="October">Oct</OPTION>                <OPTION VALUE="November">Nov</OPTION>                <OPTION VALUE="December">Dec</OPTION></SELECT>&nbsp;                <SELECT NAME="check_date" STYLE="background:#FFFFFF">              <OPTION VALUE="NA" SELECTED >DD</OPTION>               <OPTION VALUE="1">1</OPTION>                <OPTION VALUE="2" >2</OPTION>                <OPTION VALUE="3">3</OPTION>                <OPTION VALUE="4">4</OPTION>                <OPTION VALUE="5">5</OPTION>                <OPTION VALUE="6">6</OPTION>                <OPTION VALUE="7">7</OPTION>                <OPTION VALUE="8">8</OPTION>                <OPTION VALUE="9">9</OPTION>                <OPTION VALUE="10">10</OPTION>                <OPTION VALUE="11">11</OPTION>                <OPTION VALUE="12">12</OPTION>                <OPTION VALUE="13">13</OPTION>                <OPTION VALUE="14">14</OPTION>                <OPTION VALUE="15">15</OPTION>                <OPTION VALUE="16">16</OPTION>                <OPTION VALUE="17">17</OPTION>                <OPTION VALUE="18">18</OPTION>                <OPTION VALUE="19">19</OPTION>                <OPTION VALUE="20">20</OPTION>                <OPTION VALUE="21">21</OPTION>                <OPTION VALUE="22">22</OPTION>                <OPTION VALUE="23">23</OPTION>                <OPTION VALUE="24">24</OPTION>                <OPTION VALUE="25">25</OPTION>                <OPTION VALUE="26">26</OPTION>                <OPTION VALUE="27">27</OPTION>                <OPTION VALUE="28">28</OPTION>                <OPTION VALUE="29">29</OPTION>                <OPTION VALUE="30">30</OPTION>                <OPTION VALUE="31">31</OPTION></SELECT>&nbsp;                <SELECT NAME="check_year" STYLE="background:#FFFFFF">   <OPTION VALUE="NA" SELECTED >YY</OPTION>                <OPTION VALUE="2005">2005</OPTION><OPTION VALUE="2006">2006</OPTION><OPTION VALUE="2007">2007</OPTION><OPTION VALUE="2008">2008</OPTION><OPTION VALUE="2009">2009</OPTION><OPTION VALUE="2010">2010</OPTION></SELECT>');
	
	document.write('</td></tr><tr><TR><TD align=left vAlign=top width="40%"><FONT color=black face="verdana, Arial" size=2>Days in Hand: </FONT></td><td><INPUT type="Text" maxLength=20 name="txiDaysInHands" size=5><font size="1" face="Verdana" color="Navy"> (For the Trip)</font></TD></TR> <TR><TD width="40%"><FONT color=black face="verdana, Arial" size=2>No. of People Travelling : </FONT></TD><TD align=left vAlign=top width="60%"><FONT color=black face="verdana, Arial" size=2>Adults </FONT><INPUT type="Text" maxLength=20 name="txiAdults" size=4>&nbsp;&nbsp;&nbsp;&nbsp;<FONT color=black face="verdana, Arial" size=2>Children </FONT><INPUT type="Text" maxLength=20 name="txiChildren" size=5><font size="1" face="Verdana" color="Navy"> (under 12yr)</font></TD></TR>')
	document.write('<TR>')
	document.write('<td width="40%" valign="top"><font size="2" color="black" face="verdana,Arial">For Booking/Travel Related Query :</font></td><td valign="top"><TEXTAREA NAME="txaQuery" COLS="30" ROWS="5" WRAP="virtual"></TEXTAREA><font color="red">*</font></td>')
	document.write('</TR>')
	document.write('<TR>')
	document.write('<TD><font color="red">*</font> <font size="-2" face="arial">Essential Information</font> </TD>')
	document.write('<TD align=left><INPUT TYPE="submit" VALUE="Submit Query Now" onClick="return generalFormValidate(this.form)">&nbsp;&nbsp;<INPUT TYPE="reset" VALUE="Reset"></TD>')
	document.write('</TR>')

	/*document.write('<tr><td colspan="2" align="left" bgcolor="#ff0000"><font size=1 face=verdana color="white"><b>In case you face any problem submitting this form, please <a href="mailto:services@indianvisit.com, rahulsharma@proudindian.net?Subject=Direct query mail from  '+  window.self.location +'" style="{color:yellow;text-decoration:underline;}"><b>click here</b></a> to send your query by email.</font></td></tr>');*/

	document.write('</TABLE></td></tr></table>')
	document.write('</CENTER>')
	document.write('</FORM></div>')
} 

/*****************************************general Form Validation******************************************/
 /*****************************************general Form Validation******************************************/

function generalFormValidate(form) {

var v=allBlanksGeneral(form)

isgeneralFrmQuery(form)

isgeneralFrmDaysInHands(form)

isgeneralFrmTentArrival(form)

isgeneralFrmChildren(form)

isgeneralFrmAdults(form)

isgeneralFrmPhone(form)

isgeneralFrmCityCode(form)

isgeneralFrmCountryCode(form)

isgeneralFrmCountry(form)

isgeneralFrmEmail(form)

isgeneralFrmName(form)

return v ;

}



function allBlanksGeneral(form) {

if( (isgeneralFrmName(form) && isgeneralFrmEmail(form)) && (isgeneralFrmCountry(form) && isgeneralFrmCountryCode(form)) && (isgeneralFrmCityCode(form) && isgeneralFrmPhone(form)) && (isgeneralFrmTentArrival(form)&& isgeneralFrmDaysInHands(form)) && ( isgeneralFrmAdults(form) && isgeneralFrmChildren(form) ) && isgeneralFrmQuery(form) ) {

 return true ;

}



if( (isgeneralFrmName(form) == false || isgeneralFrmEmail(form) == false ) || ( isgeneralFrmCountry(form) == false || isgeneralFrmCountryCode(form) == false) || ( isgeneralFrmCityCode(form) == false || isgeneralFrmPhone(form) == false )||(isgeneralFrmTentArrival(form) == false || isgeneralFrmDaysInHands(form)== false)||( isgeneralFrmAdults(form)==false || isgeneralFrmChildren(form)== false)||isgeneralFrmQuery(form)==false ) {

composeGeneral(form)

return false ;

 }

}

function composeGeneral(form) {

var text = " You entered incorrectly or forgot to fill in ::\n"	

if(isgeneralFrmName(form) == false) {

text += "\nYour Name -- must be purely alphabetic"

}

if(isgeneralFrmEmail(form) == false) {

text += "\nYour E-mail -- improper/incomplete e-mail ID"

}

if(isgeneralFrmCountry(form) == false) {

text += "\nYour Country of Residence -- not selected yet"

}

if(isgeneralFrmCountryCode(form) == false) {

text += "\nCountry Code for Phone -- should be number or blank"

}

if(isgeneralFrmCityCode(form) == false) {

text += "\nArea Code for Phone -- should be a number or blank"

}

if(isgeneralFrmPhone(form) == false) {

text += "\nPhone Number -- should be number or blank"

}

if(isgeneralFrmAdults(form) == false) {

text += "\nNo. of Adults travelling -- should be a number"

}

if(isgeneralFrmChildren(form) == false) {

text += "\nNo. of Children travelling -- should be a number"

}

if(isgeneralFrmTentArrival(form) == false) {

text += "\nTentative Date for Trip -- cannot be earlier than today"

}

if(isgeneralFrmDaysInHands(form) == false) {

text += "\nDays in Hand -- should be a number and also should not be Less than One"

}



if(isgeneralFrmQuery(form) == false) {

text += "\nBooking/Travel related Query -- should be given briefly"

}

alert(text)

}



//for country of residence

function isgeneralFrmCountry(form)

{

 if(form.selCountry.value== "NA")

	{

	 form.selCountry.focus();

 return false;

	}

 else

 return true; 

 }



//FOR EMAIL

function isgeneralFrmEmail(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 PHONE

function isgeneralFrmPhone(form) {

if (trim(form.txiPhone.value) == "") {

form.txiPhone.value=trim(form.txiPhone.value);

return true //because it is optional

}

else {

			form.txiPhone.value=trim(form.txiPhone.value);

	 if(checkfornum(form.txiPhone.value)==0)

		 {

			form.txiPhone.focus();

			return(false);

			}

return true

 }

}



//FOR CITY CODE OF PHONE



function isgeneralFrmCityCode(form) {

if (trim(form.txiCityCode.value) == "") {

form.txiCityCode.value=trim(form.txiCityCode.value);

return true //because it is optional

}

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 isgeneralFrmCountryCode(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 isgeneralFrmAdults(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 isgeneralFrmDaysInHands(form) {

if (trim(form.txiDaysInHands.value) == "" ||trim(form.txiDaysInHands.value)<1 ) {

//form.hands.value=trim(form.hands.value);

form.txiDaysInHands.focus();

return(false); //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

 }

}







//FOR No. of Children if any

function isgeneralFrmChildren(form) {

if (trim(form.txiChildren.value) == "" ) { //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 isgeneralFrmQuery(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 isgeneralFrmName(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 ;

 }

}



function isgeneralFrmTentArrival(form)

{

	if ((form.check_month.value== "NA") || (form.check_date.value== "NA") || (form.check_year.value== "NA"))

	{

		if(form.check_month.value== "NA")

		{

			form.check_month.focus();

			return false;

		}

		if(form.check_date.value== "NA")

		{

			form.check_date.focus();

			return false; 

		}

		if(form.check_year.value== "NA")

		{

			form.check_year.focus();

			return false;

		}

	}

	else{

		if (isgeneralFrmTentDate(form)==false)

		{

			return false;

		}

		else

			return true;

	}

}



function isgeneralFrmTentDate(form)

{

	for(i=0;i<=montharray.length;i++)

	{

		if (montharray[i]==form.check_month.value)

		{

			dgt=i;

			break;

		}

	}

	//alert(dgt)

if(form.check_year.value < year)

{

	//alert("Invalid date. It must be a future date.");

	pkflg = false;

	form.check_year.focus(); 

	return false; //presently used

 } 

 else

	{

		if((form.check_year.value == year) && (dgt < month))

		{

			//alert("Invalid date. It must be a future date.");

			pkflg = false;

			form.check_month.focus();

			return false;

		}

		else

		{

			if((form.check_year.value == year) && (dgt == month))

			{

				if (form.check_date.value < daym)

				{

				//alert("Invalid date. It must be a future date.");

				pkflg = false;

				form.check_date.focus();

				return false;

				}

				else

					return true;

			}

		}

	}

 }

 //cheking for package------//

function packgFormValidate(form) {

var v=allBlankspackage(form)

isgeneralFrmQuery(form)

//isgeneralFrmChildren(form)

//isgeneralFrmAdults(form)

//isgeneralFrmDaysInHands(form)

//isgeneralFrmTentArrival(form)

ishotelFrmCheckOut(form)

ishotelFrmCheckIn(form)

isgeneralFrmPhone(form)

isgeneralFrmCityCode(form)

isgeneralFrmCountryCode(form)

ishotelFrmCountry(form)

ishotelFrmEmail(form)

ishotelFrmName(form)



return v ;

}



function allBlankspackage(form) {

if( (ishotelFrmName(form) && ishotelFrmEmail(form)) && (ishotelFrmCountry(form) && isgeneralFrmCountryCode(form)) && (isgeneralFrmCityCode(form) && isgeneralFrmPhone(form)) && ishotelFrmCheckIn(form)&& ishotelFrmCheckOut(form)&& isgeneralFrmQuery(form) ) {

 return true ;

}



if( (ishotelFrmName(form) == false || ishotelFrmEmail(form) == false ) || ( ishotelFrmCountry(form)== false || isgeneralFrmCountryCode(form) == false) || isgeneralFrmCityCode(form) == false || isgeneralFrmPhone(form) == false||ishotelFrmCheckIn(form)==false||ishotelFrmCheckOut(form) == false ||isgeneralFrmQuery(form)==false ) {

composepackage(form)

return false ;

 }

}

function composepackage(form) {

var text = " You entered incorrectly or forgot to fill in ::\n"	

if(ishotelFrmName(form) == false) {

text += "\nYour Name -- must be purely alphabetic"

}

if(ishotelFrmEmail(form) == false) {

text += "\nYour E-mail -- improper/incomplete e-mail ID"

}

if(ishotelFrmCountry(form) == false) {

text += "\nYour Country of Residence -- not selected yet"

}

if(isgeneralFrmCountryCode(form) == false) {

text += "\nCountry Code for Phone -- should be number or blank"

}

if(isgeneralFrmCityCode(form) == false) {

text += "\nArea Code for Phone -- should be a number or blank"

}

if(isgeneralFrmPhone(form) == false) {

text += "\nPhone Number -- should be number or blank"

}

/*if(isgeneralFrmTentArrival(form) == false) {

text += "\nTentative Date for Trip -- cannot be earlier than today"

}

if(isgeneralFrmDaysInHands(form) == false) {

text += "\nDays in Hand -- should be a number or blank"

}

if(isgeneralFrmAdults(form) == false) {

text += "\nNo. of Adults travelling -- should be a number or blank"

}

if(isgeneralFrmChildren(form) == false) {

text += "\nNo. of Children travelling -- should be a number or blank"

}*/

if(ishotelFrmCheckIn(form) == false) {

text += "\nCheck In Date -- cannot be earlier than today"

}

if(ishotelFrmCheckOut(form) == false) {

text += "\nCheck Out Date -- cannot be earlier than check in date"

}

if(isgeneralFrmQuery(form) == false) {

text += "\nBooking/Travel related Query -- should be given briefly"

}

alert(text)

}


///////////////// for passenger numeric feild///////////////////////
   function validate(string) {
    if (!string) return false;
    var Chars = "0123456789";

    for (var i = 0; i < string.length; i++) {
       if (Chars.indexOf(string.charAt(i)) == -1)
          return false;
    }
    return true;
} 
///////////////// end for passenger numeric feild///////////////////////

function validateHotelQry(form) {
var v=allblanksHotel(form)
//isHotelQryHotelName(form)
//isHotelQryReqCity(form)
isHotelQryQuery(form)
isHotelQryCountry(form)
isHotelQryEmail(form)
isHotelQryName(form)
if( v == true)
	{
		v=confirm("Have You entered \nthe information Correctly !!");
	}
return v;
}

function allblanksHotel(form) {
if( (isHotelQryName(form) && isHotelQryEmail(form)) && (isHotelQryCountry(form) && isHotelQryQuery(form)) ) {
 return true ;
}
if( (isHotelQryName(form) == false) || (isHotelQryEmail(form) == false) || (isHotelQryCountry(form) == false) || (isHotelQryQuery(form)==false) ) {
composeHotel(form);
return false ;
   }
}
function composeHotel(form) {
var text = " You entered incorrectly or forgot to fill in ::\n"	
if(isHotelQryName(form) == false) {
text += "\nYour Name -- must be purely alphabetic"
}
if(isHotelQryEmail(form) == false) {
text += "\nYour E-mail -- improper/incomplete e-mail ID"
}
if(isHotelQryCountry(form) == false) {
text += "\nYour Country of Residence -- not selected yet"
}

if(isHotelQryQuery(form) == false) {
text += "\nTopic Comments/Query -- should atleast be a line or blank"
}

alert(text)
}

//FOR HOTEL NAME
function isHotelQryHotelName(form) {
if (trim(form.txiHotelName.value) == "") {
form.txiHotelName.focus();
return false ;
}
else {
			form.txiHotelName.value=trim(form.txiHotelName.value);
	     if(checkforchar(form.txiHotelName.value)==0)
		   {
			form.txiHotelName.focus();
			return(false);
			}
return true ;
   }
}

//FOR HOTEL required city
function isHotelQryReqCity(form) {
if (trim(form.txiReqCity.value) == "") {
form.txiReqCity.focus();
return false ;
}
else {
			form.txiReqCity.value=trim(form.txiReqCity.value);
	     if(checkforchar(form.txiReqCity.value)==0)
		   {
			form.txiReqCity.focus();
			return(false);
			}
return true ;
   }
}


//for country of residence
function isHotelQryCountry(form)
{
 if(form.selCountry.value == "NA")
	{
	 form.selCountry.focus(); 
	 return true; //presently not used
	} 
 else
   return true;  
 }
//FOR EMAIL
function isHotelQryEmail(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 Query
function isHotelQryQuery(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 isHotelQryName(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 ;
   }
}

// common function//



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 goBack() { 
			history.back();   
					}
				
////////////////////////////////////////////////////////////////////////////////////
//////////		Hotel Required at Validations


var _aStatesAndCities = new Array( 

new Array("Delhi", new Array("The Oberoi Hotel","The Grand Hotel","Hotel Hyatt Regency","Crowne Plaza Surya","Taj Mahal Hotel","Hotel Taj Palace","Le Meridien Hotel","Inter-Continental Grand","Park Royal Grand","Ashok Hotel","The Park Hotel","Hotel Oberoi Maidens","Hotel Vasant Continental","Siddharath Hotel","Hotel Nikko","Hotel Imperial","The Connaught Hotel","Hotel Janpath","Hans Plaza","Ashok Country Resort","Centre Point Hotel","Marriott Hotel","Westend Hotel","Trident Gurgaon","Good Times Hotel ","Surya Shelter Hotel","Radisson Hotel","Centaur Hotel","Maurya Sheraton Hotel","Sita Hotel")),new Array("Bombay", new Array("Taj Mahal Hotel","The Oberoi Hotel","The Oberoi Towers","Centaur Hotel Juhu","Grand Maratha Sheraton","Hotel Le Royal Meridien ","Taj Lands End Hotel","Taj President Hotel","JW Marriott Hotel","Sun n Sand Hotel","Ramada Hotel","Hotel Marine Plaza","Hotel Kohinoor","Hotel Fariyas","Ambassador Hotel","Parle International","Ramee Guestline Hotel","Heritage Hotel","Godwin Hotel","Renaissance Hotel","Hotel Sahil","Hotel Inter Continental","The Leela Kempinski","Hyatt Regency","Midland Hotel")),new Array("Others", new Array("")));

function checkForm(frm){

	if ( trim(frm.selState.value).toUpperCase() == "NA" ){
			alert("Please Select a City");
			frm.selState.focus();
			return false;
	}

	if ( trim(frm.txiStateOther.value).length <= 0 &&  trim(frm.selState.value).toUpperCase() == "OTHER" ){
		 	alert("Please specify your Other Delivery State!");
			frm.txiStateOther.focus();
			return false;
	} 



	if ( trim(frm.selCity.value).toUpperCase() == "NA" ){
			alert("Please Select a Hotel");
			frm.selCity.focus();
			return false;
	}
}


function changeCities(objState){
	var _strStateToSearch = objState.value.toUpperCase();
	//alert(objState.value.toUpperCase());
	
	if ( _strStateToSearch == "OTHER" ){

		  //window.document.forms[0].txiStateOther.focus();

	}else{

		for (var i=0;i<_aStatesAndCities.length;i++){
			if ( _strStateToSearch == _aStatesAndCities[i][0].toUpperCase() ){
					window.document.forms[0].selCity.length=0;
					addToList(window.document.forms[0].selCity,"","NA");
					for (var k=0;k<_aStatesAndCities[i][1].length;k++){
						addToList(window.document.forms[0].selCity,_aStatesAndCities[i][1][k],_aStatesAndCities[i][1][k]); 
					}
					addToList(window.document.forms[0].selCity,"Other","Other"); 

			break;
			}
		}
	}

}

function checkCity(objCity){
	if ( objCity.value.toUpperCase() == "OTHER"){
		//window.document.forms[0].txiCityOther.focus();
	}
}



//generic function to add items to a drop down list box.
function addToList(listField, newText, newValue) {
var Found = false;
 		for (var f=0;f<listField.length ;f++) {
				if (newValue == listField[f].value) {
					Found = true;
					break;
				}
		}
 		if (!Found) {
		  var len = listField.length++; 
		  listField.options[len].value = newValue;
	      listField.options[len].text = newText;
		  listField.selectedIndex = 0; 
		}
}


	