/* function to validate city */

function validatecity(){
	
	
	var id=document.form.id.value;
	var city=document.form.city.value;
	
if(id==''){
	document.getElementById('admincityDiv').innerHTML="Enter City Code";
	document.getElementById('admincityDiv').style.display="block";
	document.form.id.focus();
	return false;
}
if(city==''){
	document.getElementById('admincityDiv').innerHTML="Enter city";
	document.getElementById('admincityDiv').style.display="block";
	document.form.city.focus();
	return false;
}

return true;
}

/* End */

/* function to validate Comment */

function validatecomment(){
	
	
	var city=document.form.city.value;
	var hoteltype=document.form.hoteltype.value;
	var hotel=document.form.hotel.value;
	var name=document.form.name.value;
	var country=document.form.country.value;
	var comment=document.form.comment.value;
	
if(city==''){
	document.getElementById('admincommentDiv').innerHTML="Select City.";
	document.getElementById('admincommentDiv').style.display="block";
	document.form.city.focus();
	return false;
}
if(hoteltype==''){
	document.getElementById('admincommentDiv').innerHTML="Select Hotel Type.";
	document.getElementById('admincommentDiv').style.display="block";
	document.form.hoteltype.focus();
	return false;
}
if(hotel==''){
	document.getElementById('admincommentDiv').innerHTML="Select Hotel.";
	document.getElementById('admincommentDiv').style.display="block";
	document.form.hotel.focus();
	return false;
}
if(name==''){
	document.getElementById('admincommentDiv').innerHTML="Enter Name.";
	document.getElementById('admincommentDiv').style.display="block";
	document.form.name.focus();
	return false;
}
if(country==''){
	document.getElementById('admincommentDiv').innerHTML="Enter Country Name.";
	document.getElementById('admincommentDiv').style.display="block";
	document.form.country.focus();
	return false;
}
if(comment==''){
	document.getElementById('admincommentDiv').innerHTML="Enter Comment. ";
	document.getElementById('admincommentDiv').style.display="block";
	document.form.comment.focus();
	return false;
}
return true;
}

/* End */

/* function to validate Package */

function validatepackage(){
	
	
	var city=document.form.city.value;
	var hoteltype=document.form.hoteltype.value;
	var hotel=document.form.hotel.value;
	var name=document.form.package_name.value;
	var price=document.form.price.value;
	var desc=document.form.desc.value;
	var duration=document.form.duration.value;
	
if(city==''){
	document.getElementById('adminpackagediv').innerHTML="Select City.";
	document.getElementById('adminpackagediv').style.display="block";
	document.form.city.focus();
	return false;
}
if(hoteltype==''){
	document.getElementById('adminpackagediv').innerHTML="Select Hotel Type.";
	document.getElementById('adminpackagediv').style.display="block";
	document.form.hoteltype.focus();
	return false;
}
if(hotel==''){
	document.getElementById('adminpackagediv').innerHTML="Select Hotel.";
	document.getElementById('adminpackagediv').style.display="block";
	document.form.hotel.focus();
	return false;
}
if(name==''){
	document.getElementById('adminpackagediv').innerHTML="Enter Hotel Package Name.";
	document.getElementById('adminpackagediv').style.display="block";
	document.form.package_name.focus();
	return false;
}
if(price==''){
	document.getElementById('adminpackagediv').innerHTML="Enter Price of Package.";
	document.getElementById('adminpackagediv').style.display="block";
	document.form.price.focus();
	return false;
}
if(desc==''){
	document.getElementById('adminpackagediv').innerHTML="Enter Description of Package. ";
	document.getElementById('adminpackagediv').style.display="block";
	document.form.desc.focus();
	return false;
}
if(duration==''){
	document.getElementById('adminpackagediv').innerHTML="Enter Duration of Package.";
	document.getElementById('adminpackagediv').style.display="block";
	document.form.duration.focus();
	return false;
}
return true;
}

/* End */
/* function to validate category */

function validatecategory(){
	
	
	var id=document.form.id.value;
	var hoteltype=document.form.hoteltype.value;
	
if(id==''){
	document.getElementById('admincategoryDiv').innerHTML="Enter Category Code";
	document.getElementById('admincategoryDiv').style.display="block";
	document.form.id.focus();
	return false;
}
if(hoteltype==''){
	document.getElementById('admincategoryDiv').innerHTML="Enter hoteltype";
	document.getElementById('admincategoryDiv').style.display="block";
	document.form.hoteltype.focus();
	return false;
}

return true;
}

/* End */

/* function to validate hoteltype */

function validatehoteltype(){
	
	
	var city=document.form.city.value;
	var hoteltype=document.form.hoteltype.value;
	
if(city==''){
	document.getElementById('hoteltype').innerHTML="Enter City ";
	document.getElementById('hoteltype').style.display="block";
	document.form.city.focus();
	return false;
}
if(hoteltype==''){
	document.getElementById('hoteltype').innerHTML="Enter Hotel Type";
	document.getElementById('hoteltype').style.display="block";
	document.form.hoteltype.focus();
	return false;
}

return true;
}


