var flashdata=new Array();
var flashindex=1;
var flashspeed=1000;
var flashtimer=new Object();
function flashInit(sped){
	flashspeed=sped;

	
	var boxhtml='<div class="sunsvsFlashBox"><div class="imgBox"><a><img src="/images/flashloading.gif" style="z-index:-800"/></a></div><div class="textBox"><div class="showText"></div><div class="showFooter"></div></div></div>'

	document.write(boxhtml);

	var tmphtml="";
	for(i=0;i<flashdata.length;i++){
		tmphtml+="<a href='javascript:;' onclick='flashshow("+i+")' onmouseover='flashPaush()' onmouseout='flashGo()' class='noindex'>"+(i+1)+"</a>";
	}
	$(".showFooter").html(tmphtml);
	
	$(".imgBox > a >img").hover(function(){flashPaush();},function(){flashGo();});
	flashshow(0);
	flashGo();



}
function add(text,url,img){
	var l=flashdata.length;
	var tmp=new Array(3);
	tmp[0]=text;
	tmp[1]=url;
	tmp[2]=img;
	flashdata[l]=tmp;
}
function flashshow(i){
	flashindex=i;
	//显示第i张图片
//	$(".imgBox > a > img").fadeOut(0);//隐藏
	$(".imgBox > a > img").css('zIndex',-9999).attr("src",flashdata[i][2]);//更换地址
	$(".imgBox > a").attr("href",flashdata[i][1]);//更换链接
	$(".showText").html(flashdata[i][0]).fadeIn(0);//显示文字
	$(".imgBox > a > img").css('zIndex',-9999).fadeIn(0);//显示图片
	for(j=0;j<flashdata.length;j++){
		$(".showFooter >a").eq(j).removeClass();
		$(".showFooter >a").eq(j).addClass("noindex");
	}
	$(".showFooter >a").eq(i).removeClass();
	$(".showFooter>a").eq(i).addClass("index");
}
function flashPaush(){
	clearInterval(flashtimer);
}
function flashGo(){
	flashtimer=setInterval("flashgoing()",flashspeed);
}
function flashgoing(){flashindex++;
	if(flashindex>=flashdata.length){
		flashindex=0;
	}
	flashshow(flashindex);
	
}
