<!--
var price = 24.95;
var bulkPrice = 23.95;
var taxRate = 0.0825;
var shippingCost = 0.00;

function isInt(inputString)
{
	if(parseInt(inputString) == inputString && !isNaN(inputString))
		return true;
	else
		return false;
}

function calculate(objQty, objPrice, objTax, objTotal, objShipState, objBillState)
{
	if(objQty.value != null && isInt(objQty.value))
	{
		document.getElementById('spanUnitCost').innerHTML = objQty.value;
		
		if(objQty.value >= 3)
		{
			objPrice.value = objQty.value * bulkPrice;
			document.getElementById('spanUnitCost').innerHTML = '&nbsp;x&nbsp;$' + bulkPrice;
		}
		else
		{
			objPrice.value = objQty.value * price;
			document.getElementById('spanUnitCost').innerHTML = '&nbsp;x&nbsp;$' + price;
		}
		
		objPrice.value = dollarFormat(objPrice.value);
		
		if(objShipState.value != "" || objBillState.value != "")
		{
			if(objBillState.value == "Texas")
			{
				document.getElementById('spanTaxComment').innerHTML = '';
				objTax.value = dollarFormat(objPrice.value * taxRate);
			}
			else if(objShipState.value == "Texas")
			{
				document.getElementById('spanTaxComment').innerHTML = '';
				objTax.value = dollarFormat(objPrice.value * taxRate);
			}
			else
			{
				document.getElementById('spanTaxComment').innerHTML = '';
				objTax.value = "0.00";
			}
		}
		else
		{
			document.getElementById('spanTaxComment').innerHTML = '(Select a state below to calculate tax)';
			objTax.value = "0.00";
		}
		
		objTotal.value = dollarFormat(eval(objPrice.value) + eval(shippingCost) + eval(objTax.value));

	}
	else
	{
		objQty.focus();
		objQty.value = '';
		objPrice.value = '';
		objTax.value = '';
		objTotal.value = '';
		document.getElementById('spanUnitCost').innerHTML = '';
		document.getElementById('spanTaxComment').innerHTML = '';
	}
	
}

function dollarFormat(amount)
{
//Taken from:  http://starbase.cs.trincoll.edu/cpsc114/fall03/toDollar
//
   // variables used
   var outStr,  // output string
       aNumber, // number wrapped in an object
       amtStr,  // number represented by a string
       pos,     // position of decimal point
       dollars, // dollar string
       cents;   // cents string

   // get up to two decimal digits
   amount = Math.round(amount*100)/100;

   // convert amount to a string
   aNumber = new Number(amount);
   amtStr = aNumber.toString();
   
   // looking for a decimal point
   if ((pos = amtStr.indexOf(".")) == -1) {  // not found
      amtStr = amtStr + ".";
      pos = amtStr.length;
   }
   
   // extract dollars and cents
   dollars = amtStr.substring(0, pos+1);
   cents = amtStr.substring(pos+1, amtStr.length);
   if (cents.length == 0) {  // no cents
      outStr = dollars + "00";
   }
   else if (cents.length == 1) { // single digit cents
      outStr = dollars + cents + "0";
   }
   else { // double digit cents
      outStr = dollars + cents;
   }

   return outStr;
}

function toggleShipFields()
{
	arrShipFields = Array ('Shipping_Name','Shipping_Address','Shipping_Address2','Shipping_City','Shipping_State','Shipping_Zip');
	if(document.getElementById('Shipping_Same_as_Billing').checked)
	{
		for(i=0; i<arrShipFields.length; i++)
		{
			document.getElementById(arrShipFields[i]).disabled = true;
		}
	}
	else
	{
		for(i=0; i<arrShipFields.length; i++)
		{
			document.getElementById(arrShipFields[i]).disabled = false;
		}
	}
}

-->