
	function Fade( Name ){
		this.ObjToFade //= new Array();
		this.ObjCounter = 0;
		
//		this.StartColor = new Array(255,255,255);
//		this.EndColor = new Array(0,0,0);
//		this.EndColorLink = new Array(0,0,0);
//		this.StepsColor = new Array();
//		this.StepsColorLink = new Array();
		this.Steps = 20;
		this.StepCounter = 0;
		this.DelayStep = 50;
		this.DelayChange = 3000;
			
		this.SetObjToFade = function(sObj){ 
			this.ObjToFade = document.getElementById(sObj).getElementsByTagName("DIV");
			if (this.ObjToFade.length == 1){
				this.ObjToFade[0].style.opacity = 1;
				this.ObjToFade[0].style.mozOpacity = 1;
				this.ObjToFade[0].style.filter = 'Alpha(opacity=100)';
			} else {	
				for (var i=0; i < this.ObjToFade.length; i++){
					this.ObjToFade[i].style.opacity = 0;
					this.ObjToFade[i].style.mozOpacity = 0;
					this.ObjToFade[i].style.filter = 'Alpha(opacity=0)';
					this.ObjToFade[i].style.display = 'none';
				}
			}
		}
		this.SetStep = function(s){this.Steps = s;}
		this.SetDelayStep = function(d){this.DelayStep = d;}
		this.SetDelaySwap = function(d){this.DelayChange = d;}
/*		
		this.GetStepColor = function( aryStepColor, aryEndColor ) {
			var diff
			var newcolor=new Array(3);
	
//			aryStepColor[0] = "rgb(" + this.StartColor[0] + ", " + this.StartColor[1] + ", " + this.StartColor[2] + ")";
			for(var s=0;s < this.Steps;s++) {
				for(var i=0;i<3;i++) {
					diff = (this.StartColor[i]-aryEndColor[i]);
					if(diff > 0) 	newcolor[i] = this.StartColor[i]-(Math.round((diff/this.Steps))*s);
					else			newcolor[i] = this.StartColor[i]+(Math.round((Math.abs(diff)/this.Steps))*s);
					if ( newcolor[i] < 0 ) newcolor[i] = 0;
					if ( newcolor[i] > 255 ) newcolor[i] = 255;
				}
				aryStepColor[s] = "rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")";
			}
//			aryStepColor[this.Steps] = "rgb(" + aryEndColor[0] + ", " + aryEndColor[1] + ", " + aryEndColor[2] + ")";
		}
*/	
		this.SwapObject = function( type ){
	//		alert('SwapObject')
	
			if ( type != 'start'){
				this.ObjToFade[ this.ObjCounter ].style.display = 'none';
				this.ObjCounter++;
				if (this.ObjCounter >= this.ObjToFade.length) 
					this.ObjCounter = 0;
			}
			this.ObjToFade[ this.ObjCounter ].style.display = '';
			this.ColorFade('in');
		}
	
		this.ColorFade = function (type) {
			var Obj = this.ObjToFade[ this.ObjCounter ];
	//		alert('ColorFade:'+type+ '  ObjToFade:'+this.ObjToFade[ this.ObjCounter ]+'  ObjCounter:'+this.ObjCounter)
	//		alert('ColorFade:'+type+ '  Obj:'+Obj+'  StepCounter:'+this.StepCounter+'  StepsColor:'+this.StepsColor[ this.StepCounter ])
			if ( type == 'in' ){
				if( this.StepCounter < (this.Steps-1) ) {	
//					Obj.style.color = this.StepsColor[ this.StepCounter ];
//					this.LinkFade(this.StepsColorLink[ this.StepCounter ]);
					this.StepCounter++;
					var opacity = this.StepCounter * 100 / this.Steps;
					Obj.style.opacity = opacity/100;
					Obj.style.mozOpacity = opacity/100;
					Obj.style.filter = 'Alpha(opacity='+opacity+')';
					
					setTimeout(Name+'.ColorFade("in")',this.DelayStep);
				} else {
					setTimeout(Name+'.ColorFade("out")', this.DelayChange);
				}
			} else if ( type == 'out' ){
				if( this.StepCounter > 0 ) {	
//					Obj.style.color = this.StepsColor[ this.StepCounter ];
//					this.LinkFade(this.StepsColorLink[ this.StepCounter ]);
					this.StepCounter--;
					var opacity = this.StepCounter * 100 / this.Steps;
					Obj.style.opacity = opacity/100;
					Obj.style.mozOpacity = opacity/100;
					Obj.style.filter = 'Alpha(opacity='+opacity+')';
					setTimeout(Name+'.ColorFade("out")',this.DelayStep);
				} else {
					this.SwapObject('');
				}
			}
		}
/*	
		this.LinkFade = function(sColor){
			var obj=this.ObjToFade[ this.ObjCounter ].getElementsByTagName("A");
//			if (obj.length>0){
				for (i=0;i<obj.length;i++)
					obj[i].style.color=sColor;
//			}
		}
*/

		this.Start = function (){
			if ( this.ObjToFade.length <= 1)	
				return false;
//			this.GetStepColor(this.StepsColor, this.EndColor);
//			this.GetStepColor(this.StepsColorLink, this.EndColorLink);
			this.SwapObject('start');
		}
	}
