  var moveInterval;
  var ua = navigator.userAgent.toLowerCase();
  var layername = 'tooltiplayer';

  function myrex_showTooltip(text) {
    myrex_hideTooltip(); // deletes an image which is already shown

    if(text!=undefined)
    {
      text = unescape(text);
       // creates a new DIV-Element...
      var newDIV = document.createElement("div");
          newDIV.setAttribute("id",layername); 
  
      if(document.all && ua.indexOf("msie")>-1) {
        // different syntax for setting the Style-attributes in MSIE
        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(layername).appendChild(newDIVText);
      document.getElementById(layername).innerHTML = text;
    
      // starts the function which lets the image follow the mouse-cursor
      moveInterval = window.setInterval("myrex_moveTooltip()", 10);
    }
  }
  
  function myrex_hideTooltip() {
    window.clearInterval(moveInterval); // stops the interval which lets the image follow the mouse-cursor
    
    if(document.getElementById(layername)!=undefined) {
      // deletes the image-div
      document.getElementById(layername).parentNode.removeChild(document.getElementById(layername));
    }
  }
  
  function myrex_moveTooltip() {
    // gets the image-size
/*
    width = document.getElementById(layername).style.width;
    width = width.substring(0,width.length-2); width = parseInt(width);
    height= document.getElementById(layername).style.height;
    height = height.substring(0,height.length-2); height = parseInt(height);
*/    
    width = document.getElementById(layername).offsetWidth;
    height = document.getElementById(layername).offsetHeight;

    // gets the window-size
    docwidth=document.all? myrex_truebody().scrollLeft+myrex_truebody().clientWidth : pageXOffset+window.innerWidth-15
    docheight=document.all? Math.min(myrex_truebody().scrollHeight, myrex_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-myrex_truebody().scrollLeft+width+12)
      xpos =myrex_truebody().scrollLeft+xmouse-width-16;
    else
      xpos = xmouse+18;
  
//    alert(docwidth+" / "+(xmouse-myrex_truebody().scrollLeft+width+12));
    if(docheight < 18+ymouse-myrex_truebody().scrollTop+height+12)
      ypos = myrex_truebody().scrollTop+ymouse-Math.max(0,(height+12 + ymouse - docheight));
    else
      ypos = ymouse+18;
  
    xpos = xpos+"px";
    ypos = ypos+"px";
    
    if(document.all && ua.indexOf("msie")>-1) {
      // different syntax for MSIE
  //    document.getElementById(layername).style.setAttribute("visibility","visible",false);
      document.getElementById(layername).style.setAttribute("top",ypos,false);
      document.getElementById(layername).style.setAttribute("left",xpos,false);
  //    document.getElementById(layername).style.setAttribute("width",width+"px",false);
  //    document.getElementById(layername).style.setAttribute("height",height+"px",false);
  //    document.getElementById(layername).style.setAttribute("position","absolute",false);
  //    document.getElementById(layername).style.setAttribute("border","solid 6px #ffffff",false);
  //    document.getElementById(layername).style.setAttribute("backgroundColor","#ffffff",false);
  //    document.getElementById(layername).style.setAttribute("backgroundImage","url(images/loading.gif)",false);
  //    document.getElementById(layername).style.setAttribute("backgroundRepeat","no-repeat",false);
  //    document.getElementById(layername).style.setAttribute("backgroundPosition","bottom right",false);
    } else {
  //    document.getElementById(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(layername).setAttribute("style","display: block; top: "+ypos+"; left: "+xpos+";");
  
    }
  
    // show the image-DIV
    document.getElementById(layername).style.visibility = "visible";
  }
  
  function myrex_truebody()	{
    // right syntax for any browser (needed in "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 = myrex_mauspos; // Die Mausposition wird bei jeder Mausbewegung neu geschrieben
  
  function myrex_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;
      }
    }
  }
  
  
  /* other scripts */
  
  window.addEvent('domready',function(){
		var obj = {
			wait: 5000, 
			effect: 'wipe',
			duration: 750,
			loop: true, 
			thumbnails: true,
			backgroundSlider: false,
			onClick: function(i) {
/*
			  xstart = document.getElementById('pagecontent').offsetLeft+document.getElementById('container02').offsetLeft+document.getElementById('slideshowContainer').offsetLeft;
        xstart+= 45; 
			  ystart = document.getElementById('pagecontent').offsetTop+document.getElementById('container02').offsetTop+document.getElementById('slideshowContainer').offsetTop; 
			  imagew = document.getElementById('slideshowContainer').getElementsByTagName('img')[document.getElementById('slideshowContainer').getElementsByTagName('img').length-1].offsetWidth;
			  imageh = document.getElementById('slideshowContainer').getElementsByTagName('img')[document.getElementById('slideshowContainer').getElementsByTagName('img').length-1].offsetHeight;
			  
			  if(
			    xmouse > xstart &&
			    xmouse < xstart+imagew/2 &&
			    ymouse > ystart &&
			    ymouse < ystart+imageh
        )
        {
          myrex_prevImage()
        }
        else if(
			    xmouse > xstart+imagew/2 &&
			    xmouse < xstart+imagew &&
			    ymouse > ystart &&
			    ymouse < ystart+imageh
        )
        {
          myrex_nextImage()
        }
*/
        myrex_nextImage()
			  
//			  show.next();
      },
      onMouseOver: function(i) {
        myrex_showTooltip(document.getElementById('thumbnails').getElementsByTagName('img')[i].alt);
      },
      onMouseOut: function(i) {
        myrex_hideTooltip();
      }
		}
		show = new SlideShow('slideshowContainer','slideshowThumbnail',obj);
		
		
		
	});  

  var myrex_buttonsSet = false;
  
  function myrex_prevImage() {
    show.options.direction='left';
    show.previous();
//    show.options.direction='right';
  }
  function myrex_nextImage() {
    show.options.direction='right';
    show.next();
  }
  
  function myrex_injectButtons()
  { 
    if(!myrex_buttonsSet && typeof(document.getElementById('submenu'))!='undefined' && document.getElementById('submenu')!=null)
    	for(i=0; i<document.getElementById('submenu').childNodes.length; i++)
  		{
  		  li_el = document.getElementById('submenu').childNodes[i];
  		  if(li_el.nodeName.toLowerCase() == 'li')
  		  {
  		    if(li_el.firstChild.nodeName.toLowerCase() == 'a')
  		    {
  		      if(li_el.firstChild.href == location.href)
  		      {
  		        prevlink = document.createElement("a");
              prevlink.setAttribute("class","prevlink"); 
              prevlink.setAttribute("href","javascript:myrex_prevImage()"); 
              prevlink.innerHTML="&#0171;&nbsp;"; 
              // li_el.appendChild(prevlink);
              document.getElementById('arrows').appendChild(prevlink);

              
  		        nextlink = document.createElement("a");
              nextlink.setAttribute("class","nextlink"); 
              nextlink.setAttribute("href","javascript:myrex_nextImage()"); 
              nextlink.innerHTML="&nbsp;&#0187;"; 
              // li_el.appendChild(nextlink);
              document.getElementById('arrows').appendChild(nextlink);
              
              myrex_buttonsSet = true;
            }
          }
        }
      }
  }