var CodeAcces=""
var PassWord=""

function AffFavoris() {
	var ChFav=""
	
	ChFav+="<br/><span style='width: 250px;margin-top: 25px;'>"
	ChFav+="<a href='http://eco.netvibes.com/subscribe/296908' target='_blank'><img src='"+RepRoot+"/Favoris/Commun/Images/AjoutNV.png' border='0' alt='Ajouter ce module à ma page NetVibes' /></a>"
	ChFav+="</span>&nbsp;&nbsp;"
	ChFav+="<span style='width: 250px;margin-top: 25px;'>"
	ChFav+="<a href='http://fusion.google.com/add?source=atgs&amp;moduleurl=http%3A//www.favorisnet.com/Favoris/FavorisGG.xml' target='_blank'><img src='http://gmodules.com/ig/images/plus_google.gif' border='0' alt='Ajouter ce module à ma page IGoogle' width='62' height='17' /></a>"
	ChFav+="</span>"
	
	ChFav+="<table width='100%'>"

	ChFav+="<tr>"
	ChFav+="<td width='60%'><iframe id='Favoris' frameborder='0' height='350px' width='600px' src='"+RepRoot+"/Favoris/Commun/Favoris.php?User="+CodeAcces+"&Passwd="+PassWord+"&Origine=Favorisnet'></iframe></td>"

	ChFav+="<td width='165px'>\n"
	/*
	ChFav+="<script type='text/javascript'>\n"
	ChFav+="<!--\n"
	ChFav+="google_ad_client = \"pub-1408347847668178\"\n";
	ChFav+="// 120x240, date de création 23/10/08 \n"
	ChFav+="google_ad_slot = \"4424678043\"\n";
	ChFav+="google_ad_width = 120;\n"
	ChFav+="google_ad_height = 240;\n"
	ChFav+="//-->\n"
	ChFav+="</script>\n"
	ChFav+="<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></script>\n"
	*/
	ChFav+="</td>\n"
	ChFav+="</tr>"

	ChFav+="</table>"
	
	/*
<a href="http://eco.netvibes.com/subscribe/296908" target="_blank">NetVibes</a>
<a href="http://fusion.google.com/add?source=atgs&amp;moduleurl=http%3A//start.ovh.net/%7Edblvvopp/Favoris/FavorisGG.xml"><img src="http://gmodules.com/ig/images/plus_google.gif" border="0" alt="Add to Google" width="62" height="17" /></a>
	*/

	document.getElementById('ContenuSite').innerHTML=ChFav
}

function ImportBkm() {
	document.getElementById('Sablier').innerHTML="<img src='"+RepTpl+"/images/Attente.gif'>"
}

function FinUpLoad(AddFolders,AddBookmarks) {
	document.getElementById('Sablier').innerHTML=AddFolders+" Dossiers<br>"+AddBookmarks+" Favoris"
}

function AffArticle(Origine,NomArticle) {
	var XHR=new XHRConnection

	//---- Renouvellement de la pub
	//document.getElementById('GoogleAdSense').innerHTML="<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></script>"

	switch (NomArticle) {
		case "Profil" :
			var ChCode="<iframe id='IFProfil' frameborder='0' class='IFrameInvis' style='width: 100%; height: 350px' name='IFProfil' src='"+RepTpl+"/Profil.php?Racine="+RepRoot+"&User="+CodeAcces+"&Passwd="+PassWord+"'></iframe>"
			document.getElementById('ContenuSite').innerHTML=ChCode
			break
		default :
			XHR.appendData("Action","LitArticle")
			XHR.appendData("Origine",Origine)
			XHR.appendData("NomArticle",NomArticle)
		
			// On soumet la requête
			// Signification des paramètres:               
			//      + On indique à l'objet qu'il faut appeler le fichier search.php
			//      + On utilise la méthode POST, adaptée l'envoi d'information
			//      + On indique quelle fonction appeler lorsque l'opération a été effectuée
			XHR.sendAndLoad(RepRoot+"/Favoris/Commun/LitJoomlaXML.php", "GET", _AffArticle);
			break
	}
}

function _AffArticle(Obj) {
	var TblArticle = Obj.responseXML.getElementsByTagName('Article');
	var Result=""

	Result = TblArticle[0];
	Origine=Result.getAttribute('ORIGINE')

	document.getElementById('ContenuSite').innerHTML=unescape(TblArticle[0].firstChild.nodeValue)
	
}

function ChargeProfil(User,Passwd) {
	var XHR=new XHRConnection

	CodeAcces=User
	PassWord=Passwd

	XHR.appendData("Action","LitProfil")
	XHR.appendData("User",User)
	XHR.appendData("Passwd",Passwd)

	// On soumet la requête
	// Signification des paramètres:               
	//      + On indique à l'objet qu'il faut appeler le fichier search.php
	//      + On utilise la méthode POST, adaptée l'envoi d'information
	//      + On indique quelle fonction appeler lorsque l'opération a été effectuée
	XHR.sendAndLoad(RepRoot+"/Favoris/Commun/LitJoomlaXML.php", "GET", _ChargeProfil);

}

function _ChargeProfil(Obj) {
	var TblProfil=Obj.responseXML.getElementsByTagName('Profil')
	var Result=""
	
	Result=TblProfil[0]
	document.getElementById('NOM').value=unescape(Result.getAttribute('NAME'))
	document.getElementById('NOMUTILISATEUR').value=unescape(Result.getAttribute('USERNAME'))
	document.getElementById('EMAIL').value=unescape(Result.getAttribute('EMAIL'))
}

function ValidProfil() {
	if (document.getElementById('PASSWD').value=="" || document.getElementById('PASSWDVERIF').value=="") {
		alert("Le mot de passe est obligatoire")
		return false
	}

	if (document.getElementById('PASSWD').value!=document.getElementById('PASSWDVERIF').value) {
		alert("Erreur dans la vérification du mot de passe, veuillez le ressaisir")
		return false
	}
	
	document.getElementById('Sablier').innerHTML="<img src='images/Attente.gif'>"
	document.getElementById('Sablier').style.visibility="visible"

	var XHR=new XHRConnection

	XHR.appendData("Action","MajProfil")
	XHR.appendData("User",CodeAcces)
	XHR.appendData("Passwd",PassWord)
	XHR.appendData("Nom",document.getElementById('NOM').value)
	XHR.appendData("EMail",document.getElementById('EMAIL').value)
	XHR.appendData("NewPasswd",document.getElementById('PASSWD').value)

	// On soumet la requête
	// Signification des paramètres:               
	//      + On indique à l'objet qu'il faut appeler le fichier search.php
	//      + On utilise la méthode POST, adaptée l'envoi d'information
	//      + On indique quelle fonction appeler lorsque l'opération a été effectuée
	XHR.sendAndLoad(RepRoot+"/Favoris/Commun/LitJoomlaXML.php", "GET", _ValidProfil);
	return false
}

function _ValidProfil(Obj) {
	var TblTransac=Obj.responseXML.getElementsByTagName('Transaction')
	var Result=""
	var Message=""
	
	Result=TblTransac[0]
	if (Result.getAttribute('ETAT')==1) {
		PassWord=Result.getAttribute('PASSWD')
		Message="Enregistrement réussi."
	} else {
		Message="Erreur d'enregistrement."
	}

	document.getElementById('Sablier').innerHTML="<p align='center'>"+Message+"</p>"
	alert(Message)
}
