function Validate(obj) { flag=""; len=""; re=/[0-9]/; re1=/[?.>,<:=+-_)(*&^%$#@!~]/; re2=/[A-Za-z]/; name=re.exec(obj.name_htm.value); name1=re1.exec(obj.name_htm.value); name2=re2.exec(obj.name_htm.value); if((obj.name_htm.value=="" || name != "null" || name1 != null) && name2 == null) { flag="1"; Str="Name"; } else if(obj.name_htm.value !="" && !isNaN(obj.name_htm.value)) { flag="1"; Str="Name"; } else if(obj.pass_htm.value=="" || obj.pass_htm.value.length < 5) { flag="8"; Str="Password"; len="5"; } else if(obj.oaddress_htm.value=="") { flag="5"; Str="Office Address1"; } else if(obj.oaddress1_htm.value=="") { flag="5"; Str="Office Address2"; } else if(obj.oaddress2_htm.value=="") { flag="5"; Str="Office Address3"; } else if(obj.opost_htm.value=="") { flag="5"; Str="Zip Code"; } else if(obj.opost_htm.value !="" && (isNaN(obj.opost_htm.value) || obj.opost_htm.value.length < 6)) { flag="4"; Str="Zip Code"; len=6; } else if(obj.ophone_htm.value=="") { flag="5"; Str="Office Telephone"; } else if(obj.ophone_htm.value !="" && (obj.ophone_htm.value.length < 5)) { flag="4"; Str="Office Telephone"; len=5; } else if(obj.omobile_htm.value !="" && (obj.omobile_htm.value.length < 9)) { flag="4"; Str="Mobile Number"; len=12; } else if(obj.opager_htm.value !="" && (obj.opager_htm.value.length < 9)) { flag="4"; Str="Pager Number"; len=12; } else if(obj.email_htm.value != "" && (obj.email_htm.value.indexOf("@")<0 || obj.email_htm.value.indexOf(".")<0)) { flag="9"; Str="E-Mail"; } else if(obj.wpost_htm.value !="" && (isNaN(obj.wpost_htm.value) || obj.wpost_htm.value.length < 6)) { flag="4"; Str="Works Zip Code"; len=6; } else if(obj.wphone_htm.value !="" && (obj.wphone_htm.value.length < 5)) { flag="4"; Str="Works Telephone"; len=5; } else if((obj.status_htm.options.selectedIndex == 0) || (obj.status_htm.options.selectedIndex == -1)) { flag="5"; Str="Status"; } else if(obj.partner1_htm.value=="") { flag="5"; Str="Partner1"; } else if(obj.yeofest_htm.value=="") { flag="5"; Str="Year of Establishment"; } else if(obj.yeofest_htm.value !="" && (isNaN(obj.yeofest_htm.value))) { flag="6"; Str="Year of Establishment"; } else if(obj.regno_htm.value=="") { flag="5"; Str="Reg No"; } else if(obj.turn_htm.value=="") { flag="5"; Str="Turn Over"; } else if(obj.baddress_htm.value=="") { flag="5"; Str="Bank Address1"; } else if(obj.baddress1_htm.value=="") { flag="5"; Str="Bank Address2"; } else if(obj.baddress2_htm.value=="") { flag="5"; Str="Bank Address3"; } else if(obj.bpost_htm.value=="") { flag="5"; Str="Bank Zip Code"; } else if(obj.bpost_htm.value !="" && (isNaN(obj.bpost_htm.value) || obj.bpost_htm.value.length < 6)) { flag="4"; Str="Bank Zip Code"; len=6; } else if(obj.floor_htm.value=="") { flag = "5"; Str="Floor Space"; } else if(obj.exp1_htm.value=="") { flag = "5"; Str="Experience"; } else if(obj.exp1_htm.value !="" && (isNaN(obj.exp1_htm.value))) { flag="6"; Str="Experience"; } else if(obj.rep_htm.value=="") { flag = "5"; Str="Reputed Customer"; } else if(obj.rep_htm.value !="" && !isNaN(obj.rep_htm.value)) { flag="1"; Str="Reputed Customer"; } else if(obj.fur_htm.value=="") { flag = "5"; Str="Further Correspondence"; } else if(obj.bphone_htm.value=="") { flag="5"; Str="Bank Telephone"; } else if(obj.bphone_htm.value !="" && (obj.bphone_htm.value.length < 5)) { flag="4"; Str="Bank Telephone"; len=5; } switch(flag) { case "1": alert(Str+" cannot be Empty or Number"); break; case "2": alert(Str+" Between"+leng); break; case "3": alert(Str+" Not Valid"); break; case "4": alert(Str+" is not valid"); break; case "5": alert(Str + " Cannot be Empty"); break; case "6": alert(Str + " Should be a Number"); break; case "7": alert(Str +" Should be Not be Empty or Less than 2000"); break; case "8": alert(Str +" Should Not be Empty or Cannot Less than "+len+" Digits"); break; case "9": alert(Str +" is Not Valid"); break; } switch(Str) { case "Name": obj.name_htm.focus(); Str=""; return false; case "Password": obj.pass_htm.focus(); Str=""; return false; case "Office Address1": obj.oaddress_htm.focus(); Str=""; return false; case "Office Address2": obj.oaddress1_htm.focus(); Str=""; return false; case "Office Address3": obj.oaddress2_htm.focus(); Str=""; return false; case "Zip Code": obj.opost_htm.focus(); Str=""; return false; case "Country": obj.ocountry_htm.focus(); Str=""; return false; case "Office Telephone": obj.ophone_htm.focus(); Str=""; return false; case "Mobile Number": obj.omobile_htm.focus(); Str=""; return false; case "Pager Number": obj.opager_htm.focus(); Str=""; return false; case "E-Mail": obj.email_htm.focus(); Str=""; return false; case "Works Zip Code": obj.wpost_htm.focus(); Str=""; return false; case "Works Telephone": obj.wphone_htm.focus(); Str=""; return false; case "Status": obj.status_htm.focus(); Str=""; return false; case "Partner1": obj.partner1_htm.focus(); Str=""; return false; case "Partner2": obj.partner2_htm.focus(); Str=""; return false; case "Year of Establishment": obj.yeofest_htm.focus(); Str=""; return false; case "Reg No": obj.regno_htm.focus(); Str=""; return false; case "Turn Over": obj.turn_htm.focus(); Str=""; return false; case "Bank Address1": obj.baddress_htm.focus(); Str=""; return false; case "Bank Address2": obj.baddress1_htm.focus(); Str=""; return false; case "Bank Address3": obj.baddress2_htm.focus(); Str=""; return false; case "Bank Zip Code": obj.bpost_htm.focus(); Str=""; return false; case "Bank Telephone": obj.bphone_htm.focus(); Str=""; return false; case "Floor Space": obj.floor_htm.focus(); Str=""; return false; case "Experience": obj.exp1_htm.focus(); Str=""; return false; case "Reputed Customer": obj.rep_htm.focus(); Str=""; return false; case "Further Correspondence": obj.fur_htm.focus(); Str=""; return false; case "Year": obj.year_htm.focus(); Str=""; return false; } }