//<script language="javascript" type="text/javascript">
//<!--

	function GetCookie(a_sField, a_sDefault)
		{
		var bikky = document.cookie;
		var index = bikky.indexOf(a_sField + "=");
		
		if (index == -1) return a_sDefault;
		
		index = bikky.indexOf("=", index) + 1; // first character
		var endstr = bikky.indexOf(";", index);
		if (endstr == -1) endstr = bikky.length; // last character
	
		return unescape(bikky.substring(index, endstr));
		}

	function SetCookie(a_sField, a_sValue)
		{
	   	var today = new Date();
		var expiry = new Date(today.getTime() + 1 * 24 * 60 * 60 * 1000); // plus 1 day

		document.cookie= a_sField+"=" + escape(a_sValue) + "; expires=" + expiry.toGMTString();
		
		//alert(document.cookie);
		}

	function toCurrency(a_pNumber)
		{
		var sCur;
	
		//a_pNumber= parseInt(a_pNumber*100.0)/100.0;
		a_pNumber = Math.round(a_pNumber*100.0)/100.0;
		sCur= "$"+a_pNumber.toString();
		
		if (sCur.indexOf(".",0)>0)
			sCur = sCur + "00";
		else
			sCur = sCur + ".00";
		
		sCur = sCur.substring(0,sCur.indexOf(".",0)+3);
		
		//InsertCurrencyIndicator
		
		//alert ("return "+sCur);
		return sCur;
		}

	function txtHSearch_onchange(a_Jump)
		{
		var i;
		
		for (i=0; i<document.links.length; i++)
			if (document.links[i].id=="lnkSearch")
				{
				var sHRef = document.links[i].href; 
				var sPar = document.links[i].href.split("?Search=");
				document.links[i].href=sPar[0]+"?Search="+document.frmHSearch.txtHSearch.value;

				if (a_Jump==1)
					document.location.href=document.links[i].href;
				}
		}


	function OverridePost(oForm)
		{
		var dKey = new Date();

		oForm.target="";
		oForm.action="shoppingcart.html";
		oForm.method="get";
		oForm.back.value=document.location.href;
		oForm.key.value=dKey.getSeconds()+'-'+dKey.getMilliseconds();
		oForm.cmd.value="";
		oForm.business.value="";
		
		if (oForm.item_number)
			oForm.item_number.value = oForm.item_number.value+'*'+oForm.amount.value;
		}
		
	function ConfirmReturnPolicy()
		{
		if (GetCookie("agreed","")=="agreed");
			return true;
		if (confirm('A link to the Return Policy can be found at the bottom of the page.\n\nClicking OK confirms that you have read and agree with the Return Policy.'))
			{
			SetCookie("agreed","agreed");
			return true;
			}
		else
			return false;
		}
	
	
//<script LANGUAGE="JavaScript" type="text/javascript">

	function NormalizePanels()
		{	
		var oElements = document.getElementsByTagName("*")
		var i;
	
		var iMaxHeight = 0;
	
		var iBodyHeight = 0;
		var iCategoryHeight = 0;
		var iMainHeight = 0;
	
		//alert(oElements.length);

		// allow them to resize to whatever
		/*
		for (i=0;i<oElements.length;i++)
			{
			var oTable = oElements[i];
			if (oTable.id.indexOf("tnTable",0)>=0)
				oTable.height="";
			}
		*/
		
		for (i=0;i<oElements.length;i++)
			{
			var oTable = oElements[i];
			
			if (oTable.id.indexOf("tblBody",0)>=0)
				iBodyHeight = oTable.offsetHeight;
			if (oTable.id.indexOf("tblCategory",0)>=0)
				iCategoryHeight = oTable.offsetHeight;
			if (oTable.id.indexOf("tblMain",0)>=0)
				iMainHeight = oTable.offsetHeight;
			
			if (oTable.id.indexOf("tnTable",0)>=0)
				if (oTable.offsetHeight>iMaxHeight)
					iMaxHeight=oTable.offsetHeight;
			}

		if (iCategoryHeight<iMainHeight)
			iCategoryHeight=iMainHeight;
		else
			iMainHeight=iCategoryHeight;

		//alert(iBodyHeight + ' ' + iCategoryHeight + ' ' + iMainHeight);
			
		for (i=0;i<oElements.length;i++)
			{
			var oTable = oElements[i];

			if (oTable.id.indexOf("tblCategory",0)>=0)
				oTable.style.height=iCategoryHeight;
			if (oTable.id.indexOf("tblMain",0)>=0)
				oTable.style.height=iMainHeight;

			if (oTable.id.indexOf("tnTable",0)>=0)
				oTable.style.height=iMaxHeight;
			}
		}
//</script>


	
	
	/*	
	function GetPrice(a_sString)
		{
		i=a_sString.indexOf("*",0);
		return a_sString.substring((i+1),a_sString.length);
		}
		
	function GetID(a_sString)
		{
		i=a_sString.indexOf("*",0);
		return a_sString.substring(0,i);
		}
	*/

//-->
//</script>
