window.addEvent("domready", function() {
									 

	share_pics = $$(".share_pic") ;
	
	$('share_legend').fade(0) ;
	
	for(i = 0; i < share_pics.length; i++) {		
		share_pics[i].fade(0.3) ;
		
		
		share_pics[i].addEvent("mouseover", function () {		
			$(this).fade(1) ;
			
			$('share_legend').set("text","Partager cette info sur " + this.getProperty("rel") + " !") ;
			$('share_legend').fade(1) ;
			
			this.style.cursor = 'pointer'; 			
			
			
		}) ;
		
		
		share_pics[i].addEvent("mouseout", function () {		
			$(this).fade(0.3) ;	
			
			$('share_legend').set("text","") ;
			$('share_legend').fade(0) ;
			
		}) ;
		
		
		
		share_pics[i].addEvent("click", function () {
			
			rel = this.getProperty("rel") ;
			
			switch(rel) {
				
				case "Facebook" :
				
					share_url = "http://www.facebook.com/share.php?u=" + encodeURI(location.href) + "&t=" + encodeURI(document.title) ;								
					break ;
			
				case "Twitter" :

					share_url = "http://twitter.com/home?status=" + encodeURI(location.href) ;									
					break ;
					
				case "Fuzz" :
				
					share_url = "http://www.fuzz.fr/submit?url=" + encodeURI(location.href) + "&title=" + encodeURI(document.title) ;				
					break ;
					
				case "del.icio.us" :
				
					share_url = "http://del.icio.us/post?url=" + encodeURI(location.href) + "&title=" + encodeURI(document.title) ;
					break ;
					
				case "Scoopeo" :
				
					share_url = "http://www.scoopeo.com/scoop/new?newurl=" + encodeURI(location.href) ;
					break ;
					
				case "Wikio" :
				
					share_url = "http://www.wikio.fr/vote?url=" + encodeURI(location.href) ;
					break ;
					
					
				case "digg" :
				
					share_url = "http://digg.com/remote-submit?phase=2&url=" + encodeURI(location.href) ;
					
					break ;
					
				
				default :
					return false ;
					break ;
		
			}
			
			window.open(share_url, "_blank") ;		
			
			
		}) ;
		
		
	}							 
									 
									 
}); 