<!--
	function getCookie(CookieName)
	{
		var beginindex, endindex, result;
		//alert(document.cookie);
		beginindex = document.cookie.indexOf(CookieName);
		if ( beginindex != "-1" )
		{
			beginindex = beginindex + CookieName.length + 1;
			endindex = beginindex;
			while(document.cookie.charAt(endindex) != ";" && endindex <= document.cookie.length - 1)
				endindex++;
			result = document.cookie.substring(beginindex, endindex);
			//alert(result);
			return result;
		}
		else
		{
			return "-1";
		}
	}

	function openCatalog()
	{
		var catalog_page = document.product.cat_path.value;
		var a = catalog_page.split("."); 
		catalog_page = a[0].toUpperCase();

		if (catalog_page.indexOf("BFE") == 0)
		{
			catalog_page = catalog_page.substring(3);	//	remove 'BFE'
			window.open('http://' + location.hostname + location.pathname + '?template=iCatalog_bfe/' + catalog_page + '&user_id=' + document.product.user_id.value + '&cust_no=' + document.product.cust_no.value + '&ship_no=' + document.product.ship_no.value, '', '');
		}
		else if (catalog_page.indexOf("CH") == 0)
		{
			catalog_page = catalog_page.substring(2);	//	remove 'CH'
			window.open('http://' + location.hostname + location.pathname + '?template=iCatalog/' + catalog_page + '&user_id=' + document.product.user_id.value + '&cust_no=' + document.product.cust_no.value + '&ship_no=' + document.product.ship_no.value, '', '');				
		}
		//window.open('http://' + location.hostname + location.pathname + '?template=viewcatalog&prod_id=?&prod_name=?&parent_id=?&page_graphic=' + document.product.cat_path.value, '', 'scrollbars=yes,resizable=yes,width=825,height=650,screenX=100,screenY=25,top=25,left=100');
	}

	function openTechInfo()
	{
		var range_name = document.product.range_name.value;
		var prod_name = document.product.prod_name.value;
		if (range_name.indexOf("Cantilever Racks") != -1 || prod_name.indexOf("Cantilever Racks") != -1) 
		{
			document.write("<center><font size=2>Click <a href='javascript:techInfo()'><font size=2 color='blue'>Here</font></a> for Detailed Information on How to Order This Product</font></center>");
		}
	}

	function techInfo()
	{
		window.open('/techinfo/techinfo.html', '', 'scrollbars=yes,resizable=no,width=625,height=500,screenX=100,screenY=25,top=25,left=100');
	}		
//*********************** 10/18/2004 Quantity Break basded on table 2-1 ********************
	function submitForm(buttonName, table_sequency)
