function FixLinks()
{
	if (PageName!=null)
	{
		for (var i=0; i<3; i++)
		{
			var CtlName	= "lnk" + PageName + (i+1)
			var LnkCtl	= document.getElementById(CtlName);
			if (LnkCtl!=null)
			{
				LnkCtl.className = "active";
			}
		}
	}
}
function FixHeader()
{
	var CtlToHide	= null;
	var CtlToShow	= null;
	if (PageName=="Default")
	{
		var CtlToHide	= document.getElementById("divHeader");
		var CtlToShow	= document.getElementById("divHomeHeader");
		if (CtlToHide!=null)
			{ CtlToHide.style.display	= 'none';	}
		if (CtlToShow!=null)
			{ CtlToShow.style.display	= '';		}
	}
	else 
	{
		var ulLoginMenu	= document.getElementById("ulLoginMenu");
		var divNotMain	= document.getElementById("divNotHomePlace");
		divNotMain.appendChild(ulLoginMenu);
	}
	if (IsLoggedIn==true)
	{
		var CtlToHide	= document.getElementById("lnkLogin2");
		var CtlToShow	= document.getElementById("lnkLogout2");
		if (CtlToHide!=null)
			{ CtlToHide.style.display	= 'none';	}
		if (CtlToShow!=null)
			{ CtlToShow.style.display	= '';		}
		var CtlToHide	= document.getElementById("lnkRegister2");
		var CtlToShow	= document.getElementById("lnkUserProfile2");
		if (CtlToHide!=null)
			{ CtlToHide.style.display	= 'none';	}
		if (CtlToShow!=null)
			{ CtlToShow.style.display	= '';		}
		
	}
}
function FixLeftMenu()
{
	if (IsLeftVisible==false)
	{
		var CtlToHide	= document.getElementById("divLeftNav");
		if (CtlToHide!=null)
			{ CtlToHide.style.display	= 'none';	}
		CtlToHide	= document.getElementById("divContent");
		if (CtlToHide!=null)
			{ CtlToHide.style.width		= '95%'; }
	}
}
function ShowConfirmation(sPrompt)
{
	try
	{
		return RetVal = showModalDialog("Confirmation.html", sPrompt,"status:no;dialogWidth:400px;dialogHeight:200px;help:no" );
	}
	catch (e)
	{
		alert("Sorry but the browser does not support the basic functionality of showing a modal dialog. Please use Internet explorer 5.0+ when administering this site.");
	}
}
function FixLeftSide()
{
	var divFeatured = document.getElementById('divFeatured');
	var lnkFeaturedProduct = document.getElementById('lnkFeaturedProduct');
	if (PageName=="Default")
	{
		if (divFeatured!=null)
			{ divFeatured.style.display = 'none'; }
		var divLeftBoxes = document.getElementById('divLeftBoxes');
		if (divLeftBoxes!=null)
			{ divLeftBoxes.style.display = ''; }
		
	}
	else
	{
		var Index			= 0;
		var Retry			= 0;
		while (((Index	= Math.round(Math.random() * Products.length))==0) && (Retry<5))
			{ Retry++; }
		Index		= Index-1;
		var Product = Products[Index];
		var imgFeaturedProduct = document.getElementById('imgFeaturedProduct');
		if (imgFeaturedProduct!=null)
		{
			imgFeaturedProduct.src = "Images/Products/" + Product + ".jpg";
		}
		var lnkFeaturedProduct = document.getElementById('lnkFeaturedProduct');
		if (lnkFeaturedProduct!=null)
		{
			lnkFeaturedProduct.innerHTML	= Product;
			lnkFeaturedProduct.href			= 'ProdDetail/' + ShortProducts[Index] + ".aspx";
		}
	}
}
function FixForm()
{
	for (var i=0; i<document.forms.length; i++)
	{
		document.forms[i].action = PagePath;
	}
}
function FilterNumericKey(event)
{
	var keyCode = event.keyCode;
	if (event.charCode)
		{ keyCode = event.charCode; }
	if ( (keyCode==9) || (keyCode==16) || ((keyCode>=48) && (keyCode<=57)) || ((keyCode>=96) && (keyCode<=105)) || (keyCode==46) || (keyCode==44) || (keyCode==8) || ((keyCode>36) && (keyCode<41)))
	{
		// if this is a decimal and there is already a decimal in place cancel it
		// if this is a comma then enumerate the comma positions and if it is not every 3 then cancel it.
	}
	else
	{
//		alert(keyCode);
		event.returnValue	= false; 
		event.cancel		= true;
		event.charCode	= 0;
		if (event.preventDefault)
			{ event.preventDefault(); }
		return false;
	}
}