if (!document.all) {document.captureEvents(Event.MOUSEMOVE);}
document.onmousemove = mouseXY;
var ttX = 0;
var ttY = 0;

var dirty = false;
var sysmenuVisible = false;

function frmGoto(e, v) {
	document.forms["frm"].action = "page.asp";
	document.forms["frm"].target = "";
	document.forms["frm"].elements["goto"].value = e;
	document.forms["frm"].navid.value = v;
	document.forms["frm"].submit();
}
function frmConfirmGoto(msg, e, v) {
	if (window.confirm(msg)) {
		document.forms["frm"].elements["goto"].value = e;
		document.forms["frm"].navid.value = v;
		document.forms["frm"].submit();
	}
}
function frmCancel(e, v) {
	document.forms["frm"].elements["edit"].value = 0;
	document.forms["frm"].elements["goto"].value = e;
	document.forms["frm"].navid.value = v;
	document.forms["frm"].submit();
}
function frmCmd(c, p, v) {
	document.forms["frm"].cmd.value = c;
	document.forms["frm"].param.value = p;
	document.forms["frm"].navid.value = v;
	document.forms["frm"].submit();
}
function frmConfirmCmd(msg, c, p, v) {
	if (window.confirm(msg)) {
		document.forms["frm"].cmd.value = c;
		document.forms["frm"].param.value = p;
		document.forms["frm"].navid.value = v;
		document.forms["frm"].submit();
	}
}
function frmSubmit(a, p, tgt) {
	if (typeof(a) == "string") {
		document.forms["frm"].action = a;
	}
	if (typeof(p) == "string") {
		document.forms["frm"].param.value = p;
	}
	if (typeof(tgt) == "string") {
		document.forms["frm"].target = tgt;
	}
	document.forms["frm"].submit();
}
function help(context) {
	window.open('help.asp?context=' + context, 'popup', 'width=300,height=300');
}
function helpUrl(u) {
	window.open(u);
}
function charcounter(n) {
	t = document.getElementById(n)
	s = document.getElementById("cnt"+n)
	s.innerText = t.value.length;
}
function change() {
	dirty=true;
}
function askchanges(msg, a) {
	if (dirty) {
		confirmNav(msg, a);
	} else {
		document.location=a;
	}
}
function sysmenuShow(state) {
	sysmenuVisible = state;
	m = document.getElementById('sysmenu');
	if (state) {
		m.style.visibility="visible";
	} else {
		m.style.visibility="hidden";
	}
}
function sysmenuClick(href) {
	top.location = href;
}
function bodyClick() {
	if (sysmenuVisible) {
		sysmenuShow(false);
	}
}
function bodyMouseDown() {
}
//ToolTip 060216
function mouseXY(e) {
	if(document.all) {
		ttX = event.clientX + document.body.scrollLeft;
		ttY = event.clientY + document.body.scrollTop;
	} else {
		ttX = e.pageX;
		ttY = e.pageY;
	}
  if(ttX<0) {ttX = 0;}
  if(ttY<0) {ttY = 0;}
  return true;
}
function ttOver(s) {
	if(!(s == "")) {
		var tt=document.getElementById("tooltip");
		tt.innerHTML = s;
		tt.style.left = ttX+4;
		tt.style.top = ttY+4;
		tt.style.visibility = "visible";
	}
}
function ttOut() {
	var tt = document.getElementById("tooltip");
	tt.style.visibility = "hidden";
	tt.innerHTML = "";
}
//Mask 060428
function mask(m) {
	c=event.keyCode;
	a=false;
	if (m.indexOf("#")>=0) {
		if ((c>=48) && (c<=57)) {
			a=true;
		}
	}
	if (!a) {
		if (m.indexOf(String.fromCharCode(c))>=0) {
			a=true;
		}
	}
	return a;
}
function focusFirstField() {
	var ok=false;
	try {
		var e = document.forms[0].elements;
		for(var i=0;i < e.length && !ok;i++) {
			switch (e[i].type) {
				case "text" :
				case "password" :
				case "textarea" :                 
					e[i].focus();
					ok = true ;
					break;
				default :
					break ;
				}
			}
	}
	catch(e) {
		ok=false;
	}
	return ok;
}
function doExec(cmd,i,n) {
	var d = eval(cmd);
	if (!d && (n>0)) {
		n--;
		setTimeout("doExec('"+cmd+"'"+","+i+","+n+")", i);
	}
}

function tickcol(n) {
	var r = 1;
	var f = true;
	do {
		try {
			document.forms["frm"].elements[n+r].checked=!(document.forms["frm"].elements[n+r].checked);
		}
		catch(e) {
			f = false;
		}
		r++;
	}
	while(f);
}

//ssfWeb
function PrintInvoke() {
	window.print();
}