var _msgBoxCallback = null;
var DIALOG_OHNE_BUTTON = 0;
var DIALOG_BUTTON_OK = 1;
var DIALOG_BUTTON_JA = 2;
var DIALOG_BUTTON_NEIN = 4;
var DIALOG_BUTTON_CANCEL = 8;
var DIALOG_BUTTON_DELETE = 16;

var DIALOG_RESULT_OK = 1;
var DIALOG_RESULT_JA = 2;
var DIALOG_RESULT_NEIN = 4;
var DIALOG_RESULT_CANCEL = 8;
var DIALOG_RESULT_DELETE = 16;

var butControl;

var ContentMitteFF = 34;
var ContentMitteIE = 42;
var fDialogBgOn = true;

var BLANK = "/b.gif";
var PNG_OPAC_50 = "/img/lay/blank_diff50.png";

var MSGVersion = 1;

Dialog.hash = new LAHash();
Dialog.id=null;
Dialog.msgBox=null;
Dialog.open = false;
Dialog.Count = 0;

function Dialog(resultCallback)
{	
    var _id = 0;
    var _RemoveMsgBox = true;
    var objPO = new PageOverlay();
    var _self = this;
    
	Dialog.msgBoxCallback = resultCallback;
    
    Dialog.Count += 1;
	this.show = function(title, text, buttons, icons, removeObj, id)
	{	
		if (typeof(removeObj) != 'undefined')
		    _RemoveMsgBox = removeObj;
		
		_id = Dialog.Count;
		if (typeof(id) != 'undefined')
		    _id = id;
		
		Dialog.hash.set(Dialog.Count, objPO);
		
		this._showMsgBox(title,text,buttons,icons);
		objPO.OpenOverlay();
		objPO.SetPOContent(Dialog.msgBox, true, false, _RemoveMsgBox);
	    objPO.ShowPOContent();
	}
	
	this._createTableCell = function()
	{
		return document.createElement("td");
	}
	
	this.but1 = 'src="/IMG/Steuerelement/tbt/67x16/'+poolfarbe+'_OK.gif" width="67" height="16" border="0" default="true" style="display:none;cursor:pointer"';
	this.but2 = 'src="/IMG/Steuerelement/tbt/67x16/'+poolfarbe+'_Ja.gif" width="67" height="16" border="0" default="true" style="display:none;cursor:pointer"';
	this.but4 = 'src="/IMG/Steuerelement/tbt/67x16/'+poolfarbe+'_Nein.gif" width="67" height="16" border="0" style="display:none;cursor:pointer"';
	this.but8 = 'src="/IMG/Steuerelement/tbt/67x16/'+poolfarbe+'_Abbrechen.gif" width="67" height="16" border="0" style="display:none;cursor:pointer"';
	this.but16 = 'src="/IMG/Steuerelement/tbt/67x16/'+poolfarbe+'_Loeschen.gif" width="67" height="16" border="0" style="display:none;cursor:pointer"';
	
	function buildMsgBox(){

        var lText = '<div id="MsgBoxTable" style="float:left;width:310px;" class=""lineDk"">';
        //lText += '<div class="boxHeadBorder flL" style="height:16px;""><img src="/b.gif"/></div>'
        //lText += '<div class="boxHeadBG ftBold flL" style="height:16px;line-height: 16px; width: 280px; padding-left: 8px;"><span id="MsgBoxHeadline" style="text-align:left;font-weight:800;"></span></div>'
        //lText += '<div class="boxHeadBorder flL" style="height:16px;""><img src="/b.gif"/></div>'
        lText += '<div id="MsgBoxCaption" class="bgStdDk" style="background-image: url(/IMG/layout/Komp/bgcalNav.gif); background-repeat:repeat-x;height:16px;width:287px;padding-left:3px;"><span id="MsgBoxHeadline" style="text-align:left;font-weight:800;"></span></div>';
        lText += '<div id="MsgBoxBox" style="width:258px;padding-left:16px;padding-right:16px;" class="bgStdLt">';
        lText += '<table width="258" cellpadding=0 cellspacing=0 border=0>';
        lText += '<tr class="bgStdLt">';
        lText += '<td id="MsgBoxImage" width=52 height=48 valign=top style="padding:16px 0px;" valign="top">';
        lText += '<img id="symMsgBoxError" src="/IMG/sym/hinweisbox/error.gif" width="48" height="48" border="0" style="display:none">';
        lText += '<img id="symMsgBoxWarning" src="/IMG/sym/hinweisbox/warn.gif" width="48" height="48" border="0" style="display:none">';
        lText += '<img id="symMsgBoxInfo" src="/IMG/sym/hinweisbox/hinweis.gif" width="48" height="44" border="0" style="display:none">';
        lText += '<img id="symMsgBoxQuestion" src="/IMG/sym/hinweisbox/quest.gif" width="48" height="48" border="0" style="display:none">';
        lText += '</td>';
        lText += '<td width=16><img src="/b.gif" width=1 height=1 border=0></td>';
        lText += '<td id="MsgBoxText" width=208 class="std_BgL" valign="middle"></td>';
        lText += '</tr>';
        lText += '<tr class="bgStdLt">';
        lText += '<td colspan=3 align=center height=32>'
        lText += '<img id="msgBoxImgBlank"  style="display:none" onclick="handleMsgBox(0,'+Dialog.Count+')">';
        lText += '<input type=image id="but1" ' + _self.but1 + ' onclick="Dialog.handleMsgBox(1,'+Dialog.Count+')">';
        lText += '<input type=image id="but2" ' + _self.but2 + ' onclick="Dialog.handleMsgBox(2,'+Dialog.Count+')">';
        lText += '<input type=image id="but4" ' + _self.but4 + ' onclick="Dialog.handleMsgBox(4,'+Dialog.Count+')">';
        lText += '<input type=image id="but8" ' + _self.but8 + ' onclick="Dialog.handleMsgBox(8,'+Dialog.Count+')">';
        lText += '<input type=image id="but16" ' + _self.but16 + ' onclick="Dialog.handleMsgBox(16,'+Dialog.Count+')">';
        lText += '<table id="MsgBoxTabButtons" cellpadding=0 cellspacing=0 border=0>';
        lText += '<tr></tr>';
        lText += '</table>';
        lText += '</td>'
        lText += '</tr>';
        lText += '</table>';
        
        lText += '</div>';
        lText += '</div>';
        
        return lText;
    }
	
	this._setMsgBoxButtons = function(buttons)
	{
		var msgBoxButTable = msgGe("MsgBoxTabButtons")
		var li = 0;
		var Knoten;
		var but1 = msgGe("but1").cloneNode(true);
        var but2 = msgGe("but2").cloneNode(true);
        var but4 = msgGe("but4").cloneNode(true);
        var but8 = msgGe("but8").cloneNode(true);
        var but16 = msgGe("but16").cloneNode(true);
		
		
	    while (msgBoxButTable.childNodes[0].childNodes[0].hasChildNodes())
	    {
		    Knoten=msgBoxButTable.childNodes[0].childNodes[0].firstChild;
		    msgBoxButTable.childNodes[0].childNodes[0].removeChild(Knoten);
	    }
	    if ((DIALOG_BUTTON_OK) == buttons){
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    but1.style.display = "block";
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].appendChild(but1);
	    }
	    else if ((DIALOG_BUTTON_CANCEL) == buttons){
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    but8.style.display = "block";
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].appendChild(but8);
	    }
	    else if((DIALOG_BUTTON_OK|DIALOG_BUTTON_CANCEL) == buttons){
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    but1.style.display = "block";
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].appendChild(but1);
		    li++;
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].innerHTML="<img src='/b.gif' width=16 height=16 border=0>";
		    li++;
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    but8.style.display = "block";
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].appendChild(but8);
	    }
	    else if((DIALOG_BUTTON_JA|DIALOG_BUTTON_NEIN) == buttons){
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    but2.style.display = "block";
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].appendChild(but2);
		    li++;
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].innerHTML="<img src='/b.gif' width=16 height=16 border=0>";
		    li++;
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    but4.style.display = "block";
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].appendChild(but4);
	    }
	    else if((DIALOG_BUTTON_JA|DIALOG_BUTTON_NEIN|DIALOG_BUTTON_CANCEL) == buttons){
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    but2.style.display = "block";
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].appendChild(but2);
		    li++;
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].innerHTML="<img src='/b.gif' width=16 height=16 border=0>";
		    li++;
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    but4.style.display = "block";
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].appendChild(but4);
		    li++;
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].innerHTML="<img src='/b.gif' width=16 height=16 border=0>";
		    li++;
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    but8.style.display = "block";
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].appendChild(but8);
	    }
	    else if(DIALOG_OHNE_BUTTON == buttons){
	        msgGe("div_MsgBoxButtons").style.display="none"
	    }
	    else{
		    msgBoxButTable.childNodes[0].childNodes[0].appendChild(this._createTableCell());
		    but1.style.display = "block";
		    msgBoxButTable.childNodes[0].childNodes[0].childNodes[li].appendChild(but1);
	    }
	}
	
	this._ohneScrollbalken = function()
	{
		var breit  = document.body.clientWidth;
        var fbreit  = document.body.scrollWidth;
		var ohneScrollBalken = false;
		
		if (breit != fbreit)
			ohneScrollBalken = true;
		
		return ohneScrollBalken
	}
	
	this._ohneScrollbalkenHoehe = function()
	{
		var hoehe  = document.body.clientHeight;
        var fhoehe  = document.body.scrollHeight;
		var ohneScrollBalken = false;
		
		if (hoehe != fhoehe)
			ohneScrollBalken = true;
		
		return ohneScrollBalken
	}
	
	this._showMsgBoxBG = function()
	{
		objPO.OpenOverlay();
	}
	
	this._showMsgBox = function(title, text, buttons, icons)
	{
	    var divMsgBox;
	    if (ge('MsgBox'+_id)){
	        Dialog.msgBox = ge('MsgBox'+_id);
	        Dialog.msgBox.style.visibility = 'hidden';
	    }
	    else{
	        divMsgBox = document.createElement("div")
	        divMsgBox.id = 'MsgBox'+_id; 
		    divMsgBox.style['position'] = 'absolute';
		    divMsgBox.style['display'] = 'block';
		    divMsgBox.style['visibility'] = 'hidden';
		    divMsgBox.style['zIndex'] = '1000000';
		    divMsgBox.style['width'] = '290px';
		    divMsgBox.innerHTML = buildMsgBox();
	        Dialog.msgBox = document.body.appendChild(divMsgBox);
	    }
		
		Dialog.msgBoxCaption = msgGe("MsgBoxCaption");
		Dialog.open = true;

		this._setMsgBoxButtons(buttons);
	    
		var msgBoxTable = msgGe("MsgBoxTable")
		var msgBoxLeft = 0;
		var msgBoxTop = 0;
		
		var msgBoxText = msgGe("MsgBoxText");
		var msgBoxSymError = msgGe("symMsgBoxError");
		var msgBoxSymWarning = msgGe("symMsgBoxWarning");
		var msgBoxSymInfo = msgGe("symMsgBoxInfo");
		var msgBoxSymQuestion = msgGe("symMsgBoxQuestion");
		var msgBoxHeadline = msgGe("MsgBoxHeadline")
		var msgBoxProgbar = msgGe("MsgBoxProgbar")
		
		var msgBoxWidth = Dialog.msgBox.style.width.replace(/px/,"");
		
		msgGe("MsgBoxHeadline").innerHTML = title;
		msgBoxSymInfo.style.display = "none";
		msgBoxSymError.style.display = "none";
		msgBoxSymWarning.style.display = "none";
		msgBoxSymQuestion.style.display = "none";
		switch(icons){
			case "INFO":
				msgBoxSymInfo.style.display = "block";
				break;
			case "ERROR":
				msgBoxSymError.style.display = "block";
				break;
			case "WARN":
				msgBoxSymWarning.style.display = "block";
				break;
			case "QUEST":
				msgBoxSymQuestion.style.display = "block";
				break;
			case "PROG":
		        msgBoxSymInfo.style.display = "block";
		        msgBoxProgbar.style.display = "";
		        break;
		}
		msgBoxText.innerHTML = text;
    }
}

