﻿	setTimeout(function ()
	{
		url_appelante = parent.location.href 
	}, 150);
	if (top.frames.length>0)
		{
			top.location.href=this.location.href;
		}

function setPNG24(obj) { 
	obj.width=obj.height=1; 
	obj.className=obj.className.replace(/\bPNG24\b/i,''); 
	obj.style.filter = 
	"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
	obj.src='http://truffaut.cache.coltfrance.com/images/commun/shim.gif'; 
	return '';
}

function envoyerAmi()
{
	launchsendFriendPopup()
	document.getElementById('popupSendFriend').style.display='block';
}
function launchsendFriendPopup()
{
    var sendFriendPopup = '';
    sendFriendPopup     += '<a href="javascript:void(0)" onclick="document.getElementById(\'popupSendFriend\').style.display=\'none\';" class="closePopup">Fermer</a>';
	sendFriendPopup     += '<h3>Envoyer &agrave; un ami</h3>';
	sendFriendPopup     += '<form action="" method="post" id="formSendFriend" name="formSendFriend" onsubmit="valideSendFriend();">';
	sendFriendPopup     += '<label for="senderMail">Votre email&nbsp;:</label>';
	sendFriendPopup     += '<input type="text" id="senderMail" name="senderMail" value="" />';
	sendFriendPopup     += '<input type="hidden" id="url_envoi" name="url_envoi" value="" />';
	sendFriendPopup     += '<label for="friendMail">Email de votre ami&nbsp;:</label>';
	sendFriendPopup     += '<input type="text" id="friendMail" name="friendMail" value="" />';
	sendFriendPopup     += '<label for="message">Votre message&nbsp;:</label>';
	sendFriendPopup     += '<textarea id="message" name="message"></textarea>';
	sendFriendPopup     += '<input type="text" value="Envoyer" name="" class="submitBtn" onclick="valideSendFriend();"/>';
	sendFriendPopup     += '</form>';
    
    document.getElementById('popupSendFriend').innerHTML = sendFriendPopup;
    document.getElementById('url_envoi').value = window.location.href;
}


function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}
/* */
/* Global function */

/* SELECT + REDIRECTIONS */
function launchSelectRedirection(obj,obj2)
{
  var anchors = document.getElementById(obj).getElementsByTagName('a');
  
  var text = document.getElementById(obj2);
  try {text.removeChild(text.getElementsByTagName('span')[0]);} catch(e) {};
  text.style.visibility = 'hidden';
  
  var txt = '<select id="new'+obj+'"><option>'+text.innerHTML+'</option>';
  
  for(var i=0; i < anchors.length; i++) {
    txt += '<option value="'+anchors[i]+'">'+anchors[i].innerHTML+'</option>';
  }
  
  txt += '</select>';
  
  document.getElementById(obj).innerHTML = txt;
  
  addEvent(document.getElementById('new'+obj),'change', function() { window.location = document.getElementById('new'+obj).value; } );
}
/* END SELECT + REDIRECTIONS */


function load() {
	if (document.images) {
		this.length=load.arguments.length;
		for (var i=0;i<this.length;i++) {
			this[i+1]=new Image();
			this[i+1].src=load.arguments[i];
		}
	}
}

document.ready(function (){
		createMiniSlider();
	});

function createMiniSlider ()
	{
		msParent	= document.getElementById("feuilleter");
		miniSlider	= msParent.getElementsByTagName('ul').item(0);
		msItems		= miniSlider.getElementsByTagName('li');
		if (msItems.length > 0)
		{
			navms		= document.createElement("ul");
			navms.id	= "navms";
		}
		for (var i = 0; i < msItems.length; i++)
		{
			var li	= document.createElement("li");
			var a	= document.createElement("a");
			if (i == 0)
			{
				msItems.item(i).style.display = "block";
				li.className = "active";
			}
			//if (i != 0)
				//msItems.item(i).style.display = 'none';
			a.rel	= msItems.item(i).id;
			a.appendChild(document.createTextNode(i + 1));
			li.appendChild(a)
			navms.appendChild(li);
			addEvent(a,'click',showDiapo);
		}
		msParent.appendChild(navms);
		navmsItems = navms.getElementsByTagName('li');
	}
	
	function showDiapo (event)
	{
		target = event.target || event.srcElement;
		for (var i = 0; i < msItems.length; i++)
		{
			msItems.item(i).style.display	= "none";
			navmsItems.item(i).className	= "";
		}
		document.getElementById(target.rel).style.display = "block";
		target.parentNode.className = 'active';
		if (event.preventDefault)
			event.preventDefault();
		event.returnValue = false;
	}
	

