$(function() {
		$('#main #content #middle .hotlink .links img').fadeTo(0,0.4);
		
		$('#main #content #middle .hotlink .links a').hover(function(){
			$(this).prev('img').fadeTo(100,1);
															},function(){
			$(this).prev('img').fadeTo(100,0.4);			
															});
			   
		$('#main #content #droite #post_something .aff_form').click(function(){
			$(this).hide();
			$('#main #content #droite #post_something .post_form').fadeIn(1000);
		});
		
		$('#main #content #droite #post_something .aff_p').click(function(){
			$(this).hide();
			$('#main #content #droite #post_something p').fadeIn(1000);
		});
		
		
		$('#main #content #middle .hotlink .titre a').click(function(){
			window.open($(this).attr('title'));
			return false;
		});
		
		/* score */
		
		$(".hotlink .up_0").click(function(){
			$(this).parents('.hotlink').find('.up_1').show();
			$(this).parents('.hotlink').find('.down_1').hide();
			$(this).parents('.hotlink').find('.down_0').show();
			$(this).hide();
			
			var ele = $(this).parents('.hotlink').find('.score_neutre');
			
			ele.removeClass('score_down');
			ele.addClass('score_up');
			
			$.post("vote.php",   
				  	{
					   truc : $(this).attr("id")
				  	},
				   function(data){ 
						if(data=='fuck') 
						{
							alert("Erreur ! votre vote n'a pas ete prit en compte.");
						}
						else
						{
							ele.html(data);
						}
				   }
			);
									});
	$(".hotlink .up_1").click(function(){
			$(this).parents('.hotlink').find('.up_0').show();
			$(this).hide();
			
			var ele = $(this).parents('.hotlink').find('.score_neutre');
			ele.removeClass('score_up');
			
			$.post("vote.php",   
				  	{
					   truc : $(this).attr("id")
				  	},
				   function(data){ 
						if(data=='fuck') 
						{
							alert("Erreur ! votre vote n'a pas ete prit en compte.");
						}
						else
						{
							ele.html(data);
						}
				   }
			);
									});
	
	$(".hotlink .down_0").click(function(){
			$(this).parents('.hotlink').find('.down_1').show();
			$(this).parents('.hotlink').find('.up_1').hide();
			$(this).parents('.hotlink').find('.up_0').show();
			$(this).hide();
			
			var ele = $(this).parents('.hotlink').find('.score_neutre');
			ele.addClass('score_down');
			ele.removeClass('score_up');
			
			$.post("vote.php",   
				  	{
					   truc : $(this).attr("id")
				  	},
				   function(data){ 
						if(data=='fuck') 
						{
							alert("Erreur ! votre vote n'a pas ete prit en compte.");
						}
						else
						{
							ele.html(data);
						}
				   }
			);
									});
	$(".hotlink .down_1").click(function(){
			$(this).parents('.hotlink').find('.down_0').show();
			$(this).hide();
			
			var ele = $(this).parents('.hotlink').find('.score_neutre');
			ele.removeClass('score_down');
			
			$.post("vote.php",   
				  	{
					   truc : $(this).attr("id")
				  	},
				   function(data){ 
						if(data=='fuck') 
						{
							alert("Erreur ! votre vote n'a pas ete prit en compte.");
						}
						else
						{
							ele.html(data);
						}
				   }
			);
									});
	
	
	
	
	
	
	$(".hotlink .save").click(function(){
			var ele = $(this);
			$.post("save.php",   
				  	{
					   truc : $(this).attr("id")
				  	},
				   function(data){ 
						if(data=='fuck') 
						{
							alert("Erreur ! votre lien n'a pas pu etre sauvegardé.");
						}
						else
						{
							ele.html('lien sauvegardé !');
						}
				   }
			);
									});
	
	
	$(".hotlink .dead").click(function(){
			$(this).hide();
			$(this).next('.dead_1').show();
			
									});
									
	$(".hotlink .dead_1 .dead_oui").click(function(){
			$(this).parents('.dead_1').html('signalé !');
			
									});
									
	$(".hotlink .dead_0").click(function(){
			$(this).parents('.dead_1').hide();
			$(this).parents('.dead_1').prev('.dead').show();
			
									});
	
	$(".hotlink .youtubelink").click(function(){
			var id = $(this).attr("title");
			$(this).next('#youtube_'+id).show();
			$(this).parents('.hotlink').css("height","460px");
			$(this).hide();
			return false;
									});
									
	});
