// <input onClick="return phpMyEdit_form_control(this.form);" type="submit" name="submit_button" id="submit_button" value="Submit">

function phpMyEdit_trim(str)
{
    while (str.substring(0, 1) == " " || str.substring(0, 1) == "\n" || str.substring(0, 1) == "\r"){
        str = str.substring(1, str.length);
    }
    while (str.substring(str.length - 1, str.length) == " " || str.substring(str.length - 1, str.length) == "\n" || str.substring(str.length - 1, str.length) == "\r"){
        str = str.substring(0, str.length - 1);
    }
    return str;
}

function phpMyEdit_form_control(theForm)
{
	// display_name, email, company, address, city, state, zip, telephone, comment, my_url
    if(phpMyEdit_trim(theForm.display_name.value) == ""){
        alert("Please enter your First and Last Name"); theForm.display_name.focus(); return false;
    }
    if(phpMyEdit_trim(theForm.email.value) == ""){
        alert("Please enter your email address"); theForm.email.focus(); return false;
    }
    if(phpMyEdit_trim(theForm.comment.value) == ""){
        alert("Please enter a comment"); theForm.comment.focus(); return false;
    }
    if(phpMyEdit_trim(theForm.my_url.value) != ""){
        alert("The submitted data appears to contain spam");
        //theForm.my_url.focus();
        return false;
    }
    return true;
}


