// JavaScript Document function LTrim( value ) { var re = /\s*((\S+\s*)*)/; return value.replace(re, "$1"); } // Removes ending whitespaces function RTrim( value ) { var re = /((\s*\S+)*)\s*/; return value.replace(re, "$1"); } // Removes leading and ending whitespaces function trim( value ) { return LTrim(RTrim(value)); } function apply_validation() { var check=validate_form_field(); if(check!=false) { document.registration.action=""; document.registration.submit(); return false; } } function validate_form_field() { if(document.registration.combined_inspection.checked==false && document.registration.building_inspection.checked==false) { alert("Please checked the type of inspection"); return false; } if(trim(document.registration.name.value)=="") { alert("Please enter the name"); document.registration.name.focus(); return false; } if(trim(document.registration.deadline.value)=="") { alert("Please enter the deadline"); document.registration.deadline.focus(); return false; } if(trim(document.registration.deadline.value)=="") { alert("Please enter the deadline"); document.registration.deadline.focus(); return false; } if(trim(document.registration.phone1.value)=="") { alert("Please enter the phone no"); document.registration.phone1.focus(); return false; } if((trim(document.registration.phone1.value))!="") { var str=document.registration.phone1.value; var str1=document.registration.phone1.value.length; var iChars = "*|\"<>[]{}`\';()@&$#%ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqqrstuvwxyz"; for (var i = 0; i []{}`\';()@&$#%ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqqrstuvwxyz"; for (var i = 0; i