function valideLostPassword() {
	ret='Attention :'
	errors=false;
	if (document.form_passe.nom.value == ''){
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre nom';
	}
	
	if (document.form_passe.email.value == ''){
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre email';
	}
	
//	errors=true;
//	ret='Le compte Truffaut est actuellement indisponible pour cause de maintenance.\nMerci de votre compréhension.'
	if (errors) {
		alert(ret);
		return false;
	} else{
		document.form_passe.action = '/demons/compte/passe.asp';
		return true;
	}
}

function valideSendFriend() {
	ret='Attention :'
	errors=false;
	if (document.getElementById('senderMail').value == ''){
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre email';
	}
	
	if (document.getElementById('friendMail').value == ''){
		errors=true;
		ret=ret +'\n- Vous devez indiquer l\'email de votre ami(e)';
	}
	
	if (errors) {
		alert(ret);
		return false;
	} else{
		alert('Votre message a bien été envoyé.')
		document.formSendFriend.action = '/demons/envoi_url.asp';
		document.formSendFriend.submit();
		return true;
	}
}

/* 
 * Script réalisé par TEDDY FERRERE
 * REUNION FRANCE
 * Written by TEDDY FERRERE, http://www.roodali.com
 * Copyright 2007, Licence: Creative Commons "Attribution-ShareAlike 2.0 France" BY-SA (FR),
 * http://creativecommons.org/licenses/by-sa/2.0/fr/
/*______________________________________________*/
function iLanceLoZaFair(data, page, method, elem)
{
    if(window.ActiveXObject)
    {
        //Internet Explorer
        var FerTedObjc = new ActiveXObject("Microsoft.XMLHTTP") ;
    }//fin if
    else
    {
        //Mozilla
        var FerTedObjc = new XMLHttpRequest();
    }//fin else
    
    //définition de l'endroit d'affichage:
	if (elem!='') var content = document.getElementById(elem);
    
    //si on envoie par la méthode GET:
    if(method == "GET")
    {
        if(data == 'null')
        {
            //Ouverture du fichier sélectionné:
            FerTedObjc.open("GET", page);
        }//fin if
        else
        {
            //Ouverture du fichier en methode GET
            FerTedObjc.open("GET", page+"?"+encodeURI(data)+"&dummy=" + new Date().getTime());
        }//fin else
    }//fin if
    else if(method == "POST")
    {
        //Ouverture du fichier en methode POST
        FerTedObjc.open("POST", page);
    }//fin elseif
    FerTedObjc.onreadystatechange = function()
    {
		if (FerTedObjc.readyState == 4 && FerTedObjc.status == 200){
			if (elem!='') {
				content.innerHTML = FerTedObjc.responseText;
			} else {
				eval(FerTedObjc.responseText);
			}
		}
    }    
    if(method == "GET")
    {
        FerTedObjc.send(null);
    }//fin if
    else if(method == "POST")
    {
        FerTedObjc.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
        FerTedObjc.send(encodeURI(data));
		
    }//fin elseif
}//fin fonction iLanceLoZaFair
/*__________________________________*/

var regExpNumeric=/[0-9]+/g;				// Accepte une chaine numérique

function matchRegularExpression(valeur, regularExpression)
{
	var resultat = valeur.match(regularExpression);
	if(resultat!=null && resultat.length==1) return true;
	else return false;
}



function global_search(){
	recherche = document.hsearch.searWords.value;
	if ((recherche!='') && (recherche.length>1)) {
		if (matchRegularExpression(recherche, regExpNumeric)) {
			iLanceLoZaFair('id_fiche='+recherche, '/ajax/recherche/fiches_conseils.asp', 'GET', '');
		}
	} else {
		document.getElementById('fiche_conseil_sap').style.display='none';	
	}
}

function  track(num){
	img_track = new Image();
	img_track.src = 'http://tsw0.com/6481/?aid='+num+'&value=1&orderid=';
}


function selectTypeCarte(carte){
	document.getElementById("name").readOnly=false;
	document.getElementById("name").className='read';
	document.getElementById("num_carte").readOnly=false;
	document.getElementById("num_carte").className='read';
	if (carte==1) document.images['pict_solde_points'].src='http://truffaut.cache.coltfrance.com/images/services/accueil_carte_v4/carte_bonus.png';
	if (carte==2) document.images['pict_solde_points'].src='http://truffaut.cache.coltfrance.com/images/services/accueil_carte_v4/carte_truffaut.png';
}

