


function getVar (nomVariable) {
	var infos = location.href.substring(location.href.indexOf("?")+1, location.href.length)+"&"
	if (infos.indexOf("#")!=-1)
	infos = infos.substring(0,infos.indexOf("#"))+"&"
	var variable=0
	{
nomVariable = nomVariable + "="
var taille = nomVariable.length
if (infos.indexOf(nomVariable)!=-1)
variable = infos.substring(infos.indexOf(nomVariable)+taille,infos.length).substring(0,infos.substring(infos.indexOf(nomVariable)+taille,infos.length).indexOf("&"))
}
return variable
} 


function getVars(nomVariable) {

valeurs = new Array();
var infos = location.href.substring(location.href.indexOf("?")+1, location.href.length);
vars = infos.split("&");
msg = "";
	for (i=0;i<vars.length;i++) {
		keyVal = vars[i].split("=");
		
		key = keyVal[0];
		val = keyVal[1];
		
		if (key == nomVariable) {
		
		valeurs.push(val);
		}
		
		
	}

return valeurs;
}

function preloadImages() {
	var preImages = new Array();
	if (document.images)
    {
      preload_image_object = new Image();
      // set image url
      image_url = new Array();
      image_url.push("images/btn/test-roll.png");
      image_url.push("images/btn/produits-roll.png");
      image_url.push("images/btn/infos-roll.png");
      image_url.push("images/btn/favoris-roll.png");
	  image_url.push("images/btn/options-roll.png");
	  image_url.push("images/btn/sequiper-roll.png");
	  image_url.push("images/btn/roll-rayons.jpg");
	  
       var i = 0;
      
        for (i = 0; i <  image_url.length; i++) { 
		preImages[i] = new Image()
		preImages[i].src = image_url[i];
		}
	}
  

 //alert( preload_image_object);


}


/*****************************************************************/
/*   			           XMLS
/*****************************************************************/


function getXML(file) {

var xmlFile = "xml/"+file+".xml";


var xhr_object; 
    try {  xhr_object = new ActiveXObject('Msxml2.XMLHTTP');   }
    catch (e) 
    {
        try {   xhr_object = new ActiveXObject('Microsoft.XMLHTTP');    }
        catch (e2) 
        {
          try {  xhr_object = new XMLHttpRequest();     }
          catch (e3) {  xhr_object = false;   }
        }
     }



xhr_object.open("GET", xmlFile, false);

xhr_object.send(null);

return xhr_object.responseXML;
}


function loadXML(file) {
	
	// Recherche le Xml Global
	
	
	switch (file) {
		
		case "home":
		
			xmlGlobal = getXML("global");
			parseGlobal(xmlGlobal);
	
			xmlHome = getXML("home");
			
			parseHome(xmlHome);
		break;
		
		case "rayons":
			xmlGlobal = getXML("global");
			parseGlobal(xmlGlobal);
	
			xmlRayons = getXML("rayons");
			parseRayons(xmlRayons);
			
		break;
		
		case "rayon":
			
			xmlGlobal = getXML("global");
			parseGlobal(xmlGlobal);
	
			getRayon = getVar("rayon");
			file = "/rayons/"+getRayon;
			xmlRayon = getXML(file);
			parseRayon(xmlRayon);
		break;
		
		
		case "comparateur":
			
			xmlGlobal = getXML("global");
			parseGlobal(xmlGlobal);
	
			file = "comparateur";
			xmlComparateur = getXML(file);
			parseComparateur(xmlComparateur);
			
		break;
		
		case "fiche_produit":
			
			xmlGlobal = getXML("global");
			parseGlobal(xmlGlobal);
	
			file = "fiche-produit";
			xmlFicheProduit = getXML(file);
			parseFicheProduit(xmlFicheProduit);
			
		break;
		
		
		case "infos":
			
			xmlGlobal = getXML("global");
			parseGlobal(xmlGlobal);
	
			file = "infos";
			parseInfos(getXML(file));
			
		break;
		
		case "ou_acheter":
			
			xmlGlobal = getXML("global");
			parseGlobal(xmlGlobal);
	
			file = "ou-acheter";
			parseOuAcheter(getXML(file));
			
		break;
		
		case "favoris":
			
			xmlGlobal = getXML("global");
			parseGlobal(xmlGlobal);
	
			file = "favoris";
			parseFavoris(getXML(file));
			
		break;
		
		case "qui_sommes_nous":
			
			file = "qui-sommes-nous";
			parseQuiSommesNous(getXML(file));
			
		break;
		
		case "tests":
			
			file = "tests";
			parseQuiSommesNous(getXML(file));
			
		break;
	
	}	
	
	preloadImages();
}

// Elements Globaux => Bloc Texte Navigation, Breadcrumb, Moteur de recherche, Keywords Footer

function parseElmtsGlob(xmlDoc) {
	var _xmlTextes = xmlDoc.getElementsByTagName('textes')[0];
	
	_textNavLeft = _xmlTextes.getElementsByTagName('nav_left')[0].firstChild.nodeValue;
	
	
	eleTextNavLeft = document.getElementById('promesses_nav').getElementsByTagName('p')[0];
	eleTextNavLeft.innerHTML = _textNavLeft;
	
	// Keywords footer

	var _xmlKeywords = xmlDoc.getElementsByTagName('footer')[0].getElementsByTagName('keywords')[0].firstChild.nodeValue;
	eleKeywords = document.getElementById('keywords');
	eleKeywords.innerHTML = _xmlKeywords;
	
	
	// Moteur de recherche
	
	var _xmlSearchEngine = xmlDoc.getElementsByTagName('recherche')[0];
	
	var _breadCrumb = _xmlSearchEngine.getElementsByTagName('breadcrumb')[0].firstChild.nodeValue;
	var _inputSearch = _xmlSearchEngine.getElementsByTagName('input')[0].firstChild.nodeValue;
	
	eleBreadCrumb = document.getElementById('recherche').getElementsByTagName('span')[0];
	eleBreadCrumb.innerHTML = _breadCrumb; 
	
	eleInputSearch =  document.getElementById('recherche').getElementsByTagName('span')[1].getElementsByTagName('input')[0];
	eleInputSearch.value = _inputSearch;
	
	}

// Global

function parseGlobal(xmlDoc)
{
	
	// DEBUG
	var msg_output = "";
	
	// Menus Nav Left
	
	var _xmlMenus = xmlDoc.getElementsByTagName('nav_left')[0].getElementsByTagName('item');
	var _htmlMenus = document.getElementById('nav_left').getElementsByTagName('li');
	
	
	
	for (i=0;i<_xmlMenus.length;i++) {
	
		if (i!=_xmlMenus.length-1) {
			var eleMenu = _htmlMenus[i].getElementsByTagName('a')[0];
		// Comment s'equiper
		} else {
		var eleMenu =document.getElementById('sequiper').getElementsByTagName('a')[0];
		}
		
		eleMenu.firstChild.innerHTML = _xmlMenus[i].getElementsByTagName('titre')[0].firstChild.nodeValue;
		eleMenu.href =  _xmlMenus[i].getElementsByTagName('url')[0].firstChild.nodeValue;
	
	}
	
	
	// Btn Change Lang
	
	var _xmlBtnChangeLang = xmlDoc.getElementsByTagName('footer')[0].getElementsByTagName('btn_lang');
	var eleChangeLang =  document.getElementById('footer').getElementsByTagName('span')[0];
	
	for (i=0;i<_xmlBtnChangeLang.length;i++) {
		
		_img = eleChangeLang.getElementsByTagName('img')[0];
		_a = eleChangeLang.getElementsByTagName('a')[0]; 
		_a.href = _xmlBtnChangeLang[i].getElementsByTagName('url')[0].firstChild.nodeValue;
		imgLang = document.createElement("img");
		imgLang.setAttribute('src','images/flags/'+_xmlBtnChangeLang[i].getElementsByTagName('image')[0].firstChild.nodeValue);
		imgLang.setAttribute('width','40');
		imgLang.setAttribute('height','15');
		imgLang.setAttribute('alt','');
		_a.appendChild(imgLang);
		txtLang = document.createElement("span");
		txtLang.innerHTML = _xmlBtnChangeLang[i].getElementsByTagName('titre')[0].firstChild.nodeValue;
		_a.appendChild(txtLang);
		
	}
	
	
	
	// Liens Footer
	
	var _xmlFooterLiens = xmlDoc.getElementsByTagName('footer')[0].getElementsByTagName('item');
	var _footerLiens = document.getElementById('footer').getElementsByTagName('span')[2];

	for (i=0;i<_xmlFooterLiens.length;i++) {
		myLink = document.createElement("a");
		
		myLink.setAttribute("href",_xmlFooterLiens[i].getElementsByTagName('url')[0].firstChild.nodeValue);
		
		myText = document.createTextNode(_xmlFooterLiens[i].getElementsByTagName('titre')[0].firstChild.nodeValue);

		myLink.appendChild(myText);
		
		_footerLiens.appendChild(myLink);
		
		// Pas de slash aprĖs le dernier lien
		if (i!=_xmlFooterLiens.length-1) {
		_footerLiens.innerHTML +="&nbsp;&nbsp;/&nbsp;&nbsp;";
		}
		
	}
	
	
	// Oxylane
	
	var _xmlOxylane = xmlGlobal.getElementsByTagName('lien_oxylane')[0];
	var _xmlOxylaneImg = _xmlOxylane.getElementsByTagName('image')[0].firstChild.nodeValue;
	var _xmlOxylaneUrl = _xmlOxylane.getElementsByTagName('url')[0].firstChild.nodeValue;
	
	
	var _htmlOxylane = document.getElementById('oxylane');
	
	_htmlOxylane.getElementsByTagName('a')[0].href = _xmlOxylaneUrl;
	_htmlOxylane.getElementsByTagName('img')[0].src +=_xmlOxylaneImg;
	
	
	_xmlGlobal = xmlDoc;
	
}


