sfHover = function()
{
	var sfEls = document.getElementById("topnav").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 checkForm(ppform)
{
	var quant = new Array(document.getElementById("quantity_1"),
						  document.getElementById("quantity_2"),
						  document.getElementById("quantity_3"),
						  document.getElementById("quantity_4"),
						  document.getElementById("quantity_5"),
						  document.getElementById("quantity_6"),
						  document.getElementById("quantity_7"),
						  document.getElementById("quantity_8"),
						  document.getElementById("quantity_9"));
	if( isNaN(parseInt(quant[0].value)) ||
		isNaN(parseInt(quant[1].value)) ||
		isNaN(parseInt(quant[2].value)) ||
		isNaN(parseInt(quant[3].value)) ||
		isNaN(parseInt(quant[4].value)) ||
		isNaN(parseInt(quant[5].value)) ||
		isNaN(parseInt(quant[6].value)) ||
		isNaN(parseInt(quant[7].value)) ||
		isNaN(parseInt(quant[8].value)))
	{
		alert('All quantities should be numbers.');
		return false;
	}
	if( quant[0].value == "0" &&
		quant[1].value == "0" &&
		quant[2].value == "0" &&
		quant[3].value == "0" &&
		quant[4].value == "0" &&
		quant[5].value == "0" &&
		quant[6].value == "0" &&
		quant[7].value == "0" &&
		quant[8].value == "0")
	{
		alert('You must order something.');
		return false;
	}
	if(quant[0].value != "0" && (document.getElementById("os0_1").value == "" || document.getElementById("os1_1").value == ""))
	{
		alert('Please enter the full name and dojo for tournament registrations. Comma separate if paying for multiple people');
		return false;
	}
	if(quant[1].value != "0" && (document.getElementById("os0_2").value == "" || document.getElementById("os1_2").value == ""))
	{
		alert('Please enter the full name and dojo for tournament registrations. Comma separate if paying for multiple people');
		return false;
	}

	var x = 1;
	for(var i = 1; i <  10; i++)
	{
		var item = parseInt(quant[i-1].value)
		if(item != 0 && !isNaN(item))
		{
			document.getElementById("item_name_" + i).name = "item_name_" + x;
			document.getElementById("quantity_" + i).name = "quantity_" + x;
			document.getElementById("amount_" + i).name = "amount_" + x;
			document.getElementById("on0_" + i).name = "on0_" + x;
			document.getElementById("os0_" + i).name = "os0_" + x;
			if(i == 1 || i == 2)
			{
				document.getElementById("on1_" + i).name = "on1_" + x;
				document.getElementById("os1_" + i).name = "os1_" + x;
			}
			x++;
		}
	}

	return true;
}