smenu = new Class({
	Implements: [Options],
	options: {
		list: '.leftmenu a',
		duration: 200
	},
	initialize: function(element, options) {
		this.setOptions(options);
		this.element = $(element);
		var list = $$(this.options.list);
		list.each(function(element) {
			element.set('tween', {duration: 200});
			var checked = element.get('class');
			if (checked != 'checked') {
			element.addEvent('mouseenter', function(){
				element.tween('margin-left', '10px');
			});
 
			element.addEvent('mouseleave', function(){
				element.tween('margin-left', '0px');
			});
			}
 
		});
	}
});

bgPulse = new Class({
	Implements: [Options],
	options: {
		offTime: 1000,
		fadeTime: 1000,
		minOpacity: .2,
		opacityVariance: .5,
		maxOpacity: 1
	},
	initialize: function(element, options) {
		this.setOptions(options);
		this.element = $(element);
		this.element.set('morph', {duration: this.options.fadeTime});
		this.startPulse.delay(this.options.offTime, this);
	},
	startPulse: function() {
		if (this.element.getStyle('opacity')<1) {
			this.pulseOn();
		} else {
			this.pulseOff();
		}
	},
	pulseOn: function() {
		var morph = this.element.morph({'opacity':this.options.maxOpacity});
		if ($chk(morph.chain))
			morph.chain(this.startPulse.delay(this.options.offTime, this));
		else
			this.startPulse.delay(this.options.offTime + this.options.fadeTime, this);
	},
	pulseOff: function() {
		var tarOp = this.options.minOpacity + (Math.random() * this.options.opacityVariance);
		var morph = this.element.morph({'opacity':tarOp});
		if ($chk(morph.chain))
			morph.chain(this.startPulse.delay(this.options.offTime, this));
		else
			this.startPulse.delay(this.options.offTime + this.options.fadeTime, this);
	}
});

window.addEvent("domready",function() {
	logoPulse = new bgPulse('logopulse');
	sharkymenu =new smenu({list: 'div.leftmenu .toggler a'});
});
