var xmlhttp

function IncrementCounter(type,recID)
{
    
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
  alert ("Your browser does not support XMLHTTP!");
  return;
}

if (type == "viewed_phone") {
    document.getElementById("phoneLink").className = "controlHide";
    document.getElementById("phoneNumber").className = "controlShow";
}

if (type == "viewed_web") {
    document.getElementById("webLink").className = "controlHide";
    document.getElementById("webInfo").className = "controlShow";
}

// we are coming from The 'empty' posting page so no increment counter available
if (recID == -1) return;

var url="../iPHP/IncrementCounter.php";
url=url+"?type="+type+"&recId="+recID;
url=url+"&sid="+Math.random();

xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);

}

function stateChanged()
{
    if (xmlhttp.readyState == 4) {
        //alert(xmlhttp.responseText);
        //open("http://www.rochestereyecenter.com");
        //open("http://www.viatelelink.com");
        //location.replace("http://www.viatelelink.com");
        //navigate("http://www.viatelelink.com");
        
        //document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        //document.getElementById("phoneLink").className = "controlPhoneHide";
    //document.getElementById("phoneNumber").className = "controlPhoneShow";
  }
  
}

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;
}
