

$(document).ready(function() {
    $("#frmcontact").submit(function() {

        $("#submit").val("Wait..");
        var str = $("#frmcontact").serialize();

        $.ajax({
            type: "POST",
            url: "contact.aspx",
            data: str,
            success: function(msg) {

                $("#note").ajaxComplete(function(event, request, settings) {
                    $("#note").show();
                    if (msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
                    {
                        result = '<span class="notification_ok">Your message has been sent. Thank you!</span>';
                        $("#fields").hide();
                    }
                    else {
                        result = msg;
                        $("#submit").val("Send");
                    }

                    $(this).html(result);

                });

            }
        });

        return false;

    });

    $("#sendfriend").submit(function() {

        $("#submit_friend").val("Wait..");
        var str = $("#sendfriend").serialize();

        $.ajax({
            type: "POST",
            url: "sendfriend.aspx",
            data: str,
            success: function(msg) {

                $("#friendresult").ajaxComplete(function(event, request, settings) {
                    $("#friendresult").show();
                    if (msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
                    {
                        result = '<span class="notification_ok">Thank you! Why Not Send Another..</span>';
                        $("#friend_email").val("");
                        $("#friend_email").focus();
                        $("#submit_friend").val("Send");
                    }
                    else {
                        result = msg;
                        $("#submit_friend").val("Send");
                    }

                    $(this).html(result);

                });

            }
        });

        return false;

    });

});
