function precharger_images(){
	liste_image=0;
	var heavyImage= new Array();
	$$('.photo_liee_liste a').each(function(lien_image) {
		heavyImage[liste_image] = new Image(); 
		heavyImage[liste_image] = lien_image.get('alt');
		liste_image++;
	});
	
}

function afficher_zoom_photo(src_new,zoom_new, suffixe_img,id_photo_courante) {
	//$("optim_"+suffixe_img).grab("photo_apercu_"+suffixe_img);
	image=$("photo_apercu_"+suffixe_img);
	image.src = src_new;
	image.setStyle('padding','0px');
	image.removeProperties('width','height');
	lien=$("photo_zoom_"+suffixe_img);
	lien.href = zoom_new;
	if($('commentaire_'+suffixe_img)){
		//alert('commentaire='+id_photo_courante);
		lien_source=id_photo_courante.replace('photo','lien');
		commentaire=$(lien_source).get('title');
		zone_commentaire=$('commentaire_'+suffixe_img);
		zone_commentaire.set('html',commentaire);
		lien.title = commentaire;
		zone_commentaire.setStyle('bottom','-50px');
		
		zone_commentaire.set('tween', {
			duration: 500
		}).tween('bottom','3px'); 
	}
	
	//lien.injectBefore(image).adopt(image);
	/*
	$$(".div_ombre").each(function(div_ombre) {
		div_ombre.destroy();
	});
	*/
	//shadow_img2();
}

function agenda_defilant(){
	if($('contenu_evenements')){
		var nombre_items=0;
		$$('#contenu_evenements .evenement').each(function(el) {
			nombre_items++;
		});
		var marge=52;
		marge=parseInt(marge);
		
		
		marge_top=$('contenu_evenements').getStyle('margin-top');
		
		if(marge_top==undefined) marge_top=0;
		marge_top=parseInt(marge_top);
		marge_top_calcul=-(nombre_items-2)*marge;
		//alert('marge_top='+marge_top+' marge_top_calcul='+marge_top_calcul);
		if(i>2){
			if(marge_top>marge_top_calcul){
				
				nouvelle_marge=marge_top-marge;
				//alert('on bouge nouvelle_marge='+nouvelle_marge);
				$('contenu_evenements').set('tween', {
					duration: 500
				}).tween('marginTop',nouvelle_marge+'px');
				setTimeout(agenda_defilant,5000);
			}else{
				//alert('reset');
				$('contenu_evenements').set('tween', {
					duration: 500
				}).tween('marginTop','0px');
				setTimeout(agenda_defilant,3000);
			}
		}
	}
}


	function shadow_img2(){
		//var el=$('photo_apercu_786');
		 $$('.photo_cadre').each(function(el) {
			ombrer_element(el,'true');
		});
	}
		
	function ombrer_element(el,redimentionner){
		if(el.offsetWidth>0){
			
			var padding=8;
			var nombre_tours=8;
			var limite_affichage=380;
			if(redimentionner=='true'){
				taille_actuelle=el.offsetWidth;
				taille_finale=taille_actuelle-2*padding-4*nombre_tours;

				hauteur_actuelle=el.offsetHeight-2*padding;
				rapport_image=el.offsetWidth/el.offsetHeight
				hauteur_finale=taille_finale/rapport_image;
				hauteur_finale=hauteur_actuelle;
				//alert(rapport_image);
				if(taille_actuelle>limite_affichage){
					el.set('width',taille_finale);
					el.set('height',hauteur_finale);
				}else{
					taille_finale=taille_actuelle;
					hauteur_finale=taille_actuelle/rapport_image;
				}
				el.setStyle('padding',padding+'px');
				//alert('taille_actuelle='+taille_actuelle+' taille_finale='+taille_finale);	
			}else{
				taille_actuelle=el.getStyle('width').replace('px','');
				hauteur_actuelle=el.getStyle('height').replace('px','');
				taille_finale=taille_actuelle;
				hauteur_finale=hauteur_actuelle;
				el.setStyle('padding',padding+'px');
				//taille_finale=el.offsetWidth-2*padding-4*nombre_tours;
			}
		
			var destination=el;
			for (p=0;p<9;p++){
				var couleur=220+p*5;
				var taille=2*p+parseInt(taille_finale)+2*padding;
				var hauteur=2*p+parseInt(hauteur_finale)+2*padding;
				//alert(hauteur);
				var container = new Element('div').setStyles({
					border: 'solid 1px rgb('+couleur+','+couleur+','+couleur+')',
					width:taille+'px',
					height:hauteur+'px'

				}).injectBefore(destination).adopt(destination);
				container.addClass('div_ombre');
				destination=container;
			}
		}
	}