function solde_bonus(){
	nom_bonus = document.getElementById('name').value;
	num_carte = document.getElementById('num_carte').value;
	iLanceLoZaFair('nom_bonus='+nom_bonus+'&num_carte='+num_carte,'/ajax/fidelite/solde.asp', 'GET','');
}

function upd_stat(url,id){
	temp =new Image();
	temp.src=url+'?'+id;
}

function lien(url){
	if (url != '') {
		window.location.href=url;	
	}
}

//MAGASIN UK

var texte= new Array;
	texte[0]=""
	texte[1]="<strong>Cadbury Garden &amp; Leisure Ltd</strong>Smallway, Congresbury, Bristol, BS49 5AA<p>Tel: 01934 875700<br/>Fax: 01934 875701<br/>Email: <a href=\"mailto:info@cadbury.g-l.co.uk\">info@cadbury.g-l.co.uk</a></p>"
	texte[2]="<strong>Endsleigh Garden &amp; Leisure Ltd</strong>Ivybridge, Devon, PL21 9JL<p>Tel: 01752 898989<br/>Fax: 01752 898990<br/>Email: <a href=\"mailto:info@endsleigh.g-l.co.uk\">info@endsleigh.g-l.co.uk</a></p>"
	texte[3]="<strong>Huntingdon Garden &amp; Leisure Ltd</strong>Banks End, Wyton, Huntingdon, PE17 2AA<p>Tel: 01480 410750<br/>Fax: 01480 452054<br/>Email: <a href=\"mailto:info@huntingdon.g-l.co.uk\">info@huntingdon.g-l.co.uk</a></p>"
	texte[4]="<strong>Melbicks Garden &amp; Leisure Ltd</strong>Chester Road, Coleshill, Birmingham, Warwickshire, B46 3HY<p>Tel: 0121 7822683<br/>Fax: 0121 7829688<br/>Email: <a href=\"mailto:info@melbicks.g-l.co.uk\">info@melbicks.g-l.co.uk</a></p>"
	texte[5]="<strong>Barnett Hill Garden &amp; Leisure Ltd</strong>Worcester Road, Clent, Stourbridge, West Midlands, DY9 OEE<p>Tel: 01562 700308<br/>Fax: 01562 700456<br/>Email: <a href=\"mailto:info@barnetthill.g-l.co.uk\">info@barnetthill.g-l.co.uk</a></p>"
	texte[6]="<strong>Gardenlands Garden &amp; Leisure Ltd</strong>Bridgnorth Road, Shipley, Wolverhampton, WV6 7EJ<p>Tel: 01902 700588<br/>Fax: 01902 701380<br/>Email: <a href=\"mailto:info@gardenlands.g-l.co.uk\">info@gardenlands.g-l.co.uk</a></p>"
	texte[7]="<strong>Percy Thrower's Gardening &amp; Leisure Ltd</strong>Oteley Road, Shrewsbury, SY2 6QW<p>Tel: 01743 352311<br/>Fax: 01743 351614<br/>Email: <a href=\"mailto:info@percythrowers.g-l.co.uk\">info@percythrowers.g-l.co.uk</a></p>"

var url_base="http://www.g-l.co.uk/content.asp?contentid="
var codemag=new Array;
	codemag[0]="#"
	codemag[1]="621"
	codemag[2]="616"
	codemag[3]="620"
	codemag[4]="619"
	codemag[5]="618"
	codemag[6]="617"
	codemag[7]="615"


function changeliste(choix) {
	document.getElementById('num2').innerHTML=texte[choix] + "site internet : <br><a href=\"" + url_base + codemag[choix] +"\" target=\"_blank\">" + url_base + codemag[choix] +"</a>";
}

function ControlForm_spec(form)
{
  // Localité obligatoire pour les adresses
  if (form.city0.value == "") {
    alert("Veuillez saisir votre ville de départ ou son code postal.");
    return (false);
  }
  return true;
}

var x, y;
function setMousePosition (e) {
	if (!e) { var e = window.event||window.Event; }
	if ( navigator.appName.substr(0,2) == "Mi" ) {
		x = event.clientX;
		y = event.clientY;
	} else {
		x = e.pageX;
		y = e.pageY;
	}
}


