var posX;
var posY;

var isIE = document.all?true:false;
document.onmousemove = getMousePosition;
function getMousePosition(e) {
var _x;
var _y;
if (!isIE) {
_x = e.pageX;
_y = e.pageY;
}
if (isIE) {
_x = event.clientX + document.body.scrollLeft;
_y = event.clientY + document.body.scrollTop;
}

posX=_x;
posY=_y;

return true;
}



//function to get a handle on xmlHttpRequest object
var xmlHttp = null

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


function closeDiv(div_id) {	
	document.getElementById(div_id).innerHTML = "";		
}

function getScrollWidth()
{
   var w = window.pageXOffset ||
           document.body.scrollLeft ||
           document.documentElement.scrollLeft;
           
   return w ? w : 0;
} 

function getScrollHeight()
{
   var h = window.pageYOffset ||
           document.body.scrollTop ||
           document.documentElement.scrollTop;
           
   return h ? h : 0;
}

// function to display the details of the classes based on the selected date
function showDetails(id, div) {
	// id - ID of the class for which details are to be displayed.
	// id of the div where the result has to be displayed
	
	var xmlHttp=null;
	
	var width = screen.width+getScrollWidth();
	//var height = screen.height+getScrollHeight();
	var height = 1021;
	
	xmlHttp = getXmlHttpObject();
	if (xmlHttp == null) {
		alert("AJAX not supported");
		return;
	}
	
	// call the php code to display the class details
	var url = "/classDetails.php?id="+id+"&y="+posY;
	xmlHttp.onreadystatechange = function() {
		if(xmlHttp.readyState == 4){
			document.getElementById(div).innerHTML = "<div style='position:absolute; filter:alpha(opacity=75);-moz-opacity:.75;opacity:.75; left:0px; top:0px; width:"+width+"px; height:"+height+"px; z-index:41'><img src='images/bk.png' width="+width+" height="+height+"> </div>"+xmlHttp.responseText;
		}
		else {
			document.getElementById(div).innerHTML ="<div style='position:absolute; filter:alpha(opacity=75);-moz-opacity:.75;opacity:.75; left:0px; top:0px; width:"+width+"px; height:"+height+"px; z-index:41'><img src='images/bk.png'> </div> <table style='position:absolute; left:150px; top:"+posY+"px; width:"+width-150+" px; height:"+height+" px; z-index:41'><tr><td><h2>please wait while the page loads...</h2></tr></table>";
		}
			
	}
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);
}