﻿Rotator = {
Count: 0,
IsRotating: true,
MoveToImage: function(i) {
        if(i<_rotatorObjs.Images.length){
         this.Count = i;}
        this.MoveNext(false);},
MoveNext: function(isFade){
            var imageContainer = document.getElementById(_rotatorObjs.ImageContainer);
            var linkContainer = document.getElementById(_rotatorObjs.LinkContainer);
            if (this.Count>=_rotatorObjs.Images.length){
                this.Count=0}
                this.SetActiveBI(this.Count + 1);
                imageContainer.src = _rotatorObjs.Images[this.Count].Image;
                imageContainer.alt = _rotatorObjs.Images[this.Count].Tip;
                imageContainer.title = _rotatorObjs.Images[this.Count].Tip;
                linkContainer.target = _rotatorObjs.Images[this.Count].Target;
                //if (isFade){
                    //FadeIn('rotatingImage', 0);
                    //}
                linkContainer.href = _rotatorObjs.Images[this.Count].Link;
                this.Count += 1;},
Rotate: function() {
            if (_rotatorObjs.Images.length > 1){
            if (!this.Preloaded){this.PreloadImages();}
            if (this.IsRotating){ this.MoveNext(true);}
            window.setTimeout('Rotator.Rotate()', 8000);}},
SetActiveBI: function(ai) {
        var i;
         for (var i = 1; i < _rotatorObjs.Images.length + 1; i++) {
                if (ai == i){ChangeClass('rotb' + i,'rotatorButton'+i+'Active');}
                else{ChangeClass('rotb' + i,'rotatorButton'+i);}}},
Preloaded: false,
PreloadImages: function() {
    if (document.images) {
        preloadobj = new Image();
        for (var i=1; i<_rotatorObjs.Images.length; i++){
            preloadobj.src = _rotatorObjs.Images[i].Image;
        }
        this.Preloaded = true;
    }}
}

function FadeIn(objId,opacity) {
    if (document.getElementById) {
    var obj = document.getElementById(objId);
    if (opacity <= 100) {
      SetOpacity(obj, opacity);
      opacity += 5;
      window.setTimeout("FadeIn('" + objId + "'," + opacity + ')', 50);
    }
    }
}
function SetOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  obj.style.filter = 'alpha(opacity:'+opacity+')';
  obj.style.KHTMLOpacity = opacity/100;
  obj.style.MozOpacity = opacity/100;
  obj.style.opacity = opacity/100;
}


