var images=new Array();
var SlidIndex=0;
var picCount=51;
var ATimer;
function Preload()
{
    try
    {
        var imgObj=new Image();

        for(var i=1;i<=picCount;i++)
        {
            images[i-1]='image/pic/'+ i  + '.jpg';
        }
        for(var j=0;j<picCount;j++)
        {
            imgObj.src=images[j];
        }
        ShowNextImage()
    }
    catch(e)
    {
        alert(e);
    }
}
function FadeOut(id,duration)
{
    try
    {
        var millisec=Math.round(duration/100);
        var timer=0;
        for(var i=0;i<=100;i++)
        {
            setTimeout("SetOpacity('" + id + "'," + i + ")",(timer*millisec));
            timer++;
        }
    }
    catch(e)
    {}
}
function FadeIn(id,duration)
{
    try
    {
        var millisec=Math.round(duration/100);
        var timer=0;
        for(var i=100;i>=0;i--)
        {
            setTimeout("SetOpacity('" + id + "'," + i + ")",(timer*millisec));
            timer++;
        }
    }
    catch(e)
    {}
}
function SetOpacity(id,opacity)
{
    try
    {
        var element=document.getElementById(id).style;
        element.opacity=(opacity/100);
        element.MozOpacity=(opacity/100);
        element.KhtmlOpacity=(opacity/100);
        element.filter="alpha(opacity=" + opacity + ")";
    }
    catch(e)
    {}
}
function ShowNextImage()
{
    try
    {
        clearTimeout(ATimer);
        SlidIndex++;
        if(SlidIndex>=picCount)
            SlidIndex=1;
        document.getElementById('pic1').src=document.getElementById('pic2').src;
        document.getElementById('pic2').src=images[SlidIndex];
        ATimer=setTimeout('ShowNextImage()',10000);
        //FadeOut('pic1',1500);
    }
    catch(e)
    {
    }
}
function ShowNextImageManually()
{
    try
    {
        clearTimeout(ATimer);
        SlidIndex++;
        if(SlidIndex>=picCount)
            SlidIndex=1;
        document.getElementById('pic1').src=document.getElementById('pic2').src;
        document.getElementById('pic2').src=images[SlidIndex];
       // FadeOut('pic1',1500);
    }
    catch(e)
    {
    }
}
function ShowLastImageManually()
{
    try
    {
        clearTimeout(ATimer);
        SlidIndex--;
        if(SlidIndex<0)
            SlidIndex=0;
        document.getElementById('pic1').src=document.getElementById('pic2').src;
        document.getElementById('pic2').src=images[SlidIndex];
       // FadeOut('pic1',1500);
    }
    catch(e)
    {
    }
}
var Blinidx=0;
function Blink(id)
{
    try
    {
        if(Blinidx==1)
        {
            document.getElementById(id).style.visibility='visible';
            Blinidx=0;
        }
        else
        {
            document.getElementById(id).style.visibility='hidden';
            Blinidx=1;
        }
        setTimeout("Blink('" + id + "')",1000);
    }
    catch(e)
    {
    }
}
//Blink('img1');
