/*
 * This method is used to return the sizes (width & height) of a document window
 */
function getHeight (removeScroll) {

	if (removeScroll) {
		if (navigator.appName.indexOf("Netscape") != -1) {
			return window.innerHeight - 16;
		}
		else if (navigator.appName.indexOf("Netscape") == -1) {
			return document.body.scrollHeight - 20 - 4;
		}
		else {
			return null;
		}
	}
	else {
		if (navigator.appName.indexOf("Netscape") != -1) {
			return window.innerHeight - 3;
		}
		else if (navigator.appName.indexOf("Netscape") == -1) {
			return document.body.scrollHeight - 4;
		}
		else {
			return null;
		}
	}
}
function getWidth (removeScroll) {

	if (removeScroll) {
		if (navigator.appName.indexOf("Netscape") != -1) {
			return window.innerWidth - 16;
		}
		else if (navigator.appName.indexOf("Netscape") == -1) {
			return document.body.scrollWidth - 20;
		}
		else {
			return null;
		}
	}
	else {
		if (navigator.appName.indexOf("Netscape") != -1) {
			return window.innerWidth;
		}
		else if (navigator.appName.indexOf("Netscape") == -1) {
			return document.body.scrollWidth;
		}
		else {
			return null;
		}
	}
}

/*
 * This method is used to reload the current page
 */
function reloadPage () {
    document.location.replace (document.location);
}


/*
 * This function opens a popup window with the given criteria
 */
function popup(url, height, width, scrollbars, alwaysNewWindow) {

	var top=0;
	var left=0;
	var pageId = 'Reg';
	
	if (height >= screen.height) {
		height = screen.height - 75;
	}
	if (width >= screen.width) {
		width = screen.width - 50;
	}
	
	top = (screen.height - height) / 2;
	left = (screen.width - width) / 2;
	
	if (!scrollbars) {
		scrollbars = 'no';
	}

	if (alwaysNewWindow) {
		pageId = Math.round(Math.random() * 100) % 1000 + 1;
	}
	if (newwindow == null) {
		var pageType = 'resizable=no,hotkeys=no,dependent=yes,toolbar=no,directories=no,scrollbars=' + scrollbars + ',status=no,width=' + width + ',height=' + height + ',top=' + top + ',left=' + left;
		var newwindow = window.open(url,pageId,pageType);
		newwindow.opener = window;
	}
	else {
		newwindow.location = url;
	} // if (newwindow == null)
	newwindow.focus();
	return newwindow;

}