
$(function(){
    var logos = $('#logos');
    var content = $('#content-wrapper');
    logos.height(content.height() + 10);
    if(content.height() < 465) logos.height(465);
});

$(function(){
   $("a.popup").click(function(e){
       e.preventDefault();
       $.fn.colorbox({href:$(this).attr('href'), iframe: true, width: 600, height: 1000});
       return false;
   });
});

$(function(){
   $('table.archivos tr').click(function(){
      $(this).find('a.popup').click();
   });
});

$(function(){
   var charMax = 30;
   var offset = 7;
   $('.news .news-title').each(function(i, element){
       var title = $(this);
       var chars = title.text().length;
       if(chars >= charMax){
           title.css('paddingTop', parseInt(title.css('paddingTop')) - offset + 'px').height(title.height() + offset);
       }
   });
});

$(function(){
   var maxWidth = 335;
   $('#popup img').load(function(){
      var img = $(this);
      var clone = img.clone().appendTo('body');
      var width = clone.width(); 
      clone.remove();
      if(width > maxWidth){
          img.css({cursor: 'pointer'});
          img.after($('<p>').text('Click para ampliar').css({textAlign: 'center', fontSize: 11, fontStyle: 'italic'}));
          img.click(function(){
            window.open($(this).attr('src'), 'image', 'width=600, height=' + $(window).height()+', resizable=yes, scrollbars=yes');
          })
      }
   });
});

