//Regexp for testing email addy validity
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
var tld = '';

// ------------------------- Begin sf

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);


// ------------------------- End sf

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// Form validation
function CkAskForCaraB() {

  var IsChecked = false;
  for (var i=0; i < document.frm25.RetailOutlets.length; i++){
    if(document.frm25.RetailOutlets[i].checked){
    IsChecked = true;
    break;
    }
  }
  if (!IsChecked){
  alert('Please identify retail stores where you shop.');
  return(false);
  }
  
  if(document.frm25.RetailOutlets[6].checked) {
	   if(document.frm25.RetailOutletsOther.value.length <= 0){
		alert('You\'ve indicated other retail. Please enter the names of those stores.');
		document.frm25.RetailOutletsOther.focus();
		return false;	   
	   } 
  }
  if(document.frm25.ZipCode.value.length <= 0){
  alert('Please enter your zip code.');
  document.frm25.ZipCode.focus();
  return false;
  }
  if(document.frm25.wordvar.value.length <= 5){
  alert('Please enter the word verification code.');
  document.frm25.wordvar.focus();
  return false;
  }  
 }


function CkZipCodeSearch() {
  if(document.frmStoreLocatorZipSearch.zip.value.length <= 4){
  alert('Please enter a 5-digit zip code to perform a search.');
  document.frmStoreLocatorZipSearch.zip.focus();
  return false;
  }
}

function CkWholesalePay(){
  if(document.frmWholesalePay.invno.value.length <= 0){
  alert('Please enter an invoice number.');
  document.frmWholesalePay.invno.focus();
  return false;
  }
  if(document.frmWholesalePay.dollars.value.length <= 0){
  alert('Please enter an amount you wish to pay.');
  document.frmWholesalePay.dollars.focus();
  return false;
  }
  if(document.frmWholesalePay.dollars.value.length > 0){
   var sText = document.frmWholesalePay.dollars.value
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;
   for (i=0; i<sText.length  && IsNumber == true; i++){
     Char = sText.charAt(i);
	 if (ValidChars.indexOf(Char) == -1){ 
	   alert('Please enter only numbers in the dollars/cents fields');
       document.frmWholesalePay.dollars.select();
	   return false;
	  }
	 }
  }  
}
