navHover = function() {

	var lis = document.getElementById("navmenu").getElementsByTagName("LI");

	for (var i=0; i<lis.length; i++) {

		lis[i].onmouseover=function() {

			this.className+=" iehover";

		}

		lis[i].onmouseout=function() {

			this.className=this.className.replace(new RegExp(" iehover\\b"), "");

		}

	}

}

if (window.attachEvent) window.attachEvent("onload", navHover);

//Height of new buy now window
var buyNowWindowWidth = 600;

//Width of new buy now window
var buyNowWindowHeight = 700;

var links = document.getElementsByTagName('a');
for(var i = 0 ; i < links.length ; i++) {
	var image = links[i].getElementsByTagName('img');
	if(image.length > 0) {
		//alert(image[0].getAttribute('src'));
	  if(image[0].getAttribute('src').indexOf('images/buynow.gif') != -1) {
	    links[i].onclick = buyNowNewWindow;
	    //alert('assign onclick');
	  }
	}
}

function buyNowNewWindow(ev) {
	var link = getTargetFromEvent(ev).parentNode;
	window.open(link.getAttribute('href'),'TheGameMonsters','width='+buyNowWindowWidth+',height='+buyNowWindowHeight+',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=yes,resizable=yes');
	return false;
}

function getTargetFromEvent(ev) {
	var targ;
	if (!ev) var ev = window.event;
	if (ev.target) targ = ev.target;
	else if (ev.srcElement) targ = ev.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
	return targ;
}

