function phF(vn,idf,ub,mf,st,rt,sf,fxn) {
	this.varName=vn
	this.fotoID=idf
	this.fotoPath=ub
	this.cfoto=1
	this.cfotoM=mf
	this.cFade=99
	this.fotoRun=false
	this.stopTime=st
	this.runTime=rt
	this.stepFade=sf
	this.fixname=fxn
	this.fotos=new Array()
	this.div=null
	this.stopb=function() {alert(this);eval(this.varName+".stopFade()")}
	this.stopFade=function() {this.fotoRun=!this.fotoRun;if (this.fotoRun) {setTimeout(this.varName+".fadefoto(-1)",this.runTime)}}
	this.runFade=function (ve) {
		this.div=document.getElementById(this.fotoID)
		if (this.div) {
			if(window.addEventListener){
				this.div.addEventListener("click", ve, false);
			} else { // IE
				this.div.attachEvent("onclick", ve);
			}
			for(var i=1;i<=this.cfotoM;i++) {
				var im=new Image()
				if (this.fixname!="") {
					var lp=this.fixname+i
					im.src=this.fotoPath+(lp.substr(lp.length-this.fixname.length))+".jpg"
				} else {
					im.src=this.fotoPath+i+".jpg"
				}
				this.fotos[this.fotos.length]=im
			}
			this.div.style.backgroundImage="url("+this.fotos[this.cfoto-1].src+")"
			this.fotoRun=true
			setTimeout(this.varName+".fadefoto(-1)",this.stopTime)
		}
	}
	
	this.fadefoto=function fadefoto(s) {
		if (this.fotoRun) {
			this.cFade+=(s*this.stepFade)
			if (this.cFade>=99) {
				this.cFade=99
				setTimeout(this.varName+".fadefoto(-1)",this.stopTime)
			} else {
				if (this.cFade<=0) {
					this.cFade=0 
					this.cfoto++
					if (this.cfoto>this.cfotoM) {this.cfoto=1}
					this.div.style.backgroundImage="url("+this.fotos[this.cfoto-1].src+")"
					setTimeout(this.varName+".fadefoto(1)",this.runTime)
				} else {
					setTimeout(this.varName+".fadefoto("+s+")",this.runTime)
				}
			}
		} else {
			this.cFade=99
		}
		this.div.style.opacity=this.cFade/100
		this.div.filter="alpha(opacity="+this.cFade+")"
	}
}
