$(function() {
    // These first three lines of code compensate for Javascript being turned on and off. 
    // It simply changes the submit input field from a type of "submit" to a type of "button".

    var paraTag = $('input#submit2').parent('p');
    $(paraTag).children('input').remove();
    $(paraTag).append('<input type="button" name="submit2" id="submit2" value="Send Order" />');

    $('#order-results2 input#submit2').click(function() {
        $('#order-results2').append('<p class="loaderIcon">Processing.. Please wait</p>');

        var name = $('input#name2').val();
        var email = $('input#email2').val();
        var pages = $('select#emailtemplates').val();
        var filelink = $('input#filelink2').val();
        var totaldays = $('select#days2').val();
        var comments = $('textarea#comments2').val();
        var formtotalcost = $('input#formtotalcost2').val();
        var formhalfcost = $('input#formhalfcost2').val();
        var orderid = $('input#orderid').val();
        var emailapp = $('input#emailapp').val();
        $.ajax({
            type: 'post' ,
            url: '../process-html.php',
            data: 'name=' + name + '&email=' + email + '&comments=' + comments + '&pages=' + pages + '&filelink=' + filelink + '&totaldays=' + totaldays + '&orderid=' + orderid + '&formhalfcost=' + formhalfcost + '&formtotalcost=' + formtotalcost + '&emailapp=' + emailapp,

            success: function(results) {
	                $('#order-results2 p.loaderIcon').fadeOut(500);
                $('ul#response2').html(results);
            }
        }); // end ajax
    });
});
	
