//Thumbnails Fensterläden
var img = new Array();
for (t = 0; t < 35; t++)
 img[t] = new Image();

 img[0].src = "images/holz_thmbs/HJ_ret.jpg";
 img[1].src = "images/holz_thmbs/HJUE_ret.jpg";
 img[2].src = "images/holz_thmbs/HA-UEM_ret.jpg";
 img[3].src = "images/holz_thmbs/HA-UEO_ret.jpg";
 img[4].src = "images/holz_thmbs/HJUE-HA.jpg";
 img[5].src = "images/holz_thmbs/HJUE-KO.jpg";
 img[6].src = "images/holz_thmbs/HA-2K.jpg";
 img[7].src = "images/holz_thmbs/HA-3-Kas.jpg";
 img[8].src = "images/holz_thmbs/HJ-KO.jpg";
 img[9].src = "images/holz_thmbs/HJ-HA.jpg";
 img[10].src = "images/holz_thmbs/HA-JM.jpg";
 img[11].src = "images/holz_thmbs/HA-JO.jpg";
 img[12].src = "images/holz_thmbs/HR.jpg";
 img[13].src = "images/holz_thmbs/HJR.jpg";
 img[14].src = "images/holz_thmbs/HJ-SPU-1-F.jpg";
 img[15].src = "images/holz_thmbs/HJ-SPU-2-F.jpg";
 img[16].src = "images/holz_thmbs/HSP-JM.jpg";
 img[17].src = "images/holz_thmbs/HSP-2F-ret.jpg";
 img[18].src = "images/holz_thmbs/HSP-3-F.jpg";
 img[19].src = "images/holz_thmbs/Bretterladen.jpg";
 img[20].src = "images/holz_thmbs/HV.jpg";
 img[21].src = "images/holz_thmbs/HAV.jpg";
 img[22].src = "images/holz_thmbs/HJ-A.jpg";
 img[23].src = "images/holz_thmbs/HJUE-A.jpg";
 //Alu
 img[24].src = "images/alu_thumbs/aj.jpg";
 img[25].src = "images/alu_thumbs/aj_2.jpg";
 img[26].src = "images/alu_thumbs/ajue.jpg";
 img[27].src = "images/alu_thumbs/av.jpg";
 img[28].src = "images/alu_thumbs/ajb.jpg";
 img[29].src = "images/alu_thumbs/ab.jpg";
 img[30].src = "images/alu_thumbs/ajr.jpg";
 img[31].src = "images/alu_thumbs/ar.jpg";
 img[32].src = "images/alu_thumbs/aussteller.jpg";
 //Kunststoff
 img[33].src = "images/kunst_thumbs/KJ.jpg";
 img[34].src = "images/kunst_thumbs/KJ-R.jpg";
 img[35].src = "images/kunst_thumbs/KJ-A.jpg";
 img[36].src = "images/holz_thmbs/laden_blind.jpg";

