var PLEASE_ENTER="Please enter ";
var prefix = window.parent.document.location.protocol + '//';
var WSPATH=prefix+"www.golflinkshotel.com";
var HTTPS_WSPATH=prefix+"www.golflinkshotel.com";
function regValidation()
{
	var dt=document.frm_register;
	if(trim(dt.user_first_name.value)==''){
		alert(PLEASE_ENTER+"first name.");
		dt.user_first_name.focus();
		return false;
	}
	if(trim(dt.user_last_name.value)==''){
		alert(PLEASE_ENTER+"last name.");
		dt.user_last_name.focus();
		return false;
	}
	if(trim(dt.user_name.value)==''){
		alert(PLEASE_ENTER+"username.");
		dt.user_name.focus();
		return false;
	}
	if(trim(dt.user_password.value)==''){
		alert(PLEASE_ENTER+"password.");
		dt.user_password.focus();
		return false;
	}
	if(trim(dt.user_email_address.value)==''){
		alert(PLEASE_ENTER+"email.");
		dt.user_email_address.focus();
		return false;
	}else{
		if(!validString(trim(dt.user_email_address.value),'email')){
			alert("Please enter valid email.");
			dt.user_email_address.focus();
			dt.user_email_address.select();
			return false;
		}
	}
	if(trim(dt.user_house_no.value)==''){
		alert(PLEASE_ENTER+"house number.");
		dt.user_house_no.focus();
		return false;
	}
	if(trim(dt.user_street.value)==''){
		alert(PLEASE_ENTER+"street.");
		dt.user_street.focus();
		return false;
	}
	if(trim(dt.user_town.value)==''){
		alert(PLEASE_ENTER+"town.");
		dt.user_town.focus();
		return false;
	}
	if(trim(dt.user_country.value)==0){
		alert(PLEASE_ENTER+"country.");
		dt.user_country.focus();
		return false;
	}
	if(trim(dt.user_zipcode.value)==0){
		alert(PLEASE_ENTER+"post code.");
		dt.user_zipcode.focus();
		return false;
	}
	if(trim(dt.user_telephone.value)==''){
		alert(PLEASE_ENTER+"telephone.");
		dt.user_telephone.focus();
		return false;
	}
	if(trim(dt.user_mobile.value)==''){
		alert(PLEASE_ENTER+"mobile.");
		dt.user_mobile.focus();
		return false;
	}
	if(uniqueUser(trim(dt.user_name.value)))
	{
		alert("Username already exists, Plese enter another username.");
		return false;
	}
	//submitStr="submitAction=Register"+"&user_first_name="+encodeURI(dt.user_first_name.value)+"&user_last_name="+encodeURI(dt.user_last_name.value)+"&user_name="+encodeURI(dt.user_name.value)+"&user_password="+encodeURI(dt.user_password.value)+"&user_email_address="+encodeURI(dt.user_email_address.value)+"&user_house_no="+encodeURI(dt.user_house_no.value)+"&user_street="+encodeURI(dt.user_street.value)+"&user_town="+encodeURI(dt.user_town.value)+"&user_country="+encodeURI(dt.user_country.value)+"&user_zipcode="+encodeURI(dt.user_zipcode.value)+"&user_telephone="+encodeURI(dt.user_telephone.value)+"&user_mobile="+encodeURI(dt.user_mobile.value);
	submitStr="submitAction=Register"+"&user_first_name="+trim(dt.user_first_name.value)+"&user_last_name="+trim(dt.user_last_name.value)+"&user_name="+trim(dt.user_name.value)+"&user_password="+trim(dt.user_password.value)+"&user_email_address="+trim(dt.user_email_address.value)+"&user_house_no="+trim(dt.user_house_no.value)+"&user_street="+trim(dt.user_street.value)+"&user_town="+trim(dt.user_town.value)+"&user_country="+trim(dt.user_country.value)+"&user_zipcode="+trim(dt.user_zipcode.value)+"&user_telephone="+trim(dt.user_telephone.value)+"&user_mobile="+trim(dt.user_mobile.value);
	postAjaxContent(WSPATH + "/register_post.php",submitStr,"frm_register_success","frm_input_register");
	return false;
}
function changeCaptcha()
{
	document.getElementById("loading").src="images/loading1.gif";
	capimg=getAJAXcontent(WSPATH + "/get_captcha.php");
	document.getElementById("codeHidden").value=capimg;
	document.getElementById("codeImage").src=capimg;
	document.getElementById("loading").src="images/ic-refresh.jpg";
}
function uniqueUser(userName)
{
	unique_user=getAJAXcontent(WSPATH + "/unique_user.php?username="+encodeURI(userName));
	return (unique_user=="1"?true:false);
}
function loginValidation()
{
	var dt=document.frm_login;
	if(trim(dt.user_name.value)==''){
		alert(PLEASE_ENTER+"username.");
		dt.user_name.focus();
		return false;
	}
	if(trim(dt.user_password.value)==''){
		alert(PLEASE_ENTER+"password.");
		dt.user_password.focus();
		return false;
	}
	if(validUser(trim(dt.user_name.value),trim(dt.user_password.value)))
	{
		YAHOO.com.thecodecentral.dialog3.hide();		
		location.href="index.php?v=login";		
		
		return false;
	}else{
		alert("Invalid username or password.");
		dt.user_name.focus();
		dt.user_name.select();
		return false;
	}
	return false;
}
function validUser(userName,passWord)
{
	unique_user=getAJAXcontent(WSPATH + "/login_user_valid.php?username="+encodeURI(userName)+"&password="+encodeURI(passWord));
	return (unique_user=="1"?true:false);
}
function forPassValidation()
{
	var dt=document.frm_forgot;
	if(trim(dt.user_email_address.value)==''){
		alert(PLEASE_ENTER+"email.");
		dt.user_email_address.focus();
		return false;
	}else{
		if(!validString(trim(dt.user_email_address.value),'email')){
			alert("Please enter valid email.");
			dt.user_email_address.focus()
			dt.user_email_address.select();
			return false;
		}
	}
	if(checkUserEmail(trim(dt.user_email_address.value)))
	{
		alert("Email does not match.");
		return false;
	}
	
	submitStr="submitAction=Forgot"+"&user_email_address="+trim(dt.user_email_address.value);
	postAjaxContent(WSPATH + "/forgot_email_post.php",submitStr,"frm_forgot_success","frm_input_forgot");
	return false;
}
function checkUserEmail(userEmail)
{
	unique_user=getAJAXcontent(WSPATH + "/forgot_email_valid.php?useremail="+userEmail);
	return (unique_user=="1"?false:true);
}
function logOut()
{
	unique_user=getAJAXcontent(WSPATH + "/logout.php");
	location.href="index.php?v=logout";		
	return false;
}
function proEditValidation()
{
	var dt=document.frm_profile;
	if(trim(dt.user_first_name.value)==''){
		alert(PLEASE_ENTER+"first name.");
		dt.user_first_name.focus();
		return false;
	}
	if(trim(dt.user_last_name.value)==''){
		alert(PLEASE_ENTER+"last name.");
		dt.user_last_name.focus();
		return false;
	}
	if(trim(dt.user_password.value)==''){
		alert(PLEASE_ENTER+"password.");
		dt.user_password.focus();
		return false;
	}
	if(trim(dt.user_email_address.value)==''){
		alert(PLEASE_ENTER+"email.");
		dt.user_email_address.focus();
		return false;
	}else{
		if(!validString(trim(dt.user_email_address.value),'email')){
			alert("Please enter valid email.");
			dt.user_email_address.focus();
			dt.user_email_address.select();
			return false;
		}
	}
	if(trim(dt.user_house_no.value)==''){
		alert(PLEASE_ENTER+"house number.");
		dt.user_house_no.focus();
		return false;
	}
	if(trim(dt.user_street.value)==''){
		alert(PLEASE_ENTER+"street.");
		dt.user_street.focus();
		return false;
	}
	if(trim(dt.user_town.value)==''){
		alert(PLEASE_ENTER+"town.");
		dt.user_town.focus();
		return false;
	}
	if(trim(dt.user_country.value)==0){
		alert("Please select country.");
		dt.user_country.focus();
		return false;
	}
	if(trim(dt.user_zipcode.value)==0){
		alert(PLEASE_ENTER+"post code.");
		dt.user_zipcode.focus();
		return false;
	}
	if(trim(dt.user_telephone.value)==''){
		alert(PLEASE_ENTER+"telephone.");
		dt.user_telephone.focus();
		return false;
	}
	if(trim(dt.user_mobile.value)==''){
		alert(PLEASE_ENTER+"mobile.");
		dt.user_mobile.focus();
		return false;
	}
	var newsl
	if(document.getElementById('radio1').checked) 
		newsl=document.getElementById('radio1').value;
	else if(document.getElementById('radio0').checked) 
		newsl=document.getElementById('radio0').value;
	submitStr="submitAction=Register"+"&user_first_name="+trim(dt.user_first_name.value)+"&user_last_name="+trim(dt.user_last_name.value)+"&user_password="+trim(dt.user_password.value)+"&user_email_address="+trim(dt.user_email_address.value)+"&user_house_no="+trim(dt.user_house_no.value)+"&user_street="+trim(dt.user_street.value)+"&user_town="+trim(dt.user_town.value)+"&user_country="+trim(dt.user_country.value)+"&user_zipcode="+trim(dt.user_zipcode.value)+"&user_telephone="+trim(dt.user_telephone.value)+"&user_mobile="+trim(dt.user_mobile.value)+"&user_newsletter="+newsl;
	var editVal=postAjaxContent(WSPATH + "/profile_management_post.php",submitStr,"frm_register_success","frm_input_register");
	if(editVal){
		alert("Your profile has been updated successfully.")
	}
	return false;
}

