// JavaScript Document

  function calculatePrice()
  {
      var eh1 = document.getElementById("height");
      var eh2 = document.getElementById("height2");
      var ew1 = document.getElementById("width");
      var ew2 = document.getElementById("width2");
      var siH = eh2.selectedIndex;
      var siW = ew2.selectedIndex;
      var h1 = parseInt(eh1.value);
      var h2 = parseFloat(eh2.options[siH].value); 
      var w1 = parseInt(ew1.value);
      var w2 = parseFloat(ew2.options[siW].value); 
      var area = 0;
      var bInvalid = false;
      if (isNaN(h1))
      {
        bInvalid = true;
        eh1.className = "invalid";
      }
      else
      {
        eh1.className = "";
      }
      if (isNaN(w1))
      {
        bInvalid = true;
        ew1.className = "invalid"; 
      }
      else
      {
        ew1.className = "";
      }
      
	  var price = 0;
      if (!bInvalid)
      {
        var height = h1 + h2;
        var width = w1 + w2;
        var area = height * width;
        var b = yIntercept;
        price = 0.246 * area + b;
        //price = price.toFixed(2);
        //document.getElementById("price").innerHTML = "$" + price;
      }

	  return price;
  }
