var PLEASE_ENTER="Please enter ";
var prefix = window.parent.document.location.protocol + '//';
var WSPATH=prefix+"www.atlantisportrush.com";
var HTTPS_WSPATH=prefix+"www.atlantisportrush.com";
var loadImg = '<img src="images/PageLoading.gif" border="0" />';


function showBookDiv(divids,listid)
{
	
	document.getElementById("restaurant").className = "make_bedroom";
	document.getElementById("events").className = "make_bedroom";

	var valu="";
	$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + '/bedrooms.php?val='+valu,
			dataType: 'JSON',
			//data: $("#galfrm").serialize(),
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					
					if(document.getElementById("bedRoomdatePickerDivID")){
							bedRoomrefreshDatePicker("bedrdtpick","bedRoomdatePickerDivID");
						}	
					return false;
				}
				return false;
			}
		});
}	


function showBookRest(divids,listid)
{
	
	document.getElementById("bedrooms").className 	= "make_bedroom";
	document.getElementById("events").className 	= "make_bedroom";

	var valu="";
	$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + '/restaurant.php?val='+valu,
			dataType: 'JSON',
			//data: $("#galfrm").serialize(),
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					
					if(document.getElementById("restdatePickerDivID")){
							restDatePicker("restdtpick","restdatePickerDivID");
						}	
					return false;
				}
				return false;
			}
		});
}

function showBookEvents(divids,listid)
{

	document.getElementById("bedrooms").className 	= "make_bedroom";
	document.getElementById("restaurant").className = "make_bedroom";

	var valu="";
	$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + '/events.php?val='+valu,
			dataType: 'JSON',
			//data: $("#galfrm").serialize(),
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				//alert(data);
				//return false;
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					
					if(document.getElementById("eventsdatePickerDivID")){
							eventsDatePicker("eventsdtpick","eventsdatePickerDivID");
						}	
					return false;
				}
				return false;
			}
		});
}


function showTicketBookFinal(ticketId,divids,listid)
{
	var valu="";
	$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + '/ticket_booking_final.php?tik_book_id='+ticketId,
			dataType: 'JSON',
			//data: $("#galfrm").serialize(),
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				//alert(data);
				//return false;
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					
					if(document.getElementById("eventsdatePickerDivID")){
							eventsDatePicker("eventsdtpick","eventsdatePickerDivID");
						}	
					return false;
				}
				return false;
			}
		});
}

function openBedroomDetail(bookid,divids,listid)
{
	var hot_book_id = bookid;
		
		$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/bedroom_booking_details.php?hot_book_id="+hot_book_id,
			dataType: 'JSON',
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					return false;
				}
				return false;
			}
		});
}

function openRestDetail(bookid,divids,listid)
{
	var res_book_id = bookid;
		
		$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/restaurant_booking_details.php?res_book_id="+res_book_id,
			dataType: 'JSON',
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					return false;
				}
				return false;
			}
		});
}


function openEventsDetail(bookid,divids,listid)
{
	var tik_book_id = bookid;
		
		$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/ticket_booking_details.php?tik_book_id="+tik_book_id,
			dataType: 'JSON',
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					return false;
				}
				return false;
			}
		});
}

function showNextBook(divids,listid)
{
	var dt=document.checkavailability;
	var hot_room_type	= trim(dt.hot_room_type.value);
	var hot_no_adults 	= trim(dt.hot_no_heads.value);
	var hot_no_child 	= trim(dt.hot_no_heads1.value);
	var hot_no_heads	= eval(parseInt(hot_no_adults) + parseInt(hot_no_child));
	var hot_no_rooms	= trim(dt.hot_no_rooms.value);
	var hot_book_dates	= trim(dt.hot_book_dates.value);
	var bookDArray=document.getElementById('bookDArray').value;

	if(hot_no_adults == '0' && hot_no_child == '0')
	{
		alert("You are not allowed to book "+hot_no_adults+" guest(s) in "+hot_no_rooms+" rooms");	
		dt.hot_no_heads.focus();
		dt.hot_no_heads.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(bookDArray!=''){
	
		document.getElementById('disableDates').value 	= "";
		document.getElementById('bookedDates').value 	= "";
		document.getElementById('hot_book_dates').value = "";
		$('#bedroomId').html(loadImg);
		
		var valu="";
		$.ajax({
			type: 'POST',
			url: 'bedroom_booking_details.php?val='+valu,
			dataType: 'JSON',
			data: $("#checkavailability").serialize(),
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					return false;
				}
				return false;
			}
		});
	}else{
		alert("Please select the date(s) you want to book for hotel.");
		return false;
	}	
}

