function affichageTotem(i, nb)
{
	var hauteur = 170;
	var position = (i * hauteur) * -1;

	if (i < nb)
	{
		// balayage
		new Effect.Move('totemInfo', { x: 0, y:position, mode: 'absolute', duration:0.6 , afterFinish: function()
		{
			new Effect.Appear('totemInfo');	
		}
		});		
		
		i++;
		
		var time = setTimeout("affichageTotem("+i+", "+nb+")", 6000);
		
	}
	
	else
	{
		i = 0;		
		new Effect.Fade('totemInfo');
		var time = setTimeout("affichageTotem("+i+", "+nb+")", 1000);
	}
	
}


function totemEnregistrer(num, champ, valeur)
{
	new Ajax.Request("/data/pouguesleseaux/site/villepouguesleseaux/module/totem/admin/save.php",
	{
		method: 'get',
		asynchronous: true,
		contentType: 'application/x-www-form-urlencoded',
		encoding: 'UTF-8',
		parameters: 
		{
			"num" : num,
			"champ" : champ,
			"valeur" : valeur
		},
			
		onSuccess: function(reponse) 
		{
			// actualise la page
			document.location.reload();						
		}		
	});
}

function totemNouveau()
{
	new Ajax.Request("/data/pouguesleseaux/site/villepouguesleseaux/module/totem/admin/create.php",
	{
		method: 'get',
		asynchronous: true,
		contentType: 'application/x-www-form-urlencoded',
		encoding: 'UTF-8',
		parameters: 
		{
			
		},
			
		onSuccess: function(reponse) 
		{
			// actualise la page
			document.location.reload();							
		}		
	});
}


function totemSupprimer(num)
{
	new Ajax.Request("/data/pouguesleseaux/site/villepouguesleseaux/module/totem/admin/delete.php",
	{
		method: 'get',
		asynchronous: true,
		contentType: 'application/x-www-form-urlencoded',
		encoding: 'UTF-8',
		parameters: 
		{
			"num" : num
		},
			
		onSuccess: function(reponse) 
		{
			// actualise la page
			document.location.reload();							
		}		
	});
}
