function strlen(value) { if (value == null) return 0 ; var str = value; var len = 0 ; for (var i = 0; i < str.length ; i++) { len ++ ; if ( str.charCodeAt(i) > 255 ) { len ++ ; } } return len ; } function checkform() { if (document.userform.loginName.value=="") { document.userform.loginName.focus(); alert("The login name cannot be blank!"); return false; } if(document.userform.loginName.value!=""){ var reg = /^[0-9a-zA-Z]+$/; if(document.userform.loginName.value.search(reg)==-1){ alert("The login name can only be the combination of letters/numbers"); document.userform.loginName.focus(); return false; } } if (document.userform.password.value=="") { document.userform.password.focus(); alert("The password cannot be blank!"); return false; } if (document.userform.prepassword.value=="") { document.userform.prepassword.focus(); alert("The confirm password can not be blank!"); return false; } if(document.userform.password.value!=""){ if(!(document.userform.password.value.length>5 && document.userform.password.value.length<20)){ alert("6 to 20 characters only."); document.userform.password.focus(); return false; } } if(document.userform.prepassword.value!=""){ if(!(document.userform.prepassword.value.length>5 && document.userform.prepassword.value.length<20)){ alert("6 to 20 characters for confirm password."); document.userform.prepassword.focus(); return false; } } if (document.userform.userName.value=="") { document.userform.userName.focus(); alert("Name cannot be blank!"); return false; } if (document.userform.onlyMail.value=="") { document.userform.onlyMail.focus(); alert("Email cannot be blank!"); return false; } if( strlen(document.userform.onlyMail.value)>30 ){ document.userform.onlyMail.focus(); alert("Email cannot exceed 30 characters!"); return false; } if(document.userform.onlyMail.value!=""){ var reg = /^([A-Za-z0-9])+(\.*\w)+@(\w)+(\.)(com$|com\.cn$|net$|cn|net\.cn$|org$|biz$|info$|gov$|gov\.cn$|edu$|edu\.cn$)/; //var reg = /^([A-Za-z0-9])(\w)+@(\w)+(\.)(com|com\.cn|net|cn|net\.cn|org|biz|info|gov|gov\.cn|edu|edu\.cn)/; if(!document.userform.onlyMail.value.match(reg)){ alert("A valid email address is required!"); document.userform.onlyMail.focus(); return false; } } return true; } function checkformone() { if (document.myform.theProvince1.value=="") { document.myform.theProvince1.focus(); alert("The province/state cannot be blank!"); return false; } return ture; } function checkformtwo() { if (document.userform.orgName.value=="") { document.userform.orgName.focus(); alert("Company Name cannot be blank!"); return false; } if(document.userform.registerFund.value!=""){ var reg = /^[0-9]*[1-9][0-9]*$/; var regg =/^\d*[.]\d*$/; if(!document.userform.registerFund.value.match(regg) && !document.userform.registerFund.value.match(reg)){ alert("The format for Registered is not correct."); document.userform.registerFund.focus(); return false; } } if (document.userform.addRess.value=="") { document.userform.addRess.focus(); alert("Mailing Address cannot be blank!"); return false; } if (document.userform.thePhone.value=="") { document.userform.thePhone.focus(); alert("Contact Phone cannot be blank!"); return false; } if(document.userform.webSite.value!=""){ } return true; } function checkformtwoa() { if (document.userform.orgName.value=="") { document.userform.orgName.focus(); alert("Company Name cannot be blank!"); return false; } if (document.userform.addRess.value=="") { document.userform.addRess.focus(); alert("Mailing address cannot be blank!"); return false; } if (document.userform.thePhone.value=="") { document.userform.thePhone.focus(); alert("Contact Phone cannot be blank!"); return false; } if(document.userform.registerFund.value!=""){ var reg = /^[0-9]*[1-9][0-9]*$/; var regg =/^\d*[.]\d*$/; if(!document.userform.registerFund.value.match(regg) && !document.userform.registerFund.value.match(reg)){ alert("The format for Registered is not correct."); document.userform.registerFund.focus(); return false; } } if(document.userform.webSite.value!=""){ } return true; } function checkformtwob() { if (document.userform.orgName.value=="") { document.userform.orgName.focus(); alert("Institution name cannot be blank!"); return false; } if(document.userform.registerFund.value!=""){ var reg = /^[0-9]*[1-9][0-9]*$/; var regg =/^\d*[.]\d*$/; if(!document.userform.registerFund.value.match(regg) && !document.userform.registerFund.value.match(reg)){ alert("The format for Registered is not correct. "); document.userform.registerFund.focus(); return false; } } if (document.userform.addRess.value=="") { document.userform.addRess.focus(); alert("Mailing address cannot be blank!"); return false; } if (document.userform.thePhone.value=="") { document.userform.thePhone.focus(); alert("Contact phone cannot be blank!"); return false; } if(document.userform.webSite.value!=""){ } return true; } function checkformtwoc() { if (document.userform.addRess.value=="") { document.userform.addRess.focus(); alert("Mailing address cannot be blank!"); return false; } if (document.userform.thePhone.value=="") { document.userform.thePhone.focus(); alert("Contact Phone cannot be blank!"); return false; } if(document.userform.webSite.value!=""){ } return true; } function checkmemberUpdate(){ if (document.myform.userName.value=="") { document.myform.userName.focus(); alert("Name cannot be blank."); return false; } var objForm=document.myform; var picUrl = document.getElementById("membHeadPic").value; if(picUrl != ""){ var picType = ",gif,jpg,jpeg,bmp,"; var ext = picUrl.substring(picUrl.lastIndexOf(".")+1, picUrl.length); if(picType.indexOf("," + ext.toLowerCase() + ",") == -1) { alert("Upload image format errors, currently only allows gif/jpg/jpeg/bmp format images!"); objForm.doc.focus(); return false; } var imgSizeChker = document.getElementById("imgSizeChecker"); if( imgSizeChker.fileSize == -1 || imgSizeChker.fileSize > 524288){ alert("Please upload the file size less than 512k members picture!"); return false; } } if (document.myform.onlyMail.value=="") { document.myform.onlyMail.focus(); alert("Email cannot be blank!"); return false; } if( strlen(document.userform.onlyMail.value)>30 ){ document.userform.onlyMail.focus(); alert("Email cannot exceed 30 characters!"); return false; } if(document.myform.onlyMail.value!=""){ var reg = /^([A-Za-z0-9])+(\.*\w)+@(\w)+(\.)(com$|com\.cn$|net$|cn|net\.cn$|org$|biz$|info$|gov$|gov\.cn$|edu$|edu\.cn$)/; //var reg = /^([A-Za-z0-9])(\w)+@(\w)+(\.)(com|com\.cn|net|cn|net\.cn|org|biz|info|gov|gov\.cn|edu|edu\.cn)/; if(!document.myform.onlyMail.value.match(reg)){ alert("A valid email address is required."); document.myform.onlyMail.focus(); return false; } } if (document.myform.addRess.value=="") { document.myform.addRess.focus(); alert("Mailing Address cannot be blank!"); return false; } if (document.myform.thePhone.value=="") { document.myform.thePhone.focus(); alert("Contact Phone cannot be blank!"); return false; } if (document.myform.orgName != undefined && document.myform.orgName.type != "hidden"){ if(document.myform.orgName.value=="") { document.myform.orgName.focus(); alert("Company Name cannot be blank!"); return false; } } if(document.myform.webSite.value!=""){ } return true; }