function nextRestBook(divids,listid)
{
	var dt			= document.checkavailability;
	var bookDArray	= document.getElementById('bookDArray').value;
	var limit_val	= document.getElementById('limit_val').value;
	var res_no_heads 	= trim(dt.res_no_heads.value);
	var res_no_child 	= trim(dt.res_no_heads1.value);
	var res_no_heads	= eval(parseInt(res_no_heads) + parseInt(res_no_child));
	
	
	booked=getAJAXcontent(HTTPS_WSPATH + "/restaurant-booking-availability.php?bdate="+bookDArray);

	if(dt.res_no_heads.value == '0' && dt.res_no_heads1.value == '0')
	{
		alert("You are not allowed to book "+res_no_heads+" guest(s)");	
		dt.res_no_heads.focus();
		dt.res_no_heads.select();
		return false;
	}

	if(bookDArray!=''){	
		if(eval(booked)<eval(limit_val)){
			alert("Booking remains for "+eval(limit_val-booked)+" guest(s).");
			$('#restaurantC').html(loadImg);
			
			document.getElementById('disableDates').value 	= "";
			document.getElementById('bookedDates').value 	= "";

			var valu="";
			$.ajax({
				type: 'POST',
				url: 'restaurant_booking_details.php?val='+valu,
				dataType: 'JSON',
				data: $("#checkavailability").serialize(),
				beforeSend: function() {
					//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
				},
				complete: function() {
					$('.attention').remove();
				},
				error: function() {
					alert('failed');
				},
				success: function(data) {
					if(data)
					{
						$('#'+divids).html(data);
						$('#'+listid).addClass('make_bedroom_act');
						return false;
					}
					return false;
				}
			});
		
		}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 nextEventsBook(divids,listid,eventId)
{

	$('#eventsC').html(loadImg);
	$.ajax({
		type: 'POST',
		url: 'ticket_booking_details.php?eid='+eventId,
		dataType: 'JSON',
		//data: $("#checkavailability").serialize(),
		beforeSend: function() {
			//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
		},
		complete: function() {
			$('.attention').remove();
		},
		error: function() {
			alert('failed');
		},
		success: function(data) {
			if(data)
			{
				$('#'+divids).html(data);
				$('#'+listid).addClass('make_bedroom_act');
				return false;
			}
			return false;
		}
	});
}

function ShowOffers(offerId)
{
	$.ajax({
	type: 'POST',
	url: 'special_offer_post.php?offerId='+offerId,
	dataType: 'JSON',
	//data: $("#checkavailability").serialize(),
	beforeSend: function() {
		$('#SpecialOffer').html('<img src="images/PageLoading.gif" alt="" />');
	},
	complete: function() {
		$('.attention').remove();
	},
	error: function() {
		alert('failed');
	},
	success: function(data) {
		if(data)
		{
			$('#SpecialOffer').html(data);
			return false;
		}
		return false;
	}
});
}
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 changeRoomDeailn(id)
{
	var slctroom=document.getElementById("selectroom").value;
	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;
}
function sethtVal(bookDt)
{
	var curtd_id="dtcalid_"+bookDt;
	
	var selectarray='';
	var alrdySelectArray=document.getElementById('bookDArray').value;
	//alert(alrdySelectArray);
	
	if(checkValidDate(bookDt))	
	{
		if(alrdySelectArray==''){
			document.getElementById('bookDArray').value=bookDt;
			document.getElementById(curtd_id).className="today_boxhighLtd";
		}
		else
		{
			var tableEveArray=alrdySelectArray.split(",");
			if(in_array(bookDt,tableEveArray))
			{
				for(var c=0;c<tableEveArray.length;c++){
					if(bookDt==tableEveArray[c]){
						document.getElementById(curtd_id).className="week_of_day1";
					}else{
						if(selectarray!='') selectarray+=",";
						selectarray+=tableEveArray[c];
					}	
				}
				document.getElementById('bookDArray').value=selectarray;
			}else{
				document.getElementById('bookDArray').value=alrdySelectArray+","+bookDt;
				document.getElementById(curtd_id).className="today_boxhighLtd";
			}
		}
	}
	else
	{
		alert("You can't place booking for expired dates.");
	}
}

function setrestVal(bookDt,dayNum)
{
	var curtd_id="dtcalid_"+dayNum;
	var olddatecolor=document.getElementById('dtId').value;
	var selDateVal=document.getElementById('bookDArray').value;

	if(checkValidDate(bookDt))	
	{	
		if(olddatecolor!='0')
			document.getElementById(olddatecolor).className="number_txt1";
	
		document.getElementById(curtd_id).className="today_boxhighLtd";
	
		document.getElementById('dtId').value=curtd_id;
		document.getElementById('bookDArray').value=bookDt;
	}else{
		alert("You can't place booking for expired dates.");
	}
}

function showBookDivn(divids,listid)
{
	document.getElementById(divids).style.display="block";
	document.getElementById(listid).className = 'make_bedroom_act';
	
	if(document.getElementById("bedRoomdatePickerDivID")){
			bedRoomrefreshDatePicker("bedrdtpick","bedRoomdatePickerDivID");
		}	
	
	//document.getElementById("charge_"+slctroom).style.display="none";	
}

function hotbookValidate(bookId)
{
	
	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;
	}
	
		$('#bedRoomD').html(loadImg);
		
		$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/hot_book_details_post.php?frm_hot_input=frm_hot_input&submitAction=ResBook",
			dataType: 'JSON',
			data: $("#frm_hot_cc_detail").serialize(),
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data == 1)
				{
					alert("You want to book hotel for "+hot_no_heads+" guest(s)");
					openpageCNF('bedroom_booking_confirm.php',bookId,'bedroomsDiv','bedrooms');
					return false;
				}
				return false;
			}
		});
	
	
	//openPage('hotel-booking-confirm.php?hot_book_id='+hot_book_id,'785','531');
	return false;

}

