function go(form) {
   window.location = form.range.options[form.range.selectedIndex].value;

}
   
function preload_images () {
   var d = document;
	 if (!d.imgs) { d.imgs = new Array(); }
	 var j = d.imgs.length, args = preload_images.arguments, i;
	 for (i = 0; i < args.length; i++) {
		  d.imgs[j] = new Image;
			d.imgs[j].src = args[i];
			j++;
	 }
}


 function bookmark(title)
 {

   var urlAddress = location.href;
   var pageName = title;
   var browser = navigator.appName;

  if (browser == 'Microsoft Internet Explorer')
  {
     window.external.AddFavorite(urlAddress,pageName)
  }
  else if (browser == 'Netscape')
  { 
     alert("Your browser does not support this feature.  Use CTRL-D to bookmark this page");
  }
  else
  { 
   alert("Your browser does not support this feature.");
  }
 }

function hello()
{ alert("hello world"); }


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
 var i,p,v,obj,args=MM_showHideLayers.arguments;
 for (i=0; i<(args.length-2); i+=3) {
  if((obj=MM_findObj(args[i]))!=null) { 
   v=args[i+2];
   if (obj.style) { 
    obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
   }
   obj.visibility=v;
   if(v=='show') {
    obj.zIndex='10';
   } 
  }
 }
}

//Contents for menu 1
var menu1=new Array();
menu1[0]='  <span title="Miracle Food Powerhouse"><a href="/ShowView/product/20/1">Bee Pollen</a></span><br />';
menu1[1]='  <span title="Herbal Bleeder Aid"><a href="/ShowView/product/24/1">Breather Powder</a></span><br />';
menu1[2]='  <span title="Air-dried Granules"><a href="/ShowView/product/29/1">Bug Off Garlic</a></span><br />';
menu1[3]='  <span title="Fully Supported Vitamin C"><a href="/ShowView/product/54/1">C-Complex</a></span><br />';
menu1[4]='  <span title="Herbal/Vitamin Stress Free"><a href="/ShowView/product/116/1">Daily Calm</a></span><br />';
menu1[5]='  <span title="Enhanced Energy Production"><a href="/ShowView/product/59/1">DMG 5,600</a></span><br />';
menu1[6]='  <span title="Build Muscle, Burn Fat"><a href="/ShowView/product/63/1">Gamma</a></span><br />';
menu1[7]='  <span title="Whole Food, Wide Spectrum"><a href="/ShowView/product/84/1">Hoof & Coat Formula - (Trace Lytes)</a></span><br />';
menu1[8]='  <span title="Economical Joint Health"><a href="/ShowView/product/68/1">J-Flex Concentrate</a></span><br />';
menu1[9]='  <span title="Quick, Most Powerful"><a href="/ShowView/product/73/1">Joint Health Formula</a></span><br />';
menu1[10]='  <span title="Quick, Most Convenient"><a href="/product/354/2">Joint Health Treats</a></span><br />';
menu1[11]='  <span title="Powerful, Effective"><a href="/ShowView/product/282/1">Performance Paste</a></span><br />';
menu1[12]='  <span title="Green Food Blood Builder"><a href="/ShowView/product/79/1">Springtime GL</a></span><br />';
menu1[13]='  <span title="Popular Joint Health"><a href="/ShowView/product/112/1">Spirulina Wafers</a></span><br />';

//Contents for menu 2, and so on
var menu2=new Array();
menu2[0]='  <span title="Miracle Food Powerhouse"><a href="/ShowView/product/129/2">Bee Pollen</a></span><br />';
menu2[1]='  <span title="Air-dried Granules"><a href="/ShowView/product/148/2">Bug Off Garlic</a></span><br />';
menu2[2]='  <span title="Air-dried Garlic Chewables"><a href="/ShowView/product/35/2">Bug Off Garlic Chewables</a></span><br />';





