function saveScrollPosition (event) {
    $("#scroll_y").val($(window).scrollTop());
    //alert("Got scroll position: " + $("#scroll_y").attr("value"));
}

function loadScrollPosition() {
    var scroll_y = $("#scroll_y").attr("value");
    //alert("About to set scroll position to: " + scroll_y );
    if(scroll_y) {
        try { $.scrollTo(scroll_y,0); } catch(e) {};
    }
    // Reset the scroll position
    $("#scroll_y").val(0);
}
$(document).ready(function(){
    $('#calculator').submit(function() {
        if (! $('#total_debt').val()) {
            $('#total_debt').focus()
            return false;
        }
        if (! $('#monthly_payment').val()) {
            $('#monthly_payment').focus()
            return false;
        }
      saveScrollPosition();
    });

    loadScrollPosition();

    if(jQuery().numeric) { // Check for plugin
        $(".numeric").numeric();
    }
});

