$(document).ready(function(){

	$(".ie").load("js/ie.html"); // Load the IE warning into a div with a class of ie

	// Contact form
	$("form#contactform").submit(function(e) {

		// Setup any needed variables
		var input_name = $('#name').val(),
		input_email    = $('#email').val(),
		input_subject  = $('#subject').val(),
		input_message  = $('#message').val(),
		response_text  = $('#response');

		// Hide any previous response text
		response_text.hide();

		// Change response text to 'loading...'
		response_text.html('Loading...').show();

		// Make AJAX request
		$.post('sendmail.php', {name: input_name, email: input_email, subject: input_subject, message: input_message}, function(data){
			response_text.html(data);
		});

		// Cancel default action
		return false;

	});

    /* GA TRACKING CODER */
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-28597595-1']);
    _gaq.push(['_trackPageview']);

    (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

});
