var Navigateur = navigator.appName;

if(Navigateur == "Microsoft Internet Explorer")
	var ie = true;
else
	var ie = false;



var IE6 = false 

var strChUserAgent = navigator.userAgent; 
var intSplitStart = strChUserAgent.indexOf("(",0); 
var intSplitEnd = strChUserAgent.indexOf(")",0); 
var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd); 

if(strChMid.indexOf("MSIE 6") != -1) IE6 = true;

var IE7 = false 

var strChUserAgent = navigator.userAgent; 
var intSplitStart = strChUserAgent.indexOf("(",0); 
var intSplitEnd = strChUserAgent.indexOf(")",0); 
var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd); 

if(strChMid.indexOf("MSIE 7") != -1) IE7 = true;


var IE8 = false 

var strChUserAgent = navigator.userAgent; 
var intSplitStart = strChUserAgent.indexOf("(",0); 
var intSplitEnd = strChUserAgent.indexOf(")",0); 
var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd); 

if(strChMid.indexOf("MSIE 8") != -1) IE8 = true;


function file(fichier)
{
	if(window.XMLHttpRequest) // FIREFOX
	  xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // IE
	  xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else 
	  return(false); 
	xhr_object.open("GET", fichier, false); 
	xhr_object.send(null); 
	if(xhr_object.readyState == 4) return(xhr_object.responseText);
	else return(false);
}


function popup(href, id, w, h, r, s) {
	window.open(href, id, 'width='+(parseInt(w)+20)+',height='+(parseInt(h)+20)+',resizable='+r+',scrollbars='+s+',toolbar=0,directories=0,status=0,menubar=0');
}

function affectPrix(bon_achat_id,valeur,panier,ports)
{
	if(panier>0)
	{
		if(document.getElementById(bon_achat_id).checked)
		{
			texte = file('/ajax/ajax_ba.php?bon_achat_id='+ bon_achat_id);
			if(texte=="ok")
			{
				document.getElementById(bon_achat_id).checked=true;
				$('total').innerHTML=Math.round((parseFloat(panier) - parseFloat(valeur))*100)/100;
			}
			else if(texte=="ok2")
			{
				//document.getElementById(bon_achat_id).disabled=true;
				//$('total').innerHTML=Math.round((parseFloat(panier) - parseFloat(valeur))*100)/100;
				$('total').innerHTML=ports;
				
				erreur_ba = file('/ajax/ajax_txt.php?erreur_ba=1');
				alert(erreur_ba);
			}
			else
			{
				document.getElementById(bon_achat_id).checked=false;
				alert(texte);
			}
		}
		else
		{
			texte = file('/ajax/ajax_ba.php?del=1&bon_achat_id='+ bon_achat_id);
			$('total').innerHTML=panier;
		}
	}
	else
	{
		alert("Le montant de votre panier est nul, vous ne pouvez pas utiliser vos bons d'achat");		
	}
}

function SecureConfirm(obj)
{
	if(confirm('Voulez-vous supprimer votre adresse du carnet ?')) {
		obj.submit();
	}else{
		return false;
	}
}



function envoyerami(obj)
{
		new Ajax(
		'/ajax/envoyerami.php',
		{
			method: 'post',
			data:$(obj).toQueryString(),
			onComplete: function(req) {
				arr = req.split('|');
				if(arr[0] == 'ok')
				{
					$('rollamis').style.display = "none";
					document.forms['send_friend'].reset();
				}

				alert(arr[1]);
			},			
			evalScripts: true
		}
	).request();
}

function ActionSelect(Objet){  
	var val = Objet.value.toLowerCase();       
	var dest;        
	switch(val){            
		case "nouvelle_adresse" :                
			dest="/account_address_book.html?cmd=add&amp;origin=panier";                
			break;            
		default:                
			return false;            
	}        
	location.href=dest;
}



function showHide(id) {
	
	var obj = document.getElementById(id);

	if (obj.style.display == 'inline')
	{
		obj.style.display = 'none'
	}else{
		obj.style.display = 'inline'
	}	
	
}

var curForm = false;

