function LTrim(str)
{
	while (str.charAt(0)==' ')
	{
		str=str.substring(1,str.length);
	}
	return str;
}

function RTrim(str)
{
	while (str.charAt(str.length-1)==' ')
	{
		str=str.substring(0,str.length-1);
	}
	return str;
}

function Trim(str)
{
	return RTrim(LTrim(str));
}



function CheckEmail(strMail)
{
     var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
     //var emailReg = "[\\w-_]+((\\.|')[\\w-_]+)*\\@[\\w-_]+(\\.[\\w-_]+){1,5}";
     //var emailReg = "/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i";

     var regex = new RegExp(emailReg);
     var return1;
     return1 = regex.test(strMail.value);
     if (return1==false)
     {alert("Invalid E-mail Address! Please re-enter.")
	 strMail.focus();
	 strMail.select();
	 return false;
		
	 }
     return true;
} 

function validEmail(strEmail)
{
	//var strExpression = /^[a-z][a-z_0-9\.]+@[a-z_0-9\.]+$/i;
	var strExpression = /^[a-z_0-9][-a-z_0-9\.]+@[a-z_0-9\.]+$/i;
	return strExpression.test(strEmail);
}

function isCheck(theForm)
{
	var strName,strMail,strPhone,strInformation,strExpectation;
	strName=theForm.txtname.value;  	
	strMail=theForm.txtemail.value;  		
	strPhone=theForm.txtphone.value;
	strInformation=theForm.txtDemand.value;
	strExpectation=theForm.txtExpectaction.value;
	
	
	if(strName.length<=0)
	{
		alert("Name can not be blank!!!")
		theForm.txtname.focus();  
		return false;
	}
	if (strMail != "undefined")
	{
		if (validEmail(strMail) == false)
		{	
			alert("Please Enter Valid E-Mail Address");
			theForm.txtemail.focus();
			return false;
		}	
	}
	else
	{
		alert("Email can not be blank!!!")
		theForm.txtemail.focus();  
		return false;
	}
	
	
	if(strPhone.length<=0)
	{
		alert("Phone Number can not be blank!!!")
		theForm.txtphone.focus();  
		return false;
	}
	
	
	if(strInformation.length<=0)
	{
	    alert("Your Demand Can not be blank!!!")
		theForm.txtDemand.focus();  
		return false;
	}
	
	if(strExpectation.length<=0)
	{
	    alert("Your Expectation Can not be blank!!!")
		theForm.txtExpectaction.focus();  
		return false;
	}
	
/*
	if(cboRoomType.options(0).selected==true)
	{
		alert("Test")
	}	
*/

}
