function VerifyClient()

{

	if (document.frmlogin.txtClientUsername.value == "" ) 

	{

		alert("Please Enter Username");

		document.frmlogin.txtClientUsername.focus();

		return false;

	}

	if (document.frmlogin.txtClientPassword.value == "" ) 

	{

		alert("Please Enter Password");

		document.frmlogin.txtClientPassword.focus();

		return false;

	}

	document.frmlogin.hidAction.value = "CLIENTLOGIN";

	return true;

}

function VerifyAgent()

{

	

	if (document.frmlogin.txtAgentUsername.value == "" ) 

	{

		alert("Please Enter Username");

		document.frmlogin.txtAgentUsername.focus();

		return false;

	}

	if (document.frmlogin.txtAgentPassword.value == "" ) 

	{

		alert("Please Enter Password");

		document.frmlogin.txtAgentPassword.focus();

		return false;

	}

	document.frmlogin.hidAction.value = "AGENTLOGIN";

	return true;

}



function VerifySearch()

{

	if (document.frmlogin.selLocation.value == "" ) 

	{

		alert("Please Select Loation");

		document.frmlogin.selLocation.focus();

		return false;

	}

	if (document.frmlogin.txtFromDate.value == "")

	{

		alert("Please Enter Check-in Date in mm/dd/yyyy format");

		document.frmlogin.txtFromDate.select();

		document.frmlogin.txtFromDate.focus();

		return false;

	}

	

	if (CheckDate(document.frmlogin.txtFromDate) == false)

	{

		alert("Please Enter Valid Check-in Date in mm/dd/yyyy format");

		document.frmlogin.txtFromDate.select();

		document.frmlogin.txtFromDate.focus();

		return false;	

	}

	if (document.frmlogin.txtToDate.value == "")

	{

		alert("Please Enter Check-out Date in mm/dd/yyyy format");

		document.frmlogin.txtToDate.select();

		document.frmlogin.txtToDate.focus();

		return false;

	}

	if (CheckDate(document.frmlogin.txtToDate) == false)

	{

		alert("Please Enter Valid Check-out Date in mm/dd/yyyy format");

		document.frmlogin.txtToDate.select();

		document.frmlogin.txtToDate.focus();

		return false;	

	}

	if ((document.frmlogin.txtFromDate.value != "") && (document.frmlogin.txtToDate.value != ""))

	{

		if (CompareDates(document.frmlogin.txtFromDate,document.frmlogin.txtToDate) == false)

		{

			return false;	

		}

	}



	document.frmlogin.hidAction.value = "SEARCH";

	document.frmlogin.action = "hotellist.php";

	return true;

}

function ChangeTotalrate(rooms,roomrate,totalrate)

{



	rooms = document.getElementById(rooms).value;

	roomrate = document.getElementById(roomrate).value;	

	document.getElementById(totalrate).value = roomrate*rooms;

	hidRoomType = document.getElementById("hidRoomType").value;

	totalrate = 0;

	totalrooms = 0;

	for (i=0;i<hidRoomType;i++)

	{

		totalratefield = parseInt(document.getElementById("totalrate_" + i).value);

		totalrate = parseInt(totalrate);

		if (totalratefield != 0 )

			totalrate = totalrate + totalratefield;



		totalroomfield = parseInt(document.getElementById("rooms_" + i).value);

		totalrooms = parseInt(totalrooms);

		if (totalroomfield != 0 )

			totalrooms = totalrooms + totalroomfield;

		

	}

	document.getElementById("totalrate").value = totalrate;

	document.getElementById("totalroom").value = totalrooms;

	

	return true;



}

function BookingVerify()

{

	if (document.getElementById("totalroom").value == 0)

	{

		alert("Please select rooms for booking");

		return false;	

	}

	document.frmbooking.action = "confirmbooking.php?ACTION=BOOK";	



}	

function VerifyPayment()

{
   
	if (document.frmbooking.txtCardHolder.value == "")

	{

		alert("Please Enter Card Holder Name");

		document.frmbooking.txtCardHolder.select();

		document.frmbooking.txtCardHolder.focus();

		return false;

	}

	if (document.frmbooking.txtCardType.value == "")

	{

		alert("Please Select Card Type");

		document.frmbooking.txtCardType.focus();

		return false;

	}

	if (document.frmbooking.txtCardNumber.value == "")

	{

		alert("Please Enter Card Number");

		document.frmbooking.txtCardNumber.select();

		document.frmbooking.txtCardNumber.focus();

		return false;

	}

	if (document.frmbooking.txtCardNumber.value == "")

	{

		alert("Please Enter Card Number");

		document.frmbooking.txtExpiryDate.select();

		document.frmbooking.txtExpiryDate.focus();

		return false;

	}

	if (document.frmbooking.txtExpiryDate.value == "")

	{

		alert("Please Enter Expiry Date");

		document.frmbooking.txtExpiryDate.select();

		document.frmbooking.txtExpiryDate.focus();

		return false;

	}

/*	if (CheckDate(document.frmbooking.txtExpiryDate) == false)
	{
		alert("Please Enter Valid Check-out Date in mm/dd/yyyy format");
		document.frmbooking.txtExpiryDate.select();
		document.frmbooking.txtExpiryDate.focus();
		return false;	
	}*/



	document.frmbooking.hidAction.value = "PAY";

}
