function e(id){
	return document.getElementById(id);
}

function callFader(container,id,cellheight,pausetime,fadetime) {
	this.container = container;
	this.id = id;
	this.pauseTime = pausetime;
	this.fadeTime = fadetime;
	this.framesPerSec = 20;
	this.transparencyStep = 100 / ((this.fadeTime / 1000) * this.framesPerSec);
	this.zIndexRangeStart = 101;
	this.int_z = 100;
	this.int_alpha= 0;
	this.int_anim_timeout = -1;
	this.current_id = -1;
	this.bln_is_first = true;
	
	this.setTransparency = function (percentage) 
	{
		
		var Fader = e(this.id + "-" +  this.current_id);
		if(!Fader){return false;}
		if (Fader.filters != null) {
			if (typeof Fader.filters == "[object]") { //if IE6+
				Fader.filters[0].opacity = percentage;
			} else { //else if IE5.5-
				Fader.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+percentage+")";
			}
		} else if (Fader.style.MozOpacity) {
			Fader.style.MozOpacity = percentage / 101;
		} else if (Fader.style.KhtmlOpacity) {
			Fader.style.KhtmlOpacity = percentage / 100;
		}
	}

	
	this.showNextImage = function () 
	{
		this.current_id++;
		
		
		if(!e(this.id.split("testimonial_fader").join("img-fader") + "-" +  this.current_id)){
			this.current_id = 1;
		}
		
		updateImageLink(this.current_id);
		
		var fader_value = e(this.id.split("testimonial_fader").join("img-fader") + "-" +  this.current_id);
		var Fader = e(this.id + "-" +  this.current_id);
		this.int_z++;
		Fader.style.zIndex = this.int_z;
		
		
		if (this.bln_is_first ){
			
			this.bln_is_first  = false;
			this.setTransparency(100) 
			this.onFadeComplete();
		} else {
			this.setTransparency(0) 
			this.int_alpha = 0;
			this.fadeCurrentIn();
		}
	}
	
	
	this.fadeCurrentIn = function(){
		this.int_alpha+=5
		this.int_alpha = Math.min(100,this.int_alpha);
		this.setTransparency(this.int_alpha) 
		if (this.int_alpha == 100){
			this.onFadeComplete();
		} else {		
		var _self = this;
			var int_dummy =  setTimeout(function(){ _self.fadeCurrentIn(); },  1000 / this.framesPerSec);
		}
	}
	
	this.onFadeComplete = function(){
		var _self = this;
		var int_dummy = setTimeout(function(){ _self.showNextImage(); }, 1 * this.fadeTime);		
	}
}
