function openWindow(url, wname, ht, wd, style) {
//  if (url.indexOf('=') > 0) url += '&' + (new Date()).getTime();
//  else                      url += '?' + (new Date()).getTime();
  var h  = (screen.availHeight - ht) / 2;
  var w  = (screen.availWidth - wd) / 2;


  if (style == 'noscroll') {
    newwin = top.open('blank.htm',wname,'width='+wd+',height='+ht+',screenX='+w+',screenY='+h+',left='+w+',top='+h+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,titlebar=0,alwaysRaised=1');
    newwin.focus();
    newwin = top.open(url,wname,'width='+wd+',height='+ht+',screenX='+w+',screenY='+h+',left='+w+',top='+h+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,titlebar=0,alwaysRaised=1');
  }
  else {
    newwin = top.open('blank.htm',wname,'width='+wd+',height='+ht+',screenX='+w+',screenY='+h+',left='+w+',top='+h+',toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,titlebar=yes');
    newwin.focus();
    newwin = top.open(url,wname,'width='+wd+',height='+ht+',screenX='+w+',screenY='+h+',left='+w+',top='+h+',toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,titlebar=yes');
  }
//  newwin.opener = self;
//  newwin.moveTo(w, h)
}

function fixNums(value)  {
				
				var raise = Math.pow(10,2);
				
				value = Math.round(value * raise) / raise;
				return value;			
				
				}
				
function calcCost(frm) {			





 	var totalArea = ((frm.area1width.value * frm.area1length.value) + (frm.area2width.value * frm.area2length.value) + (frm.area3width.value * frm.area3length.value) + 		(frm.area4width.value * frm.area4length.value));
					
	var totalBoxes = Math.ceil((totalArea) / (frm.boardwidth.value));
					
	if(totalArea <= 0) {
					alert("Please enter values into the area\nboxes to calculate your requirements...");
					return false;
					}
		              frm.totalArea.value =fixNums(totalArea);
			      frm.totalBoxes.value =fixNums(totalBoxes);
			      if (frm.boardwidth.value == 2.112) {
			      var boxCost = (2.112 * boardcost120mm);
			      frm.totalBoxarea.value = (2.112 * frm.totalBoxes.value);
                              frm.totalCost.value = fixNums(boxCost * frm.totalBoxes.value);
                              }
			      else if (frm.boardwidth.value == 2.992){
			      var boxCost = (2.992 * boardcost170mm);
			      frm.totalBoxarea.value = (2.992 * frm.totalBoxes.value);
                              frm.totalCost.value = fixNums(boxCost * frm.totalBoxes.value);
			      }	
			      else {
			      var boxCost = (1.444 * boardcosteng);
			      frm.totalBoxarea.value = (1.444 * frm.totalBoxes.value);
                              frm.totalCost.value = fixNums(boxCost * frm.totalBoxes.value);
			      }	
				return true;
				}