function resbookValid(res_book_id)
{
	var dt=document.frm_rbk_cc_detail;
	if(trim(dt.user_first_name.value)==''){
		alert(PLEASE_ENTER+"first name.");
		dt.user_first_name.focus();
		return false;
	}
	if(trim(dt.user_last_name.value)==''){
		alert(PLEASE_ENTER+"last name.");
		dt.user_last_name.focus();
		return false;
	}
	if(trim(dt.user_email_address.value)==''){
		alert(PLEASE_ENTER+"email.");
		dt.user_email_address.focus();
		return false;
	}else{
		if(!validString(trim(dt.user_email_address.value),'email')){
			alert("Invalid email.");
			dt.user_email_address.focus();
			dt.user_email_address.select();
			return false;
		}
	}
	if(trim(dt.user_mobile.value)==''){
		alert(PLEASE_ENTER+"mobile.");
		dt.user_mobile.focus();
		return false;
	}
	if(trim(dt.res_home_address.value)==''){
		alert(PLEASE_ENTER+"home address.");
		dt.res_home_address.focus();
		return false;
	}
	if(trim(dt.res_postcode.value)==''){
		alert(PLEASE_ENTER+"post code.");
		dt.res_postcode.focus();
		return false;
	}
	var res_no_heads=trim(dt.res_no_heads.value);
	if(res_no_heads==''){
		alert(PLEASE_ENTER+"number of guest(s).");
		dt.res_no_heads.focus();
		return false;
	}
	else if(!isInt(res_no_heads)){
		alert(PLEASE_ENTER+"a numeric value for number of guest(s).");
		dt.res_no_heads.focus();
		dt.res_no_heads.select();
		return false;
	}
	else if(res_no_heads==0){
		alert(PLEASE_ENTER+"a non zero numeric value for number of guest(s).");
		dt.res_no_heads.focus();
		dt.res_no_heads.select();
		return false;
	}

	var limit_val=dt.limit_val.value;
	var booked=getAJAXcontent(HTTPS_WSPATH + "/restaurant-booking-availability.php?bdate="+dt.res_book_date.value);
	var bookReq=parseInt(booked) + parseInt(res_no_heads);
	if(bookReq > limit_val){
		alert("Booking remains for "+eval(limit_val-booked)+" guest(s).");
		dt.res_no_heads.focus();
		dt.res_no_heads.select();
		return false;
	}
	if(trim(dt.res_holder_name.value)==''){
		alert(PLEASE_ENTER+"name printed on card.");
		dt.res_holder_name.focus();
		return false;
	}
	if(trim(dt.res_card_type.value)==2){
		if(trim(dt.res_issue_number.value)==''){
			alert(PLEASE_ENTER+"issue number.");
			dt.res_issue_number.focus();
			return false;
		}	
	}
	if(trim(dt.res_card_number.value)==''){
		alert(PLEASE_ENTER+"card number.");
		dt.res_card_number.focus();
		return false;
	}
	else if(isNaN(trim(dt.res_card_number.value))){
		alert(PLEASE_ENTER+"a numeric value for card number.");
		dt.res_card_number.focus();
		dt.res_card_number.select();
		return false;
	}
	else if((dt.res_card_number.value).length<16){
		alert(PLEASE_ENTER+"a 16 digit numeric value for card number.");
		dt.res_card_number.focus();
		dt.res_card_number.select();
		return false;
	}
	today = new Date();
	var crMon=eval(today.getMonth()+1);
 	var crYer=today.getFullYear();
 	var crDay=today.getDate();

	if(crYer==trim(dt.res_srt_year.value) && trim(dt.res_srt_mon.value)>=crMon){	
		alert("Your card is not valid, select valid start date.");
		return false;
	}
	if(crYer==trim(dt.res_exp_year.value) && trim(dt.res_exp_mon.value)<=crMon){	
		alert("Your card is not valid, select valid expiration date.");
		return false;
	}
	if(trim(dt.res_sec_code.value)==''){
		alert(PLEASE_ENTER+"card security code.");
		dt.res_sec_code.focus();
		return false;
	}
	else if(isNaN(trim(dt.res_sec_code.value))){
		alert(PLEASE_ENTER+"a numeric value for card security code.");
		dt.res_sec_code.focus();
		dt.res_sec_code.select();
		return false;
	}
	submitStr="submitAction=ResBook"+"&user_first_name="+trim(dt.user_first_name.value)+"&user_last_name="+trim(dt.user_last_name.value)+"&user_email_address="+trim(dt.user_email_address.value)+"&user_mobile="+trim(dt.user_mobile.value)+"&res_home_address="+trim(dt.res_home_address.value)+"&res_postcode="+trim(dt.res_postcode.value)+"&res_no_heads="+trim(dt.res_no_heads.value)+"&res_book_date="+trim(dt.res_book_date.value)+"&res_arrive_time1="+trim(dt.res_arrive_time1.value)+"&res_arrive_time2="+trim(dt.res_arrive_time2.value)+"&res_arrive_time3="+trim(dt.res_arrive_time3.value)+"&res_holder_name="+trim(dt.res_holder_name.value)+"&res_card_type="+trim(dt.res_card_type.value)+"&res_issue_number="+trim(dt.res_issue_number.value)+"&res_card_number="+trim(dt.res_card_number.value)+"&res_srt_mon="+trim(dt.res_srt_mon.value)+"&res_srt_year="+trim(dt.res_srt_year.value)+"&res_exp_mon="+trim(dt.res_exp_mon.value)+"&res_exp_year="+trim(dt.res_exp_year.value)+"&res_sec_code="+trim(dt.res_sec_code.value)+"&res_book_id="+res_book_id;
	var editVal=postAjaxContent(HTTPS_WSPATH + "/res_book_details_post.php",submitStr,"frm_res_input","frm_res_input");
	alert("You want to book restaurant for "+res_no_heads+" guest(s)");
	openPage('restaurant-booking-confirm.php?res_book_id='+res_book_id,'785','531');
	return false;	
}
function resbookConfirmValid(res_book_id,grandtotal)
{
	insertVal=getAJAXcontent(HTTPS_WSPATH + "/restaurant-booking-confirm-post.php?res_book_id="+res_book_id+"&grandtotal="+grandtotal);
	alert("Your total booking charge is : "+grandtotal);
	openPage('restaurant-booking-final.php?res_book_id='+res_book_id,'785','531');
}
function checkValidDate(bookDate)
{
	var dtAry=bookDate.split("-");
	
	today = new Date();
	var crMon=eval(today.getMonth()+1);
 	var crYer=today.getFullYear();
 	var crDay=today.getDate();
 	var vld=1;
 	
	if(dtAry[0]<crYer){
		vld=0;
	}else if(dtAry[0]==crYer && dtAry[1]<crMon){
		vld=0;
	}else if(dtAry[0]==crYer && dtAry[1]==crMon && dtAry[2]<crDay){
		vld=0;
	}
	return vld;
}
function nextResBook(){
	var bookDArray=document.getElementById('bookDArray').value;
	var limit_val=document.getElementById('limit_val').value;
	booked=getAJAXcontent(HTTPS_WSPATH + "/restaurant-booking-availability.php?bdate="+bookDArray);

	if(bookDArray!=''){	
		if(eval(booked)<eval(limit_val)){
			alert("Booking remains for "+eval(limit_val-booked)+" guest(s).")
			openPage('restaurant-booking-details.php?bookDArray='+bookDArray,'785','531');
		}else{
			alert("Booking is full for selected date.");
			return false;
		}		
	}else{
		alert("Please select the date you want to book for restaturant.");
		return false;
	}	
}
function nextHotBook(){
	var bookDArray=document.getElementById('bookDArray').value;
	if(bookDArray!=''){
		openPage('hotel-booking-details.php?bookDArray='+encodeURI(bookDArray),'785','531');
	}else{
		alert("Please select the date(s) you want to book for hotel.");
		return false;
	}	
}
function changeRoomDeail(id)
{
	document.getElementById("charge_"+id).style.display="block";
	var slctroom=document.getElementById("selectroom").value;
	document.getElementById("charge_"+slctroom).style.display="none";
	document.getElementById("selectroom").value=id;
}
function hotbookValid(hot_book_id)
{
	var dt=document.frm_hot_cc_detail;
	var hot_room_type=trim(dt.hot_room_type.value);
	var hot_no_heads=trim(dt.hot_no_heads.value);
	var hot_no_rooms=trim(dt.hot_no_rooms.value);
	var hot_book_dates=trim(dt.hot_book_dates.value);
	
	if(hot_room_type==''){
		alert("Please select room type.");
		return false;
	}	
	if(hot_no_heads==''){
		alert("Please enter number of guest(s).");
		dt.hot_no_heads.focus();
		return false;
	}
	else if(!isInt(hot_no_heads)){
		alert("Please enter a numeric value for number of guest(s).");
		dt.hot_no_heads.focus();
		dt.hot_no_heads.select();
		return false;
	}
	else if(hot_no_heads==0){
		alert("Please enter a non zero numeric value for number of guest(s).");
		dt.hot_no_heads.focus();
		dt.hot_no_heads.select();
		return false;
	}
	if(hot_no_rooms==''){
		alert("Please enter number of rooms.");
		dt.hot_no_rooms.focus();
		return false;
	}
	else if(!isInt(hot_no_rooms)){
		alert("Please enter a numeric value for number of rooms.");
		dt.hot_no_rooms.focus();
		dt.hot_no_rooms.select();
		return false;
	}
	else if(hot_no_rooms==0){
		alert("Please enter a non zero numeric value for number of rooms.");
		dt.hot_no_rooms.focus();
		dt.hot_no_rooms.select();
		return false;
	}
	
	var headallows=getAJAXcontent(HTTPS_WSPATH + "/hotel-booking-availability.php?hrt="+hot_room_type+"&hnh="+hot_no_heads+"&hnr="+hot_no_rooms);
	if(headallows==0){
		alert("You are not allowed to book "+hot_no_heads+" guest(s) in "+hot_no_rooms+" rooms");
		dt.hot_no_heads.focus();
		dt.hot_no_heads.select();
		return false;
	}	

	hot_book_dates=str_replace("\r\n",",",hot_book_dates);
	hot_book_dates=str_replace("\n",",",hot_book_dates);
	
	var room_available=getAJAXcontent(HTTPS_WSPATH + "/hotel-booking-availability1.php?hrt="+hot_room_type+"&hnr="+hot_no_rooms+"&bdate="+hot_book_dates);
	var raArray=room_available.split(":;");
	if(raArray[0]=="0"){
		alert(raArray[2]+" rooms available for the date "+raArray[1]);
		dt.hot_no_rooms.focus();
		dt.hot_no_rooms.select();
		return false;
	}
	if(trim(dt.user_first_name.value)==''){
		alert(PLEASE_ENTER+"first name.");
		dt.user_first_name.focus();
		return false;
	}
	if(trim(dt.user_last_name.value)==''){
		alert(PLEASE_ENTER+"last name.");
		dt.user_last_name.focus();
		return false;
	}
	if(trim(dt.user_email_address.value)==''){
		alert(PLEASE_ENTER+"email.");
		dt.user_email_address.focus();
		return false;
	}else{
		if(!validString(trim(dt.user_email_address.value),'email')){
			alert("Please enter valid email.");
			dt.user_email_address.focus();
			dt.user_email_address.select();
			return false;
		}
	}
	if(trim(dt.user_mobile.value)==''){
		alert(PLEASE_ENTER+"mobile.");
		dt.user_mobile.focus();
		return false;
	}
	if(trim(dt.hot_home_address.value)==''){
		alert(PLEASE_ENTER+"home address.");
		dt.hot_home_address.focus();
		return false;
	}
	if(trim(dt.hot_postcode.value)==''){
		alert(PLEASE_ENTER+"post code.");
		dt.hot_postcode.focus();
		return false;
	}
	if(trim(dt.hot_holder_name.value)==''){
		alert(PLEASE_ENTER+"name printed on card.");
		dt.hot_holder_name.focus();
		return false;
	}
	if(trim(dt.hot_card_type.value)==2){
		if(trim(dt.hot_issue_number.value)==''){
			alert(PLEASE_ENTER+"issue number.");
			dt.hot_issue_number.focus();
			return false;
		}	
	}
	if(trim(dt.hot_card_number.value)==''){
		alert(PLEASE_ENTER+"card number.");
		dt.hot_card_number.focus();
		return false;
	}
	else if(isNaN(trim(dt.hot_card_number.value))){
		alert(PLEASE_ENTER+"a numeric value for card number.");
		dt.hot_card_number.focus();
		dt.hot_card_number.select();
		return false;
	}
	else if((dt.hot_card_number.value).length<16){
		alert(PLEASE_ENTER+"a 16 digit numeric value for card number.");
		dt.hot_card_number.focus();
		dt.hot_card_number.select();
		return false;
	}
	today = new Date();
	var crMon=eval(today.getMonth()+1);
 	var crYer=today.getFullYear();
 	var crDay=today.getDate();

	if(crYer==trim(dt.hot_srt_year.value) && trim(dt.hot_srt_mon.value)>=crMon){	
		alert("Your card is not valid, select valid start date.");
		return false;
	}
	if(crYer==trim(dt.hot_exp_year.value) && trim(dt.hot_exp_mon.value)<=crMon){	
		alert("Your card is not valid, select valid expiration date.");
		return false;
	}
	if(trim(dt.hot_sec_code.value)==''){
		alert(PLEASE_ENTER+"card security code.");
		dt.hot_sec_code.focus();
		return false;
	}
	else if(isNaN(trim(dt.hot_sec_code.value))){
		alert(PLEASE_ENTER+"a numeric value for card security code.");
		dt.hot_sec_code.focus();
		dt.hot_sec_code.select();
		return false;
	}
	submitStr="submitAction=ResBook"+"&user_first_name="+trim(dt.user_first_name.value)+"&user_last_name="+trim(dt.user_last_name.value)+"&user_email_address="+trim(dt.user_email_address.value)+"&user_mobile="+trim(dt.user_mobile.value)+"&hot_home_address="+trim(dt.hot_home_address.value)+"&hot_postcode="+trim(dt.hot_postcode.value)+"&hot_book_dates="+hot_book_dates+"&hot_room_type="+hot_room_type+"&hot_no_heads="+hot_no_heads+"&hot_no_rooms="+hot_no_rooms+"&hot_book_summery="+trim(dt.hot_book_summery.value)+"&hot_arrive_time1="+trim(dt.hot_arrive_time1.value)+"&hot_arrive_time2="+trim(dt.hot_arrive_time2.value)+"&hot_arrive_time3="+trim(dt.hot_arrive_time3.value)+"&hot_detart_time1="+trim(dt.hot_detart_time1.value)+"&hot_detart_time2="+trim(dt.hot_detart_time2.value)+"&hot_detart_time3="+trim(dt.hot_detart_time3.value)+"&hot_holder_name="+trim(dt.hot_holder_name.value)+"&hot_card_type="+trim(dt.hot_card_type.value)+"&hot_issue_number="+trim(dt.hot_issue_number.value)+"&hot_card_number="+trim(dt.hot_card_number.value)+"&hot_srt_mon="+trim(dt.hot_srt_mon.value)+"&hot_srt_year="+trim(dt.hot_srt_year.value)+"&hot_exp_mon="+trim(dt.hot_exp_mon.value)+"&hot_exp_year="+trim(dt.hot_exp_year.value)+"&hot_sec_code="+trim(dt.hot_sec_code.value)+"&hot_book_id="+hot_book_id;
	var editVal=postAjaxContent(HTTPS_WSPATH + "/hot_book_details_post.php",submitStr,"frm_hot_input","frm_hot_input");
	alert("You want to book hotel for "+hot_no_heads+" guest(s)");
	openPage('hotel-booking-confirm.php?hot_book_id='+hot_book_id,'785','531');
	return false;
}
function hotbookConfirmValid(hot_book_id,grTot)
{
	insertVal=getAJAXcontent(HTTPS_WSPATH + "/hotel_booking_confirm_post.php?hot_book_id="+hot_book_id+"&grTot="+grTot);
	alert("Your total booking charge is : "+grTot);
	openPage('hotel-booking-final.php?hot_book_id='+hot_book_id,'785','531');
}
function contactusValid()
{
	var dt=document.frm_contact_us;
	if(trim(dt.visitor_name.value)==''){
		alert(PLEASE_ENTER+"name.");
		dt.visitor_name.focus();
		return false;
	}
	if(trim(dt.visitor_email.value)==''){
		alert(PLEASE_ENTER+"email.");
		dt.visitor_email.focus();
		return false;
	}else{
		if(!validString(trim(dt.visitor_email.value),'email')){
			alert("Please enter valid email.");
			dt.visitor_email.focus();
			dt.visitor_email.select();
			return false;
		}
	}
	if(trim(dt.visitor_message.value)==''){
		alert(PLEASE_ENTER+"enquiry.");
		dt.visitor_message.focus();
		return false;
	}
	if(trim(dt.generated_code.value)==''){
		alert(PLEASE_ENTER+"code shown.");
		dt.generated_code.focus();
		return false;
	}
	else if(!validCaptch(trim(dt.generated_code.value),trim(dt.pre_generated_code.value)))
	{
		alert("Please enter the security code correctly.");
		dt.generated_code.focus();
		dt.generated_code.select();
		return false;
	}
	submitStr="submitAction=Contactus"+"&visitor_name="+trim(dt.visitor_name.value)+"&visitor_email="+trim(dt.visitor_email.value)+"&visitor_message="+trim(dt.visitor_message.value);
	var insVal=postAjaxContent(WSPATH + "/contact_us_post.php",submitStr,"frm_con_success","frm_con_input");
	return false;
}
function newsLetterValid()
{
	var dt=document.frm_news_letter;
	if(trim(dt.nwl_uname.value)==''){
		alert(PLEASE_ENTER+"name.");
		dt.nwl_uname.focus();
		return false;
	}
	if(trim(dt.nwl_uemail.value)==''){
		alert(PLEASE_ENTER+"email.");
		dt.nwl_uemail.focus();
		return false;
	}else{
		if(!validString(trim(dt.nwl_uemail.value),'email')){
			alert("Please enter valid email.");
			dt.nwl_uemail.focus();
			dt.nwl_uemail.select();
			return false;
		}
	}
	if(trim(dt.nwl_uphone.value)==''){
		alert(PLEASE_ENTER+"town.");
		dt.nwl_uphone.focus();
		return false;
	}
	if(trim(dt.nwl_umobile.value)==''){
		alert(PLEASE_ENTER+"mobile number.");
		dt.nwl_umobile.focus();
		return false;
	}
	if(trim(dt.generated_code.value)==''){
		alert(PLEASE_ENTER+"code shown.");
		dt.generated_code.focus();
		return false;
	}
	else if(!validCaptch(trim(dt.generated_code.value),trim(dt.pre_generated_code.value)))
	{
		alert("Please enter the security code correctly.");
		dt.generated_code.focus();
		dt.generated_code.select();
		return false;
	}
	if(uniqueNwlUser(trim(dt.nwl_uemail.value)))
	{
		alert("Email already exists.");
		return false;
	}
	submitStr="submitAction=Newsletter"+"&nwl_uname="+trim(dt.nwl_uname.value)+"&nwl_uemail="+trim(dt.nwl_uemail.value)+"&nwl_uphone="+trim(dt.nwl_uphone.value)+"&nwl_umobile="+trim(dt.nwl_umobile.value);
	var insVal=postAjaxContent(WSPATH + "/newsletter_post.php",submitStr,"frm_nwl_success","frm_nwl_input");
	return false;
}
function validCaptch(ccode,pccode)
{
	var captchacode=getAJAXcontent(WSPATH + "/captcha_validate.php?ccode="+ccode+"&pccode="+pccode);
	return (captchacode=="1"?true:false);
}
function uniqueNwlUser(email)
{
	unique_email=getAJAXcontent(WSPATH + "/unique_email.php?email="+email);
	return (unique_email=="1"?true:false);
}

