$(document).ready(function () {

    // Logo intro
    $("#logo a").mouseenter(function () {
        $(this).stop().animate({
            "top": "-3"
        }, "fast");
    }).mouseleave(function () {
        $(this).stop().animate({
            "top": "0"
        }, "fast");
    });

    // Linked images
    $("a img").mouseenter(function () {
        $(this).stop().fadeTo("fast", .7);

    }).mouseleave(function () {
        $(this).stop().fadeTo("fast", 1);
    });
	
    // Validation
    $("#ajax-contact-form").submit(function () {
        var str = $(this).serialize();
        $.ajax({
            type: "POST",
            url: "/../php/contact.php",
            data: str,
            success: function (msg) {
                $("#messages").fadeIn(2000);
                $("#messages").ajaxComplete(function (event, request, settings) {
                    if (msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
                    {
                        result = '<div class="notification_ok">Your message has been sent.<br /><br />Thank you!</div>';
                        $("#contact_form").hide(2000);
                    } else {
                        result = msg;
                    }
                    $(this).html(result);
                });
            }
        });
        return false;
    });
});