var curMenupoint = "";
var curFoto = 0;

var sections = Array("Programm", "Haus", "Verein", "Service", "Galerie");
sections["Programm"] = 9;
sections["Haus"] = 6;
sections["Verein"] = 3;
sections["Service"] = 10;
sections["Galerie"] = 3;

var month = Array("jan", "feb", "mae", "apr", "mai", "jun", "jul", "aug", "sep", "okt", "nov", "dez");
var clickedMonth = "";
var clickedYear = "";

function highlightMenupoint( section, menupoint ) 
{
  if (navigator.userAgent.indexOf("Mac") != -1)
    window.setTimeout("doHighlightMenupoint('"+section+"', '"+menupoint+"');", 600);
  else
    doHighlightMenupoint(section, menupoint);
}

function doHighlightMenupoint( section, menupoint ) 
{
  if(top.navigation)
  {
    for ( i=1; i<=sections[section]; i++ )
    {
     //alert ("sections[section]: " + sections[section]);
      var index = 1;
      if (i<10)
        index = "0" + i;
      else
        index = i;
        
      //alert('index: ' + index);
      var element = top.navigation.document.getElementById('subnav_' + menupoint.substring(7,9) + index);
      var elementAct = top.navigation.document.getElementById('subnav_' + menupoint.substring(7,9) + index + '_act');
//      alert ("elementAct" + elementAct.id);
      element.style.visibility = 'visible';
      elementAct.style.visibility = 'hidden';
    }

    var element = top.navigation.document.getElementById(menupoint);
    var elementAct = top.navigation.document.getElementById(menupoint + '_act');
  
    element.style.visibility = 'hidden';
    elementAct.style.visibility = 'visible';
  }
}

function showNextFoto( numSecFotos )
{
  if (fotoParams)
  {
    var titleText = document.getElementById("fotoSubtitle").firstChild;

    curFoto++;
    if ( curFoto >= numSecFotos )
      curFoto = 0;

    document.images['foto'].src = '../images/'+fotoParams[curFoto][0];
    titleText.nodeValue = fotoParams[curFoto][1];
  }
}


function openNlWindow()
{
  nlWin = window.open('http://frankfurt.kulturkurier.de/nl/newsletter_optin.php?cid=literaturhaus_frankfurt', 'fenster', 'width=262,height=283,left=300,top=400','resizable=no,scrollbars=no,locationbar=no');

}


function changeImages(imgname, imgsrc) 
{
  if (document.images && top.navigation && top.navigation.clickedMonth != imgname) 
  {
    document[imgname].src = "../images/" + imgsrc;
  }
}

function highlightMonth(imgname, imgsrc) 
{
  if (navigator.userAgent.indexOf("Mac") != -1)
    window.setTimeout("doHighlightMonth('"+imgname+"', '"+imgsrc+"');", 500);
  else
    doHighlightMonth(imgname, imgsrc);
}


function doHighlightMonth(imgname, imgsrc) 
{
  if (document.images && top.navigation) 
  {
    for (i=0; i < month.length; i++)
    {     
      var deActMonth = month[i];
      var deActSrc = "pr_" + deActMonth + ".gif";
      top.navigation.document[deActMonth].src = "../images/" + deActSrc;
    }
    
    top.navigation.clickedMonth = imgname;
    top.navigation.document[imgname].src = "../images/" + imgsrc;
  }
}

function highlightYear(activeMnPoint, txtColor)
{
  if (navigator.userAgent.indexOf("Mac") != -1)
    window.setTimeout("doHighlightYear('"+activeMnPoint+"', '"+txtColor+"');", 500);
  else
    doHighlightYear(activeMnPoint, txtColor);
}

function doHighlightYear(activeMnPoint, txtColor)
{
    var numNodes = top.navigation.document.getElementById("monatsleiste").childNodes.length;
    
    for (i=0; i<numNodes; i++)
    {
      var ndName = top.navigation.document.getElementById("monatsleiste").childNodes[i].nodeName;
      if (ndName == 'A')
      {
        top.navigation.document.getElementById("monatsleiste").childNodes[i].style.color = '#000000';
      }
    }
    
    var elementAct = top.navigation.document.getElementById(activeMnPoint);
    elementAct.style.color = txtColor;
    top.navigation.clickedYear = activeMnPoint;    
}

function rollOverYear(roMnPoint, txtColor)
{
    if ( top.navigation.clickedYear != roMnPoint )
    {
      var elementAct = document.getElementById(roMnPoint);
      elementAct.style.color = txtColor;
    }
}

function fillFrames(naviFrame, contentFrame)
{
  if (naviFrame && contentFrame)
  {
    top.navigation.location.href = naviFrame;
    top.content.location.href = contentFrame;
  }
}
