function calculate(width, fwidth, height, fheight, pid) {


//alert (document.getElementById('width').options[document.getElementById('width').selectedIndex].value);
//alert (document.getElementById('fractionalwidth').options[document.getElementById('fractionalwidth').selectedIndex].value);
//alert (document.getElementById('height').options[document.getElementById('height').selectedIndex].value);
//alert (document.getElementById('fractionalheight').options[document.getElementById('fractionalheight').selectedIndex].value);
   ahah('ajaxcalc.asp?idProduct=' + pid + '&w1='+width+'&w2='+fwidth+'&h1='+height+'&h2='+fheight, 'calcprice');

}


function ahah(url,target) {
   // native XMLHttpRequest object
  // document.getElementById(target).innerHTML = 'sending...';
   //alert('debug');
   if (window.XMLHttpRequest) {
       req = new XMLHttpRequest();
       req.onreadystatechange = function() {ahahDone(target);};
       req.open("GET", url, true);
       req.send(null);
   // IE/Windows ActiveX version
   } else if (window.ActiveXObject) {
       req = new ActiveXObject("Microsoft.XMLHTTP");
       if (req) {
           req.onreadystatechange = function() {ahahDone(target);};
           req.open("GET", url, true);
           req.send();
       }
   }
} 


function ahahDone(target) {
   // only if req is "loaded"
   if (req.readyState == 4) {
       // only if "OK"
       if (req.status == 200 || req.status == 304) {
           results = req.responseText;
           document.getElementById(target).innerHTML = results;
		   if (target=='calcprice')
		   {
			  // fade('calcprice');
		   }
       } else {
           document.getElementById(target).innerHTML="ahah error:\n" +
               req.statusText;
       }
   }
}