  
  
  // Init JQuery
  function init() {
    // Hide all expanded content
    $(".expandcontent").hide();
    
    // Create expand effect
    $(".expand").click(function () {
      // Expand / Close
      $(this).toggleClass("expand").toggleClass("expandopen").children(".expandcontent").slideToggle("slow");
    });
    // Don't expand when content is clicked
    $(".expandcontent").click(function(event){
      event.stopPropagation();
    });
    
    // Add link classes (only to 'documentlist' parts of page)
    $(".documentlist a[href*='.']:not[href$='.php']:not[rel='imagebox-bw']").addClass("attachment").attr("title", "Download attachment"); // Exclude internal links from link icons
    $(".documentlist a[href$='.ppt']").addClass("attachment-ppt").attr("title", "Download Microsoft Word document (.PPT) attachment");
    $(".documentlist a[href$='.pps']").addClass("attachment-ppt").attr("title", "Download Microsoft Word document (.PPT) attachment");
    $(".documentlist a[href$='.doc']").addClass("attachment-doc").attr("title", "Download Microsoft Word document (.DOC) attachment");
    $(".documentlist a[href$='.xls']").addClass("attachment-xls").attr("title", "Download Microsoft Excel document (.XLS) attachment");
    $(".documentlist a[href$='.pdf']").addClass("attachment-pdf").attr("title", "Download Adobe Reader document (.PDF) attachment");
    $(".documentlist a[href$='.mpg']").addClass("attachment-video").attr("title", "Download video (.MPG) attachment");
    $(".documentlist a[href$='.mpeg']").addClass("attachment-video").attr("title", "Download video (.MPEG) attachment");
    $(".documentlist a[href$='.avi']").addClass("attachment-video").attr("title", "Download video (.AVI) attachment");
    $(".documentlist a[href$='.jpg']").addClass("attachment-photo").attr("title", "Download foto (.JPG) attachment");
    $(".documentlist a[href$='.jpeg']").addClass("attachment-photo").attr("title", "Download foto (.JPEG) attachment");
    $(".documentlist a[href='']:not([name])").addClass("link-missing").attr("title", "Onze excuses, deze link ontbreekt nog");
    // Disable mail and external link icons
    // $(".documentlist a[href^='mailto:']").addClass("link-email").attr("title", "Stuur een e-mail");
    // $(".documentlist a[href^='http://'][target='_blank']").addClass("link-external").attr("title", "Open link naar externe website in een nieuw venster");
    
    // Home hover effect (fire when page is loaded)
    $("body").load(function () {
      $("#jumpinlogo").hover(function() {
        $("#hometext").attr("src", "images/home2.gif");
      }, function() {
        $("#hometext").attr("src", "images/home1.gif");
      });
    });
  }
  
  
  // Print functions
  
  function printstart() {
    document.styleSheets(0).href = "jumpin-print.css";
  }

  function printstop() {
    document.styleSheets(0).href = "jumpin.css";
  }

  function printpage() {
    window.print();
  }

  
  
  
  // Kalender items voor meten en wegen
  $(document).ready(function() {
    
    var today = new Date();
    var day = today.getDate();
    var month = new Array(12);
    month[0]="januari";
    month[1]="februari";
    month[2]="maart";
    month[3]="april";
    month[4]="mei";
    month[5]="juni";
    month[6]="juli";
    month[7]="augustus";
    month[8]="september";
    month[9]="oktober";
    month[10]="november";
    month[11]="december";
    
    $('.calender').find('.' + month[today.getMonth()] ).find('.' + day ).addClass('present');
    
    // Find and edit weekends and days
    $(".calender .day:contains('za'), .calender .day:contains('zo')").parent().addClass('weekend');
    $(".calender .day:contains('ma'), .calender .day:contains('di'), .calender .day:contains('wo'), .calender .day:contains('do'), .calender .day:contains('vr')").parent().addClass('dag');
    $(".calender .vacation .day").parent().removeClass('dag');
        
    $(".calender .select_year div").click(function() {
      if (!$(this).hasClass('present_year')) {
        $(this).siblings().removeClass('present_year');
        $('.calender .select_day').removeClass('present_year');
        
        var year = $(this).attr('class');
        $(this).addClass('present_year');
        $(".calender .select_day." + year).addClass('present_year');
      }
    });
    
    $(".calender .select_month div").click(function() {
      $(this).siblings().removeClass('present_month');
      $('.calender .select_day .month').removeClass('present_month');
      
      var month = $(this).text();
      $(this).addClass('present_month');
      $(".calender .select_day ." + month).addClass('present_month');
    });
    
    $('.calender .row.dag').click(function() {
      var isopen = $(this).hasClass('open');
        
      // Hide other open containers
      $('.calender .row.open').removeClass('open').find('.extendable').slideUp();
        
      // Extend when needed
      if (!isopen) {
        $(this).addClass('open').find('.extendable').slideDown();
      }
    });
    
  });
  
  
  
