$(document).ready(function(){
   $('#kategorier a').click(function(){
      var kategori = $(this).attr('rel');
      $('#subjects li.tile:not(.' + kategori + ') h3 a').fadeTo("slow", 0.1);
      $('#subjects li.' + kategori + ' h3 a').fadeTo("slow", 1);
   });
   return false;
});

$('<div class="chosen_arrow"></div>').prependTo('.the_chosen_one');

$('#boxWrapper').fadeIn(1000);

$(".newsentry, .module, .nyhetspostlink").click(function(){
    	window.location=$(this).find("a").attr("href");return false;
	});

      $('.newsentry').hover(
        function () {
          $(this).stop().fadeTo("fast", 0.7);
        }, function () {
          $(this).stop().fadeTo("fast", 1);
      });

    $('a[href*=#]').click(function() { 
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
        && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 1000);
                return false;
            }
        }
    });
