$(document).ready(function(){
  var list = $('dl dt > a').parent();

  var onClickDD = function(){
    $(this).prev('dt').click();
  }
  var onClickDT = function(){
    document.location.href = $(this).children('a').attr('href');
  }

  var mouseIn = function(el){
    el.css({'background-color': '#e3e3e3', 'cursor': 'pointer', 'text-decoration': 'underline'});
  }

  var mouseOut = function(el){
    el.css({'background-color': '', 'text-decoration': ''});
  }

  list.each(function(index, el){
    var dt = $(el);
    var dd = dt.next('dd');
    if (!dd.size()) return;
    dt.hover(function(){
      var t = $(this);
      mouseIn(t.add(t.next('dd')));
    }, function(a,b,c){
      var t = $(this);
      mouseOut(t.add(t.next('dd')));
    }).click(onClickDT);
    dd.hover(function(){
      var t = $(this);
      mouseIn(t.add(t.prev('dt')));
    }, function(a,b,c){
      var t = $(this);
      mouseOut(t.add(t.prev('dt')));
    }).click(onClickDD);
  })


	$('a[rel*=lightbox]').lightBox({
	  imageLoading: '/img/loading.gif',
  	imageBtnClose: '/img/close.gif',
  	imageBtnPrev: '/img/prev.gif',
  	imageBtnNext: '/img/next.gif',
    imageBlank: '/img/blank.gif',
  	txtImage: ''
	});

  $('a').filter(function(){
    return document.location.href == this.href && document.location.href.indexOf('?') == -1;
  }).removeAttr('href').css({'color': '#800000', 'text-decoration': 'none'});
  
  $("img").pngfix();
});
