
var countMenueLayer = 9;

var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0, what = '';

var origXPos = new Array();

function getLayerPos() 
{
  for (i = 0 ; i < countMenueLayer ; i++)
  {
    if(window.document.getElementById("layerMenue_" + i))
    {
      origXPos["layerMenue_" + i] = parseInt(window.document.getElementById("layerMenue_" + i).style.top);
    }
  }
    
  // origXPos["layerMenue_x"] = parseInt(window.document.getElementById("layerMenue_0").style.top);	
}

function DHTML_init()
{

  if (window.opera)
  {
    OP = 1;
  }
  if(document.getElementById)
  {
    DHTML = 1;
    DOM = 1;
  }
  if(document.all && !OP)
  {
    DHTML = 1;
    MS = 1;
  }
  if(document.layers && !OP)
  {
   DHTML = 1;
   NS = 1;
  }
}

DHTML_init();

//------------------------------------------------------------------------

function setFocus(formularName, formularField)
{
  window.document.forms[formularName].elements[formularField].focus();
}

//------------------------------------------------------------------------

function openWindow(file, name, width, height, top, left, scroll, resizable)
{	
  window.open(file, name, "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + ",scrollbars=" + scroll + ",resizable=" + resizable + ",location=no,menubar=no,status=no,toolbar=no");
  return false;
}

//------------------------------------------------------------------------

function detectIfPopUp(path)
{
  if(!opener) { window.document.location.href = path + "index.htm"; }
}

//------------------------------------------------------------------------

function checkFrameset()
{
  if(parent.frames.length == 0) { window.document.location.href="index.htm"; }
}

//-----------------------------------------------------------------------

function setLayerMenue(thisID)
{		
  var layerPrefix = "layerMenue_";
  var layerID = layerPrefix + thisID;
  var visibilityType = "hidden";
  var layerPos;
  var width;
  var yKorr = 0;		
  
  if(window.document.getElementById("startTextContent"))
  {
    window.document.getElementById("startTextContent").style.visibility = "hidden";	
    window.document.getElementById("startTextContent").style.display = "none";
  }	
  
  if(MS)
  {
    // yKorr = yKorr +4;
    yKorr = yKorr +0;
  }
  else if(OP)
  {
    // yKorr = yKorr -10;
    yKorr = yKorr -2;
  }
  
  var arrLeftPosKorr = new Array();
  arrLeftPosKorr["layerMenue_0"] = -10;
  arrLeftPosKorr["layerMenue_1"] = -4;
  arrLeftPosKorr["layerMenue_2"] = 26;
  arrLeftPosKorr["layerMenue_3"] = 96;
  arrLeftPosKorr["layerMenue_4"] = 230;
  arrLeftPosKorr["layerMenue_5"] = 20;
  arrLeftPosKorr["layerMenue_8"] = 340;
  
  for(i = 0 ; i < countMenueLayer ; i++)
  {
    if(i != thisID)
    {
      thisLayerID = layerPrefix + i;		
      if(window.document.getElementById(thisLayerID) && thisID != "x")
      {				
        window.document.getElementById(thisLayerID).style.visibility = "hidden";
        window.document.getElementById(thisLayerID).style.top = origXPos[thisLayerID];					
      }
    }
  }
  if(window.document.getElementById(layerID))
  {
    visibilityType = window.document.getElementById(layerID).style.visibility;	
    if(visibilityType == "hidden") { visibilityType = "visible"; }	
    else { visibilityType = "hidden"; }	
    
    if(visibilityType == "visible")
    {
      window.document.getElementById(layerID).style.visibility = visibilityType;					
        
      width = window.innerWidth;
      // width = screen.availWidth;
      // width = screen.width;
          
      if(MS)
      {
        width = document.body.clientWidth - 100;
      }
      //alert(width);
      
      layerPos = ( width - 900 ) / 2;
      if(layerPos < 0) { layerPos = 0; }		
      
      thisXKorr = arrLeftPosKorr[layerID]; 						
          
      window.document.getElementById(layerID).style.top = parseInt(window.document.getElementById(layerID).style.top) - yKorr;							
      window.document.getElementById(layerID).style.left = layerPos + thisXKorr;
      //alert(window.document.getElementById(layerID).style.left);
    }
  }
}

// --------------------------------

function preloadImages()
{
  var mainNavImages = new Array();	
  mainNavImages[0] = new Image();
  mainNavImages[1] = new Image();
  
  mainNavImages[0].src = "/layout/mainMenueBg_0.gif";
  mainNavImages[1].src = "/layout/mainMenueBg_1.gif";
}

// --------------------------------

function getStartText()
{	
  /*
  // DEFINE TEXTS
    arrStartTexts = new Array();
    arrStartTexts[0] = "Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
    arrStartTexts[1] = "text 2";		
  // END DEFINE TEXTS
  
  var randomIndex = Math.round(Math.random() * arrStartTexts.length);
  
  if(typeof arrStartTexts[randomIndex] != "undefined" && arrStartTexts[randomIndex] != "")
  {
    window.document.getElementById("startTextContent").firstChild.nodeValue = arrStartTexts[randomIndex];
  }
  else
  {
    getStartText();	
  }
  */
}

// 

