var voffset = 0;
var hoffset = 0;
var br = bt();

if (br == 2 || br == 3) document.captureEvents(Event.MOUSEMOVE);
if(br <= 3){
	document.onmousemove = movePopdiv;
}

if(br == 3){
	window.captureEvents(Event.RESIZE);
	window.onresize = mozResize;
}

function mozResize(){
	if(bt() == 3){
		document.getElementById("bigtable").style.height = "" + window.innerHeight + "Px";
	}
}

function bt(){
	if(document.all && window.offscreenBuffering){
		return 1;
	}

	if((document.captureEvents) && (!document.getElementById)){
		return 2;
	}

	if((document.getElementById) && (!document.all) && (document.documentElement)){
		return 3;
	}

	if((document.getElementById) && (navigator.userAgent.indexOf('Opera') != -1)){
		return 4;
	}
	return 5;
}

function popdiv(){
	if(br == 1) return popup.style;
	if(br == 2) return document.popup;
	if(br == 3) return document.getElementById("popup");
}

function pop(msg, width, horizontal, up) {
	if(br <= 3){
		if(!(width > 0)){
			width = 0;
		}
		if(horizontal == 1){
			voffset = -15;
			hoffset = 60;
			width=0;
		}else{
			voffset = -70;
			hoffset = -70 -width;
		}
		var pophtml ="<table " + ((width > 0)? "width=" + width :"") + " bordercolorlight=#000000 cellspacing=0 bordercolordark=#E9E9E9";
		pophtml += " nowrap border=1 cellpadding=3 cellspacing=0 bgcolor=#FFFFEE>";
		pophtml += "<tr><td class='mainbodytext'>" + msg + "</td></tr></table>";

		br = bt();
		pdiv = popdiv();
		if (br == 1){
			document.all("popup").innerHTML = pophtml;
			pdiv.visibility = "visible";
		} else if(br == 2){
			pdiv.document.write(pophtml); 
			pdiv.document.close();
			pdiv.visibility = "show";
		} else if(br == 3){
			pdiv.innerHTML = pophtml;
			pdiv.visibility = "show";
		}
	}
}


function movePopdiv(netscEvent) {
	br = bt();
	pdiv = popdiv();
	var lleft = ((br == 2 || br == 3) ? netscEvent.pageX : event.x + document.body.scrollLeft) + hoffset;
	var ltop = ((br == 2 || br == 3) ? netscEvent.pageY : event.y + document.body.scrollTop) + voffset;
	if(br == 3){
		pdiv.style.left = "" + lleft + "Px";
		pdiv.style.top = "" + ltop + "Px";
	}else{
		pdiv.left = lleft;
		pdiv.top  = ltop;
	}
	
}

function hidePopdiv() {
	if(br <= 3){
		if(bt() == 3){
			popdiv().visibility = "hide";
			if(bt() == 3){
		   		popdiv().innerHTML = "";
			}
		}else{
			popdiv().visibility = "hidden";
		}
	}
}