function openpageCNF(pageNm,ids,divids,listid)
{
		var pageOpen = pageNm;
		var hot_book_id = ids;
		
		$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/"+pageOpen+"?hot_book_id="+hot_book_id,
			dataType: 'JSON',
			data: $("#frm_hot_cc_detail").serialize(),
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					return false;
				}
				return false;
			}
		});
}

function bedroomConfirmValid(hot_book_id,grTot,divids,listid)
{
	$('#bedRoomC').html(loadImg);
	insertVal=getAJAXcontent(HTTPS_WSPATH + "/bedroom_booking_confirm_post.php?hot_book_id="+hot_book_id+"&grTot="+grTot);
	alert("Your total booking charge is : "+grTot);
	
	$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/bedroom_booking_final.php?hot_book_id="+hot_book_id,
			dataType: 'JSON',
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					return false;
				}
				return false;
			}
		});
}

function resbookValidate(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;
	}
	
	$('#restBookD').html(loadImg);
	$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/res_book_details_post.php?frm_res_input=frm_res_input&submitAction=ResBook",
			dataType: 'JSON',
			data: $("#frm_rbk_cc_detail").serialize(),
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data == 1)
				{
					alert("You want to book restaurant for "+res_no_heads+" guest(s)");
					openresCNF('restaurant_booking_confirm.php',res_book_id,'bedroomsDiv','restaurant');
					return false;
				}
				return false;
			}
		});
	return false;	
}

function tikbookValidate(tkt_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;
	}
	
	$('#ticketD').html(loadImg);
	$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/tik_book_details_post.php?frm_res_input=frm_res_input&submitAction=TikBook",
			dataType: 'JSON',
			data: $("#frm_tbk_cc_detail").serialize(),
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				//alert(data);
				if(data == 1)
				{
					alert("You want to book ticket for "+tik_no_heads+" guest(s).");
					openeventsCNF('ticket_booking_confirm.php',tkt_book_id,'bedroomsDiv','events');
					return false;
				}
				return false;
			}
		});
	return false;	
	
}

function openeventsCNF(pageNm,ids,divids,listid)
{
		var pageOpen = pageNm;
		var tkt_book_id = ids;
		
		$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/"+pageOpen+"?tik_book_id="+tkt_book_id,
			dataType: 'JSON',
			//data: $("#frm_hot_cc_detail").serialize(),
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					return false;
				}
				return false;
			}
		});
}


function openresCNF(pageNm,ids,divids,listid)
{
		var pageOpen = pageNm;
		var res_book_id = ids;
		
		$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/"+pageOpen+"?res_book_id="+res_book_id,
			dataType: 'JSON',
			//data: $("#frm_hot_cc_detail").serialize(),
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					return false;
				}
				return false;
			}
		});
}


function resbookConfirmValidate(res_book_id,grandtotal,divids,listid)
{
	$('#restBookConf').html(loadImg);
	insertVal=getAJAXcontent(HTTPS_WSPATH + "/restaurant-booking-confirm-post.php?res_book_id="+res_book_id+"&grandtotal="+grandtotal);
	alert("Your total booking charge is : "+grandtotal);
	
	$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/restaurant_booking_final.php?res_book_id="+res_book_id,
			dataType: 'JSON',
			beforeSend: function() {
				//$('#replacePage').html('<img src="images/loading.gif" alt="" />');
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data)
				{
					$('#'+divids).html(data);
					$('#'+listid).addClass('make_bedroom_act');
					return false;
				}
				return false;
			}
		});
}

function tikbookConfirmValidate(tik_book_id,grandtotal)
{
	$('#ticketCnf').html(loadImg);
	alert("Your total booking charge is : "+grandtotal);
	window.location.href='ticket-booking-confirm-post.php?v='+tik_book_id;
}


