jQuery.extend({
    vWebForm: function(form){
        /**
         * keep a reference to ourselves
         */
        var that = this;
        var WebForm = form;

        this.getForm = function()
        {
            return WebForm;
        }
        this.setForm = function(value)
        {
            WebForm = value;
        }
        $(function() {
            // show a simple loading indicator
            var loader = $("<div class='modal'><div class='black_overlay'></div><div class='white_content'><div class='modalComentarios' style='color: #515151;'><span id='loader'><img src='imagens/loading.gif' alt='loading...' /></span></div></div></div>").appendTo("body").hide();

            $(WebForm).ajaxStart(function() {
                loader.show();
            }).ajaxStop(function() {
                loader.hide();
            }).ajaxSuccess(function(evt, request, settings){
                if(request.responseText == '1'){
                    jAlert("Seu Cadastro foi enviado com sucesso<br /> Muito Obrigado!","Unicadecor");
					WebForm.clearForm();
					}
                else
                   jAlert("Desculpe, mas ouve um erro no servidor, por favor tentar mais tarde","Unicadecor");
				
					
               
            }).ajaxError(function(event, XMLHttpRequest, ajaxOptions, thrownError) {
                jAlert("Desculpe, mas ouve um erro no servidor, por favor tentar mais tarde","Unicadecor");
				
				
				
                loader.hide();
                throw e;
            });
        });
    }
});
