$(function(){

   	/*  page index background image */
	   	
			$('#background').cycle({
				fx:    'fade',
				speed: 1500, 
				delay:  -2000
			});
			
	/*  fin page index background image */
	   	
	/*  page index - encadré programmes neufs */
				
		$('#programmes_immobiliers_neufs').cycle({ 
			fx:    'fade', 
			speed:  1300,
			before:onBefore
		});
		
		$('#programmes_a_la_carte').cycle({
				fx:    'fade',
				speed: 1300
		});
		
		$('#terrains_a_batir').cycle({
				fx:    'fade',
				speed: 1300
			});
		
		$('#dernieres_realisations').cycle({ 
			prev:   '#prev', 
		    next:   '#next', 
		    timeout: 1200,
		    before:onBefore2
		});
		
	/*  page index - encadré programmes neufs */
	

	
		
		function onBefore() {
			var idprogramme = this.id;
			var nomProgramme = $(this).attr('title');
			var nomProgrammeLien = $(this).attr('alt');
			var departement = $(this).attr('departement');
		
			/* affiche département:nomduprogramme, désactivé mais marche
			var aHref = "<a href='index.php?page=display_programmes_details&idprogramme="+idprogramme+"'>"+departement+":"+nomProgramme+"</a>";*/
			
			var aHref = "<a href='programmes_immobiliers_details/"+nomProgrammeLien+".html'>"+nomProgramme+"</a>";
			var imgHref = "programmes_immobiliers_details/"+nomProgrammeLien+".html";
			
			$('#programme-immobilier').html(aHref);
			$(this).click(function(){
				top.location=imgHref;
			})
		}; 
		
		function onBefore2() {
			var nomProgramme = $(this).attr('title');
			var descriptif = $(this).attr('descriptif');
			var ville = $(this).attr('ville');
			var annee = $(this).attr('annee');
			
			$('#nom_dernieres_realisations').html(nomProgramme);
			$('#descriptif').html(descriptif);
			$('#ville').html(ville);
			$('#annee').html(annee);
			
			$(this).click(function(){
				top.location='programmes_immobiliers/dernieres_realisations.html';
			})
		}; 
			
	
	   return false;
	}); 
	



