imgwidth=642 //圖片高度
imgheight=200 //圖片寬度
imgPauseTime=10000  //圖片停留時間
imgSpeed=20 //圖片特效速度
chgLoop=0
imgCount=0
doChg=true
//廣告圖片來源
imgSrc=new Array()
imgSrc[0]="img/europe_banner_640.gif"
imgSrc[1]="img/Banner_Scene_640.jpg"
imgSrc[2]="img/201107NewArrival_Banner_640.jpg"
imgSrc[3]="img/BlueComet_Banner_640.jpg"
//廣告圖片的超鏈結
imgURL=new Array()
imgURL[0]="http://www.pcstore.com.tw/alitrains/HM/service_faq_body.htm?msg_id=1"
imgURL[1]="http://www.mjmodelrailroad.com/index.php"
imgURL[2]="http://www.mjmodelrailroad.com/events/201107NewArrival.html"
imgURL[3]="http://www.mjmodelrailroad.com/events/BlueComet_EDM.html"
imgURL[4]="http://www..twbts.com"
//建立影像物件陣列,並將圖片檔案預先儲存物件內
imgArray=new Array()
for (x=0;x<=imgSrc.length-1;x++) {
	imgArray[x]=new Image()
	imgArray[x].src=imgSrc[x]
}

//圖片設定
function imgIni() {
doChg=true
imgCount++
	if (imgCount>=imgSrc.length){
	 imgCount=0
	}
imgStretch()
}

//圖片放大效果
function imgStretch() {
 if(doChg){
	if (chgLoop<=100) {
		if (document.all) {
			imgArea.innerHTML="<a href='"+imgURL[imgCount] + 
			"' target='_blank'><img name='myPic' align='top' width='641' height='"+chgLoop*imgheight/100+"' src='" + imgArray[imgCount].src + "' border='0'></a>"
		}
		chgLoop+=10
		timer=setTimeout("imgStretch()",imgSpeed)
  	}
	else {
		chgLoop=100
		clearTimeout(timer)
		imgArea.innerHTML="<a href='"+imgURL[imgCount] + 
		"' target='_blank'><img name='myPic' align='bottom' src='" + imgArray[imgCount].src + "' border='0'></a>"
		timer=setTimeout("imgShirk()",imgPauseTime)
	}
 }	
}

//圖片縮小效果
function imgShirk() {
 if(doChg){
	if (chgLoop>=0) {
		if (document.all) {
			imgArea.innerHTML="<a href='"+imgURL[imgCount] + 
			"' target='_blank'><img name='myPic'  width='641' height='" + chgLoop*imgheight/100 + "' src='" + imgArray[imgCount].src + "' border='0'></a>"
		}
		chgLoop-=10
		timer=setTimeout("imgShirk()",imgSpeed)
  	}
	else {
		chgLoop=0
		clearTimeout(timer)
		imgIni()
	}
  }
}

//滑鼠指標移入時
function mouse_in() {
 document.myPic.style.filter="Alpha(Opacity=50)"        
 doChg=false
}

//滑鼠指標移出時
function mouse_out() {
 document.myPic.style.filter="Alpha(Opacity=100)"
 doChg=true
 clearTimeout(timer)
 imgStretch()
}
