function findArchives()
{
	if($(".scrollink").length == 0) return;
	
	$(".scrollink").click(function(e)
	{
		e.preventDefault();
		$rel = $(this).attr('rel');
		
		var num = $(this).prevAll(".scrollink[rel='"+$rel+"']").length;
		
		//$("#content"+$rel).animate({"left":-num * $("#scroller"+$rel).width()}, 1000);
		goto($rel, num);
	});
	
	$(".scrollink:first").addClass('scrollink-active');
	if($("a.orch").length == 0)
	{
		$(".annee").each(function()
		{
			$(this).find(".scrollink:last").addClass('scrollink-active');
			$(this).find(".content").css({'left':-($(this).find('.scrollink').length - 1) * $("#scroller"+$(this).find(".scrollink:last").attr('rel')).width()});
		});
	}
	else
	{
		$(".annee").find(".scrollink:first").addClass('scrollink-active');
	}
}

function goto(id, num)
{
	$("#content"+id).animate({"left":-num * $("#scroller"+id).width()}, 1000);
	$(".scrollink").each(function()
	{
		if($(this).attr('rel') == id) $(this).removeClass('scrollink-active');
	});
	$(".scrollink[rel='"+id+"']:eq("+num+")").addClass('scrollink-active');	
}

function findNewsletter()
{
	if($("#partenaires").length == 0) return;
	
	$("#valider").click(function(e)
	{
		e.preventDefault();
		
		var partos = "0";
		if($("#partenaires").attr('checked')) partos = "1";
		$.get("dyn/newsletter/inscription.php", {partenaires:partos, email:$("#email").val()}, function(data)
		{
			if(data == 0)
			{
				$("input, label, #valider").fadeOut(500);
				$(".formelem").append("Votre email a bien été inscrit à la newsletter !");
				closeBulle();
			}
			else
			{
				placeBulle("Cet email est déjà inscrit à la newsletter !", 15, 20, $("input[name=email]"));
			}
		});
	});
}

function findOrch()
{
	if($("a.orch").length == 0) return;
	
	$("a.orch img").hide();
	
	$("a.orch").click(function(e)
	{
		e.preventDefault();
		
		$("a.orch").removeClass('selected');
		$(this).addClass('selected');
		
		var theHref = $(this).attr('href');
		var theSrc = $(this).find('img').attr('src');
		$("img.classique").fadeOut(500, function()
		{
			$(this).attr('src',theSrc);
			$(this).fadeIn(500);
			$.get(theHref, function(data)
			{
				$(".orch_detail").remove();
				$("#page").append(data);
				putPrettyPhoto($("*[rel^='prettyphoto']"));
			});
		});
	});
	
	$(".listspec .spec a").remove();
	
	$(".listspec .spec").hover(function()
	{
		$(this).addClass('active');
	}, function()
	{
		$(this).removeClass('active');
	});
	
	$(".listspec .spec").click(function()
	{
		resetContent();
		loadUniq($(this).attr("rel"));
	});
}