$(document).ready(function(){
  $('ul#random-images').innerfade({
    speed: 'slow',
		timeout: 8000,
		type: 'sequence',
		containerheight: '204px'
  });
				
  $('img[@src$=.png]').ifixpng();
	$("#random-images").prepend("<img src='images/backgrounds/overlay.png' class='random-images_overlay'>");
	

	$(".album-thumbs").each(function(){
	 if ($(this).children("li:gt(5)").length > 0) {
	   $(this).children("li:gt(5)").hide();
  	 $(this).attr('id', id='p' + Math.round(10000*Math.random()));
  	 $(this).after("<p>Alle foto's: <a href='javascript:void(0)' onclick='openAlbum(\"#"+id+"\");' class='album-more'>Tonen</a></p>");
	 }
  });
	
});

function openAlbum(selector) {
  $(selector).children().show();
  $(selector).next("p").replaceWith("<p>Alle foto's: <a href='javascript:void(0);' onclick='closeAlbum(\""+selector+"\");' class='album-more'>Verbergen</a></p>");
}

function closeAlbum(selector) {
  $(selector).children("li:gt(5)").hide();
  $(selector).next("p").replaceWith("<p>Alle foto's: <a href='javascript:void(0)' onclick='openAlbum(\""+selector+"\");' class='album-more'>Tonen</a></p>");
}


hs.registerOverlay({
  thumbnailId: null,
	overlayId: 'controlbar',
	position: 'top right',
	hideOnMouseOut: true
	}
);

hs.graphicsDir = '<?= SITE_ROOT ?>highslide/graphics/';
hs.outlineType = 'rounded-white';
window.onload = function() {
	hs.preloadImages(5);
}