// JavaScript Document

function ShowLarge(filename)
{
 var picWindow;
 var url = "view.htm?" + filename;

 if (!picWindow)
      {picWindow = window.open(url,"subWindow","height=600,width=600,screenX=5,screenY=500");}
 picWindow.focus();
}

function AddtoCart(num)
{ 
  var string = eval("document.form1.price" + num + ".value");
  var stringArray = string.split("~");
  var shipping = stringArray[0];
  var stringArray2 = stringArray[1].split("$");
  var type = stringArray2[0];
  var price = stringArray2[1];
  if (type == "12 pcs stationery")
    {
	 if (document.forms[0].header1.value == "")
	   {
	    alert("Fill in a customized header and footer for your stationery.");
		document.forms[0].header12.focus();
		document.forms[0].header1.focus();
		return;
	   }
	}
  document.forms[0].type.value = type;
  document.forms[0].price.value = price;
  document.forms[0].shipping.value =shipping;
  document.forms[0].productNum.value = num;
  document.forms[0].submit();
}

function Update(num, type, price, index)
{
  var qty = eval("document.main.text" + index + ".value");
  qty = parseInt(qty);
  if (isNaN(qty)) {qty=1;};
  document.forms[0].quantity.value = qty;
  document.forms[0].productNum.value = num;
  document.forms[0].type.value = type;
  document.forms[0].price.value = price;
  document.forms[0].submit();
}

function Edit(num)
{
  document.forms[0].num.value = num;
  document.forms[0].submit();
}

function ShowShipping()
{
  var shipWindow;

  if (!shipWindow)
      {shipWindow = window.open("shipping.asp","subWindow","height=300,width=600,scrollbars");}
  shipWindow.focus();
}

function ShowHeader(num)
{
  var headerWindow;
  var url = "header.asp?num=" + num;

  if (!headerWindow)
      {headerWindow = window.open(url,"subWindow","height=350,width=600,scrollbars");}
  headerWindow.focus();
}