var YOOBase = {
    matchHeight: function(elements, min) {
        var max = 0;
        $$(elements).each(function(element, i) {
            var height;
            if (element.offsetHeight) {
                height = element.offsetHeight;
            } else if (element.style.pixelHeight) {
                height = element.style.pixelHeight;
            }
            max = Math.max(max, height);
        });
        /*if (elements=='div.listelement div.deepest') max = max + 10;*/
        if (min != undefined) {
            max = Math.max(max, min);
        }
        $$(elements).each(function(element, i) {
            var offset = element.getStyle("padding-top").toInt() + element.getStyle("padding-bottom").toInt() + element.getStyle("border-top-width").toInt() + element.getStyle("border-bottom-width").toInt();
            var height = max - offset;
            var style = window.ie6 ? "height": "min-height";
            element.setStyle(style, height + "px");
        });
    }
};
var YOOMorph = new Class({
    initialize: function(element, enter, leave, enterFx, leaveFx, elementFx) {
        this.setOptions({
            duration: 500,
            transition: Fx.Transitions.expoOut,
            wait: false,
            ignoreClass: ""
        },
        enterFx);
        var options = this.options;
        $$(element).each(function(el, i) {
            var elfx = el;
            if (elementFx) {
                var elms = el.getElementsBySelector(elementFx);
                if (elms.length > 0) {
                    elfx = elms[0];
                }
            }
            var fx = new(Fx.Styles)(elfx, options);
            if (! ($chk(options.ignoreClass) && el.hasClass(options.ignoreClass))) {
                el.addEvent("mouseenter",
                function(e) {
                    fx.setOptions(options, enterFx).start(enter);
                });
                el.addEvent("mouseleave",
                function(e) {
                    fx.setOptions(options, leaveFx).start(leave);
                });
            }
        });
    }
});
YOOMorph.implement(new Options);
var YOOBackgroundFx = new Class({
    initialize: function(options) {
        this.setOptions({
            transition: Fx.Transitions.linear,
            duration: 9000,
            wait: false,
            colors: ["#FFFFFF", "#999999"]
        },
        options);
        var body = new Element(document.body);
        var fx = body.effects(this.options);
        var index = 0;
        var colors = this.options.colors;
        var timer = animate.periodical(this.options.duration * 2);
        animate();
        function animate() {
            fx.start({
                'background-color': colors[index]
            });
            if (index + 1 >= colors.length) {
                index = 0;
            } else {
                index++;
            }
        }
    }
});
YOOBackgroundFx.implement(new Options);