// Home

function parseHome(xmlDoc)
{
	
	
	parseElmtsGlob(xmlDoc);

	var _xmlTextes = xmlDoc.getElementsByTagName('textes')[0];
	
	_textNavLeft = _xmlTextes.getElementsByTagName('nav_left')[0].firstChild.nodeValue;
	
	_textBody = _xmlTextes.getElementsByTagName('body')[0].firstChild.nodeValue;
	eleTextBody = document.getElementById('promesses').getElementsByTagName('p')[0];
	eleTextBody.innerHTML = _textBody;
	
	
}

// Rayons
function parseRayons(xmlDoc) {
	
	
	parseElmtsGlob(xmlDoc);
	
	
	
	// BODY
	
	
		// Titre
		
		var _xmlTitreBody = xmlDoc.getElementsByTagName('titre')[0].firstChild.nodeValue;
		var _htmlTitreBody = document.getElementById('liste_rayons').getElementsByTagName('h1')[0];
		
		
		_htmlTitreBody.innerHTML = _xmlTitreBody;
		
		// Image
	
		var _xmlImgBody = xmlDoc.getElementsByTagName('image')[0].firstChild.nodeValue;
		var _htmlImgBody = document.getElementById('rayons').getElementsByTagName('img')[0];
		
		
		_htmlImgBody.src = _xmlImgBody;
		
		
		// Liens Rayons
		
		
		var _xmlRayons =  xmlDoc.getElementsByTagName('rayon');
		var _htmlRayons = document.getElementById('liste_rayons').getElementsByTagName('ul')[0];
		
		
			for (i=0;i<_xmlRayons.length;i++) {
			
			_li = document.createElement("li");
			
			_link = document.createElement("a");
			_link.setAttribute("href",_xmlRayons[i].getElementsByTagName('url')[0].firstChild.nodeValue);
			
			_span =  document.createElement("span");
			_span.innerHTML = _xmlRayons[i].getElementsByTagName('nom')[0].firstChild.nodeValue;
			
			_link.appendChild(_span);
			
			_li.appendChild(_link);
		
			_htmlRayons.appendChild(_li);
			
			}
		
		
		// Actualite
		
		
		var _xmlActualite = xmlDoc.getElementsByTagName('actualite')[0];
		var _htmlActualite = document.getElementById('actualite');
		
		_imgActu = _htmlActualite.getElementsByTagName('img')[0];
		_titreActu = _htmlActualite.getElementsByTagName('h1')[0];
		_texteActu = _htmlActualite.getElementsByTagName('p')[0];
		
		
		_imgActu.src = _xmlActualite.getElementsByTagName('image')[0].firstChild.nodeValue;
		_titreActu.innerHTML = _xmlActualite.getElementsByTagName('titre')[0].firstChild.nodeValue;
		_texteActu.innerHTML = _xmlActualite.getElementsByTagName('texte')[0].firstChild.nodeValue;
		
	return true;
}





function parseRayon(xmlDoc) {
	
	
	parseElmtsGlob(xmlDoc);
	
	// BODY
	
	
		// Image
	
		var _xmlImgBody = xmlDoc.getElementsByTagName('image')[0].firstChild.nodeValue;
		var _htmlImgBody = document.getElementById('rayons').getElementsByTagName('img')[0];
		_htmlImgBody.src = _xmlImgBody;
		
		
		// Titre Rayon
		
		var _xmlTitreRayon = xmlDoc.getElementsByTagName('nom')[0].firstChild.nodeValue;
		var _htmlTitreRayon = document.getElementById('liste_produits').getElementsByTagName('h1')[0];
		_htmlTitreRayon.innerHTML = _xmlTitreRayon;
		
		// Avertissement comparateur
		document.getElementById('avertissement').value = xmlDoc.getElementsByTagName('comparer')[0].getElementsByTagName('avertissement')[0].firstChild.nodeValue; 
		//alert(xmlDoc.getElementsByTagName('comparer')[0].getElementsByTagName('avertissement')[0].firstChild.nodeValue);
		
		// Image Partenaire
		
		var _xmlImgPart = xmlDoc.getElementsByTagName('image_partenaire')[0].firstChild.nodeValue;
		
		var _htmlImgPart = document.getElementById('liste_produits').getElementsByTagName('img')[0];
		_htmlImgPart.src = _xmlImgPart;
		
		
		// Description Rayon
		var _xmlDescRayon = xmlDoc.getElementsByTagName('description')[0].firstChild.nodeValue;
		var _htmlDescRayon = document.getElementById('liste_produits').getElementsByTagName('p')[0];
		_htmlDescRayon.innerHTML = _xmlDescRayon;
		
		
		
		
		// Bouton comparer
		
		var _xmlBtnComparerTitre = xmlDoc.getElementsByTagName('comparer')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
		var _xmlBtnComparerUrl = xmlDoc.getElementsByTagName('comparer')[0].getElementsByTagName('lien')[0].firstChild.nodeValue;
		
		
		
		var _htmlBtnComparer = document.getElementById('compare');
		_htmlBtnComparer.innerHTML = _xmlBtnComparerTitre;
		
		
		// Formulaire
		_htmlForm =document.forms[0];
		_htmlForm.setAttribute('action',_xmlBtnComparerUrl);
		//document.getElementById('eleLang').value= getVar('lang').toUpperCase();
		document.getElementById('eleRayon').value= getVar('rayon');
		
		// Liste des produits
		
		
		_xmlProduits = xmlDoc.getElementsByTagName('produit');
		
		if (!page) page= 1;
		
		
		limit = 6;
		
		start = (page-1)*limit;
		
		nb_pages = Math.ceil(_xmlProduits.length/limit);
		
		// Navigation Pages
		var _xmlNavPagesPrec = "> " +xmlDoc.getElementsByTagName('nav_pages')[0].getElementsByTagName('prec')[0].firstChild.nodeValue;
		var _xmlNavPagesSuiv = xmlDoc.getElementsByTagName('nav_pages')[0].getElementsByTagName('suiv')[0].firstChild.nodeValue+" < ";
		
		_htmlNavPages = document.getElementById('nav_pages').getElementsByTagName('a');
		_htmlNavPagesSuiv = _htmlNavPages[0];
		_htmlNavPagesPrec =  _htmlNavPages[(_htmlNavPages.length-1)];
		
		_htmlNavPagesSuiv.innerHTML =  _xmlNavPagesSuiv;
		_htmlNavPagesPrec.innerHTML = _xmlNavPagesPrec;
		
		
		
		for (j=1;j<=nb_pages;j++) {
			
			if (j !=nb_pages) document.getElementById('pages').innerHTML += '<a href="Javascript:swapPageRayon('+j+');">'+j+' - </a>';
			else document.getElementById('pages').innerHTML += '<a href="Javascript:swapPageRayon('+j+');">'+j+'</a>';
		}
		
		
		for (j=1;j<=nb_pages;j++) {
			
			_currentConteneur = document.getElementById('produits').getElementsByTagName('ul')[0];
			
			if (j== 1) {
			_conteneur = _currentConteneur;
			} else {
			_conteneur = _currentConteneur.cloneNode(true);
			_conteneur.style.display='none';
			document.getElementById('produits').appendChild(_conteneur);
			}
			
			
			var start = (j-1)*limit;
			var _limit = start+6;
			var i;
			
			
			cpt = 0;
			for (i=start;i<_limit;i++) {
			
			
			_imgThumb = _xmlProduits[i].getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].firstChild.nodeValue;
			
			_LinkProduit = _xmlProduits[i].getElementsByTagName('lien')[0].getElementsByTagName('url')[0].firstChild.nodeValue;
			
			
			if (j== 1) {
			_htmlImgThumb = document.createElement('img');
			
			} else {
			_htmlImgThumb = _conteneur.getElementsByTagName('li')[cpt].getElementsByTagName('span')[0].getElementsByTagName('img')[0];
			}
			
			
			_htmlImgThumb.src = _imgThumb;
			//_htmlImgThumb.setAttribute('onmouseover','showPopup("'+i+'");');
			_htmlImgThumb.onmouseover = function() { showPopup(this); }
			_htmlImgThumb.onmouseout = function() { hidePopUp(); }
			_htmlImgThumb.setAttribute('id',i);
			
			_htmlImgThumb.onclick =function() { gotoFicheProduit(this.getAttribute('id')); }
			
			_htmlLi = _conteneur.getElementsByTagName('li')[cpt];
			_htmlLi.setAttribute("id",i);
			_htmlLi.style.display="block";
			
			 _htmlLi.getElementsByTagName('span')[0].appendChild(_htmlImgThumb);
			
			_htmlCheckBox = _htmlLi.getElementsByTagName('input')[0];
			_htmlCheckBox.value = i;
			
			if (_htmlCheckBox.checked) {
				imgTick = _htmlCheckBox.parentNode.getElementsByTagName('img')[0]
				checkCompareProduit(imgTick); 
			}
			
			var _xmlTitreProduit = _xmlProduits[i].getElementsByTagName('nom')[0].firstChild.nodeValue;
			var _htmlTitreProduit = document.getElementById('produits').getElementsByTagName('li')[i].getElementsByTagName('a')[0];
			_htmlTitreProduit.innerHTML = _xmlTitreProduit;
			_htmlTitreProduit.href = _LinkProduit;
			//if (i == start) alert(_htmlTitreProduit);
			
			cpt++;
			}
			
			
		
		}
		
		
		// Affiche la 1ere Page
		swapPageRayon(1);
		_txtPrix = xmlDoc.getElementsByTagName('prix')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
		
		
	return true;
}





