var pause_roll = false;
$(function()
{
	get_live_status();
	
	if ($('#index_roll').find('li').length > 1)
	{
		setInterval(function(){roll_line($('#index_roll'));},3000);
	}
	
	$('#index_roll').parent().mouseover(function()
	{
		pause_roll = true;
	}).mouseout(function()
	{
		pause_roll = false;
	});
});

function roll_line(o)
{
	if (window.pause_roll) return;
	var fchild = o.children(':first');
	var height = fchild.height();
	o.animate({ marginTop:-1*height},600,function()
	{
		o.append(fchild.clone(true));
		o.children(':first').remove();
		o.css('margin-top','0');
	});
}


function get_live_status(){ /* 首页直播设置 2010-4-12 */
	get_live_status_do();
	interval = window.setInterval(function(){ get_live_status_do(); }, 120000);
	//window.clearInterval(interval);	
}
function get_live_status_do(){
	$.post("/ajax/home_page.php?action=index_live", { key:'v' }, 
	function(data){	//alert(data);
		if(data !="" ){
			var pos=data.indexOf(':');
			var program_id=data.substring(0,pos);
			var title=data.substr(pos+1);

			$('#block_live').show(); //显示直播div
			$('#block_auction').hide(); //隐藏拍卖
			$('#live_title').text(title);
			$('#live_url').attr('href','/live/'+program_id);//直播链接
		}else{
			$('#block_live').hide();
			$('#block_auction').show();
		}
	});
}

function bannerOnClick(index, type) {
	click_track('homepage_banner',index, type);
}
