/*Program:  Ajax
 * Author:  Aaron Prince
 */

var xmlhttp
function setDate(type)
{
    xmlhttp=GetXmlHttpObject();
    if (xmlhttp==null)
    {
        alert ("Your browser appears to be outdated. Please upgrade to take full advantage of our website!");
        return;
    }
    var url="opendates.php";
    url=url+"?q="+type;
    url=url+"&sid="+Math.random();
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4)
            document.getElementById('opendates').innerHTML=xmlhttp.responseText;
    }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
    
}


/*
function startAjax(type)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser appears to be outdated. Please upgrade to take full advantage of our website!");
  return;
  }

var url="opendates.php";
//adds a "q" to the getYouTube.php address for the PHP to use later
url=url+"?q="+type;
//adds a random number to the php address so the browser doesnt pull a cached file
url=url+"&sid="+Math.random();
//when the server is ready, embed the video
xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4)
         document.getElementById('opendates').innerHTML=xmlhttp.responseText;
}
xmlhttp.open("GET",url,true);
xmlhttp.send(null);

}
*/

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;
}
