var xmlhttp;

function updateprice(str, options_id)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="/getprice.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.test = options_id;
xmlhttp.onreadystatechange = stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
{
options_id = xmlhttp.test;
price = parseFloat(document.getElementById("finalprice").value);
oldprice = parseFloat(document.getElementById(options_id+"_price").value);
if ((xmlhttp.responseText == ' ')||(xmlhttp.responseText == '')){
	update = '0.00';
} else {
	update = xmlhttp.responseText;
}
update = update - oldprice;
document.getElementById("finalprice_screen").innerHTML = "<b>€ " + parseFloat((parseFloat(price) + parseFloat(update))).toFixed(2).replace(".",",") + "</b>";
document.getElementById("finalprice").value = parseFloat((parseFloat(price) + parseFloat(update))).toFixed(2);
document.getElementById(options_id+"_price").value = parseFloat((parseFloat(document.getElementById(options_id+"_price").value) + parseFloat(update))).toFixed(2);
}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}
