
// JavaScript Document
var Tab_Name="Switch";
var FreshTime=1000;
var Tab_Title=new Array();
var Tab_Link=new Array();
var Tab_Pic=new Array();
var CurScreen=1;
var Tab_Width=270;
var Tab_Height=250;
var Tip_Height=50;

function switchStart(){
	if (mPic=="") return;
	Tab_Title=mTitle.split("|");
	Tab_Link=mLink.split("|");
	Tab_Pic=mPic.split("|");
	document.write("<div id=flashNews style='width:"+Tab_Width+"px;height:"+Tab_Height+"px'>");
	for(var i=0;i<Tab_Pic.length;i++) {
		ss="<div id="+Tab_Name+"_"+(i+1)+"><a href="+Tab_Link[i]+" target=_blank><img src="+Tab_Pic[i]+" width=" +Tab_Width+ " height="+ Tab_Height +" onmouseover=pauseSwitch();  onmouseout=goonSwitch();/></a></div>";
		document.write(ss);
	}
	document.write("<div id=SwitchTitle onmouseover=pauseSwitch();  onmouseout=goonSwitch();></div>");
	document.write("<ul id=SwitchNav></ul>");
	document.write("<div class=bg style='width:"+Tab_Width+"px;height:"+Tip_Height+"px' onmouseover=pauseSwitch();  onmouseout=goonSwitch();></div>");
	document.write("</div>");
	var refreshSwitchTimer = null;
	switchPic(CurScreen);
	refreshSwitchTimer = setTimeout('reSwitchPic();', FreshTime);
}
function switchPic(screen) {
	if (screen > Tab_Pic.length) {
		screen = 1 ;
	}
	
	for (i=1;i<=Tab_Pic.length;i++) {
		document.getElementById(Tab_Name+"_"+i).style.display = "none" ;
	}
	document.getElementById(Tab_Name+"_"+screen).style.display = "block" ;
	showSwitchNav(screen);
	showSwitchTitle(screen);
	//Effect.Appear(Tab_Name+"_"+screen);
			
	//switchLittlePic(screen);
	//showSwitchTitles(screen);
	CurScreen = screen  ;
}
function showSwitchNav(screen) {
	var NavStr = "" ;
	for (i=1;i<=Tab_Pic.length;i++) {
		if (i == screen) {
			NavStr += '<li onmouseover="pauseSwitch();" onmouseout="goonSwitch();"><a href="javascript://" target="_self" class="sel">'+i+'</a></li>' ;
		}
		else {
			NavStr += '<li onmouseover="pauseSwitch();" onmouseout="goonSwitch();" onclick="goManSwitch('+i+');"><a href="javascript://" target="_self">'+i+'</a></li>' ;
		}
		
	}
	document.getElementById(Tab_Name+"Nav").innerHTML = NavStr ;
}
function showSwitchTitle(screen) {
	var titlestr = "" ;
	var stitle=Tab_Title[screen-1].substring(0,30);
	var slink=Tab_Link[screen-1];
	titlestr = "<h3 style='position:absolute;left:10px;top:"+(Tab_Height-Tip_Height)+"px;'><a href="+slink+" target=_blank>"+stitle+"</a></h3>" ;
	document.getElementById(Tab_Name+"Title").innerHTML = titlestr ;
}
function reSwitchPic() {
	refreshSwitchTimer = null;
	switchPic(CurScreen+1);
	refreshSwitchTimer = setTimeout('reSwitchPic();', 3000);
}
function pauseSwitch() {
	clearTimeout(refreshSwitchTimer);
}
function goonSwitch() {
	clearTimeout(refreshSwitchTimer);
	refreshSwitchTimer = setTimeout('reSwitchPic();', 3000);
}
function goManSwitch(index) {
	clearTimeout(refreshSwitchTimer);
	
	CurScreen = index - 1 ;
	reSwitchPic();
}
function pauseAutoSwitch() {
	clearTimeout(AutoPicSwitchTabTimer) ;
}
function goonAutoSwitch(ident,index,count,TimeLength) {
	clearTimeout(AutoPicSwitchTabTimer) ;
	AutoPicSwitchTabTimer = setTimeout("autoSwitchTab('"+ident+"',"+index+","+count+","+TimeLength+");", TimeLength);
}
function autoSwitchTab(ident,index,count,TimeLength) {
	if (index == count || index > count) {
		index = 0 ;
	}
	switchTab(ident,index,count) ;
	index = index + 1 ;
	AutoPicSwitchTabTimer = setTimeout("autoSwitchTab('"+ident+"',"+index+","+count+","+TimeLength+");", TimeLength);
}