//	<------------------------------------   Start of E-Mail Validation  -------------------------------------->
function form_Email()
{
	var regExp_email_Ind = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

	if (!regExp_email_Ind.test(document.prof_add_edit.email.value))
	{
		alert("Please Enter the Valid E-Mail Address!");
		document.prof_add_edit.email.select();
		//document.prof_add_edit.email.focus();
		return false;
	}
}
//	<------------------------------------   End of E-Mail Validation  -------------------------------------->

//	<------------------------------------   Start of User Name Validation  -------------------------------------->
function form_UName()
{
	var regExp_uname_Ind = new RegExp("^[a-zA-Z]+[a-zA-Z0-9_]+$");
	
	if (!regExp_uname_Ind.test(document.prof_add_edit.jbuser.value))
	{
		alert("User name must start with Alpha Letters & Only A-Z,0-9,_ Are allowed!");
		document.prof_add_edit.jbuser.focus();
		return false;
	}
	else if (document.prof_add_edit.jbuser.value.length < 5 || document.prof_add_edit.jbuser.value.length > 15)
	{
		alert("User name must contain minimum 5 or maximum 15 characters");
		document.prof_add_edit.jbuser.focus();
		return false;
	}
}
//	<------------------------------------   End of User Name Validation  -------------------------------------->

//	<------------------------------------   Start of Password Validation  -------------------------------------->
function form_UPass()
{
	if (document.prof_add_edit.jbpassword.value.length < 5 || document.prof_add_edit.jbpassword.value.length > 20)
	{
		alert("Password must contain minimum 5 or maximum 20 characters");
		document.prof_add_edit.jbpassword.focus();
		return false;
	}
}
//	<------------------------------------   End of Password Validation  -------------------------------------->

//	<------------------------------------   Start of Re-Type Password Validation  -------------------------------------->
function form_URePass()
{
	if (document.prof_add_edit.re_jbpassword.value != document.prof_add_edit.jbpassword.value)
	{
		alert("Your Password do not Match! Please re-type the Password");
		document.prof_add_edit.jbpassword.value = "";
		document.prof_add_edit.re_jbpassword.value = "";
		document.prof_add_edit.jbpassword.focus();
		return false;
	}
}
//	<------------------------------------   End of Re-Type Password Validation  -------------------------------------->

//	<------------------------------------   Start of First Name Validation  -------------------------------------->
function form_FName()
{
	var regExp_FName_Ind = new RegExp("^[a-z A-Z]+$");
	
	if (!regExp_FName_Ind.test(document.prof_add_edit.FName.value))
	{
		alert("First Name must contain Only Alpha Letters A-Z!");
		document.prof_add_edit.FName.focus();
		return false;
	}
}
//	<------------------------------------   End of First Name Validation  -------------------------------------->

//	<------------------------------------   Start of Last Name Validation  -------------------------------------->
/*
function form_LName()
{
	var regExp_LName_Ind = new RegExp("^[a-z A-Z]+$");

	if (!regExp_LName_Ind.test(document.prof_add_edit.LName.value))
	{
		alert("Last Name must contain Only Alpha Letters A-Z!");
		document.prof_add_edit.LName.focus();
		return false;
	}
}
*/
//	<------------------------------------   End of First Name Validation  -------------------------------------->

//	<------------------------------------   Start of City/Town Validation  -------------------------------------->
function form_City()
{
	var regExp_City_Ind = new RegExp("^[a-z A-Z]+$");

	if (!regExp_City_Ind.test(document.prof_add_edit.City.value)) 
	{
	    alert("Your City must contain Only Alpha Letters A-Z!");
		document.prof_add_edit.City.focus();
	    return false;
	} 
}
//	<------------------------------------   End of City/Town Validation  -------------------------------------->

