var HTTP_GET_VARS = new Array();
strGET=document.location.search.substr(1,document.location.search.length);
if(strGET!='')
{
    gArr=strGET.split('&');
    for(i=0;i<gArr.length;++i)
    {
    v='';vArr=gArr[i].split('=');
    if(vArr.length>1){v=vArr[1];}
    HTTP_GET_VARS[unescape(vArr[0])]=unescape(v);
    }
}

function GET(v)
{
    if(!HTTP_GET_VARS[v]){return 'undefined';}
    return HTTP_GET_VARS[v];
}
/* New Testing */
var mousePosition = null;
var windowSize = null;
var toolTipClass = 'toolTipBase';
var popup = GET('popup');
var innerBounds = null;
/**
 * Ausmasse des Contents festlegen
 */
function initToolTips()
{
    if(popup != 'undefined' && popup > 1)
    {
      // Popup - ganzer Bereich des Inhalts
      if(document.getElementById('largeColTeaser'))
      {
        innerBounds = ({width: document.getElementById('largeColTeaser').clientWidth,
                       height: document.getElementById('largeColTeaser').clientHeight,
                       maxleft: document.getElementById('largeColTeaser').clientWidth
                    });
      }
    }
    else
    {
      // normale Seite: Navi+content
      if(document.getElementById('content') && document.getElementById('navBorder'))
      {
        innerBounds = ({width: document.getElementById('content').clientWidth,
                       height: document.getElementById('content').clientHeight,
                       maxleft: Number(document.getElementById('navBorder').clientWidth+document.getElementById('content').clientWidth)
                    });
      }
    }
}

function initToolTips1500()
{
    if(popup != 'undefined' && popup > 1)
    {
      // Popup - ganzer Bereich des Inhalts
      if(document.getElementById('largeColTeaser'))
      {
        innerBounds = ({width: document.getElementById('largeColTeaser').clientWidth,
                       height: document.getElementById('largeColTeaser').clientHeight,
                       maxleft: document.getElementById('largeColTeaser').clientWidth
                    });
      }
    }
    else
    {
      // normale Seite: Navi+content
      if(document.getElementById('inhalt') && document.getElementById('sidebar'))
      {
        innerBounds = ({width: document.getElementById('inhalt').clientWidth,
                       height: document.getElementById('inhalt').clientHeight,
                       maxleft: Number(document.getElementById('sidebar').clientWidth+document.getElementById('inhalt').clientWidth)
                    });
      }
    }
}
/**
 * This function, mouseMovement, takes an event /e/ as its parameter and sets the
 * global /mousePosition/ variable to an object containing the [x, y] pair
 * representing the position of the mouse pointer when the event happened.
 *
 * @param {Event} e The event that has fired in the browser.
 */
function mouseMovement(e) {
    e = e || window.event;
    /* Is this Internet Explorer? */
    if (e.pageX || e.pageY)
        mousePosition = {
            x: e.pageX,
            y: e.pageY
        };
    else
        mousePosition = {
            x: e.clientX + document.body.scrollLeft - document.body.clientLeft,
            y: e.clientY + document.body.scrollTop - document.body.clientTop
        };
        /*
        var debugObj = document.getElementById('test');
            debugObj.innerHTML = 'x: '+mousePosition.x+' y: '+mousePosition.y;
        */
}

/**
 * This function, getResizedWindow, sets the global /windowSize/ variable to an
 * object containing the [x, y] pair representing the width and height of the
 * browser window.
 */
function getResizedWindow( ) {
    windowSize = {
        x: ((document.body.clientWidth) ? document.body.clientWidth :
            window.innerWidth),
        y: ((document.body.clientHeight) ? document.body.clientHeight :
            window.innerHeight)
    };
}
/**
 * Event-Observer
 */
if(typeof Event != 'object') { 
    Event = new Object(); 
}
Event.observe = function(object2observe, event2observe, wrapperfunc, dummy)
{
    if (object2observe.addEventListener) {
        object2observe.addEventListener(event2observe, wrapperfunc, false);
      } else {
        // object2observe.attachEvent("on" + event2observe, wrapper);
        switch(event2observe) {
          case 'mousemove':
            object2observe.onmousemove = wrapperfunc;
          break;
          case 'mouseover':
            object2observe.onmouseover = wrapperfunc;
          break;
          case 'mouseout':
            object2observe.onmouseout = wrapperfunc;
          break;
          case 'click':
            object2observe.onclick = wrapperfunc;
          break;
          case 'resize':
            object2observe.onresize = wrapperfunc;
          break;
        }
        
      }
}
try {
    /* Set up the global events to keep track of mouse movement and window size */
    Event.observe(document, 'mousemove', mouseMovement, false);
    Event.observe(window, 'resize', getResizedWindow, false);
    // Event.observe(document, 'click', setAlert, false);
} catch (ex) {/*alert(ex);*/}
function setAlert()
{
    // alert('klicker di klacker');
}

/***********************************************
* Origignal von: Dynamic Drive at http://www.dynamicdrive.com/ for full source code
* - modififiziert by Siggi, wegen besserer IE/Moz-Kompatibilität
* - Mouse-Koordinaten werden von /skripte/mouseprops.js ermittelt und auch dort gesetzt
* 
***********************************************/

