// after loading
$(document).ready(function(){

  $('#center').find("a[href$='jpg']").add("a[href$='JPG']")
    .add("a[href$='jpeg']").add("a[href$='JPEG']")
    .add("a[href$='png']").add("a[href$='PNG']")
    .add("a[href$='gif']").add("a[href$='GIF']").filter(":has('img')")
    .addClass("thickbox").attr('rel', 'galerie');

    $('a.external, a.urlextern').click(
      function(){
        window.open(this.href);
        return false;
      }
    );
    
  $("#menu li").hover(
    function() {
      $(this).children("ul").show();
    },
    function() {
      $(this).children("ul").hide();
    }
  );
  $("div#sliderWrapper").smoothDivScroll({
    autoScroll: "always",
    autoScrollDirection: "endlessloop",
    autoScrollSpeed: 1,
    pauseAutoScroll: 'mouseover'
  });

  $('div.scrollableArea img').hover(function(){
    $(this).css('opacity','1');
  }, function(){
    $(this).css('opacity','0.8');
  });

  $('div.scrollableArea img').click(function(){
    var imgNum = 0;
    var path = $(this).attr('src').split('/');
    var imgName = path[path.length-1];
    path[path.length-1] = '';
    imgName = imgName.split('.');
    imgNum = imgName[0].substr(2);
    gallery(path.join('/'),imgNum,$(this).attr('rel'),0);
  });
});
