$(document).ready(function() {

    $("body").pngFix();

    $('a.ajax').click(function() {
        
        var salida=$(this).attr('href');
        var html=salida.split("index.php?url=");
        salida=html[1];

        if( salida=='javascript:history.back()' || salida=='#arriba' )
            return true;
        
//        alert("http://localhost/emilio/content/getSalida.php?url="+salida);
        $.getJSON("/getSalida.php?url="+salida, result);
            return false;
    });

    function result(json)
    {
        if(json['data']!=null)
        {
            $('#cuerpo').html(json['data']+'<script language="javascript" type="text/javascript" src="public/scripts/init_1.js"></script>');
        }
        else
            alert("error");
    }
});


function toggleElementDisplay(togId) {

    if( $('#'+togId).css('display')=="block" )
    {
        $('#'+togId).css('display', 'none');
    }
    else
    {
        $('#'+togId).css('display', 'block');
    }
    regenarar();
}

function regenarar()
{
    cth=$('#contenedor_titulo').height();
    tch=$('#texto_cuerpo').height();
    bdh=$('#menu').height();
    //alert(parseInt(cth));
    //alert(parseInt(bdh));
    bdh=bdh-50;
    if(cth<bdh)
        $('#contenedor_titulo').css('height', bdh+'px');
    else
    {
        if((tch+77)<cth)
        {
            tch=tch+77;
            if( (tch+50) > bdh )
                $('#contenedor_titulo').css('height', tch+'px');
        }
    }

}

