var dofade=false;     // ENABLES FADE-IN EFFECT FOR IE4+ AND NS6 ONLY
var center=false;     
var centertext=false; 



var NS4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
var IE4 = (document.all && !document.getElementById)? true : false;
var IE5 = (document.getElementById && document.all)? true : false;
var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var W3C = (document.getElementById)? true : false;
var w_y, w_x, navtxt, boxheight, boxwidth;
var ishover=false;
var isloaded=false;
var ieop=0;
var op_id=0;
var click_x,click_y;
var mousedown=false;
function getwindowdims(){
w_y=(NS4||NS6)? window.innerHeight : (IE5||IE4)? document.body.clientHeight : 0;
w_x=(NS4||NS6)? window.innerWidth : (IE5||IE4)? document.body.clientWidth : 0;
}

function getboxwidth(){
	return document.getElementById('popupcontent').style.pixelWidth;
}

function getboxheight(){
	return document.getElementById('popupcontent').style.pixelHeight;
}

function movenavtxt(){
if(W3C||IE4){
navtxt.style.zIndex=300;
document.getElementById('closepopup').style.right=(-getboxwidth()-2)+'px';
document.getElementById('closepopup').style.top=-2+'px';
}}

function getpagescrolly(){
if(NS4||NS6)return window.pageYOffset;
if(IE5||IE4)return document.body.scrollTop;
}

function getpagescrollx(){
if(NS4||NS6)return window.pageXOffset;
if(IE5||IE4)return document.body.scrollLeft;
}

function writeindiv(text){
if(NS4){
navtxt.document.open();
navtxt.document.write(text);
navtxt.document.close();
}
if(W3C||IE4)navtxt.innerHTML='';
}

//**** END UTILITY FUNCTIONS ****//

function writetxt(evt){
	if(!text) var text=1;
	if(isloaded){
		ishover=true;
	getboxheight();
	if((W3C || IE4) && dofade){
		ieop=0;
		incropacity();
	}
	margin=(IE4||IE5)? 1 : 23;
	if(NS6)if(document.height+27-window.innerHeight<0)margin=15;
	if(NS4)if(document.height-window.innerHeight<0)margin=10;
	if (NS4){
		mx=evt.pageX
		my=evt.pageY
	}
	else if (NS6){
		mx=evt.clientX
		my=evt.clientY
	}
	else if (IE5){
		mx=event.clientX
		my=event.clientY
	}
	else if (IE4){
		mx=0
		my=0
	}

	if(NS4){
		mx-=getpagescrollx();
		my-=getpagescrolly();
	}

	movenavtxt();
	if(NS4)navtxt.visibility="show";
	if(W3C||IE4)navtxt.style.visibility="visible";
	document.getElementById('filter').style.visibility='visible';
	}
}

function incropacity(){
if(ieop<=100){
ieop+=7;
if(IE4 || IE5)navtxt.style.filter="alpha(opacity="+ieop+")";
if(NS6)navtxt.style.MozOpacity=ieop/100;
op_id=setTimeout('incropacity()', 50);
}}
window.onresize=getwindowdims;
function hidepopup(){
if(NS4)navtxt.visibility="hide";
if(IE4||W3C){
if(dofade)clearTimeout(op_id);
navtxt.style.visibility="hidden";
document.getElementById('filter').style.visibility='hidden';
}
ishover=false;
}
function init(){
	navtxt=document.getElementById('navtxt');
	getwindowdims();
	isloaded=true;
	if((W3C || IE4) && centertext)navtxt.style.textAlign="center";
	if(W3C)navtxt.style.padding='4px';
	document.getElementById('showwindow').onclick=writetxt;
	document.getElementById('filter').style.height=screen.availHeight-130;
	document.getElementById('filter').style.width=screen.availWidth-21;
	document.getElementById('navtxt').style.left=(screen.availWidth-21-getboxwidth())/2;
	document.getElementById('navtxt').style.top=(screen.availHeight-130-getboxheight())/2;
}