Cufon.replace("#content h1, .gray_header, #sidebar .gray_heading, #sidebar h3");

var _speed = 750;
var _timeout = 5000;
var _doRotate = true;

function _rotate() {
	if ( !_doRotate ) return false;
	var $next, $cur;
	$cur = $("#banners a:visible");
	if ( $cur.next("a").size() ) {
		$next = $cur.next();
	} else { 
		$next = $("#banners a:first");
	}
	$cur.fadeOut(_speed, function(){
		$next.fadeIn(_speed);
		$("#banners .buttons span").removeClass("active");
		$("#banners .buttons span." + $next.attr("rel")).addClass("active");
	});
	setTimeout(_rotate, _timeout);
}

$(function(){
	$("#nav").dropmenu({});
	if ( $("#banners a").size() > 1 ) {
		$("#banners a").not(":first").hide();
		$("#banners span:first").addClass('active');
		setTimeout(_rotate, _timeout);
	}
	$("#banners span").click(function(){
		_doRotate = false;
		$("#banners a").hide();
		$("#banners .buttons span").removeClass("active");
		$("#banners a[rel=" + $(this).attr("class") +  "]").show();
		$(this).addClass("active");
	});
	
	$("a.pop").attr("target", "_blank");
});
