var L = '';
var speed = 8000;
jQuery(function($){
	//排行榜滑动门
	$("#rank_data").switchTab({defaultIndex:0,titCell: "div[class='rank_top'] span",mainCell:"div[class='rank_bottom']", trigger: "mouseover", delayTime: 0,titOnClassName:'left',defaultClassName:"right"});

	//资讯块滑动门
	$("#news_data").switchTab({defaultIndex:0,titCell: "div span[class='bg_hover']",mainCell:'dd[class="news_con"]', trigger: "mouseover", delayTime: 0,titOnClassName:'bg_white',defaultClassName:"bg_hover"});

	//幻灯片
	$("#KinSlideshow").KinSlideshow({
			moveStyle:"down",
			intervalTime:6,
			moveSpeedTime:400,
			mouseEvent:"mouseover",
			isHasTitleFont:false,
			isHasTitleBar:false,
			titleFont:{TitleFont_size:14,TitleFont_color:"#FF0000"}
	});
	
	L = setInterval('AutoScroll("#marqueebox")',speed);
	$('#marqueebox li').each(function(){$(this).mouseover(function(){clearInterval(L);});});
	$('#marqueebox li').each(function(){$(this).mouseout(function(){L = setInterval('AutoScroll("#marqueebox")',speed);})});
});

function AutoScroll(obj){$(obj).find("ul:first").animate({marginTop:"-20px"},50000000,function(){$(this).css({marginTop:"0px"}).find("li:first").appendTo(this);});}

//套餐提交
function sub_data(obj,type)
{
	var checked = '';
	$('#'+obj+' input[name="expert_id[]"]').each(function()
	{
		var self = $(this);
		if(self.attr('checked') == 'checked')
		{
			checked += self.attr('value')+'|';
		}
	});
	if(checked != '')
	{
		window.open('/order.php?type='+type+'&uid='+checked.substr(0,checked.length-1),'_blank');
		$('#'+obj).dialog('close');
	}else
	{
		alert('请选择您要购买的专家！');
	}
}

//弹出套餐窗口
function show_obj(obj)
{
	$("#"+obj).dialog({
		width: 360,	
		modal: true,
		bgiframe:true, 
		title:'套餐购买'
	});
}
