function bigBan(e) {
	var active_tab=$('ul.tabs li a.active').attr('href');
	$(e).children(active_tab).siblings('.tab').hide();
	
	$('ul.tabs li a').click(function(){
		var id_tab=$(this).attr('href');
				
		if($(this).hasClass('active')==true) {
			bigBanInterval=window.setInterval(autoTabs, 5000);
		}else{
			window.clearInterval(bigBanInterval);	
		}
		
		bigBanTab(id_tab);
		return false; //deaktivace posunu na kotvu
	});
	
};

function bigBanTab(id_tab) {
	$('#hp-bigban .tab'+id_tab).siblings('.tab').css('z-index', 0);
	$('#hp-bigban .tab'+id_tab).css('z-index', 5);
	
	$('#hp-bigban .tab'+id_tab).slideDown(300, function(){
		$('#hp-bigban .tab'+id_tab).siblings('.tab').hide();
	});
	$('#hp-bigban ul.tabs li a').removeClass('active');		
	$('#hp-bigban ul.tabs li a[href='+id_tab+']').addClass('active');
}

function autoTabs() {
	var next_tab=$('#hp-bigban ul.tabs li a.active').parent().next('li').children('a').attr('href');
	if(next_tab==null) {next_tab=$('#hp-bigban ul.tabs li:first').children('a').attr('href');}
	bigBanTab(next_tab);	
}

$(document).ready(function(){
	bigBan('#hp-bigban');	
	bigBanInterval=window.setInterval(autoTabs, 5000);
	
	$('#login-link').click(function(){
		$('.popup').toggle();
		return false;
	});
});


// qtip login
$(document).ready(function()	{
	$("div.login a").qtip({
		position: {
			corner: {
				target: 'bottomMiddle',
				tooltip: 'topRight'
			}
		},
		style: {
			'background-color' : '#900',
			'color' : '#fff',
			border: {
				width: 2,
				radius: 5,
				color: '#fff'
			},
			padding: '10px',
			tip: 'topRight'
		}
	})
});



// qtip channels
$(document).ready(function()	{
	$("div.channels ul li img").qtip({
		position: {
			corner: {
				target: 'bottomMiddle',
				tooltip: 'topRight'
			}
		},
		style: {
			'background-color' : '#303591',
			'color' : '#fff',
			border: {
				width: 2,
				radius: 5,
				color: '#7f81a9'
			},
			padding: '10px',
			tip: 'topRight'
		}
	})
});