function addNewsletter(obj)
{
	
	curForm = obj;
	new Ajax(
		obj.action,
		{
			data:$(obj).toQueryString(),
			onComplete: function(txt)
			{
				alert(txt);
				curForm.reset();
			}
		}
	).request();
}



function displayError(txt)
{
	alert(txt);	
	if(txt.indexOf('notre') != -1)
		curForm.reset();
}




function check_add_panier(toto)
{
	if(!toto)
		nVarNom = prompt("Entrez un nom pour votre panier :");
	else
		nVarNom = prompt("Vous devez entrer un nom pour votre panier :");
		
	if(nVarNom != null) //check_add_panier('toto')
	{
		if(!nVarNom)
			check_add_panier('toto');
		else
		{
			document.forms['savepanier'].elements['panier_nom'].value = nVarNom;	
			document.forms['savepanier'].submit();	
		}
			
		
	}
		
		//document.forms['savepanier'].submit();	
}


var fondDiv = false;
var dataDiv = false;

function addPanier(idForm)
{
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '500px',
	   height: '250px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-250px',	   
	   marginTop: (getScrollTop()-125) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	new Ajax(
		'/panier-change-ajax.php',
		{
			method: 'get',
			update: dataDiv,
			data:$(idForm).toQueryString() + '&' + $('majimage').toQueryString(),
			onSuccess: function(req) {
				$$(fondDiv).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				$$('select.visiblect').setStyles({visibility: 'visible' });				
				$$(dataDiv).setStyles({visibility: 'visible' });

				new Ajax(
					'/ajax/updatePanier.php',
					{
						update: $('spanpan')
					}
				).request();
				
			},
			evalScripts: true
		}
	).request();
	
}


function removeDivPanier()
{
	if(fondDiv){
		$(fondDiv).remove();
		fondDiv = false;
	}	

	if(dataDiv){
		$(dataDiv).remove();
		dataDiv = false;
	}	
	
	$$('select').setStyles({visibility: 'visible' });		
}


function checkEtape(status,obj)
{
	//alert(status+' '+obj);
	//alert($(obj).toQueryString());

	
	if(status)
	{
		if($('verifcote'))
		{
			checkCote($('verifcote').value, obj);
		}	
		else
		{
			obj.submit();
		}
	}
	
}

var ministatus = false;

function checkCote(what, form) {
	
	
	new Ajax(
		'/ajax/checkcote.php',
		{
			method: 'post',
			data:$('form_etape3').toQueryString() + '&what='+ what,
			onComplete: function(req) {
				
				req = req.split('|');
				
				if(req[0] == 'ok')
				{
					form.submit();
				}
				else
				{
					alert(req[1]);
				}
			},
			evalScripts: true
		}
	).request();
}

function processPanier(v, id){ 
	
	var save = document.getElementById('qte'+id).value;

	if (v == "plus") {
		document.getElementById('qte'+id).value = parseInt(save,10) + 1; 
	}else{
		document.getElementById('qte'+id).value = save-1; 

	}
}


function updatePrixTableau(obj){
	new Ajax(
		'/ajax/prixtableau.php',
		{
			method: 'post',
			update: $('prix_final'),
			data:$('produit').toQueryString(),
			evalScripts: true
		}
	).request();
}

function updatePrix(obj){
	
	
	new Ajax(
		'/ajax/updateprix.php',
		{
			method: 'post',
			update: $('prix_final'),
			data:$('produit').toQueryString(),
			evalScripts: true
		}
	).request();
}

function updatePrixTableau2(obj){
	if(isNaN(obj.value))
		obj.value=1;	
	else
	{	
		new Ajax(
			'/ajax/prixtableau.php',
			{
				method: 'post',
				update: $('prix_final'),
				data:$('produit').toQueryString(),
				evalScripts: true
			}
		).request();
	}
}

function updatePrix2(obj){

	if(isNaN(obj.value))
		obj.value=1;	
	else
	{
		new Ajax(
			'/ajax/updateprix.php',
			{
				method: 'post',
				update: $('prix_final'),
				data:$('produit').toQueryString(),
				evalScripts: true
			}
		).request();
	}
}



