﻿$(document).ready(function() {

    $("#Question1Div").hide();
    $("#Question2Div").hide();
    $("#Question3Div").hide();
    $("#Question4Div").hide();
    $("#Question5Div").hide();

    if ($("[id$=_Results1Hidden]").val() == '1') {
        $("#IntroductionDiv").hide();
        $("#Question1Div").show();
        $("#Question2Div").hide();
        $("#Question3Div").hide();
        $("#Question4Div").hide();
        $("#Question5Div").hide();
        $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/selected_step1_btn.jpg");
        $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
        $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
        $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
        $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
    } else if ($("[id$=_Results1Hidden]").val() == "2") {
        $("#IntroductionDiv").hide();
        $("#Question1Div").hide();
        $("#Question2Div").show();
        $("#Question3Div").hide();
        $("#Question4Div").hide();
        $("#Question5Div").hide();
        $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
        $("#Question2Button").attr("src", "../Images/selected_step2_btn.jpg");
        $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
        $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
        $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
    } else if ($("[id$=_Results1Hidden]").val() == "3") {
        $("#IntroductionDiv").hide();
        $("#Question1Div").hide();
        $("#Question2Div").hide();
        $("#Question3Div").show();
        $("#Question4Div").hide();
        $("#Question5Div").hide();
        $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
        $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
        $("#Question3Button").attr("src", "../Images/selected_step3_btn.jpg");
        $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
        $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
    } else if ($("[id$=_Results1Hidden]").val() == "4") {
        $("#IntroductionDiv").hide();
        $("#Question1Div").hide();
        $("#Question2Div").hide();
        $("#Question3Div").hide();
        $("#Question4Div").show();
        $("#Question5Div").hide();
        $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
        $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
        $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
        $("#Question4Button").attr("src", "../Images/selected_step4_btn.jpg");
        $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
    } else if ($("[id$=_Results1Hidden]").val() == "5") {
        $("#IntroductionDiv").hide();
        $("#Question1Div").hide();
        $("#Question2Div").hide();
        $("#Question3Div").hide();
        $("#Question4Div").hide();
        $("#Question5Div").show();
        $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
        $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
        $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
        $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
        $("#Question5Button").attr("src", "../Images/selected_step5_btn.jpg");
    } else if ($("[id$=_Results1Hidden]").val() == "intro") {
        $("#IntroductionDiv").show();
        $("#Question1Div").hide();
        $("#Question2Div").hide();
        $("#Question3Div").hide();
        $("#Question4Div").hide();
        $("#Question5Div").hide();
        $("#IntroductionButton").attr("src", "../Images/selected_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
        $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
        $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
        $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
        $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
    } else if ($("[id$=_Results1Hidden]").val() == "how") {
        $("#IntroductionDiv").show();
        $("#Question1Div").hide();
        $("#Question2Div").hide();
        $("#Question3Div").hide();
        $("#Question4Div").hide();
        $("#Question5Div").hide();
        $("#IntroductionButton").attr("src", "../Images/selected_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
        $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
        $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
        $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
        $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");

        $("#dialog").dialog(
            {
                height: 430,
                width: 625,
                modal: false,
                position: 'center',
                autoOpen: false,
                title: 'How it works',
                closeOnEscape: true,
                resizable: false,
                draggable: false,
                close: closeDialog()
            }
        ).dialog('open').show();
        $("#dialog").focus();
        function closeDialog() {
            $('#dialog').dialog('close');
        }

    }


    $("#IntroductionButton").click(function() {
        $("#IntroductionButton").attr("src", "../Images/selected_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
        if ($("[id$=_Question2Hidden]").val() == 'true') {
            $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
        } else {
            $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
        }
        if ($("[id$=_Question3Hidden]").val() == 'true') {
            $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
        } else {
            $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
        }
        if ($("[id$=_Question4Hidden]").val() == 'true') {
            $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
        } else {
            $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
        }
        if ($("[id$=_Question5Hidden]").val() == 'true') {
            $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
        } else {
            $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
        }
        $("#IntroductionDiv").show();
        $("#Question1Div").hide();
        $("#Question2Div").hide();
        $("#Question3Div").hide();
        $("#Question4Div").hide();
        $("#Question5Div").hide();
        $("#ResultsDiv").hide();
    })

    $("#HowWorksButton").click(function() {
        $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/selected_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
        if ($("[id$=_Question2Hidden]").val() == 'true') {
            $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
        } else {
            $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
        }
        if ($("[id$=_Question3Hidden]").val() == 'true') {
            $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
        } else {
            $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
        }
        if ($("[id$=_Question4Hidden]").val() == 'true') {
            $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
        } else {
            $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
        }
        if ($("[id$=_Question5Hidden]").val() == 'true') {
            $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
        } else {
            $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
        }
        $("#IntroductionDiv").show();
        $("#Question1Div").hide();
        $("#Question2Div").hide();
        $("#Question3Div").hide();
        $("#Question4Div").hide();
        $("#Question5Div").hide();
        $("#ResultsDiv").hide();

        $("#dialog").dialog(
            {
                height: 430,
                width: 625,
                modal: false,
                position: 'center',
                autoOpen: false,
                title: 'How it works',
                closeOnEscape: true,
                resizable: false,
                draggable: false,
                close: closeDialog()
            }
        ).dialog('open').show();
        $("#dialog").focus();
        function closeDialog() {
            $('#dialog').dialog('close');
        }

    })

    $('#dialog').blur(function() {
        $('#dialog').dialog('close');
    });

    $("#GetStartedButton").click(function() {
        $("[id$=_Question1Hidden]").val('true');
        $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/selected_step1_btn.jpg");
        if ($("[id$=_Question2Hidden]").val() == 'true') {
            $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
        } else {
            $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
        }
        if ($("[id$=_Question3Hidden]").val() == 'true') {
            $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
        } else {
            $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
        }
        if ($("[id$=_Question4Hidden]").val() == 'true') {
            $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
        } else {
            $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
        }
        if ($("[id$=_Question5Hidden]").val() == 'true') {
            $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
        } else {
            $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
        }
        $("#IntroductionDiv").hide();
        $("#Question1Div").show();
        $("#Question2Div").hide();
        $("#Question3Div").hide();
        $("#Question4Div").hide();
        $("#Question5Div").hide();
        $("#ResultsDiv").hide();
    })

    $("#HowLink").click(function() {
        $("[id$=_Question1Hidden]").val('true');
        $('#dialog').dialog('close');
        $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/selected_step1_btn.jpg");
        if ($("[id$=_Question2Hidden]").val() == 'true') {
            $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
        } else {
            $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
        }
        if ($("[id$=_Question3Hidden]").val() == 'true') {
            $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
        } else {
            $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
        }
        if ($("[id$=_Question4Hidden]").val() == 'true') {
            $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
        } else {
            $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
        }
        if ($("[id$=_Question5Hidden]").val() == 'true') {
            $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
        } else {
            $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
        }
        $("#IntroductionDiv").hide();
        $("#Question1Div").show();
        $("#Question2Div").hide();
        $("#Question3Div").hide();
        $("#Question4Div").hide();
        $("#Question5Div").hide();
        $("#ResultsDiv").hide();
    })

    $("#Question1Button").click(function() {
        $("[id$=_Question1Hidden]").val('true');
        $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/selected_step1_btn.jpg");
        if ($("[id$=_Question2Hidden]").val() == 'true') {
            $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
        } else {
            $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
        }
        if ($("[id$=_Question3Hidden]").val() == 'true') {
            $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
        } else {
            $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
        }
        if ($("[id$=_Question4Hidden]").val() == 'true') {
            $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
        } else {
            $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
        }
        if ($("[id$=_Question5Hidden]").val() == 'true') {
            $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
        } else {
            $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
        }
        $("#IntroductionDiv").hide();
        $("#Question1Div").show();
        $("#Question2Div").hide();
        $("#Question3Div").hide();
        $("#Question4Div").hide();
        $("#Question5Div").hide();
        $("#ResultsDiv").hide();
    })

    $("[id$=_Question1ResultsButton]").click(function() {
        $("[id$=_Results1Hidden]").val('1');
        $("#IntroductionDiv").hide();
        $("#Question1Div").show();
        $("#Question2Div").hide();
        $("#Question3Div").hide();
        $("#Question4Div").hide();
        $("#Question5Div").hide();
        $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
        $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
        $("#Question1Button").attr("src", "../Images/selected_step1_btn.jpg");
        $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
        $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
        $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
        $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");


    })

    $("#Question1NextButton").click(function() {
        if ($("[id$=_Question1Hidden]").val() == 'true') {
            $("[id$=_Question2Hidden]").val('true');
            $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
            $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
            $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");

            if ($("[id$=_Question2Hidden]").val() == 'true') {
                $("#Question2Button").attr("src", "../Images/selected_step2_btn.jpg");
            } else {
                $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
            }
            if ($("[id$=_Question3Hidden]").val() == 'true') {
                $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
            } else {
                $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
            }
            if ($("[id$=_Question4Hidden]").val() == 'true') {
                $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
            } else {
                $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
            }
            if ($("[id$=_Question5Hidden]").val() == 'true') {
                $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
            } else {
                $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
            }
            $("#IntroductionDiv").hide();
            $("#Question1Div").hide();
            $("#Question2Div").show();
            $("#Question3Div").hide();
            $("#Question4Div").hide();
            $("#Question5Div").hide();
            $("#ResultsDiv").hide();
        } else {
            alert('You must first answer question 1');
        }
    })

    $("#Question2Button").click(function() {
        if ($("[id$=_Question1Hidden]").val() == 'true') {
            $("[id$=_Question2Hidden]").val('true');
            $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
            $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
            $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");

            if ($("[id$=_Question2Hidden]").val() == 'true') {
                $("#Question2Button").attr("src", "../Images/selected_step2_btn.jpg");
            } else {
                $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
            }
            if ($("[id$=_Question3Hidden]").val() == 'true') {
                $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
            } else {
                $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
            }
            if ($("[id$=_Question4Hidden]").val() == 'true') {
                $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
            } else {
                $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
            }
            if ($("[id$=_Question5Hidden]").val() == 'true') {
                $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
            } else {
                $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
            }
            $("#IntroductionDiv").hide();
            $("#Question1Div").hide();
            $("#Question2Div").show();
            $("#Question3Div").hide();
            $("#Question4Div").hide();
            $("#Question5Div").hide();
            $("#ResultsDiv").hide();
        } else {
            alert('You must first answer question 1');
        }
    })

    $("#Question2NextButton").click(function() {
        if ($("[id$=_Question2Hidden]").val() == 'true') {
            $("[id$=_Question3Hidden]").val('true');
            $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
            $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
            if ($("[id$=_Question1Hidden]").val() == 'true') {
                $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
            } else {
                $("#Question1Button").attr("src", "../Images/inactive_step1_btn.jpg");
            }
            if ($("[id$=_Question2Hidden]").val() == 'true') {
                $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
            } else {
                $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
            }
            if ($("[id$=_Question3Hidden]").val() == 'true') {
                $("#Question3Button").attr("src", "../Images/selected_step3_btn.jpg");
            } else {
                $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
            }
            if ($("[id$=_Question4Hidden]").val() == 'true') {
                $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
            } else {
                $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
            }
            if ($("[id$=_Question5Hidden]").val() == 'true') {
                $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
            } else {
                $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
            }
            $("#IntroductionDiv").hide();
            $("#Question1Div").hide();
            $("#Question2Div").hide();
            $("#Question3Div").show();
            $("#Question4Div").hide();
            $("#Question5Div").hide();
            $("#ResultsDiv").hide();
        } else {
            alert('You must first answer question 2');
        }
    })

    $("#Question3Button").click(function() {
        if ($("[id$=_Question2Hidden]").val() == 'true') {
            $("[id$=_Question3Hidden]").val('true');
            $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
            $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
            if ($("[id$=_Question1Hidden]").val() == 'true') {
                $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
            } else {
                $("#Question1Button").attr("src", "../Images/inactive_step1_btn.jpg");
            }
            if ($("[id$=_Question2Hidden]").val() == 'true') {
                $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
            } else {
                $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
            }
            if ($("[id$=_Question3Hidden]").val() == 'true') {
                $("#Question3Button").attr("src", "../Images/selected_step3_btn.jpg");
            } else {
                $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
            }
            if ($("[id$=_Question4Hidden]").val() == 'true') {
                $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
            } else {
                $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
            }
            if ($("[id$=_Question5Hidden]").val() == 'true') {
                $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
            } else {
                $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
            }
            $("#IntroductionDiv").hide();
            $("#Question1Div").hide();
            $("#Question2Div").hide();
            $("#Question3Div").show();
            $("#Question4Div").hide();
            $("#Question5Div").hide();
            $("#ResultsDiv").hide();
        } else {
            alert('You must first answer question 2');
        }
    })

    $("#Question3NextButton").click(function() {
        if ($("[id$=_Question3Hidden]").val() == 'true') {
            $("[id$=_Question4Hidden]").val('true');
            $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
            $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
            if ($("[id$=_Question1Hidden]").val() == 'true') {
                $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
            } else {
                $("#Question1Button").attr("src", "../Images/inactive_step1_btn.jpg");
            }
            if ($("[id$=_Question2Hidden]").val() == 'true') {
                $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
            } else {
                $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
            }
            if ($("[id$=_Question3Hidden]").val() == 'true') {
                $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
            } else {
                $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
            }
            if ($("[id$=_Question4Hidden]").val() == 'true') {
                $("#Question4Button").attr("src", "../Images/selected_step4_btn.jpg");
            } else {
                $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
            }
            if ($("[id$=_Question5Hidden]").val() == 'true') {
                $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
            } else {
                $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
            }
            $("#IntroductionDiv").hide();
            $("#Question1Div").hide();
            $("#Question2Div").hide();
            $("#Question3Div").hide();
            $("#Question4Div").show();
            $("#Question5Div").hide();
            $("#ResultsDiv").hide();
        } else {
            alert('You must first answer question 3');
        }
    })

    $("#Question4Button").click(function() {
        if ($("[id$=_Question3Hidden]").val() == 'true') {
            $("[id$=_Question4Hidden]").val('true');
            $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
            $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
            if ($("[id$=_Question1Hidden]").val() == 'true') {
                $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
            } else {
                $("#Question1Button").attr("src", "../Images/inactive_step1_btn.jpg");
            }
            if ($("[id$=_Question2Hidden]").val() == 'true') {
                $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
            } else {
                $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
            }
            if ($("[id$=_Question3Hidden]").val() == 'true') {
                $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
            } else {
                $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
            }
            if ($("[id$=_Question4Hidden]").val() == 'true') {
                $("#Question4Button").attr("src", "../Images/selected_step4_btn.jpg");
            } else {
                $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
            }
            if ($("[id$=_Question5Hidden]").val() == 'true') {
                $("#Question5Button").attr("src", "../Images/active_step5_btn.jpg");
            } else {
                $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
            }
            $("#IntroductionDiv").hide();
            $("#Question1Div").hide();
            $("#Question2Div").hide();
            $("#Question3Div").hide();
            $("#Question4Div").show();
            $("#Question5Div").hide();
            $("#ResultsDiv").hide();
        } else {
            alert('You must first answer question 3');
        }
    })

    $("#Question4NextButton").click(function() {
        if ($("[id$=_Question4Hidden]").val() == 'true') {
            $("[id$=_Question5Hidden]").val('true');
            $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
            $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
            if ($("[id$=_Question1Hidden]").val() == 'true') {
                $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
            } else {
                $("#Question1Button").attr("src", "../Images/inactive_step1_btn.jpg");
            }
            if ($("[id$=_Question2Hidden]").val() == 'true') {
                $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
            } else {
                $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
            }
            if ($("[id$=_Question3Hidden]").val() == 'true') {
                $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
            } else {
                $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
            }
            if ($("[id$=_Question4Hidden]").val() == 'true') {
                $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
            } else {
                $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
            }
            if ($("[id$=_Question5Hidden]").val() == 'true') {
                $("#Question5Button").attr("src", "../Images/selected_step5_btn.jpg");
            } else {
                $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
            }
            $("#IntroductionDiv").hide();
            $("#Question1Div").hide();
            $("#Question2Div").hide();
            $("#Question3Div").hide();
            $("#Question4Div").hide();
            $("#Question5Div").show();
            $("#ResultsDiv").hide();
        } else {
            alert('You must first answer question 4');
        }
    })

    $("#Question5Button").click(function() {
        if ($("[id$=_Question4Hidden]").val() == 'true') {
            $("[id$=_Question5Hidden]").val('true');
            $("#IntroductionButton").attr("src", "../Images/active_intro_btn.jpg");
            $("#HowWorksButton").attr("src", "../Images/active_howitworks_btn.jpg");
            if ($("[id$=_Question1Hidden]").val() == 'true') {
                $("#Question1Button").attr("src", "../Images/active_step1_btn.jpg");
            } else {
                $("#Question1Button").attr("src", "../Images/inactive_step1_btn.jpg");
            }
            if ($("[id$=_Question2Hidden]").val() == 'true') {
                $("#Question2Button").attr("src", "../Images/active_step2_btn.jpg");
            } else {
                $("#Question2Button").attr("src", "../Images/inactive_step2_btn.jpg");
            }
            if ($("[id$=_Question3Hidden]").val() == 'true') {
                $("#Question3Button").attr("src", "../Images/active_step3_btn.jpg");
            } else {
                $("#Question3Button").attr("src", "../Images/inactive_step3_btn.jpg");
            }
            if ($("[id$=_Question4Hidden]").val() == 'true') {
                $("#Question4Button").attr("src", "../Images/active_step4_btn.jpg");
            } else {
                $("#Question4Button").attr("src", "../Images/inactive_step4_btn.jpg");
            }
            if ($("[id$=_Question5Hidden]").val() == 'true') {
                $("#Question5Button").attr("src", "../Images/selected_step5_btn.jpg");
            } else {
                $("#Question5Button").attr("src", "../Images/inactive_step5_btn.jpg");
            }
            $("#IntroductionDiv").hide();
            $("#Question1Div").hide();
            $("#Question2Div").hide();
            $("#Question3Div").hide();
            $("#Question4Div").hide();
            $("#Question5Div").show();
        } else {
            alert('You must first answer question 4');
        }
    })

    $("#PursuerFFGoButton").click(function() {
        $("#dialogOptin").dialog(
                {
                    height: 430,
                    width: 625,
                    modal: false,
                    position: 'center',
                    autoOpen: false,
                    title: 'How it works',
                    closeOnEscape: true,
                    resizable: false,
                    draggable: false,
                    close: closeDialog()
                }
            ).dialog('open').show();
        function closeDialog() {
            $('#dialog').dialog('close');
        }
    })    

//    $("[id$=_AnchoredGoButton]").click(function() {
//        $("[id$=_Anchored2Background]").show();
//        $("[id$=_Pursuer2Background]").hide();
//        $("[id$=_Adapter2Background]").hide();
//        $("[id$=_Venturer2Background]").hide();
//    })

//    $("#AnchoredFindOut").click(function() {
//        $("[id$=_Results1Div]").hide();
//        $("[id$=_Results2Div]").show();
//        $("[id$=_Anchored2Background]").show();
//        $("[id$=_Pursuer2Background]").hide();
//        $("[id$=_Adapter2Background]").hide();
//        $("[id$=_Venturer2Background]").hide();
//    })

//    $("#PursuerGoButton").click(function() {
//        $("[id$=_Results1Div]").hide();
//        $("[id$=_Results2Div]").show();
//        $("[id$=_Anchored2Background]").hide();
//        $("[id$=_Pursuer2Background]").show();
//        $("[id$=_Adapter2Background]").hide();
//        $("[id$=_Venturer2Background]").hide();
//    })

//    $("#PursuerFindOut").click(function() {
//        $("[id$=_Results1Div]").hide();
//        $("[id$=_Results2Div]").show();
//        $("[id$=_Anchored2Background]").hide();
//        $("[id$=_Pursuer2Background]").show();
//        $("[id$=_Adapter2Background]").hide();
//        $("[id$=_Venturer2Background]").hide();
//    })

//    $("#AdapterGoButton").click(function() {
//        $("[id$=_Results1Div]").hide();
//        $("[id$=_Results2Div]").show();
//        $("[id$=_Anchored2Background]").hide();
//        $("[id$=_Pursuer2Background]").hide();
//        $("[id$=_Adapter2Background]").show();
//        $("[id$=_Venturer2Background]").hide();
//    })

//    $("#AdapterFindOut").click(function() {
//        $("[id$=_Results1Div]").hide();
//        $("[id$=_Results2Div]").show();
//        $("[id$=_Anchored2Background]").hide();
//        $("[id$=_Pursuer2Background]").hide();
//        $("[id$=_Adapter2Background]").show();
//        $("[id$=_Venturer2Background]").hide();
//    })

//    $("#VenturerGoButton").click(function() {
//        $("[id$=_Results1Div]").hide();
//        $("[id$=_Results2Div]").show();
//        $("[id$=_Anchored2Background]").hide();
//        $("[id$=_Pursuer2Background]").hide();
//        $("[id$=_Adapter2Background]").hide();
//        $("[id$=_Venturer2Background]").show();
//    })

//    $("#VenturerFindOut").click(function() {
//        $("[id$=_Results1Div]").hide();
//        $("[id$=_Results2Div]").show();
//        $("[id$=_Anchored2Background]").hide();
//        $("[id$=_Pursuer2Background]").hide();
//        $("[id$=_Adapter2Background]").hide();
//        $("[id$=_Venturer2Background]").show();
//    })
});

function closeDialog() {
    $('#dialog').dialog('close');
}


