//image manager
//daniel_arce at ringer dot ca

function ImgMgr(pImgArray, pPath, pID){
//todo imgPath s.b a parameter
this.imgPath = pPath;
this.ID = pID;
this.imgCollection = eval(pImgArray);
this.index = 0;
this.imgObj = new Image();
this.next = _DRimgNext;
this.prev = _DRimgPrev;
this.preLoad = _DRimgPreLoad;
this.getID = _DRgetID;
}

function _DRimgNext(){
	this.index ++;
	if (this.index > this.imgCollection.length -1)
		{this.index = 0;}
	this.getID();
}

function _DRimgPrev(){
	this.index --;
	if (this.index < 0) {
		this.index = this.imgCollection.length -1
		}
	this.getID();
}

function _DRimgPreLoad(){
	var imgObjs = new Array();
	for (i=0; i<this.imgCollection.length -1; i++) {
		imgObjs[i] = new Image();
		imgObjs[i].src = this.imgPath + this.imgCollection[i];
		//alert(imgObjs[i].src);
		//alert(imgObjs[i].complete);	
	}
}

function _DRgetID() {
(document.getElementById) ? this.imgObj = document.getElementById(this.ID) : this.imgObj = document.all[this.ID];
this.imgObj.src = this.imgPath + this.imgCollection[this.index];
}