function showEveDtl(shTab,prFixName,idsName)
{
	var eveIds=document.getElementById(idsName).value;
	var idArray=eveIds.split(",");
	for(var j=0;j<idArray.length;j++){
		if(document.getElementById(prFixName+idArray[j]))
			document.getElementById(prFixName+idArray[j]).style.display=(idArray[j]==shTab?'block':'none');	
	}	
}

function ShowMap(paddress)
{
	window.open('http://maps.google.com/?q='+paddress,'newWin','scrollbars=1,width=840,height=660,menubar=1,toolbar=1,location=1,status=1,resizable=1,address=1')
}

function contactusValidate()
{
	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.subject.value)==''){
		alert(PLEASE_ENTER+"subject.");
		dt.subject.focus();
		return false;
	}
	if(trim(dt.visitor_message.value)==''){
		alert(PLEASE_ENTER+"enquiry.");
		dt.visitor_message.focus();
		return false;
	}
	
	$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/contact_us_post.php?submitAction=Contactus",
			dataType: 'JSON',
			data: $("#frm_contact_us_id").serialize(),
			beforeSend: function() {
				$('#contactID').html(loadImg);
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data == 1)
				{
					document.getElementById("contactFrm").style.display = 'none';
					document.getElementById("contactSuc").style.display = 'block';
					return false;
				}
				return false;
			}
		});
	return false;
}

function contactusValidate()
{
	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_umobile.value)==''){
		alert(PLEASE_ENTER+"telephone number.");
		dt.nwl_umobile.focus();
		return false;
	}
	if(trim(dt.address.value)==''){
		alert(PLEASE_ENTER+"address.");
		dt.address.focus();
		return false;
	}
	
	if(uniqueNwlUser(trim(dt.nwl_uemail.value)))
	{
		alert("Email already exists.");
		return false;
	}
	
	
	$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/newsletter_post.php?submitAction=Newsletter",
			dataType: 'JSON',
			data: $("#frm_news_letter_id").serialize(),
			beforeSend: function() {
				$('#newsletterID').html(loadImg);
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {
				if(data == 1)
				{
					document.getElementById("newsletterFrm").style.display = 'none';
					document.getElementById("newsletterSuc").style.display = 'block';
					return false;
				}
				return false;
			}
		});
	return false;

}


function showEveMon(shTab,dy)
{
	
		$.ajax({
			type: 'POST',
			url: HTTPS_WSPATH + "/events_selected_post.php?dateSel="+dy,
			dataType: 'JSON',
			//data: $("#frm_news_letter_id").serialize(),
			beforeSend: function() {
				//$('#newsletterID').html(loadImg);
			},
			complete: function() {
				$('.attention').remove();
			},
			error: function() {
				alert('failed');
			},
			success: function(data) {

				if(data != 0)
				{
					$('#selectedDate').html(data);
					return false;
				}
				return false;
			}
		});
	return false;
}
function showEve(shTab,tbId)
{
	var maxEve=document.getElementById("maxEve").value;
	for(var j=1;j<=maxEve;j++){
		if(document.getElementById(shTab+"_"+j))
			document.getElementById(shTab+"_"+j).style.display=(j==tbId?'block':'none');	
	}	
	crNav("eveNav","showEve",shTab,tbId);
}
function showSpe(shTab,tbId)
{
	var maxEve=document.getElementById("maxSpe").value;
	for(var j=1;j<=maxEve;j++){
		if(document.getElementById(shTab+"_"+j))
			document.getElementById(shTab+"_"+j).style.display=(j==tbId?'block':'none');	
	}	
	crNav("speNav","showSpe",shTab,tbId);
}
function crNav(fldName,funName,shTab,tbId)
{
	var naval='';
	var pre=tbId-1;
	var nex=tbId+1;	
	naval='<table width="20%" border="0" cellspacing="0" cellpadding="0">';
        naval+='    <tr>';
        naval+='        <td class="navLink">';
        if(pre>0){
        naval+='	  <a onclick="'+funName+'(\''+shTab+'\','+pre+')" href="javascript:void(0)" title="Previous">Previous</a>'; }else{
	naval+='          &nbsp;';}
	naval+='        </td>';
        naval+='        <td class="navLink">';
        if(document.getElementById(shTab+"_"+nex)){
        naval+='          <a onclick="'+funName+'(\''+shTab+'\','+nex+')" href="javascript:void(0)" title="Next">Next</a>'; }else{ 
        naval+='          &nbsp;';}
	naval+='        </td>';
        naval+='    </tr>';
        naval+='</table>';
        document.getElementById(fldName).innerHTML=naval;
}
