// Achtung: es muss immer heissen <script></script> und nie <script      />

function init(page) {
    var applet=null;
    applet=document.getElementById("Applet1");

    if (applet!=null) {    // Stoppt und entfernt das bestehende Java-Applet
        applet.stop();
        applet.destroy();
    }
    var thisLink=document.getElementById(page) ;
    if (thisLink!=null){
        thisLink.setAttribute("className", "thisLink");
        thisLink.setAttribute("class", "thisLink");
    }
}
function endTag(s) {
        return("</"+s+">");
}

function markieren(id){
    var obj=document.getElementById(id) ;
    if (obj!=null){
        obj.setAttribute("className", "markieren");
        obj.setAttribute("class", "markieren");
    }

}
function noClass(id){
    var obj=document.getElementById(id) ;
    if (obj!=null){
        obj.setAttribute("className", "noClass");
        obj.setAttribute("class", "noClass");
    }

}
function destroyApplet(appletOkId){
    var applet=null;
    if (appletOkId!=null){
         applet=document.getElementById(appletOkId);
    }
    if (applet!=null) {
        applet.destroy();
    }
}

function setEmail() {
if (confirm ("Möchten Sie mir eine Email-Nachricht schreiben?")) {
    location.href = "mailto:liliane.hofer@itkiosk.ch";
   }
else { alert("andernfalls telefonieren Sie auf 076 414 38 06")
   }
}

function visibilityPrices(typ) {
    if (typ==0){
     document.getElementById("currency").setAttribute("class", "hide");
     document.getElementById("prices").setAttribute("class", "hide");
     document.getElementById("currency").setAttribute("className", "hide");
     document.getElementById("prices").setAttribute("className", "hide");
    } else {
     document.getElementById("currency").setAttribute("class", "x");
     document.getElementById("prices").setAttribute("class", "x");
     document.getElementById("currency").setAttribute("className", "x");
     document.getElementById("prices").setAttribute("className", "x");

    }
 }
 function visibilityTemplate(typ) {
    var obj1 = document.getElementById("maxCol");
    var obj2 = document.getElementById("publicTemplate");
    var obj3 = document.getElementById("privateTemplate");
    
    if (typ==0){
     if (obj1!=null) obj1.setAttribute("class", "x");
     if (obj1!=null) obj1.setAttribute("className", "x");
     if (obj2!=null) obj2.setAttribute("class", "hide");
     if (obj2!=null) obj2.setAttribute("className", "hide");
     if (obj3!=null) obj3.setAttribute("class", "hide");
     if (obj3!=null) obj3.setAttribute("className", "hide");
    
    } else {
     if (obj1!=null) obj1.setAttribute("class", "hide");
     if (obj1!=null) obj1.setAttribute("className", "hide");
     if (obj2!=null) obj2.setAttribute("class", "x");
     if (obj2!=null) obj2.setAttribute("className", "x");
     if (obj3!=null) obj3.setAttribute("class", "x");
     if (obj3!=null) obj3.setAttribute("className", "x");

    }
 }

function getAppletParameter() {
    var appletObject;
    appletObject=document.getElementById("Applet1");
    if (appletObject!=null) {
       var varSeats = appletObject.getSeatString(); // eine Methode im Applet!
    // seatString in hidden-Input ablegen
       var object1 = document.getElementById("seatString");
       object1.setAttribute("value", varSeats);
       appletObject.destroy();
    return true;
    }   else return false;
}

function setEmptyPlanNo(){
   var radioObj = document.getElementsByName("selectEmptyPlan") ;
   if (radioObj!=null)
       //alert("gefunden! "+radioObj[0].value);
       //alert("gefunden! "+radioObj[1].value);
       radioObj[0].checked=false;
       radioObj[1].checked=true;
    
}



// liest Selecion-Plan-Vorlage: falls eine Template-Hall gewählt wurde,
// werden planNameCity in die entspr. Formularfelder eingesetzt
function setPublicPlanName() {
    var planIdValue=document.getElementById("selectPublicPlan").value;
    var optionTag = document.getElementById("planId"+planIdValue);
    if (optionTag != null){
        document.getElementById("planNameCity").value=optionTag.text;
        document.getElementById("planRegion").value=optionTag.className;
    }
    
 }
 // liest Selecion-Plan-Vorlage: falls eine Template-Hall gewählt wurde,
// werden planNameCity in die entspr. Formularfelder eingesetzt
function setMyPlanName() {
    var planIdValue=document.getElementById("selectMyPlan").value;
    var optionTag = document.getElementById("planId"+planIdValue);
    if (optionTag != null){
        document.getElementById("planNameCity").value=optionTag.text;
       
    }

 }
var resCnt=0;
var maxRes=0;
function seatFlipFlop(id) {
    maxRes=document.getElementById("maxRes").innerHTML;
    //Test
    
    if (id<0) return;
    else try {
    var obj1 = document.getElementById("s"+id);     // das ist ein <a>-Feld
    var obj2 = document.getElementById("id"+id);    // das dazugehÃ¶rende <input>-Feld

    //maxRes erreicht? wenn nein, Feld markieren
    if (obj2.value=="0") {
        if (resCnt>=maxRes){
           alert("Achtung: Es sind nur "+maxRes+" Reservierungen erlaubt.")
           return;

        }
        obj2.setAttribute("value", id);
        obj2.setAttribute("name", "ok");
        obj1.style.background="#000";
        resCnt++;
    }
    //zurÃ¼cksetzen, <input>
    else {
       obj1.style.background="";
       obj2.setAttribute("value", "0");
       obj2.setAttribute("name", "xx");
       resCnt--;
    }
    ///alert("ZÃ¤hler: "+cnt+"  Value:"+obj2.value);

    } catch (ex){
        alert("Es ist ein gravierender Java-Script-Fehler passiert"+ex.toString());
    }
}

-->

