
		var get_comment = function(id_video,nb,page){		
						
			var handlerFunc = function(t) {
				    document.getElementById('comment_container').innerHTML = t.responseText;	
			}
			
			var errFunc = function(t) {
			    alert('Error ' + t.status + ' -- ' + t.statusText);
			}
		
			new Ajax.Request('/videos/get_comments/'+id_video+'/'+nb+'/'+page, {onSuccess:handlerFunc, onFailure:errFunc});
		}
		var vote = function(id_video){	
						
			var handlerFunc = function(t) {
				if(t.responseText == 'already_voted')
				    alert("Vous avez déjà voté...");
				else
				{
					document.getElementById('note-text-'+id_video).innerHTML = t.responseText;
					document.getElementById('note-link-'+id_video).innerHTML = 'Voté';
					
				}
				document.getElementById('note-link-'+id_video).parentNode.parentNode.className='blocVote2';
			}
			
			var errFunc = function(t) {
			    alert('Error ' + t.status + ' -- ' + t.statusText);
			}
						
			new Ajax.Request('/videos/vote', {method:'post', postBody:'id_video='+id_video, onSuccess:handlerFunc, onFailure:errFunc});
		}
		
		var activeBallon = function(anObj){
				var anObj_id = anObj.id.split('_');
				anObj_id = anObj_id[anObj_id.length-1];
				//voted = 3;
				if(anObj_id >voted )
					lightup(anObj,20);
					
				if(!voted){
					anObj.onmouseover = function(){
							var id = this.id.split('_');
							id = id[id.length-1];
							for(i=0;i<5;i++)
							{
								document.getElementById('vote_ballon_'+(i+1)).style.cursor = 'pointer';
								if(i<id)
									lightup(document.getElementById('vote_ballon_'+(i+1)),100);
								else
									lightup(document.getElementById('vote_ballon_'+(i+1)),20);
							}
					}
					anObj.onclick = function(){
							var id = this.id.split('_');
							voted = id[id.length-1];
							for(i=0;i<5;i++)
							{
								document.getElementById('vote_ballon_'+(i+1)).style.cursor = 'normal';
								document.getElementById('vote_ballon_'+(i+1)).onmouseover = null;
								document.getElementById('vote_ballon_'+(i+1)).onclick = null;	
							}
							vote(id_video,voted);		

							
					}
				}
			}
		
		var add_comment = function(){
			var id_video = escape(document.getElementById('id_video_comment').value);
			var pseudo = escape(document.getElementById('pseudo_comment').value);
			if(document.getElementById('password_comment'))
				var password = escape(document.getElementById('password_comment').value);
			var title = escape(document.getElementById('title_comment').value);
			var comment = escape(document.getElementById('text_comment').value);
			
			
			var handlerFunc = function(t) {
				if(t.responseText != 'OK')
				    alert(t.responseText);
				else
				{
					get_comment(id_video,nb_comment,1);
					document.getElementById('title_comment').value = '';
					document.getElementById('text_comment').value = '';
					if(document.getElementById('password_comment'))
					{
						get_user_block();
					}
				}
			}
			
			var errFunc = function(t) {
			    alert('Error ' + t.status + ' -- ' + t.statusText);
			}
			new Ajax.Request('/videos/send_comment', {method:'post', postBody:'id_video='+id_video+'&pseudo='+pseudo+'&password='+password+'&title='+title+'&comment='+comment, onSuccess:handlerFunc, onFailure:errFunc});
		}	