﻿// JScript 文件


img = function( clickImg ,nailImg, Img, Url ,filter, lasttime, width, height ,isflash)
{
this.Url=''; if (Url) this.Url = Url;
this.Img=''; if (Img) this.Img = Img;
this.nailImg =''; if (nailImg) this.nailImg = nailImg;
this.clickImg =''; if (clickImg) this.clickImg = clickImg;
this.filter = 7; if (filter) this.filter = filter;
this.lasttime = 4000; if (lasttime) this.lasttime = lasttime;
this.width = 256; if (width) this.width = width;
this.height = 256; if (height) this.height = height;
this.isflash = 0; if (isflash) this.isflash = isflash;
this.over = null; this.out = null;
};

Images = function(name,id,linkid,w,h,imgs) {
this.w = w;
this.h = h;
this.idobj = document.getElementById(id);
this.link = document.getElementById(linkid);
this.Items = imgs;
this.myname = name;
this.write();
this.play(0);
}

Images.prototype={
write:function(){
this.idobj.innerHTML = "";

var lis = "<div style='width:116px;height:30px;text-align:left;padding-left:2px;float:right;cursor:pointer;'><table cellpadding='0' cellspacing='0'><tr>";
for (var i=0;i<this.Items.length;i++)
lis += "<td style='padding:3px 1px 1px 1px;'><img id='"+this.myname+i+"' src='"+this.Items[i].nailImg+"' onmouseover='"+this.myname+".over(this,"+i+");' onmouseout='"+this.myname+".out(this,"+i+");' /></td>\n";
lis += "</tr></table></div>";
var htm = "<div style='width:"+this.w+"px; height:"+this.h+"px; background:#999;text-align:left; '>"
+"<div style='position:absolute;width:"+this.w+"px;height:"+this.h+"px;' ><img style='cursor:pointer;' id='"+this.myname+"img' width="+this.w+" height="+this.h+" src='' onclick='"+this.myname+".click();'/></div>"
+"<div style='position:absolute;width:"+this.w+"px;height:30px;margin:"+(this.h-30)+"px 0px 0px 0px;' >"+lis+"</div></div>";
this.idobj.innerHTML = htm;
this.imgNo = this.Items.length-1;
this.isloop = true;
this.time = 0;
this.img = document.getElementById(this.myname+'img');

},
play:function(i){
//if (this.imgNo==i) return;
var old = this.imgNo;
this.imgNo = i;
if (this.imgNo>=this.Items.length) this.imgNo = 0;

var o = document.getElementById(this.myname+old);
o.src = this.Items[old].nailImg;
var c = document.getElementById(this.myname+this.imgNo);
c.src = this.Items[this.imgNo].clickImg;

var isIE = (window.navigator.userAgent.indexOf("MSIE") != -1)?true:false;
if (isIE)
{
this.img.style.filter = Filter[this.Items[this.imgNo].filter];
this.img.filters[0].apply();
this.img.filters[0].play();
}
this.img = document.getElementById(this.myname+'img');
this.img.src = this.Items[this.imgNo].Img;
//this.img.style.filter = Filter[this.Items[this.imgNo].filter];

var next = this.imgNo + 1;
if (this.isloop&&this.Items.length>1)
    this.time = setTimeout(this.myname+".play("+next+")",this.Items[this.imgNo].lasttime);
},
stop:function(){
this.isloop = false;
clearTimeout(this.time);
},
over:function(obj,i){
this.stop();
if (this.imgNo == i) return;
var o = document.getElementById(this.myname+this.imgNo);
o.src = this.Items[this.imgNo].nailImg;
obj.src = this.Items[i].clickImg;
this.img.src = this.Items[i].Img;
this.imgNo = i;
},
out:function(obj,i){
this.isloop = true;
this.play(i);
},
click:function(){
window.open(this.Items[this.imgNo].Url,'_blank');
}
};

var Filter=new Array();
Filter[0]="progid:DXImageTransform.Microsoft.Iris(duration=0.5,irisStyle=CROSS,motion=out)";
Filter[1]="progid:DXImageTransform.Microsoft.GradientWipe(duration=0.5,gradientSize=0.25,motion=forward)";
Filter[2]="progid:DXImageTransform.Microsoft.Stretch(duration=0.5,stretchStyle=PUSH)";
Filter[3]="progid:DXImageTransform.Microsoft.Blinds(duration=0.5,bands=30,Direction=left)";
Filter[4]="progid:DXImageTransform.Microsoft.Fade(duration=2)";
Filter[5]="progid:DXImageTransform.Microsoft.Slide(duration=0.5,bands=1,slideStyle=SWAP)";
Filter[6]="progid:DXImageTransform.Microsoft.Inset(duration=1)";
Filter[7]="progid:DXImageTransform.Microsoft.RandomDissolve(duration=1)";
Filter[8]="progid:DXImageTransform.Microsoft.RevealTrans(duration=0.5,transition=23)";
Filter[9]="progid:DXImageTransform.Microsoft.Barn(duration=0.5,motion=out,orientation=vertical)";
Filter[10]="progid:DXImageTransform.Microsoft.CheckerBoard(duration=0.5,squaresX=1,squaresY=30,Direction=right)";
Filter[11]="progid:DXImageTransform.Microsoft.Pixelate( ,enabled=false,duration=0.5,maxSquare=25)";
Filter[12]="progid:DXImageTransform.Microsoft.RadialWipe(duration=1,wipeStyle=WEDGE)";
Filter[13]="progid:DXImageTransform.Microsoft.RandomBars(duration=1,orientation=vertical)";
Filter[14]="FILTER: revealTrans(duration=2,transition=20)";
Filter[15]="progid:DXImageTransform.Microsoft.Spiral(duration=0.5,gridSizeX=1,gridSizeY=5)";
Filter[16]="progid:DXImageTransform.Microsoft.Wheel(duration=0.5,spokes=16)";
Filter[17]="progid:DXImageTransform.Microsoft.Zigzag(duration=0.25,gridSizeX=10,gridSizeY=1)";
Filter[18]="progid:DXImageTransform.Microsoft.Strips(duration=0.5,motion=rightup)";
Filter[19]="BlendTrans(duration=1)";