
function strltrim() {
    return this.replace(/^\s+/,'');
}

function strrtrim() {
    return this.replace(/\s+$/,'');
}
function strtrim() {
    return this.replace(/^\s+/,'').replace(/\s+$/,'');
}

String.prototype.ltrim = strltrim;
String.prototype.rtrim = strrtrim;
String.prototype.trim = strtrim;

function checkEmail(emailAdd)
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailAdd.value))
{
return (true)
}
else
alert("Invalid E-mail Address! Please re-enter.")
return (false)
}

function Validate()
{
	var name, address, city, phone, cell, email, room, bed, choice1_1, choice1_2
	var expphonefax=/[^0-9|\s|\+|\-]+/;
	var exppostcode=/[^\w|\s|\+|\-]+/;
		
	nam = document.form1.name.value;
	nam=nam.trim();
	if (nam == "")
	{
		alert("First Name is mandatory...");
		document.form1.name.focus();
		return false;
	}

		if (document.form1.phone.value == "")
	{
		alert("Phone no is mandatory...");
		document.form1.phone.focus();
		return false;
	}
	else
	{
		if(expphonefax.test(document.form1.phone.value)==true)
		{
		alert(" Invalid Phone Number entered .\n The allowed characters are 1 to 9,+,- and spaces.")
		document.form1.phone.focus();
		return false;	
		}
	}
		if (document.form1.s_address.value == "")
	{
		alert("Street Address is mandatory...");
		document.form1.s_address.focus();
		return false;
	}
		if (document.form1.city.value == "")
	{
		alert("City is mandatory...");
		document.form1.city.focus();
		return false;
	}
			if (document.form1.state.value == "")
	{
		alert("State is mandatory...");
		document.form1.state.focus();
		return false;
	}

		if (document.form1.zcode.value == "")
	{
		alert("Zip Code is mandatory...");
		document.form1.zcode.focus();
		return false;
	}
		
	else
	{
		if(expphonefax.test(document.form1.zcode.value)==true)
		{
		alert(" Invalid Zip Code entered .\n The allowed characters are 1 to 9")
		document.form1.zcode.focus();
		return false;	
		}
	}
	
	
	
 }