//	<------------------------------------   Start of Zip Validation  -------------------------------------->
function form_Zip()	
{
	var regExp_Zip_Ind = new RegExp("^[0-9]+$");

	if (!regExp_Zip_Ind.test(document.prof_add_edit.Zip.value))
	{
		alert("Zip Code must contain Only Numbers 0-9!");
		document.prof_add_edit.Zip.focus();
		return false;
	}
}
//	<------------------------------------   End of Zip Validation  -------------------------------------->

//	<------------------------------------   Start of Phone Validation  -------------------------------------->
function form_Phone()
{
	var regExp_Phone_Ind = new RegExp("^[0-9),/. \_(-]+$");

	if (!regExp_Phone_Ind.test(document.prof_add_edit.Phone.value))
	{
		alert("Phone Number must contain Only Numbers (0-9)!");
		document.prof_add_edit.Phone.focus();
		return false;
	}
}	
//	<------------------------------------   End of Phone Validation  -------------------------------------->

//	<------------------------------------   Start of Fax Validation  -------------------------------------->
function form_Fax()
{
	var regExp_Fax_Ind = new RegExp("^[0-9)(-]+$");

	if (!regExp_Fax_Ind.test(document.prof_add_edit.Fax.value))
	{
		alert("Fax must contain Only Numbers (0-9)!");
		document.prof_add_edit.Fax.focus();
		return false;
	}
}	
//	<------------------------------------   End of Fax Validation  -------------------------------------->


function form_validate_full()
{
	var theform = document.prof_add_edit	
	var regExp_email = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	var regExp_uname = new RegExp("^[a-zA-Z]+[a-zA-Z0-9._]+$");
	var regExp_FName = new RegExp("^[a-z A-Z]+$");
	var regExp_LName = new RegExp("^[a-z A-Z]+$");
	var regExp_Zip = new RegExp("^[0-9]+$");
	var regExp_Phone = new RegExp("^[0-9),/. \_(-]+$");

	if ((theform.email.value == "") || (theform.email.value == null))
	{
	    alert("Please Enter the E-Mail!");
		theform.email.focus();
	    return false;
	} 
	else if (!regExp_email.test(theform.email.value))
	{
		alert("Please Enter the Valid E-Mail Address!");
		theform.email.focus();
		return false;
	}
	else if (theform.jbuser.value == "") 
	{
	    alert("Please Enter the User Name!");
		theform.jbuser.focus();
	    return false;
	} 
	else if (!regExp_uname.test(theform.jbuser.value))
	{
		alert("User name must start with Alpha Letters & Only A-Z,0-9,_ Are allowed!");
		theform.jbuser.focus();
		return false;
	}
	else if (theform.jbuser.value.length < 5 || theform.jbuser.value.length > 15)
	{
		alert("User name must contain minimum 5 or maximum 15 characters");
		theform.jbuser.focus();
		return false;
	}
	else if (theform.jbpassword.value == "") 
	{
	    alert("Please Enter the Password!");
		theform.jbpassword.focus();
	    return false;
	} 
	else if (theform.jbpassword.value.length < 5 || theform.jbpassword.value.length > 20)
	{
		alert("Password must contain minimum 5 or maximum 20 characters");
		theform.jbpassword.focus();
		return false;
	}
	else if (theform.re_jbpassword.value == "") 
	{
	    alert("Please Re-Enter the Password!");
		theform.re_jbpassword.focus();
	    return false;
	} 
	else if (theform.re_jbpassword.value != theform.jbpassword.value)
	{
		alert("Your Password do not Match! Please re-type the Password");
		theform.jbpassword.value = "";
		theform.re_jbpassword.value = "";
		theform.jbpassword.focus();
		return false;
	}
	else if (theform.FName.value == "") 
	{
	    alert("Please Enter the First Name!");
		theform.FName.focus();
	    return false;
	} 
	else if (!regExp_FName.test(theform.FName.value))
	{
		alert("First Name must contain Only Alpha Letters A-Z!");
		theform.FName.focus();
		return false;
	}
	/*
	else if (theform.LName.value == "") 
	{
	    alert("Please Enter the Last Name!");
		theform.LName.focus();
	    return false;
	} 
	else if (!regExp_LName.test(theform.LName.value))
	{
		alert("Last Name must contain Only Alpha Letters A-Z!");
		theform.LName.focus();
		return false;
	}
	*/
	else if (theform.Company.value == "") 
	{
	    alert("Please Enter Your Company Name!");
		theform.Company.focus();
	    return false;
	} 
	else if (theform.Address1.value == "") 
	{
	    alert("Please Enter Your Address!");
		theform.Address1.focus();
	    return false;
	} 
	else if (theform.City.value == "") 
	{
	    alert("Please Enter Your City!");
		theform.City.focus();
	    return false;
	} 
	else if (theform.State.value == "Select State") 
	{
	    alert("Please Select Your State!");
		theform.State.focus();
	    return false;
	} 
	else if (theform.Zip.value == "") 
	{
	    alert("Please Enter Your Zip Code!");
		theform.Zip.focus();
	    return false;
	} 
	else if (!regExp_Zip.test(theform.Zip.value))
	{
		alert("Zip Code must contain Only Numbers 0-9!");
		theform.Zip.focus();
		return false;
	}
	else if (theform.Phone.value == "") 
	{
	    alert("Please Enter Your Phone Number!");
		theform.Phone.focus();
	    return false;
	} 
	else if (!regExp_Phone.test(theform.Phone.value))
	{
		alert("Phone Number must contain Only Numbers (0-9)!");
		theform.Phone.focus();
		return false;
	}
	else if(theform.imName.value != "")
	{
		
		var crtstat=-1;
		for(i=theform.im.length-1; i > -1; i--)
		{ 
			if(theform.im[i].checked)
			{ 
			crtstat = i;
			i = -1;
			}
		}
		if(crtstat == -1)
		{
			alert("Please Select the IM !");
			return false;
		}
	}
	else if (theform.Website.value == "") 
	{
	    alert("Please Enter the Website!");
		theform.Website.focus();
	    return false;
	} 
	else if(theform.protect_txt.value == "")
	{
		alert("Please Enter the Text as shown");
		theform.protect_txt.focus();
		return false;
	}
	else if(theform.protect_txt.value != theform.charval.value)
	{
		alert("Please Enter the Valid Text as shown");
		theform.protect_txt.focus();
		return false;
	}
	
	else 
	{
	return true;
	} 
}