menu2[3]='  <span title="Fully Supported Vitamin C"><a href="/ShowView/product/156/2">C-Complex</a></span><br />';
menu2[4]='  <span title="Whole Food Rejuvenator"><a href="/ShowView/product/88/2">Fresh Factors</a></span><br />';
menu2[5]='  <span title="Easy Economical Upgrade"><a href="/ShowView/product/457/2">Combo</a></span><br />';
menu2[6]='  <span title="Quick, Powerful Chewables"><a href="/ShowView/product/94/2">Joint Health Chewables</a></span><br />';
menu2[7]='  <span title="Quick, Powerful Powder"><a href="/ShowView/product/131/2">Joint Health Formula</a></span><br />';
menu2[8]='  <span title="Centerpiece Whole Food Formula"><a href="/ShowView/product/121/2">Longevity</a></span><br />';
menu2[9]='  <span title="Complete Full Spectrum"><a href="/ShowView/product/500/2">Omega 3-6-9</a></span><br />';
menu2[10]='  <span title="Herbal/Vitamin Formula"><a href="/ShowView/product/100/2">Stress Free Calmplex</a></span><br />';


//Contents for menu 3
var menu3=new Array();
menu3[0]='  <span title="Miracle Food Powerhouse"><a href="/ShowView/product/12/3">Bee Pollen for People</a></span><br />';
menu3[1]='  <span title="Heart Health, Weight Loss, Stamina"><a href="/ShowView/product/39/3">CoQ10</a></span><br />';
menu3[2]='  <span title="Quick, Powerful"><a href="/ShowView/product/47/3">Joint Health Capsules</a></span><br />';
menu3[3]='  <span title="Energy, Weight Loss"><a href="/ShowView/product/125/3">Spirulina Tablets</a></span><br />';
menu3[4]='  <span title="Complex and Powerful Herbal/Vitamin Formula"><a href="/ShowView/product/50/3">Tonic Blend</a></span><br />';


var menuwidth='200px'; //default menu width
var menubgcolor='lightyellow'; //menu bgcolor
var disappeardelay=250; //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes"; //hide menu when user clicks within menu?

//alert("menu contents : " + menucontents.value);

/////No further editting needed

var ie4=document.all;
var ns6=document.getElementById&&!document.all;

if(ie4||ns6) {
 document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+';position:absolute;border:1px solid black;font:normal 11px Verdana;line-height:18px;z-index:5;display: block;" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>');
}

function getposOffset(what, offsettype) {
 var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
 var parentEl=what.offsetParent;
 while (parentEl!=null) {
  totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
  parentEl=parentEl.offsetParent;
 }
 return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth, menucat) {
 if(ie4||ns6) {
  dropmenuobj.style.left=dropmenuobj.style.top=-500;
 }
 if(menuwidth!="") {
  dropmenuobj.widthobj=dropmenuobj.style;
  dropmenuobj.widthobj.width=menuwidth;
 }
 if (menucat=="cat1") {
/*  document.getElementById("dropmenudiv").style.background="#FFCCCC";*/
  document.getElementById("dropmenudiv").style.background="#FFFFFF";
document.getElementById("dropmenudiv").style.zIndex="500";
 }
 if (menucat=="cat2") {
/*  document.getElementById("dropmenudiv").style.background="#99FF99";*/
  document.getElementById("dropmenudiv").style.background="#FFFFFF";
 }
 if (menucat=="cat3") {
/*  document.getElementById("dropmenudiv").style.background="#66DDFF";*/
  document.getElementById("dropmenudiv").style.background="#FFFFFF";
 }
 if(e.type=="click" && obj.visibility==hidden || e.type=="mouseover") {
  obj.visibility=visible;
  if(document.getElementById('child_prods')) {
   document.getElementById('child_prods').style.display = 'none';
  }
 } else if (e.type=="click") {
  obj.visibility=hidden;
  if(document.getElementById('child_prods')) {
   document.getElementById('child_prods').style.display = 'inline';
  }
 }
}

