﻿var JaFunction=null;
var IgnoreFunction=null;
var AbbrFunction=null;
var todoFunction=null;
var altblockvisibility;
var confirmed = false;
var myconfirmOK = '';


function myconfirm(pTitel,pFrage,pJaFunction,pIgnoreFunction,pAbbrFunction,pOKonly)
{
    confirmed=false;
    todoFunction=null;
    JaFunction=null;
    IgnoreFunction=null;
    AbbrFunction=null;

    var blockimg=document.getElementById("blockimg");
    var myconfirmdiv=document.getElementById("myconfirmDiv1");
    var myconfirmtiteldiv=document.getElementById("myconfirmDiv2b");
    var myconfirmtitel=document.getElementById("myconfirmTitel");
    var myconfirmfrage=document.getElementById("myconfirmFrage");
    var myconfirmIgnoreButton=document.getElementById("myconfirmIgnoreButton");
    var myconfirmOkButton=document.getElementById("myconfirmOkButton");
    var myconfirmCancelButton=document.getElementById("myconfirmCancelButton");
    var myconfirmIgnoreImg=document.getElementById("myconfirmIgnoreImg");
    var myconfirmOkImg=document.getElementById("myconfirmOkImg");
    var myconfirmCancelImg=document.getElementById("myconfirmCancelImg");
    if(myconfirmdiv) 
   {
         if(typeof(pJaFunction)!="undefined")JaFunction=pJaFunction;
         if(typeof(pIgnoreFunction)!="undefined")IgnoreFunction=pIgnoreFunction;
         if(typeof(pIgnoreFunction)!="undefined")AbbrFunction=pAbbrFunction;
         if(IgnoreFunction!=null)
        { 
            myconfirmIgnoreButton.style.visibility="";
            myconfirmIgnoreImg.style.width="";
        } 
         else
        { 
            myconfirmIgnoreButton.style.visibility="hidden";
            myconfirmIgnoreImg.style.width="0px";
         } 
         if((JaFunction!=null)||((JaFunction==null)&&(IgnoreFunction==null)&&(AbbrFunction==null)))
        { 
            myconfirmOkButton.style.visibility="";
            myconfirmOkImg.style.width="";
        } 
         else
        { 
            myconfirmOkButton.style.visibility="hidden";
            myconfirmOkImg.style.width="0px";
        }
         if((JaFunction!=null)||(IgnoreFunction!=null)||(AbbrFunction!=null))
        { 
            myconfirmCancelButton.style.visibility="";
            myconfirmCancelImg.style.width="";
        } 
         else
        { 
            myconfirmCancelButton.style.visibility="hidden";
            myconfirmCancelImg.style.width="0px";
        }
        
         
        if ( typeof(pOKonly) != "undefined" && pOKonly == true)
        {
            myconfirmIgnoreButton.style.visibility="hidden";
            myconfirmIgnoreImg.style.width="0px";
            myconfirmCancelButton.style.visibility="hidden";
            myconfirmCancelImg.style.width="0px"; 
        } 
          
         myconfirmtitel.innerHTML=pTitel;
         myconfirmfrage.innerHTML=pFrage; 
         myconfirmfrage.style.paddingLeft = '5px';
         myconfirmfrage.style.paddingRight = '5px';
         
         if(pTitel=="") myconfirmtiteldiv.style.height="0px";
 
         myconfirmdiv.style.width=Fwidth+"px";
         myconfirmdiv.style.height=Fheight+"px";
         myconfirmdiv.style.visibility="visible";
         if(blockimg)
         {
            altblockvisibility = blockimg.style.visibility;
            blockimg.style.zIndex="500";
            blockimg.style.visibility="visible";
        }
        myconfirmdiv.focus(); 
   } 
   
}

function ShowBlockImg()
{
    var blockimg=document.getElementById("blockimg");
    blockimg.style.zIndex="1001";
    blockimg.style.visibility="visible"; 
}

function HideBlockImg()
{
       var blockimg=document.getElementById("blockimg"); 
       blockimg.style.zIndex="99";
       blockimg.style.visibility='hidden';
   }
