// boards
var slideurl=new Array("image/boards_small2/ncis1.PNG","image/boards_small2/ncis_intro2.PNG","image/boards_small2/project3.PNG","image/boards_small2/web4.PNG","image/boards_small2/cloud5.PNG","image/boards_small2/mobile6.PNG","image/boards_small2/high7.PNG","image/boards_small2/p2p8.PNG","image/boards_small2/webInfowall9.PNG","image/boards_small2/tianwang10.PNG","image/boards_small2/realcourse11.PNG");
var slidelink=new Array("http://ncis.pku.edu.cn/","http://ncis.pku.edu.cn/","http://net.pku.edu.cn/","http://sewm.pku.edu.cn/","http://net.pku.edu.cn/~p2p/doku.php","http://ipv6.grids.cn/","http://gis.pku.edu.cn/","http://net.pku.edu.cn/~p2p/doku.php","http://www.infomall.cn/","http://e.pku.edu.cn/","http://realcourse.grids.cn");
var slidetarget=new Array("_blank","_blank","_blank","_blank","_blank","_blank","_blank","_blank","_blank","_blank","_blank");
var boardDescr=new Array("计算机网络与信息系统研究所","计算机网络与信息系统研究所","在研项目与国家重点课题","Web信息搜集与挖掘研究领域","分布式系统研究领域","移动计算研究领域","高效能计算研究领域","P2P文件共享存储系统","中国网络信息博物馆","天网云计算平台","大学堂");

// the size of the slideshow (pixels)
var scrollerwidth=520;
var scrollerheight=100;
var boardwidth=75;
var boardheight=100;

// do not edit below this line
var allpicturewidth = (boardwidth+4)*slideurl.length;
var distancepictopic = 0;
var scrollerleft = 0;
var scrollertop = 0;
var pause = 50;
var step = 2;
var newstep = step;
var clipleft,clipright,cliptop,clipbottom ,posleft;
var i_picture = 0;
var picturecontent = "";
var ns4 = document.layers?1:0;
var ns6 = document.getElementById&&!document.all?1:0;
var ie = document.all?1:0;
var browserinfos = navigator.userAgent;
var opera = browserinfos.match(/Opera/);

var preloadedimages = new Array();
for(i=0;i<slideurl.length;i++)
{
	preloadedimages[i] = new Image()
	preloadedimages[i].src = slideurl[i]
}

picturecontent+="<table cellpadding=2 cellspacing=0>"
picturecontent+="<tr>"
for (i=0;i<=slideurl.length-1;i++) {
	picturecontent+="<td style=\"border: 0px;\">"
	picturecontent+="<a href=\""+slidelink[i]+"\" target=\""+slidetarget[i]+"\" onMouseOver=\"javascript:onmsover()\" onMouseOut=\"javascript:onmsout()\">"
	picturecontent+="<img src=\""+slideurl[i]+"\" border=0 width=\""+boardwidth+"\" height=\""+boardheight+"\" title=\""+boardDescr[i]+"\"></a>"
	picturecontent+="</td>"
}
if(allpicturewidth>scrollerwidth)
{
	for (i=0;i<=slideurl.length-1;i++) {
		picturecontent+="<td style=\"border: 0px;\">"
		picturecontent+="<a href=\""+slidelink[i]+"\" target=\""+slidetarget[i]+"\" onMouseOver=\"javascript:onmsover()\" onMouseOut=\"javascript:onmsout()\">"
		picturecontent+="<img src=\""+slideurl[i]+"\" border=0 width=\""+boardwidth+"\" height=\""+boardheight+"\" title=\""+boardDescr[i]+"\"></a>"
		picturecontent+="</td>"
	}
}
picturecontent+="</tr></table>"


