function navFicheProduit(page,id,strLang){
	new Ajax.Updater('divFicheProduit','ajax/produitsFiche_'+page+'.php?idp='+id, {
		method: 'post',
		evalScripts: true
	});
	//Gestion des boutons on / off
	var tabPages = Array("specifications","geometrie","temoignages","avis","plusTime");
	for(i=0; i<tabPages.length; i++){
		if(tabPages[i]==page){
			$('imgLien_'+tabPages[i]).src = "images/"+strLang+"/ong_"+tabPages[i]+"_on.gif";
			$('imgLien_'+tabPages[i]).onmouseout = function () { this.src = "images/"+strLang+"/ong_"+(this.id.substr(8,this.id.length-8))+"_on.gif"; }
		} else {
			$('imgLien_'+tabPages[i]).src = "images/"+strLang+"/ong_"+tabPages[i]+"_off.gif";
			$('imgLien_'+tabPages[i]).onmouseout = function () { this.src = "images/"+strLang+"/ong_"+(this.id.substr(8,this.id.length-8))+"_off.gif"; }
		}
	}
}

function navGlossaire(lettre){
	new Ajax.Updater('divListeMot','ajax/glossaireListe.php?lettre='+lettre, {
		method: 'post',
		evalScripts: true
	});
}

function affichArticle(id)
{
	document.getElementById("old_"+old).className = "liengrisGras11s";
	
	 old = id;
	document.getElementById("old_"+old).className = "liengrisGras11Sel";
	
	new Ajax.Updater('divArticleOn','ajax/articleSelect.php?id='+id, {
		method: 'post',
		evalScripts: true
	});
	new Ajax.Updater('divCommentaire','ajax/articleCommentaire.php?id='+id, {
		method: 'post',
		evalScripts: true
	});
}

function affichArchive(rub,arch)
{
	new Ajax.Updater('divArticleOn','ajax/articleSelect.php?rubrique='+rub+'&archive='+arch, {
		method: 'post',
		evalScripts: true
	});
	new Ajax.Updater('divArticleListe','ajax/articleListe.php?archive='+arch, {
		method: 'post',
		evalScripts: true
	});
	new Ajax.Updater('divCommentaire','ajax/articleCommentaire.php?rubrique='+rub+'&archive='+arch, {
		method: 'post',
		evalScripts: true
	});
}

function changePage(page,id,archive)
{
	new Ajax.Updater('divArticleListe','ajax/articleListe.php?page='+page+'&id='+id+'&archive='+archive, {
		method: 'post',
		evalScripts: true
	});
}

function changePageCom(page,id,nb)
{
	new Ajax.Updater('divCommentaire','ajax/articleCommentaire.php?pageC='+page+'&id='+id+'&nb='+nb, {
		method: 'post',
		evalScripts: true
	});
}

function changeParcoursCom(page,id)
{
	new Ajax.Updater('divCommentaire','ajax/parcoursCommentaire.php?pageC='+page+'&id='+id, {
		method: 'post',
		evalScripts: true
	});
}

function changeParcoursPage(page, lieu, ordre, nbpage, mode)
{
	new Ajax.Updater('divCommentaire','ajax/parcoursRecherche.php?pageC='+page+'&lieu='+lieu+'&ordre='+ordre+'&nbpage='+nbpage+'&nationnal='+mode, {
		method: 'post',
		evalScripts: true
	});
}

function changeNationnalParcours(lieu, mode)
{
  new Ajax.Updater('divCommentaire','ajax/parcoursRecherche.php?lieu='+lieu+'&nationnal='+mode, {
		method: 'post',
		evalScripts: true
	});
}
function changeOrdre(ordre, lieu, nbpage, mode)
{
	new Ajax.Updater('divCommentaire','ajax/parcoursRecherche.php?ordre='+ordre+'&lieu='+lieu+'&nbpage='+nbpage+'&nationnal='+mode, {
		method: 'post',
		evalScripts: true
	});
}

function changeNumber(nbpage, lieu, ordre, mode) {
  new Ajax.Updater('divCommentaire','ajax/parcoursRecherche.php?ordre='+ordre+'&lieu='+lieu+'&nbpage='+nbpage+'&nationnal='+mode, {
		method: 'post',
		evalScripts: true
	});
}

function affichVendeur(re, t) {
  /*new Ajax.Updater('dealer_location','ajax/revendeurRecherche.php?recherche='+recherche+'&type='+type, {
		method: 'post',
		evalScripts: true
	});*/
	new Ajax.Updater('dealer_location', 'ajax/revendeurRecherche.php', { method: 'post',
  postBody: $H({recherche: re, type: t}).toQueryString()});
  
}

function changePageVendeur(p, re, nb, t) {
  /*new Ajax.Updater('dealer_location','ajax/revendeurRecherche.php?pageC='+pageC+'&recherche='+recherche+'&nbpage='+nbpage+'&type='+type, {
		method: 'post',
		evalScripts: true
	});*/
	new Ajax.Updater('dealer_location', 'ajax/revendeurRecherche.php', { method: 'post',
  postBody: $H({recherche: re, nbpage: nb, type: t, pageC: p}).toQueryString()});
}

