﻿$(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#submit').parent('');
    $(paraTag).children('input').remove();
    $(paraTag).append('<input type="button" name="submit" id="submit" value=" " />');
	
	
	
    $('#contactform input#submit').click(function() {
        var name = $('input#name').val();
        var email = $('input#email').val();
        var phone = $('input#phone').val();
        var website = $('input#website').val();
        var comments = $('textarea#comment').val();

        $.ajax({
            type: 'post',
            url: 'http://ericnunlee.com/contact_form/sendEmail.php',
            data: 'name=' + name + '&email=' + email + '&phone=' + phone + '&website=' + website + '&comments=' + comments,

            success: function(results) {
                $('#contactform p.response').fadeIn();
                $('#contactform p.response').html(results);
            }
        }); // end ajax
    });

    $('#gotsomethingformeform input#submit').click(function() {
        var name = $('input#name').val();
        var email = $('input#email').val();
        var link = $('input#link').val();
        var comments = $('textarea#comments').val();

        $.ajax({
            type: 'post',
            url: 'http://ericnunlee.com/contact_form/sendEmailGotSomethingForMe.php',
            data: 'name=' + name + '&link=' + link + '&email=' + email + '&comments=' + comments,

            success: function(results) {
                $('#gotsomethingformeform p.response').fadeIn();
                $('#gotsomethingformeform p.response').html(results);
            }
        }); // end ajax
    });
});
		