function Popup() {
	var parent;
	var popup_;

	var visible;
	this.hide = hide; // hide the popup (removes popup node from parent)
	this.show = show; // show the popup (appends popup to parent)
	
	this.load = load;  // append Element to popup
	this.unload = unload;  // take out Element from popup
	
	this.set_location = set_location;  // set the popup location from a mouse event
	this.set_location_byCoord = set_location_byCoord;  // set the popup location from x&y coordinates
	this.reset_location = reset_location;  // remove javascript set coordinates (will then rely on coordinates from CSS files)
	
	construct();

	function construct() {
		parent = document.body;
		visible = false;
		
		popup_ = document.createElement('div');
		popup_.className = "popup_";
		popup_.id = "popup_";
		popup_.style.position = "absolute";
		popup_.style.display = "block";
		
	}
	
	function load(element) {
		unload();
		popup_.appendChild(element);
	}
	
	function unload() {
		if (popup_.firstChild != null) {
			popup_.removeChild(popup_.firstChild);
		}
	}
	
	function set_location(e) {
		popup_.style.top = 1+mouseY(e)+"px";
		//if(mouseY(e)+200>=screen.availHeight-200){popup_.style.top = mouseY(e)-225+"px";}
		popup_.style.left = 1+mouseX(e)+"px";
	}
	
	function set_location_byCoord(posx,posy) {
		popup_.style.top = posy+"px";
		popup_.style.left = posx+"px";	
	}
	
	function reset_location() {
		popup_.style.top = "";
		popup_.style.left = "";	
	}
	
	function hide() {
		// if popup_ is in parent, remove it
		if (visible) {
			parent.removeChild(popup_);
			visible = false;
		}
	}
	
	function show() {
		// if popup_ is not in parent, append it
		if (!visible) {
			parent = document.body;
			parent.appendChild(popup_);
			visible = true;
		}
	}
	
	function popup_get() {
		return popup_;
	}
}