/**
 * 网站首页的相关功能js
 */

/**
 * 网站首页的搜索tabs初始化
 */
function init_homeSearch_tabs(){
	$("#homeSearchTabs").tabs();
}
/**
 * 初始化线路类型的选择按钮，默认为chinaTour
 */
function init_radio_tourType(){
	var tourType = $("input[name='tourType']:checked").val();
	init_tourType_input(tourType);
	$("input[name='tourType']").click(function(){		
		tourType = $("input[name='tourType']:checked").val();
		init_tourType_input(tourType);
	});
}
/**
 * 根据用户默认的线路类型初始化输入项
 * @param flightway
 */
function init_tourType_input(tourType){
	switch(tourType){
	case '0':
		$("#chinaTourSearch").show();
		$("#asiaTourSearch").hide();
		
	break;
	case '1':
		$("#asiaTourSearch").show();
		$("#chinaTourSearch").hide();
		break;
	}
}
/**
 * 新闻跑马灯功能
 * @param id ：div元素ID
 * @param interval:间隔时间ms
 * @param direction: 滚动方向 0:向上滚动,-1:向下滚动
 */
function travel_marquee(id,interval,direction){
	var box=document.getElementById(id),can=true,interval=interval||1500,fq=fq||10,direction=direction==-1?-1:1;
	box.innerHTML+=box.innerHTML;
	box.onmouseover=function(){can=false};
	box.onmouseout=function(){can=true};
	var max=parseInt(box.scrollHeight/2);
	new function (){
		var stop=box.scrollTop%18==0&&!can;
		if(!stop){
			var set=direction>0?[max,0]:[0,max];
			box.scrollTop==set[0]?box.scrollTop=set[1]:box.scrollTop+=direction;
		};
		setTimeout(arguments.callee,box.scrollTop%18?fq:interval);
	};
}
