$(function() {


$("#costingdiv").dialog({
        autoOpen: false,
        height: 800,
        width: 800,
        modal: true,
        buttons: {
              'Add Costing': function() {

                $.post("/line_items/ajaxSave", $("#LineItemAddForm").serialize(), function(data) {

                    fetchTable();
                     $('#mydebug').html(data);
            }
                );

                $("#LineItemAddForm").resetForm();
                $(this).dialog('close');
            },
            Cancel: function() {
                $(this).dialog('close');
            }
        },
        close: function() {

        }
    });

/**
 * When add costing button is pressed. Bring up costing dialog
 */
$("#addCostingDialog").button().click(function () {
    $.get('/costings/add/', function(data) {
        $("#costingdiv").html(data);
         $('#costingdiv').dialog('open');



    })
    });


});




function AjaxFetchPage() {
    $.post("/costings/", $("#LineItemQuoteId").serialize(), function (itemTable) {
        $("#productTable").html(itemTable);
    });
}
