
//globale Variablen definieren
var aktiv;
var activeMenuePoint = 0;
var animationOnOff = "off";
var imageBlendInAktion = "";
var dragDropElementType = "";
var MausX = 0;
var MausY = 0;
var elementTypeRightMouseClick = "";
var activeElementID= 0;
var currentDate = "";
var debugProject = false;
var correctlyBrowser = true;

if(navigator.appName != "Microsoft Internet Explorer") correctlyBrowser = false;

function disableIMAGEPLEASEWAIT(allWindowNames)
{
 var allWindows = allWindowNames.split(",");
 for(var i=0;i<4;i++)
 {
  if(parent.top.frames[allWindows[i]]) 
  {
   if(parent.top.frames[allWindows[i]].document.getElementById('IMAGEPLEASEWAIT'))
   {
    parent.top.frames[allWindows[i]].document.getElementById('IMAGEPLEASEWAIT').style.visibility='hidden';
    if(allWindows[i] == "ContentView" && parent.top.frames[allWindows[i]].document.getElementById('IMAGEPLEASEWAIT2'))
    {
     parent.top.frames[allWindows[i]].document.getElementById('IMAGEPLEASEWAIT2').style.visibility='hidden';
    }
   }
  }
 }
}

function getActiveUserName()
{
 var rueckgabe = "";
 var label = null;
 try
 {
  if(document.getElementById("LabelActiveUserName") != null) label= document.getElementById("LabelActiveUserName");
  if(top.document.getElementById("LabelActiveUserName") != null) label= top.document.getElementById("LabelActiveUserName");
  if(parent.top.document.getElementById("LabelActiveUserName") != null) label= parent.top.document.getElementById("LabelActiveUserName");
 
  if(label != null)
  {
   rueckgabe = label.innerText;
  }
 }
 catch(exception)
 {
  rueckgabe = "";
  window.status = "getActiveUserName " + exception.description;
 }
 finally
 {
  label = null;
 }
 
 return rueckgabe;
}

function writeErrorMessage(error)
{
  if(debugProject == true)
  {
   var message = "";
   if(error.description != null) message += error.description + "\n\n";
   if(error.message != null) message += error.message;
   alert("setFrameSize " + message);
  }
  else
  {
   window.status = "setFrameSize " + error;
  }
}

function SymError()
{
 if(debugProject == false)
 {
  return true;
 }
}

function getProjectURL()
{
 var counter=0;
 var rueckgabe ="";
 var checkZeichen = null;
 try
 {
  if(document.URL.indexOf("/")>-1)
  {
   for(var i=0;i<document.URL.length;i++)
   {   
    checkZeichen = document.URL.substr(i,1);
    if(checkZeichen=="/") counter++;
    if(counter<5)
    {
     rueckgabe+=checkZeichen;
    }
   }
  }
 }
 catch(exception)
 {
  window.status = "showErrorDialog " + exception.description;
 }
 finally
 {
  checkZeichen = null;
 }
 return rueckgabe;
}

function showErrorDialog(errorCode,x,y,reloadTreeView,systemErrorMessage) 
{
 try
 {
  var parameter = "?systemErrorMessage=" + systemErrorMessage + "&reloadTreeView=" + reloadTreeView + "&errorCode=" + errorCode;
  var x = 400;
  var y = 145;
  var maxWindowWidth =(Math.abs(screen.availWidth) - x) / 2;
  var maxWindowHeight=(Math.abs(screen.availHeight) - y) / 2; 
  var counter=0;
  var projectURL ="";
  var checkZeichen = "";
  if(document.URL.indexOf("/")>-1)
  {
   for(var i=0;i<document.URL.length;i++)
   {   
    checkZeichen = document.URL.substr(i,1);
    if(checkZeichen=="/") counter++;
    if(counter<4)
    {
     projectURL+=checkZeichen;
    }
   }
  }

  if(reloadTreeView=="") {reloadTreeView = "no";}
  preViewWindow = window.open(projectURL + "/includes/HTML/ErrorMessageDialog.html" + parameter,"Achtung","toolbar=no,status=no,location=no,menubar=no,resizable=no,hotkeys=no,width=" + x + ",height=" + y);
  preViewWindow.moveTo(maxWindowWidth,maxWindowHeight);  
  preViewWindow.focus();
 }
 catch(exception)
 {
  window.status = "showErrorDialog " + exception.description;
 }  
 finally
 {
  x=null;
  y=null;
  maxWindowWidth=null;
  maxWindowHeight=null;
  parameter=null;
  counter=null;
  checkZeichen=null;
 }
}

