function checkStep(myStep) { // sets results, preview and shows element itself switch (myStep) { case "WM1": unsetStep('Adressen'); // check selections of WM1: setSelection and check count only, there are no dependencies in WM1 WM1 = document.getElementById('Wahlmodul1'); var Modulename; maxCount = ChoicesWM1; count = 0; Wahlmodul1 = new Array(maxCount); for (var i = 0; i < WM1.length; i++) { if (WM1[i].selected) { ModuleID = WM1[i].value; Modulename = WM1[i].text; // set status if (count <= maxCount) { // save Selection in arr Wahlmodul1 Wahlmodul1[count] = Modulename; myinfo = document.getElementById('pv_wahlmodul1'); // join add too many html breaks //myinfo.innerHTML = Wahlmodul1.join("
"); info = ""; for (j in Wahlmodul1) { if (info != "") info += "
"; info += Wahlmodul1[j]; } // end for (i in arrFR) { myinfo.innerHTML = info; count ++; } } // end if (WM1[i].selected) { } // end for (var i = 0; i < WM1.length; i++) { // remove this Modulename from WM3 if (Modulename) { unlinkelements('Wahlmodul3'); MySelect = document.getElementById('Wahlmodul3'); for (var key in arrWM1) { if (Modulename != arrWM1[key]["Name"]) { selected = false; if (IDWM3 > 0 && key == IDWM3) selected = true; myitem = new Option(arrWM1[key]["Name"],key,false,selected); MySelect.options[MySelect.length] = myitem; } } // end for (key in arrWM1) { // set hint myinfo = document.getElementById('Hint'); myinfo.innerHTML = "Bitte wählen Sie jetzt die Zusatzqualifikation aus"; } // check for unique modules if (Wahlmodul1[0] != "" && Wahlmodul3[0] != "" && Wahlmodul1[0] == Wahlmodul3[0]) { alert("Bitte wählen Sie zwei unterschiedliche Module für Spezialisierung und Zusatzqualifikation aus."); } if (count == maxCount) { showStep('WM3'); } else { if (count > maxCount) alert("Bitte wählen Sie maximal " + maxCount + " Modul(e) aus."); unsetStep('WM3'); } break; case "WM3": unsetStep('Adressen'); // check selections of WM3 WM3 = document.getElementById('Wahlmodul3'); maxCount = ChoicesWM3; count = 0; Wahlmodul3 = new Array(maxCount); for (var i = 0; i < WM3.length; i++) { if (WM3[i].selected) { ModuleID = WM3[i].value; Modulename = WM3[i].text; // set status if (count <= maxCount) { // save Selection in arr Wahlmodul1 Wahlmodul3[ModuleID] = Modulename; myinfo = document.getElementById('pv_wahlmodul3'); info = ""; for (j in Wahlmodul3) { if (info != "") info += "
"; info += Wahlmodul3[j]; } // end for (i in arrFR) { myinfo.innerHTML = info; count ++; } } // end if (WM3[i].selected) { } // end for (var i = 0; i < WM3.length; i++) { // check for unique modules if (Wahlmodul1[0] != "" && Wahlmodul3[0] != "" && Wahlmodul1[0] == Wahlmodul3[0]) { alert("Bitte wählen Sie zwei unterschiedliche Module für Spezialisierung und Zusatzqualifikation aus."); } if (count == maxCount) { showStep('WM2'); } else { if (count > maxCount) alert("Bitte wählen Sie maximal " + maxCount + " Modul(e) aus."); unsetStep('WM2'); } break; case "WM2": unsetStep('Adressen'); // check selection of WM2: get values, count and check dependecies WM2 = document.getElementById('Wahlmodul2'); maxCount = ChoicesWM2; count = 0; validModule = false; Wahlmodul2 = new Array(maxCount); for (var i = 0; i < WM2.length; i++) { if (WM2[i].selected) { // get Module ID and name to check dependecies ModuleID = WM2.options[i].value; Modulename = WM2.options[i].text; // check if there are any dependecies for this module validModule = true; // set results if selection is valid or print warning if (validModule && count <= maxCount) { // save Selection in arr Wahlmodul1 Wahlmodul2[count] = Modulename; myinfo = document.getElementById('pv_wahlmodul2'); // join add too many html breaks //myinfo.innerHTML = Wahlmodul2.join("
"); info = ""; for (j in Wahlmodul2) { if (info != "") info += "
"; info += Wahlmodul2[j]; } // end for (i in arrFR) { myinfo.innerHTML = info; count ++; } else if (!validModule) { WM2[i].selected = false; warnmsg = "Um das Modul \"" + Modulename + "\" wählen zu können müssen Sie \"" + arrWM2[ModuleID]["Dependecies"] + "\" ausgewählt haben."; alert(warnmsg) } // end if (validSelection) } // end if (element[i].selected) { } // end for (var i = 0; i < element.length; i++) { // set hint myinfo = document.getElementById('Hint'); myinfo.innerHTML = "Bitte wählen Sie " + maxCount + " Modul(e) aus"; if (count == maxCount) { showStep('Adressen'); } else { if (count > maxCount) alert("Bitte wählen Sie maximal " + maxCount + " Modul(e) aus."); } break; case "Adressen": // set hint myinfo = document.getElementById('Hint'); myinfo.innerHTML = "Bitte geben Sie jetzt die Adressen ein"; break; } // end switch (Step) { } function unsetStep(myStep) { // unsets results, preview and hides element itself switch (myStep) { case "WM1": // delete results Wahlmodul1 = new Array(); Wahlmodul2 = new Array(); // hide elements, 3 in this case myelement = document.getElementById('Wahlmodule'); setOpacity(myelement,5); myelement = document.getElementById('Wahlmodule1'); setOpacity(myelement,5); // remove status myinfo = document.getElementById('pv_wahlmodul1'); myinfo.innerHTML = "-"; break; case "WM2": // delete results Wahlmodul2 = new Array(); // hide element myelement = document.getElementById('Wahlmodule2'); setOpacity(myelement,5); // remove status myinfo = document.getElementById('pv_wahlmodul2'); myinfo.innerHTML = "-"; break; case "Adressen": // hide element myelement = document.getElementById('Adressen'); setOpacity(myelement,5); break; } // end switch (Step) { } function showStep(myStep) { // unsets results, preview and hides element itself switch (myStep) { case "WM1": maxCount = ChoicesWM1; // prepare next step total = 21; if (total == maxCount) checkStep('WM1'); break; case "WM3": maxCount = ChoicesWM3; // prepare next step total = 21; if (total == maxCount) checkStep('WM3'); break; case "WM2": maxCount = ChoicesWM2; myelement = document.getElementById('Wahlmodule2'); setOpacity(myelement,9); // prepare next step total = 21; if (total == maxCount) checkStep('WM2'); // set hint myinfo = document.getElementById('Hint'); myinfo.innerHTML = "Bitte wählen Sie W1-Qualifikationen aus"; break; case "Adressen": myelement = document.getElementById('Adressen'); setOpacity(myelement,9); myelement = document.getElementById('Azubi'); setOpacity(myelement,9); myelement = document.getElementById('Ausbildungsbetrieb'); setOpacity(myelement,9); // set hint myinfo = document.getElementById('Hint'); myinfo.innerHTML = "Bitte geben Sie jetzt die Adressen ein"; break; } // end switch (Step) { }