// suckerfish menu
sfHover = function() {

	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	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 MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function updateSearchCats()
{
	r = document.getElementById("update_cats");
	v = document.searchGames.Console.options[document.searchGames.Console.options.selectedIndex].value;
	r.src = "update_cats.php?c=" + v;
}

function entercomments(prodcode)
{
	var url="comments.php?product_code="+prodcode;
	var msg=window.open(url,'CommentsWindow','width=400,height=230,resizable=no,scrollbars=no,status=no');
}

function viewhistory()
{
	var url="view_games_sent.php";
	var msg=window.open(url,'HistoryWindow','width=475,height=400,resizable=no,scrollbars=yes,status=no');
}

function checkValue(field,thingywotsit)
		{
				var temp = eval("document.contactForm."+field+".value;");
				if(temp=="" || temp==" " || temp=="Select Country")
				{
						alert("Please fill in your " + thingywotsit + ", and try again.");
						eval("document.contactForm."+field+".focus();");
						return false;
				} else {
						return true;
				}

		}

function checkForm()
{
		if(checkValue("name1","first friend name") && checkValue("email1","first friend email address"))
		{
				if(emailCheck(document.contactForm.email1.value))
				{
				document.contactForm.submit();
				} else {
						alert("Please fill in your friend email address, and try again.\nIf you have filled in your email address, check the '.' and '@' sign are correct, an email address will look something like this:\n\nyourname@somewhere.com                   or                  yourname@somewhere.co.uk\n");
						document.contactForm.email.focus();
				}
		}
}
