function forceNum(e) {
	/*
		Add to onKeyDown and onKeydown to prevent any keys other than return, tab, backspace
	*/
	var key = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	if (key == 13 || key == 8 || key == 9 || (key > 45 && key < 58) || (key > 95 && key < 106) || (key > 34 && key < 41)) return true; else return false;
}

function forceMinMax(obj,mymin,mymax) {
	/*
		If the value of the obj is less then the minimum then set it to the minimum, likewise
		if the value of the obj is greater than the maximum then set to the maximum.
	*/
	if (obj.value != "") {
		if (obj.value < mymin) { obj.value = mymin }
		if (obj.value > mymax) { obj.value = mymax }
	}
}

function validateFieldTextNull(mylabel,textLabel,myText) {
	/*
		Ensures that the value of the passed field is not blank.
	*/
	if (mylabel.value == "") {
		alert(myText);
		//setText(textLabel,myText);
		mylabel.focus();
		return true;
		}
	else {
		return false;
	}
}

function validateFieldDD(mylabel,textLabel,myText) {
	/*
		Ensures that the value of the passed drop down box is not 0
	*/
	if (mylabel.selectedIndex == 0) {
		alert(myText);
		//setText(textLabel,myText);
		mylabel.focus();
		return true;
		}
	else {
		return false;
	}
}

function validateCheckbox(myCB,textLabel,myText) {
	/*
		Ensures that the value of the passed drop down box is not 0
	*/
	if (myCB.checked == false) {
		alert(myText);
		//setText(textLabel,myText);
		myCB.focus();
		return true;
		}
	else {
		return false;
	}
}

function setText(mylabel,mytext) {
	document.getElementById(mylabel).innerText = mytext;
}

function NewWindow(mypage, myname, w, h) {
	var detailWindow;
	if (w==0) { w = screen.width - 100 };
	if (h==0) { h = screen.height - 100 };
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'scrollbars=yes,height='+h+',width='+w+',top='+wint+',left='+winl+',screenY='+wint+',screenX='+winl+',resizable=yes,status=yes'
	detailWindow = window.open(mypage, myname, winprops)
	if (detailWindow.opener == null) detailWindow.opener = self;
}
