﻿
/********************************************

	Home Slide Show
	Jx_Home_Slide.js
	version date: 2009-9				
	This code is from POWERON.COM.TW (9xSoft)
	http://www.poweron.com.tw/
	Copyright 2001-02 by JasonX

*********************************************/

function HomeSlideCreate(ObjName,ImgId,URLArr,IMGArr,ItemTitleArr,ItemNum,RunSpeed)
{
	this.mURLArr=URLArr;
	this.mImgArr=IMGArr;
	this.mShowTitle=ItemTitleArr;
	this.m_speed=RunSpeed;
	this.m_step=0;
	this.m_whichimage=0;
	// this.m_number_of_images=ItemNum;
	this.m_number_of_images=IMGArr.length;
	this.m_img_id=ImgId;

	this.reapply=function(){
		setTimeout(ObjName+".slideit()",2000);
		return true;
	}

	this.slideit=function(){
		try{
			if(this.mImgArr.length<=1) return;
			if (!document.images)
			return;

			if (document.all)
				document.getElementById(this.m_img_id).filters.blendTrans.apply();
			//document.images.slide.src=eval("image"+step+".src")

			document.getElementById(this.m_img_id).src=this.mImgArr[this.m_step];
			window.status=this.mShowTitle[this.m_step];
			if (document.all)
				document.getElementById(this.m_img_id).filters.blendTrans.play();

			this.m_whichimage=this.m_step;

			if (this.m_step<this.m_number_of_images-1)
				this.m_step++;
			else
				this.m_step=0;

			if (document.all)
				setTimeout(ObjName+".slideit()",this.m_speed*1000+3000);
			else
				setTimeout(ObjName+".slideit()",this.m_speed*1000);
		}
		catch(ex)
		{
			this.reapply();
		}
	}

	this.slidelink=function(){
		
		if(this.m_number_of_images==0)
		{
			alert('Not setup.');
			return;
		}
		window.location=this.mURLArr[this.m_whichimage];
	}

	this.slideshowtitle=function(){

		if(this.m_number_of_images==0)
		{
	  		return;
		}
		window.status=this.mShowTitle[this.m_whichimage];
		document.getElementById(this.m_img_id).alt=this.mShowTitle[this.m_whichimage];
	}
	this.initslid=function(){
		
		var DocContent="";
		DocContent="<a href=\"javascript:"+ObjName+".slidelink()\" onMouseover=\"window.status=document.getElementById('"+this.m_img_id+"').alt;return true;\">";
		DocContent=DocContent+"<img src=\""+this.mImgArr[0]+"\" border=\"0\" id=\""+this.m_img_id+"\" style=\"filter:blendTrans(duration=3)\" onMouseOver=\""+ObjName+".slideshowtitle()\"></a>";
		document.write(DocContent);
		
	}
}
