jQuery.fn.delay = function(time,func){
	this.each(function(){
		setTimeout(func,time);
	});
	
	return this;
};

$(function(){
	
	
			var avatars =	$('ul.avatars li');
			$(avatars[0]).addClass('active');	
			
		
	/**
	 * jCarousellite
	 * carousel for homepage with moving avatars below it
	 */
	 if ($('.carousel li').length > 1){
				$('.carousel').jCarouselLite({
					visible: 1,
					scroll: 1,
					auto: 5000,
					speed: 600,
					beforeStart: function(visElems){
						$(avatars).filter('.active').children('span').animate({"bottom":"-20px"});
						$(avatars).filter('.active').removeClass('active');
					},
					afterEnd: function(visElems){
						var activeClass = $(visElems[0]).attr("class");
						var activeElem = $('#' + activeClass);
						activeElem.children('span').animate({"bottom":"0px"});
			 			activeElem.addClass('active');
			 		}
				});
			};
		

			
		// small function to hide the last hr in a page of articles
		var hrs =	$('.archive .hr.w600');
		$(hrs[hrs.length -1]).addClass('hide');

 });