// Rayons

function parseComparateur(xmlDoc) {
	
	
	
	// Textes
	_produitsComp = getVars('produits');
	
	// XML Rayons
	getRayon = getVar('rayon');
	file = "/rayons/"+getRayon;
	xmlRayon = getXML(file);
	
	
	parseElmtsGlob(xmlDoc);
	
	
	// BODY
	
		
		// Image
	
		var _xmlImgBody = xmlDoc.getElementsByTagName('image')[0].firstChild.nodeValue;
		var _htmlImgBody = document.getElementById('comparateur').getElementsByTagName('img')[0];
		
		
		
		_htmlImgBody.src = _xmlImgBody;
		
		
		// Produits a comparer
		
		msg = "";
		
		_xmlProduits = xmlRayon.getElementsByTagName('produit');
		
		for (i=0;i<_produitsComp.length;i++) {
		key = _produitsComp[i];
		var _xmlTitreProduit = _xmlProduits[key].getElementsByTagName('nom')[0].firstChild.nodeValue;
		_CurrentHtmlProduit = document.getElementById('liste_produits').getElementsByTagName('div')[0];
		
			if (i>0) {
				_htmlProduit = _htmlProduit.cloneNode(true);
				document.getElementById('liste_produits').appendChild(_htmlProduit);
			} else {
				_htmlProduit =_CurrentHtmlProduit;
			}
			
			
			if (i == _produitsComp.length-1) _htmlProduit.style.border="0px";
			
			// Titre
			_htmlProduit.getElementsByTagName('h1')[0].innerHTML = _xmlTitreProduit;
			
			// Image
			var _htmlImgTh = _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('img')[0];
			var _xmlImgTh = _xmlProduits[key].getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].firstChild.nodeValue;
			_htmlImgTh.setAttribute('width',_xmlProduits[key].getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].getAttribute('width'));
			_htmlImgTh.setAttribute('height',_xmlProduits[key].getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].getAttribute('height'));
			_htmlImgTh.src = _xmlImgTh;
			
			// Ref
			
			var _xmlRef = _xmlProduits[key].getElementsByTagName('ref')[0].firstChild.nodeValue;
			var _htmlRef =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('b')[0];
			_htmlRef.innerHTML = _xmlRef;
			
			
			// Tailles Coloris
			
			var _htmlTaillesColoris = _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[1].getElementsByTagName('b')[0];
			var _xmlTitreTaillesColoris =  _xmlProduits[key].getElementsByTagName('tailles_coloris')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
			
			
				// Titre
				_htmlTaillesColoris.innerHTML =_xmlTitreTaillesColoris ;
				
				// Texte Taille
				var _htmlTexteTaillesColoris = _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[1].getElementsByTagName('cite')[0];
				var _xmlTexteTaillesColoris =  _xmlProduits[key].getElementsByTagName('tailles_coloris')[0].getElementsByTagName('taille')[0].firstChild.nodeValue;
				
				_htmlTexteTaillesColoris.innerHTML =_xmlTexteTaillesColoris ;
				
				// Titre Coloris
				var _xmlTexteColoris =  _xmlProduits[key].getElementsByTagName('tailles_coloris')[0].getElementsByTagName('coloris')[0].getAttribute('titre');
				_htmlTexteTaillesColoris.innerHTML +="<br/>"+_xmlTexteColoris+"<br/>";
				
				
				// Coloris
				var _xmlColoris = _xmlProduits[key].getElementsByTagName('tailles_coloris')[0].getElementsByTagName('coloris')[0].getElementsByTagName('couleur');
				
				if (_xmlColoris) {
				for (j=0;j<_xmlColoris.length;j++) {
				
					_htmlTexteTaillesColoris.innerHTML +=_xmlColoris[j].getElementsByTagName('titre')[0].firstChild.nodeValue+" .<img src='"+_xmlColoris[j].getElementsByTagName('image')[0].firstChild.nodeValue+"' alt=''/><br/>";
					
				}
				}
				
		
			// Description
			
			var _xmlDescription =  _xmlProduits[key].getElementsByTagName('textes')[0].getElementsByTagName('description')[0].firstChild.nodeValue;
			var _htmlDescription =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[2];
			
			_htmlDescription.innerHTML = _xmlDescription;
			
			// Achat Magasin / Ligne
			
			var _xmlAchatMagasin = _xmlProduits[key].getElementsByTagName('achat_magasin')[0].getElementsByTagName('texte')[0].firstChild.nodeValue; 
			var _xmlAchatWeb = _xmlProduits[key].getElementsByTagName('achat_web')[0].getElementsByTagName('texte')[0].firstChild.nodeValue; 
			
			var _htmlAchatMagasin =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('span')[0];
			_htmlAchatMagasin.innerHTML = _xmlAchatMagasin;
			
			var _htmlAchatWeb =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('span')[2];
			_htmlAchatWeb.innerHTML = _xmlAchatWeb;
			
			
			// Prix
			
			var _xmlPrixMagasin = _xmlProduits[key].getElementsByTagName('achat_magasin')[0].getElementsByTagName('prix')[0].firstChild.nodeValue;
			var _xmlPrixWeb = _xmlProduits[key].getElementsByTagName('achat_web')[0].getElementsByTagName('prix')[0].firstChild.nodeValue;
			
			var _htmlPrixMagasin =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('span')[1];
			_htmlPrixMagasin.innerHTML = _xmlPrixMagasin;
			
			var _htmlPrixWeb =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('span')[3];
			_htmlPrixWeb.innerHTML = _xmlPrixWeb;
			
			// Precision Magasin / Ligne
			
			_xmlPrecisionMagasin= _xmlProduits[key].getElementsByTagName('achat_magasin')[0].getElementsByTagName('precision')[0].firstChild.nodeValue; 
			var _htmlPrecisionMagasin =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('span')[5];
			_htmlPrecisionMagasin.innerHTML = _xmlPrecisionMagasin;
			
			
			_xmlPrecisionLigne = _xmlProduits[key].getElementsByTagName('achat_web')[0].getElementsByTagName('precision')[0].firstChild.nodeValue; 
			var _htmlPrecisionLigne =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('span')[4];
			_htmlPrecisionLigne.innerHTML = _xmlPrecisionLigne;
			
			
			// Lien Fiche Produit
			
			_xmlLienTrFicheProduit = _xmlProduits[key].getElementsByTagName('lien')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
			_xmlLienUrlFicheProduit = _xmlProduits[key].getElementsByTagName('lien')[0].getElementsByTagName('url')[0].firstChild.nodeValue;
			
			_LiensEle = _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('a');
			
			_htmlLienFicheProduit = _LiensEle[_LiensEle.length-1];
			_htmlLienFicheProduit.href = _xmlLienUrlFicheProduit;
			
			_htmlLienFicheProduit.getElementsByTagName('span')[0].innerHTML =_xmlLienTrFicheProduit;
			
			
		}
		
}