function setText(produit) {
	// You need to tell Mozilla to start listening:
	if(window.Event && document.captureEvents)
	document.captureEvents(Event.MOUSEMOVE);
	// Then assign the mouse handler
	document.onmousemove = setMousePosition;
	// Then your mouseover function can just read mouseX and mouseY directly.
	document.getElementById("zoom_"+produit).style.display = "block";
	document.getElementById('img_zoom_'+produit).src = document.getElementById('img_zoom_'+produit).src.replace('big','zoom');
	var coordX, coordY;
	if ( navigator.appName.substr(0,2) == "Mi" ) {
		x = event.clientX;
		y = event.clientY;
		coordX = event.clientX + document.documentElement.scrollLeft + 15;
		coordY = event.clientY + document.documentElement.scrollTop + 15;
	} else {
		coordX = x + 15;
		coordY = y + 15;
	}
	if (coordX > 650) coordX = 550;
	document.getElementById("zoom_"+produit).style.left = coordX + "px";
	document.getElementById("zoom_"+produit).style.top = coordY + "px";
}

function setText1(produit) {
	// You need to tell Mozilla to start listening:
	if(window.Event && document.captureEvents)
	document.captureEvents(Event.MOUSEMOVE);
	// Then assign the mouse handler
	document.onmousemove = setMousePosition;
	// Then your mouseover function can just read mouseX and mouseY directly.
	document.getElementById("zoom_"+produit).style.display = "block";
	if ( navigator.appName.substr(0,2) == "Mi" ) {
		x = event.clientX;
		y = event.clientY;
	document.getElementById("zoom_"+produit).style.left = event.clientX + document.documentElement.scrollLeft + 15 + "px";
	document.getElementById("zoom_"+produit).style.top = event.clientY + document.documentElement.scrollTop - 80 + "px";
	} else {
	document.getElementById("zoom_"+produit).style.left = x + 15 + "px";
	document.getElementById("zoom_"+produit).style.top = y - 50 + "px";
	}
}


function hideText() {
      var obj;
      var oDivs = document.getElementsByTagName("DIV");
      for (i = 0 ; i < oDivs.length ; i++)
      {
            if (String(oDivs[i].id).substring(0,5) == 'zoom_')
            {
                        oDivs[i].style.display='none';
            }
      }
}

function show_biblio_list(topic){
	document.getElementById('faq').style.display='none';
	document.getElementById('fiches_conseil').style.display='none';
	document.getElementById(topic).style.display='block';
}

function showPictIlly(pict){
	document.getElementById("zoom_cafe1_illy").style.display='none';
	document.getElementById("zoom_cafe2_illy").style.display='none';
	document.getElementById("zoom_cafe3_illy").style.display='none';
	document.getElementById("zoom_"+pict+"_illy").style.display='block';
}

function coche(field) {
  var result = false;
	for (i = 0; i < field.length; i++) {
		if (field[i].checked==true) {
			result = true;
		}
	}
  return result;
}

function envoi_form_recherche(num){
	if (eval(num) == 1) {
		if (!coche(document.form_recherche.lineaire)) {
			alert('Veuillez choisir au moins un rayon.');
		} else {
			document.form_recherche.action ='/index.asp?id_page=97&recherche=lineaires';
			document.form_recherche.submit();
		}
	 } else if (eval(num) == 2) {
		if (!coche(document.form_recherche.service)) {
			alert('Veuillez choisir au moins un service.');
		} else {
			document.form_recherche.action ='/index.asp?id_page=97&recherche=services';
			document.form_recherche.submit();
		}
	}
}

function imprime_zone(div){
	var contentDiv = document.getElementById(div).innerHTML;
	var fenetre = window.open("", "ZoneImpr", "height=600, width=600,	toolbar=0, menubar=0, scrollbars=1, resizable=1, status=0, location=0, left=10, top=10");
	fenetre.document.body.innerHTML = contentDiv ;
	fenetre.window.print();
	fenetre.window.close();
	return true;
}

function imprime_magasin(magasin){
	var fenetre = window.open("/includes/pages/magasin_print.asp?magasin="+magasin, "ZoneImpr", "height=600, width=600,	toolbar=0, menubar=0, scrollbars=1, resizable=1, status=0, location=0, left=10, top=10");
	fenetre.window.print();
//	fenetre.window.close();
	return true;
}

