OpenLayers.Dialeg = OpenLayers.Class(OpenLayers.Popup, {

	events: null,
	
	EVENT_TYPES: ["close"],

    initialize: function(id, size, contentHTML, closeBox) {
    	var lonlat = null;
    	OpenLayers.Popup.prototype.initialize.apply(this, [id, lonlat, size, contentHTML, closeBox, this.closeBoxCallback]);

    	this.div.className = 'olDialeg';
		this.contentDiv.className = 'olDialegContent';
		this.closeDiv.className = 'olDialegCloseBox';

		this.events = new OpenLayers.Events(this, null, this.EVENT_TYPES);
    },
    
    setMap: function(map) {
    	this.map = map;
    },
    
    closeBoxCallback: function() {
    	this.events.triggerEvent("close");
    },
    
    draw: function() {
    	var div = OpenLayers.Popup.prototype.draw.apply(this, arguments);
        if (div) {
            div.style.zIndex = this.map.Z_INDEX_BASE['Control'];
            this.map.viewPortDiv.appendChild(div);
        }
    	//this.map.div.style.cursor = "crosshair";
    },
    
	CLASS_NAME: "OpenLayers.Dialeg"
});