// JavaScript Functions used by the following pages
//            lpd/prices.htm 
//            lpd/weborder.aspx    
//
// computePrice - Calculates the price on the price form 
// computeUpgradePrice - computes the price on the upgrade price form 
//
// Amendments
function computePrice(form)
{
	// Set feature prices
	basePrice = 25;
	processingFee = 35;
	amount = basePrice;
	
	// Set quantity discount levels
	if (form.Quantity != null)
	    quantity = eval(form.Quantity.value);
	else
	    quantity = 1;    
	discount = 1;
	if (quantity >= 15)  discount = .95;
	if (quantity >= 50)  discount = .90;
	if (quantity >= 100) discount = .72;
	
	
	// if (form.ProcessingFee != null) form.ProcessingFee.value = "";
	// form.TotalPrice.value = "";

	// Compute Unit Price
	unitPrice = amount * discount
	
	// Compute Subtotal
	subtotal = amount * quantity * discount;
	if (subtotal != parseFloat(subtotal))
		subtotal = 0;
		
	// Compute maintenance price
	maintenance = subtotal * .15;
	if (maintenance < 100)
		maintenance = 100;
	// form.Maintenance.checked = true;
			
	// Compute Total Price
	totalPrice = subtotal + maintenance;

	// Add processing fee
	if (form.ProcessingFee != null)
	{   
	    fee = 0;
	    if (totalPrice < 300) fee += processingFee;
	               
	    totalPrice += fee;
	    if (fee.toFixed) fee = fee.toFixed(2);
	    form.ProcessingFee.value = '$' + fee;
	}

	unitPrice = Math.round(unitPrice*100)/100;
	subtotal = Math.round(subtotal*100)/100;
	maintenance = Math.round(maintenance*100)/100;
	totalPrice = Math.round(totalPrice*100)/100;
	
	if (totalPrice != parseFloat(totalPrice))
		totalPrice = 0;
	if (totalPrice.toFixed) 		//if browser supports toFixed() method
	{
		unitPrice = unitPrice.toFixed(2);
		subtotal = subtotal.toFixed(2);
		maintenance = maintenance.toFixed(2);
		totalPrice = totalPrice.toFixed(2);
	}
	

    if (form.UnitPrice != null)
        form.UnitPrice.value = '$' + unitPrice; 
    if (form.Subtotal != null)
        form.Subtotal.value = '$' + subtotal; 
    if (form.MaintenancePlan != null)
        form.MaintenancePlan.value = '$' + maintenance;        
	form.TotalPrice.value = '$' + totalPrice; 
}

/* -------------------------------------------------------------------------------- */
function computeUpgradePrice(form)
{
	
	
}

