﻿$(document).ready(function() {
    var CurrentSection = "Home";

    $(".Content").jScrollPane();

    $(".FAQ").hide();
    $(".TermsOfUse").hide();

    $(".FAQButton").click(function() {
        GoToFAQ();
        CurrentSection = "FAQ";
        return false;
    });

    $(".BackFromFAQ").click(function() {
        GoToHomeFromFAQ();
        CurrentSection = "Home";
        return false;
    });

    $(".BackFromTermsOfUse").click(function() {
        GoToHomeFromTermsOfUse();
        CurrentSection = "Home";
        return false;
    });

    $(".LinkTermsOfUse").click(function() {
        if (CurrentSection == "Home") {
            GoToTermsOfUseFromHome();
        }
        else if (CurrentSection == "FAQ") {
            GoToTermsOfUseFromFAQ();
        }
        CurrentSection = "TermsOfUse";
        return false;
    });
    /*
    $(".LogoFAQ").click(function() {
    GoToHome();
    return false;
    });

    $(".LogoHome").click(function() {
    return false;
    });
    */
});

function GoToHomeFromFAQ() {
    $(".Footer").fadeOut();
    //$(".LogoFAQ").hide();
    //$(".LogoHome").show();
    $(".FAQButton").show();
    $(".jScrollPaneContainer").fadeOut();
    $(".BackFromFAQ").hide("drop", { direction: "up" }, function() {
        $(".FAQ").hide("drop", { direction: "up" });
        $(".Home").show("drop", { direction: "up" }, function() {
            $(".Footer").fadeIn();
        });
    });
}

function GoToHomeFromTermsOfUse() {
    $(".Footer").fadeOut();
    $(".FAQButton").show();
    $(".jScrollPaneContainer").fadeOut();
    $(".BackFromTermsOfUse").hide("drop", { direction: "up" }, function() {
        $(".TermsOfUse").hide("drop", { direction: "up" });
        $(".Home").show("drop", { direction: "up" }, function() {
            $(".Footer").fadeIn();
        });
    });
}

function GoToFAQ() {
    $(".Footer").fadeOut();
    //$(".LogoHome").hide();
    //$(".LogoFAQ").show();
    $(".BackFromFAQ").show("drop");
    $(".jScrollPaneContainer").fadeIn();
    $(".FAQButton").hide("explode", function() {
        $(".Home").hide("drop", { direction: "up" });
        $(".FAQ").show("drop", { direction: "up" }, function() {
            $(".Footer").fadeIn();
        });
    });
}

function GoToTermsOfUseFromHome() {
    $(".Footer").fadeOut();
    $(".BackFromTermsOfUse").show("drop");
    $(".jScrollPaneContainer").fadeIn();
    $(".FAQButton").hide("slide", 1, function() {
        $(".Home").hide("drop", { direction: "up" });
        $(".TermsOfUse").show("drop", { direction: "up" }, function() {
            $(".Footer").fadeIn();
        });
    });
}

function GoToTermsOfUseFromFAQ() {
    $(".Footer").fadeOut();
    $(".BackFromTermsOfUse").show("drop");
    $(".jScrollPaneContainer").fadeOut();
    $(".BackFromFAQ").hide("drop", { direction: "up" }, function() {
        $(".FAQ").hide("drop", { direction: "up" });
        $(".TermsOfUse").show("drop", { direction: "up" }, function() {
            $(".Footer").fadeIn();
            $(".jScrollPaneContainer").fadeIn();
        });
    });
}
