$(document).ready(function(){
    $("#logo").click(function(){
        window.open("/","_self");
    });

    $(".facebookPie").click(function(){
        $('#contenedorFacebook').fadeIn('4000');
    });

    $(".twitterPie").click(function(){
        $('#contenedorTwitter').fadeIn('4000');
    });

    $(".cabecera_cerrar_face").click(function(){
        $("#contenedorFacebook").fadeOut('2000');
    });
    $(".cabecera_cerrar_twitter").click(function(){
        $("#contenedorTwitter").fadeOut('2000');
    });

    $(".slide").click(function(){
        var id = $(this).attr('id').substr(8);
        var titulo = $(this).attr('title');
        window.open('/index/noticia/id/'+id+'/', '_self');
    });

    $("img.ampliar").bind('click', function(){
       var imagen = $(this).clone();
       imagen.css('height','auto');
       imagen.css('width', 'auto');
       $('#visor').html(imagen);
       $("#visor").dialog({title:imagen.attr('alt')});
       $("#visor").dialog('open');
       return false;
    });

    $("#visor").dialog({
        autoOpen: false,
        modal: true,
        resizable: false,
        width: 'auto',
        top:5,
        left:5,
        hide: "scale" ,
        show: "scale"
    });

    $("#legal").click(function(){
        $("#aviso-legal").dialog("open");
        $.post('/index/terms/',{
        }, function(data){
            $("#aviso-legal").dialog("open");
            $("#aviso-legal").html(data);
        });
    });
    $("#condiciones").click(function(){
        $("#condiciones-uso").dialog("open");
    });

    $(".portadaFoto1").click(function(){
        window.open('/consultoria/aplicaciones/', '_self');
    });

     $(".portadaFoto2").click(function(){
        window.open('/disenho/corporativo/', '_self');
    });

     $(".portadaFoto3").click(function(){
        window.open('/web/disenho/', '_self');
    });

    $(".portadaFoto4").click(function(){
        window.open('/alojamiento/hosting', '_self');
    });

    $("#aviso-legal, #condiciones-uso").dialog({
            autoOpen: false,
            modal: true,
            position:'top',
            bgiframe: true,
            resizable: true,
            height:520,
            width:650,
            overlay: {
                backgroundColor: '#FFF',
                opacity: 0.1
            },
            buttons: {
                Cerrar: function() {
                    $(this).dialog('close');
                }
            }
    });

        $("#correoDialog").dialog({
            modal: true,
            width: 650,
            height: 265,
            resizable: false,
            buttons: {
                Aceptar: function() {
                    $(this).dialog('close');
                    window.open("/","_self");
                }
            }
        });



});