// Rayons
function parseFicheProduit(xmlDoc) {
	
	
	
	// Textes
	_produitsComp = getVars('produits');
	
	// XML Rayons
	getRayon = getVar('rayon');
	file = "/rayons/"+getRayon;
	xmlRayon = getXML(file);
	
	
	parseElmtsGlob(xmlDoc);
	
	// BODY
	
		
		// Image
	
		var _xmlImgBody = xmlDoc.getElementsByTagName('image')[0].firstChild.nodeValue;
		var _htmlImgBody = document.getElementById('fiche_produit').getElementsByTagName('img')[0];
		
		
		_htmlImgBody.src = _xmlImgBody;
		
		
		_xmlProduits = xmlRayon.getElementsByTagName('produit');
		_productName = getVar('name');
		
		for (i=0;i<_xmlProduits.length;i++) {
			
			if (_xmlProduits[i].getAttribute('short_name') == _productName) key = i;
		}
		
		
		// BREADCRUMB PRODUIT
		
		var _breadCrumb = _xmlProduits[key].getElementsByTagName('breadcrumb')[0].firstChild.nodeValue;
		eleBreadCrumb = document.getElementById('recherche').getElementsByTagName('span')[0];
		eleBreadCrumb.innerHTML = _breadCrumb; 
		
		
		// Produit Suivant / Precedent
		
		key_prec = parseInt(key)-1;
		key_suiv = parseInt(key)+1;
		
		
		
		
		_htmlProduitsPrec = document.getElementById('nav_produits').getElementsByTagName('span')[0];
		_htmlProduitsSuiv = document.getElementById('nav_produits').getElementsByTagName('span')[1];
		
		if (key_prec>=0) { 
			
			_xmlProduitsPrec = _xmlProduits[key_prec];
		
			// Lien
			
			 _xmlTitreLienPrec = xmlRayon.getElementsByTagName('lien_produit_prec')[0].firstChild.nodeValue;
			
			
			_lien = _xmlProduitsPrec.getElementsByTagName('lien')[0].getElementsByTagName('url')[0].firstChild.nodeValue;
			_img = _xmlProduitsPrec.getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].firstChild.nodeValue;
			_imgW = _xmlProduitsPrec.getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].getAttribute('width');
			_imgH = _xmlProduitsPrec.getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].getAttribute('height');
			
			_htmlProduitsPrec.innerHTML = '<table height="80" cellspacing="0" cellpadding="0" border="0"><tr><td><a href="'+_lien+'"><img src="'+_img+'" width="'+_imgW+'" height="'+_imgH+'" alt=""/></a></td><td valign="bottom"><a href="'+_lien+'">< '+ _xmlTitreLienPrec+'</a><br/><br/></td></tr></table>';
			
			
		}
		
		if (key_suiv < _xmlProduits.length) {
			
			 _xmlProduitsSuiv = _xmlProduits[key_suiv];
			 _xmlTitreLienSuiv = xmlRayon.getElementsByTagName('lien_produit_suiv')[0].firstChild.nodeValue;
			_lien = _xmlProduitsSuiv.getElementsByTagName('lien')[0].getElementsByTagName('url')[0].firstChild.nodeValue;
			_img = _xmlProduitsSuiv.getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].firstChild.nodeValue;
			_imgW = _xmlProduitsSuiv.getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].getAttribute('width');
			_imgH = _xmlProduitsSuiv.getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].getAttribute('height');
			
			_htmlProduitsSuiv.innerHTML = '<table height="80" cellspacing="0" cellpadding="0" border="0"><tr><td valign="bottom"><a href="'+_lien+'">'+_xmlTitreLienSuiv+' ></a><br/><br/></td><td><a href="'+_lien+'"><img src="'+_img+'" width="'+_imgW+'" height="'+_imgH+'" alt=""/></a></td></tr></table>';
		}
		
		
		// Nom / Type / Ref
		
		var _xmlNomProduit = _xmlProduits[key].getElementsByTagName('nom')[0].firstChild.nodeValue;
		var _xmlTypeProduit = _xmlProduits[key].getElementsByTagName('type')[0].firstChild.nodeValue;
		var _xmlRefProduit = _xmlProduits[key].getElementsByTagName('ref')[0].firstChild.nodeValue;
		
		
		var _htmlInfoProduit = document.getElementById('col1').getElementsByTagName('span')[0];
		var _htmlNomProduit = _htmlInfoProduit.getElementsByTagName('h1')[0];
		var _htmlTypeProduit = _htmlInfoProduit.getElementsByTagName('h2')[0];
		var _htmlRefProduit = _htmlInfoProduit.getElementsByTagName('h3')[0];
		
	
		_htmlNomProduit.innerHTML = _xmlNomProduit;
		_htmlTypeProduit.innerHTML = _xmlTypeProduit;
		_htmlRefProduit.innerHTML = _xmlRefProduit;
		
		// Textes
		var _xmlTexteConception = _xmlProduits[key].getElementsByTagName('textes')[0].getElementsByTagName('conception')[0].firstChild.nodeValue;
		var _xmlTexteDifference = _xmlProduits[key].getElementsByTagName('textes')[0].getElementsByTagName('difference')[0].firstChild.nodeValue;
		
		
		var _htmlTexteConception = document.getElementById('col1').getElementsByTagName('span')[1].getElementsByTagName('cite')[0];
		var _htmlTexteDifference = document.getElementById('col1').getElementsByTagName('span')[2].getElementsByTagName('cite')[0];
		
		_htmlTexteConception.innerHTML = _xmlTexteConception;
		_htmlTexteDifference.innerHTML =  _xmlTexteDifference
		
		
		// Note
		
		var _xmlNotes = _xmlProduits[key].getElementsByTagName('note')[0];
		var _xmlNbNotes = _xmlNotes.getAttribute("nb");
		var _xmlTitreNotes = _xmlNotes.getAttribute("titre");
		var _xmlNote  = _xmlNotes.firstChild.nodeValue;
		var _xmlTitreLienNoter = _xmlNotes.getAttribute("lien");
		
		var _htmlNotes = document.getElementById('col1').getElementsByTagName('span')[3];
		_htmlNotes.getElementsByTagName('b')[0].innerHTML = _xmlNbNotes+" "+_xmlTitreNotes;
		_htmlNotes.getElementsByTagName('img')[0].src += _xmlNote+".jpg";
		
		_htmlNotes.getElementsByTagName('a')[0].innerHTML = _xmlTitreLienNoter;
		//alert(_xmlNbNotes+"//"+_xmlTitreNotes+"//"+_xmlNote+"//"+_xmlTitreLienNoter);
		
		// Achat
		
		var _xmlAchatMagasin = _xmlProduits[key].getElementsByTagName('achat_magasin')[0];
		var _htmlAchat = document.getElementById('col1').getElementsByTagName('span')[4];
		
		var _xmlTitreAchat = _xmlAchatMagasin.getAttribute('titre');
		var _htmlTitreAchat = _htmlAchat.getElementsByTagName('h1')[0];
		_htmlTitreAchat.innerHTML = _xmlTitreAchat;  
		
		
			// Texte Magasin
			var _xmlAchatTexteMagasin = _xmlAchatMagasin.getElementsByTagName('texte')[0].firstChild.nodeValue;
			var _htmlAchatTexteMagasin =  _htmlAchat.getElementsByTagName('span')[0].getElementsByTagName('span')[0];
			_htmlAchatTexteMagasin.innerHTML = _xmlAchatTexteMagasin;
			
		var _xmlAchatWeb = _xmlProduits[key].getElementsByTagName('achat_web')[0];
		
			// Texte Web
			var _xmlAchatTexteWeb = _xmlAchatWeb.getElementsByTagName('texte')[0].firstChild.nodeValue;
			var _htmlAchatTexteWeb =  _htmlAchat.getElementsByTagName('span')[4].getElementsByTagName('span')[0];
			_htmlAchatTexteWeb.innerHTML = _xmlAchatTexteWeb;
			
			// Prix
			
			var _xmlPrixMagasin = _xmlAchatMagasin.getElementsByTagName('prix')[0].firstChild.nodeValue;
			var _xmlPrixWeb = _xmlAchatWeb.getElementsByTagName('prix')[0].firstChild.nodeValue;
			
			var _htmlPrixMagasin =  _htmlAchat.getElementsByTagName('span')[0].getElementsByTagName('span')[2];
			var _htmlPrixWeb =  _htmlAchat.getElementsByTagName('span')[4].getElementsByTagName('span')[1];
			_htmlPrixMagasin.innerHTML = _xmlPrixMagasin;
			_htmlPrixWeb.innerHTML = _xmlPrixWeb;
			
			
			// Precisions
			
			var _xmlPrecisionMagasin = _xmlAchatMagasin.getElementsByTagName('precision')[0].firstChild.nodeValue;
			var _xmlPrecisionWeb = _xmlAchatWeb.getElementsByTagName('precision')[0].firstChild.nodeValue;
			
			var _htmlPrecisionMagasin =  _htmlAchat.getElementsByTagName('span')[0].getElementsByTagName('span')[1];
			var _htmlPrecisionWeb =  _htmlAchat.getElementsByTagName('span')[4].getElementsByTagName('span')[2];
			
			
			_htmlPrecisionMagasin.innerHTML = _xmlPrecisionMagasin;
			_htmlPrecisionWeb.innerHTML = _xmlPrecisionWeb;
			
				
		// Image Produit
		
		var _xmlImageHD = _xmlProduits[key].getElementsByTagName('images')[0].getElementsByTagName('hd')[0];
		var _xmlImageHDSize = _xmlImageHD.getAttribute('width')+"x"+_xmlImageHD.getAttribute('height')+"px";
		var _xmlImageHDSrc = _xmlImageHD.firstChild.nodeValue;
		
		
		var _htmlImageHD = document.getElementById('col2').getElementsByTagName('span')[0].getElementsByTagName('img')[0];
		_htmlImageHD.setAttribute("width",_xmlImageHD.getAttribute('width'));
		_htmlImageHD.setAttribute("height",_xmlImageHD.getAttribute('height'));
		_htmlImageHD.src = _xmlImageHDSrc;
		
		
		// Icones 
		
		var _xmlIconAmi = _xmlProduits[key].getElementsByTagName('liens')[0].getElementsByTagName('envoyer_ami')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
		var _xmlIconImprimer = _xmlProduits[key].getElementsByTagName('liens')[0].getElementsByTagName('imprimer')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
		var _xmlIconFavoris = _xmlProduits[key].getElementsByTagName('liens')[0].getElementsByTagName('favoris')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
		var _xmlIconZoomer = _xmlProduits[key].getElementsByTagName('liens')[0].getElementsByTagName('zoomer')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
		
		
		var _htmlIconAmi = document.getElementById('col2').getElementsByTagName('span')[1].getElementsByTagName('span')[0];
		_htmlIconAmi.getElementsByTagName('a')[0].getElementsByTagName('cite')[0].innerHTML = _xmlIconAmi;
		
		var _htmlIconImprimer = document.getElementById('col2').getElementsByTagName('span')[1].getElementsByTagName('span')[1];
		_htmlIconImprimer.getElementsByTagName('a')[0].getElementsByTagName('cite')[0].innerHTML = _xmlIconImprimer;
		
		var _htmlIconFavoris = document.getElementById('col2').getElementsByTagName('span')[1].getElementsByTagName('span')[2];
		_htmlIconFavoris.getElementsByTagName('a')[0].getElementsByTagName('cite')[0].innerHTML = _xmlIconFavoris;
		
		var _htmlIconZoomer = document.getElementById('col2').getElementsByTagName('span')[1].getElementsByTagName('span')[3];
		_htmlIconZoomer.getElementsByTagName('a')[0].getElementsByTagName('cite')[0].innerHTML = _xmlIconZoomer;
		
		// Onglets
			
			var _xmlOnglets = _xmlProduits[key].getElementsByTagName('onglet');
			
				for (i=0;i<_xmlOnglets.length;i++) {
				
					_liOnglet = document.getElementById('row2').getElementsByTagName('li')[i].getElementsByTagName('span')[0];
					_liOnglet.innerHTML = _xmlOnglets[i].getAttribute('titre');
					_txtOnglet = document.getElementById('row2').getElementsByTagName('p')[0].getElementsByTagName('span')[i];
					_txtOnglet.innerHTML = _xmlOnglets[i].firstChild.nodeValue;
				}
			
		// Produits Complementaires
		
		
			var _xmlProduitsComp = _xmlProduits[key].getElementsByTagName('produits_complementaires')[0];
			
			var _xmlProduitsCompTitre = _xmlProduitsComp.getAttribute('titre');
			
			var _htmlProduitsComp =document.getElementById('row3').getElementsByTagName('span')[0];
			
			var _htmlProduitsCompTitre = _htmlProduitsComp.getElementsByTagName('h1')[0];
			_htmlProduitsCompTitre.innerHTML = _xmlProduitsCompTitre;
			
			
			// Liste Produits
			
			_xmlListeProduitsComp = _xmlProduits[key].getElementsByTagName('produit_complementaire');
			
			for (i=0;i<_xmlListeProduitsComp.length;i++) {
			_CurrentHtmlProduitComp = document.getElementById('row3').getElementsByTagName('span')[0].getElementsByTagName('div')[i];
		
				_htmlProduitComp =_CurrentHtmlProduitComp;
			
			
			//alert(_xmlListeProduitsComp[i].getElementsByTagName('image')[0].firstChild.nodeValue);
				
				_htmlProduitComp.getElementsByTagName('a')[0].href = _xmlListeProduitsComp[i].getElementsByTagName('url')[0].firstChild.nodeValue;
				
				_htmlProduitComp.getElementsByTagName('img')[0].setAttribute('width',_xmlListeProduitsComp[i].getElementsByTagName('image')[0].getAttribute('width'));
				_htmlProduitComp.getElementsByTagName('img')[0].setAttribute('height',_xmlListeProduitsComp[i].getElementsByTagName('image')[0].getAttribute('height'));
				_htmlProduitComp.getElementsByTagName('img')[0].src = _xmlListeProduitsComp[i].getElementsByTagName('image')[0].firstChild.nodeValue;
				
				_htmlProduitComp.getElementsByTagName('cite')[0].innerHTML = _xmlListeProduitsComp[i].getElementsByTagName('titre')[0].firstChild.nodeValue;
				
			}
			
			
	
	// Profil sportif
			
			// Titre
			
			var _xmlProfilSport = _xmlProduits[key].getElementsByTagName('profil_oxylane')[0];
			
			var _xmlProfilSportTitre = _xmlProfilSport.getAttribute('titre');
			
			var _htmlProfilSport =document.getElementById('row3').getElementsByTagName('span')[2];
			
			var _htmlProfilSportTitre = _htmlProfilSport.getElementsByTagName('h1')[0];
			
			_htmlProfilSportTitre.innerHTML = _xmlProfilSportTitre;
		
			// Type
			
			var _xmlProfilSportType = 	_xmlProfilSport.getElementsByTagName('type')[0];
			var _xmlProfilSportTypeTitre = _xmlProfilSportType.getElementsByTagName('titre')[0].firstChild.nodeValue;
			var _xmlProfilSportTypeImg = _xmlProfilSportType.getElementsByTagName('image')[0].firstChild.nodeValue;
			
			var _htmlProfilSportTypeTitre = _htmlProfilSport.getElementsByTagName('span')[0].getElementsByTagName('a')[0];
			_htmlProfilSportTypeTitre.innerHTML = _xmlProfilSportTypeTitre;
			
			var _htmlProfilSportTypeImg = _htmlProfilSport.getElementsByTagName('span')[5].getElementsByTagName('img')[0];
		
			_htmlProfilSportTypeImg.src = _xmlProfilSportTypeImg;
			
			// Niveaux
			var _xmlProfilSportNiveaux = _xmlProfilSport.getElementsByTagName('niveaux')[0];
			var _xmlProfilSportNiveauxTitre = _xmlProfilSportNiveaux.getElementsByTagName('titre')[0].firstChild.nodeValue;
			var _xmlProfilSportNiveauxValeur = _xmlProfilSportNiveaux.getElementsByTagName('valeur')[0].firstChild.nodeValue;
			
			var _htmlProfilSportNiveauxTitre = _htmlProfilSport.getElementsByTagName('span')[0].getElementsByTagName('a')[1];
			_htmlProfilSportNiveauxTitre.innerHTML = _xmlProfilSportNiveauxTitre;
			
			var _htmlProfilSportNiveauxValeur = _htmlProfilSport.getElementsByTagName('span')[0].getElementsByTagName('b')[0];
			_htmlProfilSportNiveauxValeur.innerHTML = _xmlProfilSportNiveauxValeur;
			
			
			// Ages
			var _xmlProfilSportAges = _xmlProfilSport.getElementsByTagName('age')[0];
			var _xmlProfilSportAgesTitre = _xmlProfilSportAges.getElementsByTagName('titre')[0].firstChild.nodeValue;
			var _xmlProfilSportAgesValeur = _xmlProfilSportAges.getElementsByTagName('valeur')[0].firstChild.nodeValue;
			
			
			var _htmlProfilSportAgesTitre = _htmlProfilSport.getElementsByTagName('span')[0].getElementsByTagName('a')[2];
			_htmlProfilSportAgesTitre.innerHTML = _xmlProfilSportAgesTitre;
			
			var _htmlProfilSportAgesValeur = _htmlProfilSport.getElementsByTagName('span')[0].getElementsByTagName('b')[1];
			_htmlProfilSportAgesValeur.innerHTML = _xmlProfilSportAgesValeur;
			
			// Condition
			var _xmlProfilSportCondition= _xmlProfilSport.getElementsByTagName('condition')[0];
			var _xmlProfilSportConditionTitre = _xmlProfilSportCondition.getElementsByTagName('titre')[0].firstChild.nodeValue;
			var _xmlProfilSportConditionValeur = "images/misc/profils/"+_xmlProfilSportCondition.getElementsByTagName('valeur')[0].firstChild.nodeValue;
			_htmlProfilSport.getElementsByTagName('span')[5].getElementsByTagName('a')[0].innerHTML = _xmlProfilSportConditionTitre;
			_htmlProfilSport.getElementsByTagName('span')[5].getElementsByTagName('img')[1].src = _xmlProfilSportConditionValeur+".jpg";
			
			// Technique
			var _xmlProfilSportTechnique= _xmlProfilSport.getElementsByTagName('technique')[0];
			var _xmlProfilSportTechniqueTitre = _xmlProfilSportTechnique.getElementsByTagName('titre')[0].firstChild.nodeValue;
			var _xmlProfilSportTechniqueValeur = "images/misc/profils/"+_xmlProfilSportTechnique.getElementsByTagName('valeur')[0].firstChild.nodeValue;
			
			_htmlProfilSport.getElementsByTagName('span')[5].getElementsByTagName('a')[1].innerHTML = _xmlProfilSportTechniqueTitre;
			_htmlProfilSport.getElementsByTagName('span')[5].getElementsByTagName('img')[2].src = _xmlProfilSportTechniqueValeur+".jpg";
}



