//--------------------------------------------------------------------------------
//   Application:   Agile Shopping Cart -- Cold Fusion Edition
//	 Version    :   5.0
//   Author     :   Eastland Data Systems
//
//
//                         COPYRIGHT NOTICE
//
//   The contents of this file is protected under the United States
//   copyright laws, and is confidential and proprietary to Eastland Data Systems.
//   Its use or disclosure in whole or in part without the expressed written 
//   permission of Eastland Data Systems is prohibited.
//
//   (c) Copyright Eastland Data Systems.  All rights reserved.
//
//--------------------------------------------------------------------------------->

function DoMath(){
	if (window.document.calcprice.bob) {
		var baseprice_selected = new Number(document.calcprice.baseprice.options[document.calcprice.baseprice.selectedIndex].value);
		base = "$"+cent(baseprice_selected);
		dispbase = document.getElementById ('prodoption');
		dispbase.innerHTML = base;

		if (document.calcprice.baseprice.selectedIndex == 0) {
			document.calcprice.download_selected.value = "N";
		} else {
			document.calcprice.download_selected.value = "Y";
		}
		finalprice = baseprice_selected;
	} else {
		finalprice = new Number(document.calcprice.baseprice.value);		
	}


	if (window.document.calcprice.attribute1_selected) {
		var x = document.calcprice.attribute1_selected.options[document.calcprice.attribute1_selected.selectedIndex].value.split("|");
		var y = new Number(x[1]);
		finalprice += y;

		z = "$"+cent(y);
		disp = document.getElementById ('traitpricechange1');
		disp.innerHTML = z;
	}
		
	if (window.document.calcprice.attribute2_selected) {
		var x = document.calcprice.attribute2_selected.options[document.calcprice.attribute2_selected.selectedIndex].value.split("|");
		var y = new Number(x[1]);
		finalprice += y;

		z = "$"+cent(y);
		disp = document.getElementById ('traitpricechange2');
		disp.innerHTML = z;
	}
		
	if (window.document.calcprice.attribute3_selected) {
		var x = document.calcprice.attribute3_selected.options[document.calcprice.attribute3_selected.selectedIndex].value.split("|");
		var y = new Number(x[1]);
		finalprice += y;

		z = "$"+cent(y);
		disp = document.getElementById ('traitpricechange3');
		disp.innerHTML = z;
	}
		
	if (window.document.calcprice.attribute4_selected) {
		var x = document.calcprice.attribute4_selected.options[document.calcprice.attribute4_selected.selectedIndex].value.split("|");
		var y = new Number(x[1]);
		finalprice += y;

		z = "$"+cent(y);
		disp = document.getElementById ('traitpricechange4');
		disp.innerHTML = z;
	}
		
	finalprice = "$"+cent(finalprice);
	disptotal = document.getElementById ('fullprice');
	disptotal.innerHTML = finalprice;
}


function cent(amount) {
    amount -= 0;
    return (amount == Math.floor(amount)) ? amount + '.00' : (  (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}

