// JavaScript Document
//用法
//<script type="text/javascript" src="JS/IndexScroll.js" language="javascript"></script>
//<body onload="initiate()">
//<span id="imgcontainer1"></span> <span id="imgcontainer2"></span>

// The width of your images (pixels). All pictures should have the same width.
var imgwidth=430

// The height of your images (pixels). All pictures should have the same height.
var imgheight=320

// The horizontal and vertical position of the images (pixels). 
var pos_left=210
var pos_top=110

// The name of your images. You may add as many images as you like.
var imgname=new Array()
imgname[0]="images/Scroll/index_1.jpg"
imgname[1]="images/Scroll/index_2.jpg"
imgname[2]="images/Scroll/index_3.jpg"
imgname[3]="images/Scroll/index_4.jpg"
imgname[4]="images/Scroll/index_5.jpg"
imgname[5]="images/Scroll/index_6.jpg"
imgname[6]="images/Scroll/index_7.jpg"
imgname[7]="images/Scroll/index_8.jpg"
imgname[8]="images/Scroll/index_9.jpg"
imgname[9]="images/Scroll/index_10.jpg"
imgname[10]="images/Scroll/index_11.jpg"
imgname[11]="images/Scroll/index_12.jpg"
imgname[12]="images/Scroll/index_13.jpg"

// Where should those images be linked to? 
// Add an URL for each image.
// If you don't want to add an URL just write '#' instead of 
// the URL, see sample imgurl[2].
var imgurl=new Array()
imgurl[0]="default.aspx"
imgurl[1]="default.aspx"
imgurl[2]="default.aspx"
imgurl[3]="default.aspx"
imgurl[4]="default.aspx"
imgurl[5]="default.aspx"
imgurl[6]="default.aspx"
imgurl[7]="default.aspx"
imgurl[8]="default.aspx"
imgurl[9]="default.aspx"
imgurl[10]="default.aspx"
imgurl[11]="default.aspx"
imgurl[12]="default.aspx"
imgurl[13]="default.aspx"

// This block will preload your images. Do not edit this block.
var imgpreload=new Array()
for (i=0;i<=imgname.length-1;i++) {
	imgpreload[i]=new Image()
	imgpreload[i].src=imgname[i]
}

// Standstill-time between the images (microseconds).
var pause=2000

// Speed of the stretching and shrinking effect. More means slower.
var speed=20

// This variable also affects the speed (the length of the step between each inmage-frame measured in pixels). More means faster.
var step=10

// Do not edit the script below
var i_loop=0
var i_image1=0
var i_image2=1

function stretchimage() {
	if (i_loop<=imgwidth) {
		if (document.all) {
			imgcontainer1.innerHTML="<a href='"+imgurl[i_image1]+"'><img width='"+i_loop+"' height='"+imgheight+"' src='"+imgname[i_image1]+"' border='0' alt='VI设计，CI设计，标识设计，VIS导入，标识导示系统设计，企业VI设计制作' /></a>"
			document.all.imgcontainer2.style.posLeft=document.all.imgcontainer1.style.posLeft+i_loop
			
			imgcontainer2.innerHTML="<a href='"+imgurl[i_image2]+"'><img width='"+(imgwidth-i_loop)+"' height='"+imgheight+"' src='"+imgname[i_image2]+"' border='0' alt='VI设计，CI设计，标识设计，VIS导入，标识导示系统设计，企业VI设计制作' /></a>"
		}
		i_loop=i_loop+step
		var timer=setTimeout("stretchimage()",speed)
  	}
	else {
		clearTimeout(timer)
		changeimage()
	}
}

function changeimage() {
	i_loop=0
	i_image1++
	if (i_image1>imgname.length-1) {i_image1=0}
	i_image2=i_image1-1
	if (i_image2>imgname.length-1) {i_image2=0}
	if (i_image2<0) {i_image2=imgname.length-1}
	
	document.all.imgcontainer2.style.posLeft=document.all.imgcontainer1.style.posLeft
   	var timer=setTimeout("stretchimage()",pause)
}

function initiate() {
	if (document.all) {
		document.all.imgcontainer1.style.posLeft=pos_left
		document.all.imgcontainer2.style.posLeft=pos_left
		document.all.imgcontainer1.style.posTop=pos_top
		document.all.imgcontainer2.style.posTop=pos_top
		changeimage()
	}
	if (document.layers) {
		document.imgcontainer1.left=pos_left
		document.imgcontainer2.left=pos_left
		document.imgcontainer1.top=pos_top
		document.imgcontainer2.top=pos_top
		rotatenetscape()
	}
}

function rotatenetscape() {
	document.imgcontainer1.document.write("<a href='"+imgurl[i_image1]+"'><img src='"+imgname[i_image1]+"' border='0'></a>")	
	document.imgcontainer1.document.close()	
	i_image1++
	if (i_image1>imgname.length-1) {i_image1=0}
   	var timer=setTimeout("rotatenetscape()",pause*2)
}