var posx = 0;
var posy = 0;

function getCoordinates(e)
{
	if (!e) var e = window.event;
	//alert(e);
	
	if (e.pageX || e.pageY)
	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		posx = e.clientX + document.body.scrollLeft;
		posy = e.clientY + document.body.scrollTop;
	}
	// posx and posy contain the mouse position relative to the document
	// Do something with this information</pre>
}
	
function showDate(control, level)
{

	var strLink = "";
	var relativeLink = "";
	
	if (level == 1) relativeLink = "../";
	else if (level == 2) relativeLink = "../../";
	
	strLink = relativeLink + "controls/calendar.aspx?dateControl=" + control + "&selectedDate=" + document.getElementById(control).value;	
	
	//
	document.getElementById('dvCalendarSelect').style.visibility = 'visible';
	document.getElementById('dvCalendarSelect').style.zIndex = '100';
	//document.getElementById('dvCalendarSelect').style.border = 'black thin solid';
	document.getElementById('dvCalendarSelect').style.position = 'absolute';
	document.getElementById('dvCalendarSelect').style.left = event.x - 164;// + 75;
	document.getElementById('dvCalendarSelect').style.top = event.y;
	
	//document.getElementById('dvCalendarSelect').innerHTML = "<iframe id='ifCalendarSelect' width='164' height='152' onBlur=\"closeCalendar()\">Your browser does not support frames.</iframe>";
	var iframeString = "";
	iframeString = "<iframe id='ifCalendarSelect' width='164' height='152' ";
	if(document.all)
		iframeString += " onBlur=\"closeCalendar()\" ";
	iframeString += " >Your browser does not support frames.</iframe>";
	
	document.getElementById('dvCalendarSelect').innerHTML = iframeString;
	
	loadCalendar(strLink);
}

function loadCalendar(strLink)
{
	document.getElementById('ifCalendarSelect').src = strLink;
}
function closeCalendar()
{
	document.getElementById('dvCalendarSelect').style.visibility = 'hidden';
	document.getElementById('ifCalendarSelect').src = "";
}
