//<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;
		
		//alert ("toCurrency("+a_pNumber+")");
		a_pNumber= parseInt(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);
		
		//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="";
		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 OverrideAddItem(oForm, item_number, item_name, amount, weight, quantity, taxable, itempage)
		{
		var dKey = new Date();
		//alert (oForm.name);
		//alert (item_number);
		//alert (item_name);
		//alert (amount);
		//alert (weight);
		//alert (quantity);
		//alert (taxable);
		//alert (taxable);

		oForm.target="";
		//oForm.action="ShoppingCart.html?Key="+dKey.getSeconds()+'-'+dKey.getMilliseconds() +"&Back="+document.location.href +"&item_number="+item_number+'*'+amount +"&item_name="+item_name +"&amount="+amount +"&weight="+weight +"&quantity="+quantity +"&taxable="+taxable +"&itempage="+itempage;
		oForm.action="ShoppingCart.html";
		oForm.Key=dKey.getSeconds()+'-'+dKey.getMilliseconds();
		oForm.business="";
		oForm.cmd="";
		oForm.method="";
		//alert (oForm.action);
		}


	function OverrideSC(oForm)
		{
		//alert (oForm.name);
		oForm.target="";
		oForm.action="ShoppingCart.html?Back=" + document.location.href;
		oForm.method="";
		}
	*/

	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 NormalizeThumbs()
		{	
		var oElements = document.getElementsByTagName("*")
		var i;
	
		var iMaxHeight = 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("tnTable",0)>=0)
				if (oTable.offsetHeight>iMaxHeight)
					iMaxHeight=oTable.offsetHeight;
			}

		for (i=0;i<oElements.length;i++)
			{
			var oTable = oElements[i];
			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>
