var __MD__POST_REGISTER = ''; 

function sendRegisterForm(){
    var form = '#register_form';
    $.ajax({
        url: $(form).attr('action'),
        data: $(form).serialize(),
        type: 'POST',
        dataType: 'json',
        success: function(json) {
            if(json.result == 1){
                $('#div_registro').html(json.body);
                $('#register_error').html(json.error);
                $.fancybox.resize();
            }else{
                if(json.share != 0){
                    document.location = json.share;
                } else {
                    if(__MD__POST_REGISTER != ''){
                        document.location = __MD__POST_REGISTER;
                    }else{
                        document.location.reload();
                    }
                }
            }
        }
    });

    return false;

}

function setPostRegister(page)
{
    __MD__POST_REGISTER = page;
}

