function changediv(id,ord) {
	$('.photodiv').fadeOut("slow", function(){
		$(".photodiv").load("fonctions/div_photo.php?id="+id, function(){
			$('.photodiv').fadeIn();
		}); 
	
	});
	
	currentPhoto = ord;
}

function changedivprevious() {
		if (currentPhoto <= 0) { currentPhoto = photos.length; }
		photoNum = currentPhoto - 1;
		changediv(photos[photoNum],photoNum);
		
}
function changedivnext() {
		if (currentPhoto >= photos.length -1) { currentPhoto = -1; }
		photoNum = currentPhoto + 1;
		changediv(photos[photoNum],photoNum);
		
}

function campchangediv(id,ord) {
	$('.photodiv').fadeOut("slow", function(){
		$(".photodiv").load("fonctions/div_photo_campagne.php?id="+id, function(){
			$('.photodiv').fadeIn();
		}); 
	
	});
	
	currentPhoto = ord;
}

function campchangedivprevious() {
		if (currentPhoto <= 0) { currentPhoto = photos.length; }
		photoNum = currentPhoto - 1;
		campchangediv(photos[photoNum],photoNum);
		
}
function campchangedivnext() {
		if (currentPhoto >= photos.length -1) { currentPhoto = -1; }
		photoNum = currentPhoto + 1;
		campchangediv(photos[photoNum],photoNum);
		
}

function changephoto(id,vue) {
	$('.contenu_diapo_photo').fadeOut("fast", function(){
		$(".contenu_diapo_photo").load("fonctions/div_photo_contenu.php?id="+id+"&vue="+vue, function(){
			$('.contenu_diapo_photo').fadeIn("fast");	
		
		}); 
	});
	

}

function displayinfos() 
{
	if ($('.infos').css('display') == 'none') 
	{	
		$('.infos').slideDown();
	} 
	else 
	{
		$('.infos').slideUp();
	}
}

function collection() 
{
	if ($('.collection').css('display') == 'none') 
	{	
		$('.collection').slideDown();
	} 
	else 
	{
		$('.collection').slideUp();
	}
}

function displayinf() {	$('.infos').slideDown();}
function hideinf() {	$('.infos').slideUp();	}

$(function() {
			$("div#makeMeScrollable").smoothDivScroll({scrollingSpeed: 10, mouseDownSpeedBooster: 3, autoScroll: "", autoScrollDirection: "backandforth", autoScrollSpeed: 1, visibleHotSpots: "always"});
			
		});	
		
	
function limite(textarea, max)
{
    if(textarea.value.length >= max)
    {
        textarea.value = textarea.value.substring(0,max);
    }
    var reste = max - textarea.value.length;
    var affichage_reste =  '('+ reste +')';
   document.getElementById('max_desc').innerHTML = affichage_reste;
}

function displaynl() 
{
	if ($('.newsletter').css('display') == 'none') 
	{	
		$('.newsletter').slideDown();
	} 
	else 
	{
		$('.newsletter').slideUp();
	}
}