//*********************** 10/18/2004 Quantity Break basded on table 2-1 ********************	
	{
        	if(navigator.appName == "Netscape")
        	{
			product_name = document.product.prod_name.value;
			ary = product_name.split(' ');
			product_name = ary[0];
			for(i=1; i<ary.length; i++)
            		{
				product_name = product_name + "_" + ary[i];
            		}
            		document.product.prod_name.value = product_name;
        	}

		/*	Check for login
		if ((document.product.cust_no.value == "?") || (document.product.cust_no.value == "") || (document.product.cust_no.value == "0"))
		{
			document.cookie="prodid=" + document.product.prod_id.value;
			if (confirm("Por favor entrada antes de ordenar los productos. \n¿Querría usted ir a la página de la entrada/matrícula?")) 
				window.location = "eComm?template=login";
			return false;

//*************************** advertisement2 ********************************************************************
			//var pubid = getCookie("pubid");
			//if ( (pubid == "p1") || (pubid == "p2") || (pubid == "p3") ||(pubid == "p4") )
			//{
			//	alert("You must login before ordering products.\nIf you are a registered customer, please log in.\nIf you are new to our web site, please register now."); 
			//	window.location = "eComm?template=login&cust_no=?&user_id=?&ship_no=?&vend_id=?";
			//	return false;
			//}
			//else
			//{
			//	alert("You must login before ordering products.");
			//	//********** vender link 4 ***********************************
			//	if (document.product.vend_id.value != "")
			//	{
			//		//alert(document.links[2].href);
			//		window.location.href = document.links[2].href;
			//	}
			//	//********** vender link 4 ***********************************
			//	return false;
			//}
//*************************** advertisement2 ********************************************************************
		}*/

		//	Get stock number
		var a = buttonName.split('_');
		var nRow = a[1];
		var name = 'document.product.stock_no_' + nRow + '.value';
		document.product.stock_no.value = eval(name);
		
		//	Modify stock number format
		var s = document.product.stock_no.value;
		a = s.split('-');
		s = a[0];
		for (var i = 1; i < a.length; i++)
			s = s + a[i];
		if (s.length == 5)
			s = s + "00";
		document.product.stock_no.value = s;
		
//*************** CH/BFE 05/21/03 C&H update with Custom-Cut Mats Length Specify function 2-1 ***************************
		if ( document.product.color_specify.value == "Yes" )
		{
			name = 'document.product.color_specify_' + nRow + '.value';
			document.product.color_specify.value = eval(name);
			if (document.product.color_specify.value == "")
				document.product.color_specify.value = "No color specified."
			else
			{
				var b = document.product.color_specify.value;
				if ( !validate(b))
				{
					alert("Please do not use following charactors in 'Specify Color' field:\n'        \"        ,");
					return false;
				}
			}
		}
		else
			document.product.color_specify.value = "N/A";
//*************** CH/BFE 05/21/03 C&H update with Custom-Cut Mats Length Specify function 2-1 ***************************

		//	Get order qty
		name = 'document.product.ord_qty_' + nRow + '.value';
		document.product.ord_qty.value = eval(name);

		//	Check for invalid order quantities
		if (document.product.ord_qty.value < 1)
		{
			alert("Las cantidades de la orden deben ser más que cero.");
			return false;
		}

//************** CH/BFE 05/05/03 Custom-Cut Mats Length Specify function 3-3 **************************************************************************
		name = 'document.product.Custom_Cut_' + nRow; 
		if (eval(name))
		{
			name = 'document.product.Custom_Cut_' + nRow + '.selectedIndex'; 
			var custom_cut_length = eval(name); 
			name = 'document.product.Custom_Cut_' + nRow + '.length'; 
			var custom_cut_max = eval(name)-1; 
			name = 'document.product.Custom_Cut_piece_' + nRow + '.selectedIndex'; 
			var pieces = eval(name);
			document.product.color_specify.value = "Custom-Cut_" + custom_cut_length + "_" + custom_cut_max + "_" + pieces; 	
		}
//************** CH/BFE 05/05/03 Custom-Cut Mats Length Specify function 3-3 **************************************************************************

//*********************** 10/18/2004 Quantity Break basded on table 2-2 ********************
		name = 'document.product.unit_qty6_table_' + table_sequency + '.value';
		document.product.unit_qty6.value = eval(name);
		name = 'document.product.unit_qty5_table_' + table_sequency + '.value';
		document.product.unit_qty5.value = eval(name);
		name = 'document.product.unit_qty4_table_' + table_sequency + '.value';
		document.product.unit_qty4.value = eval(name);
//*********************** 10/18/2004 Quantity Break basded on table 2-2 ********************

		name = 'document.product.unit_qty3_' + nRow + '.value';
		document.product.unit_qty3.value = eval(name);
		var ord_qty = new Number(document.product.ord_qty.value);
		var unit_qty = new Number(document.product.unit_qty3.value);
		var division = ord_qty/unit_qty;
		var remainder = ord_qty%unit_qty;
		if ( division < 1 || remainder != 0)
		{
			alert("Este producto " + document.product.stock_no.value + " se vende solamente en cantidades de " + unit_qty + 
				". Favor de solicitar en múltiplos de " + unit_qty + 
				".\nPara más información, favor de llamar a un Ejecutivo de Atención a Clientes al 001-877-448-0703.")
			return false;
		}

		//	Get unit prices
		name = 'document.product.unit_price3_' + nRow + '.value';
		document.product.unit_price3.value = eval(name);
		name = 'document.product.unit_price4_' + nRow + '.value';
		document.product.unit_price4.value = eval(name);
		name = 'document.product.unit_price5_' + nRow + '.value';
		document.product.unit_price5.value = eval(name);
		name = 'document.product.unit_price6_' + nRow + '.value';
		document.product.unit_price6.value = eval(name);


		



		var n1 = new Number(document.product.unit_qty6.value);
		var n2 = new Number(parseFloat(document.product.unit_price6.value));
		var n3 = new Number(document.product.unit_qty5.value);
		var n4 = new Number(parseFloat(document.product.unit_price5.value));
		var n5 = new Number(document.product.unit_qty4.value);
		var n6 = new Number(parseFloat(document.product.unit_price4.value));

		if ((division >= n1) && (n1 > 0) && (n2 > 0))
		{
			document.product.unit_price3.value = document.product.unit_price6.value;
		}
		else if ((division >= n3) && (n3 > 0) && (n4 > 0))
		{
			document.product.unit_price3.value = document.product.unit_price5.value;
		}
		else if ((division >= n5) && (n5 > 0) && (n6 > 0))
		{
			document.product.unit_price3.value = document.product.unit_price4.value;
		}

		if (document.product.prod_name.value == "")
		{
			if (document.product.range_name.value != "")
			{
				document.product.prod_name.value = document.product.range_name.value;
			}
			else
			{
				document.product.prod_name.value = document.product.stock_no.value;
			}
		}
            if (navigator.appName == "Netscape")
            {
              alert("El producto " + document.product.stock_no.value + " son añadidos a su orden.");
            }

		//	Submit form
		document.product.tran_id.value = "26";
		document.product.submit();
		return true;
	}

//*************** CH/BFE 05/21/03 C&H update with Custom-Cut Mats Length Specify function 2-2 ***************************
	function validate(field) 
	{
		var invalid = "',\""
		var temp;
		for (var i=0; i<field.length; i++)
		{
			temp = "" + field.substring(i, i+1);
			if (invalid.indexOf(temp) != "-1")					
				return false;
		}
		return true;
	}
//*************** CH/BFE 05/21/03 C&H update with Custom-Cut Mats Length Specify function 2-2 ***************************
//-->

