var ZJ_JSPN_Effect = new Class({
	options: {
		transition: Fx.Transitions.linear,
		duration: 300,
		fps: 50
	},
	
	build: function(el) {
		el._w = el.getStyle('width');
		el._fx = new Fx.Styles(el, {transition: this.options.transition, duration: this.options.duration, fps: this.options.fps, wait: false});
		el._fx.start({
			'width': 1,
			'opacity': 0.7
		});
		el.addEvents({
			'mouseenter': function(e) {
				this._fx.start({
					'width': this._w,
					'opacity': 1
				});
			}.bind(el),
			
			'mouseleave': function(e) {
				this._fx.start({
					'width': 1,
					'opacity': 0.7
				});
			}.bind(el)
		});
		
	},
	
	initialize: function(options) {
		this.setOptions(options);
		// get elements
		this.prev = $('zj_jspn_prev');
		this.next = $('zj_jspn_next');
		var el = null;
		
		if (this.prev) {
			el = this.prev.getParent().getParent();
			this.prev = this.prev.inject(document.body);
			this.build(this.prev.getElements('.zj_jspn_outer')[0]);
		}
		if (this.next) {
			el = this.next.getParent().getParent();
			this.next = this.next.inject(document.body);
			this.build(this.next.getElements('.zj_jspn_outer')[0]);
		}
		
		// remove jomsocial app-box
		if (el) {
			el.remove();
		}
	}
});

ZJ_JSPN_Effect.implement(new Options);