function changeNombreVendeur(nb, re, t) {
  /*new Ajax.Updater('dealer_location','ajax/revendeurRecherche.php?recherche='+recherche+'&nbpage='+nbpage+'&type='+type, {
		method: 'post',
		evalScripts: true
	});*/
	new Ajax.Updater('dealer_location', 'ajax/revendeurRecherche.php', { method: 'post',
  postBody: $H({recherche: re, nbpage: nb, type: t}).toQueryString()});
//});
}



function changePageAvisProduit(page,id,nb)
{
	new Ajax.Updater('divFicheProduit','ajax/produitsFiche_avis.php?page='+page+'&idp='+id+'&nb='+nb, {
		method: 'post',
		evalScripts: true
	});
}

function changePageTemoinProduit(page,id,nb)
{
	new Ajax.Updater('divFicheProduit','ajax/produitsFiche_temoignages.php?page='+page+'&idp='+id+'&nb='+nb, {
		method: 'post',
		evalScripts: true
	});
}
function changePageArticleProduit(page,id)
{
	new Ajax.Updater('divFicheProduit','ajax/produitsFiche_plusTime.php?page='+page+'&idp='+id, {
		method: 'post',
		evalScripts: true
	});
}


function navGestionCompte(page,lg){
	new Ajax.Updater('divGestionCompte','ajax/compte_'+page+'.php', {
		method: 'post',
		evalScripts: true
	});
	//Gestion des boutons on / off
	var tabPages = Array("parcours","favoris","produits","actus");
	for(i=0; i<tabPages.length; i++){
		if(tabPages[i]==page){
			$('imgLien_'+tabPages[i]).src = "images/"+lg+"/ong_"+tabPages[i]+"_on.png";
			$('imgLien_'+tabPages[i]).onmouseout = function () { this.src = "images/"+lg+"/ong_"+(this.id.substr(8,this.id.length-8))+"_on.png"; }
		} else {
			$('imgLien_'+tabPages[i]).src = "images/"+lg+"/ong_"+tabPages[i]+"_off.png";
			$('imgLien_'+tabPages[i]).onmouseout = function () { this.src = "images/"+lg+"/ong_"+(this.id.substr(8,this.id.length-8))+"_off.png"; }
		}
	}
}

function filtreGuideReglette(id){
	new Ajax.Updater('divGuideReglette','ajax/guideReglette.php?id_usage='+id, {
		method: 'post',
		evalScripts: true
	});
}

function ajouterFavorisArticle(id) {
	new Ajax.Request('ajax/ajoute_article_favoris.php?id='+id, {
		method: 'get',
		evalScripts: true,
		onComplete: function(transport) {
			$('btnFavoris').innerHTML = transport.responseText;
		}
	});
}

function ajouterFavorisParcours(id) {
	new Ajax.Request('ajax/ajoute_parcours_favoris.php?id='+id, {
		method: 'get',
		evalScripts: true,
		onComplete: function(transport) {
			$('btnFavoris').innerHTML = transport.responseText;
		}
	});
}

function ajouteCommentaireArticle(id) {
	new Ajax.Updater('divCommentaire','ajax/articleCommentaire.php?id='+id, {
		method: 'post',
		parameters: $('frm_commentaire').serialize(),
		evalScripts: true
	});
}

function ajouteCommentaireParcours(id) {
	new Ajax.Updater('divCommentaire','ajax/parcoursCommentaire.php?id='+id, {
		method: 'post',
		parameters: $('frm_commentaire').serialize(),
		evalScripts: true
	});
}

function ajouteTemoignageProduit(id) {
	new Ajax.Updater('divFicheProduit','ajax/produitsFiche_temoignages.php?idp='+id, {
		method: 'post',
		parameters: $('frm_commentaire').serialize(),
		evalScripts: true
	});
}

function ajouteAvisProduit(id) {
	new Ajax.Updater('divFicheProduit','ajax/produitsFiche_avis.php?idp='+id, {
		method: 'post',
		parameters: $('frm_commentaire').serialize(),
		evalScripts: true
	});
}

var current_note = 0;
function setNote(val) {
	if(current_note != 0 && val == current_note) {
		val = 0;	
	}
	for(var i = 1 ; i <= 5 ; i++) {
		if(i <= val)
			$('etoile'+i).src = "images/etoile_on.gif";
		else
			$('etoile'+i).src = "images/etoile_off.gif";
	}
	$('note').value = val;	
	current_note = val
}

function previewNote(val) {
	for(var i = 1 ; i <= 5 ; i++) {
		if(i <= val)
			$('etoile'+i).src = "images/etoile_on.gif";
		else
			$('etoile'+i).src = "images/etoile_off.gif";
	}
}
function restoreNote() {
	for(var i = 1 ; i <= 5 ; i++) {
		if(i <= current_note)
			$('etoile'+i).src = "images/etoile_on.gif";
		else
			$('etoile'+i).src = "images/etoile_off.gif";
	}
}

function changePageProduit(id, start) {
	new Ajax.Updater('divGuideReglette','ajax/guideReglette.php?id_usage='+id+'&start='+start, {
		method: 'post',
		evalScripts: true,
		parameters: $('frm_rech_produit').serialize()
	});
}

function rechercheProduit(lang) {
	new Ajax.Updater('divGuideReglette','ajax/guideReglette.php', {
		method: 'post',
		evalScripts: true,
		parameters: $('frm_rech_produit').serialize()
	});
	PlayerGuideReglette.addParam("Flashvars", "Highlight=0&Langue="+lang);
	PlayerGuideReglette.write("divReglette");
}

