function IndexString (n) {
	str=null;
	if (n<10) str= "0" + n;
	else str=String(n);	
	return str;
}

function Highliter (_imgpath, inClient, imageName, nState, _autoReset) {
	
	var i,j,n,ns,obj, str, val;
	
	if(_autoReset==true) {
		this.autoReset = true;
	} else {
		this.autoReset = false;
	}
	
	this.lastHiliteIndex = -1;
	this.lastHiliteName = "";
	
	this.client = inClient;
	this.namePrefix = (imageName[0]).substr(0, imageName[0].length-2);
	
	
	n = imageName.length;
	this.state = new Array();
		
	for(i=0; i<nState; i++) {
	
		ns = this.state.length;
		this.state[ns] = new Array();
		obj = this.state[ns];
		
		for(j=0; j<n; j++) {
			obj[j] = new Image;
			obj[j].src = _imgpath + imageName[j] + "." + IndexString(i) + ".gif";
		}
	}
	
	this.SetState = Highliter_SetState;
	
}


function Highliter_SetState(ndx, inState) {

	var imgName = String(this.namePrefix+IndexString(ndx));
	
	if(this.autoReset) {
		if (this.lastHiliteIndex >=0 ) {
			this.client[ this.lastHiliteName ].src= this.state[0][this.lastHiliteIndex].src;
		}
	}
	
	
	if(ndx < this.state[0].length && ndx >= 0) {
		if(inState < this.state.length && inState >= 0) {
			this.client[imgName].src=this.state[inState][ndx].src;
			this.lastHiliteIndex = ndx;
			this.lastHiliteName = imgName;
		}
	}
}