function iecompattest() {
 return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function clearbrowseredge(obj, whichedge) {
 var edgeoffset=0;
 if(whichedge=="rightedge") {
  var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15;
  dropmenuobj.contentmeasure=dropmenuobj.offsetWidth;
 }
 if(windowedge-dropmenuobj.x < dropmenuobj.contentmeasure) {
  edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth;
 } else {
  var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
  dropmenuobj.contentmeasure=dropmenuobj.offsetHeight;
  if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure) {
   edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight;
  }
  return edgeoffset;
 }
}

function populatemenu(what){
 if (ie4||ns6) {
  dropmenuobj.innerHTML=what.join("");
 }
}


function dropdownmenu(obj, e, menucontents, menuwidth, menucat) {
 if(window.event) {
  event.cancelBubble=true;
 } else if (e.stopPropagation) {
  e.stopPropagation();
 }
 clearhidemenu();
 dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv;
 populatemenu(menucontents);

 if (ie4||ns6) {
  showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth, menucat);
  dropmenuobj.x=getposOffset(obj, "left");
  dropmenuobj.y=getposOffset(obj, "top");
  dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px";
  dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px";
 }

 return clickreturnvalue();
}

function clickreturnvalue() {
 if (ie4||ns6) { 
  return false;
 } else { 
  return true;
 }
}

function contains_ns6(a, b) {
 while (b.parentNode) {
  if ((b = b.parentNode) == a) {
   return true;
   return false;
  }
 }
}

function dynamichide(e) {
 if (ie4&&!dropmenuobj.contains(e.toElement)) {
  delayhidemenu();
 } else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget)) {
  delayhidemenu();
 }
}

function hidemenu(e) {
 if (typeof dropmenuobj!="undefined") {
  if (ie4||ns6) {
   dropmenuobj.style.visibility="hidden";
   if(document.getElementById('child_prods')) {
    document.getElementById('child_prods').style.display = 'inline';
   }
  }
 }
}

function delayhidemenu() {
 if (ie4||ns6) {
  delayhide=setTimeout("hidemenu()",disappeardelay);
 }
}

function clearhidemenu() {
 if (typeof delayhide!="undefined") {
  clearTimeout(delayhide);
 }
}

if (hidemenu_onclick=="yes") {
 document.onclick=hidemenu;
}

/*   ***************************
     * Free product JavaScript *
     ***************************   */

freeProds = new Array (
 'Horse Products:',
 ' - Breather Powder - 10 oz', 
 ' - Bug Off Garlic - 5 lb', 
 ' - Daily Calm - 14 oz', 
 ' - DMG 5,600 - 30 oz', 
 ' - Springtime Gamma - 1/2 gal', 
 ' - J-Flex Concentrate - 6 oz',
 ' - Joint Health Treats - 1 jar of 200\'s', 
 ' - Performance Paste - 3 tubes', 
 ' - Spirulina Wafers - 2 jars of 180\'s', 
 ' - Springtime GL - 16 oz',
 ' - Hoof and Coat - 3 lb',
 'Dog Products:',
 ' - Springtime Bee Pollen for Dogs - 3 lb', 
 ' - Bug Off Garlic for Dogs - 2 jars of 2.5 lb', 
 ' - Bug Off Garlic Chewables - 2 jars of 180\'s', 
 ' - C-Complex - 1.4 lb', 
 ' - Fresh Factors - 2 jars of 90\'s', 
 ' - Joint Health Chewables - 2 jars of 90\'s', 
 ' - Joint Health Formula - 1 lb', 
 ' - Longevity - 1.4 lb', 
 ' - Omega 3-6-9 - 1 jar of 200\'s', 
 ' - Stress Free Calmplex - 2 jars of 180\'s', 
 ' - Combo - 1 jar each of 90ct Fresh Factors & Joint Health Chewables', 
 'People Products:',
 ' - Springtime Bee Pollen for People - 3 lb',  
 ' - Springtime CoQ10 - 1 jar of 90\'s',    
 ' - Joint Health Capsules - 1 jar of 180\'s', 
 ' - Spirulina Tablets - 1 jar of 360\'s', 
 ' - Tonic Blend - 1 jar of 80\'s'
);

