<!-- "Kontextmenü" Autor: www.All-Community.de

/********************************************************************************************/

document.dragWindow   = new overlayWindow(300,300,'<img onmouseup="endAction()" border="3" width=100% height=100% src="images/skins/modern/drag.png" style="border: 2px dashed gray">', 'filter:alpha(opacity=70);z-index:5;');
document.activeWindow = new Object();
document.dragWindow.active=false;

function resetWindow() {
  with(document.activeWindow) {
    difX = null; difY = null; drag = false; resize = false; reserved = false;
  };
};

function activateWindow(id) {
  if (this.meinKontextMenue != null) { meinKontextMenue.hide(); };
  for (i=1;i<document.overlayWindows.length;i++) {
    deactivateWindow(i);
  };
  document.overlayWindows[id].style.zIndex=3;
  document.activeWindow.id=id;
  resetWindow();
};

function deactivateWindow(id) {
  if (id != null) {
    document.overlayWindows[id].style.zIndex=0;
  } else {
    document.overlayWindows[document.activeWindow.id].style.zIndex=0;
  }
  resetWindow();
};

function requestFocus() {
  document.activeWindow.reserved=true;
};

function releaseFocus() {
  document.activeWindow.reserved=false;
};

function startAction(id, action) {
  if (document.overlayWindows[id].minimize == null) {
    if (!document.activeWindow.reserved) {
      document.overlayWindows[document.dragWindow.id].style.zIndex=5;
      activateWindow(id);
      if (action == 'drag') {
        document.activeWindow.drag=true;
        document.activeWindow.resize=false;
      } else if (action == 'resize') {
        document.activeWindow.drag=false;
        document.activeWindow.resize=true;
      }
      document.dragWindow.move(document.overlayWindows[id].x(),document.overlayWindows[id].y());
      document.dragWindow.resize(document.overlayWindows[id].width(),document.overlayWindows[id].height());
      document.overlayWindows[id].hide();
      document.dragWindow.show();
      document.dragWindow.active=true;
    };
  };
};

function doSomeAction(event) {
  if (document.activeWindow.drag) {
    dragWindow(event);
  } else if (document.activeWindow.resize) {
    resizeWindow(event);
  };
  return false;
};

function endAction() {
  if (document.dragWindow.active) {
    resetWindow();
    document.overlayWindows[document.activeWindow.id].move(document.dragWindow.x(),document.dragWindow.y());
    document.overlayWindows[document.activeWindow.id].resize(document.dragWindow.width(),document.dragWindow.height());
    document.dragWindow.hide();
    document.overlayWindows[document.activeWindow.id].show();
    document.dragWindow.active=false;    
  };
};

function dragWindow(event) {
  var x = ((event.pageX != null) ? event.pageX : window.event.x + document.body.scrollLeft);
  var y = ((event.pageY != null) ? event.pageY : window.event.y + document.body.scrollTop);
  if (document.activeWindow.difX == null) { document.activeWindow.difX = x- (document.dragWindow.x()); }
  if (document.activeWindow.difY == null) { document.activeWindow.difY = y- (document.dragWindow.y()); }
  document.dragWindow.move(x-document.activeWindow.difX, y-document.activeWindow.difY);
};

function resizeWindow(event) {
  var x = ((event.pageX != null) ? event.pageX : window.event.x + document.body.scrollLeft);
  var y = ((event.pageY != null) ? event.pageY : window.event.y + document.body.scrollTop);
  if (document.activeWindow.difX == null) { document.activeWindow.difX = x- document.dragWindow.width(); }
  if (document.activeWindow.difY == null) { document.activeWindow.difY = y- document.dragWindow.height(); }
  document.dragWindow.resize(x-document.activeWindow.difX, y-document.activeWindow.difY);
};

// initialize
resetWindow();

/********************************************************************************************/
var Application = new Object(overlayWindow);
Application.prototype.onDrag = dragWindow;
Application.prototype.onResize = resizeWindow;
Application.prototype.open = openWindow;
Application.prototype.close = closeWindow;
Application.prototype.setContent = createWindow;
Application.prototype.load = loadWindow;
Application.prototype.toggle = toggleWindow;
Application.prototype.showIcon = showIcon;
Application.prototype.hideIcon = hideIcon;
Application.prototype.constructor = Application;
Application.minimize = new Array();
Application.noresize = false;
Application.autoreload = false;
Application.content = new String();
Application.title = 'unbenannt';
Application.icon = 'blank.gif';

