//-------------roll top link
function showTopLink(){
	var tlink=document.getElementById("tlink");
	var pos=tlink.style.posTop;
	
	var end=-indexTopLink*18;
	if(pos>=end){
		tlink.style.posTop=pos-1;
		setTimeout("showTopLink()",10);
	}
	else{
		if(indexTopLink==(tlinkPages-1)){
			tlink.style.posTop=0;
			indexTopLink=0;
		}
		moveTopLink();
	}
}
function moveTopLink(){
	indexTopLink++;
	setTimeout("showTopLink()",1000*6);
}
var indexTopLink=1;

//-------------roll aviation
function showExternalLink(){
	var elink=document.getElementById("elink");
	var pos=elink.style.posTop;
	
	var end=-indexElink*34;
	if(pos>=end){
		elink.style.posTop=pos-1;
		setTimeout("showExternalLink()",10);
	}
	else{
		if(indexElink==(elinkPages-1)){
			elink.style.posTop=0;
			indexElink=0;
		}
		moveElink();
	}
}
function moveElink(){
	indexElink++;
	setTimeout("showExternalLink()",1000*6);
}
var indexElink=1;
//--------------scroll interview tab,hotel news tab,industry news tab----------------
var timeInterview=0;
var timeHotel=0;
var timeIndustry=0;

var indexInterview=1;
var indexHotel=1;
var indexIndustry=1;

function scrollInterview(){
	fireClick(document.getElementById("tagA"+indexInterview));
	indexInterview++;
	if(indexInterview>3)
		indexInterview=0;
}
function scrollHotel(){
	fireClick(document.getElementById("tagB"+indexHotel));
	indexHotel++;
	if(indexHotel>8)
		indexHotel=0;
}
function scrollIndustry(){
	fireClick(document.getElementById("tagC"+indexIndustry));
	indexIndustry++;
	if(indexIndustry>1)
		indexIndustry=0;
}
function startInterview(){
	timeInterview=window.setInterval("scrollInterview()",1000*3);
}
function startHotel(){
	timeHotel=window.setInterval("scrollHotel()",1000*3);
}
function startIndustry(){
	timeIndustry=window.setInterval("scrollIndustry()",1000*3);
}
function stopInterview(){
	window.clearInterval(timeInterview);
}
function stopHotel(){
	window.clearInterval(timeHotel);
}
function stopIndustry(){
	window.clearInterval(timeIndustry);
}

function fireClick(sel){
	if (navigator.appVersion.match(/\bMSIE\b/)){
		sel.click();
	}
	else{
		var evt = document.createEvent("MouseEvents");
        evt.initEvent("click", true, true);
	    sel.dispatchEvent(evt);
	}
}