function homeClignote(){ 
	if (document.getElementById(bloc1).style.display=='none' && document.getElementById(bloc2).style.display=='none'){
		document.getElementById(bloc1).style.display='block';
		document.getElementById(bloc3).style.display='none';
	} else if (document.getElementById(bloc1).style.display=='none' && document.getElementById(bloc3).style.display=='none'){
		document.getElementById(bloc3).style.display='block';
		document.getElementById(bloc2).style.display='none';
	}else if (document.getElementById(bloc2).style.display=='none' && document.getElementById(bloc3).style.display=='none'){
		document.getElementById(bloc2).style.display='block';
		document.getElementById(bloc1).style.display='none';
	}
	setTimeout("homeClignote()",3000);
}

function showEncycloFiche(onglet){
	for (i=1;i<=10;i++){
      if(document.getElementById('contenu_ssnav_'+i) != undefined )
          document.getElementById('contenu_ssnav_'+i).style.display='none';
	 } 
	for (j=1;j<=10;j++){
      if(document.getElementById('onglet_'+j) != undefined )
          document.getElementById('onglet_'+j).className='';
	 }
	document.getElementById('contenu_ssnav_'+onglet).style.display='block';
	document.getElementById('onglet_'+onglet).className='on';	
}

function showGuide(guide){
	for (i=1;i<=80;i++){
      if(document.getElementById('guide_content_'+i) != undefined )
          document.getElementById('guide_content_'+i).style.display='none';
	 } 
	for (j=1;j<=80;j++){
      if(document.getElementById('guide_'+j) != undefined )
          document.getElementById('guide_'+j).className='off';
	 } 
	for (k=1;k<=80;k++){
      if(document.getElementById('guide_link_'+k) != undefined )
          document.getElementById('guide_link_'+k).style.display='none';
	 } 
	document.getElementById('guide_content_'+guide).style.display='block';
	 if(document.getElementById('guide_link_'+guide) != undefined )
          document.getElementById('guide_link_'+guide).style.display='block';
	document.getElementById('guide_'+guide).className='on';
	document.getElementById('guide').className='activate';	
}


function showProduitMarque(produit){
	for (i=1;i<=10;i++){
      if(document.getElementById('detail_produit_'+i) != undefined )
          document.getElementById('detail_produit_'+i).style.display='none';
	 } 
	for (j=1;j<=10;j++){
      if(document.getElementById('produit_'+j) != undefined )
          document.getElementById('produit_'+j).className='';
	 }
	document.getElementById('detail_produit_'+produit).style.display='block';
	document.getElementById('produit_'+produit).className='on';	
}


function closePartagAvis(){
	for (i=1;i<=500;i++){
      if(document.getElementById('partager_avis_'+i) != undefined )
          document.getElementById('partager_avis_'+i).style.display='none';
	 } 
}
function showPartagAvis(fiche){
	closePartagAvis()
	document.getElementById('partager_avis_'+fiche).style.display='block';
}

function closeListAvis(){
	for (i=1;i<=500;i++){
      if(document.getElementById('consult_avis_'+i) != undefined )
          document.getElementById('consult_avis_'+i).style.display='none';
	 } 
}
function showConsultAvis(fiche){
	closeListAvis()
	document.getElementById('consult_avis_'+fiche).style.display='block';
}

function closeAvisAide(){
	for (i=1;i<=500;i++){
      if(document.getElementById('aide_avis_'+i) != undefined )
          document.getElementById('aide_avis_'+i).style.display='none';
	 } 
}
function showAvisAide(fiche){
	closeAvisAide()
	document.getElementById('aide_avis_'+fiche).style.display='block';
}

	//PNG24 
function valide() {
	ret='Attention :'
	errors=false;
	if (document.form_ouv_compte.nom2.value == '' && document.form_ouv_compte.nom.value == '' && document.form_ouv_compte.carte.value == ''){
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre nom et votre numéro de carte Bonus\nou bien votre nom si vous n\'avez pas de carte. '
	} else if (document.form_ouv_compte.nom.value != '' || document.form_ouv_compte.carte.value != '') {

		if (document.form_ouv_compte.nom.value == '') {
			errors=true;
			ret=ret +'\n- Vous devez indiquer votre nom';
		}
	
		if (document.form_ouv_compte.carte.value == '') {
			errors=true;
			ret=ret +'\n- Vous devez indiquer le numéro de votre carte Bonus';
		}else{
			if (isNaN(document.form_ouv_compte.carte.value)) {
				errors=true;
				ret=ret +'\n- Le numéro de votre carte Bonus ne doit contenir que des chiffres';
			}
		}
	} else if (document.form_ouv_compte.nom2.value != '') {
//	
	}
	
//	errors=true;
//	ret='Le compte Truffaut est actuellement indisponible pour cause de maintenance.\nMerci de votre compréhension.'
	if (errors) {
		alert(ret);
		return false;
	} else if ( document.form_ouv_compte.nom.value != '' && document.form_ouv_compte.carte.value != '' ) {
		document.form_ouv_compte.action = '/demons/compte/identification.asp';
//		document.form_ouv_compte.action = 'ouverture2_bonus.asp';
		return true;
	} else if (document.form_ouv_compte.nom2.value != '') {
		document.form_ouv_compte.action = 'ouverture-compte-etape-1-3.html';
		return true;
	}
}