function parseInfos(xmlDoc) {
	
	
	parseElmtsGlob(xmlDoc);
	
	
	// BODY
	
		
		// Image
	
		var _xmlImgBody = xmlDoc.getElementsByTagName('image')[0].firstChild.nodeValue;
		var _htmlImgBody = document.getElementById('infos').getElementsByTagName('img')[0];
		
		
		_htmlImgBody.src = _xmlImgBody;
		
		
		// Titre Info
		
		var _xmlTrInfo = xmlDoc.getElementsByTagName('themes')[0].getAttribute('titre');
		var _htmlTrInfo = document.getElementById('liste_infos').getElementsByTagName('h1')[0];
		
		_htmlTrInfo.innerHTML = _xmlTrInfo;
		
		
		// Liste des themes
		
		var _xmlThemes = xmlDoc.getElementsByTagName('theme');
		
		var _htmlThemes = document.getElementById("liste_infos").getElementsByTagName('span')[0];
		for (i=0;i<_xmlThemes.length;i++) {
			
			_xmlTheme = _xmlThemes[i];
			
			_xmlLienRubInfos = _xmlGlobal.getElementsByTagName('nav_left')[0].getElementsByTagName('item')[2].getElementsByTagName('url')[0].firstChild.nodeValue;
			_htmlTheme = '<a href="'+_xmlLienRubInfos+"?theme="+_xmlTheme.getAttribute('short_name')+'">'+ _xmlTheme.firstChild.nodeValue+'</a>';
			if (i!=_xmlThemes.length-1) _htmlTheme +=" / ";
			_htmlThemes.innerHTML +=_htmlTheme;
		
		}
		
		// Liste des actus
		
		var _theme = getVar('theme');
			
			// Parcours les infos a la recherche du theme demande
			if (_theme) {
			var _xmlInfosOrig =  xmlDoc.getElementsByTagName('info');
			
			var _xmlInfos = new Array();
			
				for (i=0;i<_xmlInfosOrig.length;i++) {
			
				if (_xmlInfosOrig[i].getAttribute('theme') == _theme) _xmlInfos.push(_xmlInfosOrig[i]);
				
				
				}
			
			
			} else {
			
			var _xmlInfos = xmlDoc.getElementsByTagName('info');
			
			}
		
		for (i=0;i<_xmlInfos.length;i++) {
			
			_xmlInfo = _xmlInfos[i];
			
			_CurrentHtmlInfos = document.getElementById('liste_infos').getElementsByTagName('div')[0];
			
			if (i>0) {
				_htmlInfos = _htmlInfos.cloneNode(true);
				document.getElementById('liste_infos').appendChild(_htmlInfos);
			} else {
				_htmlInfos =_CurrentHtmlInfos;
			}
			
			// Image
			var _xmlInfoImage = _xmlInfo.getElementsByTagName('image')[0];
			_xmlInfoImageW = _xmlInfoImage.getAttribute('width');
			_xmlInfoImageH = _xmlInfoImage.getAttribute('height');
			_xmlInfoImageSrc = _xmlInfoImage.firstChild.nodeValue;
			
			var _htmlInfoImage = _htmlInfos.getElementsByTagName('img')[0];
			_htmlInfoImage.setAttribute('width',_xmlInfoImageW);
			_htmlInfoImage.setAttribute('height',_xmlInfoImageH);
			_htmlInfoImage.src = _xmlInfoImageSrc;
			
			// Titre
			var _xmlInfoTitre = _xmlInfo.getElementsByTagName('titre')[0].firstChild.nodeValue;
			var _htmlInfoTitre = _htmlInfos.getElementsByTagName('h1')[0];
			_htmlInfoTitre.innerHTML = _xmlInfoTitre+"&nbsp;&nbsp;-&nbsp;&nbsp;" ;
			
			// Date
			var _xmlInfoDate = _xmlInfo.getElementsByTagName('date')[0].firstChild.nodeValue;
			var _htmlInfoDate = _htmlInfos.getElementsByTagName('h2')[0];
			_htmlInfoDate.innerHTML = _xmlInfoDate ;
			
			// Extrait
			var _xmlInfoExtrait = _xmlInfo.getElementsByTagName('extrait')[0].firstChild.nodeValue;
			var _htmlInfoExtrait = _htmlInfos.getElementsByTagName('span')[1];
			_htmlInfoExtrait.innerHTML = _xmlInfoExtrait;
			
			// Lien
			var _xmlInfoLienTitre = xmlDoc.getElementsByTagName('lien_suite')[0].firstChild.nodeValue;
			_xmlInfoLienUrl = _xmlInfo.getElementsByTagName('url')[0].firstChild.nodeValue;
			var _htmlInfoLien = document.createElement('a');
			_htmlInfoLien.href = _xmlInfoLienUrl;
			_htmlInfoLien.innerHTML = _xmlInfoLienTitre;
			_htmlInfoExtrait.appendChild(_htmlInfoLien);
			
			
		}
		
		
		
		
}

