$(document).ready(function(){
		// slideshow 
		  	$('#refBox img:first').fadeIn(800, function() {
          	$('#refBox').cycle();
    	  });

		// nyhetshover
	$('.newsentry').click(function(){
    	window.location=$(this).find("a").attr("href");return false;
	});

      $('.newsentry').hover(
        function () {
          $(this).stop().fadeTo("slow", 0.7);
        }, function () {
          $(this).stop().fadeTo("fast", 1);
      });
      // nyhetssortering
	$('<p class="searchlabel">Innehåll av typen <span>nyheter och pressmeddelanden</span></p>').insertAfter('.search .post div.entry');
	$('<p class="searchlabel">Innehåll av typen <span>sida</span></p>').insertAfter('.search .page div.entry');
	$('<div class="label">Innehåll av typen <span>nyhet</span></div>').insertAfter('.blog .category-nyheter div.entry');
	$('<div class="label">Innehåll av typen <span>pressmeddelande</span></div>').insertAfter('.blog .category-pressmeddelanden div.entry, .archive .category-pressmeddelanden div.entry');

// slidelocation
$('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;          
         }         
     }
     });

	$('.personallista_item').click(function(){
    	window.location=$(this).find("a").attr("href");return false;
 	});
 	
 	$('.personallista_item').hover(
	function(){ $(this).addClass('hover_style_class') },
	function(){ $(this).removeClass('hover_style_class') }
	)  
 	 });
 	 
 	 jQuery.fn.mailto = function() {
	return this.each(function(){
		var email = $(this).html().replace(/\s*\(.+\)\s*/, "@");
		$(this).before('<a href="mailto:' + email + '" rel="nofollow" title="Email ' + email + '">' + email + '</a>').remove();
	});
};

$(document).ready(function(){
	$('.email').mailto();
	});

