function addLoadEvent(func) {
 var oldonload = window.onloadl
  if (typeof window.onload != 'function') {
   window.onload = func;
   } else {
  window.onload = function(){
   oldonload();
   func();
  }
 }
}



function prepareLinkPop() {
	
 if (!document.getElementsByTagName) return false;
 if (!document.getElementById) return false;	
 if (!document.getElementById("products")) return false;
 var ImagePop = document.getElementById("products");
 var links = ImagePop.getElementsByTagName("a");

for (var i = 0; i < links.length; i++){
  links[i].onclick = function(){
   return popWin(this);
  }
 }
}
function popWin(whichLink){

	if (whichLink.getAttribute("href")) {
		var source = whichLink.getAttribute("href");		
			// Don't laugh, it works in absence of inherent support for getElementByClass in DOM
			if  ((source == "http:\/\/www.allstarfire.com/product.php#top") || (source == "#top")) {
			popsvar.focus();				
			}
			//alert("source = "+source  ); 
		
	} else {
		source = "";
	}
	
	/* var source = whichpic.getAttribute("href");	 */

	if (whichLink.getAttribute("id")) {
		var  title= whichLink.getAttribute("id");
	} else {
		var text = "";
	}




    var popsvar;
	popsvar=window.open(source,title,'height=400,width=550,left=15,top=15,screenX=15,screenY=15,toolbar,location,scrollbars,menubar,resizable,status');
    popsvar.focus();
	return false;
}


/*
son of suckerfish menu script from:
http://www.htmldog.com/articles/suckerfish/dropdowns/
 */
 
 sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
			this.style.zIndex=200; //this line added to force flyout to be above relatively positioned stuff in IE
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

addLoadEvent(prepareLinkPop);

