// JavaScript Document

	var s281_basePrice   = new Array();
	var s281sc_basePrice = new Array();
	
	var s281_optPrice    = new Array();
	// Base Prices
	s281_basePrice[0]    = 43999;
	s281_basePrice[1]    = 48999;
	
	s281sc_basePrice[0] = 53999;
	s281sc_basePrice[1] = 58499;

	// Option Prices
	s281_optPrice[0] = 2049;
	s281_optPrice[1] = 899;
	s281_optPrice[2] = 1399;
	s281_optPrice[3] = 1039;
	s281_optPrice[4] = 2569;
	
	s281_optPrice[15] = 1879;
	s281_optPrice[16] = 3199;
	s281_optPrice[19] = 2070;
	
	s281_optPrice[5] = 1653;
	
	s281_optPrice[23] = 551;
	
	s281_optPrice[6] = 999;
	
	s281_optPrice[22] = 1098;
	
	s281_optPrice[7] = 1999;
	
	s281_optPrice[20] = 460;
	s281_optPrice[21] = 1379;
	
	s281_optPrice[8] = 1295;
	
	s281_optPrice[17] = 3999;
	
	s281_optPrice[9] = 17000;
	s281_optPrice[10] = 18000;
	
	s281_optPrice[24] = 250;
	
	s281_optPrice[18] = 1000;
	
	s281_optPrice[11] = 1550;
	s281_optPrice[12] = 665;
	s281_optPrice[13] = 1770;
	s281_optPrice[14] = 645;
	
	function getFormat(val)
	{
	    var fmtValue;
		if(val == 0)
		{
		    fmtValue = 'TBD';
		}
		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;
		var GasGuzzlerTax = 0;
		switch(document.form.model.value)
		{
		    case 's281':
     		if(document.form.s281_base[0].checked)
		    {
		        MSRPBase = s281_basePrice[0];
		    }
		    else if(document.form.s281_base[1].checked)
		    {
		        MSRPBase = s281_basePrice[1];
		    }
		    else
		    {
		        MSRPBase = 0;
		    }
			break;
			
			case 's281sc':
			s281_optPrice[0] = 0;
			GasGuzzlerTax = s281_optPrice[18];
			if(document.form.s281sc_base[0].checked)
		    {
		        MSRPBase = s281sc_basePrice[0];
		    }
		    else if(document.form.s281sc_base[1].checked)
		    {
		        MSRPBase = s281sc_basePrice[1];
		    }
		    else
		    {
		        MSRPBase = 0;
		    }
			break;
		}
		
		var oPrice0 = document.form.s281_optPrice_0.checked ? s281_optPrice[0] : 0;
		var oPrice1 = document.form.s281_optPrice_1.checked ? s281_optPrice[1] : 0;
		var oPrice2 = document.form.s281_optPrice_2.checked ? s281_optPrice[2] : 0;
		var oPrice3 = document.form.s281_optPrice_3.checked ? s281_optPrice[3] : 0;
		var oPrice4 = document.form.s281_optPrice_4.checked ? s281_optPrice[4] : 0;
		var oPrice5 = document.form.s281_optPrice_5.checked ? s281_optPrice[5] : 0;
		var oPrice6 = document.form.s281_optPrice_6.checked ? s281_optPrice[6] : 0;
		var oPrice7 = document.form.s281_optPrice_7.checked ? s281_optPrice[7] : 0;
		var oPrice8 = document.form.s281_optPrice_8.checked ? s281_optPrice[8] : 0;
		//var oPrice9 = document.form.s281_optPrice_9.checked ? s281_optPrice[9] : 0;
		var oPrice9;
		if(document.form.s281_optPrice_9[0].checked)
		{
		    oPrice9 = s281_optPrice[9];
		}
		else if(document.form.s281_optPrice_9[1].checked)
		{
		    oPrice9 = s281_optPrice[10];
		}
		else
		{
		    oPrice9 = 0;
		}
		
		//var oPrice10 = document.form.s281_optPrice_10.checked ? s281_optPrice[10] : 0;
		//var oPrice11 = document.form.s281_optPrice_11.checked ? s281_optPrice[11] : 0;
		var oPrice11 = s281_optPrice[11];
		var oPrice12 = document.form.s281_optPrice_12.checked ? s281_optPrice[12] : 0;
		var oPrice13 = document.form.s281_optPrice_13.checked ? s281_optPrice[13] : 0;
		var oPrice14 = document.form.s281_optPrice_14.checked ? s281_optPrice[14] : 0;
		
		var oPrice15 = document.form.s281_optPrice_15.checked ? s281_optPrice[15] : 0;
		var oPrice16 = document.form.s281_optPrice_16.checked ? s281_optPrice[16] : 0;
		var oPrice17 = document.form.s281_optPrice_17.checked ? s281_optPrice[17] : 0;
		
		var oPrice19 = document.form.s281_optPrice_19.checked ? s281_optPrice[19] : 0;
		var oPrice20 = document.form.s281_optPrice_20.checked ? s281_optPrice[20] : 0;
		var oPrice21 = document.form.s281_optPrice_21.checked ? s281_optPrice[21] : 0;
		var oPrice22 = document.form.s281_optPrice_22.checked ? s281_optPrice[22] : 0;
		var oPrice23 = document.form.s281_optPrice_23.checked ? s281_optPrice[23] : 0;
		var oPrice24 = document.form.s281_optPrice_24.checked ? s281_optPrice[24] : 0;
		
		
		
		
		var ttl = MSRPBase + oPrice0 + oPrice1 + oPrice2 + oPrice3 + oPrice4 + oPrice5 + oPrice6 + oPrice7 + oPrice8 + oPrice9 + oPrice11 + oPrice12 + oPrice13 + oPrice14 + oPrice15 + oPrice16 + oPrice17 + GasGuzzlerTax + oPrice19 + oPrice20 + oPrice21 + oPrice22 + oPrice23 + oPrice24;
		document.form.msrpTTL.value = fmtMoney(ttl,0,'.',',');
		return true;
	}
	
function convertOnly(obj,id)
{
	if(obj.checked)
	{
		getMSRP();
	}
	else
	{
		document.getElementById(id).checked = false;
		alert('This option is only available on convertible models');
	}
	
}

function coupeOnly(obj,id)
{
	if(obj.checked)
	{
		getMSRP();
	}
	else
	{
		document.getElementById(id).checked = false;
		alert('This option is only available on coupe models');
	}
	
}

function clearCoupe(id1)
{
	document.getElementById(id1).checked = false;
	getMSRP();
}

function clearConvert(id1,id2)
{
	document.getElementById(id1).checked = false;
	document.getElementById(id2).checked = false;
	getMSRP();
}