/*
   class: popup
   Die EgoTec popup Klasse stellt popup Boxen zur Verfügung
   abgeleitet von eWindow

   vars:
    settings - (object) settings: Einstellungen des Alertfensters
 */
function popup(settings)
{
	this.settings	= settings;
	this.tabbox		= document.createElement("div");
	this.tabbox.id	= "TABBOX_" + this.settings.name;
	//this.tabbox.style.width = this.settings.width + 'px';
}

popup.prototype = new eWindow(this.settings);

popup.prototype.createBody = function()
{
	this.window_body = new eFrame(this.settings);

	var bodybox 	= document.createElement("div");
	var bodyOutBox 	= bodybox.cloneNode(true);
	var buttonBox 	= bodybox.cloneNode(true);
	var close		= document.createElement('input');
	var image		= document.createElement('img');

	var html = '', stringSrc = '', activeIframe = 0, tabbar = '';

	if(egotecSystem.isMSIE)
	{
		bodyOutBox.style.width = '105%';
		bodyOutBox.align = 'center';
	}

	// Buttons
	buttonBox.style.position = 'absolute';
	buttonBox.style.bottom = '10px';
	buttonBox.style.right = '10px';

	close.type = 'button';

	if(lang == "en")
	{
		close.value = 'close';
	} else
	{
		close.value = 'schließen';
	}

	close.className = 'alertButton';

	if(egotecSystem.isMSIE)
	{
		close.setAttribute('obj_name', this.settings.name);
		close.onclick = function(){(eval("egotecSystem.popupClose('" + this.getAttribute('obj_name') + "')"))};
	} else
	{
		close.setAttribute('onclick', "egotecSystem.popupClose('" + this.settings.name + "')");
	}

	image.src = this.settings.tabs[0]['image'];
	image.align = 'center';
	bodybox.align = 'center';

	buttonBox.appendChild(close);
	bodybox.appendChild(image);
	bodybox.appendChild(buttonBox);
	bodyOutBox.appendChild(bodybox);

	this.window_body.setDialog(bodyOutBox);
}

popup.prototype.show = function()
{
	this.create();

	if(this.settings.modal)
	{
		var overall = document.createElement("div");
		var hoehe = (document.body.clientHeight || window.innerHeight);
		var breite = (document.body.clientWidth || window.innerWidth);

		overall.id = "overall";

		overall.style.position = "absolute";
		overall.style.top = "0px";
		overall.style.left = "0px";
		overall.style.width = breite + "px";
		overall.style.height = hoehe + "px";
		overall.style.backgroundColor = "#ffffff";

		overall.style.MozOpacity = "0.5";
		overall.style.filter = "alpha(opacity=50)";
		overall.style.zIndex = "10000";

		document.body.appendChild(overall);
	}

	allWindows[this.settings.name] = this;

	// Aktives Popup bekommen
	egotecSystem.activePopup = this.settings.name;

	new Effect.Appear("popup_" + this.settings.name);
}

popup.prototype.hide = function()
{
	new Effect.Fade("popup_" + this.settings.name);

	if(document.getElementById("overall"))
	{
		document.body.removeChild(document.getElementById("overall"));
	}
}

popup.prototype.getWindowArg = function(request)
{
	return this.settings.arg[request];
}

popup.prototype.setWindowArg = function(request, argValue)
{
	this.settings.arg[request] = argValue;
}
