function newWindow(mypage, myname, w, h, scroll, menu, toolbar, resizable, status) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar='+toolbar+',resizable='+resizable+',status='+status+',menubar='+menu
    win = window.open(mypage, myname + Math.floor(Math.random()*10001), winprops)
	win.window.focus();
}

function getDocumentHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

function setBottomOfPage(id) {
	if (document.getElementById) {
		var windowHeight=getDocumentHeight();
		if (windowHeight>0) {
			var footerElement=document.getElementById(id);
			var footerHeight=footerElement.offsetHeight;
			if ((windowHeight-footerHeight)>=0) {
				footerElement.style.position='relative';
				footerElement.style.top=(windowHeight-footerHeight)+'px';
			}
			else {
				footerElement.style.position='static';
			}
		}
	}
}

// validate to see if it is an integer
function IsInteger(sText) {
	var ValidChars = "0123456789";
	var IsNumber=true;
	var Char;

	for (i = 0; i < sText.length && IsNumber == true; i++) {
	   Char = sText.charAt(i);
	   if (ValidChars.indexOf(Char) == -1)
	      {
	      IsNumber = false;
	      }
	   }
	return IsNumber;
}

function validateNumberEmps(sText) {
	if (IsInteger(sText)) {
		return sText
	}
	else {
		return ''
	}
}
