
		var get_comment = function(id_article,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('/dossiers/get_comments/'+id_article+'/'+nb+'/'+page, {onSuccess:handlerFunc, onFailure:errFunc});
		}
		var vote = function(id_article){	
						
			var handlerFunc = function(t) {
				if(t.responseText == 'already_voted')
				    alert("Vous avez déjà voté...");
				else
				{
					document.getElementById('note-text-'+id_article).innerHTML = t.responseText;
					document.getElementById('note-link-'+id_article).innerHTML = 'Voté';
					
				}
				document.getElementById('note-link-'+id_article).parentNode.parentNode.className='blocVote2';
			}
			
			var errFunc = function(t) {
			    alert('Error ' + t.status + ' -- ' + t.statusText);
			}
						
			new Ajax.Request('/dossiers/vote', {method:'post', postBody:'id_article='+id_article, onSuccess:handlerFunc, onFailure:errFunc});
		}
		
		
		
		var add_comment = function(){
			var id_article = escape(document.getElementById('id_article_comment').value);
			var pseudo = escape(document.getElementById('pseudo_comment').value);
			if(document.getElementById('password_comment'))
				var password = escape(document.getElementById('password_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_article,nb_comment,1);
					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('/dossiers/send_comment', {method:'post', postBody:'id_article='+id_article+'&pseudo='+pseudo+'&password='+password+'&comment='+comment, onSuccess:handlerFunc, onFailure:errFunc});
		}	
		var saveGame = 0;
		var showLayer = function(){
			if(document.getElementById('photoLayer').style.display != 'block')
			{
				document.getElementById('photoLayer').style.display = 'block';
				document.getElementById('photoLayerContent').style.display = 'block';
				document.getElementById('pub_header').style.display = 'none';
				if(saveGame != 0)
					document.getElementById('photoLayerContent').innerHTML = saveGame;
			}
			else
			{
				saveGame = document.getElementById('photoLayerContent').innerHTML;
				document.getElementById('photoLayerContent').innerHTML = '';
				document.getElementById('photoLayer').style.display = 'none';
				document.getElementById('photoLayerContent').style.display = 'none';
				document.getElementById('pub_header').style.display = 'block';
			}
				
		}			