function parseOuAcheter(xmlDoc) {
	
	
	// Textes Nav, Moteur de recherche, Breadcrumb, Footer
	parseElmtsGlob(xmlDoc);
	
	// BODY
	
		
		// Titre
	
		var _xmlTitreBloc = xmlDoc.getElementsByTagName('bloc')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
		var _htmlTitreBloc = document.getElementById('contenu').getElementsByTagName('h1')[0];
		
		_htmlTitreBloc.innerHTML = _xmlTitreBloc;
		
		// Achat Magasin
		var _xmlAchatMag = xmlDoc.getElementsByTagName('bloc')[0].getElementsByTagName('magasin')[0];
		var _xmlAchatMagTxt = _xmlAchatMag.getElementsByTagName('texte')[0].firstChild.nodeValue;
		var _xmlAchatMagUrl = _xmlAchatMag.getElementsByTagName('url')[0].firstChild.nodeValue;
		
		var _htmlAchatMag = document.getElementById('row1');
		var _htmlAchatMagLiens1 = _htmlAchatMag.getElementsByTagName('a')[0];
		_htmlAchatMagLiens1.setAttribute('href',_xmlAchatMagUrl);
		var _htmlAchatMagLiens2 = _htmlAchatMag.getElementsByTagName('a')[1];
		_htmlAchatMagLiens2.setAttribute('href',_xmlAchatMagUrl);
		
		var _htmlAchatMagTxt = _htmlAchatMag.getElementsByTagName('span')[0];
		_htmlAchatMagTxt.innerHTML = _xmlAchatMagTxt;
		
		
		// Achat Web
		
		var _xmlAchatWeb = xmlDoc.getElementsByTagName('bloc')[0].getElementsByTagName('web')[0];
		var _xmlAchatWebTxt = _xmlAchatWeb.getElementsByTagName('texte')[0].firstChild.nodeValue;
		var _xmlAchatWebUrl = _xmlAchatWeb.getElementsByTagName('url')[0].firstChild.nodeValue;
		
		var _htmlAchatWeb = document.getElementById('row2');
		var _htmlAchatWebLiens1 = _htmlAchatWeb.getElementsByTagName('a')[0];
		_htmlAchatWebLiens1.setAttribute('href',_xmlAchatWebUrl);
		var _htmlAchatWebLiens2 = _htmlAchatWeb.getElementsByTagName('a')[1];
		_htmlAchatWebLiens2.setAttribute('href',_xmlAchatWebUrl);
		
		var _htmlAchatWebTxt = _htmlAchatWeb.getElementsByTagName('span')[0];
		_htmlAchatWebTxt.innerHTML = _xmlAchatWebTxt;
		
		
}


