// JavaScript Document
<!-- 
function moreinfo() {
document.getElementById('moreinfolink').style.display='none';
new Effect.Appear('moreinfo', {duration:0.7});
}
document.getElementById('moreinfo').style.display='none';

	function showcomments() {
new Effect.Appear('comments', {duration:0.7});
}

	function comment() {
	if (user != 0) {
	document.getElementById('inputdata').innerHTML = '<table width="280" height="100" border="0" cellspacing="0" cellpadding="0"><tr><td width="140">comment &eacute;valuez-vous cet article ?</td><td width="60" align="left"><img id="Star1" src="images/stars/StarOut.gif" /><img id="Star2" src="images/stars/StarOut.gif" /><img id="Star3" src="images/stars/StarOut.gif" /><img id="Star4" src="images/stars/StarOut.gif" /><img id="Star5" src="images/stars/StarOut.gif" /></td></tr><tr><td  colspan="2"><textarea name="commentaire" id="textcomment" cols="" rows="" onFocus="this.style.borderColor=\'#D27611\';this.value=\'\'" onBlur="this.style.borderColor=\'#cccccc\'">'+leaveComment+'</textarea></td></tr><tr><td colspan="2" align="center"><a href="javascript:saveComment()" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'ok\',\'\',\'images/ok_button_hover.gif\',1)"><img src="images/ok_button.gif" width="52" height="26" border="0" id="ok" /></a></td></tr></table>';
	montreoverlay("<table class = 'image_calque ' valign = 'center' border = '0' align = 'center'><tr><td></tr>");
	montrefenetre();
	NotationSystem();
	}
	else affiche_overlay_window(connected);
	}


StarOutUrl=		'../images/stars/StarOut.gif';		//image par défaut
StarOverUrl=	'../images/stars/StarOver.gif';		//image d'une étoile sélectionnée
StarBaseId=		'Star';				//id de base des étoiles
NbStar=			5;					//nombre d'étoiles
Note = 0;
LgtStarBaseId=StarBaseId.lastIndexOf('');

function NotationSystem() {
	for (i=1;i<NbStar+1;i++) {
		var img			=document.getElementById('Star'+i);
			
		img.onclick		=function() {
		Note = 0;
		Note = Name2Nb(this.id);
		for(i=1; i<=5; i++) {
		if(i<=Note)	document.getElementById('Star'+i).src=StarOverUrl;
		else document.getElementById('Star'+i).src=StarOutUrl;
		}

		};
		//Réaction lors du clic sur une étoile
		//Evidemment, il faudrait compléter cette fonction pour la rendre vraiment utile.
		//Par exemple, envoyer la note dans une base de donnée via un XMLHttpRequest.
		
		img.alt			='Donner la note de '+i;
		//Texte au survol
		
		img.src			=StarOutUrl;
		img.onmouseover	=function() {StarOver(this.id);};
		img.onmouseout	=function() {StarOut(this.id);};
	}
}

function StarOver(Star) {
	StarNb=Name2Nb(Star);
	for (i=(Note+1);i<(StarNb*1)+1;i++) {
		document.getElementById('Star'+i).src=StarOverUrl;
	}
}

function StarOut(Star) {
	StarNb=Name2Nb(Star);
	for (i=(Note+1);i<(StarNb*1)+1;i++) {
		document.getElementById('Star'+i).src=StarOutUrl;
	}
}

function Name2Nb(Star) {
	//Le survol d'une étoile ne nous permet pas de connaître directement son numéro
	//Cette fonction extrait donc ce numéro à partir de l'Id
	StarNb=Star.slice(LgtStarBaseId);
	return(StarNb);
}

function saveComment() {
valeur = document.getElementById('textcomment').value;
if (Note != 0) {
if((valeur != leaveComment) && (valeur != '')) {
ajaxComment(); }
else affiche_overlay_window(anycomment);
}
else affiche_overlay_window(nomark);
}

		function ajaxComment() {
var xhr = getXhr();
xhr.onreadystatechange = function(){
if(xhr.readyState == 4 && xhr.status == 200){
reponse = xhr.responseText;
if (reponse == 1) {
affiche_overlay_window(thankyou);
window.setTimeout("cachetout()",4000);
}
}
}
xhr.open("POST","php/savecomment.php",true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr.send("ref="+ref+"&comment="+encodeURIComponent(valeur)+"&note="+Note);
}
-->