/*	Function for Vertical Slider	*/
function SlideMenu(idMenu,className) {
	var ulList = $$('.'+className);
	var effs = new Array();
	for (var i = 0; i < ulList.length; i++) {
		var ul = ulList[i];
		if (ul.id != idMenu && ul.style.display != 'none') {
			effs.push(new Effect.SlideUp(ul, { sync: true, beforeStart: function (ddId) { $(ddId).previous('dt').removeClassName('dt_Selected') }.bind(null, ul.id) }));
		} else if (ul.id == idMenu) {
			if (ul.style.display != 'none') {
				effs.push(new Effect.SlideUp(ul, { sync: true, beforeStart: function (ddId) { $(ddId).previous('dt').removeClassName('dt_Selected') }.bind(null, ul.id) }));
			} else {
				effs.push(new Effect.SlideDown(ul, { sync: true, beforeStart: function (ddId) { $(ddId).previous('dt').addClassName('dt_Selected') }.bind(null, ul.id) }));
			}
		}
	}
	new Effect.Parallel(effs, { duration: 0.5 });
}

/*	Function for Horizontal ul Slider	*/
var HorizontalUlSlider = Class.create();
HorizontalUlSlider.prototype = {
	initialize: function (idUl, openWidth, closedWidth, duration) {
		this.idUl = idUl;
		this.openWidth = openWidth;
		this.closedWidth = closedWidth;
		this.duration = duration ? duration : 0.5;
		
		this.currentEffect = null;
		
		this.elms = $$('#'+ idUl + ' li');
		if (this.elms.length > 0) {
			this.onMouseOver(this.elms[0]);
		}
		this.elms.each(function (elm) {
			Event.observe(elm, 'mouseover', this.onMouseOver.bind(this, elm));
		}.bind(this));
	},
	
	onMouseOver: function (elm) {
		if (this.currentEffect != null) {
			this.currentEffect.cancel();
			this.currentEffect = null;
		}
		var effs = new Array();
		for (var i = 0; i < this.elms.length; i++) {
			var li = this.elms[i];
			if (li == elm) {
				effs.push(new Effect.Morph(li, { style: { width: this.openWidth }, sync: true }));
			} else if (li.style.width != this.closedWidth) {
				effs.push(new Effect.Morph(li, { style: { width: this.closedWidth }, sync: true }));
			}
		}
		this.currentEffect = new Effect.Parallel(effs, { duration: this.duration });
	}
	
};

