
function validateForm()
{
	
	// Name - 5 characters
	var empName = trim(document.frmEmployer.txtEmpName.value);
	if((empName.length) < 5)
	{
		alert("Please enter a valid Institute/Bank name.\nBank name cannot have less than 5 characters.");
		document.frmEmployer.txtEmpName.focus();
		return false;
	}
	//Member Type
	if(document.frmEmployer.cmbUserType.value == 0)
	{
		alert("Please choose FBA Member type.");
		document.frmEmployer.cmbUserType.focus();
		return false;
	}
	
	/*
	//If member is a FBA Member ,make sure that the FBA Number is provided.
	var fbaNo = document.frmEmployer.txtFBANo.value;
	if((document.frmEmployer.cmbUserType.value == 1) && (fbaNo.length <= 5))
	{
		alert("Please provide a valid FBA Number.");
		document.frmEmployer.txtFBANo.focus();
		return false;
	}*/

	//Address1
	var empAddess1 = trim(document.frmEmployer.txtEmpAddress1.value);
	if((empAddess1.length) < 5)
	{
		alert("Please enter a valid Address");
		document.frmEmployer.txtEmpAddress1.focus();
		return false;
	}
	//State
	
	if(document.frmEmployer.cmbState.value == 0)
	{
		alert("Please choose a state.");
		document.frmEmployer.cmbState.focus();
		return false;
	}
	
	//Country
	
	if(document.frmEmployer.cmbCountry.value == 0)
	{
		alert("Please choose a country.");
		document.frmEmployer.cmbCountry.focus();
		return false;
	}

	//Contact Name
	var contactName = trim(document.frmEmployer.txtContactName.value);
	if((contactName.length) < 5)
	{
		alert("Please enter a valid Contact Name");
		document.frmEmployer.txtContactName.focus();
		return false;
	}
	
	//PHONE NUMBER
	
	var phoneNumber = trim(document.frmEmployer.txtContactPhone.value);
	if (phoneNumber.length > 0) 
	{
		if(!check_phonenumber(document.frmEmployer.txtContactPhone))
		{
			document.frmEmployer.txtContactPhone.focus();
			return false;
		}
	}
	//EMail
	var eMail = trim(document.frmEmployer.txtContactEMail.value);
	if((eMail.length) = 0)
	{
		alert("Please enter a valid EMail account");
		document.frmEmployer.txtContactEMail.focus();
		return false;
	}
	//Check for Minimum user name characters
	if (!check_email(eMail))
	{
		alert("Please enter a valid email id.");
		document.frmEmployer.txtContactEMail.focus();
		return false;
	}
	//For Edit
	if (document.frmEmployer.Action.value == 'Edit') 
	{
		if (document.frmEmployer.txtUserName != null)
		{
			if((document.frmEmployer.txtUserName.value.length) < 5)
			{
				alert("Please enter a valid User Name");
				document.frmEmployer.txtUserName.focus();
				return false;
			}	
			if((document.frmEmployer.txtPwd.value.length) < 5)
			{
				alert("Please enter a valid Password");
				document.frmEmployer.txtPwd.focus();
				return false;
			}	
		}
		
	}
	return true;	
	
}

function ChangeUserName(elem)
{
	
	//if ((document.frmEmployer.Action.value == 'Edit') && (document.frmEmployer.cmbUserType.value == 1))
	if ((document.frmEmployer.cmbUserType.value == 1))
	{
		if(document.frmEmployer.txtUserName != null)
		{
			document.frmEmployer.txtUserName.value = elem.value;
		}
	}
}

//For employer default.asp page
function EmpDefaultFormSubmit(w)
{  
     if (w =='AddNew') {
       document.frmAdmin.Mode.value='AddNew';
       document.frmAdmin.action='employer.asp';
       document.frmAdmin.submit();
       } 
      if (w =='Done') {
       document.frmAdmin.Mode.value='Done';
       document.frmAdmin.action='../default.asp';
       document.frmAdmin.submit();
       }    
     } 

