/* JavaScripts KraskaEckstein */

// Background-Colors
var colors = new Array();
    colors[0]  = '#00ffff';
    colors[1]  = '#ff00ff';
    colors[2]  = '#00766f';
    colors[3]  = '#2f2f31';
    colors[4]  = '#aeafb0';
    colors[5]  = '#d0d1d3';
    colors[6]  = '#e7e7e9';
    colors[7]  = '#e13100';
    colors[8]  = '#f69c83';
    colors[9] = '#fcdbd1';
    colors[10] = '#5ce06b';
    colors[11] = '#c4f4c6';
    colors[12] = '#e3fbe4';
    colors[13] = '#e0fb00';
    colors[14] = '#e8fd32';
    colors[15] = '#f1fe88';
    colors[16] = '#ffee00';
    colors[17] = '#fff658';
    colors[18] = '#fff998';
    colors[19] = '#00b9ef';
    colors[20] = '#7cd2f6';
    colors[21] = '#b2e4f9';
    colors[22]  = '#f2f4f4';
    colors[23] = '#fdede8';
    colors[24] = '#f0fcf0';
    colors[25] = '#fbffe3';
    colors[26] = '#ffffec';
    colors[27] = '#e8f6fd';

var color_timeout;

function set_bgcolor(item,color)
{
  if(item!=undefined)
  {
    if(color!=undefined)
    {
      if(color.indexOf('#')<=-1)
        color = '#'+color;
        
      item.style.backgroundColor=color;
    }
    else
    {
      color = item.style.backgroundColor;
      newcolor = color;
      while(newcolor == color)
        newcolor = colors[Math.round(Math.random()*colors.length)];

      item.style.backgroundColor = newcolor;
    }
  }
}

function loadimage(image,container)
{
  if(image!=undefined && container!=undefined)
  {
    document.getElementById(container).src = image;
  }
}

function scroll_submenu_in(container) {
/*
  container = document.getElementById(container);
  submenu = container;
  
  if(container.className!='row2')
  {
    if(container.getElementsByTagName!=undefined)
    {
      for(i=0; i<container.getElementsByTagName('div').length; i++)
      {
        if(container.getElementsByTagName('div')[i].className=='row2')
        {
          submenu = container.getElementsByTagName('div')[i];
          break;
        }
      }
    }
  }
  if(submenu.className=='row2')
  {
    submenu.style.marginTop = submenu.parentNode.scrollTop+"px";
  }

  window.setTimeout("scroll_submenu_in('"+container.id+"')", 1);
*/
}


function openWin(url,winname,posx,posy,width,height,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='winPopup';
  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=no,status=yes,scrollbars=yes,toolbar=no');

    objekt.focus
  } else {
    alert('Fehler openwin.1 - Keine URL fuer das PopUp uebergeben!');
    return false;
  }
}
