				function form_validator_second(theform)
					{
					
					if (theform.radCatalogue[0].checked)
						{
						
						if (theform.txtFirstName.value == "")
							{
							alert("Please enter your first name!");
							theform.txtFirstName.focus();
							return (false);
							}
							
						if (theform.txtLastName.value == "")
							{
							alert("Please enter your last name!");
							theform.txtLastName.focus();
							return (false);
							}
						
						if (theform.txtAddress.value == "")
							{
							alert("Please enter your address!");
							theform.txtAddress.focus();
							return (false);
							}
							
						if (theform.txtCity.value == "")
							{
							alert("Please enter your city!");
							theform.txtCity.focus();
							return (false);
							}
							
						if (theform.txtProvince.value == "")
							{
							alert("Please enter your province!");
							theform.txtProvince.focus();
							return (false);
							}
						
						if (theform.txtPostalCode.value == "")
							{
							alert("Please enter your postal code!");
							theform.txtPostalCode.focus();
							return (false);
							}
						
						}
					
					
					if (theform.radNewsletter[0].checked && theform.txtEmail.value == "")
						{
						alert("Please enter a valid email address!");
						theform.txtEmail.focus();
						return (false);
						}
						
					if (theform.radNewsletter[0].checked && echeck(theform.txtEmail.value)==false)
		                {
		                alert("Please enter a valid email address");
		                theform.txtEmail.focus();
		                theform.txtEmail.select();
		                return (false);
		                }
					
					return (true);
					
					}
					
				function give_focus()
				    {
				    document.forms[1].txtFirstName.focus();
				    }
					
					

function form_validator(theform){
	if (theform.email.value == ""){
		alert("Please enter a valid email address!");
		theform.email.focus();
		return (false);
	}
	if (echeck(theform.email.value)==false){
		alert("Please enter a valid email address");
		theform.email.focus();
		theform.email.select();
		return (false);
	}
	return (true);
}
	
function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
		//alert("Invalid E-mail ID")
		return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		//alert("Invalid E-mail ID")
		return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		//alert("Invalid E-mail ID")
		return false
	}
	if (str.indexOf(at,(lat+1))!=-1){
		//alert("Invalid E-mail ID")
		return false
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		//alert("Invalid E-mail ID")
		return false
	}
	if (str.indexOf(dot,(lat+2))==-1){
		//alert("Invalid E-mail ID")
		return false
	}
	if (str.indexOf(" ")!=-1){
		//alert("Invalid E-mail ID")
		return false
	}
 	return true					
}
	
