﻿var x_pos;
var y_pos;

function view_cal(d_id){
	var d = document.getElementById('over_details');
	d.style.display = "block";
	d.style.top = (y_pos-90)+"px";
	d.style.left = (x_pos-358)+"px";
	document.getElementById("details_txt").innerHTML = "<div style='width:99%; text-align:center; padding:20px 0 0 0;'><img src='images/generic/ajax_loader.gif' width='32' height='32' alt='Loading...' border='0' /></div>";
	get_details(d_id);
}

function view_out(){
	var d = document.getElementById('over_details');
	d.style.display = "none";
}

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  x_pos = tempX
  y_pos = tempY
  return true
}

//-->

var xmlHttp2
//var ts;
function get_details(id)
{
xmlHttp2=GetXmlHttpObject2();
if (xmlHttp2==null)
  {
  alert ("Your browser does not support AJAX, some features may be disabled.");
  return;
  }
  t = new Date();
  ts = t.getTime();
  
//var url="functions/get_cal.php";
var url2="functions/get_details.php";
url2=url2+"?id="+id;
url2=url2+"&ts="+ts;
xmlHttp2.onreadystatechange=stateChanged2;
xmlHttp2.open("GET",url2,true);
xmlHttp2.send(null);
}

function stateChanged2() 
{ 
if (xmlHttp2.readyState==4)
{
document.getElementById("details_txt").innerHTML=xmlHttp2.responseText;
document.getElementById('over_details').style.top = (y_pos-90)+"px";
document.getElementById('over_details').style.left = (x_pos-358)+"px";
}

}

function GetXmlHttpObject2()
{
var xmlHttp2=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp2=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp2;
}