/*
author: dpecjea
date: 5/10/00
*/

var ie4 = document.all;
var ns4 = document.layers;
var x = 0;
var y = 0;

/*
Netscape doesn't track mouse position over form
buttons so keep running track at all times.
*/
if (ns4) { document.captureEvents(Event.MOUSEMOVE); }
document.onmousemove = mouseMove;

function mouseMove(e) {
	if (ie4) {
		x = event.screenX
		y = event.screenY
	}
	if (ns4) {
		x = e.screenX;
		y = e.screenY;
	}
}

// open or focus on calendar popup (jea:8/24/00)
// spawns browser window -------------------------------------------------
function calpop(frm,el) {
	var bOpen = false;
	if (typeof(calWin) == "object") {
		if (!(calWin.closed)) { bOpen = true; }
	}
	if (bOpen) {
		// window already open--put in focus
		calWin.focus();
	} else {
		// create new window
		x = x + 25; y = y - 10;
		var oField = eval("document." + frm + "." + el);
		var sDate
		if (isDate(oField)) {
			// check for a valid date--requires validation.js
			sDate = oField.value;
		} else {
			// if there's junk in the field, just ignore it
			sDate = "";
		}
		var url = "include/calpop.asp?element=" + el + "&form=" + frm + "&date=" + sDate
		calWin = window.open(url,"calendar","height=140,width=140,scrollbars=no,titlebar=no,resizable,screenX="+x+",left="+x+",screenY="+y+",top="+y);
	}
}