function roomfacilitymappingvalid()
{
		if (document.getElementById("hotel").value==0) 
		{
			alert("Please select one hotel");
		
			return false;
		}

		
		if (document.getElementById("facility").value==0) 
		{
			alert("Please select one facility");
		
			return false;
		}

		
		if (document.facilityroomfrm.roomtype.value==0) 
		{
			alert("Please select one roomtype");
		
			return false;
		}


		if (!checkboxvalidforroommapping())
		{

			confirm("You have not selected any rooms for mapping.If you wish to continue click ok");
		
		}
		

		if (checkboxvalidforroommapping())
		{
			
			if (document.getElementById("facilityrent").value=="") 
			{
				alert("The field facility rent must be filled in");
		
				return false;
			}
		}

		var action = "insert";
		xajax_roomfacilitymappingfunction(xajax.getFormValues('facilityroomfrm'), action);
		return true;
		

}


function roomtypevalid()
{
	document.facilityroomfrm.roomtype.value=0

	document.getElementById("room").style.display='none';

}
	


function checkboxvalidforroommapping()
{
	flag = false;
	
	for(i=0; i<document.facilityroomfrm.rooms.length; i++)
	{
			//alert ('yes');
			//alert (document.facilityhotelfrm.facilities[i].value);

			if(document.facilityroomfrm.rooms[i].checked)
			{	
				flag=true;
				
			}

	}

	return flag;
	
}



function displayrooms()
{
	var hotelid=document.getElementById("hotel").value;

	//alert ("hotel"+hotelid);
	
	var roomtypeid=document.facilityroomfrm.roomtype.value;
	//alert ("roomtype"+roomtypeid);

	var facilityid=document.getElementById("facility").value;

	//alert ("facility"+facilityid);

	

	if (document.getElementById("facility").value==0) 
	{
		alert("Please select one facility");
		
		return false;
	}

	

	document.getElementById("room").style.display='block';

	//xajax_displayroomfacilitymapping(hotelid, facilityid, roomtype);

	xajax_getroomsfacility(roomtypeid, hotelid, facilityid);

	//xajax_displayroomfacilitymapping(hotelid, facilityid, roomtype);

	return true;
}


function roomfacilityroomtype(hotelid)
{	
	alert ("yes");
	//var hotelid=document.getElementById("hotel").value;

	document.getElementById("roomtype").style.display='block';

		
		xajax_getallroomtypehotelxajax(hotelid);
		return true;
		
}

function hotelfacilitymappingvalid()
{
	/*if (document.getElementById("hotel").value==0) 
	{
		alert("Please select one hotel");
		
		return false;
	}*/

	

	if (flag == 'false')
	{
		alert ("Please click on submit before submitting mapping");
		return false;
	
	}

	if (!checkboxvalid())
	{
		alert ("Please click atleast one check box");

		return false;
	
	}
	
	

		for(i=0; i<document.facilityhotelfrm.facilities.length; i++)
		{
			//alert ('yes');
			//alert (document.facilityhotelfrm.facilities[i].value);

			if(document.facilityhotelfrm.facilities[i].checked)
			{	
			
				//alert ('checked');
				var facilityid= document.facilityhotelfrm.facilities[i].value;
				//alert ("facility rent" + facilityid);
				//document.getElementById(facilityid).style.display='block';

				if (document.getElementById(facilityid).value==0)
				{
					alert("The field Facility Rent must be filled in");
		
					//document.hotelform.action="hotelinformation.php";

					return false;
				}
				
										
				if (isNaN(document.getElementById(facilityid).value))
				{
				
					alert("The field Facility Rent must be numeric");

					return false;
				}
				
				
				if (document.getElementById(facilityid).value<500)
				{
				
					alert("Minimum Facility Rent is Rs 500");

					return false;
				}
				
					
				
				if (document.getElementById(facilityid).value>100000)
				{
				
					alert("Maximum Facility Rent is Rs 1 lakh");

					return false;
				}
				

			}

		
		}

	

	
	var action="insert";
	xajax_hotelfacilitymappingfunction(xajax.getFormValues('facilityhotelfrm'), action);

	flag='false';
	return true;
}

