$(function() {
				/**
				* the list of posts
				*/
				var $list 		= $('#rp_list ul');
				/**
				* number of related posts
				*/
				var elems_cnt 		= $list.children().length;
				
				/**
				* show the first set of posts.
				* 200 is the initial left margin for the list elements
				*/
				load(200);
				
				function load(initial){
					$list.find('li').hide().andSelf().find('.animacion').css('margin-left',-initial+'px');
					var loaded	= 0;
					//show 5 random posts from all the ones in the list. 
					//Make sure not to repeat
					while(loaded < 1){
						var r 		= Math.floor(Math.random()*elems_cnt);
						var $elem	= $list.find('li:nth-child('+ (r+1) +')');
						if($elem.is(':visible'))
							continue;
						else
							$elem.show();
						++loaded;
					}
					//animate them
					var d = 200;
					$list.find('li:visible .animacion').each(function(){
						$(this).stop().animate({
							'marginLeft':'-30px'
						},d += 100);
					});
				}
					
				/**
				* hovering over the list elements makes them slide out
				*/	
				$("#slideboton").live("click",function(){
													   if($(".animacion").attr("id")=="oculto")
													   {
													   		$('.animacion').stop().animate({'marginLeft':'-255px'},200);
															$('.animacion').attr("id","visible");
													   }
													   else
													   {
														   $('.animacion').stop().animate({'marginLeft':'-30px'},200);
														   $('.animacion').attr("id","oculto");
													   }
				});				
			});
/*********************************************************************************************/
