$(document).ready(function() {

    // function make sure 'actie van de week' is formatted properly by providing correct classes.
    $("#sidebar310").find("table").each(function(){
      $(this).removeAttr("style").removeAttr("border").removeAttr("cellspacing").removeAttr("cellpadding").removeAttr("width");
    });

    var counter = 1;
    $("#sidebar310").find("td").each(function(){
      if (counter == 5) { counter = 1; }
      $(this).attr("class","td"+counter);
      counter++;
    });
    
    // function used for showing products used in 'producten' template'
    $('#mycarousel').jcarousel({
        scroll: 2,
        vertical:true
    });

   	// SET FIRST IMAGEBOX CORRECT
    var totalHeight = $("#imageDescription").height() + $(".fullImages:first").height() + 50;
    $("#imageBox").height(totalHeight);

    // SHOW LARGE IMAGE
    $("#mycarousel li img").click(function(){
    	// get stuff needed
    	var imageID = $(this).attr("id");
    	var description = $(this).attr("description");

    	// publish stuff
    	$(".fullImages").fadeOut(500);
   	  $("#"+imageID+"full").fadeIn(500);
    	$("#imageDescription p").html(description);
    	var totalHeight = $("#imageDescription").height() + $("#"+imageID+"full").height() + 50;
    	$("#imageBox").height(totalHeight);
    });
});
