
function VerifNewsLetter()
{
	var FormOK
	FormOK=true

  if (document.NewsLetter.Prenom.value == "")
  {
    alert("Vous devez saisir votre Prenom.");
    document.NewsLetter.Prenom.focus();
    FormOK=false;
    return (false);
  }
  
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.";
  var checkStr = document.NewsLetter.Prenom.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Vous ne pouvez saisir ni espace ni des caractères avec accent dans le champ prenom.");
    document.NewsLetter.Prenom.focus();
    FormOK=false
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.@1234567890";
  var checkStr = document.NewsLetter.Email.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  
  if (!allValid)
  {
    alert("Vous ne pouvez saisir ni espace ni des caractères avec accent dans le champ Email.");
    document.NewsLetter.Email.focus();
    FormOK=false ;
    return (false); 
  }
  
  if (document.NewsLetter.Email.value == "")
  {
    alert("Vous devez saisir votre adresse Email.");
    document.NewsLetter.Email.focus();
    FormOK=false;
    return (false);
  }
  
  if (FormOK=true)
  {
  	Le_Prenom=document.NewsLetter.Prenom.value;
	L_Email=document.NewsLetter.Email.value;

	//popup1=window.open("/html/accueil/autres/SaveInfoNewsLetter.asp?Pr="+Le_Prenom+"&Em="+L_Email,"popup1","toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=350,height=270");
	HTTP_Requete_NewsLetter('/html/accueil/autres/SaveInfoNewsLetter.asp?Pr='+Le_Prenom+'&Em='+L_Email)
  	return (false);
  }
}

function HTTP_Requete_NewsLetter(HR_data)
{
	var HR_objethttp=null;
	var HR_urlbase=HR_data;
	var HR_retour=null;
	var elemdivnewsletter=document.getElementById('divnewsletter');
		
	if(window.XMLHttpRequest) HR_objethttp = new XMLHttpRequest();
	else if(window.ActiveXObject) HR_objethttp = new ActiveXObject("Microsoft.XMLHTTP");
	else
	{  
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
		return;
	} 
	
	HR_objethttp.open("GET", HR_urlbase , true);
	HR_objethttp.onreadystatechange = function()
	{
		if (HR_objethttp.readyState < 4)
		{
			//Display_Attente(true);
		}
		else if (HR_objethttp.readyState == 4)
		{
			elemdivnewsletter.innerHTML=unescape(HR_objethttp.responseText);
			elemdivnewsletter.style.display='block';
		}
	}
	HR_objethttp.send(null);
}



$(document).ready(function (){
	
	//SCROLL
	
	$('a[href*=#].scrollto').click(function() {
     if ((location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')) && (location.hostname == this.hostname)) {
        var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
              var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 1000);
                return false;
            } 
         }
    }); 
	
	//ANIMATION MENU
	
	$(".item").mouseover(
		function(){ 
			$(".item").stop().css('backgroundImage','url("/img/bg-item.jpg")');
			
			$(this).stop().css('backgroundImage','url("/img/bg-item-hover.jpg")');
		
			$(".item-link").stop().css('color','#fff');
			$(".item-link",this).stop().css('color','#45946a');
			
			$(".sub-menu").stop().hide();
			$(".sub-menu", this).stop().show();
			
		}
	);
	
	$(".item-left").mouseover(
		function(){ 
			$(".item").stop().css('backgroundImage','url("/img/bg-item.jpg")');
			
			$(this).stop().css('backgroundImage','url("/img/bg-item-hover-left.jpg")');
		
			$(".item-link").stop().css('color','#fff');
			$(".item-link",this).stop().css('color','#45946a');
			
			$(".sub-menu").stop().hide();
			$(".sub-menu", this).stop().show();
			
		}
	);
	
		$(".item-right").mouseover(
		function(){ 
			$(".item").stop().css('backgroundImage','url("/img/bg-item.jpg")');
			
			$(this).stop().css('backgroundImage','url("/img/bg-item-hover-right.jpg")');
		
			$(".item-link").stop().css('color','#fff');
			$(".item-link",this).stop().css('color','#45946a');
			
			$(".sub-menu").stop().hide();
			$(".sub-menu", this).stop().show();
			
		}
	);
	
	
	
	/*BLOCK ANIMATION*/
	
	$(".block").hover(
		function(){
			$(".block-hover").hide();	
			$(".block-hover", this).fadeIn();	
		},
		function(){
			$(".block-hover").hide();	
		}
	
	);	
	var text;
	
	/*SOCIAL BUTTON ANIMATION*/
	$("#social-buttons a").hover(
		function(){
			text = $(this).attr("rel");
			$("#social-text").text(text);
			
		},
		function(){
			$("#social-text").text("");	
		}
	);
	
	/*END SOCIAL BUTTON ANIMATON*/
	
	/*ANNUAIRE COMMERCANT ANIMATION*/
	
	var titre;
	
		$("#annuaireC a").hover(
			function(){
				titre = $(this).attr("rel");
				$("#iconsRel").text(titre);
			},
			function(){
				$("#iconsRel").text("");	
			}
		);
	
	/*END ANNUAIRE COMMERCANTS*/
	
	/* SHOW HIDE CONTENT*/

	
	$(".toshow").toggle(
		function(){
			$(this).next(".hide-content").slideDown();
			$(this).css("backgroundPosition","right -15px");
		},
		
		function(){
			$(this).next(".hide-content").slideUp();
			$(this).css("backgroundPosition","right 0px");		
		}
	
	);
	
	/*END SHOW HIDE CONTENT*/
	
	

	
});


function calculerLarger(){
	var nbr = $("#menu .current-item ul.sub-menu li.sub-item").size(); 
	
	 var width = ((1000 - ((nbr-1)*2)) / nbr)  ;
	
	$("#menu .current-item ul.sub-menu li.sub-item").width(width);	
}