var flag='false';

function hotelfacilityvalid()
{

	if (document.getElementById("hotel").value==0) 
	{
		alert("Please select one hotel");
		
		return false;
	}
	xajax_hotelfacilitymappingfunction(xajax.getFormValues('facilityhotelfrm'));	

	flag='true';
}

function checkboxvalid()
{
	flag = false;
	
	for(i=0; i<document.facilityhotelfrm.facilities.length; i++)
	{
			//alert ('yes');
			//alert (document.facilityhotelfrm.facilities[i].value);

			if(document.facilityhotelfrm.facilities[i].checked)
			{	
				flag=true;
				
			}

	}

	return flag;
	
}


		

function displayrent()
{

	alert ('working');


	for(i=0; i<document.facilityhotelfrm.facilities.length; i++)
	{
		//alert ('yes');
		if(document.facilityhotelfrm.facilities[i].checked)
		{	
			//alert ('checked');
			var facilityid= document.facilityhotelfrm.facilities[i].value;
			//alert (facilityid);
			document.getElementById(facilityid).style.display='block';
		
		}
		else
		{
			var facilityid= document.facilityhotelfrm.facilities[i].value;
			//alert (facilityid);
			document.getElementById(facilityid).style.display='none';	
		}

	}

}




function hoteltypesearchvalid()
{
	var hoteltype=document.getElementById("type").value;
	//alert (hoteltype);

	var hotelstarcategory=document.getElementById("starcategory").value;
	//alert (hotelstarcategory);

	//xajax_hoteltypesearchfunction(xajax.getFormValues('hoteltypefrm'));

	xajax_hoteltypesearchfunction(hoteltype, hotelstarcategory);

}



function hoteldelete()
{
	
		alert ('working');
		//var hotelid=25; 
		var hotelid=document.getElementById("hotel_id").value;
		if(confirm("Do you want to Delete the hotel details"))
		{

			xajax_hoteldeletefunction(hotelid);

			//xajax_hotelsearchcriteriafunction(xajax.getFormValues('hotelsearch'));
				
		}
}


function hoteltypedelete(hoteltypeid,hoteltype,hotelstarcategory)
{
	
		alert ('working');
			
		if(confirm("Do you want to delete the hotel type details"))
		{

			xajax_hoteltypedeletefunction(hoteltypeid);
			
			xajax_hoteltypesearchfunction(hoteltype,hotelstarcategory);
				
			
				
		}
}




function selectsearchstate(country)
{
	alert ('yes');
	document.getElementById("state").style.display='block';

	
	
	xajax_searchstate(country);
	return true;

	
}

function selectsearchcity(state)
{
	alert (state);
	var country=document.getElementById("country").value;

	document.getElementById("city").style.display='block';

		
		xajax_searchcity(country,state);
		return true;
	
}

function imagedelete(i)
{
		alert ('working');
	 	var imagepath = document.getElementById("imageoldpath"+i).value;
		alert (imagepath);
		var imageid= document.getElementById("imageid"+i).value;
		alert (imageid);
		var hotelid=  document.getElementById("hotel_id").value;
		alert (hotelid);
		
		xajax_hotelimagedeletexajax(imageid, hotelid, imagepath);
		
		document.getElementById("imagetr"+i).style.display="none";





}

function displayhotel($hotelid)
{
	alert("Welcome to hotel information");
	//xajax_displayhotel(xajax.getFormValues("frmcustomersearch"));

}


function searchresult()
{
	//alert("Welecome search result");
	xajax_customersearchresult(xajax.getFormValues("frmcustomersearch"));

}

function customerstate(country)
{
	//alert("welcome state function");
	xajax_state1(country);
	return true;

	
}

function customerselectcity(state)
{

	//alert("Welcome customercity function");

	var country=document.getElementById("country").value;

		
	xajax_city1(country,state);
	return true;
	
}

