var Vircolab = Vircolab || {};

Vircolab.HighlightCurrentSection = (function($) {

  function init() {

    var url = window.location.pathname.split('/')[1];
    if ( url != '' ) {
      $('html').addClass( $.camelCase( url ) ); // add current section name as a css class to the html element
      $("#pageHeader .menu").find("a[href^='/" + url + "']").parent().addClass("current");
    } else {
      $("#pageHeader .menu").find("a[href='/']").parent().addClass("current");
    }
  }

  return {
    init: init
  }

})( jQuery );

jQuery(document).ready(function() {
  Vircolab.HighlightCurrentSection.init();
});



Vircolab.ExternalLinkConfirmation = (function($) {

  function init( message ) {

    var hostname = window.location.hostname;

    $('a').not('.fancybox').each(function(){
      var href = $(this).attr("href");
      if (href && ( href.indexOf("http://")>-1 || href.indexOf("https://")>-1 ) ) { 
        //full url
        if (href.indexOf(hostname)==-1) { 
          //external link
          $(this).click(function(e) {
            if (!confirm(message)) {
              return false;
            }
          });
        }
      }
    });

  }

  return {
    init: init
  }

})( jQuery );

jQuery(document).ready(function() {
  Vircolab.ExternalLinkConfirmation.init( 'This link will take you to a Web site to which this Privacy Policy does not apply.\n\nWe encourage you to read the Privacy Policy of every Web site you visit.\n\nDo you want to continue?' );
});

