function clearInputBox(el,st){
	var iE=$('#'+el);
	var iV=iE.val();
	if (iV==st){
		iE.val('');	
	}
	iE.addClass('inputActive');
}

function resetInputBox(el,st){
	var iE=$('#'+el);
	var iV=iE.val();
	if (iV==""){
		iE.val(st);	
	}
	iE.removeClass('inputActive');
}


$(document).ready(function() {
	$("#suSubmit").click(function () { 
	   return validateForm(); 
    });
});


function validateForm(){
	
	var reason = "";
	var result = "";

	reason += validateName($('#suName'));
	reason += validateEmail($('#suEmail'));
	
	if (reason != "") {
		result="Not Submitted:<br />"+reason;
    	$('#errors').html(result);
    	return false;
  	}

return true;

}

function validateName(fld) {
    var error = "";
  
    if (fld.val().length == 0) {
        error = "<span>Please enter your name.</span>";
    } else 
	if (fld.val() == "Name...") {
        error = "<span>Please enter your real name.</span>";
    }
    return error;   
}

function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
} 

function validateEmail(fld) {
    var error="";
	//var fld=document.getElementById(fld3);
    var tfld = trim(fld.val());                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\ \\:\\\"\[\]]/ ;
    
    if (fld.val() == "") {
        error = "<span>You didn't enter an email address.</span>";
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        error = "<span>Please enter a valid email address.</span>";
    } else if (fld.val().match(illegalChars)) {
        error = "<span>Your email address contains illegal characters.</span>";
    }
    return error;
}