
var flag = true;
var nr = 0;
var anzahl_img = images.length;

function textAppear() {
  $('toplinks_container').appear({duration: 1.0});
  $('sm_container').appear({duration: 1.5});
  return false;
}

function datesAppear() {
    $('dates').appear({duration: 1.0});
    return false;
}


function play(time) {
   window.setTimeout("show_album()", 10000);
   window.setTimeout("textAppear()", time);
   window.setTimeout("datesAppear()", 22000);
}

function display() {
  $('toplinks_container').style.display = 'block';
  $('sm_container').style.display = 'block';
}

function openWindow (address) {
  newWindow = window.open(address, "MENU", "width=250,height=350,left=20,top=250,dependent=yes");
  newWindow.focus();
}

function show(id) {

    if ($('dates').style.display == 'block') {
            $('dates').style.display = 'none';
    }

    if ($('news').style.display == 'block') {
            $('news').style.display = 'none';
    }

    if ($('contact').style.display == 'block') {
            $('contact').style.display = 'none';
    }

    $(id).style.display = 'block';
}


function show_gallery() {
  $('gallery_container').style.display = 'block';
}

function hide_gallery() {
  $('gallery_container').style.display = 'none';
}

function switch_img(vor) {
   
    if (vor) {
        if (nr <= anzahl_img-2) {
            nr = nr+1;
            $('image').src = 'img/fotos/'+images[nr];
        }
    } else {
        if (nr >= 1) {
            nr = nr-1;
            $('image').src = 'img/fotos/'+images[nr];
        }
    }
    $('img_number').innerHTML = (nr+1) + '/' + anzahl_img;
}

function bildZurueck() {

}

function gallery() {
   if ($('gallery_container').style.display == 'block') {
     hide_gallery();
   } else {
    show_gallery();
    display();  //Menu und Icons im Hintergrund anzeigen
    gallery_height();
   }
}

function gallery_height() {
    //alert($('image').style.height);
    image_height = window.innerHeight-190;
    arrow_distance = (image_height/2)-32;

    $('image').style.height = image_height+"px";
    $('left_arrow').style.top = arrow_distance+"px";
    $('right_arrow').style.top = arrow_distance+"px";
}

function show_album() {
    Effect.Grow('album_ad');
    window.setTimeout("Effect.Fold('album_ad')",20000);
}
