// CALCULATE PRICES//

function round(price)
{
return Math.round(price * 100)/100;
}

function calculateTotal()
{
	var form, total=0
	form = document.forms['costcalc'];
	if (form.costRoom1.value.length != 0) {
		total = total + parseFloat(form.costRoom1.value);
		} 	
	if (form.costRoom2.value.length != 0) {
		total = total + parseFloat(form.costRoom2.value);
		}	
	if (form.costRoom3.value.length != 0) {
		total = total + parseFloat(form.costRoom3.value);
		}	
	if (form.costRoom4.value.length != 0) {
		total = total + parseFloat(form.costRoom4.value);
		}	
	if (form.costRoom5.value.length != 0) {
		total = total + parseFloat(form.costRoom5.value);
		}									
	form.costTotal.value = '$' + round(total);
}

function calculate()
{
	var form, wattage=0, hours=0, costperhour=0, costperday=0, costpermonth=0
	form = document.forms['costcalc'];	
	wattage=form.wattage.value;
	hours=form.hours.value;
	costperhour=0.18*wattage/1000;
	costperday=round(costperhour*hours);
	//costpermonth=round(costperday*30);	
	//form.monthlyCost.value='$' + costpermonth;
	form.monthlyCost.value='$' + costperday;	
	var si, sroom		
	si = form.roomSelect.selectedIndex;
	sroom = form.roomSelect.options[si].value;
	if (parseInt(sroom) == 1)
		form.costRoom1.value = costperday;
	if (parseInt(sroom) == 2)
		form.costRoom2.value = costperday;
	if (parseInt(sroom) == 3)
		form.costRoom3.value = costperday;
	if (parseInt(sroom) == 4)
		form.costRoom4.value = costperday;
	if (parseInt(sroom) == 5)
		form.costRoom5.value = costperday;

	calculateTotal();	
}

// END CALCULATIONS//