var ie=document.all;
var ns6=document.getElementById && !document.all;

var offsetxpoint= 0; //Customize x offset of tooltip
var offsetypoint= (ns6) ? 20 : 25; //Customize y offset of tooltip

var enabletip=false;

if (ie||ns6) {
  var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "";
 }

function ietruebody(){
  return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function showInfo(thetext, thecolor, thewidth) {
  if(!ns6) 
    {
      // offsetxpoint += 80; 
    }
  if (ns6||ie){
    if (typeof toleft=="undefined") toleft = 0;
    if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px";
    if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor;
    tipobj.innerHTML = thetext;
    // wenn ein kleines Häkchen am linken unteren Rand gewünscht ist
    // tipobj.innerHTML += '<img src="templates/default/layout/images/tip_corner.gif" alt="" id="c" />';    
    enabletip=true;
    positiontip();
    return false;
  }
}
function positiontip(toleft){
  if (enabletip){
    var curX = mousePosition.x;
    if(innerBounds != null && curX+(tipobj.clientWidth) >= innerBounds.maxleft) {
        curX = innerBounds.maxleft-tipobj.clientWidth;
    } else {
        /*curX -= '20';*/
    }
    var curY = mousePosition.y;
    tipobj.style.left=curX+offsetxpoint+"px";
    tipobj.style.top=curY+offsetypoint+"px";
    tipobj.style.visibility="visible";
    tipobj.style.position="absolute";
    tipobj.style.display="block";
  }
}

function hideInfo(){
  if (ns6||ie) {
    enabletip=false;
    tipobj.style.visibility="hidden";
    tipobj.style.left="-1000px";
    tipobj.style.backgroundColor='';
    tipobj.style.width='';
  }
}

/* info als Popup anzeigen */
function openInfo(titel, cssfile, txt, w, h){
  
  fenster = window.open('', 'infoPopup','width='+w+',height='+h);
  
  if(fenster) {
    if(fenster.focus) fenster.focus();
    fenster.document.open();
    
    fenster.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html lang="de"><head>');
    fenster.document.write('<title>'+titel+'</title>');
    fenster.document.write('<link rel="stylesheet" type="text/css" href="'+cssfile+'">');
    fenster.document.write('</head><body>');
    fenster.document.write('<center><table>');
    fenster.document.write('<tr><td>'+txt+'</td></tr>');
    fenster.document.write('<tr><td></td></tr>');
    fenster.document.write('<tr><td class="closeTd"><a href="javascript: self.close();">schlie&szlig;en</a></td></tr>');
    fenster.document.write('</table></center></body></html>');
    fenster.document.close();
  }
}

/* Element-Resizer */
var resizeto = function() {    
    var obj2Resize = arguments[0];
    var _w = obj2Resize.clientWidth;
    var _h = obj2Resize.clientHeight;
    
    if(arguments.length == 2) {
         if(arguments[1].w != null){ _w = arguments[1].w; }
         if(arguments[1].h != null){ _h = arguments[1].h; }         
    }
    // alert('resize2 w: '+_w+' h: '+_h);
    obj2Resize.style.height = _h+'px';
    obj2Resize.style.width = _w+'px';
    init(false);
}
document.getElementsByClassName = function(class_name) {
    var all_obj,ret_obj=new Array(),j=0,teststr;

  if(document.all)all_obj=document.all;
  else if(document.getElementsByTagName && !document.all)
    all_obj=document.getElementsByTagName("*");

  for(i=0;i<all_obj.length;i++)
  {
    if(all_obj[i].className.indexOf(class_name)!=-1)
    {
      teststr=","+all_obj[i].className.split(" ").join(",")+",";
      if(teststr.indexOf(","+class_name+",")!=-1)
      {
        ret_obj[j]=all_obj[i];
        j++;
      }
    }
  }
  return ret_obj;   
}
var expandOffset = 0;
var elemOffset = 20;
/* Expander */
var expand = function(elem) {
    if(elem.style.visibility == 'visible') {
        elem.style.visibility = 'hidden';
        elem.style.display = 'none';
        expandOffset-=elemOffset;
        visible = false;
    } else {
        elem.style.visibility = 'visible';
        elem.style.display = 'block';
        expandOffset+=elemOffset;
        visible = true;
    }
    return visible;
}
var expandFromNode = function(class_name,rootNode) {
  if(arguments.length == 3) {
     var clickParam = arguments[2];     
     if(typeof clickParam == 'object') {
        var visibleTitel = clickParam.visible;
        var hiddenTitel = clickParam.hidden;
        var clickObj = document.getElementById(clickParam.id);
     }
  }
    if(rootNode) {
        if(typeof rootNode == 'object' && rootNode.hasChildNodes())
        {
            var childs = rootNode.childNodes;
            var is_visible = false; 
            for(var i = 0; i < childs.length; i++) {              
                if(childs[i].className == class_name){        	
                    is_visible = expand(childs[i]);                    
                }
            }
            if(is_visible == true) { clickObj.innerHTML = visibleTitel;}else{ clickObj.innerHTML = hiddenTitel;}
        }
    }
    var foo = document.getElementById('footer');
    if(foo){ 
        foo.style.visibility='hidden';
        foo.style.visibility='visible';     
    }
}