function show(obj,what)
{
	

	
	
	if($(what)) {
		$(what).style.top = (obj.offsetTop-3)+"px";
		$(what).style.left = "6px";		
		$(what).style.display = "block";		
		
	}
		
}

function hide(what)
{
	if($(what))
		$(what).setStyles({display: 'none' });
}

function switchdis(id)
{
	if($(id+'_qte').disabled == true)
	{
		$(id+'_qte').value = 1;
		$(id+'_qte').disabled = '';
		$(id+'_qte').onchange();
	}
	else
	{
		$(id+'_qte').value = 0;
		$(id+'_qte').disabled = 'disabled';
		$(id+'_qte').onchange();
	}

}

function blocksite() {
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '395px',
	   height: '308px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-250px',	   
	   marginTop: (getScrollTop()-154) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});	
	
	new Ajax(
		'/ajax/blocksite.php',
		{
			method: 'get',
			update: dataDiv,
			data:"",
			onSuccess: function(req) {
			
				$$(fondDiv).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				$$('select.visiblect').setStyles({visibility: 'visible' });				
				$$(dataDiv).setStyles({visibility: 'visible' });


				
			},
			evalScripts: true
		}
	).request();		
}


function switchretombee(id)
{
	if(id == 116)
	{
		$('retombee-div').style.display = 'block';
		$('produit_taille_retombee').disabled = '';
	}
	else
	{
		$('retombee-div').style.display = 'none';
		$('produit_taille_retombee').disabled = true;
	}
}

function verifEsc(id)
{
	arrArt = $$('#produit_esc_id2 option');
	arrArt_beta = $$('#produit_esc_id_beta option');

	numArt = arrArt.length;
	numArt2 = arrArt_beta.length;
		
	if(id == 140 || id == 141 || id == 152)
	{
		
			document.getElementById('produit_esc_id2').options.length = 0;
			var obj = document.getElementById('produit_esc_id2');

			for(i=0;i < numArt2;i++)
			{
				if(arrArt_beta[i].value != '151')
					obj.options[obj.options.length] = new Option(arrArt_beta[i].text,arrArt_beta[i].value);
			}


	}
	else
	{

			document.getElementById('produit_esc_id2').options.length = 0;
			var obj = document.getElementById('produit_esc_id2');

			for(i=0;i < numArt2;i++)
			{
				obj.options[obj.options.length] = new Option(arrArt_beta[i].text,arrArt_beta[i].value);
			}


	}
}

function verifEsc2(id)
{
	
	if(id == 140 || id == 141 || id == 152)
	{
		$('esc_151').style.display = 'none';
		$('aucun_150').checked = true;
	}
	else
	{
		$('esc_151').style.display = 'block';	
	}

}

function switch_adr_livr_fac(obj)
{
	if(obj.checked == true)
	{
		
		$('co_fact_add').style.display="block";
	
		arrinput = $$('#adresse_factu_table input');

		for(i=0;i < arrinput.length;i++)
		{
			arrinput[i].disabled=false;
		}		
		
		arrinput = $$('#adresse_factu_table select');

		for(i=0;i < arrinput.length;i++)
		{
			arrinput[i].disabled=false;
		}	
		
	}
	else
	{
		
		
		$('co_fact_add').style.display="none";
		
		arrinput = $$('#adresse_factu_table input');

		for(i=0;i < arrinput.length;i++)
		{
			arrinput[i].disabled=true;
		}		
		
		arrinput = $$('#adresse_factu_table select');

		for(i=0;i < arrinput.length;i++)
		{
			arrinput[i].disabled=true;
		}		
		
		
		// INIT DES VALEURS IDENTIQUE
		$('civilite_id1').value = $('civilite_id').value;
		$('adresse_societe1').value = $('adresse_societe').value;
		$('adresse_nom1').value = $('client_nom').value;
		$('adresse_prenom1').value = $('client_prenom').value;
		$('adresse_rue1').value = $('adresse_rue').value;
		$('adresse_rue21').value = $('adresse_rue2').value;
		$('adresse_cp1').value = $('adresse_cp').value;
		$('adresse_ville1').value = $('adresse_ville').value;
		$('pays_id1').value = $('pays_livr').value;		
		

		
		
	}
	
	obj.disabled = false;	
}

