sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/* Email Signup */
function SendEmail(frm){
    var emailAddress="xxxatyy.com"
    var message = "Name:" + frm.txtName.value + "\n";
    message = message +"Phone:" +  frm.txtPhone.value;
    message = message +"\nEmail:" + frm.txtEmail.value;
    document.location.href = "mailto:"+'emailsignup@solutionstosavor.com'+"?subject=Order Product Catalog="+escape(message);
}

<!-- for form validation -->

function validate_form(theForm)
{
var reason = "";




  reason += validateEmpty(theForm.firstname,"First name");
  reason += validateEmpty(theForm.lastname, "Last name");
  reason += validateEmpty(theForm.address, "Address");
  reason += validateEmpty(theForm.City, "City");
  reason += validateEmpty(theForm.zip, "Zip Code");

  

        
  if (reason != "") {
    alert("Some requiered fields were not entered:\n\n" + reason);
    return false;
  }

  return true;
}


function validateEmpty(fld, wname) {
    var error = "";
  
    if (fld.value.length == 0) {
        fld.style.background = 'Pink'; 
        error = "The required "+wname+" field has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;   
}



function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
} 

function validateEmail(fld) {
    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
    
    if (fld.value == "") {
        fld.style.background = 'Yellow';
        error = "You didn't enter an email address.\n";
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        fld.style.background = 'Yellow';
        error = "Please enter a valid email address.\n";
    } else if (fld.value.match(illegalChars)) {
        fld.style.background = 'Yellow';
        error = "The email address contains illegal characters.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
}

function addToCart()
{
    var id = null;

    var classes = this.className.split( /\s+/ );
    for( var i = 0; i < classes.length; i++ ) {
	var cname = classes[i];
	if( cname.indexOf( 'id-' ) == 0 ) {
	    id = cname.substr( "id-".length );
	}
    }
    
    if( id != null ) {
	$( '#addToCart input[name=id]' ).val( id );
	$( '#addToCart' ).submit();
    }

    return false;
}

<!-- for form validation -->

function validate_form(theForm)
{
var reason = "";




  reason += validateEmpty(theForm.firstname,"First name");
  reason += validateEmpty(theForm.lastname, "Last name");
  reason += validateEmpty(theForm.address, "Address");
  reason += validateEmpty(theForm.City, "City");
  reason += validateEmpty(theForm.zip, "Zip Code");

  

        
  if (reason != "") {
    alert("Some requiered fields were not entered:\n\n" + reason);
    return false;
  }

  return true;
}


function validateEmpty(fld, wname) {
    var error = "";
  
    if (fld.value.length == 0) {
        fld.style.background = 'Pink'; 
        error = "The required "+wname+" field has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;   
}



function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
} 

function validateEmail(fld) {
    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
    
    if (fld.value == "") {
        fld.style.background = 'Yellow';
        error = "You didn't enter an email address.\n";
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        fld.style.background = 'Yellow';
        error = "Please enter a valid email address.\n";
    } else if (fld.value.match(illegalChars)) {
        fld.style.background = 'Yellow';
        error = "The email address contains illegal characters.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
}





$(document).ready( function () {

    $( '.selected-allergens input[type=button]' ).click( function () {
	    $( '.selected-allergens' ).hide();
	    $( '.select-allergens' ).show();
    });

    $( 'button.add-to-cart' ).click( addToCart );
});
