var empty = new Image(); empty.src = "http://images.AraServ.com/common/yelo-table/fieldempty.gif";
var email = new Image(); email.src = "http://images.AraServ.com/common/yelo-table/mailerror.gif";

var haveerrors = 0;
function showImage(imagename, imageurl, errors) {
document[imagename].src = imageurl;
if (!haveerrors && errors) haveerrors = errors;
}

function validateForm(f) {
haveerrors = 0;

(f.Name.value.length < 4) // validate full name length
? showImage("Name", "http://images.AraServ.com/common/yelo-table/fieldempty.gif", true)
: showImage("Name", "http://images.AraServ.com/common/yelo-table/blankimage.gif", false);


(f.subject.value.length < 4)
? showImage("subject", "http://images.AraServ.com/common/yelo-table/fieldempty.gif", true)
: showImage("subject", "http://images.AraServ.com/common/yelo-table/blankimage.gif", false);


(f.MSG.value.length < 10)
? showImage("MSG", "http://images.AraServ.com/common/yelo-table/fieldempty.gif", true)
: showImage("MSG", "http://images.AraServ.com/common/yelo-table/blankimage.gif", false);


(f.email.value.search("@") == -1 || f.email.value.search("[.*]") == -1) // validate email
? showImage("emailerror", "http://images.AraServ.com/common/yelo-table/mailerror.gif", true)
: showImage("emailerror", "http://images.AraServ.com/common/yelo-table/blankimage.gif", false);

return (!haveerrors);
}
