var xmlHttp;

/*
if(document.all && !document.getElementById) {
    document.getElementById = function(id) {
         return document.all[id];
    }
}
*/

function openPriceHistory(id, curDate) {
  document.getElementById("prcHistDiv").style.visibility = "visible";
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/php/gethprc.php";
url=url+"?id="+id
url=url+"&curDate="+curDate
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function openPriceHistory2(id, curDate) {
  document.getElementById("prcHistDiv").style.visibility = "visible";
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  }
var url="/php/gethprc2.php";
url=url+"?id="+id
url=url+"&curDate="+curDate
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function closePriceHistory() {
  document.getElementById("prcHistDiv").style.visibility = "hidden";
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
  popDiv = document.getElementById("prcHistDiv");
  popDiv.innerHTML=xmlHttp.responseText + "<div class=\"closeLink\"><a href=\"javascript:closePriceHistory()\">close</a></div>";
  popDiv.style.visibility = "visible";
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

