﻿var c = 1;//页面载入时显示第几张
var autoroll = true;//是否自动轮换
var t = 5000;//自动轮换间隔的时间，单位ms
var sd;
var imgs;
var texts;
var ids;
var imgspre;
function NoticeInit(imgs_,texts_,ids_)
{
    imgspre = new Array();
    for(var r=0;r<5;r++)
    {
    	imgspre[r] = new Image();
    	imgspre[r].src = imgs[r];
    }
    imgs=imgs_;
    texts=texts_;
    ids=ids_;
}
function ob(o,t)
{
    if(o.getAttribute('b')=='false')
    {
        o.style.backgroundColor = t== 1?'#fff':'red';
        o.style.color = t==1?'black':'white';
    }
}
function ci(i)
{
    clearInterval(sd);
    sd = setInterval(roll,t);
    ic(i);
}
function ic(i)
{
    ac(i);
    i--;
    var i1 = document.getElementById('i1');
    if (document.all) 
    {
	    i1.style.filter=st();
	    i1.filters[0].Apply();
    }
     i1.src = imgspre[i].src;
    if (document.all) 
    {
        i1.filters[0].Play();
    }
    document.getElementById('txt1').innerHTML = texts[i];
    document.getElementById('txt1').href=ids[i];
    document.getElementById('txt2').href=ids[i];
}
function ac(q)
{
    c = q;
    for(var i = 1;i<=5;i++)
    {
	    var o = document.getElementById('d'+i);
	    o.setAttribute('b','false');
	    o.style.backgroundColor = '#fff';
	    o.style.color = 'black';
    }
    var oe = document.getElementById('d'+q);
    oe.setAttribute('b','true');
    oe.style.backgroundColor = 'orange';
    oe.style.color = 'white';
}
function roll()
{
	c++;
	c = c>5?1:c;
	ic(c);
}
function st()
{
    var ts = new Array();
    ts[0] = 'progid:DXImageTransform.Microsoft.Fade(duration=1)';
    ts[1] = 'progid:DXImageTransform.Microsoft.Blinds(Duration=1,bands=20)';
    ts[2] = 'progid:DXImageTransform.Microsoft.Checkerboard(Duration=1,squaresX=20,squaresY=20)';
    ts[3] = 'progid:DXImageTransform.Microsoft.Strips(Duration=1,motion=rightdown)';
    ts[4] = 'progid:DXImageTransform.Microsoft.Barn(Duration=1,orientation=vertical)';
    ts[5] = 'progid:DXImageTransform.Microsoft.GradientWipe(duration=1)';
    ts[6] = 'progid:DXImageTransform.Microsoft.Iris(Duration=1,motion=out)';
    ts[7] = 'progid:DXImageTransform.Microsoft.Wheel(Duration=1,spokes=12)';
    ts[8] = 'progid:DXImageTransform.Microsoft.Pixelate(maxSquare=10,duration=1)';
    ts[9] = 'progid:DXImageTransform.Microsoft.RadialWipe(Duration=1,wipeStyle=clock)';
    ts[10] = 'progid:DXImageTransform.Microsoft.RandomBars(Duration=1,orientation=vertical)';
    ts[11] = 'progid:DXImageTransform.Microsoft.Slide(Duration=1,slideStyle=push)';
    ts[12] = 'progid:DXImageTransform.Microsoft.RandomDissolve(Duration=1,orientation=vertical)';
    ts[13] = 'progid:DXImageTransform.Microsoft.Spiral(Duration=1,gridSizeX=40,gridSizeY=40)';
    ts[14] = 'progid:DXImageTransform.Microsoft.Stretch(Duration=1,stretchStyle=push)';
    it = Math.floor(Math.random() * ts.length);
    return ts[it];
}
window.onload = function()
{
    ic(c);
    if(autoroll)
    {
        sd = setInterval(roll,t);
    }
}
