var xmlHttp
var url
var popstatus
function popup(sw,strDay,strMonth,strYear)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
	popstatus = sw;
	url = "populateCalendar.php";
var month = (strMonth > 9)? strMonth : "0"+strMonth;
url=url+"?q="+strDay+"/"+month+"/"+strYear

url=url+"&fresh="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 		document.getElementById("pop_content").innerHTML=xmlHttp.responseText 
		if (popstatus == 1) {
			// Show popup
			document.getElementById('blackout').style.visibility = 'visible';
			document.getElementById('divpopup').style.visibility = 'visible';
			document.getElementById('blackout').style.display = 'block';
			document.getElementById('divpopup').style.display = 'block';
		} else {
			// Hide popup
			document.getElementById('blackout').style.visibility = 'hidden';
			document.getElementById('divpopup').style.visibility = 'hidden';
			document.getElementById('blackout').style.display = 'none';
			document.getElementById('divpopup').style.display = 'none';
		}
 } 
}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;
}