function hotelstar(city)
{

	//alert("Welcome hotelstar function");
	xajax_star(city);
	return true;
	
}


function selectstar(type)
{
	alert ('working');
	document.getElementById("hotel_star").style.display='block';

	if (type == 0)
	{
		alert('Please select one hotel type');
		return false;
	}
	else
	{
	
		xajax_getallstarsxajax(type);
		return true;

	}
	
}


function selectstate(country)
{

	document.getElementById("state").style.display='block';

	if (country == 0)
	{
		alert('Please select one country');
		return false;
	}
	else
	{
	
		xajax_state(country);
		return true;

	}
	
}


function selectcity(state)
{
	var country=document.getElementById("country").value;

	document.getElementById("city").style.display='block';

	if (state == "0")
	{
		alert('Please select one state');
		return false;
	}
	else
	{
		
		xajax_city(country,state);
		return true;
	}
}


function validateemail(emailid)
{
	
	var email=emailid;
	var at="@";
	var dot=".";
	var lat=email.indexOf(at);
	var lemail=email.length;
	var ldot=email.indexOf(dot);

	if(email.length <= 0) 
	{
		
		return false;
		
		
	}

	
	else
	{
		if (lat==-1 || lat==0 || lat==lemail)
		{
		   	//alert("Invalid E-mail ID");
		   	//email = "";
		   	
		   	return false;
		}
		if (ldot==-1 || ldot==0 || ldot==lemail)
		{
		    	//alert("Invalid E-mail ID")
			 //email = "";
		   	
		    	return false;
		}
		if (email.indexOf(at,(lat+1))!=-1)
		{
		   	//alert("Invalid E-mail ID")
			//email = "";
		    	
		    	return false;
		}

		if (email.substring(lat-1,lat)==dot || email.substring(lat+1,lat+2)==dot)
		{
		    	//alert("Invalid E-mail ID")
			//email = "";
		    	
		    	return false;
		}

		if (email.indexOf(dot,(lat+2))==-1)
		{
		    	//alert("Invalid E-mail ID")
			// email = "";
		    	
		    	return false;
		}

		if (email.indexOf(" ")!=-1)
		{
		    	//alert("Invalid E-mail ID")
	         	//email = "";
		    	
			return false;
		}
		
 		

		return true;
		
	}
			
}


function checkwebsite(websitevalue)
{
	

	var website=websitevalue;
	
	var dot=".";

	
	var lwebsite=website.length;

	var ldot=website.indexOf(dot);

	var web=website.substr(0,4);
	//alert (web);
	var count=0;

	for(i=1; i<=lwebsite; i++)
	{
			
			var character= website.substr(i,1);
			
			if(character == dot)
			{
				count++;
			}
			
	}


	if(lwebsite<= 0) 
	{
		alert("Invalid website null");
		
		return false;
		
		
	}
	else
	{

	
		if (ldot==-1 || ldot==0 || ldot==lwebsite)
		{
		    	//alert("Invalid website dot");
			 
		   	
		    	return false;
		}


		if (!(web == 'www.' || web == 'WWW.'))
		{
			//alert("Invalid website www");
			return false;
		}

			

		
		if (count != 2)
		{
			//alert("Invalid website count");
			return false;
		}

			
		//alert ('valid website');
	 
		return true;
	}

	

}
	


function IsNumeric(strString)
   
   {
	

   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);

      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   	return blnResult;
   }



function validatephone(phone)
{

	for(var j=0; j< phone.length; j++)
	{
		var c= phone.charAt(j);
		
				
		if (c!='-' &&  c!= '/' && (c < '0' || c> '9'))
		{
			return false;
		}
	}
	
	return true;

}



