	function returnFalse() { return false; };
nbNews = 2; // POUR LES ACTUALITES
$(document).ready(function(){	
	
 
 	$(function() { $(".lavaLamp").lavaLamp({ fx: "easeOutExpo", speed: 700 })});

	// ***** PROMO BOX LEFT
	$('#promoLeft').children('.text').slideUp(2, 'easeInExpo');
	
	$('#promoLeft').mouseenter(function(){
		$(this).children('.text').slideDown('fast', 'easeOutExpo');							  
	});
	
	$('#promoLeft').mouseleave(function(){
		$(this).children('.text').slideUp('fast', 'easeInExpo');							  
	});
	
	// ***** PROMO BOX RIGHT
	$('#promoRight').children('.text').slideUp(2, 'easeInExpo');
	
	$('#promoRight').mouseenter(function(){
		$(this).children('.text').slideDown('fast', 'easeOutExpo');							  
	});
	
	$('#promoRight').mouseleave(function(){
		$(this).children('.text').slideUp('fast', 'easeInExpo');							  
	});
	
	// ***** PROMO BOX CENTER
	$('#promoCenter').children('.text').slideUp(2, 'easeInExpo');
	
	$('#promoCenter').mouseenter(function(){
		$(this).children('.text').slideDown('fast', 'easeOutExpo');							  
	});
	
	$('#promoCenter').mouseleave(function(){
		$(this).children('.text').slideUp('fast', 'easeInExpo');							  
	});	

	/* -++-+-+-+-+-+-+- CONTACT FORM +-+-+-++-+-+- */
	
	$('#submit .button').bind('click', returnFalse);
	var nom = false;
	var postal = false;
	var emailFrom = false;
	
	$('#txtName').blur(function(){
		if ($('#txtName').val() == '')
		{
			$('#alertName').append('<p class="red">* Veuillez indiquer vos nom et prénom </p>');
			nom = false;
		}
		else {
			$('#alertName').append('<p class="green">* Champ nom et prénom valide </p>');	
			nom = true;
		}		

		if (emailFrom && nom && postal)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});


	$('#txtPostal').blur(function(){
		if ($('#txtPostal').val() == '')
		{
			$('#alertPostal').append('<p class="red">* Veuillez indiquer le code postal</p>');	
			postal = false;
		}
		else {
			$('#alertPostal').append('<p class="green">* Champ code postal valide</p>');	
			postal = true;
		}		

		if (emailFrom && nom && postal)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});


	var filter=/^.+@.+\..{2,3}$/;
	$('#txtEmailFrom').blur(function(){
		if ($('#txtEmailFrom').val() == '')
		{
			$('#alertEmailFrom').append('<p class="red">* Veuillez indiquer votre email</p>');	
			emailFrom = false;
		}
		else if (filter.test($('#txtEmailFrom').val())) {
			$('#alertEmailFrom').append('<p class="green">*  Champ email complet</p>');	
			emailFrom = true;
		}
		else {
			$('#alertEmailFrom').append('<p class="orange">* Rentrer une adresse email valide svp</p>');	
			emailFrom = false;
		}		
		
		if (emailFrom && nom && postal)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});

	$('#txtEmailFrom').focus(function(){
		$('#alertEmailFrom').empty();	
	});	
	
	$('#txtName').focus(function(){
		$('#alertName').empty();	
	});		

	$('#txtPostal').focus(function(){
		$('#alertPostal').empty();	
	});	


	$('#submit .button').click(function(){
		if (emailFrom && nom && postal)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	 
	});	
	
		$('#leftContainerHome a').bind('click', returnFalse);
		
		$("#rightContainer2").hide('slow');
		$("#rightContainer3").hide('slow');
		$("#rightContainer4").hide('slow');
		$("#rightContainer5").hide('slow');
		$("#rightContainer6").hide('slow');
		$("#rightContainer7").hide('slow');
	
	$('#leftContainer1 a').click(function(){
	
		$("#rightContainer1").show('slow');
	
		$("#rightContainer2").hide('slow');
		$("#rightContainer3").hide('slow');
		$("#rightContainer4").hide('slow');
		$("#rightContainer5").hide('slow');
		$("#rightContainer6").hide('slow');
		$("#rightContainer7").hide('slow');
		
		
	});

	$('#leftContainer2 a').click(function(){
	
		$("#rightContainer2").show('slow');
	
		$("#rightContainer1").hide('slow');
		$("#rightContainer3").hide('slow');
		$("#rightContainer4").hide('slow');
		$("#rightContainer5").hide('slow');
		$("#rightContainer6").hide('slow');
		$("#rightContainer7").hide('slow');
				
	});

	$('#leftContainer3 a').click(function(){
	
		$("#rightContainer3").show('slow');
	
		$("#rightContainer1").hide('slow');
		$("#rightContainer2").hide('slow');
		$("#rightContainer4").hide('slow');
		$("#rightContainer5").hide('slow');
		$("#rightContainer6").hide('slow');
		$("#rightContainer7").hide('slow');
		
	});

	$('#leftContainer4 a').click(function(){
	
		$("#rightContainer4").show('slow');
	
		$("#rightContainer1").hide('slow');
		$("#rightContainer2").hide('slow');
		$("#rightContainer3").hide('slow');
		$("#rightContainer5").hide('slow');
		$("#rightContainer6").hide('slow');
		$("#rightContainer7").hide('slow');
		
	});

	$('#leftContainer5 a').click(function(){
	
		$("#rightContainer5").show('slow');
	
		$("#rightContainer1").hide('slow');
		$("#rightContainer2").hide('slow');
		$("#rightContainer3").hide('slow');
		$("#rightContainer4").hide('slow');
		$("#rightContainer6").hide('slow');
		$("#rightContainer7").hide('slow');
		
	});

	$('#leftContainer6 a').click(function(){
	
		$("#rightContainer6").show('slow');
	
		$("#rightContainer1").hide('slow');
		$("#rightContainer2").hide('slow');
		$("#rightContainer3").hide('slow');
		$("#rightContainer4").hide('slow');
		$("#rightContainer5").hide('slow');
		$("#rightContainer7").hide('slow');
		
	});

	$('#leftContainer7 a').click(function(){
	
		$("#rightContainer7").show('slow');
	
		$("#rightContainer1").hide('slow');
		$("#rightContainer2").hide('slow');
		$("#rightContainer3").hide('slow');
		$("#rightContainer4").hide('slow');
		$("#rightContainer5").hide('slow');
		$("#rightContainer6").hide('slow');
		
	});


// +-+-+-+-+-+-+-+- TOP IMAGE 	
	var liNumero = 1;
	var currentTopImage = $('#imageTopImage01');
	var direction = 'next';
	var timer = setInterval (function () {
		
		if ($('.secteursEquipes li#numero'+liNumero).next('.secteursEquipes li').attr('id') != '')							   
		{	
			$('.secteursEquipes li#numero'+liNumero).animate({marginTop:'-=204px'},{queue:false, duration:1000, easing: 'easeInOutQuint'});
			liNumero++;
		}
		else {
		liNumero = liNumero*112;
		$('.secteursEquipes li.defilant').animate({marginTop:'+='+204},{queue:false, duration:1000, easing: 'easeInOutQuint'});
		liNumero = 1;
		}
	}, 2000 );

	
// +-+-+-+-+-+- LIST PAGE
	$('#items h4').mouseenter(function(){
		$(this).fadeTo('fast',0.6);							  
	});
	
	$('#items h4').mouseleave(function(){
		$(this).fadeTo('fast',1);							  
	});


			$('.textItem').hide();
			$('#item1').slideDown('slow');
			$('#items h4').click(function() {

				if ($(this).next('.textItem:visible').length != 0)
				{
					$('.textItem').stop().slideUp('fast');
					$(this).next('.textItem').stop().slideUp('slow');
				}			
				else 
				{
					$('.textItem').stop().slideUp('fast');
					$(this).next('.textItem').stop().slideDown('slow');
				}
			});
		
			derouleOnce = false;
			$('#nuancierCouleurs').hide();
			$('#nuancierH2').click(function() {
				if (derouleOnce == true) {
					$('#nuancierCouleurs').stop().slideUp('slow');
					$('#nuancierH2 img').attr('src','images-realisations-verandas/palette.jpg');
					derouleOnce = false;
				}
				else {
					theOffset= $('#footer').offset().top;
					$('#nuancierH2 img').attr('src','images-realisations-verandas/palette-bas.jpg');				
					derouleOnce = true;
					$('#nuancierCouleurs').stop().show('fast', function() {																		 
						$('html,body').stop().animate({scrollTop:theOffset+'px'});															 
					});					
					$('#nuancierH2 img').attr('src','images-realisations-verandas/palette-bas.jpg');
				}
											
				return false;
			});
			
			
			$('#nuancierH2').mouseover(function() {
					$('#nuancierH2 img').attr('src','images-realisations-verandas/palette-bas.jpg');					
			});
			
			$('#nuancierH2').mouseout(function() {
					if(derouleOnce == false)
					{
					$('#nuancierH2 img').attr('src','images-realisations-verandas/palette.jpg');					
					}
			});	
			
	var nombre = 1;		
	var theNews = $('.theNews').attr('id');

	while($('#'+theNews).next('.theNews').attr('class') != null)
	{
		nombre++;
		theNews = $('#'+theNews).next('.theNews').attr('id');
	}

/* ACTUALITES */	
	marginTopNews = (nbNews-2)*140+1;
	$('#nextActu').bind('click', function () {
		var marginTop = $('#insideActu').css('margin-top');
		marginTop = marginTop.substring(0 , marginTop.length - 2);
		if ( marginTop > -marginTopNews)
		{
			$('#insideActu').animate({marginTop:'-=140px'},{queue:false, duration:1000, easing: 'easeInOutQuint'});
		}
		
	});			
	$('#previousActu').bind('click', function () {
		var marginTop = $('#insideActu').css('margin-top');
		marginTop = marginTop.substring(0 , marginTop.length - 2);
		if ( marginTop < -100)
		{
			$('#insideActu').animate({marginTop:'+=140px'},{queue:false, duration:1000, easing: 'easeInOutQuint'});
		}		
	});			
			
/* FIN ACTUALITES */

var hauteurBody = $('#footer').offset().top + 100;
	
	$('#bottomH1').css('margin-top', hauteurBody);
	

	
	/*	$('#items a').bind('click', function() {
			returnFalse;
			var whatToLoad = $(this).attr('class');
			$('#loading').fadeTo('fast', 0.8);
			
			$('#enSavoirPlus').load('ensavoirplus.htm #'+whatToLoad, function(){
				$('#enSavoirPlus').show(600);
				$('#loading').fadeTo('fast',0); 
			});
			$(this).attr('href','#mosaique-projets');
			
	});
	*/
	
	$('.legendeVeranda').stop().slideUp(2, 'easeInExpo');	
	$('#slideshowVeranda img').bind('mouseenter', function(){
			$('.legendeVeranda').stop().slideUp(2, 'easeInExpo');															   	
			var whichImage = $(this).attr('class');
			$('#'+whichImage+'Legende').stop().slideDown(180, 'easeOutBack');									   													
	});
	$('#slideshowVeranda img').bind('mouseleave', function(){
			var whichImage = $(this).attr('class');
			$('#'+whichImage+'Legende').stop().slideUp(180, 'easeInBack');									   													
	});
	
	
	$('#loadvun').click(returnFalse);
	$('#loadvdeux').click(returnFalse);
	$('#close').click(returnFalse);
	$('#loadvun').bind('click',function () {
		$('#visiteVirtuelle').load('v1.php #vun', function(){
					var panoflash = new SWFObject( "visitesVirtuelles/visite1/pano.swf", "panoflash", "800", "600", "10", "#ffffff" );
                    panoflash.addParam( "allowfullscreen", "true" );
                    panoflash.addParam( "scale", "exactfit" );
                    panoflash.addParam( "base", "visitesVirtuelles/visite1/" );
                    panoflash.addParam( "wmode", "transparent" );
                    panoflash.write( "panoflash");
				
					$('#fondNoir').fadeIn(1000);$('#visiteVirtuelle').fadeIn(1000);
		
		});
	});	
	
	$('#loadvdeux').bind('click',function () {
		$('#visiteVirtuelle').load('v2.php #vdeux', function(){
	                var panoflash = new SWFObject( "visitesVirtuelles/visite2/pano.swf", "panoflash", "800", "600", "10", "#ffffff" )
                    panoflash.addParam( "allowfullscreen", "true" )
                    panoflash.addParam( "scale", "exactfit" )
                    panoflash.addParam( "base", "visitesVirtuelles/visite2/" )
                    panoflash.addParam( "wmode", "transparent" )
                    panoflash.write( "panoflash")
				
					$('#fondNoir').fadeIn(1000);$('#visiteVirtuelle').fadeIn(1000);
		
		});
	});	
	
		$('#close').bind('click',function () {
			$('#fondNoir').fadeOut(500);
			$('#visiteVirtuelle').fadeOut(500);
			$('#panoflash').fadeOut(500);
		});


/*		$.keypress(function(event) {
			if(event.keyCode == '1')
			{
				$('#fondNoir').fadeOut(500);
				$('#visiteVirtuelle').fadeOut(500);
				$('#panoflash').fadeOut(500);
			}
		});
*/

$('#menu-principal li').bind('mouseenter', function() {
	$(this).fadeTo('fast', 0.8);
});	
$('#menu-principal li').bind('mouseleave', function() {
	$(this).fadeTo('fast', 1);
});	

	$('.lienCarte img').bind('click', returnFalse);
	$('.lienCarte').bind('mouseenter', function() { 
		$('.legendeCarte').slideUp('fast', 'easeOutExpo');										
		$(this).next('img').attr('src','salon-des-vins/repere-carte-over.png');
		$(this).next('.legendeCarte').slideDown('slow', 'easeOutExpo');
	});



});


