StarBaseId 		= new Array('S1_', 'S2_');	//id de base des Ã©toiles
NbStar			= 10;						//nombre d'Ã©toiles
Check 			= new Array(0, 0);
LgtStarBaseId	= new Array();

for (i =0; i < StarBaseId.length; i++)
{
	LgtStarBaseId[i] = StarBaseId[i].lastIndexOf('');
}

function reset()
{
  Check 			= new Array(0, 0);
  for (var i = 1; i <= 5; i++)
	{
		document.getElementById('S1_'+i).style.opacity = '0.3';
		document.getElementById('S1_'+i).style.filter = 'alpha(opacity=30)';
	}
}

function NotationSystem() {
	for (j = 0; j < StarBaseId.length; j++)
	{
		for (i=1; i < NbStar+1; i++)
		{
			var img	= document.getElementById(StarBaseId[j]+i);
			
			if(img) 
			{ 
				img.key = j;
		  			
			img.onclick	= function()
			{
				if (Check[this.key] == 0)
				{
					SetOpacity(this.id, this.key, 1);
					Check[this.key] = 1;
					
					var input = document.getElementById('note');
					input.value = Name2Nb(this.id, this.key);
					//alert('Vous avez donnÃ© la note de '+Name2Nb(this.id, this.alt)+'.');
				}
			};
		
			img.title = 'Donner la note de '+i; //Texte au survol, le alt marche pas
			//img.alt = 'Donner la note de '+i;
			
			img.onmouseover	= function()
			{
				if (Check[this.key] == 0)
				{
					SetOpacity(this.id, this.key, 1);
				}
			};
			
			img.onmouseout = function()
			{
				if (Check[this.key] == 0)
				{
					SetOpacity(this.id, this.key, 0.3);
				}
			};
		}
		}
	}
}

function SetOpacity(Star, key, opacity)
{
	StarNb=Name2Nb(Star, key);
	opac = opacity*100;
	for (var i = 1; i <= StarNb; i++)
	{
		document.getElementById(StarBaseId[key]+i).style.opacity = opacity;
		document.getElementById(StarBaseId[key]+i).style.filter = 'alpha(opacity='+opac+')';
    
	}
}

function Name2Nb(Star, key) {
	//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[key]);
	return(StarNb);
}

function citer(id) {
	
	  var body  = 'commentbody-' + id;
	  var texte = document.getElementById(body).innerHTML;
	  
	  var author  = 'commentauthor-' + id;
	  var auteur = document.getElementById(author).innerHTML;
	  
	  var contenu = '<blockquote cite="#commentbody-'+id+'"><strong><a href="#comment-'+id+'">'+auteur+'</a> :</strong>'+texte+'</blockquote>';
	  document.getElementById('comment').value += contenu;
	
	
}

function position(e)
{
x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
window.status = "Souris X:"+x+" / Y:"+y;

}
if(navigator.appName.substring(0,3) == "Net")
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = position;

function open_window(page)
{
	window.open(page,'nom_popup','menubar=no, status=no, scrollbars=no, menubar=no, width=300, height=100, left='+(x+20)+', top='+y);
}