function checkcorse(valeur){
	
	if(valeur.substr(0,2) == '20' || valeur.substr(1,1) == 'A' || valeur.substr(1,1) == 'B') { 
		document.getElementById('pays_livr').value='81'; 
		document.forms['coordonnees'].flag.value='1';
		document.forms['coordonnees'].submit();
	}
}

function affiche_account() {
	$('account_roll').style.display = "inline";
	var posX = $('compte_lol').offsetLeft;
	var posY = $('compte_lol').offsetTop;
	//alert(posY);
	if(IE7 || IE6) {
		posY = posY+8;
	}else{
		posY = posY-1;
	}
	posX = posX-6;
	
	$('account_roll').style.top = posY+"px";
	$('account_roll').style.left = posX+"px";
}

function cache_account() {
	//$('account_roll').style.display = "none";
	//setTimeout('cache_account_real()', 1000);
	cache_account_real();
}

function cache_account_real() {
	$('account_roll').style.display = "none";
	//setTimeout('cache_account()', 5000);
}

function trim (myString){
	return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
} 

function changeongletimg(id_li) {
	
	
	if($("onglet_index").className != "accueil accueil_actif") {
		$("onglet_index").style.background="transparent url('/styles/images/header/onglet_accueil.png') no-repeat top left";
		$("onglet_index_a").style.color="#4c4c4c";
	}
	
	if($("onglet_promo").className != "promo promo_actif") {
		$("onglet_promo").style.background="transparent url('/styles/images/header/promotion.png') no-repeat top left";
	} else {
		$("onglet_promo").style.background="transparent url('/styles/images/header/promotion_over.png') no-repeat top left";
	}
	
	var s = new Array();
  if (document.getElementsByClassName) {
      s = document.getElementsByClassName("catparent");
  }
  else { //cas special IE car n'implemente pas la fonction getElementsByClassName
      elm = document.getElementsByTagName('li');
      for (var i = 0; i < elm.length; i++) {
          if (trim(elm[i].className) == "catparent") {
              s.push(elm[i]);
              
          }
      }
  }	
  for (var i = 0; i < s.length; i++) {
    if(s[i].className!='catparent actif'){
    	s[i].style.background="transparent url('/styles/images/header/onglet.png') no-repeat top left";
    } else {
    	s[i].style.background="transparent url('/styles/images/header/onglet_hover.png') no-repeat top left";
    }
  }	
  

	var t = new Array();
  if (document.getElementsByClassName) {
      t = document.getElementsByClassName("catparent_a");
  }
  else { //cas special IE car n'implemente pas la fonction getElementsByClassName
      elm = document.getElementsByTagName('a');
      for (var i = 0; i < elm.length; i++) {
          if (trim(elm[i].className) == "catparent_a") {
              t.push(elm[i]);
          }
      }
  }	
  for (var i = 0; i < t.length; i++) {
  	
  	if(t[i].className!="catparent_a actif"){
      t[i].style.color="#4c4c4c";
    } else {
    	t[i].style.color="#876505";
    }
  }	
	
	if(id_li == "onglet_promo"){
		$(id_li).style.background="transparent url('/styles/images/header/promotion_over.png') no-repeat top left";
	} else {
		$(id_li).style.background="transparent url('/styles/images/header/onglet_hover.png') no-repeat top left";
		$(id_li+"_a").style.color="#876505";
	}
	
	if(trim($(id_li).className) == "accueil" || $(id_li).className == "accueil accueil_actif") {	
		$(id_li).style.background="transparent url('/styles/images/header/onglet_accueil_actif.png') no-repeat top left";
		$(id_li+"_a").style.color="#876505";
	}
	
	if($(id_li+"_sm")) $(id_li+"_sm").style.display="block";
	
	
}