function validateinsert()
{
	alert ('function working');	
	
	if ((document.getElementById("hotel_name").value== null) || (document.getElementById("hotel_name").value == ""))
	{
		alert("The field hotel name must be filled in");
		
		//document.hotelform.action="hotelinformation.php";
		
		return false;
	}
	else if ((document.getElementById("hotel_address").value== null) || (document.getElementById("hotel_address").value==""))
	{	
		alert("The field hotel_address must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	else if ((document.getElementById("hotel_location").value== null) || (document.getElementById("hotel_location").value==""))
	{
		alert("The field hotel_location must be filled in");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}
	else if (document.getElementById("country").value== 0)
	{
		alert("Please select one country");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}


	else if (document.hotelform.state.value==0)
	{
		alert("Please select one state");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}

	else if (document.hotelform.city.value==0)
	{
		alert("Please select one city");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}

	else if (document.hotelform.hotel_type.value==0)
	{
		alert("Please select the type of the hotel");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}

	else if (document.hotelform.star.value==0)
	{
		alert("Please select the star category of hotel");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}


	else if (document.getElementById("hotel_accessibility").value=="")
	{
		alert("The field hotel_accessibility must be filled in");

		//document.hotelform.action="hotelinformation.php";


		return false;
	}
	else if ((document.getElementById("hotel_landmark").value== null) || (document.getElementById("hotel_landmark").value==""))
	{
		alert("The field hotel_landmark must be filled in");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	else if ((document.getElementById("no_of_rooms").value== null) || (document.getElementById("no_of_rooms").value==""))
	{
		alert("The field no_of_rooms must be filled in");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
	}	
	else if (!IsNumeric(document.getElementById("no_of_rooms").value))
	{	
		alert("The field no_of_rooms must be numeric");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}	
	else if ((document.getElementById("hotel_phone").value== null) || (document.getElementById("hotel_phone").value==""))
	{
		alert("The field hotel_phone must be filled in");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
	}	
	else if (!validatephone(document.getElementById("hotel_phone").value))
	{
		alert("The field hotel_phone must have only numbers and '-' or '/' characters");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	else if ((document.getElementById("hotel_fax").value== null) || (document.getElementById("hotel_fax").value==""))
	{
		alert("The field hotel_fax  must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	else if (!validatephone(document.getElementById("hotel_fax").value))
	{
		alert("The field hotel_fax must have only numbers and '-' or '/' characters");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	else if ((document.getElementById("hotel_email").value== null) || (document.getElementById("hotel_email").value==""))
	{
		alert("The field hotel_email must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}

	else if (!validateemail(document.getElementById("hotel_email").value))
	{
		alert("Invalid Emailid");

		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}
		
	else if ((document.getElementById("hotel_website").value== null) || (document.getElementById("hotel_website").value==""))
	{
		alert("The field hotel website must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}


	else if (!checkwebsite(document.getElementById("hotel_website").value))
	{
		alert("Invalid website");

		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}	
	else if ((document.getElementById("hotel_checkouttime").value== null) || (document.getElementById("hotel_checkouttime").value==""))
	{
		alert("The field hotel_checkouttime must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}

	else if (!IsNumeric(document.getElementById("hotel_checkouttime").value))
	{	
		alert("The field hotel_checkouttime must be numeric");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}	

	else if ((document.getElementById("accepted_creditcards").value== null) || (document.getElementById("accepted_creditcards").value==""))
	{
		alert("The field accepted_creditcards must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	
	
	else if ((document.getElementById("hotel_description").value== null) || (document.getElementById("hotel_description").value==""))
	{
		alert("The field hotel_description must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	
		
		
	else if(document.getElementById("no_of_images").value>0)
	
	{	
	       
		
		
		for(i=1; i<=document.getElementById("no_of_images").value; i++)
		{

			if ((document.getElementById("image" + i).value==null) || (document.getElementById("image" + i).value==""))
			{
				alert("The field image " + i + " must be filled in");

				//document.hotelform.action="hotelinformation.php";


				return false;
			}
		}
		

	}
	
	
	

	//document.hotelform.submit();

	
	xajax_hotelinsert(xajax.getFormValues('hotelform'));



	return true;


}

function validateupdate()
{
	alert ('function working');	
	
	if ((document.getElementById("hotel_name").value== null) || (document.getElementById("hotel_name").value == ""))
	{
		alert("The field hotel name must be filled in");
		
		//document.hotelform.action="hotelinformation.php";
		
		return false;
	}
	
	else if ((document.getElementById("hotel_address").value== null) || (document.getElementById("hotel_address").value==""))
	{	
		alert("The field hotel_address must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	else if ((document.getElementById("hotel_location").value== null) || (document.getElementById("hotel_location").value==""))
	{
		alert("The field hotel_location must be filled in");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}


	
	else if (document.getElementById("country").value== 0)
	{
		alert("Please select one country");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}

	
	else if (document.hotelupdatefrm.state.value==0)
	{
		alert("Please select one state");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}
	
	else if (document.hotelupdatefrm.city.value==0)
	{
		alert("Please select one city");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}
	
	else if (document.hotelupdatefrm.hotel_type.value==0)
	{
		alert("Please select the type of the hotel");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}
	
	else if (document.hotelupdatefrm.star.value==0)
	{
		alert("Please select the star category of hotel");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}
	
	else if (document.getElementById("hotel_accessibility").value=="")
	{
		alert("The field hotel_accessibility must be filled in");

		//document.hotelform.action="hotelinformation.php";


		return false;
	}
	else if ((document.getElementById("hotel_landmark").value== null) || (document.getElementById("hotel_landmark").value==""))
	{
		alert("The field hotel_landmark must be filled in");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	else if ((document.getElementById("no_of_rooms").value== null) || (document.getElementById("no_of_rooms").value==""))
	{
		alert("The field no_of_rooms must be filled in");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
	}	
	else if (!IsNumeric(document.getElementById("no_of_rooms").value))
	{	
		alert("The field no_of_rooms must be numeric");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}	
	else if ((document.getElementById("hotel_phone").value== null) || (document.getElementById("hotel_phone").value==""))
	{
		alert("The field hotel_phone must be filled in");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
	}	
	else if (!validatephone(document.getElementById("hotel_phone").value))
	{
		alert("The field hotel_phone must have only numbers and '-' or '/' characters");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	else if ((document.getElementById("hotel_fax").value== null) || (document.getElementById("hotel_fax").value==""))
	{
		alert("The field hotel_fax  must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	else if (!validatephone(document.getElementById("hotel_fax").value))
	{
		alert("The field hotel_fax must have only numbers and '-' or '/' characters");
		
		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	else if ((document.getElementById("hotel_email").value== null) || (document.getElementById("hotel_email").value==""))
	{
		alert("The field hotel_email must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}

	else if (!validateemail(document.getElementById("hotel_email").value))
	{
		alert("Invalid Emailid");

		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}	
	else if ((document.getElementById("hotel_website").value== null) || (document.getElementById("hotel_website").value==""))
	{
		alert("The field hotel_website must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}	

	else if (!checkwebsite(document.getElementById("hotel_website").value))
	{
		alert("Invalid website");

		//document.hotelform.action="hotelinformation.php";

		return false;
		
	}
	else if ((document.getElementById("hotel_checkouttime").value== null) || (document.getElementById("hotel_checkouttime").value==""))
	{
		alert("The field hotel_checkouttime must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}

	else if (!IsNumeric(document.getElementById("hotel_checkouttime").value))
	{	
		alert("The field hotel_checkouttime must be numeric");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}	

	else if ((document.getElementById("accepted_creditcards").value== null) || (document.getElementById("accepted_creditcards").value==""))
	{
		alert("The field accepted_creditcards must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	
	
	else if ((document.getElementById("hotel_description").value== null) || (document.getElementById("hotel_description").value==""))
	{
		alert("The field hotel_description must be filled in");

		//document.hotelform.action="hotelinformation.php";

		return false;
	}
	
		
		
	/**else if(document.getElementById("no_of_images").value>0)
	
	{	
	       
		
		
		for(i=1; i<=document.getElementById("no_of_images").value; i++)
		{

			if ((document.getElementById("image" + i).value==null) || (document.getElementById("image" + i).value==""))
			{
				alert("The field image " + i + " must be filled in");

				//document.hotelform.action="hotelinformation.php";


				return false;
			}

		}
		

	}**/
	
	
	

	
	

	//document.hotelupdatefrm.submit();

	
	if(xajax_hotelupdatefunction(xajax.getFormValues('hotelupdatefrm')))
	{	
		
		xajax_hoteldisplayfunction(document.getElementById("hotel_id").value);
	}

	
}




function validatetypeinsert()
{
	alert ('function working');	
	
	if ((document.getElementById("hotel_type").value== null) || (document.getElementById("hotel_type").value == ""))
	{
		alert("The field hotel type must be filled in");
		
		
		return false;
	}

	else if ((document.getElementById("hotel_star_category").value== null) || (document.getElementById("hotel_star_category").value==""))
	{	
		alert("The field hotel star category must be filled in");

		return false;
	}

	var action='insert';

	xajax_hoteltypefunction(xajax.getFormValues('hoteltypefrm'), action);

	return true;


}


function validatetypeupdate()
{
	alert ('function working');	
	
	if ((document.getElementById("hotel_type").value== null) || (document.getElementById("hotel_type").value == ""))
	{
		alert("The field hotel type must be filled in");
		
		
		return false;
	}

	else if ((document.getElementById("hotel_star_category").value== null) || (document.getElementById("hotel_star_category").value==""))
	{	
		alert("The field hotel star category must be filled in");

		return false;
	}

	var action='update';

	xajax_hoteltypefunction(xajax.getFormValues('hoteltypefrm'), action);

	return true;


}

//-------------------//
function selectsectorvalue(elementid,selecttype)
{
	var indexOfSelect = document.getElementById('citybox').selectedIndex;
	var selectedText = document.getElementById('citybox')[indexOfSelect].text;
	var selectedValue = document.getElementById('citybox')[indexOfSelect].value;
	
	if(selectedValue != '')
	{
		document.getElementById(elementid).value = selectedText;
	}
	else
	{
		document.getElementById(elementid).value = '';
	}
	if(document.getElementById("DIV"+elementid))
	{
		document.getElementById("DIV"+elementid).value = selectedValue;
	}
	if(selecttype == 'mouseclick')
	{
		if(document.getElementById("openboxdiv"))
		{
			document.getElementById("openboxdiv").className = "hide";
			document.getElementById("openboxdiv").innerHTML = "";
		}
		
	}
	
}

function intersectorselect(event,elementid) 
{
 if( (window.event && window.event.keyCode == 13) || (event && event.which == 13) )
  {
	  	var indexOfSelect = document.getElementById('citybox').selectedIndex;
		var selectedText = document.getElementById('citybox')[indexOfSelect].text;
		var selectedValue = document.getElementById('citybox')[indexOfSelect].value;

		if(selectedValue != '')
		{
			document.getElementById(elementid).value = selectedText;
		}
		else
		{
			document.getElementById(elementid).value = '';
		}
		if(document.getElementById("DIV"+elementid))
		{
			document.getElementById("DIV"+elementid).value = selectedValue;
		}
		if(document.getElementById("openboxdiv"))
		{
			document.getElementById("openboxdiv").className = "hide";
			document.getElementById("openboxdiv").innerHTML = "";
		}
		 
		return true; 
		
  }
  else
  {
    return false;
  }
}

function changecolor1(td)
{
	document.getElementById(td).bgColor="#99CCFF";
}
function changecolor2(td)
{
	document.getElementById(td).bgColor="FFFFFF";
}

function showboxdiv(divname)
{
	document.getElementById(divname).className="show";
}
function closeboxdiv(divdata)
{
	document.getElementById(divdata).className="hide";
}
function openbox(data,divname,elementid)
{
	if(data.length >= 3 )
	{
		document.getElementById(divname).className="show";
		xajax_xajaxgetcity(data,divname,elementid);
	}
}
function nextfocus(evt)
{
	evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
	
    if ((charCode == 38) || (charCode == 40)) 
	{
		if(document.getElementById("citybox"))
		{
      		document.getElementById("citybox").focus();
		}
	    return false;
    }
	return true;
}
