function returnFalse() { return false; };
nbNews = 4; // POUR LES ACTUALITES
$(document).ready(function(){	
	
	var versionNav = navigator.appVersion;
	if ((screen.width < 1100) || ((navigator.appName == 'Microsoft Internet Explorer') && (versionNav.search('MSIE 6'))))	
 	{
		$('#menu').css('position','absolute');
		$('#languette').css('position','absolute');
		$('#itemOne').css('position','absolute');
		$('#itemTwo').css('position','absolute');
		$('#itemThree').css('position','absolute');
		$('#itemFour').css('position','absolute');
		$('#itemFive').css('position','absolute');
		$('#itemSix').css('position','absolute');
		$('#itemSeven').css('position','absolute');
		$('#itemHeight').css('position','absolute');
		$('#logoDrimex').css('position','absolute');
		$('#logoDrimex').css('top','550px');
	}

	if (navigator.appName == 'Microsoft Internet Explorer')
	{
		$('#menu').css('margin-left','690px');
		
	}
 
	/* -++-+-+-+-+-+-+- 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);
		}	
	 
	});	
	
	/* -+-+-+-+-+-+-+ FIN CONTACT -+-+-+-+-+-+-+ */	
	

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

/*---- PARAGRAPHE TO GROW ------ */

	var deroule = false;
	$('#agrandir').bind('click', function() {
		if (deroule == false)
		{
			deroule = true;
			theOffset= $('#footer').offset().top;
			
			$('#paragrapheToGrow').animate({height:'100%'},{queue:false, duration:2000, easing: 'easeInOutQuint'});
			$('html,body').animate({scrollTop:theOffset+'px'},1600);															 
	
		}
		else //if deroule == true
		{
			$('#paragrapheToGrow').animate({height:'140px'},{queue:false, duration:2000, easing: 'easeInOutQuint'});
			deroule = false;
		}
	});
	
	
	
	$('table.accueil td').bind('mouseenter', function() {
		$(this).fadeTo('normal', 0.8);
	});

	$('table.accueil td').bind('mouseleave', function() {
		$(this).fadeTo('normal', 1);
	});


});