//======================================================================================
function init()
{
	if(ie)
	{
		document.all.picturediv.style.posTop = scrollertop;
		document.all.picturediv.style.posLeft = scrollerleft;
		clipleft = 0;
		clipright = scrollerwidth;
		cliptop = 0;
		clipbottom = scrollerheight;
		document.all.picturediv.style.clip = "rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")";
		document.all.picturediv.style.visibility = "visible";
	}
	else if(ns6)
	{
		document.getElementById('picturediv').style.top = scrollertop;
		document.getElementById('picturediv').style.left = scrollerleft;
		clipleft = 0;
		clipright = scrollerwidth;
		cliptop = 0;
		clipbottom = scrollerheight;
		document.getElementById('picturediv').style.clip = "rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")";
		document.getElementById('picturediv').style.visibility = "visible";
	}
	else if(ns4)
	{
		document.roof.document.picturediv.top = scrollertop;
		document.roof.document.picturediv.left = scrollerleft+scrollerwidth;
		document.roof.document.picturediv.clip.left = 0;
		document.roof.document.picturediv.clip.right = scrollerwidth;
		document.roof.document.picturediv.clip.top = 0;
		document.roof.document.picturediv.clip.bottom = scrollerheight;
		document.roof.document.picturediv.visibility = "visible";
	}
	else
		return;
	if(allpicturewidth>scrollerwidth) scrollpicture();
}

function scrollpicture()
{
	if(ie)
	{
		if(document.all.picturediv.style.posLeft>=scrollerleft-allpicturewidth)
		{
			document.all.picturediv.style.posLeft -= step;
			clipright += step;
			if(clipright>scrollerwidth)
				clipleft += step;
			document.all.picturediv.style.clip = "rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")";
		}
		else
			resetposition();
	}
	else if(ns6)
	{
		if(parseInt(document.getElementById('picturediv').style.left)>=scrollerleft-allpicturewidth)
		{
			document.getElementById('picturediv').style.left = parseInt(document.getElementById('picturediv').style.left)-step;
			clipright += step;
			if(clipright>scrollerwidth)
				clipleft += step;
			document.getElementById('picturediv').style.clip = "rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")";
		}
		else
			resetposition();
	}
	else if(ns4)
	{
		if(document.roof.document.picturediv.left>=scrollerleft-allpicturewidth)
		{
			document.roof.document.picturediv.left -= step;
			document.roof.document.picturediv.clip.right += step;
			if(document.roof.document.picturediv.clip.right>scrollerwidth)
				document.roof.document.picturediv.clip.left+=step;
		}
		else
			resetposition();
	}
	setTimeout("scrollpicture()",pause);
}

function onmsover()
{
	step=0;
}
function onmsout()
{
	step=newstep;
}

function resetposition()
{
	clipleft = 0;
	cliplight = scrollerwidth;
	posleft = -2;
	if(ie)
	{
		document.all.picturediv.style.posLeft = posleft;
		document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")";
	}
	else if(ns6)
	{
		document.getElementById('picturediv').style.left = posleft;
		document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")";
	}
	else if(ns4)
	{
		document.roof.document.picturediv.left = posleft;
		document.roof.document.picturediv.clip.left = clipleft;
		document.roof.document.picturediv.clip.right = clipright;
	}
}
function drawScroller()
{
	var picturecontentwidth = (boardwidth+4)*slideurl.length;
	if(allpicturewidth>scrollerwidth)
		picturecontentwidth *= 2;
	if (ie || ns6) {
		document.write('<div style="position:relative;width:'+scrollerwidth+'px;height:'+scrollerheight+'px;overflow:hidden">')
		document.write('<div id="picturediv" style="position:absolute;top:0px;left:0px; height:'+scrollerheight+'px;visibility:hidden; width: '+picturecontentwidth+'px;">'+picturecontent+'</div>')
		document.write('</div>')
		document.write('<div id="emptypicturediv" style="position:absolute;top:0px;left:0px;height:'+scrollerheight+'px;visibility:hidden">'+picturecontent+'</div>')

		window.onload=init
	}

	if (ns4) {
		document.write('<ilayer name="roof" width='+scrollerwidth+' height='+scrollerheight+'>')
		document.write('<layer name="picturediv" width='+scrollerwidth+' height='+scrollerheight+' visibility=hide>'+picturecontent+'</layer>')
		document.write('</ilayer>')
		window.onload=init
	}
}
//======================================================================================
