(function($) {

	$.fn.blogRotator = function(options) {
		
		var prevItem,
			interval,
			timer		= 8000,
			items 		= this,
			itemlength 	= items.size(),
			start		= 0;

		var fadeI = function(item) {
			clearTimeout(interval);

			//alert(itemlength);
			if($(prevItem).is(".item")){
				$(prevItem).fadeOut("slow");
			}
			
			
			$(item).fadeIn(2000);
			interval = setTimeout(function (){
				start++;

				if(start > (itemlength-1)) {
					start = 0;
				}

				fadeI(items[start]);
			},timer);
			prevItem = item;
		}

		var fadeO = function(item) {
			$(item).fadeOut("slow");
		}

		fadeI(items[start]);
	}
    
})(jQuery);

jQuery(function($) {
    $('#blog-teaser div.item').blogRotator();
});

/*
jQuery(function(){
	jQuery('ul.sf-menu').superfish();
});
*/

/* used on /tv/ before, not anymore */
/*
jQuery(document).ready(function(){ 
	jQuery("ul.sf-menu").supersubs({ 
		minWidth:    5,   // minimum width of sub-menus in em units 
		maxWidth:    15,   // maximum width of sub-menus in em units 
		extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
						   // due to slight rounding differences and font-family 
	}).superfish();  // call supersubs first, then superfish, so that subs are 
					 // not display:none when measuring. Call before initialising 
					 // containing tabs for same reason. 
}); 
*/

jQuery.noConflict();
jQuery(window).bind('unload', function() { jQuery('*').unbind(); });