  //Energy Calculator Script  
	
	
	function calculate(energyForm) {
		miniWatts = energyForm.miniLights.value * 40
		bigWatts = energyForm.bigLights.value * 125
		spotWatts = energyForm.spotlights.value * 150
		totalWatts = miniWatts + bigWatts + spotWatts
		
		hoursPerDay = totalWatts * energyForm.regHoursUsed.value
		regKWH = hoursPerDay / 1000
		regCost = regKWH * 0.09262  //Current Residential Electric Rate
		
		KWHPerDay = regKWH
		energyForm.estimatedKWHPerDay.value = Math.round(KWHPerDay * 1000) / 1000
		costPerDay = regCost
		energyForm.estimatedPerDay.value = CurrencyFormat(costPerDay)
        energyForm.estimatedPerMonth.value = CurrencyFormat(costPerDay * 30)
    }
    
    function CurrencyFormat(amount) {
        var i = parseFloat(amount);
        if(isNaN(i)) { i = 0.00; }
        var minus = '';
        if(i < 0) { minus = '-'; }
        i = Math.abs(i);
        i = parseInt((i + .005) * 100);
        i = i / 100;
        s = new String(i);
        if(s.indexOf('.') < 0) { s += '.00'; }
        if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
        s = minus + s;
        return "$" + s;
         
	calculate(energyForm)
    }

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=250');");
}

