﻿function popup_disclaimer() {
    url = 'Trainer/Disclaimer.aspx';
    window.open(url, 'nachrichten', 'width=700,height=300,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no');
}

function ShowSub(prefix, menu) {
    switch (menu.toLowerCase()) {
        case 'profession':
            var professionList = $get(prefix + "List_Profession");
            if (professionList != null) {
                var yearsArea = $get(prefix + "Area_YearsInPractice");
                var projectCodeArea = $get(prefix + "Area_ProjectCode");
                var otherProfessionArea = $get(prefix + "Area_OtherProfession");
                var teacherInfoArea = $get(prefix + "Area_TeacherInfo");
                teacherInfoArea.style.display = "none";
                switch (professionList.selectedIndex) {
                    case 0: // none
                        yearsArea.style.display = "none";
                        projectCodeArea.style.display = "none";
                        otherProfessionArea.style.display = "none";
                        break;
                    case 2: // "student"
                    case 5: // "hygiene student"
                        yearsArea.style.display = "none";
                        projectCodeArea.style.display = "";
                        otherProfessionArea.style.display = "none";
                        teacherInfoArea.style.display = "";
                        break;
                    case 7: // "other"
                        yearsArea.style.display = "none";
                        projectCodeArea.style.display = "none";
                        otherProfessionArea.style.display = "";
                        break;
                    default: // other entry
                        yearsArea.style.display = "";
                        projectCodeArea.style.display = "none";
                        otherProfessionArea.style.display = "none";
                }
            }
            break;
        case 'ethnicity' : 
            var ethnicityList = $get(prefix + "List_Ethnicity");
            if (ethnicityList != null) {
                var otherEthnicityArea = $get(prefix + "Area_OtherEthnicity");

                switch (ethnicityList.selectedIndex) {
                    case 5: // "other"
                        otherEthnicityArea.style.display = "";
                        break;
                    default: // other entry
                        otherEthnicityArea.style.display = "none";
                }
            }
            break;
    }
}

function keyPress(evt) {
    var previousButton = 'ctl11$TTWizard$StepNavigationTemplateContainerID$StepPreviousButton';
    var nextButton = 'ctl11$TTWizard$StepNavigationTemplateContainerID$StepNextButton';
    var finishButton = 'ctl11$TTWizard$FinishNavigationTemplateContainerID$FinishButton';
    var startNextButton = 'ctl11$TTWizard$StartNavigationTemplateContainerID$StartNextButton';
    var wizardCtl = 'ctl11_TTWizard';

    if (window.event) // for IE
        var keynum = window.event.keyCode;
    else if (evt.which)
        var keynum = evt.which;

    if (keynum != null && $get(wizardCtl)) {
        switch (keynum) {
            // Page Up  
            case 33: if ($get(previousButton.replace(/\$/g, "_"))) // convert $ to _
                    __doPostBack(previousButton, ''); return true;
            // Page Down
            case 34:
                if ($get(nextButton.replace(/\$/g, "_")) && $get(nextButton.replace(/\$/g, "_")).onclick != null) {
                    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(nextButton, "", true, "", "", false, false));
                    __doPostBack(nextButton, '');
                }
                else if ($get(startNextButton.replace(/\$/g, "_")) && $get(startNextButton.replace(/\$/g, "_")).onclick != null) {
                    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(startNextButton, "", true, "", "", false, false));
                    __doPostBack(startNextButton, '');
                }
                else if ($get(finishButton.replace(/\$/g, "_")) && $get(nextButton.replace(/\$/g, "_")).onclick != null)
                    __doPostBack(finishButton, '');

                return true;
        }
    }
}
// Firefox / IE
if (document.attachEvent)
    document.attachEvent("onkeydown", keyPress);
else if (document.addEventListener)
    document.addEventListener("keydown", keyPress, false);