function Isalpha(strCharacter)
   //  check for valid numeric strings 
   {
   var strValidAlpha = "ABCDEFGHIJKLMNOPQRSTWXYZ.abcdefghijklmnopqrstuvwxyz .-";
   var strAlpha;
   var blnResult = true;
   if (strCharacter.length == 0) return false;
   //  test strString consists of valid characters listed above
   for (i = 0; i < strCharacter.length && blnResult == true; i++)
      {
      strAlpha = strCharacter.charAt(i);
      if (strValidAlpha.indexOf(strAlpha) == -1)
         {
         blnResult = false;
        }
      }
   return blnResult;
   }

function IsNumeric(strString)
   //  check for valid numeric strings 
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;
   if (strString.length == 0) return false;
   //  test strString consists of valid characters listed above
  for (i = 0; i < strString.length && blnResult == true; i++)
     {
      strChar = strString.charAt(i);
     if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function Email(str)
		{
			var supported = 0;
			if (window.RegExp)
			{
			var tStr = "a";
			var tReg = new RegExp(tStr);
			if (tReg.test(tStr)) supported = 1;
			}
			if (!supported)
			return (str.indexOf(".") <= 5) || (str.indexOf("@") < 0);
			var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
			var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			return (r1.test(str) || !r2.test(str));
		}

function user_login()
{	
 	if (Email(document.frm_login.user_id.value))
	{
		alert("Please enter your Email Id");
		document.frm_login.user_id.focus();
		document.frm_login.user_id.select();
		return false;
	}	
  	if (document.frm_login.password.value==0)
	{
		alert("Please enter your Correct Password");
		document.frm_login.password.focus();
		document.frm_login.password.select();
		return false;
	}		
 	document.frm_login.submit();
}	

function changepwd1()
{		
	if(document.frmchangepwd.old_password.value==0)
	{ 
	alert('Please enter your old password.');
	document.frmchangepwd.old_password.focus();
	document.frmchangepwd.old_password.select();
	return false;
	}
	if(document.frmchangepwd.password.value==0)
	{ 
	alert('Please enter your new password.');
	document.frmchangepwd.password.focus();
	document.frmchangepwd.password.select();
	return false;
	}

	if (document.frmchangepwd.confirm_password.value==0)
	{
	alert("Please enter confirm Password");
	document.frmchangepwd.confirm_password.focus();
	document.frmchangepwd.confirm_password.select();
	return false;
	}

	if ((document.frmchangepwd.password.value) != (document.frmchangepwd.confirm_password.value))
   {
	alert("Password mismatch retype your password");
	document.frmchangepwd.confirm_password.focus();
	document.frmchangepwd.confirm_password.select();
	return false;
	}

	if(document.frmchangepwd.password.value.length < 6)

	{ 

	alert('Password should be 6 characters Long.!');

	document.frmchangepwd.password.focus();

	document.frmchangepwd.password.select();

	return false;

	}	

	document.frmchangepwd.submit();

}		



function addbus()

{		

 	if (document.busi_frm.business_name.value==0)

	{

		alert("Please enter your Business Name");

		document.busi_frm.business_name.focus();

		document.busi_frm.business_name.select();

		return false;

	}

 	if (document.busi_frm.first_name.value==0)

	{

		alert("Please enter your First Name");

		document.busi_frm.first_name.focus();

		document.busi_frm.first_name.select();

		return false;

	}	

	if (Email(document.busi_frm.user_id.value))

	{

	alert("Please enter valid Email Id");

	document.busi_frm.user_id.focus();

	document.busi_frm.user_id.select();

	return false;

	}

	if (document.busi_frm.address1.value==0)

	{

		alert("Please enter your Address");

		document.busi_frm.address1.focus();

		document.busi_frm.address1.select();

		return false;

	}

	

	if (document.busi_frm.address2.value==0)

	{

		alert("Please enter your Address");

		document.busi_frm.address2.focus();

		document.busi_frm.address2.select();

		return false;

	}

	if (document.busi_frm.area.value==0)

	{

		alert("Please enter your Area");

		document.busi_frm.area.focus();

		document.busi_frm.area.select();

		return false;

	}

	if (IsNumeric(document.busi_frm.pincode.value)==false)

		{

		alert("Please enter your Pincode");

		document.busi_frm.pincode.focus();

		document.busi_frm.pincode.select();

		return false;

	}

	

	if (IsNumeric(document.busi_frm.phone.value)==false)

		{

		alert("Please enter your Phone Number");

		document.busi_frm.phone.focus();

		document.busi_frm.phone.select();

		return false;

	}

	if (IsNumeric(document.busi_frm.mobile.value)==false)

		{

		alert("Please enter your Mobile Number");

		document.busi_frm.mobile.focus();

		document.busi_frm.mobile.select();

		return false;

	}					

	document.busi_frm.submit();

}



 

 





function login_form()
{	
 
 	if (document.frm_login.user_id.value==0)
	{
		alert("Please enter your Login Id");
		document.frm_login.user_id.focus();
		document.frm_login.user_id.select();
		return false;
	}
 	if (document.frm_login.password.value==0)
	{
		alert("Please enter your correct password");
		document.frm_login.password.focus();
		document.frm_login.password.select();
		return false;
	}	
	
	document.frm_login.submit();
}