function valide2() {
	ret='Attention :'
	errors=false;
	if (document.form_ouv_compte.login.value=='') {
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre identifiant'
	}
	
	if (document.form_ouv_compte.pass.value=='') {
		errors=true;
		ret=ret +'\n- Vous devez choisir un mot de passe'
	} else if (document.form_ouv_compte.pass.value.length < 4) {
		errors=true;
		ret=ret +'\n- Votre mot de passe doit contenir au moins 4 caractères'
	} else if (document.form_ouv_compte.pass2.value != document.form_ouv_compte.pass.value) {
		errors=true;
		ret=ret +'\n- Le mot de passe et la confirmation du mot de passe sont différents'
	}

	if (document.form_ouv_compte.civ.selectedIndex==0) {
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre civilité'
	}

	if ((document.form_ouv_compte.cp.value=='') || (isNaN(document.form_ouv_compte.cp.value)) || (document.form_ouv_compte.cp.value.length != 5)) {
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre code postal à 5 chiffres'
	}
	
	if (document.form_ouv_compte.id_mag.selectedIndex==0) {
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre magasin habituel.'
	}
	
	if (document.form_ouv_compte.email.value=='') {
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre adresse email'
	}else if (!isEmailAddr(document.form_ouv_compte.email.value)){
		errors=true;
		ret=ret +'\n- Vous devez indiquer une adresse email valide'
	}

	if (errors) {
		alert(ret);
		return false;
	} else {
		document.form_ouv_compte.submit();
		return true;
	}
}

function modification_compte() {
	ret='Attention :'
	errors=false;
	
	if (document.form_ouv_compte.old_pass.value!='') {
		if (document.form_ouv_compte.pass.value=='') {
			errors=true;
			ret=ret +'\n- Vous devez choisir un mot de passe'
		} else if (document.form_ouv_compte.pass.value.length < 4) {
			errors=true;
			ret=ret +'\n- Votre mot de passe doit contenir au moins 4 caractères'
		} else if (document.form_ouv_compte.pass2.value != document.form_ouv_compte.pass.value) {
			errors=true;
			ret=ret +'\n- Le mot de passe et la confirmation du mot de passe sont différents'
		}
	}


	if (document.form_ouv_compte.civ.selectedIndex==0) {
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre civilité'
	}

	if ((document.form_ouv_compte.cp.value=='') || (isNaN(document.form_ouv_compte.cp.value)) || (document.form_ouv_compte.cp.value.length != 5)) {
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre code postal à 5 chiffres'
	}
	
	if (document.form_ouv_compte.id_mag.selectedIndex==0) {
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre magasin habituel.'
	}
	
	if (document.form_ouv_compte.email.value=='') {
		errors=true;
		ret=ret +'\n- Vous devez indiquer votre adresse email'
	}else if (!isEmailAddr(document.form_ouv_compte.email.value)){
		errors=true;
		ret=ret +'\n- Vous devez indiquer une adresse email valide'
	}

	if (errors) {
		alert(ret);
		return false;
	} else {
		document.form_ouv_compte.submit();
		return true;
	}
}

function gereAutre(){
	//rien de special
}

function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))

	result = true;
  }
  return result;
}

function showPromo(menu){
	document.getElementById('jardin_list').style.display='none';
	document.getElementById('animaux_list').style.display='none';
	document.getElementById('deco_list').style.display='none';
	document.getElementById('jardin').style.zIndex='10';
	document.getElementById('animaux').style.zIndex='40';
	document.getElementById('deco').style.zIndex='30';
	document.getElementById(menu+'_list').style.display='block';
	document.getElementById(menu).style.zIndex='100';
}

function favoris(url,titre) {
if ( navigator.appName != 'Microsoft Internet Explorer' )
{ window.sidebar.addPanel(titre,url,''); }
else { try {window.external.AddFavorite(url,titre);} catch (e){alert('Cette fonction ne fonctionne sur votre navigateur.\nVous pouvez l\'utiliser manuellement en tapant CTRL+D')} } }