function nextTermHotBook(){
	if(document.frm_hotel_booking_term.accept_terms_hotel.checked)
		openPage('hotel-booking.php','501','472');
	else{
		alert("You have to accept hotel terms and conditions.");
		return false;
	}	
}
function nextTermResBook(){
	if(document.frm_restaurant_booking_term.accept_terms_restaurant.checked)
		openPage('restaurant-booking.php','501','472');
	else{
		alert("You have to accept restaurant terms and conditions.");
		return false;
	}	
}
function showdetailBooking(tabname,tabid)
{
	var max_tbl=document.getElementById("max_tbl").value;	
	for(k=1;k<=max_tbl;k++){
		if(document.getElementById(tabname+"_"+k))
			document.getElementById(tabname+"_"+k).style.display=(k==tabid?'block':'none');
	}			
}
function nextTermTikBook(){
	if(document.frm_ticket_booking_term.accept_terms_ticket.checked)
		openPage('ticket-booking.php','785','529');
	else{
		alert("You have to accept ticket terms and conditions.");
		return false;
	}	
}

function tikbookValid(tik_book_id)
{
	var dt=document.frm_tbk_cc_detail;
	if(trim(dt.user_first_name.value)==''){
		alert(PLEASE_ENTER+"first name.");
		dt.user_first_name.focus();
		return false;
	}
	if(trim(dt.user_last_name.value)==''){
		alert(PLEASE_ENTER+"last name.");
		dt.user_last_name.focus();
		return false;
	}
	if(trim(dt.user_email_address.value)==''){
		alert(PLEASE_ENTER+"email.");
		dt.user_email_address.focus();
		return false;
	}else{
		if(!validString(trim(dt.user_email_address.value),'email')){
			alert("Invalid email.");
			dt.user_email_address.focus();
			dt.user_email_address.select();
			return false;
		}
	}
	if(trim(dt.user_mobile.value)==''){
		alert(PLEASE_ENTER+"mobile.");
		dt.user_mobile.focus();
		return false;
	}
	if(trim(dt.tik_home_address.value)==''){
		alert(PLEASE_ENTER+"home address.");
		dt.tik_home_address.focus();
		return false;
	}
	if(trim(dt.tik_postcode.value)==''){
		alert(PLEASE_ENTER+"post code.");
		dt.tik_postcode.focus();
		return false;
	}
	var tik_no_heads=trim(dt.tik_no_heads.value);
	if(tik_no_heads==''){
		alert(PLEASE_ENTER+"number of guest(s).");
		dt.tik_no_heads.focus();
		return false;
	}
	else if(!isInt(tik_no_heads)){
		alert(PLEASE_ENTER+"a numeric value for number of guest(s).");
		dt.tik_no_heads.focus();
		dt.tik_no_heads.select();
		return false;
	}
	else if(tik_no_heads==0){
		alert(PLEASE_ENTER+"a non zero numeric value for number of guest(s).");
		dt.tik_no_heads.focus();
		dt.tik_no_heads.select();
		return false;
	}

	var limit_val=eval(dt.limit_val.value);
	var remain_booking=eval(dt.remain_booking.value);
	if(tik_no_heads > remain_booking){
		alert("Booking remains for "+remain_booking+" guest(s).");
		dt.tik_no_heads.focus();
		dt.tik_no_heads.select();
		return false;
	}
	submitStr="submitAction=TikBook"+"&user_first_name="+trim(dt.user_first_name.value)+"&user_last_name="+trim(dt.user_last_name.value)+"&user_email_address="+trim(dt.user_email_address.value)+"&user_mobile="+trim(dt.user_mobile.value)+"&tik_home_address="+trim(dt.tik_home_address.value)+"&tik_postcode="+trim(dt.tik_postcode.value)+"&tik_no_heads="+trim(dt.tik_no_heads.value)+"&tik_book_id="+tik_book_id;
	var editVal=postAjaxContent(HTTPS_WSPATH + "/tik_book_details_post.php",submitStr,"frm_tik_input","frm_tik_input");
	alert("You want to book ticket for "+tik_no_heads+" guest(s).");
	openPage('ticket-booking-confirm.php?tik_book_id='+tik_book_id,'785','531');
	return editVal;
	
}
function tikbookConfirmValid(tik_book_id,grandtotal)
{
	alert("Your total booking charge is : "+grandtotal);
	YAHOO.com.thecodecentral.dialog3.hide();
	window.location.href='ticket-booking-confirm-post.php?v='+tik_book_id;
}