// JavaScript Document

	var s281e_basePrice  = new Array();
	var s281e_optPrice   = new Array();
	// Base Prices
	
	s281e_basePrice[0]  = 70999;
	s281e_basePrice[1]  = 76199;

    //Tires
	s281e_optPrice[1] = 2070;
	//Chrome Alloy Wheels
	s281e_optPrice[2] = -1;
	//Scenic Roof 
	s281e_optPrice[3] = 3999;
	//Speedster Tonneau Cover
	s281e_optPrice[4] = 1195;
	//Sports Bar
	s281e_optPrice[5] = -1;
	//Racing Qtr Panle Window
	s281e_optPrice[6] = -1;	
	//Custom Factory Paint
	s281e_optPrice[7] = 17000;
	//Extreme Rainbow Paint
	s281e_optPrice[8] = 18000;
	//Gas Guzzler Tax
	s281e_optPrice[9] = 2600;
	//Enclosed Transport
	s281e_optPrice[10] = 1550;
	//Shaker 500 Electronic AM/FM Stereo
	s281e_optPrice[11] = 665;
	//Shaker 1000 Electronic AM/FM Stereo
	s281e_optPrice[12] = 1770;
	
	//Punch Sound System
	s281e_optPrice[13] = -1;
	//Saleen 7 Spoke Wheel (Painted)
	s281e_optPrice[14] = -1;
	//Saleen Forged 5 Spoke One Piece Wheel (Painted)
	s281e_optPrice[15] = -1;
	//Saleen Forged 5 Spoke One Piece Wheel (Chrome)
	s281e_optPrice[16]  = 1399;
	//Removal of Saleen Design Rear Wing
	s281e_optPrice[17]  = 250;

	
	
	
	
	
	function getFormat(val)
	{
	    var fmtValue;
		if(val == 0)
		{
		    fmtValue = 'TBD';
		}
		else if (val == -1)
		{
			fmtValue = 'No Chrg';
		}
		else
		{
		    fmtValue = val.toFixed(2);
			fmtValue = fmtMoney(val,0,'.',',');
			
			
		}
		
		return fmtValue;
	}
	
	function fmtMoney( number, floatPoint, decimalSep, thousandsSep ) {
	floatPoint = Math.abs( floatPoint+1 ? floatPoint : 2 );
	decimalSep = decimalSep || ',';
	thousandsSep = thousandsSep || '.';
	( number+'' ).match( /(\d+)(?:\.(\d+)|)/ );
	with( RegExp ) {
 		var frac = floatPoint ? decimalSep + Number( '.'+ $2 ).toFixed( floatPoint ).substr( 2 ) : '';
		return ( ( x = $1.length % 3 ) ? $1.substr( 0, x )+thousandsSep :'' ) + $1.substr( x ).replace( /(\d{3})(?=\d)/g, '$1'+thousandsSep ) + frac;
	}
}

    function getMSRP()
	{
		var MSRPBase = 0;
		switch(document.form.model.value)
		{	
			case 's281e':
			if(document.form.s281e_base[0].checked)
		    {
		        MSRPBase = s281e_basePrice[0];
		    }
		    else if(document.form.s281e_base[1].checked)
		    {
		        MSRPBase = s281e_basePrice[1];
		    }
		    else
		    {
		        MSRPBase = 0;
		    }
			
			break;
		}
		

		var oPrice1 = document.form.s281e_optPrice_1.checked ? s281e_optPrice[1] : 0;
		var oPrice2 = document.form.s281e_optPrice_2.checked ? s281e_optPrice[2] : 0;
		var oPrice3 = document.form.s281e_optPrice_3.checked ? s281e_optPrice[3] : 0;
		var oPrice4 = document.form.s281e_optPrice_4.checked ? s281e_optPrice[4] : 0;
		var oPrice5 = document.form.s281e_optPrice_5.checked ? s281e_optPrice[5] : 0;
		var oPrice6 = document.form.s281e_optPrice_6.checked ? s281e_optPrice[6] : 0;

		var oPrice7;
		if(document.form.s281e_optPrice_7[0].checked)
		{
		    oPrice7 = s281e_optPrice[7];
		}
		else if(document.form.s281e_optPrice_7[1].checked)
		{
		    oPrice7 = s281e_optPrice[8];
		}
		else
		{
		    oPrice7 = 0;
		}
		

		var oPrice9  = s281e_optPrice[9];
		var oPrice10 = s281e_optPrice[10];
		var oPrice11 = document.form.s281e_optPrice_11.checked ? s281e_optPrice[11] : 0;
		var oPrice12 = document.form.s281e_optPrice_12.checked ? s281e_optPrice[12] : 0;
		var oPrice13 = document.form.s281e_optPrice_13.checked ? s281e_optPrice[13] : 0;
		var oPrice14 = document.form.s281e_optPrice_14.checked ? s281e_optPrice[14] : 0;
		var oPrice15 = document.form.s281e_optPrice_15.checked ? s281e_optPrice[15] : 0;
		var oPrice16 = document.form.s281e_optPrice_16.checked ? s281e_optPrice[16] : 0;
		var oPrice17 = document.form.s281e_optPrice_17.checked ? s281e_optPrice[17] : 0;
		
		
		
		
		var ttl = MSRPBase + oPrice1 /*+ oPrice2*/ + oPrice3 + oPrice4 /*+ oPrice5 + oPrice6*/ + oPrice7 + oPrice9 + oPrice10 + oPrice11 + oPrice12 /*+ oPrice13 + oPrice14 + oPrice15*/ + oPrice16 + oPrice17;
		document.form.msrpTTL.value = fmtMoney(ttl,0,'.',',');
		return true;
	}
	
function convertOnly(id)
{
	if(document.form.s281e_base[1].checked)
	{
		getMSRP();
	}
	else
	{
		document.getElementById(id).checked = false;
		alert('This option is only available on convertible models');
	}
	
}

function coupeOnly(id)
{
	if(document.form.s281e_base[0].checked)
	{
		getMSRP();
	}
	else
	{
		document.getElementById(id).checked = false;
		alert('This option is only available on coupe models');
	}
	
}

function clearCoupe()
{
	document.getElementById('s281e_optPrice_3').checked = false;
}

function clearConvert()
{
	document.getElementById('s281e_optPrice_4').checked = false;
	document.getElementById('s281e_optPrice_5').checked = false;
}