var rootPath = "";
var actualPage = 0;   // 0:Start 1:Menue 2:Seitenrahmen mit Bild 3:Inhalt 4:Seitenrahmen ohne Bild 5:Inhalt-Fotoseite 6:Inhalt-Trailerseite
var actualLanguage = 1;  // 1:deutsch 2:english
var actualLanguageDirectory = "deutsch";


var startButtons = new Array();
var startButtonsLoaded = 0;
var menuButtons = new Array();
var menuButtonsLoaded = 0;
var contentFrameButtons = new Array();
var contentFrameButtonsLoaded = 0;

var scrollIFrameInterval = 0;

var checkAnimationsCount = 0;

var actualGalleryImageIdx;






function WriteStyles()
{
}


function PreloadButtons()
{
  if ((actualPage == 1) && (!menuButtonsLoaded))
  {
    for (i=0; i<22; i++) 
      menuButtons[i] = new Image();
    menuButtons[0].src =  rootPath + "bilder/menue/03.jpg";
    menuButtons[1].src =  rootPath + "bilder/menue/03b.jpg";
    menuButtons[2].src =  rootPath + "bilder/menue/05.jpg";
    menuButtons[3].src =  rootPath + "bilder/menue/05b.jpg";
    menuButtons[4].src =  rootPath + "bilder/menue/07.jpg";
    menuButtons[5].src =  rootPath + "bilder/menue/07b.jpg";
    menuButtons[6].src =  rootPath + "bilder/menue/11.jpg";
    menuButtons[7].src =  rootPath + "bilder/menue/11b.jpg";
    menuButtons[8].src =  rootPath + "bilder/menue/13.jpg";
    menuButtons[9].src =  rootPath + "bilder/menue/13b.jpg";
    menuButtons[10].src =  rootPath + "bilder/menue/15.jpg";
    menuButtons[11].src =  rootPath + "bilder/menue/15b.jpg";
    menuButtons[12].src =  rootPath + "bilder/menue/17.jpg";
    menuButtons[13].src =  rootPath + "bilder/menue/17b.jpg";
    menuButtons[14].src =  rootPath + "bilder/menue/21.jpg";
    menuButtons[15].src =  rootPath + "bilder/menue/21b.jpg";
    menuButtons[16].src =  rootPath + "bilder/menue/23.jpg";
    menuButtons[17].src =  rootPath + "bilder/menue/23b.jpg";
    menuButtons[18].src =  rootPath + "bilder/menue/25.jpg";
    menuButtons[19].src =  rootPath + "bilder/menue/25b.jpg";
    menuButtons[20].src =  rootPath + "bilder/menue/27.jpg";
    menuButtons[21].src =  rootPath + "bilder/menue/27b.jpg";
    menuButtonsLoaded = 1;
  }
  else if (((actualPage == 2) || (actualPage == 4)) && (!contentFrameButtonsLoaded))
  {
    for (i=0; i<4; i++) 
      contentFrameButtons[i] = new Image();
    contentFrameButtons[0].src = rootPath + "bilder/seitenrahmen/" + actualLanguageDirectory + "/menue.jpg";
    contentFrameButtons[1].src = rootPath + "bilder/seitenrahmen/" + actualLanguageDirectory + "/menue2.jpg";
    contentFrameButtons[2].src = rootPath + "bilder/seitenrahmen/fotoseite/" + actualLanguageDirectory + "/galerie.jpg";
    contentFrameButtons[3].src = rootPath + "bilder/seitenrahmen/fotoseite/" + actualLanguageDirectory + "/galerie2.jpg";
    contentFrameButtonsLoaded = 1;
  }
}


function LoadImageSource(dstImgName,srcImg)
{
  document.images[dstImgName].src = srcImg.src;
}


function HeadScripts(actualPageIdx,rootPathName,languageNo)
{
  if (!rootPathName)
    rootPath = "";
  else
    rootPath = rootPathName;
  if (rootPath[rootPath.length-1] != "/")
    rootPath = rootPath + "/";

  if (!languageNo)
    actualLanguage = 1;
  else
    actualLanguage = languageNo;
  if (actualLanguage == 1)
    actualLanguageDirectory = "deutsch";
  else if (actualLanguage == 2)
    actualLanguageDirectory = "english";

  if (!actualPageIdx)
    actualPage = 0;
  else
    actualPage = actualPageIdx;

  if ((top.frames.length > 0) && ((actualPage < 3) || (actualPage == 4)))
    top.location.href=self.location;

  WriteStyles();
  
  PreloadButtons();
}