function form_validate_part_1()
{
	var theform = document.prof_add_edit	
	var regExp_email_1 = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	var regExp_uname_1 = new RegExp("^[a-zA-Z]+[a-zA-Z0-9_]+$");
	var regExp_FName_1 = new RegExp("^[a-zA-Z ]+$");
	var regExp_LName_1 = new RegExp("^[a-zA-Z]+$");
	var regExp_Zip_1 = new RegExp("^[0-9]+$");
	var regExp_Phone_1 = new RegExp("^[0-9),/. \_(-]+$");

	if ((theform.email.value == "") || (theform.email.value == null))
	{
		alert("Please Enter the E-Mail!");
		theform.email.focus();
	    return false;
	} 
	else if (!regExp_email_1.test(theform.email.value))
	{
		alert("Please Enter the Valid E-Mail Address!");
		theform.email.focus();
		return false;
	}
	else if (theform.jbuser.value == "") 
	{
	    alert("Please Enter the User Name!");
		theform.jbuser.focus();
	    return false;
	} 
	else if (!regExp_uname_1.test(theform.jbuser.value))
	{
		alert("User name must start with Alpha Letters & Only A-Z,0-9,_ Are allowed!");
		theform.jbuser.focus();
		return false;
	}
	else if (theform.jbuser.value.length < 5 || theform.jbuser.value.length > 15)
	{
		alert("User name must contain minimum 5 or maximum 15 characters");
		theform.jbuser.focus();
		return false;
	}
	else if (theform.jbpassword.value == "") 
	{
	    alert("Please Enter the Password!");
		theform.jbpassword.focus();
	    return false;
	} 
	else if (theform.jbpassword.value.length < 5 || theform.jbpassword.value.length > 20)
	{
		alert("Password must contain minimum 5 or maximum 20 characters");
		theform.jbpassword.focus();
		return false;
	}
	else if (theform.re_jbpassword.value == "") 
	{
	    alert("Please Re-Enter the Password!");
		theform.re_jbpassword.focus();
	    return false;
	} 
	else if (theform.re_jbpassword.value != theform.jbpassword.value)
	{
		alert("Your Password do not Match! Please re-type the Password");
		theform.jbpassword.value = "";
		theform.re_jbpassword.value = "";
		theform.jbpassword.focus();
		return false;
	}
	else if (theform.FName.value != "")
	{
		if (!regExp_FName_1.test(theform.FName.value))
		{
			alert("First Name must contain Only Alpha Letters A-Z!");
			theform.FName.focus();
			return false;
		}
	}
	/*
	else if (theform.LName.value != "")
	{
		if (!regExp_LName_1.test(theform.LName.value))
		{
			alert("Last Name must contain Only Alpha Letters A-Z!");
			theform.LName.focus();
			return false;
		}
	}
	*/
	else if (theform.Zip.value != "")
	{
		if (!regExp_Zip_1.test(theform.Zip.value))
		{
			alert("Zip Code must contain Only Numbers 0-9!");
			theform.Zip.focus();
			return false;
		}
	}
	else if (theform.Phone.value != "")
	{
		if (!regExp_Phone_1.test(theform.Phone.value))
		{
			alert("Phone Number must contain Only Numbers (0-9)!");
			theform.Phone.focus();
			return false;
		}
	}
	else if(theform.protect_txt.value == "")
	{
		alert("Please Enter the Text as shown");
		theform.protect_txt.focus();
		return false;
	}
	else if(theform.protect_txt.value != theform.charval.value)
	{
		alert("Please Enter the Valid Text as shown");
		theform.protect_txt.focus();
		return false;
	}
	else
	{
	return true;
	}
	
}


