
$(function() {
    /* Agregar al chiss*/
    $("div[class^=BLO_boton]").filter(function() {

        $(this).bind("mouseover", function() {
            this.className = this.className + "_on";
        })

        $(this).bind("mouseout", function() {
            this.className = this.className.substring(0, (this.className.length - 3))
        })

    })

    /*******************/
    //$('#BLO_botonOK').bind('click', fnc_CerrarProcess);
    //$('#BLO_ingreso2').bind('click', verLogueoUsuario);

    // $('.BLO_CONTE_superior').bind('click',verLogueo);  
    //$('.BLO_botonComentar').bind('click',verLogueo);
    $('#div_BLO_usuario1').bind('click', verLogueoUsuario);
    $('#div_BLO_anonimo1').bind('click', verLogueoAnonimo);

    $('#div_BLO_usuario2').bind('click', fnc_VerUsuario);
    $('#div_BLO_anonimo2').bind('click', fnc_VerAnonimo);

    $('.BLO_leerTodo').bind('click', mostrarComentario);

    $('.BLO_leerTodo').parent().prev('div').filter(function() {
        $(this).css({ 'height': 'auto' });
        var altura = $(this).height();
        $(this).css({ 'height': '32px' });
        //alert($(this).height() + ":" + $(this).attr('id'));
        if (altura <= '32') {
            //alert($(this).attr('className'));
            //alert($(this).next().find('.BLO_leerTodo'));
            //alert($(this).next().find('.BLO_leerTodo'));
            $(this).next().find('.BLO_leerTodo').css({ 'visibility': 'hidden' });
            // $(this).find('.BLO_leerTodo').css({ 'visibility': 'hidden' });
        } else {
            $(this).next().find('.BLO_leerTodo').css({ 'visibility': 'visible' });
        }
    })

    $('.BLO_mostrarComentarios_on').bind('click', mostrarListaComentarios);
    //alert(window.parent.NombreFuncion);


    //$('.BLO_ICONO_reportarAbuso').bind('click',mostrarReportarAbuso);

    //$('.BLO_usuarioAbuso').bind('click',verLogueoUsuario);         
    //$('.BLO_anonimoAbuso').bind('click',verLogueoAnonimo); 

})


function mostrarReportarAbuso() {
    //alert("si")
    $(this).parent().parent().parent().parent().find('.BLO_CONTE_reportarAbuso').filter(function() {
        $(this).show();
        //$(this).find('.BLO_CONTE_logueoUsuarioAnonimo').show();
    });
}


function mostrarListaComentarios() {
    //alert($('#P_Comentario').html());
    if ($('.BLO_CONTE_listaComentarios:first').is(":hidden")) {
        $('.BLO_mostrarComentarios_on').removeClass('BLO_mostrarComentarios');
        $('.BLO_mostrarComentarios_on').filter(function() {
                    $('#ctl00_PortalPlaceHolder_ctl01_P_Comentario2').html("" + window.parent.vstr_Ocultar + " <span>(" + window.parent.viint_CantidadMostrar + "  " + vstr_TotalComentarios + ")</span>");

        })
        $('.BLO_CONTE_listaComentarios').show();
    } else {
        $('.BLO_mostrarComentarios_on').addClass('BLO_mostrarComentarios');
        $('.BLO_mostrarComentarios_on').filter(function() {
$('#ctl00_PortalPlaceHolder_ctl01_P_Comentario2').html("" + window.parent.vstr_Mostrar + " <span>(" + window.parent.viint_CantidadMostrar + "  " + vstr_TotalComentarios + ")</span>");
        })
        $('.BLO_CONTE_listaComentarios').hide();
    }
    $("#Div_Motivo2").hide();
}


function mostrarComentario() {

    $(this).parent().prev('div').filter(function() {

        if ($(this).height() == '32') {
            $(this).css({ 'height': 'auto' });
            $(this).next().find('.BLO_leerTodo').text("colapsar").css({ 'color': '#075373' });

        } else {
            $(this).css({ 'height': '32px' });
            $(this).next().find('.BLO_leerTodo').text("leer todo").css({ 'color': '#1293a9' }); ;
        }


    })
} $("#Div_Motivo2").hide();


function verLogueoUsuario() {

    try {

        window.parent.avstr_Tipo = 1;
        if ($(this).attr('class') == "BLO_ingreso") {
            $(this).parent().parent().parent().parent().next().children('.BLO_CONTE_logueoUsuarioPortal').filter(function() {
                $(this).find('.BLO_botonIngresar').show();
                $(this).css({ 'padding-bottom': '8px' });

            })



        }


        $('.BLO_CONTE_comentar_on').hide();
        $('.BLO_CONTE_comentar').hide();
        $('.BLO_FRM_cajaTextoMotivo').val("");
        $("#ctl00_PortalPlaceHolder_BLO_ListarBlog1_txt_UsuComentario").val("");
        $('.BLO_CONTE_escribirComentario').show();
        $(this).parents('.BLO_CONTE_superior').filter(function() {
            //$(this).children('.BLO_CONTE_comentar').children('.BLO_TXT_mensajeIngresar').hide();
            //$(this).children('.BLO_CONTE_ingreso').show();
        });


        $(this).parents('.BLO_CONTE_superior').next('.BLO_CONTE_elegirTipoLogueo').filter(function() {
            $(this).show();
            $(this).children('.BLO_CONTE_logueoUsuarioAnonimo').hide();
            $(this).children('.BLO_CONTE_logueoUsuarioPortal').show();

        });
        $("#Div_Motivo2").hide();
    }
    catch (er) {
        alert(er)
    }
    fnc_verificaEstadoHead();
}

function verLogueoAnonimo() {

    try {
        $('.BLO_CONTE_comentar_on').hide();
        $('.BLO_CONTE_comentar').hide();
        window.parent.avstr_Tipo = 2;
        $('.BLO_CONTE_escribirComentario').show();

        $('.BLO_FRM_cajaTextoMotivo').val("");
        $("#ctl00_PortalPlaceHolder_BLO_ListarBlog1_txt_UsuComentario").val("");
        if ($(this).attr('class') == "BLO_botonComentar") {
            $(this).parent('.BLO_CONTE_comentar').hide();
            $(this).parent().next('.BLO_CONTE_ingreso').show();
            $('.BLO_CONTE_escribirComentario').show();
            $(this).parent().parent().next('.BLO_CONTE_elegirTipoLogueo').children('.BLO_CONTE_logueoUsuarioPortal').filter(function() {
                $(this).find('.BLO_botonIngresar').hide();
                $(this).css({ 'padding-bottom': '2px' });
            })



            if ($('.BLO_CONTE_listaComentarios:first').is(":hidden")) {
                mostrarListaComentarios();
            }
        }

        $(this).parents('.BLO_CONTE_superior').filter(function() {
            //$(this).children('.BLO_CONTE_comentar').children('.BLO_TXT_mensajeIngresar').hide();
            //$(this).children('.BLO_CONTE_ingreso').show();
        });

        $(this).parents('.BLO_CONTE_superior').next('.BLO_CONTE_elegirTipoLogueo').filter(function() {
            $(this).show();
            $(this).children('.BLO_CONTE_logueoUsuarioPortal').hide()
            $(this).children('.BLO_CONTE_logueoUsuarioAnonimo').show();
        });
        $("#Div_Motivo2").hide();
    }
    catch (er) {
        alert(er)
    }
    fnc_verificaEstadoHead();
}
