var WM3ID = "";
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');
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++) {
// set hint
if (count == maxCount) {
myinfo = document.getElementById('Hint');
myinfo.innerHTML = "Bitte wählen Sie die Zusatzqualifikation aus";
}
if (count == maxCount) {
showStep('WM3');
} else {
if (count > maxCount) alert("Bitte wählen Sie maximal " + maxCount + " Modul(e) aus.");
unsetStep('WM3');
unsetStep('WM2');
}
break;
case "WM3":
unsetStep('Adressen');
WM3 = document.getElementById('Wahlmodul3');
maxCount = ChoicesWM3;
count = 0;
Wahlmodul3 = new Array(maxCount);
var Modulename;
for (var i = 0; i < WM3.length; i++) {
if (WM3[i].selected) {
ModuleID = WM3[i].value;
Modulename = WM3[i].text;
WM3ID = WM3[i].value;
// set status
if (count <= maxCount) {
// save Selection in arr Wahlmodul1
Wahlmodul3[count] = Modulename;
myinfo = document.getElementById('pv_wahlmodul3');
// join add too many html breaks
//myinfo.innerHTML = Wahlmodul1.join("
");
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++) {
// remove this Modulename from WM2
if (Modulename != "") {
// wenn »Großformatiger Digitaldruck« gewählt wurde, dann ist »Datenvorbereitung Digitaldruck« als W1 Pflicht
WM2Hint = document.getElementById('hint-wahlmodule2');
//Wahlmodul2 = new Array();
if (WM3ID == 11) {
// get list from Wahlmodul2
WM2 = document.getElementById('Wahlmodul2');
// check if forced module is set, set if not
if (!Wahlmodul2[10]) {
Wahlmodul2[10] = arrWM2[10]["Name"];
myinfo = document.getElementById('pv_wahlmodul2');
myinfo.innerHTML = arrWM2[10]["Name"];
}
// now only module can be choosen because of forced module
WM2Hint.innerHTML = "Wählen Sie hier 1 Modul aus";;
// avoid multiple selections
WM2.multiple = false;
} else {
myinfo = document.getElementById('pv_wahlmodul2');
myinfo.innerHTML = "";
// remove forced module
if (Wahlmodul2[10]) Wahlmodul2.splice(10, 1);
// now two modules can be choosen
WM2Hint.innerHTML = "Mit STRING-Taste 2 Module wählen";
myinfo.innerHTML = "";
// allow multiple selections
WM2 = document.getElementById('Wahlmodul2');
WM2.multiple = true;
}
unlinkelements('Wahlmodul2');
MySelect = document.getElementById('Wahlmodul2');
for (var key in arrWM2) {
if (Modulename != arrWM2[key]["Name"]) {
if ((WM3ID == 11 && key != 10) || WM3ID != 11) {
selected = false;
if (Wahlmodul2[key]) selected = true;
myitem = new Option(arrWM2[key]["Name"],key,false,selected);
MySelect.options[MySelect.length] = myitem;
}
}
} // end for (key in arrWM2) {
}
if (count == maxCount) {
showStep('WM2');
} else {
if (count > maxCount) alert("Bitte wählen Sie maximal " + maxCount + " Modul(e) aus.");
unsetStep('WM2');
}
if (Modulename) showStep('WM2');
break;
case "WM2":
unsetStep('Adressen');
// check selection of WM2: get values, count and check dependecies
WM2 = document.getElementById('Wahlmodul2');
if (WM3ID == 11) maxCount = 1;
else maxCount = ChoicesWM2;
count = 0;
Wahlmodul2 = new Array();
if (WM3ID == 11) {
// set if forced module again
Wahlmodul2[10] = arrWM2[10]["Name"];
count = 1;
}
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;
// set results if selection is valid or print warning
if (count <= maxCount) {
// save Selection in arr Wahlmodul1
Wahlmodul2[ModuleID] = Modulename;
myinfo = document.getElementById('pv_wahlmodul2');
myinfo.innerHTML = "";
// join add too many html breaks
info = "";
for (j in Wahlmodul2) {
if (info != "") info += "
";
info += Wahlmodul2[j];
} // end for (i in Wahlmodul2) {
myinfo.innerHTML = info;
count ++ ;
}
} // 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 hier " + maxCount + " Modul(e) aus";
maxCount = ChoicesWM2;
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 "WM3":
// hide element
myelement = document.getElementById('Zusatzqualifikationen');
setOpacity(myelement,5);
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 = 11;
if (total == maxCount) checkStep('WM1');
break;
case "WM3":
// show element
myelement = document.getElementById('Zusatzqualifikationen');
setOpacity(myelement,9);
break;
case "WM2":
maxCount = ChoicesWM2;
myelement = document.getElementById('Wahlmodule2');
setOpacity(myelement,9);
// prepare next step
total = 11;
if (total == maxCount) checkStep('WM2');
// set hint
myinfo = document.getElementById('Hint');
myinfo.innerHTML = "Wählen Sie hier 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) {
}