//=====================================================//
var LoadReady = {

    register: function(exPar){
        $(function() {
            var options = {
                url: exPar['formAction'],
                success: Validate.validateFormData,
                beforeSubmit: function() {},
                dataType: 'json'

            };
            $('#registerForm').ajaxForm(options);
        });
    },

    login: function(exPar){
        $(function() {
            var options = {
                url: exPar['formAction'],
                success: Validate.validateFormData,
                returnType: 'xml',
                beforeSubmit: function() {},
                dataType: 'json'
            };
            $('#loginForm').ajaxForm(options);
        });
    },

    forgotPassword: function(exPar){
        $(function() {
            var options = {
                url: exPar['formAction'],
                success: Validate.validateFormData,
                returnType: 'xml',
                beforeSubmit: function() {},
                dataType: 'json'
            };
            $('#frmForgotPassword').ajaxForm(options);
        });
    },

    commentForm: function(){
        $('#addComment').click(function(e) {
            e.preventDefault();

            var options = {
                success: function(json, statusText, jqFormObj) {
                    extraPar= {callback: function(){
                        var returnText = json.returnText;
                        $("#commentsList").html(returnText);
                        $('#frmComment').resetForm();
                        $('#commentForm').show();
                        document.location = '#commentForm';
                    }}
                    Validate.validateFormData(json, statusText, jqFormObj, extraPar);
                    Util.hideProgressInd();
                },
                beforeSubmit: function() {
                    $('#commentForm').hide();
                    Util.showProgressInd();
                },
                dataType: 'json'
            };

            $('#frmComment').ajaxForm(options);
            $('#frmComment').submit();
        });
    },

    enquiryForm: function(){
        $(function() {
            var options = {
                success: Validate.validateFormData,
                beforeSubmit: function() {},
                dataType: 'json'
            };
            $('#enquiryForm').ajaxForm(options);
        });
    },

    toggleSlideBox: function() {
        $(function() {
            $('.slideBox').hide();

            $('a.clickToSlide')
            .livequery('click', function(e) {
                e.preventDefault();
                var parent     = $(this).closest('.slideBoxParent');
                var slideBox = $('.slideBox', parent)
                $(slideBox).slideToggle('slow');
            });
        });
    }
}
