// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
//
//	Utility Methods v0.05
//	by Daniel Macias - http://www.danmacias.com
//	Last Modification: 8/5/09
//
//	For more information, visit:
//	http://www.danmacias.com
//
//	Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
//  	- Free for use in both personal and commercial projects
//		- Attribution requires leaving author name, author link, and the license info intact.
//
//  !!!  Include Prototype
//
// -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

//Just give your UL's a class name of "random_bullets' and pass in as many images as u want!
//Public Methods:  randomize(tag) | randomizeAll();
var BulletRandomizer = Class.create({
	listTags : [],
	bulletImages : [],
	initialize: function(inputImages){
		this.listTags = $$('ul.random_bullets');
		if (inputImages instanceof Array){
			this.bulletImages = inputImages;
			this.listTags.each(function(listTag){
											this.setRandomBulletStyle(listTag);											
										}.bind(this));
		}else{
			alert('BulletRandomizer Error: Must pass in an ARRAY of images as an argument');
		}
	},
	setRandomBulletStyle: function(listTag){
		var randomImageIndex = Math.floor(Math.random() * this.bulletImages.length);
		listTag.setStyle({listStyleImage: 'url('+ this.bulletImages[randomImageIndex] +')'});
	},
	randomize: function(listTag){
		setRandomBulletStyle(listTag);
	},
	randomizeAll: function(){
		this.listTags.each(function(listTag){
										this.setRandomBulletStyle(listTag);											
									}.bind(this));		
	}
	
});