
/* - carousel.js - */
// http://www.forbrugerkemi.dk/portal_javascripts/carousel.js?original=1
jQuery(function($){var resizeCarousel=function(carousel,scrollable,elems){var base_height=Math.max.apply(null,$(elems).map(function(){return $(this).height()}).get());$(elems).height(base_height);var scrollable_height=$(elems).eq(0).outerHeight(true);$(scrollable).height(scrollable_height);var outer_height=$(scrollable).outerHeight(true)+$(".navi").outerHeight(true);var $carousel=$(carousel);$carousel.height(outer_height).trigger('resized.carousel',[$(elems)])};$(".toolBar").hide();var carousels=$(".carousel");carousels.each( function(i){var carousel=this;var scrollable=$(this).find(".scrollable").eq(0);var elems=$(scrollable).find('.tileItem');if(elems.length<2) $(scrollable).removeClass("scrollable");scrollable_width=$(scrollable).width();for(i=0;i<elems.length;i++){$(elems[i]).css({width:scrollable_width})};setTimeout(function(){resizeCarousel(carousel,scrollable,elems)},0);$(scrollable).find("img").load(function(event){resizeCarousel(carousel,scrollable,elems)})})
var ap=(carousels.length==1)?true:false;var api=$("div.scrollable").scrollable({size:1,clickable:false,circular:true,loop:true}).autoscroll({autoplay:ap,steps:1,interval:10000}).navigator({indexed:true,api:true});$(".carousel").hover(
function(){$(this).find(".toolBar").eq(0).slideToggle('fast').show()},
function(){$(this).find(".toolBar").eq(0).slideToggle('fast').hide()});$("body.section-forside .carousel").bind('resized.carousel', function(event,elems){$("body.section-forside .carousel").each(function(){var scrollable=$(this).find(".scrollable").eq(0);$(this).height('270px');$(elems).height('270px');$(scrollable).height('270px')})})})

