loadImage = function() {
	loadImage.prototype.init = function(imgArr, imgCount, uniqueKey, rotateImageTime) {
		this.imgCount = imgCount;		//total number of images
		this.uniqueKey = uniqueKey;	//uniqueID
		this.rotateImageTime = rotateImageTime;
		this.imgArr = new Array();
		
		var imgArrCount = imgArr.length;

		for(var i = 0; i < imgCount; i ++) {
			this.imgArr[i] = new Image();
			if (i < imgArrCount)
			{
				this.imgArr[i].src = imgArr[i];	
			} 
		}

		this.trigger();		
	}//end init
	
	loadImage.prototype.trigger = function() {
		 var _self = this;
			setInterval(function(){
				_self.render();
			}, this.rotateImageTime*1000);
	}
		
	loadImage.prototype.render = function() {
		if (arguments.length)
			imgNdx = parseInt(arguments[0]);
		else 
			imgNdx = -1; //request random	

		while (imgNdx < 0 || imgNdx >= this.imgCount) {
			imgNdx = Math.round(Math.random()*100)%this.imgCount;		
		}
//console.log('35 imgNdx    ' +this.uniqueKey + " " + imgNdx + '********');				
		if (this.imgArr[imgNdx]) { //render from local "cache"
			$('#randomimage_'+this.uniqueKey).attr('src', this.imgArr[imgNdx].src);	
		} else { //request in ajax
			
		}
	}
}

