
var ViewAllHoverController = new Class({
	ClassName: 'ViewAllHoverController',
	Extends: Thread,

	initialize: function(options) {
		this.parent(options);
		this.button = this.options.button;
		this.position = {
			x: this.button.getStyle('right').toInt(),
			y: this.button.getStyle('bottom').toInt()
		}

		this.button.addEvent('mouseenter', function(){
			this.start();
		}.bind(this));
		this.button.addEvent('mouseout', function(){
			this.stop();
		}.bind(this));
	},

	execute: function() {
		this.button.setStyles({
			bottom: Random(this.position.y-2,this.position.y+2),
			right: Random(this.position.x-3,this.position.x+3)
		});
	},

	stop: function() {
		this.parent();
		this.button.setStyles({
			bottom: this.position.y,
			right: this.position.x
		});
	}
});

$$('div.viewall').each(function(item) {
	new ViewAllHoverController({button: item, interval:100});
});
