// JavaScript Document

function openWin(url,winname,width,height,posx,posy,scrollbars) {
  /* Oeffnet ein neues PopUp-Fenster mit den entsprechenden Parametern. Falls jene nicht
     gesetzt sind, werden sie mit Standardwerten belegt. */
  if((typeof winname)=='undefined') winname='merkmalPopup';
  if((typeof width)=='undefined') width=660;
  if((typeof height)=='undefined') height=500;
  if((typeof posx)=='undefined') posx=screen.availWidth/2-width/2;
  if((typeof posy)=='undefined') posy=screen.availHeight/2-height/2;

  if(navigator.platform.toLowerCase().indexOf("win")>-1) {
    objekt = window.open('', winname); // objekt.close();
  }
  
  if(url) {
    if((typeof objekt) != 'undefined') {
      /* Falls das Fenster schon geoeffnet ist, wird es geschlossen */
      if(!objekt.closed) objekt.close();
    }

    objekt = window.open(url,winname,'width='+width+',height='+height+',left='+posx+',top='+posy+',dependent=yes,hotkeys=no,location=no,menubar=no,resizable=yes,status=yes,scrollbars=auto,toolbar=no');

    objekt.focus
  } else {
    alert('Fehler openwin.1 - Keine URL fuer das PopUp uebergeben!');
    return false;
  }
}
function show_works(id,onoff)
{
  // deactivate all descriptions
  for(i=0; i<document.getElementsByTagName('span').length; i++)
  {
    if(document.getElementsByTagName('span')[i].id.indexOf('work_')>-1)
    {
      document.getElementsByTagName('span')[i].className = 'off';
    }
  }
  
  if(typeof(id)!='undefined')
  {
    if(typeof(document.getElementById(id))=='object')
    {
      if(typeof(onoff)=='undefined')
        onoff = 'off';
      else if(onoff!=1)
        onoff = 'off';
      else
        onoff = 'on';
      
      document.getElementById(id).className = onoff;
    }
  }
}





  var co_moveInterval;
  var co_ua = navigator.userAgent.toLowerCase();
  var co_layername = 'co_tooltiplayer';

  function rex_j330_showTooltip(text,onoff,linkobject) {
    rex_j330_hideTooltip(); // deletes an image which is already shown
    // linkobject.title="";
    if(text!=undefined)
    {
      text = unescape(text);
       // creates a new DIV-Element...
      var newDIV = document.createElement("div");
          newDIV.setAttribute("id",co_layername); 
  
      if(document.all && co_ua.indexOf("msie")>-1) {
        // different syntax for setting the Style-attributes in MSIE
        newDIV.style.visibility = "hidden";
      }
      newDIV.style.visibility = "hidden";
            
      // creates the text to be shown in the DIV-Element
      // var newDIVText = document.createTextNode(text);
  
      // Sets the new elements onto the page
      document.getElementsByTagName("body")[0].appendChild(newDIV);
      // document.getElementById(co_layername).appendChild(newDIVText);
      document.getElementById(co_layername).innerHTML = text;
    
      // starts the function which lets the image follow the mouse-cursor
      co_moveInterval = window.setInterval("rex_j330_moveTooltip()", 10);
    }
  }
  
  function rex_j330_hideTooltip() {
    window.clearInterval(co_moveInterval); // stops the interval which lets the image follow the mouse-cursor
    
    if(document.getElementById(co_layername)!=undefined) {
      // deletes the image-div
      document.getElementById(co_layername).parentNode.removeChild(document.getElementById(co_layername));
    }
  }
  
  function rex_j330_moveTooltip() {
    // gets the image-size
    width = document.getElementById(co_layername).style.width; width = width.substring(0,width.length-2); width = parseInt(width);
    height= document.getElementById(co_layername).style.height; height = height.substring(0,height.length-2); height = parseInt(height);
    
    // gets the window-size
    docwidth=document.all? rex_j330_truebody().scrollLeft+rex_j330_truebody().clientWidth : pageXOffset+window.innerWidth-15
    docheight=document.all? Math.min(rex_j330_truebody().scrollHeight, rex_j330_truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight)
  
    // if the image would be shown outside of the viewable area of the page, it will stuck to the borders
    if(docwidth < 18+xmouse-rex_j330_truebody().scrollLeft+width+12)
      xpos =rex_j330_truebody().scrollLeft+xmouse-width-16;
    else
      xpos = xmouse+10;
  
    if(docheight < 18+ymouse-rex_j330_truebody().scrollTop+height+12)
      ypos = rex_j330_truebody().scrollTop+ymouse-Math.max(0,(height+12 + ymouse - docheight));
    else
      ypos = ymouse+10;
  
    xpos = xpos+"px";
    ypos = ypos+"px";

    if(document.all && co_ua.indexOf("msie")>-1) {
      // different syntax for MSIE
  //    document.getElementById(co_layername).style.setAttribute("visibility","visible",false);
      document.getElementById(co_layername).style.setAttribute("top",ypos,false);
      document.getElementById(co_layername).style.setAttribute("left",xpos,false);
  //    document.getElementById(co_layername).style.setAttribute("width",width+"px",false);
  //    document.getElementById(co_layername).style.setAttribute("height",height+"px",false);
  //    document.getElementById(co_layername).style.setAttribute("position","absolute",false);
  //    document.getElementById(co_layername).style.setAttribute("border","solid 6px #ffffff",false);
  //    document.getElementById(co_layername).style.setAttribute("backgroundColor","#ffffff",false);
  //    document.getElementById(co_layername).style.setAttribute("backgroundImage","url(images/loading.gif)",false);
  //    document.getElementById(co_layername).style.setAttribute("backgroundRepeat","no-repeat",false);
  //    document.getElementById(co_layername).style.setAttribute("backgroundPosition","bottom right",false);
    } else {
  //    document.getElementById(co_layername).setAttribute("style","position: absolute; display: block; top: "+ypos+"; left: "+xpos+"; width: "+width+"px; height: "+height+"px; border: solid 6px #ffffff;background-color: #ffffff; background-image: url(images/loading.gif); background-repeat: no-repeat; background-position: bottom right;");
      document.getElementById(co_layername).setAttribute("style","display: block; top: "+ypos+"; left: "+xpos+";");
  
    }
  
    // show the image-DIV
    document.getElementById(co_layername).style.visibility = "visible";
  }
  
  function rex_j330_truebody()	{
    // right syntax for any browser (needed in "co_moveTooltip")
  	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  }
  
  
  /* Zum Speichern der Mausposition */
    var xmouse=0; var ymouse=0;  // Speichern die Mausposition
    navigator.appName ? 'Netscape' : document.captureEvents(Event.MOUSEMOVE);  // Mausposition erkennen fuer Netscape
    document.onmousemove = rex_j330_mauspos; // Die Mausposition wird bei jeder Mausbewegung neu geschrieben
  
  function rex_j330_mauspos(e) {
  /* Zum Abfragen der Mausposition - je nach Browser wird das anders erledigt. Am Ende werden die Daten fuer
     xmouse und ymouse in den globalen Variablen gespeichert. */
    if (navigator.appName == 'Netscape') {
       xmouse = e.pageX;
       ymouse = e.pageY;
    } else {
       xmouse = window.event.clientX;
       ymouse = window.event.clientY;
    }
    
    if(!(navigator.appName == 'Netscape')) {  
      if(document.documentElement && document.documentElement.scrollTop) {
        xmouse = xmouse + document.documentElement.scrollLeft;
        ymouse = ymouse + document.documentElement.scrollTop;
      } else if(document.body) {
        xmouse = xmouse + document.body.scrollLeft;
        ymouse = ymouse + document.body.scrollTop;
      }
    }
  }
