
$(document).ready(function() {
    $(".homeCenterboxDescription").hide();
    $('.homeCenterbox').cycle({
        fx:     'scrollLeft',
        speed:   300,
        timeout: 5000,
        pager:   '.homeCenterboxNav',
        pause:   1,
        before:  onBefore
    });

    $(".checkerSubmit").click(function() {
        document.teststatus.submit();
    });
    $(".locatorSubmit").click(function() {
        document.locator.submit();
    });

});

function onBefore() {
    $(".homeCenterboxDescription").hide();
    var html_id = $(this).attr("id");

    // Make sure it's not hidden
    if( $("#cntrBx" + html_id).attr("title") != "hide" ) {
        // Load the text
        var title = $("#cntrBx" + html_id + " .cntrBxTitle").html();
        var description = $("#cntrBx" + html_id + " .cntrBxDesc").html();
        var url = $(this).attr("href");
        $("#cntrBxTitle").html(title);
        $("#cntrBxDesc").html(description);
        $("a.homeCenterboxLearnMore").attr("href",url);

        // Get the height of the text box
        var cntrBxHeight = $(".homeCenterboxDescription").height();

        // Set it outside of viewability then slide it up
        $(".homeCenterboxDescription").css("bottom", "-" + cntrBxHeight + "px")
            .show()
            .animate({"bottom": "+=" + cntrBxHeight + "px"}, "fast");
    }
}