// Auswahlmenü aktualisieren
function typ() {
    var MaterialAuswahl     = document.forms["angebot"].elements["material"];
    var TypusAuswahl        = document.forms["angebot"].elements["typus"];
    var OberflaecheAuswahl  = document.forms["angebot"].elements["oberflaeche"];
    TypusAuswahl.options.length = 0; // Liste leeren
    OberflaecheAuswahl.options.length = 0; // Liste leeren

    if (MaterialAuswahl.options[MaterialAuswahl.selectedIndex].value == "Kunststoff" ) {
        TypusAuswahl.options[0] = new Option("KJ", "33", false, false);
        TypusAuswahl.options[1] = new Option("KJR", "34", false, false);
        //TypusAuswahl.options[2] = new Option("KJ A", "35", false, false);

        //Oberflaeche
        OberflaecheAuswahl.options[0] = new Option("Standardfarben", "Standardfarben", false, false);
        OberflaecheAuswahl.options[1] = new Option("Dekorfarben", "Dekorfarben", false, false);
    }
    else if (MaterialAuswahl.options[MaterialAuswahl.selectedIndex].value == "Meranti" || MaterialAuswahl.options[MaterialAuswahl.selectedIndex].value == "Kiefer") {
        //Typus
        TypusAuswahl.options[0] = new Option("HJ", "0", false, false);
        TypusAuswahl.options[1] = new Option("HJ(UE)", "1", false, false);
        TypusAuswahl.options[2] = new Option("HA-(UE)M", "2", false, false);
        TypusAuswahl.options[3] = new Option("HA-(UE)O", "3", false, false);
        TypusAuswahl.options[4] = new Option("HJ(UE)-HA", "4", false, false);
        TypusAuswahl.options[5] = new Option("HJ(UE)-KO", "5", false, false);
        TypusAuswahl.options[6] = new Option("HA-2 Kass", "6", false, false);
        TypusAuswahl.options[7] = new Option("HA-3 Kass", "7", false, false);
        TypusAuswahl.options[8] = new Option("HJ-KO", "8", false, false);
        TypusAuswahl.options[9] = new Option("HJ-HA", "9", false, false);
        TypusAuswahl.options[10] = new Option("HA-JM", "10", false, false);
        TypusAuswahl.options[11] = new Option("HA-JO", "11", false, false);
        TypusAuswahl.options[12] = new Option("HR", "12", false, false);
        TypusAuswahl.options[13] = new Option("HJR", "13", false, false);
        TypusAuswahl.options[14] = new Option("HJ-SPU 1", "14", false, false);
        TypusAuswahl.options[15] = new Option("HJ-SPU 2", "15", false, false);
        TypusAuswahl.options[16] = new Option("HSP-JM", "16", false, false);
        TypusAuswahl.options[17] = new Option("HSP 2", "17", false, false);
        TypusAuswahl.options[18] = new Option("HSP 3", "18", false, false);
        TypusAuswahl.options[19] = new Option("Bretterladen", "19", false, false);
        TypusAuswahl.options[20] = new Option("HV", "20", false, false);
        TypusAuswahl.options[21] = new Option("HAV", "21", false, false);
           //TypusAuswahl.options[22] = new Option("HJA", "22", false, false);
          //TypusAuswahl.options[23] = new Option("HJ(UE)-A", "23", false, false);
        //Oberflaeche
        OberflaecheAuswahl.options[0] = new Option("Vakuum impr.", "Vakuum impr.", false, false);
        OberflaecheAuswahl.options[1] = new Option("RAL-Farben", "RAL-Farben", false, false);
    }
    else if (MaterialAuswahl.options[MaterialAuswahl.selectedIndex].value == "Aluminium") {
        //Typus
        TypusAuswahl.options[0] = new Option("AJ 38", "24", false, false);
        TypusAuswahl.options[1] = new Option("AJ 50", "25", false, false);
        TypusAuswahl.options[2] = new Option("AJUE", "26", false, false);
        TypusAuswahl.options[3] = new Option("AV", "27", false, false);
        TypusAuswahl.options[4] = new Option("AJB", "28", false, false);
        TypusAuswahl.options[5] = new Option("AB", "29", false, false);
        TypusAuswahl.options[6] = new Option("AJR", "30", false, false);
        TypusAuswahl.options[7] = new Option("AR", "31", false, false);
        //TypusAuswahl.options[1] = new Option("Aussteller", "33", false, false);
        //Oberflaeche
          //OberflaecheAuswahl.options[0] = new Option("Seidenglanz", "Seidenglanz", false, false);
         //OberflaecheAuswahl.options[1] = new Option("Vakuum impr.", "Vakuum impr.", false, false);
        OberflaecheAuswahl.options[0] = new Option("RAL Farben", "RAL Farben", false, false);
    }
}

// Thumbnail anzeigen
function thumb() {
    // Variablen deklarieren
    var TypusAuswahl    = document.forms["angebot"].elements["typus"];
    var BildNummer      = "33";

    // Ausgewähltes Element ermitteln
    if (TypusAuswahl.value ) { BildNummer = TypusAuswahl.value; }

    // Entsprechendes Bild anzeigen 
    document.getElementById("Fensterladen").src = img[BildNummer].src;
}


//Flügelamzahl checken
function fluegelcheck(feld) {
    var fa = "0";
    var nummer = "fenster"+feld+"b";
    var naechstes = "fenster"+feld+"h";
    var wing = "fluegel"+feld;
    var weite = document.forms[0].elements[nummer].value;
        
    if(weite == 0){
        fa="0";
    }else if(weite <= 60 ){
        fa="1";    
    }else if(weite <= 130){
        fa="2";
    }else if(weite <= 180){
        fa="3";
    }else{
        fa="4";
    }
    document.forms[0].elements[wing].value = fa;
    document.forms[0].elements[naechstes].focus();
    anzahl(feld);
}

//Warnung Flügel
function fluegelwarnung(feld1){
    alert("Die Anzahl wird automatisch ermittelt!\nBitte geben Sie hier nichts ein!");
    fluegelcheck(feld1);
}

//überprüfen, ob alles ausgefüllt wurde
function anzahl(feld2){
    var fensternummer = "fenster"+feld2;
    var naechstes = "fenster"+feld2+"h";
    var fensterwert = document.forms[0].elements[fensternummer].value;
    if(fensterwert == "0"){
    alert("Bitte geben Sie noch die Anzahl der Fenster an!");
    document.forms[0].elements[fensternummer].focus();
    }
}

//Klappladen oder Fensterladen
function checkladenart(wert){
    if(wert == 0 && (document.forms[0].ladenart[1].checked == true)) {
    document.forms["angebot"].kloben[1].checked = true;
    }
    if(wert == 2 && (document.forms[0].ladenart[1].checked == true)) {
    alert("An einem Schiebladen werden spezielle\nHalterungen notwendig!");
    document.forms["angebot"].kloben[1].checked = true;
    }
}