function zoom(name) {
  f=window.open("zoomwindow.html?picname="+name,"Foto","width=544,height=366,scrollbars=no,resizable=no");
}

function zoom_param(name,w,h) {
  f=window.open("zoomwindow.html?picname="+name,"Foto","width="+w+",height="+h+",scrollbars=no,resizable=no");
}

function closewindow() { 
  window.close();
}

function picurl() {
  var s = location.href;
  s = s.replace(/.*\?picname=/, "");
  return s;
}

function angebot() { 
  // alert("angebot"); 
  location.href="angebot.html"; 
}


// =========================== MENU FUNCTIONS =========================

var currentItem = "";
var isOverMenu = false;
var timeOut = 0;

function init(ci) {
  currentItem = ci;
  isOverMenu = false;
}
      
function hideMenu() {
  document.getElementById([currentItem]).style.visibility = "hidden";
}
      
function cleanUp() {
  isOverMenu = false;
  timeOut = window.setTimeout("closeMenu()", 10);
}
      
function retainMenu() {
  isOverMenu = true;
  window.clearTimeout(timeOut);
}
      
function closeMenu() {
  if(!isOverMenu) {
    document.getElementById([currentItem]).style.visibility = "hidden";
  }
}
     
function openMenu(menuItem) {
  return;
  isOverMenu = true;
  window.clearTimeout(timeOut);
  document.getElementById([currentItem]).style.visibility = "hidden";
  currentItem=[menuItem];
  document.getElementById([currentItem]).style.visibility = "visible";
}
      

function startSwingingStrings() {
  document.getElementById(["menu1open"]).style.visibility = "visible";
  document.getElementById(["menu2open"]).style.visibility = "visible";
  document.getElementById(["menu3open"]).style.visibility = "visible";
  document.getElementById(["menu4open"]).style.visibility = "visible";
  document.getElementById(["menu5open"]).style.visibility = "visible";
  document.getElementById(["menu6open"]).style.visibility = "visible";
  stopSwingingStrings();
}


function startSwinging(id) {
  document.getElementById(id).style.visibility = "visible";
}

function stopSwinging(id) {
  document.getElementById(id).style.visibility = "hidden";
}

function stopSwingingStrings() {
    window.setTimeout("stopSwinging('menu1open')",3000);
    window.setTimeout("stopSwinging('menu2open')",5000);
    window.setTimeout("stopSwinging('menu3open')",8000);
    window.setTimeout("stopSwinging('menu4open')",12000);
    window.setTimeout("stopSwinging('menu5open')",17000);
    window.setTimeout("stopSwinging('menu6open')",23000);

    window.setTimeout("startSwinging('menu2open')",25000);
    window.setTimeout("startSwinging('menu3open')",27000);
    window.setTimeout("startSwinging('menu5open')",29000);
}

// =========================== PAGER: GO NEXT PAGE ICON ================ 

var nextFlag = false;
var idShow;
var idHide;

function initNext() {
    nextFlag = false;
    idShow = null;
    idHide = null;
}

function closeNext() {
  if(!nextFlag && idHide && document.getElementById(idHide)) {
    document.getElementById(idHide).style.visibility = "hidden";
    document.getElementById(idShow).style.visibility = "visible";
  }
}

function retainNext(ids, idh) {
  nextFlag = true;
  idShow = ids;
  idHide = idh;
  window.clearTimeout(timeOut);
}

function cleanUpNext(ids, idh) {
  nextFlag = false;
  idShow = ids;
  idHide = idh;
  timeOut = window.setTimeout("closeNext()", 3);
}

function openNext(idShow, idHide) {
  nextFlag = true;
  window.clearTimeout(timeOut);
  document.getElementById(idHide).style.visibility = "hidden";
  document.getElementById(idShow).style.visibility = "visible";
}

function changePicture(elemName, bildSrc) {
  var str = "document['" + elemName + "'].src = '" + bildSrc + "';";
  eval(str);
}

// =========================== FORMULAR CHECK  ========================= 

function ischecked(checkBoxName) {
    var cb = document.getElementsByName(checkBoxName);
    return (cb.length > 0 && cb[0].type == "checkbox" && cb[0].checked);
}

function formcheck() {
    if (document.F1.Vorname.value == '') {
        alert("Vorname darf nicht leer sein.");
        return;
    }
    if (document.F1.Nachname.value == '') {
        alert("Nachname darf nicht leer sein.");
        return;
    }
    if (document.F1.Anschrift.value == '') {
        alert("Anschrift darf nicht leer sein.");
        return;
    }
    if (document.F1.Ort.value == '') {
        alert("PLZ, Ort dürfen nicht leer sein.");
        return;
    }
    if (document.F1.teilnehmer_email.value != '') {
        if( document.F1.teilnehmer_email.value.indexOf("@") == -1 ) {
                alert("Email Adresse nicht korrekt");
                return;
        }
    }
    else {
        alert("Email darf nicht leer sein.");
    }
    document.F1.submit();
}

function revert(name) {
    if (ischecked(name)) {
        document.getElementsByName(name)[0].click();
    }
}

function checkMeisterkurs() {
    revert("meisterkurs");
    revert("Swete");
    revert("Catala");
    revert("Hebb");
    revert("Kaufmann");
    revert("Wagner");
}

function checkStudienkurs() {
    revert("Studienkurs");
}

function checkJazz() {
    revert("JazzKursKlassiker");
}

function checkJazzStudien() {
    checkJazz();
    checkStudienkurs();
}

function checkJazzMeister() {
    checkJazz();
    checkMeisterkurs();
}

function checkStudienMeister() {
    checkStudienkurs();
    checkMeisterkurs();
}