function parseFavoris(xmlDoc) {

	// Textes Nav, Moteur de recherche, Breadcrumb, Footer
	parseElmtsGlob(xmlDoc);
	
	
	// Image
	
		var _xmlImgBody = xmlDoc.getElementsByTagName('image')[0].firstChild.nodeValue;
		var _htmlImgBody = document.getElementById('comparateur').getElementsByTagName('img')[0];
		
		
		
		_htmlImgBody.src = _xmlImgBody;
		
		
		
	// Produits a afficher
		
		file = "favoris-exemple";
		xmlRayon = getXML(file);
	
		msg = "";
		
		_xmlProduits = xmlRayon.getElementsByTagName('produit');
		
		for (i=0;i<_xmlProduits.length;i++) {
		key = i;
		var _xmlTitreProduit = _xmlProduits[key].getElementsByTagName('nom')[0].firstChild.nodeValue;
		_CurrentHtmlProduit = document.getElementById('liste_produits').getElementsByTagName('div')[0];
		
			if (i>0) {
				_htmlProduit = _htmlProduit.cloneNode(true);
				document.getElementById('liste_produits').appendChild(_htmlProduit);
			} else {
				_htmlProduit =_CurrentHtmlProduit;
			}
			
			
			/*if (i == _xmlProduits.length-1) _htmlProduit.style.border="0px";*/
			
			// Titre
			_htmlProduit.getElementsByTagName('h1')[0].innerHTML = _xmlTitreProduit;
			
			// Btn Supprimer
			_htmlBtnSupprimer = _htmlProduit.getElementsByTagName('a')[0];
			_htmlBtnSupprimer.setAttribute('id',i);
			_htmlBtnSupprimer.onclick = function() { deleteFavoris(this.getAttribute('id'));}
			_htmlBtnSupprimer.getElementsByTagName('cite')[0].innerHTML = xmlDoc.getElementsByTagName('bouton_supprimer')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
			
			// Btn Envoyer
			_htmlBtnEnvoyer = _htmlProduit.getElementsByTagName('a')[1];
			_htmlBtnEnvoyer.setAttribute('href',xmlDoc.getElementsByTagName('bouton_envoyer_ami')[0].getElementsByTagName('url')[0].firstChild.nodeValue);
			_htmlBtnEnvoyer.getElementsByTagName('cite')[0].innerHTML = xmlDoc.getElementsByTagName('bouton_envoyer_ami')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
			if (i>0) _htmlBtnEnvoyer.style.display="none";
			else _htmlBtnEnvoyer.style.display="block";
			
			// Avertissement Suppression
			_htmlAvertissement = document.getElementById('avertissement');
			_htmlAvertissement.value = xmlDoc.getElementsByTagName('avertissement')[0].firstChild.nodeValue;
			
			
			// Image
			var _htmlImgTh = _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('img')[0];
			var _xmlImgTh = _xmlProduits[key].getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].firstChild.nodeValue;
			_htmlImgTh.setAttribute('width',_xmlProduits[key].getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].getAttribute('width'));
			_htmlImgTh.setAttribute('height',_xmlProduits[key].getElementsByTagName('images')[0].getElementsByTagName('thumb')[0].getAttribute('height'));
			_htmlImgTh.src = _xmlImgTh;
			
			// Ref
			
			var _xmlRef = _xmlProduits[key].getElementsByTagName('ref')[0].firstChild.nodeValue;
			var _htmlRef =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('b')[0];
			_htmlRef.innerHTML = _xmlRef;
			
			
			// Tailles Coloris
			
			var _htmlTaillesColoris = _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[1].getElementsByTagName('b')[0];
			var _xmlTitreTaillesColoris =  _xmlProduits[key].getElementsByTagName('tailles_coloris')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
			
			
				// Titre
				_htmlTaillesColoris.innerHTML =_xmlTitreTaillesColoris ;
				
				// Texte Taille
				var _htmlTexteTaillesColoris = _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[1].getElementsByTagName('cite')[0];
				var _xmlTexteTaillesColoris =  _xmlProduits[key].getElementsByTagName('tailles_coloris')[0].getElementsByTagName('taille')[0].firstChild.nodeValue;
				
				_htmlTexteTaillesColoris.innerHTML =_xmlTexteTaillesColoris ;
				
				// Titre Coloris
				var _xmlTexteColoris =  _xmlProduits[key].getElementsByTagName('tailles_coloris')[0].getElementsByTagName('coloris')[0].getAttribute('titre');
				_htmlTexteTaillesColoris.innerHTML +="<br/>"+_xmlTexteColoris+"<br/>";
				
				
				// Coloris
				var _xmlColoris = _xmlProduits[key].getElementsByTagName('tailles_coloris')[0].getElementsByTagName('coloris')[0].getElementsByTagName('couleur');
				
				if (_xmlColoris) {
				for (j=0;j<_xmlColoris.length;j++) {
				
					_htmlTexteTaillesColoris.innerHTML +=_xmlColoris[j].getElementsByTagName('titre')[0].firstChild.nodeValue+" .<img src='"+_xmlColoris[j].getElementsByTagName('image')[0].firstChild.nodeValue+"' alt=''/><br/>";
					
				}
				}
				
		
			// Description
			
			var _xmlDescription =  _xmlProduits[key].getElementsByTagName('textes')[0].getElementsByTagName('description')[0].firstChild.nodeValue;
			var _htmlDescription =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[2];
			
			_htmlDescription.innerHTML = _xmlDescription;
			
			// Achat Magasin / Ligne
			
			var _xmlAchatMagasin = _xmlProduits[key].getElementsByTagName('achat_magasin')[0].getElementsByTagName('texte')[0].firstChild.nodeValue; 
			var _xmlAchatWeb = _xmlProduits[key].getElementsByTagName('achat_web')[0].getElementsByTagName('texte')[0].firstChild.nodeValue; 
			
			var _htmlAchatMagasin =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('span')[0];
			_htmlAchatMagasin.innerHTML = _xmlAchatMagasin;
			
			var _htmlAchatWeb =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('span')[2];
			_htmlAchatWeb.innerHTML = _xmlAchatWeb;
			
			
			// Prix
			
			var _xmlPrixMagasin = _xmlProduits[key].getElementsByTagName('achat_magasin')[0].getElementsByTagName('prix')[0].firstChild.nodeValue;
			var _xmlPrixWeb = _xmlProduits[key].getElementsByTagName('achat_web')[0].getElementsByTagName('prix')[0].firstChild.nodeValue;
			
			var _htmlPrixMagasin =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('span')[1];
			_htmlPrixMagasin.innerHTML = _xmlPrixMagasin;
			
			var _htmlPrixWeb =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('span')[3];
			_htmlPrixWeb.innerHTML = _xmlPrixWeb;
			
			// Precision Magasin / Ligne
			
			_xmlPrecisionMagasin= _xmlProduits[key].getElementsByTagName('achat_magasin')[0].getElementsByTagName('precision')[0].firstChild.nodeValue; 
			var _htmlPrecisionMagasin =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('span')[5];
			_htmlPrecisionMagasin.innerHTML = _xmlPrecisionMagasin;
			
			
			_xmlPrecisionLigne = _xmlProduits[key].getElementsByTagName('achat_web')[0].getElementsByTagName('precision')[0].firstChild.nodeValue; 
			var _htmlPrecisionLigne =  _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('span')[4];
			_htmlPrecisionLigne.innerHTML = _xmlPrecisionLigne;
			
			
			// Lien Fiche Produit
			
			_xmlLienTrFicheProduit = _xmlProduits[key].getElementsByTagName('lien')[0].getElementsByTagName('titre')[0].firstChild.nodeValue;
			_xmlLienUrlFicheProduit = _xmlProduits[key].getElementsByTagName('lien')[0].getElementsByTagName('url')[0].firstChild.nodeValue;
			
			_LiensEle = _htmlProduit.getElementsByTagName('span')[0].getElementsByTagName('span')[3].getElementsByTagName('a');
			
			_htmlLienFicheProduit = _LiensEle[_LiensEle.length-1];
			_htmlLienFicheProduit.href = _xmlLienUrlFicheProduit;
			
			_htmlLienFicheProduit.getElementsByTagName('span')[0].innerHTML =_xmlLienTrFicheProduit;
			
			
		}
		
		
		// Explications
		_htmlExplications = document.createElement('div');
		_htmlExplications.setAttribute('id','explications');
		_htmlExplications.innerHTML = xmlDoc.getElementsByTagName('explications')[0].firstChild.nodeValue;
		document.getElementById('liste_produits').appendChild(_htmlExplications);
}



function parseQuiSommesNous(xmlDoc) {

	//Moteur de recherche, Breadcrumb, Footer
	// Keywords footer

	xmlGlobal = getXML("global");
	
	// Btn Change Lang
	
	var _xmlBtnChangeLang = xmlGlobal.getElementsByTagName('footer')[0].getElementsByTagName('btn_lang');
	var eleChangeLang =  document.getElementById('footer').getElementsByTagName('span')[0];
	
	for (i=0;i<_xmlBtnChangeLang.length;i++) {
		
		_img = eleChangeLang.getElementsByTagName('img')[0];
		_a = eleChangeLang.getElementsByTagName('a')[0]; 
		_a.href = _xmlBtnChangeLang[i].getElementsByTagName('url')[0].firstChild.nodeValue;
		imgLang = document.createElement("img");
		imgLang.setAttribute('src','images/flags/'+_xmlBtnChangeLang[i].getElementsByTagName('image')[0].firstChild.nodeValue);
		imgLang.setAttribute('width','40');
		imgLang.setAttribute('height','15');
		imgLang.setAttribute('alt','');
		_a.appendChild(imgLang);
		txtLang = document.createElement("span");
		txtLang.innerHTML = _xmlBtnChangeLang[i].getElementsByTagName('titre')[0].firstChild.nodeValue;
		_a.appendChild(txtLang);
		
	}
	
	
	
	// Liens Footer
	
	var _xmlFooterLiens = xmlGlobal.getElementsByTagName('footer')[0].getElementsByTagName('item');
	var _footerLiens = document.getElementById('footer').getElementsByTagName('span')[2];

	for (i=0;i<_xmlFooterLiens.length;i++) {
		myLink = document.createElement("a");
		
		myLink.setAttribute("href",_xmlFooterLiens[i].getElementsByTagName('url')[0].firstChild.nodeValue);
		
		myText = document.createTextNode(_xmlFooterLiens[i].getElementsByTagName('titre')[0].firstChild.nodeValue);

		myLink.appendChild(myText);
		
		_footerLiens.appendChild(myLink);
		
		// Pas de slash aprĖs le dernier lien
		if (i!=_xmlFooterLiens.length-1) {
		_footerLiens.innerHTML +="&nbsp;&nbsp;/&nbsp;&nbsp;";
		}
		
	}
	
	// Oxylane
	
	var _xmlOxylane = xmlGlobal.getElementsByTagName('lien_oxylane')[0];
	var _xmlOxylaneImg = _xmlOxylane.getElementsByTagName('image')[0].firstChild.nodeValue;
	var _xmlOxylaneUrl = _xmlOxylane.getElementsByTagName('url')[0].firstChild.nodeValue;
	
	
	var _htmlOxylane = document.getElementById('oxylane');
	
	_htmlOxylane.getElementsByTagName('a')[0].href = _xmlOxylaneUrl;
	_htmlOxylane.getElementsByTagName('img')[0].src +=_xmlOxylaneImg;
	
	
	parseElmtsGlob(xmlDoc);
}


