isns=navigator.appName=="Netscape";
function vbannerstr(id,imgurl,linkurl)
{
	this.id=id
	this.imgurl=imgurl
	this.linkurl=linkurl
}

vbanner=new Array()
imgcount=1;
frequency=10*400; //60 Seconds

vbanner[1]=new vbannerstr('1','../images/cover_bund.jpg','../learn-chinese-en/photo-list.asp?cid=1')

vbanner[2]=new vbannerstr('2','../images/cover_school.jpg','../learn-chinese-en/photo-list.asp?cid=2')

vbanner[3]=new vbannerstr('3','../images/cover_class.jpg','../learn-chinese-en/photo-list.asp?cid=3')

imgcount=vbanner.length-1
for(i=1;i<=imgcount;i++)
{
	eval("img"+i+"=new Image()")
	eval("img"+i+".src=vbanner["+i+"].imgurl")
}

nn=1

var rand1=0;
var useRand=0;

function swapBanner() {
	var imgnum=vbanner.length-1;
	do {
		var randnum=Math.random();
		rand1=Math.round((imgnum-1)*randnum)+1;
	} while (rand1==useRand);
	useRand=rand1;
//	alert(useRand);
	nn=useRand;
	change_img();
}

function change_img()
{
	eval('document.xbanner.src=img'+nn+'.src');
	nn++;
	if(nn>imgcount) nn=1
	if(!isns)
	{
		xbanner.filters.item(0).apply()
		xbanner.style.visibility='visible'
		xbanner.filters.item(0).play()
		setTimeout("xbanner.style.visibility='hidden'",frequency);
	}
	else
	document.xbanner.visibility='visible'
	tt=setTimeout('change_img()',frequency)
}

function xlink()
{
	tt=nn-1
	if(tt<1) tt=imgcount
	cururl=vbanner[tt].linkurl
	window.open(cururl);
}

function ini()
{
	if(!isns)
	{
		spacewidth=Math.round((divmask.offsetWidth-770)/3)
		dmwidth=770+spacewidth
		dmheight=divmask.offsetHeight
		totalstep=50
		timeout=50
		dmstepw=Math.round(770/totalstep)
		dmsteph=Math.round(dmheight/totalstep)
		setTimeout('hidimg()',3000)
	}
	else swapBanner()
}

function hidimg()
{
	dmwidth-=dmstepw
	dmheight-=dmsteph
	eval('divmask.style.clip="rect(0,'+dmwidth+','+dmheight+',0)"')
	hdrun=setTimeout('hidimg()',timeout)
	if(dmwidth<=spacewidth&&dmheight<=0)
	{
		divmask.style.visibility='hidden'
		clearTimeout(hdrun)
		swapBanner()
	}
}