/************************************************************
Coolmenus Beta 5.01 - Copyright Thomas Brattli - www.dhtmlcentral.com
Last updated: 11.13.04

v5.01 - with basic frame support
*************************************************************/
function SetScrollingFalse(){
  var_scrolling = false;
}

function ScrollDown(top){
  if(top>0){
    for (x=var_pos+1; x<var_menus.length; x++){
      obj = GetObj(var_menus[x]);
      obj.style.top = parseInt(obj.style.top)+scroll;
    }
    window.setTimeout('ScrollDown('+(top-scroll)+')',speed);
  }else{
    MM_showHideLayers(var_sub_div, '', 'show');
    window.setTimeout('SetScrollingFalse()', 100);
  }
}

function ScrollUp(top){
  if(top>0){
    for (x=var_pos+1; x<var_menus.length; x++){
      obj = GetObj(var_menus[x]);
      obj.style.top = parseInt(obj.style.top)-scroll;
    }
    window.setTimeout('ScrollUp('+(top-scroll)+')',speed);
  }else{
    var_pos = 0;
    var_sub_div = '';
    window.setTimeout('SetScrollingFalse()', 100);
  }
}


function ScrollUpDown(top, pos, sub_div_name){
  if(top>0){
    for (x=var_pos+1; x<var_menus.length; x++){
      obj = GetObj(var_menus[x]);
      obj.style.top = parseInt(obj.style.top)-scroll;
    }
    window.setTimeout('ScrollUpDown('+(top-scroll)+','+pos+',"'+sub_div_name+'")',speed);
  }else{
    var_pos = pos;
    var_sub_div = sub_div_name;
    obj = GetObj(var_sub_div);
    height = parseInt(obj.style.height);
    ScrollDown(height);
  }
}

function ShowSub(div_name, sub_div_name){
  if (!var_scrolling){
    if (sub_div_name!=''){ var_scrolling = true; }
    obj = (var_sub_div!='') ? GetObj(var_sub_div) : GetObj(sub_div_name);
    height = parseInt(obj.style.height);

    if (var_sub_div==''){
      var_pos = GetPos(div_name);
      var_sub_div = sub_div_name;
      ScrollDown(height);
    }else if(var_sub_div == sub_div_name){
      MM_showHideLayers(var_sub_div, '', 'hide');
      ScrollUp(height);
    }else{ 
      MM_showHideLayers(var_sub_div, '', 'hide');
      pos = GetPos(div_name);
      ScrollUpDown(height, pos, sub_div_name);
    }

  }
}

function Close(){
  if (!var_scrolling && var_sub_div!=''){
      obj = GetObj(var_sub_div);
      height = parseInt(obj.style.height);
      MM_showHideLayers(var_sub_div, '', 'hide');
      ScrollUp(height);
  }
}

function GetPos(div_name){
  for (x=0; x<var_menus.length; x++){
    if (div_name==var_menus[x]){ pos = x; }
  }
  return pos;
}

function markierenHauptmenue(obj) 
{ 
for (var i = 1; i < document.getElementsByTagName("a").length; i++) { 
var cur = document.getElementsByTagName("a")[i]; 
if (cur == obj) 
cur.className = "hauptmenue_aktiv"; 
else 
cur.className = ""; 
} 
} 

function markierenSubmenue(obj) 
{ 
for (var i = 1; i < document.getElementsByTagName("a").length; i++) { 
var cur = document.getElementsByTagName("a")[i]; 
if (cur == obj) 
cur.className = "submenue_aktiv"; 
else 
cur.className = ""; 
} 
}

var scroll = 2;
var speed = 1;

var_menu_id = 0;
var_sub_id = 0;
var var_pos = 0;
var var_sub_div = '';
var var_scrolling = false;

function GetObj(name){
  obj = document.getElementById(name);
  if (!obj){
    obj = document.getElementsByName(name)[0];
  }
  return obj;
}

function getObj(name) {
    return GetObj(name);
}

function showDiv(div) {
    obj = getObj(div);
    if (obj != null) {
        obj.style.visibility = 'visible';
    }
}

function hideDiv(div) {
    obj = getObj(div);
    if (obj != null) {
        obj.style.visibility = 'hidden';
    }
}

var m_over = new Array();
function MOver(text, name, src){
  window.status = unescape(text);
  if (name){
    obj = GetObj(name);
    m_over["src"] = obj.src;
    m_over["obj"] = obj;
    obj.src = src;
  }
  return true;
}

function MOut(){
  window.status = '';
  if (m_over["src"]){
    m_over["obj"].src = m_over["src"];
  }
}