function delongletimg(id_li) {
	
	if($("onglet_index").className != "accueil accueil_actif") {
		$("onglet_index").style.background="transparent url('/styles/images/header/onglet_accueil.png') no-repeat top left";
		$("onglet_index_a").style.color="#4c4c4c";
	}else{
		$("onglet_index").style.background="transparent url('/styles/images/header/onglet_accueil_actif.png') no-repeat top left";
		$("onglet_index_a").style.color="#876505";		
	}
	
	if($("onglet_promo").className != "promo promo_actif") {
		$("onglet_promo").style.background="transparent url('/styles/images/header/promotion.png') no-repeat top left";
	}else{
		$("onglet_promo").style.background="transparent url('/styles/images/header/promotion_over.png') no-repeat top left";		
	}
	
	var s = new Array();
  if (document.getElementsByClassName) {
      s = document.getElementsByClassName("catparent");
  }
  else { //cas special IE car n'implemente pas la fonction getElementsByClassName
      elm = document.getElementsByTagName('li');
      for (var i = 0; i < elm.length; i++) {
          if (trim(elm[i].className) == "catparent") {
              s.push(elm[i]);
          }
      }
  }	
  for (var i = 0; i < s.length; i++) {
    if(s[i].className!='catparent actif'){
    	s[i].style.background="transparent url('/styles/images/header/onglet.png') no-repeat top left";
    } else {
    	s[i].style.background="transparent url('/styles/images/header/onglet_hover.png') no-repeat top left";
    }
  }	
  
	var t = new Array();
  if (document.getElementsByClassName) {
      t = document.getElementsByClassName("catparent_a");
  }
  else { //cas special IE car n'implemente pas la fonction getElementsByClassName
      elm = document.getElementsByTagName('a');
      for (var i = 0; i < elm.length; i++) {
          if (trim(elm[i].className) == "catparent_a") {
              t.push(elm[i]);
          }
      }
  }	
  for (var i = 0; i < t.length; i++) {
  	
  	if(t[i].className!="catparent_a actif"){
      t[i].style.color="#4c4c4c";
    } else {
    	t[i].style.color="#876505";
    }
  }	
}


function affiche_sous_menu(li_id,my_id) {
	
	if(my_id < 6){
		var posX = 173;
		var posY = 70;

		if(IE6) {
			
			posY = 70;		
			posX = 187;		
			
		}else if(IE7) {
			posY = posY;		
			posX = 183;
		}else{
			posY = posY;		
			posX = posX;
		}
	} else {
		var posX = 216;
		var posY = 30;

		if(IE6) {
			
			posY = 30;		
			posX = 230;		
			
		}else if(IE7) {
			posY = posY;		
			posX = 226;
		}else{
			posY = posY;		
			posX = posX;
		}
	}
	
		$(li_id+'_conteneur').style.top = posX+"px";
		$(li_id+'_conteneur').style.left = posY+"px";	
		$(li_id+'_conteneur').style.display = "inline";
}

function cache_sous_menu(li_id) {
	$(li_id+'_conteneur').style.display = "none";
}



function affiche_panier() {
	$('panier_roll').style.display = "inline";
	var posX = 789;
	var posY = 129;
	//alert(posY);
	if(IE7 || IE6) {
		posY = posY+9;
	}else{
		posY = posY;
	}
	posX = posX;
	
	$('panier_roll').style.top = posY+"px";
	$('panier_roll').style.left = posX+"px";
	
	
	$('panier_roll2').style.display = "inline";
	var posX = 369;
	var posY = 177;
	//alert(posY);
	if(IE7 || IE6) {
		posY = posY+8;
	}else if(IE8){
		posY = posY;
	}
	
	posY = posY;
	posX = posX;
	
	$('panier_roll2').style.top = posY+"px";
	$('panier_roll2').style.left = posX+"px";	
}

function cache_panier() {
	$('panier_roll').style.display = "none";
	$('panier_roll2').style.display = "none";
}






function detect(chaine) {


//Liste des Caractères interdits
var CaracteresInterdits = "\`\²\%\*\,\.\?\;\:\§\!\#\$\£\¤\(\)\~\/\\\'\=\+\{\}\[\]|^@&\"\"\<\>©®";

   var i=0;
   Result = true;
   fin=chaine.length;

//Boucle qui extrait chaque lettre de 'chaine' et qui regarde si elle correspond à un caractère interdit
   for (var i=0; i<fin; i++) {
      carac = chaine.substring(i,i+1);
      if (CaracteresInterdits.indexOf(carac)!=(-1)){;
         Result = false;
      }
   }

   if (Result==false)alert("Caractère(s) Interdit(s) détecté(s)\n");
   else alert("Aucun Caractère Interdit détecté\n");
}










