function kaMapPopUp(oKaMap, id){
	this.kaMap = oKaMap;
	this.kaMap.kaMapPopUp = this;
	var topPosition = null;
	if(arguments.length > 2){
		topPosition = arguments[2];	
	}
	
	return this.createKaMapPopUp(id, topPosition);
};

// create a pop-up above a div which diables all in background
// pop-up is positioned relatively to div "mainContainer", centered on it
kaMapPopUp.prototype.createKaMapPopUp = function(id, topPosition){
	this.disableBody();

	var navigator = this.kaMap.getRawObject("mainContainer");
	var navigatorWidth = this.kaMap.getObjectWidth(navigator);
	var navigatorHeight = this.kaMap.getObjectHeight(navigator);
	var a = this.kaMap.findObjectPos(navigator);
	var navigatorLeft = a[0];
	var navigatorTop = a[1];

	this.popUp = document.createElement("div");
	document.body.appendChild(this.popUp);
	this.popUp.id = id;
	this.popUp.style.position = "absolute";
	this.popUp.style.zIndex = "10";
	
	var popUpWidth = this.kaMap.getObjectWidth(this.popUp);
	var popUpHeight = this.kaMap.getObjectWidth(this.popUp);
	this.popUp.style.left = navigatorLeft + (navigatorWidth/2) - (popUpWidth/2) + "px";
	if(topPosition)
		this.popUp.style.top = topPosition + "px";
	else
		this.popUp.style.top = navigatorTop + (navigatorHeight/2) - (popUpHeight/2) + "px";
		
	return this;
};

kaMapPopUp.prototype.setText = function(content){
	this.popUp.innerHTML = content;
};

kaMapPopUp.prototype.disableBody = function() {
	this.disabler = document.createElement("div");
	document.body.appendChild(this.disabler);
	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 = "100%";
	
	// 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";
		}
	}
};

kaMapPopUp.prototype.destroyKaMapPopUp = function() {
	var t = this;
	document.body.removeChild(this.kaMap.getRawObject(this.popUp));
	document.body.removeChild(this.kaMap.getRawObject("PopUpDisabler"));
	
	// 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";
		}
	}
};
