$(document).ready
(
    function()
    {
	/*
	    Affichage des images
	*/

	$("#zone-content img[align=left]").css("margin", "0 1em 1ex 0");
	$("#zone-content img[align=right]").css("margin", "0 0 1ex 1em");

	/*
	   Cut des mots trop grands pour les créatrices et 
	*/

	$("#zone-content div#view-creatrices ul.creatrices li.creatrice h5, #zone-content div.articleList ul.articles li.article h5").each
	(
	    function()
	    {
		var span    = $("a span", this);
		var height  = $(this).height();
		var s	    = span.text().split(" ");

		while ( span.height() > height )
		{
		    s.length--;
		    span.text(s.join(" ") + " ...");
		}

		$(this).height("auto");
	    }
	);

	/*
	   Images no-avatar
	   dans la navigation
	*/
	
	$("#zone-content div.navigation div.previous a, #zone-content div.navigation div.next a").each
	(
	    function()
	    {
		if ( $("img", this).length )
		{
		    return true;
		}

		var span    = $("span", this);
		var img	    = $("<img src=\"" + wisy.toURL("/layout/img/avatar-thumb.jpg") + "\" />");
		if ( $(this).parent().is(".next") )
		{
		    img.insertBefore(span);
		}
		else
		{
		    img.insertAfter(span);
		}
	    }
	);

	/*
	   Articles non disponibles
	*/

	$("#zone-content div.articleList ul li.article.indisponible").each
	(
	    function()
	    {
		var a = $(this).find("div.img a").get(0);
		a = $(a.cloneNode(false)).addClass("bandeau-indispo").prependTo(this);

		if ( a.is("[attr]") )
		{
		    a.css("cursor", "pointer");
		}
	    }
	);

	$("#zone-content div.venteDetail div.articleDetail.indisponible > div.img").each
	(
	    function()
	    {
		$("<div></div>").addClass("bandeau-indispo").prependTo(this);
	    }
	);
    }
);