var Error_form = 0;

// Formulaire inscription
function check(champ,NbCarac,idChamp)
{
	//document.getElementById("aide").innerHTML="&nbsp;<img src='/charte/info_ajax_ico.gif' width='15' height='15' align='absmiddle'>";	
	
	if(idChamp == 1)
		valeur = "Nom";
	else if(idChamp == 2)
		valeur = "Prénom";
	
	if(idChamp == 2) {
		if(champ.value.length < NbCarac) {
			document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
			champ.style.border="#B30000 1px solid";
			champ.style.background="#FFD4D7";		
			
			document.getElementById("err" + idChamp).style.display = "block";	
			if(NbCarac < 2) {
				document.getElementById("err" + idChamp).innerHTML = "Champ obligatoire de "+NbCarac+" caract&egrave;re  minimum";
			} else {
				document.getElementById("err" + idChamp).innerHTML = "Champ obligatoire de "+NbCarac+" caract&egrave;res minimum";
			}
			Error_form++;			
		}else{
			if(champ.value!=document.register.client_password.value) {
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";	
				champ.style.border="#B30000 1px solid";
				champ.style.background="#FFD4D7";		
				
				document.getElementById("err" + idChamp).style.display = "block";	
				document.getElementById("err" + idChamp).innerHTML = "La confirmation du mot de passe ne correspond pas.";
				
						
				Error_form++;	
			}else{
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/info_ajax_valid.gif' width='15' height='15'>";
				champ.style.border="#00CC00 1px solid";
				champ.style.background="#DCEFB3";			
				
			document.getElementById("err" + idChamp).style.display = "none";	
			document.getElementById("err" + idChamp).innerHTML = "";				
					
			}
		}
	}
	else if(idChamp == 12 || idChamp == 21) {
		
		if(champ.value.length < NbCarac)
		{				
			//if(idChamp == 21) { alert(champ.value); }
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
				champ.style.border="#B30000 1px solid";
				champ.style.background="#FFD4D7";	
				document.getElementById("err" + idChamp).style.display = "block";	
				if(NbCarac < 2) {
				document.getElementById("err" + idChamp).innerHTML = "Champ obligatoire de "+NbCarac+" caract&egrave;re  minimum";
			} else {
				document.getElementById("err" + idChamp).innerHTML = "Champ obligatoire de "+NbCarac+" caract&egrave;res minimum";
			}						
				Error_form++;	
		}
		else{
			if(isNumeric(champ.value)) {
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/info_ajax_valid.gif' alt='valide' />";
				champ.style.border="#00CC00 1px solid";
				champ.style.background="#DCEFB3";				
				document.getElementById("err" + idChamp).style.display = "none";	
				document.getElementById("err" + idChamp).innerHTML = "";								
			}else{
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
				champ.style.border="#B30000 1px solid";
				champ.style.background="#FFD4D7";		
				document.getElementById("err" + idChamp).style.display = "block";	
				document.getElementById("err" + idChamp).innerHTML = "Le num&eacute;ro de t&eacute;l&eacute;phone doit contenir des chiffres uniquement";							
				Error_form++;	
			}
		}
		
	}
	else
	{

		//if(idChamp == 1){ alert(champ.value.length); }

		if(champ.value.length < NbCarac)
		{				
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
				champ.style.border="#B30000 1px solid";
				champ.style.background="#FFD4D7";						
				
				document.getElementById("err" + idChamp).style.display = "block";	
				if(NbCarac < 2) {
						document.getElementById("err" + idChamp).innerHTML = "Champ obligatoire de "+NbCarac+" caract&egrave;re  minimum";
					} else {
						document.getElementById("err" + idChamp).innerHTML = "Champ obligatoire de "+NbCarac+" caract&egrave;res minimum";
					}			
				
				Error_form++;	
		}
		else{
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/info_ajax_valid.gif' alt='valide' />";
				champ.style.border="#00CC00 1px solid";
				champ.style.background="#DCEFB3";			
				
				document.getElementById("err" + idChamp).style.display = "none";	
				document.getElementById("err" + idChamp).innerHTML = "";					
							
		}
	}

	
}

