function nonmember()
   {
    if (window.document.signup.member[0].checked==true) 
       {the_change="none";} else {the_change="block";}

    if (document.getElementById) 
       {document.getElementById("Nonmember").style.display = the_change;
        return;}

    if (document.all) 
       {div_string = "window.document.all.Nonmember.style"; 
	the_div = eval(div_string);
        the_div.display = the_change;
        return;} 

    if (document.layers) 
       {window.document.Nonmember.display= the_change;
        return;} 

   }
function valsign()
   {
    var xerr=error_check();
    if (xerr == "")
       {return true}
    else
       {alert(xerr);
        return false;
       }
   }


function error_check()
   {
    var error_string = "";

    if (window.document.signup.firstname.value == "") 
       { error_string = "Please enter your first name.\n"; return error_string;}

    if (window.document.signup.lastname.value == "") 
       { error_string = "Please enter your last name.\n"; return error_string;}

    if (window.document.signup.member[0].checked == true) 
       { error_string = ""; return error_string;}

    if (window.document.signup.email.value == "") 
       { error_string = "We would prefer that non-members provide their email address.\n"; return error_string;}

    if (window.document.signup.hostname.value == "") 
       { error_string = "Please enter the name of the MPN member who invited you.\n"; return error_string;}

    if (checkEmail(window.document.signup.email.value) ==false)
       { error_string = "Sorry, your email address is not valid.\n"; return error_string;}

    return error_string;
   }

function checkEmail(the_email)
{
    var the_at = the_email.indexOf("@");
    var the_dot = the_email.lastIndexOf(".");
    var a_space = the_email.indexOf(" ");
    if ((the_at != -1) &&  // if there's an '@'
        (the_at != 0) &&  // and it's not at position 0
        (the_dot != -1) && // and there's a '.'
        (the_dot > the_at + 1) &&  // and something between the '@' and '.'
        (the_dot < the_email.length - 1) && // and something after the '.'
        (a_space  == -1))  // and there're no spaces
    	{
        	    return true;
    	}  else {
        	    return false;
    	}
}