var AutoOkenable = new Date();
function myconfirm2(pTitel,pFrage,pTimeOut,onDoFunk) {
   if(!pTimeOut) return;
   myconfirm(pTitel, pFrage, typeof (onDoFunk) != "undefined" ? onDoFunk : null, null, typeof (onDoFunk) != "undefined" ? onDoFunk : null, true);
   AutoOkenable = new Date();
   myconfirmCountdownd(pTimeOut, AutoOkenable.toString());
   setTimeout("if(AutoOkenable.toString()=='" + AutoOkenable.toString() + "')myconfirmclick(1);", pTimeOut * 1000);
}
function myconfirmCountdownd(pSec,pDate) {
    if (AutoOkenable.toString() != pDate) return;
    var counter = document.getElementById('myConfirmInfo');
    if (counter) {
        if (pSec > 1) {
            counter.innerHTML = "( '" + myconfirmOK + "' " + confirmIn + " " + pSec.toString() + " " + confirmSec + " )";
            setTimeout("myconfirmCountdownd(" + (pSec - 1).toString() + ",'" + pDate + "');", 1000);
        } else if (pSec == 1) {
            counter.innerHTML = "( '" + myconfirmOK + "' " + confirmIn + " " + pSec.toString() + " " + confirm1Sec + " )";
            setTimeout("myconfirmCountdownd(0,'" + pDate + "');", 1000);
        } else
            counter.innerHTML = "";
    }
}
function myconfirmclick(pAct) {
    AutoOkenable = new Date();
    var myConfirmInfo = document.getElementById('myConfirmInfo');
    if (myConfirmInfo) myConfirmInfo.innerHTML = '';
   if(confirmed)return;
   confirmed=true;
   var blockimg=document.getElementById("blockimg");
    var myconfirmdiv=document.getElementById("myconfirmDiv1");
    var myconfirmtitel=document.getElementById("myconfirmTitel");
    var myconfirmfrage=document.getElementById("myconfirmFrage");
    var myconfirmIgnoreButton=document.getElementById("myconfirmIgnoreButton");
     myconfirmtitel.innerHTML="";
     myconfirmfrage.innerHTML=""; 
     myconfirmdiv.style.visibility="hidden";
     if(blockimg)
     {
        blockimg.style.zIndex="99";
        blockimg.style.visibility=altblockvisibility;
     }
     todoFunction=null;
     if(pAct==1)
        if(JaFunction)
            todoFunction=JaFunction;   
     if(pAct==2)
        if(IgnoreFunction)
            todoFunction=IgnoreFunction;
     if(pAct==3)
        if(AbbrFunction)
            todoFunction=AbbrFunction;   
     JaFunction=null;
     IgnoreFunction=null;
     AbbrFunction = null;
     if(todoFunction)todoFunction();
}

function createconfirm(pAltOK, pAltIngnore, pAltCancel) {
    myconfirmOK = pAltOK;
    var htmcode = '';
   
    htmcode+="<table class='ModalPopupPos' border=0 id='myconfirmDiv1'><tr><td valign=middle>"
    
    htmcode+="<table cellspacing=0 cellpadding=0 border=0 class='ModalPopupForeground' align=center >"
    
    htmcode+="<tr><td class='ModalPopupTitle' id='myconfirmDiv2'>"
    htmcode+="    <center id='myconfirmTitelFrame'></center>"
    htmcode+="</td></tr>"
   
    htmcode+="<tr><td class='ModalPopupTitleBody' id='myconfirmDiv2b'>"
    htmcode+="    <center id='myconfirmTitel'></center>"
    htmcode+="</td></tr>"
    
    htmcode+="<tr><td class='ModalPopupText' id='myconfirmDiv3' >"
    htmcode+="    <center id='myconfirmFrage'></center>"
    htmcode+="</td></tr>"
    
    htmcode+="<tr><td class='ModalPopupButtonsBody' id='myconfirmDiv4b' align='center'>"
    
    htmcode+="    <center><table width='0' cellspacing=0 cellpadding=0  border=0 ><tr valign=bottom> <td id='myconfirmOkButton' onclick='myconfirmclick(1);' width=0>"
    htmcode+="            <input type=image border=0 alt='"+pAltOK+"' src='../images/Icons/BTOK.ICO' id='myconfirmOkImg'>"
    htmcode+="    </td>"
    htmcode+="    <td id='myconfirmIgnoreButton' onclick='myconfirmclick(2);'  width=0>"    
    htmcode+="        <input type=image border=0 alt='"+pAltIngnore+"' src='../images/Icons/BTIGNORE.ICO' id='myconfirmIgnoreImg' >"
    htmcode+="    </td>"
    htmcode+="    <td id='myconfirmCancelButton' onclick='myconfirmclick(3);'  width=0>"
    htmcode+="        <input type=image border=0 alt='"+pAltCancel+"' src='../images/Icons/BTCANCEL.ICO' id='myconfirmCancelImg' >"
    htmcode+="    </td></tr></table></center> "
    
    htmcode+="</td></tr>"

    htmcode += "<tr><td class='ModalPopupButtons' id='myconfirmDiv4' align='center'><center><div id='myConfirmInfo'></div>"
    htmcode+="</center> "
    htmcode+="</td></tr>"
    htmcode+="</table>"
    
    htmcode+="</td></tr></table>"
    
    document.write(htmcode);
    
}

