function product_check(obj){ if(!isobj(obj)) return false; if(!obj.name.value) return msg("Please enter your Name",obj.name) if(!space_check(obj.name)){ obj.name.value = ""; return msg("Please enter your Name",obj.name); } if(!validate_email(obj.email)) return msg("Please enter your Email address",obj.email) obj.phone.value = remove_space ( obj.phone.value ); if(!obj.phone.value) return msg("Please enter your phone number",obj.phone) if ( !Check_Is_Num ( obj.phone.value, obj.phone ) ) { obj.phone.value = ""; return msg("Please enter only numbers for phone field.",obj.phone) } //loadpopup(); return true; } function product_check_wo_company(obj){ //Product check without company filed if(!isobj(obj)) return false; if(!obj.name.value) return msg("Please enter your Name",obj.name) if(!validate_email(obj.email)) return msg("Please enter your Email address",obj.email) if(!obj.phone.value) return msg("Please enter your Phone number",obj.phone) return true; } function Check_Is_Num ( str, obj ) { var stripped = str.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters for ( i = 0; i < stripped.length; i++ ) { if (isNaN(parseInt(stripped.charAt(i)))) { return false; } } obj.value = stripped; return true; } function remove_space ( str ) { re = / /g; // remove spaces. str = str.replace(re, ""); return str; } function isobj(obj){ if(!obj){ alert("The form was not found for validation"); return false; } return true; } function validate_email(obj){ var x=true var len=obj.value.length var str=obj.value str=str.split(",") for(var i=0 ; i != str.length ; i++) if(!emailcheck(str[i])) return false; return true; } function msg(message,obj){ alert(message) obj.focus() return false; } function emailcheck(str){ var x=true var len=str.length if((str.charAt(0)=="@")||(str.charAt(0)==".")||(str.charAt(len-1)=="@")||(str.charAt(len-1)==".")){x=false;} else{ for(i=1;i= "A")&&(str.charAt(i) <= "Z"))||((str.charAt(i) >= "a")&&(str.charAt(i) <= "z"))||((str.charAt(i) >= 0)&&(str.charAt(i) <= 9))||(str.charAt(i)==".")||(str.charAt(i)=="@")||(str.charAt(i)=="_")||(str.charAt(i)=="-")){ if(((str.charAt(i)=="@")&&(str.charAt(i-1)=="."))||((str.charAt(i)==".")&&(str.charAt(i-1)=="@"))||((str.charAt(i)==".")&&(str.charAt(i-1)=="."))||((str.charAt(i)=="@")&&(str.charAt(i-1)=="@"))){x=false;i=len;} }else{x=false;i=len;} } if(x){ var at_count=0;var dot_count=0; for(i=1;i 1))&&(x==true)){ x=false; } } } return x; } function trim(str) { return str.replace(/^\s*|\s*$/g,""); } function space_check(obj)//Checks name field - remove space { var str=obj.value; str=trim(str); if( str.length > 0 ) { return true; } else { return false; } } function loadpopup(){ popupwin = window.open("../trial_confirm.htm","","width=400,height=280,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no"); }