//-------------------------------Function to set focus on body load --------------------
function set_focus()
{
	document.form1.salutation.focus();
}

//-------------------------------Function to validate --------------------

function checkmail(mail)
	{
		if (mail.indexOf('@')==-1)
			return false;
		else
			if (mail.indexOf('.')==-1)
				return false;
			else
				return true;
	}
	function validate()
	{
	
		if(document.form1.salutation.value == "")
		{
			alert("Please select the Salutation.");
			document.form1.salutation.focus();
			return false;
		}
		if(document.form1.firstname.value == "")
		{
			alert("Please enter your First Name.");
			document.form1.firstname.focus();
			return false;
		}
		if(document.form1.lastname.value == "")
		{
			alert("Please enter your Last Name.");
			document.form1.lastname.focus();
			return false;
		}
	
		var newlength = document.form1.radiobutton.length;
		myOption = -1;
		for (i=newlength-1; i > -1; i--) 
		{
			if (document.form1.radiobutton[i].checked) 
			{
				var val	=	document.form1.radiobutton[i].value;
				myOption = i;
			}
		}
		if (myOption == -1) 
		{
			alert("Please select at least one radio button");
			return false;
		}

		switch (val)
		{
			case "MD": 
					if (document.form1.md.value == "")//************ OPTION
					{
						alert("Please select one from the List.");
						document.form1.md.focus();
						return false;
					}
			break;
			case "OHP": 
					if (document.form1.otherhealthcareprofessional.value == "")//************ OPTION
					{
						alert("Please select one from the List.");
						document.form1.otherhealthcareprofessional.focus();
						return false;
					}
			break;
			case "INDUS":
				if (document.form1.manufactureroragencyother.value == "" && document.form1.manufactureroragency.value == "")
				{
					alert("Please select an Industry. If it is not listed, please specify it in the OTHER box below.");
					document.form1.manufactureroragencyother.focus();
					return false;
				}
				if (document.form1.manufactureroragencyother.value == "")
				{
					if (document.form1.manufactureroragency.value == "")//************ OPTION
					{
						alert("Please select one from the List.");
						document.form1.manufactureroragency.focus();
						return false;
					}
				}
			break;
		}

		if(document.form1.companyname.value == "")
		{
			alert("Please enter your Company Name.");
			document.form1.companyname.focus();
			return false;
		}
		if(document.form1.title.value == "")
		{
			alert("Please enter your Title.");
			document.form1.title.focus();
			return false;
		}
		if(document.form1.email.value == "")
		{
			alert("Please enter an Email Address.");
			document.form1.email.focus();
			return false;
		}
		if(!checkmail(document.form1.email.value))
		{
			alert("Please enter a valid Email Address.");
			document.form1.email.focus();
			return false;
		}
		
		return true;
		
		
		
	}
	
	
	