function suivre_souris0(e) {

if (e) {
var x =  e.pageX - 600;
var y =  e.pageY - 180;

} else {
var x = event.clientX - 700;
var y = event.clientY - 200;
}

 if( document.documentElement && document.documentElement.clientWidth) // Donc DOCTYPE
      DocRef = document.documentElement;   // Dans ce cas c'est documentElement qui est reference
    else
      DocRef = document.body;                    // Dans ce cas c'est body qui est reference

    //-- On rajoute la position liee aux ScrollBars
    x += DocRef.scrollLeft;
    y += DocRef.scrollTop;
    

if (document.getElementById("popup")) {

document.getElementById("popup").style.position= "absolute";
document.getElementById("popup").style.left = x+"px"; 
document.getElementById("popup").style.top  = y+"px";

if (document.getElementById("popup").style.display !="block") {
document.getElementById("popup").style.display="block";
}

}

}

function showPopup(ele) {

document.onmousemove = suivre_souris0;

id = ele.parentNode.parentNode.getAttribute('id');


// Extraction XML

_imgPng = _xmlProduits[id].getElementsByTagName('images')[0].getElementsByTagName('popup')[0].firstChild.nodeValue;
_txtConception = _xmlProduits[id].getElementsByTagName('textes')[0].getElementsByTagName('conception')[0].firstChild.nodeValue;
_txtShortMagasin = _xmlProduits[id].getElementsByTagName('achat_magasin')[0].getElementsByTagName('texte_popup')[0].firstChild.nodeValue;
_txtShortWeb = _xmlProduits[id].getElementsByTagName('achat_web')[0].getElementsByTagName('texte_popup')[0].firstChild.nodeValue;
_txtPrecisionsWeb = _xmlProduits[id].getElementsByTagName('achat_web')[0].getElementsByTagName('precision')[0].firstChild.nodeValue;
_prixMagasin = _xmlProduits[id].getElementsByTagName('achat_magasin')[0].getElementsByTagName('prix')[0].firstChild.nodeValue;
_prixWeb =_xmlProduits[id].getElementsByTagName('achat_web')[0].getElementsByTagName('prix')[0].firstChild.nodeValue;

_txtSpan = "<b>"+_txtPrix+"</b><br/><br/><b>/</b>&nbsp;"+_txtShortMagasin+"<br/><b>/</b>&nbsp;"+_prixMagasin+"<br/><br/><b>/</b>&nbsp;"+_txtShortWeb+"<br/><b>/</b>&nbsp;"+_prixWeb+"&nbsp;<i>"+_txtPrecisionsWeb+"</i>";

_htmlPopUpTxt = document.getElementById('popup').getElementsByTagName('p')[0];
_htmlPopUpTxt.innerHTML = _txtConception;

_htmlPopUpImg = document.getElementById('popup').getElementsByTagName('img')[0];

_htmlPopUpImg.setAttribute('width',_xmlProduits[id].getElementsByTagName('images')[0].getElementsByTagName('popup')[0].getAttribute('width'));
_htmlPopUpImg.setAttribute('height',_xmlProduits[id].getElementsByTagName('images')[0].getElementsByTagName('popup')[0].getAttribute('height'));
_htmlPopUpImg.src = _imgPng;


_htmlPopUpSpan =  document.getElementById('popup').getElementsByTagName('span')[0];
_htmlPopUpSpan.innerHTML = _txtSpan;




}


function hidePopUp() {
_popUp = document.getElementById('popup');
_popUp.style.display="none";
document.onmousemove = function() {};
_popUp.style.left = "-300px";
_popUp.style.top = "-300px";
}

function checkCompareProduit(img) {
	
	checkBox = img.parentNode.getElementsByTagName('input')[0];
	if (img.className !="on") {
	img.src ="images/btn/tick-on.png";
	img.className = "on";
	checkBox.checked = true;
	

	} else {
	img.src ="images/btn/tick-off.png";
	img.className = "off";
	checkBox.checked = false;
	}
	
	setCheckbox(checkBox);
}

function setCheckbox(checkBox) {

	if (checkBox.checked) {
	// Ajoute
		
		if (!document.getElementById('check_'+checkBox.value)) {
			_eleHiddenCheck = document.createElement('input');
			_eleHiddenCheck.setAttribute('type','hidden');
			_eleHiddenCheck.setAttribute('value',checkBox.value);
			_eleHiddenCheck.setAttribute('name','produits');
			_eleHiddenCheck.setAttribute('id','check_'+checkBox.value);
			_htmlForm.appendChild(_eleHiddenCheck);
		}
	
	} else {
		if (document.getElementById('check_'+checkBox.value)) {
		
		ele = document.getElementById('check_'+checkBox.value);
		ele.parentNode.removeChild(ele);
		}
	}
}

function compareSubmit() {
var avertissement = document.getElementById('avertissement').value;

if (_htmlForm.elements.length < 3) {
alert(avertissement);
} else {
_htmlForm.submit();
}

}

// RAYON BOUTIQUE
var page;

function swapPageRayon(_page) {

_currentPage = document.getElementById('produits').getElementsByTagName('ul')[page-1];
_currentPage.style.display="none";

page = _page;
_newPage = document.getElementById('produits').getElementsByTagName('ul')[_page-1];
_newPage.style.display="block";

if (page !="1") {
	
	_htmlNavPagesPrec.href="Javascript:swapPageRayon("+(page-1)+");";
}
		
if (page !=nb_pages) {

	_htmlNavPagesSuiv.href="Javascript:swapPageRayon("+(page+1)+");";
}
		
		


}

function gotoFicheProduit(i) {

location.href = _xmlProduits[i].getElementsByTagName('lien')[0].getElementsByTagName('url')[0].firstChild.nodeValue;

}
function deleteFavoris(id) {

// Fonction Ajax a realiser ...

// DIV Produit a supprimer
ele = document.getElementById('liste_produits').getElementsByTagName('div')[id];

// Avertissement concernant la suppression du produit

	
var avertissement = document.getElementById('avertissement').value;

// Nom du Produit
	nomProduit = ele.getElementsByTagName('h1')[0].firstChild.nodeValue;
	avertissement = avertissement.replace("%s", nomProduit);
	
	// Si confirmation de la suppression
if (confirm(avertissement)) {
ele.style.display = "none";


	var liste_produits = document.getElementById("liste_produits").getElementsByTagName('div');
	var first_visible =false;
	
	// Affiche le premier bouton "Envoyer a un ami"
	for (i=0;i<liste_produits.length;i++) {
		
		
		if (!first_visible) {
			
			if (liste_produits[i].style.display == "") {
			liste_produits[i].getElementsByTagName('a')[1].style.display = "block";
			first_visible = true;
			} 
		}
	}
	
	
}



}


function getElementsByName_iefix(tag, name) {
     
     var elem = document.getElementsByTagName(tag);
     var arr = new Array();
     for(i = 0,iarr = 0; i < elem.length; i++) {
          att = elem[i].getAttribute("name");
          if(att == name) {
               arr[iarr] = elem[i];
               iarr++;
          }
     }
     return arr;
}

function swapPageResultatTest(id) {
	
	var _pages =getElementsByName_iefix('div','page');
	for (i=0;i<_pages.length;i++) {
		if (_pages[i].getAttribute('id') !=id) _pages[i].style.display="none";
		else  _pages[i].style.display="block";
	}
}

// COOKIES Page Tests

//recupere le nom et la valeur du cookie
function GetCookie () {
var cookValue = "";
var cookName = "";


alert(document.cookie);

}
 
//cree le cookie avec la valeur saisie en parametre
function SetCookie (name, value)
{

alert(name+"//"+value);
//nouvel objet date
var aujourdhui = new Date() ;
 
//nouvel objet date
var expdate = new Date() ;
 
//plus an an  partir d'aujourdh'ui le cookie ne s'efface jamais
expdate.setTime( aujourdhui.getTime() + ( 365*24*60*60*1000 ) ) ;
 
//creation du cookie de nom name et de valeur saisie en parametre
document.cookie = name + "=" + value + ";expires=" + expdate.toGMTString() ;
}
 


/*****************************************************/
/*					FONCTIONS						 */
/*****************************************************/

function homeLoad(){
$('btn-left').style.display='none';
//setTimeout("autoSlide()", 5000);

}

var currentPage = 1;

function autoSlide() {


slideHomepage('right');


setTimeout("autoSlide()", 5000);
}

function slideHomepage(direction) {

var nb_pages = $('tableSlide').getElementsByTagName('td').length;

if (currentPage == nb_pages) {
direction = "start";
}


if (direction == "right") { 
	var position_x = -1127;
	currentPage++;
	id = 'slide-'+(currentPage-1);
	id2 = 'slide-'+currentPage;
} else if (direction == "left") {
	var position_x = 1127;
	currentPage--;
	id2 = 'slide-'+(currentPage-1);
	id = 'slide-'+currentPage;
} else if (direction == "start") {
	currentPage = 1;
	var  position_x = 1127*(nb_pages-1);
}


//var images = $('slideshow').getElementsByTagName('img').length;

//key_img = currentPage -1;

//new Effect.Fade(id, { duration: 0.5 ,beforeUpdate:function() { new Effect.Appear(id2, { duration: 0.5,afterFinish:function() {showSlideBtn()}});}});

new Effect.Move('slideshow', {x: position_x, y: 0, mode: 'relative',duration: 0.4,transition: Effect.Transitions.sinoidal,afterFinish:function() {showSlideBtn()}});

}