freeProdIds = new Array (
 '',
 '287',
 '288',
 '289',
 '290',
 '291',
 '292',
 '369',
 '294',
 '295',
 '296',
 '297',
 '',
 '298',
 '497',
 '300',
 '301',
 '302',
 '303',
 '304',
 '305',
 '504',
 '306',
 '491',
 '',
 '307',
 '309',
 '313',
 '314',
 '490'
);


freeProdSkus = new Array (
 '',
 '17010F',
 '43005F',
 '13014F',
 '19030F',
 '42001F',
 '16006F',
 '52200F',
 '14060F',
 '51180F',
 '45012F',
 '12003F',
 '',
 '11003F',
 '43001F',
 '43180F',
 '48014FF',
 '24090F',
 '49090F',
 '49001F',
 '50014F',
 '46180F',
 '90090F',
 '',
 '21003F',
 '23030F',
 '27090F',
 '29180F',
 '45012F',
 '28180F',
 '30360F',
 '26080F'
);

// ************ [ Do not edit below this line. ] ************

function populateProds(total,cur) {
 var intProds = freeProds.length, twoInOne = ''; // twoInOne is the index of the product that counts as 2
 var pid = freeProdIds[0], sku = freeProdSkus[0];
 var cntProds = 0;
 for(var i = 0;i<intProds;i++) {
  var modCount = cur % 2;
  if((total == '1' || (total == '2' && modCount == '0') || (total > 2 && modCount == '1') || total == cur) && i == twoInOne) {
   var skip = true;
  } else {
   var skip = false;
  }
  if(!skip) {
   prodsBox = document.getElementById('free_prods'+cur);
   prodsBox.options[prodsBox.options.length] = new Option(freeProds[i],freeProdIds[i]+'.'+freeProdSkus[i]);
   if(freeProds[i].substr(0, 3) != ' - ') {
    prodsBox.options[+prodsBox.options.length - 1].style.fontWeight = 'bold';
   }
  }
  cntProds++;
 }
}

function populateForm(prod,total,cur,first) {
 var prod = prod.split('.'), pid = prod[0], sku = prod[1];
 var twoInOne = '';
 var cur2 = +cur + 1, modCount = cur % 2;
 var dropBox = document.getElementById('free_prods'+cur2);
 var dropDiv = document.getElementById('dropDiv'+cur2);
 if(pid == twoInOne) {
  document.getElementById('zz-qty'+cur2).name = '';
  document.getElementById('zz-sku'+cur2).name = '';
  document.getElementById('zz-qty'+cur2).value = '';
  document.getElementById('zz-sku'+cur2).value = '';
  dropBox.style.display = 'none';
 } else if(cur2 <= total && dropBox.style.display == 'none') {
  dropBox.style.display = 'inline';
  dropBox.options[0].selected = true;
 }
}

