
 function showalert() {
   alert('show alert function');
   }
   
 //=============================================================  
    function newwindow() {
   //params="width=500,height=300,scrollbars=yes,resizable=yes,menubar=no";
   //params="";
   window.open('wattage.htm');
   }
   
//=============================================================
   function getresults() { 
  var temp=0;
  var total=0;
  
  htmldata="<table border=1>"
  htmldata+="<tr><th>Description</th>";
  htmldata+="<th>Quantity</th><th>Watts</th><th>Hours/Month</th>";
  htmldata+="<th>Cost</th></tr>";

  for(var i = 0; i<(document.forms.length - 2); i++) {       
     temp = calculate(document.forms[i],applist[i]);
     if (temp) {
       temp += total 
       temp = (temp*100)
       temp = Math.round(temp)
       temp = (temp/100)
       total = (temp);
          }
  }
  if (total) {
    var params=new String();
    //params="menubar=yes,width=600,height=500,status=yes,scrollbars=yes";
  params="menubar=no,scrollbars=yes,width=600,height=400";

      formwindow=window.open("","newform",params);
      formwindow.document.open()
      formwindow.document.clear()
          
      formwindow.document.writeln(htmlstart);
      formwindow.document.write(htmldata);
      formwindow.document.write(htmlend);
      formwindow.document.write("<h3>Total: $"+total+"</h3>");
      formwindow.document.writeln(" <A href=><IMG border=0 src=images/close_button.jpg onclick=window.close();> </A> ")

	  formwindow.document.close()
	  
	  
      //alert("Total: $"+total)

        return 1;
  } else {
        alert("No items have are checked.  You need to check at least one item to calculate.")
        return 1;
  }
}
       
//=============================================================
function calculate(form,applistobj) {
  if (form.selected.checked) {
    value=document.rateform.rate.value 
    value *= eval(form.number.options[form.number.selectedIndex].text)
    value *= (form.avg_watts.value / 1000) * form.hours_used.value
        
        if (value) {
        amount=Math.round((value)*100)
        amount=(amount/100)
        value=(amount);
        }

        htmldata += "<td>" + applistobj.name + "</td>"
    htmldata += "<td>"+form.number.options[form.number.selectedIndex].text+"</td>";
    htmldata += "<td>"+form.avg_watts.value+"</td>"
    htmldata += "<td>"+form.hours_used.value+"</td>";
    htmldata+="<td>"+value+"</td></tr>"

    return(value)
  }
}



//=============================================================
function appliance(name, avg_watts, hours_used, kWH_used, number) {
        this.name = name
        this.avg_watts = avg_watts
        this.hours_used = hours_used
}

//=============================================================

var numapp=86;
var i=0;

var htmlstart=new String();
htmlstart="<html>";
htmlstart+="<body bgcolor=#FFFFFF>"
htmlstart+="<body>"
htmlstart+="<h1>RP&L Energy Consumption Results</h1>";

var htmldata=new String();

var htmlend=new String();
htmlend="</table></body></html>"

