function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}


function isEmail(aStr)
	{
		var reEmail=/^[0-9a-zA-Z_\.-]+\@[0-9a-zA-Z_\.-]+\.[0-9a-zA-Z_\.-]+$/;
		if(!reEmail.test(aStr))
		{
			return false;
		}
		return true;
	}


function verifyLogin()
	{

		if(trim(document.frm_login.txt_login_email.value).length==0)
			{
				alert("Please enter E-mail Address");
				document.frm_login.txt_login_email.focus();
				return false;
			}

		if(!isEmail(document.frm_login.txt_login_email.value))
			{
				alert("Please enter valid E-mail Address");
				document.frm_login.txt_login_email.focus();
				return false;
			
			}

		if(trim(document.frm_login.txt_login_password.value).length==0)
			{
				alert("Please enter Password");
				document.frm_login.txt_login_password.focus();
				return false;
			}


		return true;
	}

function verifyRegistrationForm()
	{

		if(trim(document.frm_registration.txt_first_name.value).length==0)
			{
				alert("Please enter First Name");
				document.frm_registration.txt_first_name.focus();
				return false;
			}


		if(trim(document.frm_registration.txt_last_name.value).length==0)
			{
				alert("Please enter Last Name");
				document.frm_registration.txt_last_name.focus();
				return false;
			}


		if(trim(document.frm_registration.txt_address1.value).length==0)
			{
				alert("Please enter Street Address1");
				document.frm_registration.txt_address1.focus();
				return false;
			}

		if(trim(document.frm_registration.txt_city.value).length==0)
			{
				alert("Please enter City");
				document.frm_registration.txt_city.focus();
				return false;
			}



		if(trim(document.frm_registration.cmb_state.value).length==0)
			{
				alert("Please select State");
				document.frm_registration.cmb_state.focus();
				return false;
			}


	if(trim(document.frm_registration.txt_zipcode.value).length==0)
			{
				alert("Please enter Zip/Postal Code");
				document.frm_registration.txt_zipcode.focus();
				return false;
			}



		if(isNaN(trim(document.frm_registration.txt_zipcode.value)))
			{
				alert("Please enter valid Zip/Postal Code");
				document.frm_registration.txt_zipcode.focus();
				return false;
			}


		if(trim(document.frm_registration.txt_zipcode.value).length!=5)
			{
				alert("Please enter valid Zip/Postal Code");
				document.frm_registration.txt_zipcode.focus();
				return false;
			}



		if(trim(document.frm_registration.txt_phone.value).length==0)
			{
				alert("Please enter Phone");
				document.frm_registration.txt_phone.focus();
				return false;
			}


		if(trim(document.frm_registration.txt_email.value).length==0)
			{
				alert("Please enter E-mail Address");
				document.frm_registration.txt_email.focus();
				return false;
			}


		if(!isEmail(trim(document.frm_registration.txt_email.value)))
			{
					alert("Please enter valid Email Address");
					document.frm_registration.txt_email.focus();
					return false;
			}


			return true;
	}




	function verifyForgotPasswordForm()
		{

		if(trim(document.frm_forgotpassword.txt_email.value).length==0)
			{
				alert("Please enter E-mail Address");
				document.frm_forgotpassword.txt_email.focus();
				return false;
			}


		if(!isEmail(trim(document.frm_forgotpassword.txt_email.value)))
			{
					alert("Please enter valid Email Address");
					document.frm_forgotpassword.txt_email.focus();
					return false;
			}

			return true;

		}