/* Defaulting this var */
//var hasVoted = 3;


var tempImage;

function overStar(baseUrl,v)
{
	/* Preloading image */
/*	if(!tempImage)
	{
		tempImage = new Image;
		tempImage.src = baseUrl+"/images/note_on.png"
	}
*/
	//new_image = baseUrl+"/images/note_on.png"
	for(i=2; i<12; i++)
	{
		if(i<=v)
			document.getElementById('star_'+i).src =  baseUrl+"/images/note_on_"+ i % 2+".gif";
		else
			document.getElementById('star_'+i).src = baseUrl+"/images/note_off_"+ i % 2+".gif";
	}
}


function outStar(baseUrl,hasVoted)
{
	//alert(hasVoted);
	hasVoted+=2;
	for(i=2; i <12 ; i++)
	{
/*		alert(i%2);
		return;
*/		if(i<hasVoted)
			document.getElementById('star_'+i).src = baseUrl+"/images/note_on_"+ i % 2 +".gif";
		else
			document.getElementById('star_'+i).src = baseUrl+"/images/note_off_"+ i % 2 +".gif";
	}
}

function outStar2(baseUrl,hasVoted)
{
	hasVoted +=11;
	for(i=21; i > 11; i=i-1)
	{
		//alert(hasVoted);
		if(i<=hasVoted)
		{	
			document.getElementById('star_'+i).src = baseUrl+"/images/note_on_"+ i % 2 +".gif";
			//alert(i);
		}
		else
			document.getElementById('star_'+i).src = baseUrl+"/images/note_off_"+ i % 2 +".gif";
	}
}

/*function coloriage-note(params)
{
	// Patch, hidden by other layer
	//document.getElementById('video_rating_stars').style.display = 'none';
	///////document.getElementById('video_rating_waiting').style.visibility = 'visible';

	exploded = params.split(',');
	sig = exploded[0];
	note = exploded[1];

	hasVoted = note;

	parameters = new Object();
	parameters['rating'] = note;
	parameters['sig'] = sig;
	parseResponseFunction = returnedVideoRate;
	runAJAX('api_server/', 'video_rate', parameters, 'get');
}
*/
//function returnedVideoRate(response)
//{
//	if(response <= 0)
//	{
//		if(window.document.flvplayer)
//		{
//			try {
//				window.document.flvplayer.SetVariable("is_note", "false");
//			}
//			catch(err) {
//
//			}
//		}
//
//		displayError(JST_COULDNT_SAVE_VOTE)
//		timeout(setUpFade, 'video_rating_waiting', 900);
//		hasVoted = 0;
//	}
//	else
//	{
//		if(window.document.flvplayer)
//		{
//			try {
//				window.document.flvplayer.SetVariable("is_note", "true");
//			}
//			catch(err) {
//
//			}
//		}
//
//		exploded = response.split('|')
//		if(exploded.length != 2)
//		{
//			returnedVideoRate(-1)
//			return
//		}
//
//		/* Shows the rate results if invisible */
//		document.getElementById('li_vote').style.display = 'block';
//
//		document.getElementById('video_rating_span').innerHTML = exploded[0];
//		document.getElementById('video_rating_count_span').innerHTML = exploded[1];
//
//		document.getElementById('video_rating_stars').style.display = 'block';
////		document.getElementById('video_rating_waiting').style.visibility = 'hidden';
//		overStar(hasVoted)
//		//document.getElementById('video_rating_waiting').innerHTML = JST_PLAYER_VOTE_OK
//		displayMessage(JST_PLAYER_VOTE_OK);
//		timeout(setUpFade, 'video_rating_waiting', 900);
//	}
//}




