$(document).ready(function(){
	setComparison();
});

function setComparison(){
	var stateprice, fiveproduction, sixproduction, sevenproduction;
	var state = $('#state').val();
	var price = 29000;
	var percentoff = .55;
	
	var turbineprice = price * (1-percentoff);

	sixproduction = 5572/12;
	sevenproduction = 8731/12;
	eightproduction = 12437/12;
	compsixproduction = 5124/12;
	compsevenproduction = 7344/12;
	compeightproduction = 8796/12;

	switch(state){
		case 'AL':
		  stateprice = .1073;
		  break;        
		case 'AK':
		  stateprice = .1721;
		  break;
		case 'AZ':
		  stateprice = .1117;
		  break;
		case 'AR':
		  stateprice = .0977;
		  break;
		case 'CA':
		  stateprice = .1576;
		  break;
		case 'CO':
		  stateprice = .1072;
		  break;
		case 'CT':
		  stateprice = .2031;
		  break;
		case 'DE':
		  stateprice = .1445;
		  break;
		case 'DC':
		  stateprice = .1448;
		  break;
		case 'FL':
		  stateprice = .1234;
		  break;
		case 'GA':
		  stateprice = .1073;
		  break;
		case 'HI':
		  stateprice = .2549;
		  break;
		case 'ID':
		  stateprice = .0775;
		  break;
		case 'IL':
		  stateprice = .1148;
		  break;
		case 'IN':
		  stateprice = .0974;
		  break;
		case 'IA':
		  stateprice = .1099;
		  break;
		case 'KS':
		  stateprice = .1038;
		  break;
		case 'KY':
		  stateprice = .0839;
		  break;
		case 'LA':
		  stateprice = .0817;
		  break;
		case 'ME':
		  stateprice = .1519;
		  break;
		case 'MD':
		  stateprice = .1546;
		  break;
		case 'MA':
		  stateprice = .1598;
		  break;
		case 'MI':
		  stateprice = .1268;
		  break;
		case 'MN':
		  stateprice = .1066;
		  break;
		case 'MS':
		  stateprice = .101;
		  break;
		case 'MO':
		  stateprice = .0908;
		  break;
		case 'MT':
		  stateprice = .093;
		  break;
		case 'NE':
		  stateprice = .0985;
		  break;
		case 'NV':
		  stateprice = .1327;
		  break;
		case 'NH':
		  stateprice = .1607;
		  break;
		case 'NJ':
		  stateprice = .1679;
		  break;
		case 'NM':
		  stateprice = .1028;
		  break;
		case 'NY':
		  stateprice = .1974;
		  break;
		case 'NC':
		  stateprice = .1062;
		  break;
		case 'ND':
		  stateprice = .0869;
		  break;
		case 'OH':
		  stateprice = .1115;
		  break;
		case 'OK':
		  stateprice = .1033;
		  break;
		case 'OR':
		  stateprice = .091;
		  break;
		case 'PA':
		  stateprice = .1199;
		  break;
		case 'RI':
		  stateprice = .1614;
		  break;
		case 'SC':
		  stateprice = .1032;
		  break;
		case 'SD':
		  stateprice = .0928;
		  break;
		case 'TN':
		  stateprice = .0903;
		  break;
		case 'TX':
		  stateprice = .1235;
		  break;
		case 'UT':
		  stateprice = .0893;
		  break;
		case 'VT':
		  stateprice = .1536;
		  break;
		case 'VA':
		  stateprice = .1125;
		  break;
		case 'WA':
		  stateprice = .0798;
		  break;
		case 'WV':
		  stateprice = .0796;
		  break;
		case 'WI':
		  stateprice = .1221;
		  break;
		case 'WY':
		  stateprice = .0913;
		  break;
		default:
		  stateprice= .000;
		  break;
	}
	
	// --- Switch values based on state and model chosen
	$('#price').html(stateprice.toFixed(2));
	//$('#wt_name').html('<h3>' + model + '</h3>');
	
	$('#fivems .wt.kwh').html(Math.round(sixproduction) + ' kWh');
	$('#sixms .wt.kwh').html(Math.round(sevenproduction) + ' kWh');
	$('#sevenms .wt.kwh').html(Math.round(eightproduction) + ' kWh');
	$('#fivems .wt.dollars').html('$' + Math.round(sixproduction * stateprice));
	$('#sixms .wt.dollars').html('$' + Math.round(sevenproduction * stateprice));
	$('#sevenms .wt.dollars').html('$' + Math.round(eightproduction * stateprice));
	$('#fivems .wt.payback').html((turbineprice / (sixproduction * 12 * stateprice)).toFixed(1) + ' yrs');
	$('#sixms .wt.payback').html((turbineprice / (sevenproduction * 12 * stateprice)).toFixed(1) + ' yrs');
	$('#sevenms .wt.payback').html((turbineprice / (eightproduction * 12 * stateprice)).toFixed(1) + ' yrs');


	$('#fivems .comp.kwh').html(Math.round(compsixproduction) + ' kWh');
	$('#sixms .comp.kwh').html(Math.round(compsevenproduction) + ' kWh');
	$('#sevenms .comp.kwh').html(Math.round(compeightproduction) + ' kWh');
	$('#fivems .comp.dollars').html('$' + Math.round(compsixproduction * stateprice));
	$('#sixms .comp.dollars').html('$' + Math.round(compsevenproduction * stateprice));
	$('#sevenms .comp.dollars').html('$' + Math.round(compeightproduction * stateprice));
	$('#fivems .comp.payback').html((turbineprice / (compsixproduction * 12 * stateprice)).toFixed(1) + ' yrs');
	$('#sixms .comp.payback').html((turbineprice / (compsevenproduction * 12 * stateprice)).toFixed(1) + ' yrs');
	$('#sevenms .comp.payback').html((turbineprice / (compeightproduction * 12 * stateprice)).toFixed(1) + ' yrs');
}