function WriteBodyTag(attributes)
{
  if (!attributes)
    attributes = "";

  document.write("\
    <body leftMargin=0 topMargin=0 marginwidth=0 marginheight=0 " + attributes + ">\
  ");
}


function BodyScripts()
{
}


function WriteTopCode(bg_image)
{
  if (!bg_image)
    bg_image = 0;

  if ((actualPage < 3) || (actualPage == 4))
  {
    document.write("\
    <table width=100% height=100% cellpadding=0 cellspacing=0 border=0>\
      <tr><td width=100% height=100% align=center valign=middle style='vertical-align:middle;'>\
        <div style='position:relative; width:790; height:550;'>\
    ");
  }

  else if (actualPage == 3)
    document.write("\
      <div id='scrollUpArrow' style='position:absolute; left:0; top:0; width:350; height:15; z-index:100; visibility:visible; padding=0px; margin=0px; font-size:1px;'>\
        <img src='" + rootPath + "bilder/pfeil_hoch.jpg' width=350 height=15 border=0 onMouseDown='StartScrollUpIFrame();' onMouseUp='StopScrollIFrame();' onMouseOut='StopScrollIFrame();'>\
      </div>\
      <div id='scrollDownArrow' style='position:absolute; left:0; top:249; width:350; height:15; z-index:100; visibility:visible; padding=0px; margin=0px; font-size:1px;'>\
        <img src='" + rootPath + "bilder/pfeil_runter.jpg' width=350 height=15 border=0 onMouseDown='StartScrollDownIFrame();' onMouseUp='StopScrollIFrame();' onMouseOut='StopScrollIFrame();'>\
      </div>\
    ");

  else if (actualPage == 5)
    document.write("\
      <div id='scrollUpArrow' style='position:absolute; left:0; top:0; width:400; height:20; z-index:100; visibility:visible; padding=0px; margin=0px; font-size:1px;'>\
        <img src='" + rootPath + "bilder/seitenrahmen/fotoseite/pfeil_hoch.jpg' width=400 height=20 border=0 onMouseDown='StartScrollUpIFrame();' onMouseUp='StopScrollIFrame();' onMouseOut='StopScrollIFrame();'>\
      </div>\
      <div id='scrollDownArrow' style='position:absolute; left:0; top:380; width:400; height:20; z-index:100; visibility:visible; padding=0px; margin=0px; font-size:1px;'>\
        <img src='" + rootPath + "bilder/seitenrahmen/fotoseite/pfeil_runter.jpg' width=400 height=20 border=0 onMouseDown='StartScrollDownIFrame();' onMouseUp='StopScrollIFrame();' onMouseOut='StopScrollIFrame();'>\
      </div>\
    ");
}


function WriteBottomCode()
{
  if ((actualPage < 3) || (actualPage == 4))
    document.write("</div></td></tr></table>");
  
  if (actualPage == 3)
    setInterval("ActualizeScrollButtons()",4);
}


function GetVerticalScrollPosition()
{
  var yOffset;

  if (self.pageYOffset)
    yOffset = self.pageYOffset;
  else if (document.documentElement && document.documentElement.scrollTop)
    yOffset = document.documentElement.scrollTop;
  else if (document.body)
    yOffset = document.body.scrollTop;

  return yOffset;
}

function ActualizeScrollButtons()
{
  var downArrow;
  document.getElementById("scrollUpArrow").style.top = GetVerticalScrollPosition();
  if (actualPage == 3)
    downArrow = GetVerticalScrollPosition() + 249;
  else if (actualPage == 5)
    downArrow = GetVerticalScrollPosition() + 380;
  document.getElementById("scrollDownArrow").style.top = downArrow;
}

function ScrollUpIFrame()
{
  document.getElementById("scrollUpArrow").style.visibility = "hidden";
  document.getElementById("scrollDownArrow").style.visibility = "hidden";
  window.scrollBy(0,-8);
  ActualizeScrollButtons();
  document.getElementById("scrollUpArrow").style.visibility = "visible";
  document.getElementById("scrollDownArrow").style.visibility = "visible";
}

function StartScrollUpIFrame()
{
  if (scrollIFrameInterval != 0)
    clearInterval(scrollIFrameInterval);
  scrollIFrameInterval = setInterval("ScrollUpIFrame()",30);
}

function ScrollDownIFrame()
{
  document.getElementById("scrollUpArrow").style.visibility = "hidden";
  document.getElementById("scrollDownArrow").style.visibility = "hidden";
  window.scrollBy(0,8);
  ActualizeScrollButtons();
  document.getElementById("scrollUpArrow").style.visibility = "visible";
  document.getElementById("scrollDownArrow").style.visibility = "visible";
}

