0byt3m1n1
Path:
/
data
/
17
/
1
/
18
/
11
/
1670011
/
user
/
1801231
/
htdocs
/
tanningonline_com
/
[
Home
]
File: application.js
function trim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); } function confirmBox(message){ var myMessage = confirm(message) return myMessage; } function emailCheck(str){ var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) // check if string contains @sign if (str.indexOf(at)==-1){ return false } // check if @sign not at beginning of string if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false } // check if period not at beginning of string if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false } if (str.indexOf(at,(lat+1))!=-1){ return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false } if (str.indexOf(dot,(lat+2))==-1){ return false } if (str.indexOf(" ")!=-1){ return false } return true }// end function emailCheck function validate_catalog(){ var error = ''; myForm = document.getElementById('catalog_form'); if (trim(myForm.contact_name.value) == '') error += " - Contact Name\n"; if (!emailCheck(myForm.email.value)) error += " - Email is invalid\n"; if (trim(myForm.phone.value) == '') error += " - Phone\n"; if (trim(myForm.fax.value) == '') error += " - Fax\n"; if (trim(myForm.street_address.value) == '') error += " - Street Address\n"; if (trim(myForm.city.value) == '') error += " - City\n"; if (trim(myForm.zip.value) == '') error += " - Zip\n"; if (trim(myForm.salon_name.value) == '') error += " - Salon Name\n"; if (trim(myForm.your_title.value) == '') error += " - Your Title\n"; if (error != ''){ alert("Please fill in the require fields:\n"+error); }else{ myForm.submit(); } }