dsBlockRating = {
	
	d: document,
	ratingImgs: new Array(),
	scale: 5,
	
	setScale: function(newScale){
		
		this.scale = newScale;
		
	},
	
	assignImgToIndex: function(imgIndex, imgLoc){
		
		if(imgIndex > this.scale){
			
			alert('dsBlockRating\n\tassignImgToIndex\n\t\tUnable to assign an image to index ' + imgIndex + ' because scale is ' + this.scale);
			return;
			
		}
		
		this.ratingImgs[imgIndex] = imgLoc;
		
	},
	
	getImgFromPerc: function(perc, imgLink, imgStyle){
		
		if(perc == undefined){
			
			this.writeImg(0, imgLink, imgStyle);
			
		} else{
			
			// get the appropriate image
			var percConvert = Math.floor(this.scale * (perc / 100));
			var imgIndex = (percConvert > 0) ? percConvert : 1;
			
			this.writeImg(imgIndex, imgLink, imgStyle);

		}
		
	},
		
	writeImg: function(imgIndex, imgLink, imgStyle){
		
		if(this.ratingImgs[imgIndex]){
			
			var writeStr = '';
			
			if(imgLink) writeStr += '<a href="' + escape(imgLink) + '">';
			writeStr += '<img src="' + this.ratingImgs[imgIndex] + '" alt="Rating ' + imgIndex + '" style="' + imgStyle + '">';
			if(imgLink) writeStr += '</a>';
			
			document.write(writeStr);
			
		} else {
			
			document.write('Rating: ' + imgIndex);
			
		}	
		
	}
	
}