(function($) {
	
	$.fn.extend({
				
		evinaura_index: function() {
			
			return this.each(function() {
				
				var obj = $(this);
				var numEntries = $("div.entry", obj).length;
				var nextPosition = 0;
				var padding = 30;
				var noRepeats = new Array();
				var repeatTest = false;
				
				//alert("check");
				
				for (var i=0; i<numEntries; i++) {
					
					var thisIndex = Math.round(Math.random() * numEntries);
					
					//alert("thisIndex = " + thisIndex + ",noRepeats = " + noRepeats.length);
					
					if (noRepeats.length > 0) {
						repeatTest = check(thisIndex);
					}
					
					function check(tIndex) {
						for (var s=0; s<noRepeats.length; s++) {
							if (noRepeats[s] == tIndex) {
									return true;
							}
						}
						
						if (thisIndex >= numEntries) {
							return true;	
						}
						
						if (thisIndex < 0) {
							return true;	
						}
						
						return false;
					}
					
					while (repeatTest == true) {
						thisIndex = Math.round(Math.random() * numEntries);
						repeatTest = check(thisIndex);
					}
					
					noRepeats.push(thisIndex);
					
					var thisPosition = nextPosition;
					
					//alert("thisIndex = " + thisIndex + ",noRepeats = " + noRepeats.length + ", thisPosition = " + thisPosition);
					
					$("div.entry:eq(" + thisIndex + ")", obj).css({left:thisPosition}); 
					
					nextPosition = thisPosition + padding + 210;
				}
			});
		}
	});
	
})(jQuery);
