var popWindow; var gPage; var gText; var gHeight; var gWidth; var gScroll;
var newWindow = null;

function openWindow(gPage,gText,gHeight,gWidth,gScroll) {

	if (newWindow != null) {
	   if (!window.newWindow.closed){window.newWindow.close()};
	   }
	if (gPage != "") {nwURL=gPage}
	if (gText != "") {nwURL=nwURL+"?"+gText}
	if (gWidth != "") {nwWidth=gWidth}
	else {nwWidth="500"};
	if (gHeight != "") {nwHeight=gHeight}
	else {nwHeight="400"};
	newWindow = window.open(nwURL,"newWindow","toolbar=no,location=no,resizeable=yes,scrollbars="+gScroll+",width="+nwWidth+",height="+nwHeight,"copyhistory=no")
}
 
	var btype = false;
	if(document.getElementById){ btype = "DOM"; }
	else if(document.all){ btype = "IE4"; }
	else if(document.layers){ btype = "NS4"; } 
	else { btype = false; }
 
	function seeDiv(id,state){
		if(btype){
			if (state == ''){
				if (btype == "DOM"){var state = document.getElementById(id).style.visibility}
				else if (btype == "IE4"){var state = document.all[id].visibility}
				else if (btype == "NS4"){var state = document.layers[id].visibility}
				return state;
			} else if (state == 'hidden' || state == 'visible') {
				if (state == 'hidden'){var state2 = 'none'}
				else {var state2 = 'block'}
				if (btype == "DOM"){
					document.getElementById(id).style.visibility = state;
					document.getElementById(id).style.display = state2;
				}
				else if (btype == "IE4"){
					document.all[id].style.visibility = state;
					document.all[id].style.display = state2;
				}
				else if (btype == "NS4"){
					if (state == 'hidden'){document.layers[id].visibility = 'hide'}
					else {document.layers[id].visibility = 'show'}
					document.layers[id].display = state2;
				}
			}
		}
	}
 
	function readDiv(id){
		var text = '';
		if (btype){
			if (btype == "DOM"){text = document.getElementById(id).innerHTML}
			else if (btype == "IE4"){text = document.all[id].innerHTML}
			else if (btype == "NS4"){text = document.layers[id].document}
		}
		return text;	
	}
 
	function writeDiv(id,text){
		if (btype){
			if (btype == "DOM"){var x = document.getElementById(id);x.innerHTML = '';x.innerHTML = text}
			else if (btype == "IE4"){var x = document.all[id];x.innerHTML = text}
			else if (btype == "NS4"){
			var x = document.layers[id];
			var temp = "<P CLASS=\""+id+"\">" + text + "</p>";
			x.document.open();
			x.document.write(temp);
			x.document.close();
			}
		}
	}

