var YOOBase = {
	matchDivHeight: function (selector, divBorder, minWidth) {
		var maxHeight = 0;
		var matchDivs = [];
		var selectors = selector.split(" ");
		var elements = selectors.shift();
		var script = "";
		selectors.each(function (el, i) {
			script += ".getElement(\"" + el + "\")";
		});
		$ES(elements).each(function (element, i) {
			eval("matchDivs.push(element" + script + ");");
		});
		matchDivs.each(function (div, i) {
			if (!$chk(div)) {return;}
			var divHeight, divPadding;
			if (div.offsetHeight) {
				divHeight = div.offsetHeight;
				divPadding = 0;
				divPadding += div.getStyle("padding-top").toInt();
				divPadding += div.getStyle("padding-bottom").toInt();
				divHeight -= divPadding;
				if (divBorder != undefined) {divHeight -= divBorder;}
			} else if (div.style.pixelHeight) {divHeight = div.style.pixelHeight;}
			maxHeight = Math.max(maxHeight, divHeight);
		});
		if (minWidth != undefined) {
			maxHeight = Math.max(maxHeight, minWidth);
		}
		matchDivs.each(function (div, i) {
			if (!$chk(div)) {return;}
			if (window.ie6) {div.setStyle("height", maxHeight + "px");} 
				else {div.setStyle("min-height", maxHeight + "px");}
		});
}, 
addHeaderSpan: function (selector) {
	$$(selector).each(function (el, i) {
		var text = el.getText().replace(/[^\w]*(\w+)(.*)/, "<span class=\"color\">$1</span>$2");
		el.setHTML(text);
	});}
};

/*
var YOOStyleSwitcher = new Class({
	initialize: function (wrappers, options) {
		this.setOptions({
			widthDefault: "width-wide", 
			widthThinPx: 780, 
			widthWidePx: 940, 
			widthFluidPx: 0.9, 
			transition: Fx.Transitions.quadOut, 
			duration: 500, 
			afterSwitch: Class.empty
		}, options);
		this.fontSmall = "font-small", 
		this.fontMedium = "font-medium", 
		this.fontLarge = "font-large", 
		this.widthThin = "width-thin";
		this.widthWide = "width-wide";
		this.widthFluid = "width-fluid";
		this.wrappers = $$(wrappers);
		this.htmlbody = new Element(document.body);
		this.addEvent("afterSwitch", this.options.afterSwitch);
		this.widthStyle = "";
		var switchWidthThin = $E("#switchwidththin");
		var switchWidthWide = $E("#switchwidthwide");
		var switchWidthFluid = $E("#switchwidthfluid");
		var switchFontSmall = $E("#switchfontsmall");
		var switchFontMedium = $E("#switchfontmedium");
		var switchFontLarge = $E("#switchfontlarge");
		if (switchWidthThin) {switchWidthThin.addEvent("click", function () {this.widthSwitch(this.widthThin);}.bind(this));}if (switchWidthWide) {switchWidthWide.addEvent("click", function () {this.widthSwitch(this.widthWide);}.bind(this));}if (switchWidthFluid) {switchWidthFluid.addEvent("click", function () {this.widthSwitch(this.widthFluid);}.bind(this));}if (switchFontSmall) {switchFontSmall.addEvent("click", function () {this.fontSwitch(this.fontSmall);}.bind(this));}if (switchFontMedium) {switchFontMedium.addEvent("click", function () {this.fontSwitch(this.fontMedium);}.bind(this));}if (switchFontLarge) {switchFontLarge.addEvent("click", function () {this.fontSwitch(this.fontLarge);}.bind(this));}}, fontSwitch: function (font) {var fonts = [this.fontSmall, this.fontMedium, this.fontLarge];fonts.each(function (currentFont, i) {if (currentFont == font) {this.htmlbody.addClass(font);} else {this.htmlbody.removeClass(currentFont);}}.bind(this));Cookie.set("ytstylefont", font, {path: "/"});this.fireEvent("afterSwitch");}, widthSwitch: function (width) {var curWidth = this.getWidthPx(Cookie.get("ytstylewidth") || this.options.widthDefault);var newWidth = this.getWidthPx(width);Cookie.set("ytstylewidth", width, {path: "/"});this.wrappers.each(function (wrapper, i) {var fx = wrapper.effect("width", this.options);fx.addEvent("onComplete", this.widthSwitchComplete.bind(this)).addEvent("onComplete", this.options.afterSwitch);fx.start(curWidth, newWidth);}.bind(this));}, widthSwitchComplete: function () {var widthStyle = Cookie.get("ytstylewidth") || this.options.widthDefault;if (widthStyle == this.widthFluid) {this.wrappers.each(function (wrapper, i) {wrapper.setStyle("width", this.options.widthFluidPx * 100 + "%");}.bind(this));}}, getWidthPx: function (width) {if (width == this.widthThin) {return this.options.widthThinPx;}if (width == this.widthFluid) {return parseInt(Window.getWidth() * this.options.widthFluidPx);}return this.options.widthWidePx;}
});
YOOStyleSwitcher.implement(new Events);
YOOStyleSwitcher.implement(new Options);
*/

var YOOMorph = new Class({
	initialize: function (menu, enter, leave, enterFx, leaveFx) {
		this.setOptions({duration: 500, transition: Fx.Transitions.expoOut, wait: false, ignoreClass: ""}, enterFx);
		var options = this.options;
		$$(menu).each(function (el, i) {
			var liFxs = new (Fx.Styles)(el, options);
			if (!($chk(options.ignoreClass) && el.hasClass(options.ignoreClass))) {
				el.addEvent("mouseenter", function (e) {
					liFxs.setOptions(options, enterFx).start(enter);
				});
				el.addEvent("mouseleave", function (e) {
					liFxs.setOptions(options, leaveFx).start(leave);
				});
			}
		});
	}
});

YOOMorph.implement(new Options); 

