$(document).ready(function(){

/* translated titles */


//hover mouseover news på PA
$(".news-latest-item_PA").each(function(){
      var Link = $(this).children().find("a").attr("href");
      $(this).wrap("<a class='box_link'></a>");
      $(this).parent().attr("href", Link);
});

$(".news-list-item_PA").each(function(){
      var Link = $(this).children().find("a").attr("href");
      $(this).wrap("<a class='box_link'></a>");
      $(this).parent().attr("href", Link);
});


//Søgning


var getvalue = $(document).getUrlParam("tx_indexedsearch[sections]");

if(getvalue){
  if(getvalue == 0){
	$("input[name*='section'][value=0]").attr("checked","checked");
  } else if(getvalue.length > 3){
	$("input[name*='section'][value*='rl1_']").attr("checked","checked");
  }
}


$("#over_menu li").each(function(i){
	
$(this).hover(
	
	function () {
        	$("#menuSelect li").hide();
        	$("#menuSelect li:eq("+i+")").show();
      	}, function () {
      	       	$("#menuSelect li.act").show();
      	       	$("#menuSelect li:eq("+i+")").hide();
      	}
);
	
});

$('.innerwrap').not(":last").css("margin-bottom","15px");
	
$("#over_menu li").not(".act").hover(
	
	function () {
       		$("#over_menu li.act img").css("border-bottom","1px solid white");
       		$("#over_menu li.act img").height(9);
	}, function () {
	       	$("#over_menu li.act img").css("border-bottom","none");
	       	$("#over_menu li.act img").height(10);
	}
);

/* Directory */

var maxantal = 5;

$('.catcontainer .catbox').each(function(){
	var lis = $(this).find("li").size();
	if(lis > maxantal) {
		$(this).append('<img class="catclapper" src="fileadmin/danish_arts/images/expand.png" alt="Vis alle" />');
	}
});

$(".catbox ul").each(function(){
	var listitem = $(this).children("li");
	for(var x = maxantal; x < listitem.length; x++) {
		listitem[x].style.display = "none";
	}
});

$('.catclapper').toggle(function () {
	$(this).siblings("ul").children("li").show();
	$(this).attr("src","fileadmin/danish_arts/images/minimize.png");
},function () {
	var listitem = $(this).siblings("ul").children("li");
	for(var x = maxantal; x < listitem.length; x++) {
		listitem[x].style.display = "none";
	}
	$(this).attr("src","fileadmin/danish_arts/images/expand.png");
}
);


});