if(parent.top.frames["CMEMenue"])
{
 if(parent.top.frames["CMEMenue"].document.getElementById('TextBoxSessionTimeOut'))
 {
  parent.top.frames["CMEMenue"].document.getElementById('TextBoxSessionTimeOut').value =10;
 }
}

function pleaseWait()
{
 var allWindows = "CMEMenue,TreeView,ContentView,SettingsPanel,ShortCuts".split(",");
 for(var i=0;i<allWindows.length;i++)
 {
  if(parent.top.frames[allWindows[i]]) 
  {
   if(parent.top.frames[allWindows[i]].document.getElementById('IMAGEPLEASEWAIT'))
   {
    var activeWindow = parent.top.frames[allWindows[i]].document.getElementById('IMAGEPLEASEWAIT');
    activeWindow.style.width=activeWindow.document.body.offsetWidth + 'px';
    activeWindow.style.height=activeWindow.document.body.offsetHeight + 'px'; 
    activeWindow.style.visibility='visible';
    if(allWindows[i] == "ContentView")
    {
     if(parent.top.frames[allWindows[i]].document.getElementById('IMAGEPLEASEWAIT2'))
     {
      activeWindow = parent.top.frames[allWindows[i]].document.getElementById('IMAGEPLEASEWAIT2');
      activeWindow.style.visibility='visible';
      activeWindow.style.left = Math.abs(Math.abs(activeWindow.document.body.offsetWidth / 2) - 150) + "px";
      activeWindow.style.top  = Math.abs(Math.abs(activeWindow.document.body.offsetHeight / 2) - 100) + "px";
     }
    }
   }
  }
 }
}

function gotonode(activeNodeID,searchNode)
{
 loadTreeViewByNode(activeNodeID,searchNode);
}

function loadTreeViewByNode(activeNodeID,searchNode)
{
 if(parent.top.frames["TreeView"] && parent.top.frames["TreeView"].document.FORM1) 
 {
  parent.top.frames["TreeView"].document.FORM1.reset(); 
  parent.top.frames["TreeView"].document.getElementById("TextBoxHiddenRightMouseClick").value = "activeNodePath=" + searchNodePath;
  parent.top.frames["TreeView"].document.FORM1.submit();
 }
}

function gotopath(searchNodePath)
{
 loadTreeViewByPath(searchNodePath);
}

function loadTreeViewByPath(searchNodePath)
{
 if(parent.top.frames["TreeView"] && parent.top.frames["TreeView"].document.FORM1) 
 {
  parent.top.frames["TreeView"].document.FORM1.reset(); 
  parent.top.frames["TreeView"].document.getElementById("TextBoxHiddenRightMouseClick").value = "path:" + searchNodePath;
  parent.top.frames["TreeView"].document.FORM1.submit();  
 }
}

function moveToTOP(Element)
{
 try
 {
  if(parent.top.frames["ContentView"])
  {
   parent.top.frames["ContentView"].scrollTo(1,1);
  }
  if(parent.top.frames["TreeView"])
  {
   parent.top.frames["TreeView"].scrollTo(1,1);
  }

  if(document.getElementById(Element)) 
  {
   document.getElementById(Element).style.position = "absolute";
   document.getElementById(Element).style.top = "1px";
   document.getElementById(Element).style.left = "1px";
 }
  setTimeout('moveToTOP("' + Element + '")',1000);
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }
}

