/* 
 * Changes the action that the form points to so we can
 * get the quotes on the right page.
 *
 * -Bob
 * 
 */

$(document).ready(function(){
    $("#get_quotes_button").click(function(){
        updateTarget();
    });

    $('#insurance_types, #statecode').change(function(){
        updateTarget();
        $('#quote_form').submit();
    });
});

function updateTarget() {
    var insType = $("#insurance_types").val();
    var resultsPage = insType + ".php";
    $("#quote_form").attr("action", resultsPage);
}