function StartScrollDownIFrame()
{
  if (scrollIFrameInterval != 0)
    clearInterval(scrollIFrameInterval);
  scrollIFrameInterval = setInterval("ScrollDownIFrame()",30);
}

function StopScrollIFrame()
{
  if (scrollIFrameInterval != 0)
  {
    clearInterval(scrollIFrameInterval);
    scrollIFrameInterval = 0;
  }
}


function WritePageCode(contentSrc,foregroundPicturePath,scrollingIFrame)
{
  if (scrollingIFrame)
  {
    if (actualPage == 2)
      document.write("\
        <div id='hintergrund_oben' style='position:absolute; left:87; top:138; width:245; height:15; z-index:90; visibility:visible; padding=0px; margin=0px; font-size:1px;'>\
          <img src='" + rootPath + "bilder/seitenrahmen/03a.jpg' width=245 height=15 border=0 style='vertical-align:top;'>\
        </div>\
        <div id='hintergrund_unten' style='position:absolute; left:87; top:387; width:245; height:15; z-index:90; visibility:visible; padding=0px; margin=0px; font-size:1px;'>\
          <img src='" + rootPath + "bilder/seitenrahmen/03b.jpg' width=245 height=15 border=0 style='vertical-align:top;'>\
        </div>\
      ");
  }

  document.write("\
  <div id='menue_button' style='position:absolute; left:451; top:265; width:102; height:18; z-index:90; visibility:visible; padding=0px; margin=0px; font-size:1px; line-height:1px;'>\
    <a href='menue.htm' target=_self onMouseOver=\"LoadImageSource('img_menue_button',contentFrameButtons[1])\" onMouseOut=\"LoadImageSource('img_menue_button',contentFrameButtons[0])\">\
      <img name='img_menue_button' src='" + rootPath + "bilder/seitenrahmen/" + actualLanguageDirectory + "/menue.jpg' width=102 height=18 border=0 style='vertical-align:top;'></a>\
  </div>\
  <div id='foregroundPicture' style='position:absolute; left:451; top:321; width:300; height:180; z-index:100; visibility:visible;'>\
    <img src=" + foregroundPicturePath + " width=300 height=180 border=0>\
  </div>\
  <table width=790 height=550 cellpadding=0 cellspacing=0 border=0 align=center>\
    <tr>\
      <td colspan=3><img src='" + rootPath + "bilder/seitenrahmen/01.jpg' width=790 height=138 border=0></td>\
    </tr>\
    <tr>\
      <td><img src='" + rootPath + "bilder/seitenrahmen/02.jpg' width=87 height=264 border=0></td>\
  ");
  if (contentSrc.length > 0)
  document.write("\
      <td>\
        <iframe src='" + contentSrc + "' width=350 height=264 name='contentFrame' scrolling='no' align=center marginheight=0 marginwidth=0 frameborder=0 border=0 framespacing=0>\
          Ihr Browser kann leider keine eingebetteten Inhalte anzeigen.<br>\
          Sie können die entsprechende Seite direkt über folgenden link aufrufen:<br>\
          <a href='" + contentSrc + "' target=_blank>" + contentSrc + "</a>\
        </iframe></td>\
    ");
  else
  document.write("\
      <td><img src='" + rootPath + "bilder/seitenrahmen/03.jpg' width=350 height=264 border=0></td>\
    ");
  document.write("\
      <td><img src='" + rootPath + "bilder/seitenrahmen/" + actualLanguageDirectory + "/04.jpg' width=353 height=264 border=0></td>\
    </tr>\
    <tr>\
      <td colspan=3><img src='" + rootPath + "bilder/seitenrahmen/05.jpg' width=790 height=148 border=0></td>\
    </tr>\
  </table>\
  ");
}


function CheckAnimations()
{
  if (document.getElementById("img_start").complete == true)
  {
    if (document.getElementById("img_gras").complete == true)
      document.getElementById("gras").style.visibility = "visible";
    if (document.getElementById("img_windrad").complete == true)
      document.getElementById("windrad").style.visibility = "visible";
  }
  checkAnimationsCount = checkAnimationsCount + 1;
  if (checkAnimationsCount > 15)
  {
    document.getElementById("windrad").style.visibility = "visible";
    document.getElementById("gras").style.visibility = "visible";
  }
  else  
    setTimeout("CheckAnimations()",200);
}