function moveToTOP2(Element,x,y)
{
 try
 {
  if(parent.top.frames["ContentView"])
  {
   parent.top.frames["ContentView"].scrollTo(1,1);
  }
  if(parent.top.frames["TreeView"])
  {
   parent.top.frames["TreeView"].scrollTo(1,1);
  }
    
  if(document.getElementById(Element)) 
  {
   document.getElementById(Element).style.position = "absolute";
   document.getElementById(Element).style.top = y + "px";
   document.getElementById(Element).style.left = x + "px";
  }
  setTimeout('moveToTOP2("' + Element + '","' + x + '","' + y + '")',1000);
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }
}

if(document.layers) document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=click;
document.oncontextmenu=click2; 

function clearEvent()
{
 try
 {
  if(correctlyBrowser == true)
  {
   if(event)
   {
    event.returnValue=false;
    event.keyCode = 0;
   }
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }
}

function cancelKey(evt) 
{
 try
 {
  if(event.ctrlKey == false && event.shiftKey == false && event.altKey == false)
  {
   if (evt.preventDefault) 
   {
    evt.preventDefault();
    return false;
   }
   else 
   {
    evt.keyCode = 0;
    evt.returnValue = false;
   }
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }
}

function click(e)
{
 try
 {  
  //unterdruecken der rechten MausTaste
  if(document.all)if(event.button == 2) return false;
  if(document.layers)if (e.which == 3) return false;
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }
} 

function createFavoriteMenue()
{
 if(parent.top.frames["TreeView"].document.getElementById("DIVShortCuts"))
 {
  var DIVShortCuts = parent.top.frames["TreeView"].document.getElementById("DIVShortCuts");
  var DIVShortCutsShadow = parent.top.frames["TreeView"].document.getElementById("DIVShortCutsShadow")
  
  if(DIVShortCuts.style.visibility=="visible")
  {
   DIVShortCuts.style.visibility="hidden";
   DIVShortCutsShadow.style.visibility="hidden";
  }
  else
  {
   var minSize = 125;
   if(DIVShortCuts.style.width.replace("px","")<250)
   {
    minSize = 25;   
   }

   DIVShortCuts.style.visibility="visible";
   DIVShortCutsShadow.style.visibility="visible";
   DIVShortCuts.style.left = minSize + "px";
   DIVShortCutsShadow.style.left = Math.abs(minSize-1) + "px";
   DIVShortCuts.style.top = 200;
   DIVShortCutsShadow.style.top = 199;
  }
 }
}

function click2()
{
 var minSize = 125;
 var minimize= 2.5;
 try
 {
  if(window.name == "TreeView")
  {
   if(Math.abs(document.getElementById("TreeView").style.width.replace('px',''))<250)
   {
     minSize = 35;
     minimize=5;
   }
    
   if(document.getElementById("DIVShortCuts"))
   {
    var aElement = document.getElementById("DIVShortCuts");
    var aElement2 = document.getElementById("DIVShortCutsShadow");
    if(aElement.style.visibility=="visible")
    {
     aElement.style.visibility="hidden";
     aElement2.style.visibility="hidden";
    }
    else
    {
     aElement.style.visibility="visible";
     aElement2.style.visibility="visible";
     if(window.event.x<minSize)
     {
      aElement.style.left = window.event.x + 20;
      aElement2.style.left = window.event.x +19;
     }
     else
     {
      aElement.style.left = window.event.x / minimize;
      aElement2.style.left = window.event.x / minimize - 1;
     }
     aElement.style.top = window.event.y;
     aElement2.style.top = window.event.y - 1;
    }
   }
  }
  else
  {
   if(elementTypeRightMouseClick != "") 
   {
    CMEMenueOnOff('MenuePoint1');
   }
  } 
  if(debugProject == false)
  {
   if(document.getElementById('downloadDialog'))
   {
    if(document.getElementById('downloadDialog').style.visibility == "hidden")
    {
      event.returnValue=false;
      return false;
    }
   }
   else
   {
    event.returnValue=false;
    return false;
   }
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 } 
 finally
 {
  aElement=null;
  aElement2=null;
 }
}

function showDateTime(setDateTime)
{
 try
 {
  var Jetzt = new Date();
  var Stunden = Jetzt.getHours();
  var Minuten = Jetzt.getMinutes();
  var Sekunden = Jetzt.getSeconds();
  var Vorstd  = ((Stunden < 10) ? "0" : "");
  var Vormin  = ((Minuten < 10) ? ":0" : ":");
  var Vorsek  = ((Sekunden < 10) ? ":0" : ":");
  var Uhrzeit = Vorstd + Stunden + Vormin + Minuten + Vorsek + Sekunden;
  var Gesamt = currentDate + Uhrzeit;
      document.getElementById('TextBoxDateTime').value = Gesamt;
      document.getElementById('TextBoxDateTime').setAttribute("size", Math.abs(Gesamt.length +2));
      setTimeout('showDateTime("");',1000);
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }      
}

function getCurrentDate()
{
 try
 {
  var Wochentagname =  new Array("So","Mo","Di","Mi","Do","Fr","Sa");
  var Jetzt = new Date();
  var Tag = Jetzt.getDate();
  var Monat = Jetzt.getMonth() + 1;
  var Jahr = Jetzt.getYear();
  if(Jahr < 999) Jahr += 1900;
  var WoTag = Jetzt.getDay();
  var Vortag  = ((Tag < 10) ? "0" : "");
  var Vormon  = ((Monat < 10) ? ".0" : ".");
  var Datum = Vortag + Tag + Vormon + Monat  + "." + Jahr;
  currentDate = Wochentagname[WoTag] + ", " + Datum + ", ";
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }   
}

function refreshSessionImages()
{
 try
 {
 if(parent.top.frames["CMEMenue"])
 { 
  var aElement = parent.top.frames["CMEMenue"];
  if(aElement.document.getElementById('TextBoxSessionTimeOut'))
  {
   var timeOut = aElement.document.getElementById('TextBoxSessionTimeOut').value;
   if(Math.abs(timeOut)>-1)
   {
    for(var i =1; i<= Math.abs(timeOut); i++)
    {
     if(aElement.document.getElementById("SessionImage" + i))
     {
      aElement.document.getElementById("SessionImage" + i).style.visibility = "visible";
      if(aElement.document.URL.indexOf("endlessSession=true")<0)
      {
       aElement.document.getElementById("SessionImage" + i).alt = timeOut + unescape(" Minute[n] bis erneuten Anmeldung am System\n\rDoppelklick um Zeitbeschr%E4nkung zu deaktivieren.");
      }
      else
      {
       aElement.document.getElementById("SessionImage" + i).alt = unescape(" Zeitbeschr%E4nkung deaktiviert!\n\rDoppelklick um Zeitbeschr%E4nkung zu aktivieren.");
      }
     }
    }
    for(var i = Math.abs(timeOut)+1; i <= 10; i++)
    {
     if(aElement.document.getElementById("SessionImage" + i))
     {
      aElement.document.getElementById("SessionImage" + i).style.visibility = "hidden";
     }
    }
   }
  }
 }
 return false;
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }
 finally
 {
  aElement=null;
 }
}

function setEndlessSession()
{
 var settingsPanel = false;
 if(top.document.getElementById("FRAMESET2").cols.indexOf(",212")>-1) {settingsPanel = true;}
 setFramesToDefaultSettings(settingsPanel);
 try
 {
  if(parent.top.frames["CMEMenue"].document.URL.indexOf("endlessSession=true")>-1)
  {
   parent.top.frames["CMEMenue"].document.URL = "CMEMenue.aspx";
  }
  else
  {
   parent.top.frames["CMEMenue"].document.URL = "CMEMenue.aspx?endlessSession=true";
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 } 
}

function showSessionTimeOut(reset)
{
 try
 {
 if(parent.top.frames["CMEMenue"])
 {
  if(parent.top.frames["CMEMenue"].document.getElementById('TextBoxSessionTimeOut'))
  {
   var aElement = parent.top.frames["CMEMenue"].document.getElementById('TextBoxSessionTimeOut');
   var timeOut = aElement.value;
   if(reset == true || timeOut == "") { timeOut = 11; if(aktiv) {window.clearTimeout(aktiv);} }
   timeOut = Math.abs(timeOut)-1;
   if(timeOut>2) {aElement.style.color = "lightgreen"; }
   if(timeOut==2) {aElement.style.color = "orange"; }
   if(timeOut<2) {aElement.style.color = "red"; }
   if(timeOut<=0)
   {
    alert(unescape("Ihre Sitzung ist abgelaufen, Sie m%FCssen sich neu am System anmelden"));
    parent.top.frames["CMEMenue"].focus();
    parent.top.document.location.href = "Login.aspx";
   }
   else
   {
    if(parent.top.frames["CMEMenue"].document.URL.indexOf("endlessSession=true")>-1)
    {
     if(timeOut <=5)
     {
      parent.top.frames["CMEMenue"].document.URL = "CMEMenue.aspx?endlessSession=true";
     }
     window.status = unescape("keine Zeitbeschr%E4nkung aktiviert !");
    }
    else
    {
     window.status = timeOut + " Minute[n] bis erneuten Anmeldung am System ";
     if(timeOut <=2)
     {
      if(timeOut == 2) 
      {
       window.status = unescape("Achtung Ihre Session l%E4uft in [" + timeOut + "] Minuten ab!");
      }
      else
      {
       window.status = unescape("Achtung Ihre Session l%E4uft in [" + timeOut + "] Minute ab!");
      }
     }
    }
   }
   parent.top.frames["CMEMenue"].document.getElementById("TextBoxSessionTimeOut").value = timeOut;
   refreshSessionImages();
  }
 } 

  getCurrentDate();
  setTimeout('showSessionTimeOut(false);',60000);
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }
 finally
 {
  aElement=null;
 }
}

function closeCMEMenuePoints(reload,loadSettings,topRows,topCols)
{
 try
 {
  activeMenuePoint = 0;
  if(parent.top) {parent.top.document.body.rows = topRows + "px,*";}
  if(top.document.getElementById("FRAMESET2")) {top.document.getElementById("FRAMESET2").cols = topCols + ",0,0, *";}
  if(reload == true)
  {
   if(loadSettings == true) 
   { 
    if(parent.top.frames["SettingsPanel"]) { parent.top.frames["SettingsPanel"].document.location.href="SettingsPanel.aspx"; }
   }
   if(parent.top.frames["ContentView"]) {parent.top.frames["ContentView"].document.location.href="ContentView.aspx";}
  }
  for(var i = 1; i <= 6; i++)
  {
   var MenuePointName = "MenuePoint" + i;
   if(parent.top.frames["CMEMenue"])
   {
    if(parent.top.frames["CMEMenue"].document.all[MenuePointName])
    {
     parent.top.frames["CMEMenue"].document.all[MenuePointName].className = 'MenuePointOut';
     parent.top.frames["CMEMenue"].document.all[MenuePointName].src = parent.top.frames["CMEMenue"].document.all[MenuePointName].src.replace("_aktiv","_1");
    }
   }
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }  
}

function CMEMenueOverOut(MenuePoint,over)
{
 try
 {
  if(parent.top.document.body.rows != "30px,*")
  {
   if(over == true) 
   {
    if(document.all[MenuePoint]) {document.all[MenuePoint].className = 'MenuePointOver';}
    insertMenuePointDescription(MenuePoint);
   }
   else
   {
    if(activeMenuePoint != MenuePoint)
    {
     if(document.all[MenuePoint]) {document.all[MenuePoint].className = 'MenuePointOut'; }
     //anzeigen der MenuePointDescription
     insertMenuePointDescription(activeMenuePoint);
    }
   }
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 } 
}


function resetHeightWidth()
{
 try
 {
  var ClientID2 = ClientID;
  if(top.frames["SettingsPanel"].document.getElementById("ASP_ELEMENTDESCRIPTOR")) { ClientID2 = top.frames["SettingsPanel"].document.getElementById("ASP_ELEMENTDESCRIPTOR").value;}
  document.getElementById(ClientID2 + "_TextBoxElementHeight").value = "0"; 
  document.getElementById(ClientID2 + "_TextBoxElementWidth").value = "0"; 
 }
 catch(exception)
 {
 }
 return false;
}

function CMEMenueOnOff(MenuePoint)
{
 try
 {
  if(parent.top)
  {
   if(parent.top.document.body.rows == "30px,*" || activeMenuePoint != MenuePoint)
   {
    if(activeMenuePoint != 0)
    {
     if(document.all[activeMenuePoint]){ document.all[activeMenuePoint].className = 'MenuePointOut';}
    }
    activeMenuePoint = MenuePoint;
    blendFrameIn(176,196,activeMenuePoint,"topLevel");
    if(parent.top.frames["CMEMenue"])
    {
     parent.top.frames["CMEMenue"].document.location.href="CMEMenue.aspx?activeMenuePoint=" + activeMenuePoint;
    }
   }
   else
   {
    activeMenuePoint = 0;
    blendFrameOut(50,30,MenuePoint,"topLevel");
    if(document.getElementById(MenuePoint)){document.getElementById(MenuePoint).src = document.getElementById(MenuePoint).src.substr(0,document.getElementById(MenuePoint).src.lastIndexOf('_')) + '_1.jpg';}
   }
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 } 
}

function setFramesToDefaultSettings(viewSettingsPanel)
{
 try
 {
  activeMenuePoint = 0; 
  if(parent.top) {parent.top.document.body.rows = "30px,*";}
  var topCols = top.document.getElementById("FRAMESET2").cols;
  if(topCols.indexOf(",")>-1)
  {
   top.document.getElementById("FRAMESET2").cols = topCols.split(",")[0] + "," + topCols.split(",")[1] + ",0,*";
  }
  if(viewSettingsPanel == true)
  {
   blendFrameIn(190,212,activeMenuePoint,"settings");
  }
  //deaktivieren alle OverStyles
  for(var i = 1; i <= 4; i++)
  {
   var MenuePointName = "MenuePoint" + i;
   if(parent.top.frames["CMEMenue"])
   {
    if(parent.top.frames["CMEMenue"].document.all[MenuePointName])
    {
     parent.top.frames["CMEMenue"].document.all[MenuePointName].className = 'MenuePointOut';
    }
   }
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 } 
}

function ElementSettingsMenue(MenuePoint)
{
 try
 {
  if(document.all["TableCellMenuePanel" + MenuePoint].style.height != "100%")
  {
   blendDivIn(1,100,MenuePoint);
  }
  else
  {
   if(MenuePoint >1)
   {
   MenuePoint--;
   blendDivIn(1,100,MenuePoint);
   }
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 } 
}

function showDialog(Adresse,x,y) 
{
 try
 {
  var win = window.showModalDialog(Adresse,self,"dialogWidth:" + x + "px;dialogHeight:" + y + "px;center:yes;help:no;dialogHide:yes;resizable:no;scroll:no;status:no;unadorned:no;");
  if(document.getElementById('newElementName'))
  {
     document.getElementById('newElementName').value = window.clipboardData.getData("Text");
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }  
 finally
 {
  win=null;
 }
}

function openDialog(Adresse,x,y) 
{
  openWindowNew(Adresse,"CME",x,y,1);
}

function openPreviewWindow(Adresse,x,y)
{
 openWindow(Adresse,"PreView",x,y)
}

function openSimpleWindow(Adresse,x,y)
{
 window.open(Adresse,"","toolbar=no,status=no,location=no,menubar=no,resizable=no,hotkeys=no,dependent=yes,hotkeys=no,width=" + x + ",height=" + y);
}

function openSimpleWindow2(Adresse,x,y)
{
 window.open(Adresse,"","toolbar=no,status=no,location=no,menubar=no,resizable=yes,hotkeys=no,scrollbars=1,dependent=no,hotkeys=no,width=" + x + ",height=" + y);
}

function openWindowNew(Adresse,Title,x,y,mode)
{
 
 try
 {
  var resize = "yes";
  if(mode=1) resize="no";
  if(Title==null) Title="PreView";
  var maxWindowWidth =(Math.abs(screen.availWidth) - x) / 2;
  var maxWindowHeight=(Math.abs(screen.availHeight) - y) / 2;
  preViewWindow = window.open(Adresse,Title,"toolbar=no,status=no,location=no,menubar=no,resizable=" + resize + ",hotkeys=no,dependent=yes,hotkeys=no,width=" + x + ",height=" + y);
  preViewWindow.moveTo(maxWindowWidth + 150,maxWindowHeight);  
  preViewWindow.focus();
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 } 
 finally
 {
  maxWindowWidth=null;
  maxWindowHeight=null;
  preViewWindow=null;
 } 
}

function openAssistentWindow(Adresse,x,y)
{
 openWindowNew(Adresse,"Assistent",x,y,1);
}

function openWindow(Adresse,Title,x,y)
{
 openWindowNew(Adresse,Title,x,y,0);
}

function openHelpWindow(Adresse,x,y)
{
 openWindowNew(Adresse,"HelpCenter",x,y,0)
}

function openAssistent(Adresse,x,y,textMode)
{
  if(textMode == "text") openAssistentWindow(Adresse,x,y);
  if(textMode == "html") openPreviewWindow(Adresse,x,y);
}

function setNewTreeNodeID(TreeNodeID)
{
 try
 {
  var activeTreeNodeID  = "";
      activeTreeNodeID += TreeNodeID;
  if(activeTreeNodeID.replace(" ","") != "")
  {
   if(self.document.FORM1 && self.document.all["TextBoxHiddenRightMouseClick"])
   {
    self.document.FORM1.reset(); 
    self.document.all["TextBoxHiddenRightMouseClick"].value= activeTreeNodeID; 
    self.document.FORM1.submit();
   }
   else
   {
    top.frames["TreeView"].document.FORM1.reset(); 
    top.frames["TreeView"].document.all["TextBoxHiddenRightMouseClick"].value= activeTreeNodeID; 
    top.frames["TreeView"].document.FORM1.submit();
   }
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 } 
 finally
 {
  activeTreeNodeID=null;
 }  
}

function CMEMenueFrameResize()
{
 try
 {
  var MenuePointDescriptionWidth = document.all.myBody.offsetWidth - 680;
  if(document.getElementById('TableMenuePointDescription')){document.getElementById('TableMenuePointDescription').setAttribute("width", MenuePointDescriptionWidth + "px");}
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }  
 finally
 {
  MenuePointDescriptionWidth=null;
 }
}

function imageBlendIn(elementID,images,position)
{
 try
 {
  if(document.getElementById(elementID) && correctlyBrowser == true)
  {
   var activeElement = document.getElementById(elementID);
   if(activeElement.src.indexOf("_aktiv")<0)
   {
    var image = images.split(',');
    if(position > image.length - 1) position = 0;
    if(activeElement && image != "")
    {
     activeElement.filters.blendTrans.Apply();
     activeElement.style.cursor = "hand";
     activeElement.src = image[position];
     activeElement.style.cursor = "hand";
     activeElement.filters.blendTrans.Play();
    }
    position++;
    imageBlendInAktion = window.setTimeout("imageBlendIn('" + elementID + "','" + images + "'," + position + ")",2000);
   }
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 } 
}

function imageBlendOut(elementID,image,CMEMenue)
{
 try
 {
  if(document.getElementById(elementID) && correctlyBrowser == true)
  {
   var activeElement = document.getElementById(elementID);
   if(activeElement.src.indexOf("_aktiv")<0)
   {
    if(image != "")
    {
     activeElement.filters.blendTrans.Apply();
     activeElement.style.cursor = "hand";
     activeElement.src = image;
     activeElement.style.cursor = "hand";
     activeElement.filters.blendTrans.Play();
    }
   }
  }
  if(imageBlendInAktion != "") clearTimeout(imageBlendInAktion);
  clearTimeout();
  if(CMEMenue == true) { CMEMenueOverOut(activeMenuePoint,true); }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }  
}

function ZeitAnzeigen(ElementName) 
{
 try
 {
  var Wochentagname =  new Array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag");
  var Jetzt = new Date();
  var Tag = Jetzt.getDate();
  var Monat = Jetzt.getMonth() + 1;
  var Jahr = Jetzt.getYear();
  if(Jahr < 999) Jahr += 1900;
  var Stunden = Jetzt.getHours();
  var Minuten = Jetzt.getMinutes();
  var Sekunden = Jetzt.getSeconds();
  var WoTag = Jetzt.getDay();
  var Vortag  = ((Tag < 10) ? "0" : "");
  var Vormon  = ((Monat < 10) ? ".0" : ".");
  var Vorstd  = ((Stunden < 10) ? "0" : "");
  var Vormin  = ((Minuten < 10) ? ":0" : ":");
  var Vorsek  = ((Sekunden < 10) ? ":0" : ":");
  var Datum = Vortag + Tag + Vormon + Monat  + "." + Jahr;
  var Uhrzeit = Vorstd + Stunden + Vormin + Minuten + Vorsek + Sekunden;
  var Gesamt = Wochentagname[WoTag] + ", " + Datum + ", " + Uhrzeit;
  setCont(ElementName,Gesamt);
  window.setTimeout("ZeitAnzeigen('" + ElementName + "')",1000);
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }  
 finally
 {
  Wochentagname=null;
  Jetzt=null;
  Tag=null;
  Monat=null;
  Jahr=null;
  Stunden=null;
  Minuten=null;
  Sekunden=null;
  WoTag=null;
  Vortag=null;
  Vormon=null;
  Vorstd=null;
  Vormin=null;
  Vorsek=null;
  Datum=null;
  Uhrzeit=null;
  Gesamt=null;
 } 
}
function setCont(ElementName,Inhalt)
{
 try
 {
  if(document.layers)
  {
   document.layers[ElementName].open();
   document.layers[ElementName].write(Inhalt);
   document.layers[ElementName].close();
  }
  else
  {
   document.all[ElementName].innerText = Inhalt;
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }  
}
function getFileName(filePath)
{
 try
 {
  var rueckgabe = filePath;
  var startPos = rueckgabe.lastIndexOf("/");
  if(startPos >- 1)
  {
   rueckgabe  = rueckgabe.substring(startPos, rueckgabe.length);
  }
 
  rueckgabe = rueckgabe.toLowerCase();
  return rueckgabe;
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 }
 finally
 {
  startPos=null;
 }
}
function setFrameSize(id)
{
 try
 {
  if(document.getElementById(id))
  {
   if(navigator.appName != "Microsoft Internet Explorer")
   {
    document.getElementById(id).style.height = window.innerHeight;
   } 
   else
   {
    document.getElementById(id).style.height = document.body.offsetHeight-1;
   }
  }
 }
 catch(exception)
 {
  writeErrorMessage(exception);
 } 
}