function checkEmail(champ)
{
	texte = file('/ajax/verifMail.php?mail=' + champ.value);
	if (texte == "")
	{
		document.getElementById("validEmail").innerHTML="<img src='/styles/images/check/info_ajax_valid.gif' alt='valide' />";
		champ.style.border="#00CC00 1px solid";
		champ.style.background="#DCEFB3";
		$('errEmail').style.display = "none";
		$('errEmail').innerHTML ="";
		
	}
	else{
		
		if(texte=="errFormat") {
			
			document.getElementById("validEmail").innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
			champ.style.border="#B30000 1px solid";
			champ.style.background="#FFD4D7";	
			$('errEmail').style.display = "block";
			$('errEmail').innerHTML = "Le format de l'email n'est pas correct.";
			Error_form++;	
		}else if(texte=="errMailUse") {
			
			document.getElementById("validEmail").innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
			champ.style.border="#B30000 1px solid";
			champ.style.background="#FFD4D7";
			$('errEmail').style.display = "block";
			$('errEmail').innerHTML = "L'email est d&eacute;j&agrave; utilis&eacute; par un autre membre.";
			Error_form++;	
		}else if(texte == "vide") {
			
			document.getElementById("validEmail").innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
			champ.style.border="#B30000 1px solid";
			champ.style.background="#FFD4D7";
			$('errEmail').style.display = "block";
			$('errEmail').innerHTML = "Vous devez saisir une adresse email valide.";			
			Error_form++;	
		}
		
	}
}

function checkEmailParain(champ)
{

	texte = file('/ajax/verifMail.php?mail=' + champ.value);
	
	//alert(texte);

	if(texte == "false" && champ.value!="") {
		document.getElementById("validEmail2").innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
		Error_form++;	
	}
	
	if (texte == "true" && champ.value!="")
	{
		document.getElementById("validEmail2").innerHTML="<img src='/styles/images/check/info_ajax_valid.gif' alt='valide' />";
	}
	

	
	if(champ.value=="") {
		document.getElementById("validEmail2").innerHTML="";
	}
	
}

function isNumeric(sText){ 
	var ValidChars = "0123456789."; 
	var IsNumber=true; 
	var Char; 
	for (i = 0; i < sText.length && IsNumber == true; i++){ 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1){ 
			IsNumber = false; 
		} 
	} 
	return IsNumber; 
} 


function deletout(mon_id) {
	if(ie){
		$('onglet_'+mon_id+'_conteneur').setProperty('onmouseout','');
		
		//$('onglet_0_conteneur').setProperty('onmouseout','');
	}
}


function addout(mon_id) {
	if(ie){
		$('onglet_'+mon_id+'_conteneur').setProperty("onmouseout","delongletimg('onglet_"+mon_id+"');cache_sous_menu('onglet_"+mon_id+"');");
		//document.getElementById('onglet_0_conteneur').attachEvent("onmouseout","delongletimg('onglet_0');cache_sous_menu('onglet_0');");
        if (window.attachEvent) {
            $('onglet_'+mon_id+'_conteneur').onmouseout = function(){
                delongletimg('onglet_'+mon_id+'');
                cache_sous_menu('onglet_'+mon_id+'');
            }

        }
	}
}

function getElementsByClassName(classname, node) { 
	if (!node) { 
		node = document.getElementsByTagName('body')[0];
	} 
	var a = [], re = new RegExp('\\b' + classname + '\\b'); 
	els = node.getElementsByTagName('*'); 
	for (var i = 0, j = els.length; i < j; i++) {
	 	if ( re.test(els[i].className)){ 
	 		a.push(els[i]); 
	 	} 
	} 
	if(a.length > 0){
		return a;
	} else {
		return false;
	}
}

//Dans la page des cotes personalisées
// Permet de sélectionner la cote choisie et de rediriger vers les prix perso

function goCotesPerso(myId){
	document.getElementById('mesCotesPerso').value=myId;
	document.formChangeCotes.action.value="redirect";
	document.formChangeCotes.submit();
}
