
$(document).ready(function() {

  // menu hover
  $('#menu .icon.home').hover(function(){$('img', this).attr('src','style/icon-home-over.gif');},
                              function(){$('img', this).attr('src','style/icon-home.gif');});
  $('#menu .icon.search').hover(function(){$('img', this).attr('src','style/icon-search-over.gif');},
                                function(){$('img', this).attr('src','style/icon-search.gif');});

  // pagelist
  $('.block-pagelist li').each(function() { 
    var li = this;
    if ($('a', li).attr('href')==window.location['pathname']) {
      $(li).addClass('active').parents('li').addClass('active');
    }
  });

  //blocks rounded corners
  $('div.block').each(function() {
    $(this).prepend('<img class="tl" src="style/block-blue-tl.gif"/><img class="tr" src="style/block-blue-tr.gif"/><img class="bl" src="style/block-blue-bl.gif"/><img class="br" src="style/block-blue-br.gif"/>');
  });

  // lightbox
  $('a.lightbox').lightBox({
    overlayBgColor: '#f4f9ff',
    overlayOpacity: 0.8,
    imageLoading: 'style/lightbox-ico-loading.gif',
    imageBlank: 'style/lightbox-blank.gif',
    imageBtnClose: 'style/lightbox-btn-close.gif',
    imageBtnPrev: 'style/lightbox-btn-prev.gif',
    imageBtnNext: 'style/lightbox-btn-next.gif',
    imageBtnPrint: 'style/icons/print.png',
    txtPrint: 'Afdrukken'
  });

  //references
  $('.references').prepend('<div id="hi-ref"><img class="tl" src="style/block-orange-tl.gif"/><img class="tr" src="style/block-orange-tr.gif"/><img class="bl" src="style/block-orange-bl.gif"/><img class="br" src="style/block-orange-br.gif"/><img class="logo" src="" alt=""/><p/></div>');
  var hiref = $('#hi-ref');
  $(hiref).mouseout(function() { $(hiref).removeClass('hover'); });
  $('.references div').not('#hi-ref').each(function() {
    var self = this;
    $('img', self).hover(function() {
                   var refimg = $(this);
                   var reftxt = $('p', self);
                   var imgpos = refimg.position();
                   $('img.logo', hiref).attr('src', refimg.attr('src')); 
                   $('p', hiref).html(reftxt.html()); 
                   $(hiref).css({top: (imgpos.top-11)+'px', left: (imgpos.left-9)+'px'}).addClass('hover'); 
                 }, 
                 function() { });
  });

  // info toggles
  $('dt').each(function() {
    $(this).prepend('<img src="style/item-expanded.gif" alt="-"/>');
  });
  $('dt.closed').each(function() {
    $(this).next('dd').css({'display': 'none'});
    $('img', this).attr('src', "style/item-collapsed.gif").attr('alt', "+");
  });
  $('dt').click(function() {
    if ($(this).next('dd').css('display') != 'block') {
      $(this).next('dd').css({'display': 'block'});
      $('img', this).attr('src', "style/item-expanded.gif").attr('alt', "-");
    }
    else {
      $(this).next('dd').css({'display': 'none'});
      $('img', this).attr('src', "style/item-collapsed.gif").attr('alt', "+");
    }
  });

});

