   var http_request = false;
   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('pdtDiv').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
	  } else {
		document.getElementById('pdtDiv').innerHTML = '<div class="content" align="center" style="color:#969696;background-color:#3d3d3d;padding-bottom:10px"><img src="images/loading.gif" />&nbsp;&nbsp;&nbsp;&nbsp;<strong>Loading...</strong></div>';
	 }
   }
   
   function searchPdt() {
      var poststr = "numOfPagesAjax=" + encodeURI( document.getElementById("numOfPagesAjax").value ) +
	  				"&selectedPaperAjax=" + encodeURI( document.getElementById("selectedPaperAjax").value ) +
					"&selectedQuantityAjax=" + encodeURI( document.getElementById("selectedQuantityAjax").value ) +
					"&numOfSidesAjax=" + encodeURI( document.getElementById("numOfSidesAjax").value ) +
					"&paymentOptionAjax=" + encodeURI( document.getElementById("paymentOptionAjax").value ) +
					"&currencySelectedAjax=" + encodeURI( document.getElementById("currencySelectedAjax").value );
      
	  makePOSTRequest('pdtAjax.php', poststr);
   }
   
	function addPrice(typeVal,countVal) 
	{
		var displayPrice 	   = document.getElementById('displayPrice'+countVal).value;
		var displayPriceTAT1 = document.getElementById('displayPriceTAT1'+countVal).value;
		var displayPriceTAT2 = document.getElementById('displayPriceTAT2'+countVal).value;
		var displayPriceTAT3 = document.getElementById('displayPriceTAT3'+countVal).value;
		
		var displayTAT  = document.getElementById('displayTAT'+countVal).value;
		var displayTAT1 = document.getElementById('displayTAT1'+countVal).value;
		var displayTAT2 = document.getElementById('displayTAT2'+countVal).value;
		var displayTAT3 = document.getElementById('displayTAT3'+countVal).value;
		
		var fold_price = document.getElementById('managePdt'+countVal).fold_price.value;
		
		if( fold_price == 0 )
		{
		fold_price = document.getElementById('managePdt'+countVal).fold_price_euro.value;
		}
		else
		{
		  if( document.getElementById('managePdt'+countVal).currencySelected.value == 2 )
		  {
			fold_price = parseFloat(fold_price) * parseFloat(document.getElementById('managePdt'+countVal).rate.value);
		  }
		}
		
		fold_price = Math.ceil(fold_price);
		
		var crease_price = document.getElementById('managePdt'+countVal).crease_price.value;
		
		if( crease_price == 0 )
		{
		crease_price = document.getElementById('managePdt'+countVal).crease_price_euro.value;
		}
		else
		{
		  if( document.getElementById('managePdt'+countVal).currencySelected.value == 2 )
		  {
			crease_price = parseFloat(crease_price) * parseFloat(document.getElementById('managePdt'+countVal).rate.value);
		  }
		}
		
		crease_price = Math.ceil(crease_price);
	  
		if(typeVal == "fold")
		{
			displayPrice = parseFloat(displayPrice) + parseFloat(fold_price);
			displayPrice1 = parseFloat(displayPriceTAT1) + parseFloat(fold_price);
			displayPrice2 = parseFloat(displayPriceTAT2) + parseFloat(fold_price);
			displayPrice3 = parseFloat(displayPriceTAT3) + parseFloat(fold_price);
			
			displayTAT = parseFloat(displayTAT) + 1;
			displayTAT1 = parseFloat(displayTAT1) + 1;
			displayTAT2 = parseFloat(displayTAT2) + 1;
			displayTAT3 = parseFloat(displayTAT3) + 1;
		}
		else if(typeVal == "creasedandflat")
		{
			displayPrice = parseFloat(displayPrice) + parseFloat(crease_price);
			displayPrice1 = parseFloat(displayPriceTAT1) + parseFloat(crease_price);
			displayPrice2 = parseFloat(displayPriceTAT2) + parseFloat(crease_price);
			displayPrice3 = parseFloat(displayPriceTAT3) + parseFloat(crease_price);
		}
		else if(typeVal == "creasedandfold")
		{
			displayPrice = parseFloat(displayPrice) + parseFloat(fold_price) + parseFloat(crease_price);
			displayPrice1 = parseFloat(displayPriceTAT1) + parseFloat(fold_price) + parseFloat(crease_price);
			displayPrice2 = parseFloat(displayPriceTAT2) + parseFloat(fold_price) + parseFloat(crease_price);
			displayPrice3 = parseFloat(displayPriceTAT3) + parseFloat(fold_price) + parseFloat(crease_price);
			
			displayTAT = parseFloat(displayTAT) + 1;
			displayTAT1 = parseFloat(displayTAT1) + 1;
			displayTAT2 = parseFloat(displayTAT2) + 1;
			displayTAT3 = parseFloat(displayTAT3) + 1;
		}
		else
		{
			displayPrice = parseFloat(displayPrice);
			displayPrice1 = parseFloat(displayPriceTAT1);
			displayPrice2 = parseFloat(displayPriceTAT2);
			displayPrice3 = parseFloat(displayPriceTAT3);
		}
		
		displayPrice = Math.ceil(displayPrice);
		displayPriceTAT1 = Math.ceil(displayPriceTAT1);
		
		document.getElementById('displayPriceSpan'+countVal).innerHTML = formatAsMoney(displayPrice);
		
		document.getElementById('displayTATSpan'+countVal).innerHTML = displayTAT;
		
		if( displayPriceTAT1 != 0 )
		{
			document.getElementById('displayPriceTAT1Span'+countVal).innerHTML = formatAsMoney(displayPrice1);
			
			document.getElementById('displayTAT1Span'+countVal).innerHTML = displayTAT1;
		}
		if( displayPriceTAT2 != 0 )
		{
			document.getElementById('displayPriceTAT2Span'+countVal).innerHTML = formatAsMoney(displayPrice2);
			
			document.getElementById('displayTAT2Span'+countVal).innerHTML = displayTAT2;
		}
		if( displayPriceTAT3 != 0 )
		{
			document.getElementById('displayPriceTAT3Span'+countVal).innerHTML = formatAsMoney(displayPrice3);
			
			document.getElementById('displayTAT3Span'+countVal).innerHTML = displayTAT3;
		}
   }
   
   function formatAsMoney(mnt) {
		mnt -= 0;
		mnt = (Math.round(mnt*100))/100;
		return (mnt == Math.floor(mnt)) ? mnt + '.00' 
				  : ( (mnt*10 == Math.floor(mnt*10)) ? 
						   mnt + '0' : mnt);
	}