jQuery(function($) {
		
	 var active = 0; // starts at zero
	 $list = $('#ranks');
	 $name = $('#sitenameshow');
	 $rt = $('#rank_right');
	 $lt = $('#rank_left');
	 $kids = $list.children('li');
	 
	 setActive(); // Initialize the setup to show the first element
	
	 $rt.click(function(e) { // Move one to the right on click
		e.preventDefault();
	 	active = active == $kids.length-1 ? 0 : active + 1;
	 	setActive();
	 });
	
	 $lt.click(function(e) { // Move one to the left on click
		e.preventDefault();
	 	active = active == 0 ? $kids.length-1 : active - 1;
	 	setActive();
	 });	 
	
	 function setActive(){ // Set the active item and hide the rest
		 $active = $kids.eq(active);
		 var link = $('a', $active).attr('href');
		 var title = $('a', $active).attr('title');
		 $name.html('<a class="sitename" href="'+link+'" target="_blank">'+title+'</a>');
		 $active.show().siblings().hide();		 
	 }
	 
 });
