
ContentLayer.prototype = new LayerObject();
_this = ContentLayer.prototype;
function ContentLayer(elmID,strTitle) {
	/*create a draggable - non resizable layer. */
	var objPop = MM_findObj(elmID); //new DraggableLayer(elmID,null,null,true);
	/* find the top container. */
//	var objPop = pop.getObject();
	
	var children = objPop.childNodes;
	for (var i=0;i<children.length;i++ ) {
		if(children[i].className) {
			/*find console*/
			if(children[i].className=="contentConsole") {
				this._console = children[i];
//				pop.ignoreLayer(""+children[i].id);
			}
		}
	}

	this._topBtn = document.getElementById('goToTop');
	this._dl = this;
	this._obj = _this.objPop;
		
	this._parent_show = this.show;
	this._parent_hide = this.hide;

	/** override show method*/
	this.show=function() {
		/* hide combos */
		new DOMManager().hideCombos();
		/*call parent object's show method. */
		this._parent_show();
	}

	/** override hide method*/
	this.hide=function() {
		/* show combos */
		new DOMManager().showCombos();
		/*call parent object's show method. */
		this._parent_hide();
	}
}
_this._closeBtn_Click=function(evt) {
	var obj = new EventHandler().getProperSourceFromEvent(evt);
	if(!obj||!obj.popupHandle) {
		return;
	}
	obj.popupHandle.hide();
};

_this.setTopBtn=function() {
	if (this._console.clientHeight)
		if(this._console.clientHeight > 400)
			this._topBtn.style.visibility = 'visible';
		else
			this._topBtn.style.visibility = 'hidden';
	else if (this._console.offsetHeight)
		if(this._console.offsetHeight > 400)
			this._topBtn.style.visibility = 'visible';
		else
			this._topBtn.style.visibility = 'hidden';

}


/** overridden method */
_this.changeContent = function(strNewHTML) {
	this._console.innerHTML = strNewHTML;
};
/** overridden method */
_this.addContentBefore = function(strHTML) {
	/*just returning now and inform that the object is not complete*/
	alert("method addContentBefore has not been implemented yet! [PopupLayer]");
	return;
};
/** overridden method */
_this.addContentAfter = function(strHTML) {
	/*just returning now and inform that the object is not complete*/
	alert("method addContentAfter has not been implemented yet! [PopupLayer]");
	return;
}
_this.center = function() {
	/*quick and dirty way to get cross-browser width and height - not fully tested */
	var windowHeight = self.innerHeight?self.innerHeight:document.body.clientHeight;
	var windowWidth = self.innerWidth?self.innerWidth:document.body.clientWidth;

	this.moveTo(
		((windowWidth)/2-g_popup.getWidth()/2)-17
		,
		((windowHeight)/2-g_popup.getHeight()/2)-17
	);
};
_this.open = function(url,title) {
	if(title&&this._title) {
		this._title.innerHTML = title;
	}
	/*hide pop-up*/
	this.hide();
	/*open an HTTP request to the url*/
	var request = new XHRequest().getObject();
	request.open("GET",url);
	var eventSource = this;
	request.onreadystatechange = function() {
		if(request.readyState == 4) {
			eventSource.changeContent(request.responseText);
			eventSource.setTopBtn();
		}
		eventSource.show();
	}
	request.send(null);
};