﻿//<!--

var last_click;             // zuletzt angeklickter Button
var windows = new Array();  // Array mit Win-Objekten

function set_over(obj) {
   document.getElementById(obj).style.borderTopColor = "white";
   document.getElementById(obj).style.borderLeftColor = "white";
   document.getElementById(obj).style.borderBottomColor = "black";
   document.getElementById(obj).style.borderRightColor = "black";
}

function set_out(obj) {
   document.getElementById(obj).style.borderColor = "ButtonFace";
}

function set_click(obj) {
   document.getElementById(obj).style.borderTopColor = "black";
   document.getElementById(obj).style.borderLeftColor = "black";
   document.getElementById(obj).style.borderBottomColor = "white";
   document.getElementById(obj).style.borderRightColor = "white";
   elem1 = document.getElementById(last_click);
   if (elem1) elem1.style.fontWeight = "normal";
   last_click = obj;
   document.getElementById(obj).style.fontWeight = "bold";
}

function Win(ref, posx, posy) {
   this.ref  = ref;
   this.posx = posx;
   this.posy = posy;
}

function check_windows() {
   windows_new = new Array();
   for (i=0; i<windows.length; i++)
   {
    var found = false;
    try{
        if(!windows[i].ref.closed)
            found = true;
    }
    catch(e){
        found = false;
    }
    if (found && windows[i] && windows[i].ref && !windows[i].ref.closed) {
         windows_new.push(windows[i]);
         windows[i].ref.focus();
      }
   }
   windows = windows_new;
}

function window_open(url, w_width, w_height, scroll, type) {
   check_windows();
   ind = windows.length - 1;
   if (windows[ind]) {
      posx = windows[ind].posx + 20;
      posy = windows[ind].posy + 20;
   }
   else {
      posx = (screen.width - w_width) / 2;
      posy = (screen.height - w_height) / 2 - 30;
   }
   if (type == 'resizeable')  proper = 'titlebar=no,toolbar=no,menubar=no,scrollbars='+scroll+',width='+w_width+',height='+w_height+',resizable=yes,left='+posx+',top='+posy+',screenX='+posx+',screenY='+posy;
   if (type == 'normal')      proper = 'titlebar=no,toolbar=no,menubar=no,scrollbars='+scroll+',width='+w_width+',height='+w_height+',resizable=no,left='+posx+',top='+posy+',screenX='+posx+',screenY='+posy;
   if (type == 'menu')        proper = 'titlebar=no,toolbar=no,menubar=yes,scrollbars='+scroll+',width='+w_width+',height='+w_height+',resizable=no,left='+posx+',top='+posy+',screenX='+posx+',screenY='+posy;
   if (type == 'mresizeable') proper = 'titlebar=no,toolbar=no,menubar=yes,scrollbars='+scroll+',width='+w_width+',height='+w_height+',resizable=yes,left='+posx+',top='+posy+',screenX='+posx+',screenY='+posy;
   if (type == 'minimized')   proper = 'titlebar=no,toolbar=no,menubar=yes,scrollbars='+scroll+',width='+w_width+',height='+w_height+',resizable=no,left='+screen.width+',top='+screen.height+',screenX='+screen.width+',screenY='+screen.height;

   win_ref = window.open(url, '', proper);
   if (win_ref) {
      tmp = new Win(win_ref, posx, posy);
      windows.push(tmp);
      win_ref.focus();
   }
   return win_ref;
}

function modal_open(url, w_width, w_height, scroll, type) {
   if (type == 'normal')     proper = 'dialogHeight:'+w_height+'px;dialogWidth:'+w_width+'px;center:yes;edge:raised;help:no;resizable:no;scroll:'+scroll+';status:no;';
   if (type == 'resizeable') proper = 'dialogHeight:'+w_height+'px;dialogWidth:'+w_width+'px;center:yes;edge:raised;help:no;resizable:yes;scroll:'+scroll+';status:no;';
   window.showModalDialog(url, window, proper);
}

function modless_open(url, w_width, w_height, scroll, type) {
   if (type == 'normal')     proper = 'dialogHeight:'+w_height+'px;dialogWidth:'+w_width+'px;center:yes;edge:raised;help:no;resizable:no;scroll:'+scroll+';status:no;';
   if (type == 'resizeable') proper = 'dialogHeight:'+w_height+'px;dialogWidth:'+w_width+'px;center:yes;edge:raised;help:no;resizable:yes;scroll:'+scroll+';status:no;';
   window.showModalDialog(url, window, proper);
}

//--> end hide JavaScript