var handler = function(){
$("ul.tabs li").removeClass("active");
$(this).addClass("active");
$(".tab_content, .tab_test").hide();
var activeTab = $(this).find("a").attr("class");
$('.'+activeTab).show();
}
$("ul.tabs li").interval = setInterval(handler.bind(this), 1000);
function rotateBackground() {
var ct = $("#header").data("background") || 0,
newCt = ct == background.length -1 ? 0 : ct + 1;
$("#header").data("background", newCt).fadeIn()
.css({'background' : 'url('+ background[newCt] +') no-repeat', 'background-size':'cover'}).delay(2000).fadeOut(200, rotateBackground);
}