function getXMLHttp()
{
  var xmlHttp

  try
  {
    //Firefox, Opera 8.0+, Safari
    xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  {
    //Internet Explorer
    try
    {
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
      try
      {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e)
      {
        alert("Your browser does not support AJAX!")
        return false;
      }
    }
  }
  return xmlHttp;
}

function AjaxRequest(text)
{
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponse(xmlHttp.responseText);
    }
  }

  xmlHttp.open("GET", "index_text.php?textdisp="+text, true); 
  xmlHttp.send(null);
}

function HandleResponse(response)
{
  document.getElementById('cont').innerHTML = response;
}

function ajaxHideResponse(response)
{
  document.getElementById('text').innerHTML = response;
  
}

function ajaxHide(disp)
{
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      ajaxHideResponse(xmlHttp.responseText);
	  if(disp=="view")
	  document.getElementById('content').innerHTML = "<a href=\"javascript:ajaxHide('hide');\">Hide common chargers</a><br><br>";
	  else
	  document.getElementById('content').innerHTML = "<a href=\"javascript:ajaxHide('view');\">view common chargers</a><br><br>";
	  
    }
  }

  xmlHttp.open("GET", "quote_charge.php?textdisp="+disp, true); 
  xmlHttp.send(null);
}
