// JavaScript Document function checkBrowser() { // returns true if using Netscape 3+ or MSIE 4+, else returns false browseapp = navigator.appName; vers = navigator.appVersion; if( ( browseapp.indexOf( "Netscape" ) >= 0 ) && ( vers.substring( 0, 1 ).indexOf( "5" ) >= 0 ) ) return 1; else if( ( browseapp.indexOf( "Netscape" ) >= 0 ) && ( vers.substring( 0, 1 ).indexOf( "4" ) >= 0 ) ) return 1; else if( ( browseapp.indexOf( "Netscape" ) >= 0 ) && ( vers.substring( 0, 1 ).indexOf( "3" ) >= 0 ) ) return 1; else if( ( browseapp.indexOf( "Microsoft" ) >= 0 ) && ( vers.substring( 0, 1 ).indexOf( "5" ) >= 0 ) ) return 1; else if( ( browseapp.indexOf( "Microsoft" ) >= 0 ) && ( vers.substring( 0, 1 ).indexOf( "4" ) >= 0 ) ) return 1; else if( ( browseapp.indexOf( "Microsoft" ) >= 0 ) && ( vers.substring( 0, 1 ).indexOf( "2" ) >= 0 ) && ( vers.charAt( 22 ) == "3" ) ) return 0; else if( ( browseapp.indexOf( "Microsoft" ) >= 0 ) && ( vers.substring( 0, 1 ).indexOf( "3" ) >= 0 ) ) return 0; else // if using really old or non-MS/Netscape browser, return false return 0; } if( checkBrowser() ) { // navbar preloads here var home_on=new Image(53,91); home_on.src="images/home_on.gif"; var faq_on=new Image(46,91); faq_on.src="images/faq_on.gif"; var register_on=new Image(81,91); register_on.src="images/register_on.gif"; // recipe nav preloads var recipes_on=new Image(62,91); recipes_on.src="images/recipes_on.gif"; var recipes_appson=new Image(62,91); recipes_appson.src="images/recipes_appson.gif"; var recipes_mainson=new Image(62,91); recipes_mainson.src="images/recipes_mainson.gif"; var recipes_sideson=new Image(62,91); recipes_sideson.src="images/recipes_sideson.gif"; var recipes_saladson=new Image(62,91); recipes_saladson.src="images/recipes_saladson.gif"; var recipes_sandson=new Image(62,91); recipes_sandson.src="images/recipes_sandson.gif"; // prodinfo nav preloads var prodinfo_on=new Image(89,91); prodinfo_on.src="images/prodinfo_on.gif"; var prodinfo_bmilkon=new Image(89,91); prodinfo_bmilkon.src="images/prodinfo_bmilkon.gif"; var prodinfo_wchedon=new Image(89,91); prodinfo_wchedon.src="images/prodinfo_wchedon.gif"; var prodinfo_spicyon=new Image(89,91); prodinfo_spicyon.src="images/prodinfo_spicyon.gif"; var prodinfo_newon=new Image(89,91); prodinfo_newon.src="images/prodinfo_newon.gif"; var prodinfo_existon=new Image(89,91); prodinfo_existon.src="images/prodinfo_existon.gif"; // about nav preloads var abcon_abon=new Image(139,91); abcon_abon.src="images/abcon_abon.gif"; var abcon_conon=new Image(139,91); abcon_conon.src="images/abcon_conon.gif"; var about_histon=new Image(139,91); about_histon.src="images/about_histon.gif"; var about_mileson=new Image(139,91); about_mileson.src="images/about_mileson.gif"; var about_bioon=new Image(139,91); about_bioon.src="images/about_bioon.gif"; var about_annivon=new Image(139,91); about_annivon.src="images/about_annivon.gif"; } function senseOne(imgName,fileName) { if (document.images && checkBrowser()) document[imgName].src="images/"+fileName+".gif"; } function senseTwo(imgName,fileName,imgNamea,fileNamea) { if (document.images && checkBrowser()) { document[imgName].src="images/"+fileName+".gif"; document[imgNamea].src="images/"+fileNamea+".gif"; } } // ##################################################################################################### // **** Function to format phone number function formatPhone( phone ) { var num = phone.value; var newnum = ""; var output = ""; // strip out non-numbers for ( var i = 0; i < num.length; i++ ) if ( num.charAt( i ).match(/\d/) ) newnum += num.charAt( i ); if ( newnum ) { // rebuild number with hyphen for ( var i = 0; i < 10; i++ ) { output += newnum.charAt( i ) if ( i == 2 || i == 5) output += "-"; } } // return value phone.value = output; } // ***** Validation --- Contact US Form function validateContactFields(curform) { var emailTMP = new String( curform.email.value ) ; // --- Don't allow message to be submitted 2 x or more .. if (curform.SentFlag.value == "1") { window.alert("Message has already been submitted, please Refresh Page to send a new message. Thank You." ); return false }; if ( curform.title.selectedIndex < 1 ) { window.alert( "Please select your title." ) ; curform.title.focus() ; return false ; } if ( curform.firstname.value == "" ) { window.alert( "Please enter your first name." ) ; curform.firstname.focus() ; return false ; }; if ( curform.lastname.value == "" ) { window.alert( "Please enter your last name." ) ; curform.lastname.focus() ; return false ; }; if ( emailTMP == "" ) { window.alert( "Please enter your E-Mail Address." ) ; curform.email.focus() ; return false ; } if ( emailTMP.indexOf( "@" ) == -1 ) { window.alert( "Please enter a valid E-mail Address." ) ; curform.email.focus() ; return false ; } if ( emailTMP.indexOf( " " ) != -1 ) { window.alert( "Please enter a valid E-mail Address (spaces are not allowed)." ) ; curform.email.focus() ; return false ; } if ( emailTMP.indexOf( "." ) == -1 ) { window.alert( "Please enter a valid E-mail Address (domain name must have a top level extension, ie .com, .net)." ) ; curform.email.focus() ; return false ; }; // -- Format phone number if( curform.phone.value != "" ) { formatPhone( curform.phone ); if( !curform.phone.value.match(/^\d\d\d\-\d\d\d\-\d\d\d\d$/) ) { alert("Please enter a valid phone number \n\n Format: XXX-XXX-XXXX"); curform.phone.select(); return false ; }; } if ( curform.address.value == "" ) { window.alert( "Please enter your address." ) ; curform.address.focus() ; return false ; } if ( curform.city.value == "" ) { window.alert( "Please enter your city." ) ; curform.city.focus() ; return false ; } if ( curform.zipcode.value == "" ) { window.alert( "Please enter you zip/postal code." ) ; curform.zipcode.focus() ; return false ; } if ( curform.state.selectedIndex < 1 ) { window.alert( "Please select you state/province." ) ; curform.state.focus() ; return false ; } if ( curform.subject.selectedIndex < 1 ) { window.alert( "Please select what you would like to tell us?" ) ; curform.subject.focus() ; return false ; } if ( curform.productSelect.selectedIndex < 1 ) { window.alert( "Please select the product purchased." ) ; curform.productSelect.focus() ; return false ; } if ( curform.comments.value == "" ) { window.alert( "Please enter your questions/comments." ) ; curform.comments.focus() ; return false ; } curform.SentFlag.value = "1"; document.forms[0].submit() ; }