function form_validate_part_2()
{
	var theform = document.prof_add_edit	

	if ((theform.email.value == "") || (theform.email.value == null))
	{
		alert("Please Enter the E-Mail!");
		theform.email.focus();
	    return false;
	} 
	else if (theform.jbuser.value == "") 
	{
	    alert("Please Enter the User Name!");
		theform.jbuser.focus();
	    return false;
	} 
	else if (theform.jbuser.value.length < 5 || theform.jbuser.value.length > 15)
	{
		alert("User name must contain minimum 5 or maximum 15 characters");
		theform.jbuser.focus();
		return false;
	}
	else if (theform.jbpassword.value == "") 
	{
	    alert("Please Enter the Password!");
		theform.jbpassword.focus();
	    return false;
	} 
	else if (theform.jbpassword.value.length < 5 || theform.jbpassword.value.length > 20)
	{
		alert("Password must contain minimum 5 or maximum 20 characters");
		theform.jbpassword.focus();
		return false;
	}
	else if (theform.re_jbpassword.value == "") 
	{
	    alert("Please Re-Enter the Password!");
		theform.re_jbpassword.focus();
	    return false;
	} 
	else if (theform.re_jbpassword.value != theform.jbpassword.value)
	{
		alert("Your Password do not Match! Please re-type the Password");
		theform.jbpassword.value = "";
		theform.re_jbpassword.value = "";
		theform.jbpassword.focus();
		return false;
	}
	else if(theform.protect_txt.value == "")
	{
		alert("Please Enter the Text as shown");
		theform.protect_txt.focus();
		return false;
	}
	else if(theform.protect_txt.value != document.prof_add_edit.charval.value)
	{
		alert("Please Enter the Valid Text as shown");
		theform.protect_txt.focus();
		return false;
	}

	else
	{
	return true;
	}
}

