
function FormValidator(name)
{this.entity=$(name);this.name=name;if($(name))
{$(name).onsubmit=function(e){return checkForm(e);}}
function getName(){return this.name;}
this.getName=getName;function setName(name)
{this.name=name}
this.setName=setName;function getType()
{return typeof this.entity;}
this.getType=getType;function clearField()
{if(this.style)
{if(this.value=='This is required')
{this.value='';this.style.color='#000';}}
if(window.event.srcElement)
{var thisObj=window.event.srcElement;if(thisObj.value=='This is required')
{thisObj.value='';thisObj.style.color='#000';}}}
this.clearField=clearField;function checkForm(e)
{var targetObject;if(!e)
{var e=window.event;}
if(e.target)
{targetObject=e.target;}
else if(e.srcElement)
{targetObject=e.srcElement;}
if(targetObject.nodeType==3)
{targetObject=targetObject.parentNode;}
var allRequired=targetObject.getElementsByClassName('required');var sendForm=true;for(var i=0;i<allRequired.length;i++)
{if(((allRequired[i]).value.strip()).length==0)
{var errorBox=$(allRequired[i].id);errorBox.value="This is required";errorBox.style.color="Red";addEvent(errorBox,'focus',clearField);sendForm=false;}}
return sendForm;}
this.checkForm=checkForm;}
