
//  ==============================================
//  Routines used in displaying the calendar popup 
//  ==============================================
var popupCalendar; 

// =========================================================================================
function OpenCalendar(idname, postBack)
{
	var coords = getPageCoords(document.forms[0].elements[idname]);
	var absLeft = window.screenLeft + coords.x + document.forms[0].elements[idname].clientWidth;
	var absTop = window.screenTop + coords.y + document.forms[0].elements[idname].clientHeight;

	popupCalendar = window.open('../protected/DisplayCalendar.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=170,height=230,left=' + absLeft + ',top=' + absTop +
		',channelmode=no,fullscreen=no,directories=no,menubar=no,status=no,resizable=no,scrollbars=no,toolbar=no,location=no,titlebar=no');
	popupCalendar.focus();	// bring window to the front...	
}

// =========================================================================================
function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	popupCalendar.close();
	theform.elements[id].value = newDate;

	// trigger the textbox on original form to postback
	//	if (postBack) 
	//		__doPostBack(id,'');
}		

// =========================================================================================
function getPageCoords (el) 
{
	var coords = {x: 0, y: 0};
	do 
	{
		coords.x += el.offsetLeft - el.scrollLeft;
		coords.y += el.offsetTop - el.scrollTop;
	}
	while (el = el.offsetParent);
	return coords;
}  

//  ==============================================
//  Routines used in displaying help screen popups 
//  ==============================================

// =========================================================================================
function OpenHelp( help_screen_path, help_screen_ID )
{
	popupHelp = window.open( help_screen_path, help_screen_ID, 
		'width=450,height=600,left=250,top=100' +
		',channelmode=no,fullscreen=no,directories=no,menubar=no,status=no,resizable=yes,scrollbars=yes,toolbar=no,location=no,titlebar=no');
	popupHelp.focus(); // bring window to the front...
}