function createWindow(content) {
  var txt = ''+
'<table onclick="activateWindow(\''+this.id+'\')" ondblclick="deactivateWindow(\''+this.id+'\')" border="0" width="100%" height="100%" cellspacing="0" cellpadding="0" style="border: 3px solid cornflowerblue">'+
 '<tr height="25px" title="Fenster verschieben" style="cursor:move" onmouseup="resetWindow()" onmousedown="startAction(\''+this.id+'\', \'drag\');return false">'+
  '<td height="25px" style="background-image:url(\'images/skins/modern/t-background.jpg\'); font-family:Arial,Helvetica; color:#F0F0F0; font-size:14pt; font-weight: bold">'+
   '<span style="float:right">'+((this.noresize) ? '' : '<a onmouseover="requestFocus()" onmouseout="releaseFocus()" title="Vollbild <> Normal" href="javascript:document.overlayWindows[\''+this.id+'\'].toggle()" target="_self"><img border="0" vspace=4 src="images/skins/modern/t-move.gif" width="16" height="14"></a>')+
   '<a onmouseover="requestFocus()" onmouseout="releaseFocus()" title="Ausblenden" href="javascript:document.overlayWindows[\''+this.id+'\'].close()" target="_self"><img border="0" vspace=4 src="images/skins/modern/t-close.gif" width="16" height="14"></a></span>'+
   '<img hspace=5 src="images/skins/modern/t-document.gif" width="13" height="16">'+this.title+' </td></tr><tr>'+
  '<td>'+content+'</td></tr>'+
  ((this.noresize) ? '' : '<tr height="18px" title="Fenstergröße einstellen" style="cursor:nw-resize" onmousedown="startAction(\''+this.id+'\', \'resize\');return false" onmouseup="resetWindow()"><td height="18px" style="background-image:url(\'images/skins/modern/t-background.jpg\');background-color:cornflowerblue" valign="bottom" align=right><img src="images/skins/modern/t-resize.gif" width="11" height="11" ondragstart="return false" onmouseup="endAction()"></td></tr>' )+
'</table>';
  this.content = txt;
  return true;
};

function loadWindow() {
  (document.getElementById(this.id)).innerHTML = this.content;
};

function toggleWindow() {
  if (this.minimize == null) {
    this.minimize=new Array(this.width(),this.height(),this.x(),this.y());
    this.move(0,0);
    this.resize("99%","99%");
  } else {
    this.resize(this.minimize[0],this.minimize[1]);
    this.move(this.minimize[2],this.minimize[3]);
    this.minimize = null;
  }
};

function showIcon() {
  var myLocalContent = '<img alt="'+this.title+' einblenden" vspace=5 border="0" src="'+this.icon+'"><br><font size=1>'+((this.title.length>9)?(this.title).substring(0,8)+'.':this.title)+'</font>';
  if (document.getElementById('icon_'+this.id) == null) {
    document.getElementById('startmenue').innerHTML += '<table height=100% align=right style="float:left" border="0" cellspacing="0" cellpadding="0"><tr><td align="center"><a id="icon_'+this.id+'" href="javascript:document.overlayWindows[\''+this.id+'\'].open()" target="_self">'+myLocalContent+'</a></td></tr></table>';
  } else {
    document.getElementById('icon_'+this.id).innerHTML = myLocalContent;
  };
};

function hideIcon() {
  document.getElementById('startmenue').innerHTML = (document.getElementById('startmenue').innerHTML).replace((document.getElementById('icon_'+this.id).innerHTML), '');
};

function closeWindow() {
  this.hide();
  if (this.icon) { this.showIcon(); };
};

function openWindow() {
  if (this.autoreload || this.innerHTML() == "" || this.innerHTML() == " ") { this.load(); };
  activateWindow(this.id);
  if (this.icon) { this.hideIcon(); };
  this.show();
};

ready = true;
// Copyright www.All-Community.de 07/2002 -->

