Event.observe(window, 'load', function(){
	$$('div.mod_photos_diaporama').each(function(itemPhoto){
		itemPhoto.update('');
		itemPhoto.setStyle({position:'relative'});
		this.img1 = Builder.node('img', { className:'modphotos_item', src:'', style:'display:none; position:absolute; top:0; left:0;' });
		this.img2 = Builder.node('img', { className:'modphotos_item', src:'', style:'display:none; position:absolute; top:0; left:0;' });
		itemPhoto.appendChild(this.img1);
		itemPhoto.appendChild(this.img2);
		new Ajax.Request('ajax.mod.photos.diaporama.php?id='+itemPhoto.getAttribute('rel'), 	{
			method:'post',
			asynchronous:true,
			onSuccess: function(t) {
				if(t.responseText != ""){
					var img = t.responseText.evalJSON();
					img1.src = img.src;
					img1.title = img.title;
					new Effect.Appear(img1, {duration:3,afterFinish:function(){}});
				}
			},
			onComplete: function(){},
			evalScripts:true
		});

		new Ajax.Request('ajax.mod.photos.diaporama.php?id='+itemPhoto.getAttribute('rel'), 	{
			method:'post',
			asynchronous:true,
			onSuccess: function(t) {
				if(t.responseText != ""){
					var img = t.responseText.evalJSON();
					img2.src = img.src;
				}
			},
			onComplete: function(){},
			evalScripts:true
		});
		new PeriodicalExecuter(function(pe) {
			new Ajax.Request('ajax.mod.photos.diaporama.php?id='+itemPhoto.getAttribute('rel'), 	{
				method:'post',
				asynchronous:true,
				onSuccess: function(t) {
					if(t.responseText != ""){
						var toShow = img1.visible() ? img2 : img1;
						var toMask = img1.visible() ? img1 : img2;
						var img = t.responseText.evalJSON();
						new Effect.Fade(toMask, {duration:12,afterFinish:function(){toMask.src = img.src;toMask.title = img.title;}});
						new Effect.Appear(toShow, {duration:3,afterFinish:function(){}});
					}
				},
				onComplete: function(){},
				evalScripts:true
			});
		}, 7);

	});
});

Event.observe(window, 'load', function(){
	$$('div.mod_photos_diaporama_accueil').each(function(itemPhoto){
		itemPhoto.update('');
		itemPhoto.setStyle({position:'relative'});
		this.img1 = Builder.node('img', { className:'modphotos_item', src:'', style:'display:none; position:absolute; top:0; left:0;' });
		this.img2 = Builder.node('img', { className:'modphotos_item', src:'', style:'display:none; position:absolute; top:0; left:0;' });
		itemPhoto.appendChild(this.img1);
		itemPhoto.appendChild(this.img2);
		new Ajax.Request('ajax.mod.photos.diaporama.php?id='+itemPhoto.getAttribute('rel'), 	{
			method:'post',
			asynchronous:true,
			onSuccess: function(t) {
				if(t.responseText != ""){
					var img = t.responseText.evalJSON();
					img1.src = img.src;
					img1.title = img.title;
					new Effect.Appear(img1, {duration:2,afterFinish:function(){}});
				}
			},
			onComplete: function(){},
			evalScripts:true
		});

		new Ajax.Request('ajax.mod.photos.diaporama.php?id='+itemPhoto.getAttribute('rel'), 	{
			method:'post',
			asynchronous:true,
			onSuccess: function(t) {
				if(t.responseText != ""){
					var img = t.responseText.evalJSON();
					img2.src = img.src;
				}
			},
			onComplete: function(){},
			evalScripts:true
		});
		new PeriodicalExecuter(function(pe) {
			new Ajax.Request('ajax.mod.photos.diaporama.php?id='+itemPhoto.getAttribute('rel'), 	{
				method:'post',
				asynchronous:true,
				onSuccess: function(t) {
					if(t.responseText != ""){
						var toShow = img1.visible() ? img2 : img1;
						var toMask = img1.visible() ? img1 : img2;
						var img = t.responseText.evalJSON();
						new Effect.Fade(toMask, {duration:3,afterFinish:function(){toMask.src = img.src;toMask.title = img.title;}});
						new Effect.Appear(toShow, {duration:3,afterFinish:function(){}});
					}
				},
				onComplete: function(){},
				evalScripts:true
			});
		}, 7);

	});

	
});

Event.observe(window, 'load', function(){
	$$('div.mod_actu_diaporama_accueil').each(function(item){
		item.update('');
		var param = item.getAttribute('rel').evalJSON();
		new Ajax.Request('ajax.mod.actu.diaporama.php?id='+param.actu+'&page='+param.page+'&unique='+param.unique+'&nbcar='+param.nbcar, 	{
			method:'post',
			asynchronous:true,
			onSuccess: function(t) {
				if(t.responseText != ""){
					item.update(t.responseText);
				}
			},
			onComplete: function(){},
			evalScripts:true
		});
		new PeriodicalExecuter(function(pe) {
			var param = item.getAttribute('rel').evalJSON();
			new Ajax.Request('ajax.mod.actu.diaporama.php?id='+param.actu+'&page='+param.page+'&unique='+param.unique+'&nbcar='+param.nbcar, 	{
				method:'post',
				asynchronous:true,
				onSuccess: function(t) {
					if(t.responseText != ""){
						new Effect.Fade(item, {
							duration:3,
							afterFinish:function(){
								item.update(t.responseText);
								item.appear();
							}
						});					
					}
				},
				onComplete: function(){},
				evalScripts:true
			});
		}, 7);
	});
});

Event.observe(window, 'load', function(){
	$$('div.mod_actu_diaporama_accueil_full').each(function(itemActu){
		itemActu.update('');
		var param = itemActu.getAttribute('rel').evalJSON();
		new Ajax.Request('ajax.mod.actu.diaporama2.php?id='+param.actu, 	{
			method:'post',
			asynchronous:true,
			onSuccess: function(t) {
				if(t.responseText != ""){
					itemActu.update(t.responseText);
				}
			},
			onComplete: function(){},
			evalScripts:true
		});
		new PeriodicalExecuter(function(pe) {
			var param = itemActu.getAttribute('rel').evalJSON();
			new Ajax.Request('ajax.mod.actu.diaporama2.php?id='+param.actu, 	{
				method:'post',
				asynchronous:true,
				onSuccess: function(t) {
					if(t.responseText != ""){
						new Effect.Fade(itemActu, {
							duration:3,
							afterFinish:function(){
								itemActu.update(t.responseText);
								itemActu.appear();
							}
						});					
					}
				},
				onComplete: function(){},
				evalScripts:true
			});
		}, 7);
	});
});