var OP = (window.opera) ? 1:0;
var IE4 = (document.all && !document.getElementById && !OP) ? 1:0;
var IE5 = (navigator.appVersion.indexOf('MSIE 5') != -1) ? 1:0;
var IE6 = (document.all && document.getElementById && !IE5 && !OP) ? 1:0;
var NS6 = (document.getElementById && !IE6 && !OP && !IE5 ) ? 1:0;
var NS4 = (document.layers) ? 1:0;
var Timeout = "";
var AktivesBild = "";
var Menu = new Array();


//einbinden der Stylsheet-Dateien für die unterschiedlichen Browser:
if(IE6){
   document.write('<link rel="STYLESHEET" type="text/css" href="menue.css">');
} else if(NS4){
   document.write('<link rel="STYLESHEET" type="text/css" href="menue_ns4.css">');
}else if(NS6){
   document.write('<link rel="STYLESHEET" type="text/css" href="menue.css">');
}else {
   document.write('<link rel="STYLESHEET" type="text/css" href="menue.css">');
}

var bilderpfad = "images/navigation_festivals/";
function bilderladen()
{
    var Bilder = new Array();
    for(i=0; i<bilderladen.arguments.length; i++){
        Bilder[i] = new Image();
        Bilder[i].src = bilderpfad + bilderladen.arguments[i];
    }
}
function Anim(nsObj, Bild, Quelle)
{
  if(AktivesBild != Bild){
    if(document.layers){
        if(nsObj != ""){
            document['menue'].document[nsObj].document[Bild].src = Quelle;
        } else {
            document['menue'].document[Bild].src = Quelle;
        }
    } else {
        document[Bild].src = Quelle;
    }
  }
}
function MenuStart(ID, Pos, Bild)
{
    MenuZu();
    MenuAuf(ID, Pos, Bild);
}
function MenuAuf(MenuID, pos, bild)
{
    if(Menu[MenuID].css.visibility == "hidden" || Menu[MenuID].css.visibility == "hide"){
        Menu[MenuID].css.visibility = "visible";
    }
    Quelle = Menu[MenuID].bild.src;
    /*if(Quelle.indexOf('_1') == -1){
        Menu[MenuID].bild.src = "images/navigation_festivals/"+bild;
        AktivesBild = Menu[MenuID].bild.name;
    }*/
    
    pos+=5;
    if(!NS4){
         Menu[MenuID].css.clip = "rect(0,auto,"+pos+",0)";
    } else {
         Menu[MenuID].css.clip.bottom = pos;
    }
    if(pos <=  Menu[MenuID].hoehe){
        Timeout = setTimeout('MenuAuf('+MenuID+','+pos+',"'+bild+'")', 20);
    }
    
}
function MenuZu()
{
    clearTimeout(Timeout);
    AktivesBild = "";
    for(n=0; n<MaxMenu; n++){
        //Menu[n].bild.src = Bild[n].src;
        Menu[n].css.visibility = "hidden";
    }
}
function createMenu(nr,element,bildname,nsObjekt)
{
    if(NS6 || IE6 || OP){
        this.css = document.getElementsByName(element)[nr].style;
        this.hoehe = document.getElementById(element).offsetHeight;
        this.bild = document[bildname];
    }
    if(IE5 || IE4){
        this.css = document.all[element].style;
        this.hoehe = document.all[element].offsetHeight;
        this.bild = document[bildname];
    }
    if(NS4){
        if(nsObjekt == ""){
            this.css = document[element];
            this.hoehe = document[element].document.height;
        } else {
            this.css = document[nsObjekt].document[element];
            this.hoehe = document[nsObjekt].document[element].document.height;
        }
        if(nsObjekt != ""){
            this.bild = document[nsObjekt].document[bildname]
        } else {
            this.bild = document[bildname];
        }
    }
}

//initialisierung des Menues:
var MaxMenu = 4;
var Bild = new Array();
function init()
{
    bilderladen('navigation_festival.gif',
                'navigation_location.gif',
                'navigation_infos.gif',
                'navigation_kontakt.gif');
    Menu[0] = new createMenu(0, 'festival','mfestival','menue');
    Menu[1] = new createMenu(0, 'location','mlocation','menue');
    Menu[2] = new createMenu(0, 'info','minfo','menue');
    //Menu[3] = new createMenu(0, 'tickets','mspecials','menue');
    //Menu[4] = new createMenu(0, 'kontakt','mkontakt','menue');
    Menu[3] = new createMenu(0, 'kontakt','mkontakt','menue');
}
function window_open(source,w,h)
{
    var l = (screen.width-w) / 2;
    var t = (screen.height-h) / 2;
    
    var win = open('bild_anzeige.asp?src='+source+'&hoehe='+h+'&breite='+w,'','width='+w+',height='+h+',top='+t+',left='+l+',scrollbars=0');
}
function checkEmail(checkString)
// --------------------------------------------------------------------
// COMPANY:       Netscape Communications
// AUTHOR:        Robert W. Husted
// DATE CREATED:  March 17, 1997
// MODIFIED BY: 
// DATE MODIFIED: 
// --------------------------------------------------------------------
{
    var newstr = "";
    var at = false;
    var dot = false;

    // DO SOME PRELIMINARY CHECKS ON THE DATA

    // IF EMAIL ADDRESS HAS A '@' CHARACTER
    if (checkString.indexOf("@") != -1) {
      at = true;

    // IF EMAIL ADDRESS HAS A '.' CHARACTER
    } else if (checkString.indexOf(".") != -1) {
      dot = true;
    }
    // PARSE REMAINDER OF STRING
    for (var i = 0; i < checkString.length; i++) {
        ch = checkString.substring(i, i + 1)
        if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
                || (ch == "@") || (ch == ".") || (ch == "_")
                || (ch == "-") || (ch >= "0" && ch <= "9")) {
                newstr += ch;
                if (ch == "@") {
                    at=true;
                }
                if (ch == ".") {
                    dot=true;
                }
        }
    }
    if ((at == true) && (dot == true)) {
        
      if(!checkEmail.arguments[1]){
          return newstr;
      } else {
          return true;
      }
    }
    else {
      // DISPLAY ERROR MESSAGE
      if(!checkEmail.arguments[1]){
      alert ("Bitte üeberprüfen Sie die Emailadresse.\n Dieses Format ist ungültig.");
      }
      checkString = ""
      if(!checkEmail.arguments[1]){
          return checkString;
      } else {
          return false;
      }
      
    }
}