function trim(stringToTrim) {
    return stringToTrim.replace(/^\s+|\s+$/g,"");
}
$("form#emailForm").submit(function(){ 
    if(trim($("#email_from").val()) == "") {
        alert('Please provide your email');
    }
    else {
        $.post("signup_email.php",{ 
            email_from: $("#email_from").val(), 
            submit: "enter", 
            byajax: "true" 
         }, function(xml) {
             if($("status",xml).text() == "6") {
                 alert('Thank you for signing up');
             } 
             else if($("status",xml).text() == "1") {
                 alert('You are already signed up');
             } 
             else if($("status",xml).text() == "2") {
                 alert('You are set to not receive messages');
             }
             else if($("status",xml).text() == "3") {
                 alert('Email is empty');
             }
             else if($("status",xml).text() == "4") {
                 alert('Email is invalid');
             }
             else if($("status",xml).text() == "5") {
                 alert('Failed to record your email');
             }
             else {
                 alert('Unknown response');
             }
        });
    }
    return false; 
});