
//navigation rollovers
function load(defImg) {
	document.getElementById(defImg).src=("/allergens/i/topnav/nav_" + defImg + "_on.jpg");
}

sfHover = function() {
	var sfEls = document.getElementById("topNav").getElementsByTagName("a");
	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);

// function: show / hide menu
function showMenu(menuId) {
	document.getElementById(menuId).style.display="";
}

function hideMenu(menuId) {
	document.getElementById(menuId).style.display="none";
}

// function: show / hide tabs
function showTab(tabId) {
	document.getElementById('tab1').style.display="none";
	document.getElementById('tab2').style.display="none";
	document.getElementById('tab3').style.display="none";
	document.getElementById('tab4').style.display="none";
	document.getElementById('tab1a').style.display="none";
	document.getElementById('tab2a').style.display="none";
	document.getElementById('tab3a').style.display="none";
	document.getElementById('tab4a').style.display="none";
	document.getElementById('tab1b').style.display="inline";
	document.getElementById('tab2b').style.display="inline";
	document.getElementById('tab3b').style.display="inline";
	document.getElementById('tab4b').style.display="inline";
	document.getElementById(tabId+'b').style.display="none";
	document.getElementById(tabId+'a').style.display="inline";
	document.getElementById(tabId).style.display="block";
}

// function: clear form field
function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = "";
  el.setAttribute('maxLength','5');
}

window.onerror=null;
var win = null;
function PopWindow(mypage,myname) {
	//closePopWin();
	winprops = 'height=500,width=820,top=30,left=0,scrollbars=1,resizable=1,status=1';
	win = window.open(mypage, myname, winprops);
	}
function SizedPopWindow(mypage,myname,w,h) {
	//closePopWin();
	winprops = 'height='+h+',width='+w+',top=30,left=0,scrollbars=1,resizable=1,status=1';
	win = window.open(mypage, myname, winprops);
	}
function closePopWin() {
	if(win != null) { 
		if(!win.closed) { 
			win.close();
			win = null;
			} else {
			win = null;
			}
		}	
	}