//When the DOM tree is loaded
$(document).ready(function() {
  
    // setear menú activo con url
    $("#menu a").each(function(i) {
        switch (window.location.pathname)
        {
        case $(this).attr("href"):
            $(this).parent().addClass("current_page_item");
            break;
    case '/':
      $("#menu a[href='/inicio.aspx']").parent().addClass("current_page_item");
      break;
    default:
      if (window.location.pathname.indexOf($(this).attr("href").split('.')[0]) > -1)
      {
        $(this).parent().addClass("current_page_item");
      }
        }
    });

    /* Acciones para Herramientas */
    $(".imprimir").click(function() {
        $("#contenido_principal").printElement({
            printMode: 'iframe',
            overrideElementCSS: ['/css/estilos-print.css']
        });
    });
    fontResizer('85%', '90%', '100%');

    // facebox popup interno
    $('a.popup').facebox();

      // enlaces de descarga
    $(".enlace a, .enlace_doc a, .enlace_xsl a, .enlace_pdf a").click(function() {
        pageTracker._trackEvent('Descargas', this.href, document.location.href);
    });


  // destacados keynotes.
  $('#destacados_lista')
  .after('<div id="destacados_nav">')
  .cycle({
    fx:     'fade',
    speed:  'slow',
    timeout: 5000,
    pager:  '#destacados_nav'
  });

  $('p:empty').remove();

  // oEmbed
  //$("a.oembed").oembed();
  $("a.oembed").oembed(null, { 
      maxWidth: 640, 
      maxHeight: 480 });
});

