function validate()
{
	if (document.reg.firstname.value=="")
	{
		alert ("    Enter First Name  ")
		document.reg.firstname.focus()
		return false;
	}
	if (document.reg.lastname.value=="")
	{
		alert ("    Enter Last Name  ")
		document.reg.lastname.focus()
		return false;
	}
	if (document.reg.title.value=="")
	{
		alert ("    Enter Title  ")
		document.reg.title.focus()
		return false;
	}

	if (document.reg.company.value=="")
	{
		alert ("    Enter your company name  ")
		document.reg.company.focus()
		return false
	}	

	if(document.reg.phone.value=="")
	{
		alert(" Enter Phone ")
		document.reg.phone.focus()
		return false;
	}

	var checkOK = "0123456789-.,+() ";
	var checkStr = document.reg.phone.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digits.");
		document.reg.phone.focus();
		document.reg.phone.select();
		return false;
	}
	if (document.reg.email.value=="")
	{
		alert (" Please Enter Your Email   ")
		document.reg.email.focus()
		return false
	}
	var s= document.reg.email.value	
	
	if (!checkEmail(s)){
		alert(" Email Address should be in the form of xyz@domainname ")
		document.reg.email.focus()
		return false	
	}
	if(document.reg.website.value=="")
	{
		alert(" Enter the website ")
		document.reg.website.focus()
		return false;
	}

	if(document.reg.wherehear.value=="")
	{
		alert (" Where did you hear about Sterling-Hoffman Life Sciences? ");
		document.reg.wherehear.focus()
		return false;
	}
	
	if (document.reg.wherehear.value=="Internet Search" && document.reg.internet.value=="")
	{
		alert (" Please specify Search terms:")
		document.reg.internet.focus()
		return false;
	}
	
	if (document.reg.wherehear.value=="Other" && document.reg.otherhear.value=="")
	{
		alert (" Please specify if other:")
		document.reg.otherhear.focus()
		return false;
	}
	
	document.reg.submit()
}


function checkEmail(strng)
{
	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(strng))) 
		return false;
			var illegalChars= /[\(\)\<\>\?\,\;\:\\\/\"\[\]\*\+\&\%\!\#\$\^\=]/		
	if (strng.match(illegalChars)) 
		return false;
	else
		return true;
}

function validate1()
{
	if (document.reg1.firstname.value==""){
		alert ("    Enter First Name  ")
		document.reg1.firstname.focus()
		return false;
	}
	if (document.reg1.lastname.value==""){
		alert ("    Enter Last Name  ")
		document.reg1.lastname.focus()
		return false;
	}
	if(document.reg1.city.value==""){
		alert(" Enter City ")
		document.reg1.city.focus()
		return false;
	}
	if(document.reg1.state.value==""){
		alert(" Enter State ")
		document.reg1.state.focus()
		return false;
	}
	if(document.reg1.country.value==""){
		alert(" Enter Country ")
		document.reg1.country.focus()
		return false;
	}
	if(document.reg1.phone.value==""){
		alert(" Enter Phone ")
		document.reg1.phone.focus()
		return false;
	}

	var checkOK = "0123456789-.,+() ";
	var checkStr = document.reg1.phone.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
	alert("Please enter only digits.");
	document.reg1.phone.focus();
	document.reg1.phone.select();
	return false;
	}
	if (document.reg1.email.value=="")
	{
		alert (" Please Enter Your Email   ")
		document.reg1.email.focus()
		return false
	}
	var s= document.reg1.email.value	

	if (!checkEmail(s)){
		alert(" Email Address should be in the form of xyz@domainname ")
		document.reg1.email.focus()
		return false	
	}

	if(document.reg1.wherehear.value=="")
	{
		alert ("Where did you hear about Sterling-Hoffman Life Sciences?");
		document.reg1.wherehear.focus()
		return false;
	}
	if (document.reg1.wherehear.value=="Internet Search" && document.reg1.internet.value=="")
	{
		alert (" Please specify Search terms:")
		document.reg1.internet.focus()
		return false;
	}

	if (document.reg1.wherehear.value=="Other" && document.reg1.otherhear.value=="")
	{
		alert (" Please specify if other:")
		document.reg1.otherhear.focus()
		return false;
	}
	
	if (document.reg1.wherehear.value=="Job Board")
	{
		if(document.reg1.jboard.value=="")
		{
			alert ("   Enter Job Board?  ")
			document.reg1.jboard.focus()
			return false
		}
	}
	if (document.reg1.resume.value=="" && document.reg1.textresume.value=="")
	{
		alert ("    Please upload your resume or enter text format    ")
		document.reg1.resume.focus()
		return false;
   }
   
	if (document.reg1.relocation.value=="")
	{
		alert ("Please indicate whether you are open to relocation ")
		document.reg1.relocation.focus()
		return false;
	}
	else
	{	   		   		  	
		if(document.reg1.relocation.value=="Yes")
		{
	   		if (document.reg1.state2.value=="")
			{
				alert (" Please select the States you would consider relocating to");
				document.reg1.state2.focus();
				return false;
			}
	   	}	   	
	}

	if(document.reg1.employed.value=="")
	{
		alert(" Enter how many different companies have you been employed by in the past 7 years?")
		document.reg1.employed.focus()
		return false;
	}
}

