function popUp(oKaMap, id){
	this.kaMap = oKaMap;
	this.kaMap.popUp = this;
	
	this.forbidden = false;
	this.disableBody();

	this.popUp = document.createElement("div");
	document.body.appendChild(this.popUp);
	this.popUp.id = id;
	this.popUp.style.position = "absolute";
	
	this.popUp.style.display = "none";
	return this;
};

popUp.prototype.setText = function(content){
	this.popUp.innerHTML = content;
};

// center Pop-up
popUp.prototype.updatePosition = function(){
	this.popUp.style.display = "block";
	var pageSize = this.kaMap.utils.getPageSize();
	var width = this.kaMap.getObjectWidth(this.popUp);
	var height = this.kaMap.getObjectHeight(this.popUp);

	this.popUp.style.top = pageSize[3]/2 - height/2 + "px";
	this.popUp.style.left  = pageSize[2]/2 - width/2 + "px";
	this.popUp.style.display = "none";
}

popUp.prototype.display = function(){
	var t = this;
	this.updatePosition();
	
	if(!this.forbidden){
		new Effect.SlideDown(this.popUp, {duration : 0.6});
	}
	else
		setTimeout(function(){t.display()}, 800);
}

popUp.prototype.hide = function(){
	new Effect.SlideUp(this.popUp);
}

popUp.prototype.appendChild = function(elem){
	this.popUp.appendChild(elem);
}

popUp.prototype.removeChild = function(elem){
	this.popUp.removeChild(elem);
}

popUp.prototype.disableBody = function() {
	var t = this;
	var pageSize = this.kaMap.utils.getPageSize();
	this.disabler = document.createElement("div");
	document.body.appendChild(this.disabler);
	this.disabler.style.opacity = 0;
	this.disabler.style.mozOpacity = 0;
	this.disabler.style.filter = "Alpha(opacity=0)";
	this.disabler.id = "popUpDisabler";
	this.disabler.style.position = "absolute";
	this.disabler.style.top = "0px";
	this.disabler.style.left = "0px";
	this.disabler.style.width = "100%";
	this.disabler.style.height = pageSize[1] + "px";
	
	// hide selects in IE6
	if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!= -1){
		var aSelects = document.getElementsByTagName("select");
		for(var i = 0; i < aSelects.length; i++){
			aSelects[i].style.visibility = "hidden";
		}
	}
	new Effect.Opacity(this.disabler, {duration: 0.6, from: 0, to: 0.7});
	this.forbidden = true;
	this.noPopUpChrono = window.setTimeout(function(){t.forbidden = false}, 0.6);
};

popUp.prototype.destroy = function() {
	var t = this;
	document.body.removeChild(this.popUp);
	document.body.removeChild(this.disabler);
	
	// unhide selects
	if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!= -1){
		var aSelects = document.getElementsByTagName("select");
		for(var i = 0; i < aSelects.length; i++){
			aSelects[i].style.visibility = "visible";
		}
	}
};