var applist = new Array(86)
applist[0] = new appliance("Air Cleaner", 75, 240)
applist[1] = new appliance("Air Conditioner, 8000 BTU", 900, 200)
applist[2] = new appliance("Air Cooler, Evaporative", 700, 90) 
applist[3] = new appliance("Air Conditioner, Room", 1200, 90)
applist[4] = new appliance("Battery Charger", 150, 6)
applist[5] = new appliance("Blender", 300, 5)
applist[6] = new appliance("Bottle Warmer", 350, 8)
applist[7] = new appliance("Can Opener", 100, 1)
applist[8] = new appliance("Carving Knife", 95, 1)
applist[9] = new appliance("Clock", 3, 730)
applist[10] = new appliance("Ceiling Fan", 100, 100)
applist[11] = new appliance("Christmas Tree Lights", 480, 115)
applist[12] = new appliance("Circular Saw", 1150, 2)
applist[13] = new appliance("Clothes Dryer (electric)", 5000, 20)
applist[14] = new appliance("Clothes Washer", 500, 12)
applist[15] = new appliance("Coffee Maker", 800, 15)
applist[16] = new appliance("Corn Popper", 575, 2)
applist[17] = new appliance("Computer/Monitor/Printer", 500, 60)
applist[18] = new appliance("Crock PotŪ", 250, 40)
applist[19] = new appliance("Curling Iron", 40, 12)
applist[20] = new appliance("Dehumidifier", 500, 360)
applist[21] = new appliance("Dish Washer (hot water not incl.)", 200, 20)
applist[22] = new appliance("Dish Washer (Dry Cycle)", 1200, 20)
applist[23] = new appliance("Electric Blanket", 180, 120)
applist[24] = new appliance("Fan (attic)", 400, 200)
applist[25] = new appliance("Fan (furnace)", 200, 240)
applist[26] = new appliance("Fan (window)", 200, 200)
applist[27] = new appliance("Fax Machine", 300, 170)
applist[28] = new appliance("Fish Tank", 110, 365)
applist[29] = new appliance("Floor Polisher", 400, 2)
applist[30] = new appliance("Fondue/Chafing Dish", 800, 2)
applist[31] = new appliance("Food Processor", 350, 2)
applist[32] = new appliance("Frying Pan, Electric", 600, 10)
applist[33] = new appliance("Freezer (16 cu. ft)", 350, 292)
applist[34] = new appliance("Freezer (16 cu. ft. frostless)", 400, 292)
applist[35] = new appliance("Garage Door Opener", 350, 1)
applist[36] = new appliance("Garbage Disposal", 440, 3)
applist[37] = new appliance("Griddle", 1200, 4)
applist[38] = new appliance("Hair Dryer", 1500, 10)
applist[39] = new appliance("Heater, Portable", 1500, 45)
applist[40] = new appliance("Heating Pad", 60, 10)
applist[41] = new appliance("Heating System- blower fan", 400, 292)
applist[42] = new appliance("Hedge Clipper", 250, 3)
applist[43] = new appliance("Hot Tub", 1500, 73)
applist[44] = new appliance("Humidifier", 200, 200)
applist[45] = new appliance("Ice Cream Freezer", 130, 5)
applist[46] = new appliance("Ice Crusher", 100, 3)
applist[47] = new appliance("Iron", 1100, 3)
applist[48] = new appliance("Lamp 100w", 100, 90)
applist[49] = new appliance("Lamp, Fluorescent ", 27, 90)
applist[50] = new appliance("Mixer (hand held)", 100, 20)
applist[51] = new appliance("Mixer (stand)", 150, 20)
applist[52] = new appliance("Microwave Oven", 1400, 30)
applist[53] = new appliance("Oven (electric)", 5000, 5)
applist[54] = new appliance("Range- Broiler", 3100, 10)
applist[55] = new appliance("Refrigerator Freezer", 350, 237)
applist[56] = new appliance("Refrigerator Freezer, Energy-Efficient", 600, 237)
applist[57] = new appliance("Refrigerator Freezer, Frost Free", 800, 237)
applist[58] = new appliance("Roaster", 1425, 8)
applist[59] = new appliance("Rotisserie", 1400, 8)
applist[60] = new appliance("Sewing Machine", 100, 8)
applist[61] = new appliance("Shaver, Electric", 15, 3)
applist[62] = new appliance("Stereo", 120, 120)
applist[63] = new appliance("Sun Lamp/Heat Lamp", 250, 15)
applist[64] = new appliance("Swimming Pool - 1/2 HP", 500, 360)
applist[65] = new appliance("Television, B&W 13 inch", 60, 120)
applist[66] = new appliance("Television, Color 25 inch", 165, 120)
applist[67] = new appliance("Television, Color 35 inch", 210, 120)
applist[68] = new appliance("Toaster 2 slice", 1100, 4)
applist[69] = new appliance("Toaster Oven", 1500, 10)
applist[70] = new appliance("Tools - Bench Grinder", 500, 1)
applist[71] = new appliance("Tools - Circular Saw", 1100, 1)
applist[72] = new appliance("Tools - Drill", 440, 1)
applist[73] = new appliance("Tools - Sabre Saw", 360, 1)
applist[74] = new appliance("Tools - Sander, Belt", 600, 1)
applist[75] = new appliance("Tools - Sander, Disc", 280, 1)
applist[76] = new appliance("Tools - Soldering Gun", 600, 1)
applist[77] = new appliance("Trash Compactor", 400, 1)
applist[78] = new appliance("Typewriter", 100, 4)
applist[79] = new appliance("Vacuum", 600, 4)
applist[80] = new appliance("Vacuum - Central", 800, 5)
applist[81] = new appliance("Vacuum - Electric Broom", 1000, 10)
applist[82] = new appliance("VCR", 45, 30)
applist[83] = new appliance("Warming Tray", 140, 5)
applist[84] = new appliance("Water Heater, Electric ", 4500, 90)
applist[85] = new appliance("Waterbed Heater- Double", 375, 250)

//=============================================================
function showtable() {

<!-- Build table  -->
var content = "<table cellspacing=1 >"
var bColor = false;
var strbgColor = "";

content += "<tr bgcolor=#0066cc>" 
        +  "<th>  </th>"
		+  "<th><font face=Arial color=#FFFFFF>Appliance</th></font>"
		+  "<th width=15%><font face=Arial color=#FFFFFF>Quantity</th></font>"
		+  "<th width=15%><font face=Arial color=#FFFFFF>Watts</th></font>"
		+  "<th width=25%><font face=Arial color=#FFFFFF>Hours/Month</th></font>"
		+  "</tr>"

for(var i = 0 ; i < numapp; i++) {
//800000
  if (bColor){
    strbgColor = "#c0c0c0" ;
	bColor = false; }
  else {
    strbgColor = ""; 
    bColor = true; }
	
  content += "<form> <tr bgcolor=" + strbgColor + ">"
  + "<td><INPUT type='checkbox' Name='selected'></td>"
  + "<td>" + applist[i].name + "</td>"
  + "<td align=center> <SELECT name='number'>"
  + "<OPTION selected>1"
  + "<OPTION>2"
  + "<OPTION>3"
  + "<OPTION>4"
  + "<option>5"
  + "</SELECT></td>"
  + "<td align=right>" + applist[i].avg_watts + "<INPUT type='HIDDEN' name='avg_watts' size='4'></td>"
  + "<td align=right>" + applist[i].hours_used + "<INPUT type='HIDDEN' name='hours_used' size='4'></td>"
  + "</FORM></tr><tr>"
}
content += "</tr></table>"
document.write(content)

for(i=0;i<(document.forms.length);i++) {
  document.forms[i].avg_watts.value = applist[i].avg_watts
  document.forms[i].hours_used.value = applist[i].hours_used
   }
   }
//=============================================================

function close_picture()
{
	window.close();
}
function calc_clear()
{
   for(var i = 0; i<(document.forms.length - 2); i++) {
        if (document.forms[i].selected.checked) {
             //alert(applist[i].name);
            document.forms[i].selected.checked=false
               }
      }
   } 
