function validateForm( )
	{
		var frm = document.frmMain;

		if(! ValidateEmail(frm.emailaddr) )
		{
			return false;
		}

		if(frm.firstname.value == "")
		{
			//alert('Must fill in your first name!');
			//frm.firstname.focus();
			//return false;

			// default a first name
			frm.firstname.value = frm.emailaddr.value;
		}
		
		if(frm.userfield1.value == "")
		{
			alert('Must fill in your zip code!');
			frm.userfield1.focus();
			return false;
		}

		return true;
	}
	
	function validateContact( )
	{
		var contact_form = document.contact_form;

		if(! ValidateEmail(contact_form.emailaddr) )
		{
			return false;
		}

		if(contact_form.thename.value == "")
		{
			alert('Must fill in your name!');
			contact_form.thename.focus();
			return false;
		}
		
		if(contact_form.message.value == "")
		{
			alert('You totally need to fill in a message. Totally.');
			contact_form.message.focus();
			return false;
		}

		return true;
	}
	
	function validateJoin( )
	{

		var join_form = document.join_form;
		
		//user_screen_name
		//user_mod_email
		//user_mod_email_redundant
		//user_password
		//user_password_redundant
		
		//security_question

		if(! ValidateEmail(join_form.user_mod_email) )
		{
			return false;
		}
		
		if(! ValidateEmail(join_form.user_mod_email_redundant) )
		{
			return false;
		}

		if(join_form.user_screen_name.value == "")
		{
			alert('We need a screen name from you!');
			join_form.user_screen_name.focus();
			return false;
		}
		
		if(join_form.user_password.value == "")
		{
			alert('We need you to enter a password!');
			join_form.subject.focus();
			return false;
		}
		
		if(join_form.user_password_redundant.value == "")
		{
			alert('Please re-enter your password.');
			join_form.fromtext.focus();
			return false;
		}
		
		if(join_form.security_question.value == "")
		{
			alert('The security question is really, really easy. You can do it.');
			join_form.security_question.focus();
			return false;
		}
		
		if(join_form.user_mod_email.value == join_form.user_mod_email_redundant)
		{
			alert('Your e-mail addresses do not match. Please fix!');
			join_form.user_mod_email.focus();
			return false;
		}
		
		if(join_form.user_password.value == join_form.user_password_redundant)
		{
			alert('Your passwords do not match. Please fix!');
			join_form.user_password.focus();
			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!")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail!")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail!")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail!")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail!")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail!")
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail!")
		    return false
		 }

 		 return true
	}

	function ValidateEmail(emailID){
		if ((emailID.value==null)||(emailID.value=="")){
			alert("Please enter your valid e-mail address.")
			emailID.focus()
			return false
		}
		if (echeck(emailID.value)==false){
			emailID.value=""
			emailID.focus()
			return false
		}
		return true
	 }