function submitForm() {
 var cntItems = document.free_products.length;
 var qty = 0, freeProdQtys = new Array();
 for(var i=0;i<cntItems;i++) {
  var formItem = document.free_products.elements[i];
  if(formItem.name == 'free_prods' && formItem.value == '' && formItem.style.display != 'none') {
   alert("You still have FREE products left to choose!");
   return false;
  }
 }
 for(var i=0;i<cntItems;i++) {
  var formItem = document.free_products.elements[i];
  var formItemValue = 'document.free_products';
  var prod = formItem.value.split('.');
  var pid = prod[0], sku = prod[1];
  if(formItem.name == 'free_prods' && formItem.value != '' && formItem.style.display != 'none') {
   var cntIds = freeProdIds.length;
   for(var x=0;x<cntIds;x++) {
    if(freeProdIds[x] == pid) {
     freeProdQtys[qty] = pid;
     qty++;
    }
   }
  }
 }
 for(var i=0;i<freeProdQtys.length;i++) {
  if(eval('document.free_products.qty'+freeProdQtys[i])) {
   var isThere = true;
  } else {
   var isThere = false;
  }
  if(!isThere) {
   var x = +i+1;
   document.getElementById('zz-qty'+x).name = 'qty'+freeProdQtys[i];
   document.getElementById('zz-qty'+x).value = '0';
   document.getElementById('zz-qty'+x).id = 'qty'+freeProdQtys[i];
   if(document.getElementById('qty'+freeProdQtys[i]).value != 0) {
    document.getElementById('qty'+freeProdQtys[i]).value = '0'; // IE Fix
   }
  }
  var qty = document.getElementById('qty'+freeProdQtys[i]);
  qty.value = parseInt(qty.value) + 1;
 }
 return true;
}

function checkoutConfirm() {
 if(confirm('There are still FREE products left to choose.  Are you sure you wish to checkout without selecting your FREE products?')) {
  return true;
 } else {
  return false;
 }
}

// ************* [ End free prod javascript ] *************


function macIE() {
 var macPattern = /mac/i;
 var macIEPattern = /MSIE/i;
 if(macPattern.exec(navigator.userAgent) != null && macIEPattern.exec(navigator.userAgent) != null) {
  if(!getCookie('alreadySeen')) {
   alert("Some features of this site are not compatible with the browser you are using.\n\nFor Macintosh users, it is highly recommended that you use either Safari or Mozilla FireFox when browsing our site.");
   setCookie('alreadySeen',true);
  }

 }

}

/* The functions below are cookie functions which can be used for anything site-wide but
   are intended (at the moment) to be used for the dynamic cart quantities */

function getCookie(Name) {
 var search = Name + "=";
 var returnvalue = "";
 if (document.cookie.length > 0) {
  offset = document.cookie.indexOf(search)
  // if cookie exists
  if (offset != -1) { 
  offset += search.length
  // set index of beginning of value
  end = document.cookie.indexOf(";", offset);
  // set index of end of cookie value
  if (end == -1) end = document.cookie.length;
  returnvalue=unescape(document.cookie.substring(offset, end))
 }
}
 return returnvalue;
}

function setCookie(name,num){
 //set document cookie
 document.cookie=name+"="+num;
}

function isCookied(name,num) {
 if (getCookie(name)!=num) {
  return true;
 } else {
  return false;
 }
}

/* End Cookie Functions */

/* checkStates function
   checks the state fields in the checkout to see if they're blank */

function checkStates(theForm) {
  if(theForm.elements.length > 0) {
    for(var i=0,n=theForm.elements.length;i<n;i++) {
      if(theForm.elements[i].name.match(/state/i) && theForm.elements[i].value == '') {
        alert('Please select your state.');
        return false;
      }
    }
  }
  /* zip code stuff */
  if(typeof theForm.elements['s_zip1'] != 'undefined') { // shipping form
    if(theForm.elements['s_zip1'].value.length < '5' && theForm.elements['s_country1'].value == 'United States') {
      alert('Please enter a valid Postal Code.');
      return false;
    }
  } else if(typeof theForm.elements['billing_zip'] != 'undefined') { // shipping form
    if(theForm.elements['billing_zip'].value.length < '5' &&
       theForm.elements['billing_country'].value == 'United States') {
      alert('Please enter a valid Postal Code.');
      return false;
    }
  }
  return true; // if we get this far
}

/* Disable form submit button */
function disableSubmit(buttonId)
{
    document.getElementById(buttonId).value = "Processing...";
    document.getElementById(buttonId).disabled = true;
}