﻿// JScript File

function RedirectToAd()
{
    if (document.getElementById)
    {
        // this is the way the standards work
            var inp=document.getElementById("TopRotatorID");
    }
    else if (document.all)
    {
            // this is the way old msie versions work
            var inp=document.all["TopRotatorID"];
    }
    else if (document.layers)
    {
            // this is the way nn4 works
            var inp=document.layers["TopRotatorID"];
    }

    if(TopRotatorImgAry.length>inp.value){
        parent.location=TopRotatorImgAry[inp.value][1];
    }
    //Value for Link
}

function ResetTopRotatorInterval(Speed)
{
    clearInterval(intervalID);
    intervalID = window.setInterval("AutoRotate()", Speed);
}

function LoadTopRotatorImgAry(id)
{
    if(TopRotatorImgAry.length>id){
        
        if (document.getElementById)
        {
            // this is the way the standards work
            var Div = document.getElementById("mainPromo");
            var inp=document.getElementById("TopRotatorID");
            
            
            //Detect IE6+
            version=0
            if (navigator.appVersion.indexOf("MSIE")!=-1){
            temp=navigator.appVersion.split("MSIE")
            version=parseFloat(temp[1])
            }

            //alert(version);
            if (version>=6){
             
                if(Div.filters){
                    Div.style.filter="blendTrans(duration=crossFadeDuration)";
                    Div.filters.blendTrans.Apply();
                    Div.filters.blendTrans.Play();
                    //alert("Blend");
                }
            }
            
            
            // Change the Image
            Div.style.background='url(' + TopRotatorImgAry[id][0] + ')';
            inp.value=id;
            
            
            // set the pager BG color
            for (i = 0; i < TopRotatorImgAry.length; i++)
            {
                if(i == id)
                {
                    document.getElementById("adpage_" + i).style.backgroundColor='#FFD86F';
                    document.getElementById("adpage_" + i).style.color='#000000';
                }else{
                    document.getElementById("adpage_" + i).style.backgroundColor='#fff';
                    document.getElementById("adpage_" + i).style.color='#000000';
                }
            }
        
        }
        else if (document.all)
        {
            // this is the way old msie versions work
            var Div = document.all["mainPromo"];
            Div.style.background='url(' + TopRotatorImgAry[id][0] + ')';
            var inp=document.all["TopRotatorID"];
            inp.value=id;
        }
        else if (document.layers)
        {
            //  this is the way nn4 works
            var Div = document.layers["mainPromo"];
            Div.style.background='url(' + TopRotatorImgAry[id][0] + ')';
            var inp=document.layers["TopRotatorID"];
            inp.value=id;
        }
        
    }
}

function AutoRotate()
{
    if (document.getElementById)
    {
        // this is the way the standards work
            var inp=document.getElementById("TopRotatorID");
    }
    else if (document.all)
    {
            // this is the way old msie versions work
            var inp=document.all["TopRotatorID"];
    }
    else if (document.layers)
    {
            // this is the way nn4 works
            var inp=document.layers["TopRotatorID"];
    }
    if(TopRotatorImgAry.length>0)
    {
        var newidx = parseInt(inp.value) + 1 < TopRotatorImgAry.length ? parseInt(inp.value) + 1 : 0;
        LoadTopRotatorImgAry(newidx);
    }
}
