/*
 * Polaris Weather Widget - Rotator
 */
(function($){

	$.widgetPolarisWeatherRotate = function(node, interval) {
		setInterval(function(){
			var $active = $('#'+node +' div.place.active');
			if ( $active.length == 0 ) $active = $('#'+node +' div.place:first');

			var $next =  $active.next('div.place').length ? $active.next('div.place') : $('#'+node +' .place:first');

			$active.addClass('prev');

			$next.css({opacity: 0.0})
				.addClass('active')
				.animate({opacity: 1.0}, 1000, function() {
					$active.removeClass('active prev');
			});
		}, interval*1000);
	}

})(jQuery);
