// MARTEK Globals

function calculate() { // written by Jerald Dawson 7-25-2000
  var numItems = document.item_form.total_items.value;
  var totalDHA = 0;
  var DHA;
  var item;
  
  for (i=1; i<=numItems; i++) {
    item = eval("document.item_form.dha_content" + i);
    if (item) {
		if (item.checked == true) {
		  DHA = parseFloat(item.value); 
		  totalDHA = totalDHA + DHA;
		 
		}
	}
  }
  //alert(totalDHA);
  if (totalDHA==0) {
		alert('The items you have selected do not contain DHA.');
		document.item_form.total2.value = "0";
	}
  else {
  	document.item_form.total2.value = totalDHA;
  }
}

function popWin(fileName) {
     myWin = window.open('','myWindow','directories=no,status=no,resizable=no,toolbar=no,copyhistory=no,location=no,menubar=no,width=518,height=375,scrollbars=yes,top=10,left=10')
     myWin.location.href = fileName;
}

var currActiveP = null;
var currActiveC = null;
function activeNav(parent) { /* TO 'STICKY' THE MAIN NAV ITEM */
		//alert('hit');
		if(currActiveP!==null && currActiveP!==parent) {
			//Effect.BlindUp(currActiveC);
			document.getElementById(currActiveC).style.display="none";
			navOn(currActiveP);
		}
		if (currActiveP!==parent) {
			navOn(parent);
			//Effect.BlindDown(parent+"_sub");
			document.getElementById(parent+"_sub").style.display="block";
			currActiveP = parent;
			currActiveC = parent+"_sub";
			setTimeout("clearNav()",3000);
		}
}
function clearNav() {
	//alert('hit');
	if(currActiveP!==null) {
			//Effect.BlindUp(currActiveC);
			document.getElementById(currActiveC).style.display="none";
			navOn(currActiveP);
			currActiveP = null;
			currActiveC = null;
	}	
}

var currActiveP2 = null;
var currActiveC2 = null;
function activeNav2(el) { /* TO 'STICKY' THE MAIN NAV ITEM */
		//alert(currActiveP2);
		if(currActiveP2!==null && currActiveP2!==el) {
			document.getElementById(currActiveP2).className="";
			document.getElementById(currActiveC2).style.display="";
			//Effect.BlindUp(currActiveC2);
		
		//document.getElementById(el).className=(document.getElementById(el).className=='sub_active') ? '': 'sub_active';
		}
		//document.getElementById(el).className=(document.getElementById(el).className=='sub_active') ? '': 'sub_active';
		var obj = el+"_sub";
		document.getElementById(obj).style.display=(document.getElementById(obj).style.display=='block')? '': 'block';
		currActiveP2 = el;
		currActiveC2 = obj;
}
function clearNav2() {
	//alert(currActiveP2);
	if(currActiveP2!==null) {
			//document.getElementById(currActiveP2).className="";
			document.getElementById(currActiveC2).style.display="";
			//Effect.BlindUp(currActiveC2);
			//if(currActiveP2!==el) {
				//document.getElementById(currActiveP2).className="";
			//}
			currActiveP2 = null;
			currActiveC2 = null;
	}	
}



function navOn(el) { /* TO 'STICKY' THE MAIN NAV ITEM */
		document.getElementById(el).className=(document.getElementById(el).className=='nav_wSub')?'':'nav_wSub';
	}
function navOn2(el) { /* TO 'STICKY' THE MAIN NAV ITEM */
		document.getElementById(el).className=(document.getElementById(el).className=='tempA_nav_active') ? 'tempA':'tempA_nav_active';
	}

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

sfHover2 = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	//var isOpen=false;
	
	for (var i=0; i<sfEls.length; i++) {
		//alert(sfEls.length);
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
			//isOpen=true;
			
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover2\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover2);


function myResolution() {
	//alert(document.body.clientWidth);
	if (document.body.clientWidth < 850) {
		//alert("Small, yo...");
		document.getElementById('header_search').style.left= 600 + "px";
		document.getElementById('header_breadcrumbs').style.left= 375 + "px";
		document.getElementById('header_business_section').style.width= 786 + "px";
		document.getElementById('content_header').style.width= 540 + "px";
		document.getElementById('content_body').style.width= 530 + "px";
	}
}
window.onload=function(){
 myResolution();
 currActiveP2 = null;
 currActiveC2 = null;
}