Dialog.handleMsgBox = function(sStatus, sID)
{
	var msgBoxElem = Dialog.msgBox;
	msgBoxElem.style.visibility = "hidden";

	var lObj = Dialog.hash.get(sID);
	lObj.CloseOverlay();
	
	if (Dialog.msgBoxCallback!=undefined) 
		Dialog.msgBoxCallback(sStatus);
	Dialog.open = false;
	Dialog.Count -= 1;
	if (Dialog.Count < 0)
	    Dialog.Count = 0;
}

Dialog.beep = function(sStatus){
	/*if (document.all){
		if (sStatus==0)
	    	msgGe("msgBoxError").play();
		else
			msgGe("msgBoxInfo").play();
	}*/
}

function msgGe(id) {
	if (document.getElementById)
		return document.getElementById(id);
	else
		return document.all[id];
}


function msgBox(resultCallback){
    var _self = this;
    var _objPO = new PageOverlay();
    var _resultCallBack = resultCallback; 
    var _RemoveMsgBox = true;
    var _id = 0;
    
    this.msgBoxObj = null;
    
    this.but1 = '/IMG/Steuerelement/tbt/67x16/'+poolfarbe+'_OK.gif';
	this.but2 = '/IMG/Steuerelement/tbt/67x16/'+poolfarbe+'_Ja.gif';
	this.but4 = '/IMG/Steuerelement/tbt/67x16/'+poolfarbe+'_Nein.gif';
	this.but8 = '/IMG/Steuerelement/tbt/67x16/'+poolfarbe+'_Abbrechen.gif';
	this.but16 = '/IMG/Steuerelement/tbt/67x16/'+poolfarbe+'_Loeschen.gif';
    
    this.msgBoxCaption = '';
    this.msgBoxVisible = true;
    
    function _renderMsgBox(title, text, buttons, icons){
        var divMsgBox;
        
        divMsgBox = document.createElement("div")
        divMsgBox.id = 'MsgBox'+_id; 
	    divMsgBox.style['position'] = 'absolute';
	    divMsgBox.style['display'] = 'block';
	    divMsgBox.style['visibility'] = 'hidden';
	    divMsgBox.style['zIndex'] = '1000000';
	    divMsgBox.style['width'] = '290px';
	    _buildMsgBox(divMsgBox);
        _self.msgBoxObj = divMsgBox;
        _objPO.OpenOverlay();
		_objPO.SetPOContent(_self.msgBoxObj, true, false, true);
        
        _self.msgBoxCaption = ge("MsgBoxCaption");
		_self.open = true;
        
      
        _setMsgBoxButtons(buttons);
	    
		var msgBoxTable = ge("MsgBoxTable")
		var msgBoxLeft = 0;
		var msgBoxTop = 0;
		
		var msgBoxText = ge("MsgBoxText");
		var msgBoxSymError = ge("symMsgBoxError");
		var msgBoxSymWarning = ge("symMsgBoxWarning");
		var msgBoxSymInfo = ge("symMsgBoxInfo");
		var msgBoxSymQuestion = ge("symMsgBoxQuestion");
		var msgBoxHeadline = ge("MsgBoxHeadline")
		
		var msgBoxWidth = _self.msgBoxObj.style.width.replace(/px/,"");
		
		ge("MsgBoxHeadline").innerHTML = title;
		msgBoxSymInfo.style.display = "none";
		msgBoxSymError.style.display = "none";
		msgBoxSymWarning.style.display = "none";
		msgBoxSymQuestion.style.display = "none";
		switch(icons){
			case "INFO":
				msgBoxSymInfo.style.display = "block";
				break;
			case "ERROR":
				msgBoxSymError.style.display = "block";
				break;
			case "WARN":
				msgBoxSymWarning.style.display = "block";
				break;
			case "QUEST":
				msgBoxSymQuestion.style.display = "block";
				break;
		}
		msgBoxText.innerHTML = text; 

    }
    
    
    this.show = function(title, text, buttons, icons, removeObj, id){
        
        if (typeof(removeObj) != 'undefined')
		    _RemoveMsgBox = removeObj;
		    
		if (typeof(id) != 'undefined')
		    _id = id;
        
        _renderMsgBox(title, text, buttons, icons);
        
        
		
		multihandle_append(ge('but1'),"onclick",function (e){
            _self.handleBox(1);
        });
        multihandle_append(ge('but2'),"onclick",function (e){
            _self.handleBox(2);
        });
        multihandle_append(ge('but4'),"onclick",function (e){
            _self.handleBox(4);
        });
        multihandle_append(ge('but8'),"onclick",function (e){
            _self.handleBox(8);
        });
        multihandle_append(ge('but16'),"onclick",function (e){
            _self.handleBox(16);
        });
		
		
	    _objPO.ShowPOContent();

    }
    
    
    function _buildMsgBox(objDiv){
        
        var divBd = document.createElement("div");
        divBd.id = 'MsgBoxTable';
	    divBd.style.cssFloat = 'left';
	    divBd.style.width = '290px';
        divBd.className = 'lineDk';
        objDiv.appendChild(divBd);
        
        var divCap = document.createElement("div");
        divCap.id = 'MsgBoxCaption';
        divCap.className = 'bgStdDk';
        divCap.style.backgroundImage = 'url(/IMG/layout/Komp/bgcalNav.gif)';
	    divCap.style.width = '287px';
        divCap.style.height = '16px';
        divCap.style.backgroundRepeat = 'repeat-x';
        divCap.style.paddingLeft = '3px';
        
        var spnCap = document.createElement("span");
        spnCap.id = 'MsgBoxHeadline';
        spnCap.style.textAlign = 'left';
        spnCap.style.fontWeight = '800';
        
        divCap.appendChild(spnCap);
        divBd.appendChild(divCap);
        
        var divMsgBB = document.createElement("div");
        divMsgBB.id = 'MsgBoxBox';
        divMsgBB.className = 'bgStdLt';
        divMsgBB.style.paddingLeft = '16px';
        divMsgBB.style.paddingRight = '16px';
	    divMsgBB.style.width = '258px';
        
        divBd.appendChild(divMsgBB);
        
        var tab = document.createElement("table");
        tab.id = 'msgTab';
        tab.width = '258';
        tab.cellPadding = '0';
        tab.cellSpacing = '0';
        tab.border = '0';
        
        var trTop = document.createElement("tr");
        trTop.className = 'bgStdLt';
        
        var tdImg = document.createElement("td");
        tdImg.id = 'MsgBoxImage';
        tdImg.width = '52';
        tdImg.height = '48';
        tdImg.vAlign = 'top';
        tdImg.style.padding = '16px 0px';
        
        
        var imgErr = document.createElement("img");
        imgErr.id = 'symMsgBoxError';
        imgErr.src = '/IMG/sym/hinweisbox/error.gif';
        imgErr.width = '48';
        imgErr.height = '48';
        imgErr.border = '0';
        imgErr.style.display = 'none';
        tdImg.appendChild(imgErr);
        
        var imgWarn = document.createElement("img");
        imgWarn.id = 'symMsgBoxWarning';
        imgWarn.src = '/IMG/sym/hinweisbox/warn.gif';
        imgWarn.width = '48';
        imgWarn.height = '48';
        imgWarn.border = '0';
        imgWarn.style.display = 'none';
        tdImg.appendChild(imgWarn);
        
        var imgInfo = document.createElement("img");
        imgInfo.id = 'symMsgBoxInfo';
        imgInfo.src = '/IMG/sym/hinweisbox/hinweis.gif';
        imgInfo.width = '48';
        imgInfo.height = '48';
        imgInfo.border = '0';
        imgInfo.style.display = 'none';
        tdImg.appendChild(imgInfo);
        
        var imgQuest = document.createElement("img");
        imgQuest.id = 'symMsgBoxQuestion';
        imgQuest.src = '/IMG/sym/hinweisbox/quest.gif';
        imgQuest.width = '48';
        imgQuest.height = '48';
        imgQuest.border = '0';
        imgQuest.style.display = 'none';
        tdImg.appendChild(imgQuest);
        
        trTop.appendChild(tdImg);
        
        var tdText = document.createElement("td");
        tdText.id = 'MsgBoxText';
        tdText.width = '208';
        tdText.setAttribute('valign','middle');
        tdText.style.paddingLeft = '16px';
        
        trTop.appendChild(tdText);
     
        tab.appendChild(trTop);
        
        var trBot = document.createElement("tr");
        trBot.className = 'bgStdLt';
        
        var tdBut = document.createElement("td");
        tdBut.id = 'tdInput';
        tdBut.colSpan = '2';
        tdBut.align = 'center';
        tdBut.height = '32';
        
        var but1 = document.createElement("input");
        but1.id = 'but1';
        but1.type = 'image';
        but1.src = _self.but1;
        but1.width = '67';
        but1.height = '16';
        but1.border = '0' 
        //but1.default = 'true' 
        but1.style.display = 'none';
        but1.style.cursor = 'pointer';
        tdBut.appendChild(but1);
        
        var but2 = document.createElement("input");
        but2.id = 'but2';
        but2.type = 'image';
        but2.src = _self.but2;
        but2.width = '67';
        but2.height = '16';
        but2.border = '0' 
        //but1.default = 'true' 
        but2.style.display = 'none';
        but2.style.cursor = 'pointer';
                
        tdBut.appendChild(but2);
        
        
        
        var but4 = document.createElement("input");
        but4.id = 'but4';
        but4.type = 'image';
        but4.src = _self.but4;
        but4.width = '67';
        but4.height = '16';
        but4.border = '0' 
        //but1.default = 'true' 
        but4.style.display = 'none';
        but4.style.cursor = 'pointer';
        tdBut.appendChild(but4);
        
        var but8 = document.createElement("input");
        but8.id = 'but8';
        but8.type = 'image';
        but8.src = _self.but8;
        but8.width = '67';
        but8.height = '16';
        but8.border = '0' 
        //but1.default = 'true' 
        but8.style.display = 'none';
        but8.style.cursor = 'pointer';
        tdBut.appendChild(but8);
        
        var but16 = document.createElement("input");
        but16.id = 'but16';
        but16.type = 'image';
        but16.src = _self.but16;
        but16.width = '67';
        but16.height = '16';
        but16.border = '0' 
        //but1.default = 'true' 
        but16.style.display = 'none';
        but16.style.cursor = 'pointer';
        tdBut.appendChild(but16);
        
        var tabBut = document.createElement("table");
        tabBut.id = 'MsgBoxTabButtons';
        tabBut.cellPadding = '0';
        tabBut.cellSpacing = '0';
        tabBut.border = '0';
        
        var trBut = document.createElement("tr");
        
        tabBut.appendChild(trBut);
        
        tdBut.appendChild(tabBut);
        
        trBot.appendChild(tdBut);
        
        tab.appendChild(trBot);
        
        divMsgBB.appendChild(tab);
        
    }
    
    function _createTableCell(){
		return document.createElement("td");
	}
    
    function _setMsgBoxButtons(buttons)
	{
		var butDiv = ge("MsgBoxTabButtons");
		var tdInput = ge("tdInput"); 
		var li = 0;
		var Knoten;
		var but1 = ge("but1");
        var but2 = ge("but2");
        var but4 = ge("but4");
        var but8 = ge("but8");
        var but16 = ge("but16");
	    
	    while (butDiv.childNodes[0].hasChildNodes())
	    {
		    Knoten=butDiv.childNodes[0].childNodes[0].firstChild;
		    butDiv.childNodes[0].childNodes[0].removeChild(Knoten);
	    }
	    if ((DIALOG_BUTTON_OK) == buttons){
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    but1.style.display = "block";
		    butDiv.childNodes[0].childNodes[li].appendChild(but1);
	    }
	    else if ((DIALOG_BUTTON_CANCEL) == buttons){
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    but8.style.display = "block";
		    butDiv.childNodes[0].childNodes[li].appendChild(but8);
	    }
	    else if((DIALOG_BUTTON_OK|DIALOG_BUTTON_CANCEL) == buttons){
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    but1.style.display = "block";
		    butDiv.childNodes[0].childNodes[li].appendChild(but1);
		    li++;
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    butDiv.childNodes[0].childNodes[li].innerHTML="<img src='/b.gif' width=16 height=16 border=0>";
		    li++;
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    but8.style.display = "block";
		    butDiv.childNodes[0].childNodes[li].appendChild(but8);
	    }
	    else if((DIALOG_BUTTON_JA|DIALOG_BUTTON_NEIN) == buttons){
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    but2.style.display = "block";
		    butDiv.childNodes[0].childNodes[li].appendChild(but2);
		    li++;
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    butDiv.childNodes[0].childNodes[li].innerHTML="<img src='/b.gif' width=16 height=16 border=0>";
		    li++;
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    but4.style.display = "block";
		    butDiv.childNodes[0].childNodes[li].appendChild(but4);
	    }
	    else if((DIALOG_BUTTON_JA|DIALOG_BUTTON_NEIN|DIALOG_BUTTON_CANCEL) == buttons){
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    but2.style.display = "block";
		    butDiv.childNodes[0].childNodes[li].appendChild(but2);
		    li++;
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    butDiv.childNodes[0].childNodes[li].innerHTML="<img src='/b.gif' width=16 height=16 border=0>";
		    li++;
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    but4.style.display = "block";
		    butDiv.childNodes[0].childNodes[li].appendChild(but4);
		    li++;
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    butDiv.childNodes[0].childNodes[li].innerHTML="<img src='/b.gif' width=16 height=16 border=0>";
		    li++;
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    but8.style.display = "block";
		    butDiv.childNodes[0].childNodes[li].appendChild(but8);
	    }
	    else if(DIALOG_OHNE_BUTTON == buttons){
	        ge("div_MsgBoxButtons").style.display="none"
	    }
	    else{
		    butDiv.childNodes[0].appendChild(_createTableCell());
		    but1.style.display = "block";
		    butDiv.childNodes[0].childNodes[li].appendChild(but1);
	    }
	}
    
    this.handleBox = function(sStatus){
       
	    _self.msgBoxObj.style.visibility = "hidden";
	    _objPO.CloseOverlay(_objPO.id);
	    //document.body.removeChild(_self.msgBoxObj);
	    if (_resultCallBack != null)
            _resultCallBack(sStatus);
        
    }
}
