function imgFade (tagId, bdir, width, height) {
	var that = this ;

	var imgArea = document.createElement ('div') ;
	imgArea.id = "bigImgArea" ;
	imgArea.setAttribute("style","float:right");
	imgArea.style.styleFloat='right' ;
	imgArea.style.width = width;
	imgArea.style.height= height;
	imgArea.style.display = "block";
	imgArea.style.marginBottom='1.5em';
	imgArea.style.border='0px solid #FFFFFF';
	imgArea.className='faded';
	document.getElementById(tagId).appendChild (imgArea);
	
	this.basedir = bdir ;
	this.imageId = [] ;
	this.imageDirName = [] ;
	this.imageFileName = [] ;
	this.imageComment = [] ;
	this.fadevalue = 0 ;
	this.plusorminus = 1 ;
	this.currentID = 0 ;
	this.count = 0;

	this.register = function(id, dir, name, comment) {
		var imageLength = that.imageId.length ;
		that.imageId[imageLength] = id ;
		that.imageDirName[imageLength] = dir ;
		that.imageFileName[imageLength] = name ;
		that.imageComment[imageLength] = comment ;
		document.getElementById('bigImgArea').innerHTML = 
			"<img id=\"img"+id+"\" src=\""+
			that.basedir+that.imageDirName[imageLength]+
			that.imageFileName[imageLength]+"\" >" ;
	}
	fadePic = function() {
		mozilla();
		setInterval("mozilla()", 200) ;
	}
	setOpacity = function(obj, opacity) {
		opacity = (opacity == 100)?99.999:opacity;
		// IE/Win
		obj.style.filter = "alpha(opacity:"+opacity+")";
		// Safari<1.2, Konqueror
		obj.style.KHTMLOpacity = opacity/100;
  		// Older Mozilla and Firefox
		obj.style.MozOpacity = opacity/100;
		// Safari 1.2, newer Firefox and Mozilla, CSS3
		obj.style.opacity = opacity/100;
	}

	mozilla = function () {
		if (that.fadevalue == 0){
                        document.getElementById('bigImgArea').innerHTML =
                              "<img id=\"bigImg\" src=\""+
                              that.basedir+that.imageDirName[that.currentID]+
                              that.imageFileName[that.currentID]+"\" >" ;
                }
		if (that.fadevalue < 40) {
                         that.fadevalue += 5 ;
		} else if (that.fadevalue < 100) {
			that.fadevalue += 10;
                } else if (that.count > 2) {
		that.count = 0;
			that.fadevalue=0;
                        if (that.currentID == that.imageId.length-1)
                               that.currentID = 0;
                         else
                              that.currentID++ ;
		} else {
                        document.getElementById('bigImgArea').style.background="url(\""+
                                that.basedir+that.imageDirName[that.currentID]+
                                that.imageFileName[that.currentID]+"\") no-repeat";
			that.count++;
		}

		obj = document.getElementById('bigImg');
		setOpacity(obj, that.fadevalue);
	}
}

