var baseText = null; 
function showPopup(t,l,w,h,msg){   
	var viewPortWidth = windowState.getWidth();
	var viewPortHeight = windowState.getHeight();
	var horizontalScroll = windowState.getScrollX();
	var verticalScroll = windowState.getScrollY();

	var popUp = document.getElementById("popupcontent");    
	//alert(popUp);
	/*popUp.style.top = t + "em";   
	popUp.style.left = l + "em";
	popUp.style.top = (screen.width/2)-(h/2)+'px';
	popUp.style.left = (screen.height/2)-(w/2)+'px';
	popUp.style.left = "35%"
	popUp.style.top = "50%"*/
	popUp.style.width = w+'em';   
	popUp.style.height = h+'em';
	
	var hPos = Math.round(horizontalScroll+((viewPortWidth-w*16)/2));
	var vPos = Math.round(verticalScroll+((viewPortHeight-h*16)/2));
	
	popUp.style.top = vPos;
	popUp.style.left = hPos;
	
	
	if (baseText == null) baseText = popUp.innerHTML;   
	popUp.innerHTML = msg +
	 //"<div id=\"statusbar\" align=\"center\"><button onclick=\"hidePopup();\">Close window</button></div>"; 
	 /* "<span class=\"class1\"><div id=\"statusbar\" align=\"center\"><a href=\"#\" onclick=\"hidePopup();\"><u>Close window</u></a></div></span>";*/
	  "<span class=\"class1\"><div id=\"statusbar\" align=\"center\"><a href=\"javascript:{}\" onclick=\"hidePopup();\"><u>Close window</u></a></div></span>";
	var sbar = document.getElementById("statusbar");   
	//sbar.style.marginTop = (parseInt(h)- 40) + "px";  
	//sbar.style.marginBottom = "10px";
	popUp.style.visibility = "visible";
}

function hidePopup(){   
	var popUp = document.getElementById("popupcontent");   
	popUp.style.visibility = "hidden";
}

function showPopupMouse(pos,w,h,msg,e){   
	var viewPortWidth = windowState.getWidth();
	var viewPortHeight = windowState.getHeight();
	var horizontalScroll = windowState.getScrollX();
	var verticalScroll = windowState.getScrollY();

	var popUp = document.getElementById("popupcontent");    
	//alert(popUp);
	/*popUp.style.top = t + "em";   
	popUp.style.left = l + "em";
	popUp.style.top = (screen.width/2)-(h/2)+'px';
	popUp.style.left = (screen.height/2)-(w/2)+'px';
	popUp.style.left = "35%"
	popUp.style.top = "50%"*/
	popUp.style.width = w+'em';   
	popUp.style.height = h+'em';
	
	/*var hPos = Math.round(horizontalScroll+((viewPortWidth-w*16)/2));
	var vPos = Math.round(verticalScroll+((viewPortHeight-h*16)/2));
	
	popUp.style.top = vPos;
	popUp.style.left = hPos;*/
	
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}

	//popUp.style.top = posy-(h*10)/2;
	popUp.style.top = posy;
	if (pos == 'left') {
		popUp.style.left = posx-w*20;
	}
	else {
		popUp.style.left = posx+20;
	}
	
	
	if (baseText == null) baseText = popUp.innerHTML;   
	popUp.innerHTML = msg //+
	 //"<div id=\"statusbar\" align=\"center\"><button onclick=\"hidePopup();\">Close window</button></div>"; 
	 /* "<span class=\"class1\"><div id=\"statusbar\" align=\"center\"><a href=\"#\" onclick=\"hidePopup();\"><u>Close window</u></a></div></span>";*/
	 //"<span class=\"class1\"><div id=\"statusbar\" align=\"center\"><a href=\"javascript:{}\" onclick=\"hidePopup();\"><u>Close window</u></a></div></span>";
	//var sbar = document.getElementById("statusbar");  
	//sbar.style.marginTop = (parseInt(h)- 40) + "px";  
	//sbar.style.marginBottom = "10px";
	popUp.style.visibility = "visible";
}

var windowState = (function(){
var readScroll = {scrollLeft:0,scrollTop:0};
var readSize = {clientWidth:0,clientHeight:0};
var readScrollX = 'scrollLeft';
var readScrollY = 'scrollTop';
var readWidth = 'clientWidth';
var readHeight = 'clientHeight';
function otherWindowTest(obj){
if((document.compatMode)&&
(document.compatMode == 'CSS1Compat')&&
(document.documentElement)){
return document.documentElement;
}else if(document.body){
return document.body;
}else{
return obj;
}
};
if((typeof this.innerHeight == 'number')&&
(typeof this.innerWidth == 'number')){
readSize = this;
readWidth = 'innerWidth';
readHeight = 'innerHeight';
}else{
readSize = otherWindowTest(readSize);
}
if((typeof this.pageYOffset == 'number')&&
(typeof this.pageXOffset == 'number')){
readScroll = this;
readScrollY = 'pageYOffset';
readScrollX = 'pageXOffset';
}else{
readScroll = otherWindowTest(readScroll);
}
return {
getScrollX:function(){
return (readScroll[readScrollX]||0);
},
getScrollY:function(){
return (readScroll[readScrollY]||0);
},
getWidth:function(){
return (readSize[readWidth]||0);
},
getHeight:function(){
return (readSize[readHeight]||0);
}
};
})();