function validatehoteltypes(){
	
	
	var city=document.form.city.value;
	var hoteltype=document.form.hoteltype.value;
	
if(city==''){
	document.getElementById('hoteltypes').innerHTML="Enter City ";
	document.getElementById('hoteltypes').style.display="block";
	document.form.city.focus();
	return false;
}
if(hoteltype==''){
	document.getElementById('hoteltypes').innerHTML="Enter Hotel Type";
	document.getElementById('hoteltypes').style.display="block";
	document.form.hoteltype.focus();
	return false;
}

return true;
}
/* End */


/* function to validate Hotel */

function validatehotel(){
	
	var city=document.form.city.value;
	var hoteltype=document.form.hoteltype.value;
	var hotelname=document.form.name.value;
	var profile=document.form.profile.value;
	var group=document.form.group.value;
	var services=document.form.services.value;
	var class=document.form.class.value;
	var restaurant=document.form.restaurant.value;
	var distance_railway=document.form.distance_railway.value;
	var distance_bus=document.form.distance_bus.value;
	var distance_airport=document.form.distance_airport.value;
	var title=document.form.title.value;

if(city==''){
	document.getElementById('hotel').innerHTML="Select city";
	document.getElementById('hotel').style.display="block";
	document.form.city.focus();
	return false;
}
if(hoteltype==''){
	document.getElementById('hotel').innerHTML="Select Hotel Type";
	document.getElementById('hotel').style.display="block";
	document.form.hoteltype.focus();
	return false;
}
if(hotelname==''){
	document.getElementById('hotel').innerHTML="Enter Hotel Name";
	document.getElementById('hotel').style.display="block";
	document.form.name.focus();
	return false;
}

if(profile==''){
	document.getElementById('hotel').innerHTML="Enter Profile";
	document.getElementById('hotel').style.display="block";
	document.form.profile.focus();
	return false;
}
if(group==''){
	document.getElementById('hotel').innerHTML="Enter Group";
	document.getElementById('hotel').style.display="block";
	document.form.group.focus();
	return false;
}
if(services==''){
	document.getElementById('hotel').innerHTML="Enter Services";
	document.getElementById('hotel').style.display="block";
	document.form.services.focus();
	return false;
}
if(class==''){
	document.getElementById('hotel').innerHTML="Enter No. of Rooms";
	document.getElementById('hotel').style.display="block";
	document.form.class.focus();
	return false;
}
if(restaurant==''){
	document.getElementById('hotel').innerHTML="Enter Restaurant";
	document.getElementById('hotel').style.display="block";
	document.form.restaurant.focus();
	return false;
}
if(distance_railway==''){
	document.getElementById('hotel').innerHTML="Enter Distance From Railway Station";
	document.getElementById('hotel').style.display="block";
	document.form.distance_railway.focus();
	return false;
}
if(distance_bus==''){
	document.getElementById('hotel').innerHTML="Enter Distance From Bus Stand";
	document.getElementById('hotel').style.display="block";
	document.form.distance_bus.focus();
	return false;
}
if(distance_airport==''){
	document.getElementById('hotel').innerHTML="Enter Distance From Airport";
	document.getElementById('hotel').style.display="block";
	document.form.distance_airport.focus();
	return false;
}
if(title==''){
	document.getElementById('hotel').innerHTML="Enter Package";
	document.getElementById('hotel').style.display="block";
	document.form.title.focus();
	return false;
}
return true;
}

/* End */

/* function to validate Admin */

function validateadmin(){
	
	var emailExp = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var admin=document.form.admin.value;
	var email=document.form.email.value;
	


if(admin==''){
	document.getElementById('hotel').innerHTML="Enter Username";
	document.getElementById('hotel').style.display="block";
	document.form.admin.focus();
	return false;
}
if(email==''){
	document.getElementById('hotel').innerHTML="Enter Email";
	document.getElementById('hotel').style.display="block";
	document.form.email.focus();
	return false;
}
if(!email.match(emailExp)){
		document.getElementById('hotel').innerHTML = "Enter valid email.";
		document.getElementById('hotel').style.display="block";
		document.form.email.focus();
		return false;
	}

return true;
}



		
/************************************************************************************************** 
* Function to change the admin password , Start 
**************************************************************************************************/
function changePasswordValidate(){
	var oldPassword = document.form.oldPassword.value;
	var newPassword = document.form.newPassword.value;
	var rePassword = document.form.rePassword.value;
	if(oldPassword==''){
		document.getElementById('changePasswordDiv').innerHTML = "Enter old password.";
		document.getElementById('changePasswordDiv').style.display="block";
		document.form.oldPassword.focus();
		return false;
	}
	if(newPassword==''){
		document.getElementById('changePasswordDiv').innerHTML = 'Enter new password.';
		document.getElementById('changePasswordDiv').style.display = 'block';
		document.form.newPassword.focus();
		return false;
	}
	if(rePassword==''){
		document.getElementById('changePasswordDiv').innerHTML = 'Enter Re-password.';
		document.getElementById('changePasswordDiv').style.display = 'block';
		document.form.rePassword.focus();
		return false;
	}
	if(newPassword!=rePassword){
		document.getElementById('changePasswordDiv').innerHTML = 'New password and Re-password did not match.';
		document.getElementById('changePasswordDiv').style.display = 'block';
		document.form.newPassword.focus();
		document.form.newPassword.value='';
		document.form.rePassword.value='';
		return false;
	}
	return true;
}
/************************************************************************************************** 
* Function to change the admin password , End
**************************************************************************************************/

