function echeck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ alert("Invalid E-mail") return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ alert("Invalid E-mail") return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ alert("Invalid E-mail") return false } if (str.indexOf(at,(lat+1))!=-1){ alert("Invalid E-mail") return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ alert("Invalid E-mail") return false } if (str.indexOf(dot,(lat+2))==-1){ alert("Invalid E-mail") return false } if (str.indexOf(" ")!=-1){ alert("Invalid E-mail") return false } return true } function checkForm(){ var d = document.thisform ; if ( d.firstname.value == '' ) { alert("You need to specifiy a First Name!"); d.firstname.focus(); return false; } if ( d.lastname.value == '' ) { alert("You need to specifiy a Last Name!"); d.lastname.focus(); return false; } if ( d.address1.value == '' ) { alert("You need to specifiy an Address!"); d.address1.focus(); return false; } if ( d.city.value == '' ) { alert("You need to specifiy a city!"); d.city.focus(); return false; } if ( d.state_code_us.value == '0' && d.state_code_cdn.value == '0' && d.state_code_int.value == '' ) { alert("You need to specifiy a state, province, county, territory, or region!"); return false; } if ( d.country.value == '0' ) { alert("You need to specifiy a country!"); d.country.focus(); return false; } if ( d.zip.value == '' ) { alert("You need to specifiy a zip!"); d.zip.focus(); return false; } if ( d.phone.value == '' ) { alert("You need to specifiy a home phone!"); d.phone.focus(); return false; } if ( d.email.value == '' ) { alert("You need to specifiy an email address!"); d.email.focus(); return false; } if ( echeck(d.email.value)==false ) { d.email.value = '' ; d.email.focus() ; return false ; } //gift if ( d.gift_order.checked == true ) { if ( d.gift_firstname.value == '' ) { alert("You need to specifiy a First Name!"); d.gift_firstname.focus(); return false; } if ( d.gift_lastname.value == '' ) { alert("You need to specifiy a Last Name!"); d.gift_lastname.focus(); return false; } if ( d.gift_address1.value == '' ) { alert("You need to specifiy an Address!"); d.gift_address1.focus(); return false; } if ( d.gift_city.value == '' ) { alert("You need to specifiy a city!"); d.gift_city.focus(); return false; } if ( d.gift_state_code_us.value == '0' && d.gift_state_code_cdn.value == '0' && d.gift_state_code_int.value == '' ) { alert("You need to specifiy a state, province, county, territory, or region!"); return false; } if ( d.gift_country.value == '0' ) { alert("You need to specifiy a country!"); d.gift_country.focus(); return false; } if ( d.gift_zip.value == '' ) { alert("You need to specifiy a zip!"); d.gift_zip.focus(); return false; } } //cc if ( d.cc_number.value == '') { alert("You need to specifiy a credit card number!"); d.cc_number.focus(); return false; } if ( d.cc_month.value == '' ) { alert("You need to specifiy a credit card expiration month!"); d.cc_month.focus(); return false; } if ( d.cc_year.value == '' ) { alert("You need to specifiy a credit card expiration year!"); d.cc_year.focus(); return false; } if ( d.cvv2.value == '' ) { alert("You need to specifiy a credit card security code number on back of card!"); d.cvv2.focus(); return false; } //subscription data var magazine_selected = false ; for ( var i = 0; i < d.productID.length; i++ ) { if ( d.productID[i].checked == true ) { magazine_selected = true ; break ; } } if ( magazine_selected == false ) { alert("Please select your subscription option!"); return false; } } function doStates(){ var d = document.thisform ; d.state_code_us.value = '0'; d.state_code_cdn.value = '0'; d.state_code_int.value = ''; var the_country_selected = d.country.value ; document.getElementById('Canadian_Provinces').style.display = 'none'; document.getElementById('Intl_States').style.display = 'none'; document.getElementById('US_States').style.display = 'none'; if (the_country_selected == 'United States') { document.getElementById('US_States').style.display = 'block'; } if (the_country_selected == 'Canada') { document.getElementById('Canadian_Provinces').style.display = 'block'; } if (( the_country_selected != 'Canada' && the_country_selected != 'United States' ) && the_country_selected != '0') { document.getElementById('Intl_States').style.display = 'block'; } if (( the_country_selected != 'Canada' && the_country_selected != 'United States' ) && the_country_selected == '0') { } } function doOldStates(){ var d = document.thisform ; d.old_state_code_us.value = '0'; d.old_state_code_cdn.value = '0'; d.old_state_code_int.value = ''; var the_country_selected = d.old_country.value ; document.getElementById('Old_Canadian_Provinces').style.display = 'none'; document.getElementById('Old_Intl_States').style.display = 'none'; document.getElementById('Old_US_States').style.display = 'none'; if (the_country_selected == 'United States') { document.getElementById('Old_US_States').style.display = 'block'; } if (the_country_selected == 'Canada') { document.getElementById('Old_Canadian_Provinces').style.display = 'block'; } if (( the_country_selected != 'Canada' && the_country_selected != 'United States' ) && the_country_selected != '0') { document.getElementById('Old_Intl_States').style.display = 'block'; } if (( the_country_selected != 'Canada' && the_country_selected != 'United States' ) && the_country_selected == '0') { } } function doGiftStates(){ var d = document.thisform ; d.gift_state_code_us.value = '0'; d.gift_state_code_cdn.value = '0'; d.gift_state_code_int.value = ''; var the_country_selected = d.gift_country.value ; document.getElementById('gift_Canadian_Provinces').style.display = 'none'; document.getElementById('gift_Intl_States').style.display = 'none'; document.getElementById('gift_US_States').style.display = 'none'; if (the_country_selected == 'United States') { document.getElementById('gift_US_States').style.display = 'block'; } if (the_country_selected == 'Canada') { document.getElementById('gift_Canadian_Provinces').style.display = 'block'; } if (( the_country_selected != 'Canada' && the_country_selected != 'United States' ) && the_country_selected != '0') { document.getElementById('gift_Intl_States').style.display = 'block'; } if (( the_country_selected != 'Canada' && the_country_selected != 'United States' ) && the_country_selected == '0') { } } function doGiftOrder(was_checked) { document.getElementById('div_gift_order').style.display = 'none' ; if ( was_checked == true ) { document.getElementById('div_gift_order').style.display = 'block' ; } }