Event.observe(window, 'load', function(){
		if($('pano')){
		  var myPano = new GStreetviewPanorama(document.getElementById("pano"));
	      fenwayPark = new GLatLng(48.621477,7.726681);
	      myPOV = {yaw:63.017031832715475,pitch:-5.9897251981999124,zoom:0};
	      myPano.setLocationAndPOV(fenwayPark, myPOV);
	 	}
	});




Event.observe(window, 'load', function() {
		var wndo = new dw_scrollObj('featured', 'slides', null);
		dw_scrollObj.GeckoTableBugFix('featured');

		$$('.jFlowControl').each(function(item){item.onclick = function(){ dw_scrollObj.scrollTo('featured',747*item.getAttribute('rel'),0); };});

		$('jFlowNext').onclick = function(){ if(Element.getStyle('slides', 'right') == '0px') dw_scrollObj.scrollTo('featured',0,0); else dw_scrollObj.scrollBy('featured',-747,0); };

		dw_scrollObj.scrollBy('featured',747,0);
		new PeriodicalExecuter(function(pe) {
			if(Element.getStyle('slides', 'right') == '0px') dw_scrollObj.scrollTo('featured',0,0); else dw_scrollObj.scrollBy('featured',-747,0);
		}, 5);
	});


Event.observe(window, 'load', function(){
	$$('div.mod_photos_diaporama').each(function(item){
		item.update('');
		item.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;' });
		item.appendChild(this.img1);
		item.appendChild(this.img2);
		new Ajax.Request('ajax.mod.photos.diaporama.php?id='+item.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='+item.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='+item.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_photos_diaporama_accueil').each(function(item){
		item.update('');
		item.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;' });
		item.appendChild(this.img1);
		item.appendChild(this.img2);
		new Ajax.Request('ajax.mod.photos.diaporama.php?id='+item.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='+item.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='+item.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);

	});


	if($('nbr_vo') && $('nbr_vn'))
		new Ajax.Request('ajax.v.stats.php?u='+(new Date()).getTime(),{
				onSuccess: function(t) {
					if(t.responseText != ""){
						var stats = t.responseText.evalJSON();
						$('nbr_vn').update(stats.vn+" en stock");
						$('nbr_vo').update(stats.vo+" en stock");
					}
				}
			});


	
});
