lf.effects = {
    
    version:            1,
    elementArrributes: {},
    
    blindUp: function(element) {
        
        /* set some styles we need for this things */
        var e  = lf.element.get(element);
        lf.element.setStyle(e,'overflow','hidden');
        
        var anim = new YAHOO.util.Anim(element,{
            height: { to: 0 }
        });
        
        anim.onComplete.subscribe(function() {
            lf.element.hide(e);
            lf.element.setStyle(e,'height','');
        });
        
        anim.animate();
    },
    
    blindDown: function(element, onComplete, scope) {
        
        var e           = lf.element.get(element);
        var orgHeight   = lf.element.getHeight(element);
        
        var anim = new YAHOO.util.Anim(element,{
            height: { from: 0, to: orgHeight }
        },0.5);
        
        anim.onComplete.subscribe(function() {
            if(onComplete) {
                onComplete.call(scope);
            }
            lf.element.setStyle(e,'height',orgHeight + 'px');
        });
        
        lf.element.setStyle(e,'overflow','hidden');
        lf.element.setStyle(e,'height','0px');
        lf.element.setStyle(e,'display','block');
        lf.element.setStyle(e,'visiblility','visible');
        
        anim.animate();
    },
    
    scrollWindow: function(to, dur, ease) {
            
            var setAttr = function(a, v, u) {
                window.scroll(0, v);
            };
        
            var anim = new YAHOO.util.Anim(null,
                { 'scroll' : {
                    from : YAHOO.util.Dom.getDocumentScrollTop(),
                    to : to }
                },
                dur, ease
            );
            
            anim.setAttribute = setAttr;
            anim.animate();
    },
    
    scrollWindowToElement: function(element,duration,ease) {
        element = lf.element.get(element);
        var y   = lf.element.getY(element);
        this.scrollWindow(y,duration,ease);
    },

    
    scrollTo: function(element, x, y, duration, onComplete, scope, easing) {
       
        x = x || 0;
        y = y || 0;
        
        var anim = new YAHOO.util.Scroll(element, {
            scroll:{to:[x,y]}
        }, duration, easing);
        
        if(onComplete) {
            if(scope) {
                anim.onComplete.subscribe(onComplete,scope,true);
            } else {
                anim.onComplete.subscribe(onComplete);
            }
        }
        
        anim.animate();
    },
    
    animation: function(element, attributes, onComplete, scope, duration, easing) {
        
        var elements = [];
        if(lf.isArray(element)) {
            elements = element;
        } else {
            elements.push(element);
        }
        
        var animation = false;
        
        for(var c=0;c<elements.length;c++) {
            animation = new YAHOO.util.Anim(elements[c],attributes, duration, easing);
            if(onComplete) {
                animation.onComplete.subscribe(onComplete,scope,true);
            }
            animation.animate();
        }
        
        return animation;
    },
    
    fadeIn: function(elements, args, onComplete, scope) {
        
        args =lf.defaultObjectProperties(args, {
            to:         1,
            from:       parseFloat(lf.element.getStyle(elements,'opacity')) || 0,
            duration:  0.5
        });
        
        lf.element.setStyle(elements,'opacity',args.from);
        lf.element.setStyle(elements,'display','block');
        
        var anim = lf.effects.animation(elements,{
            'opacity': {
                from:   args.from,
                to:     args.to
            }
        }, onComplete, scope, args.duration);
        
        /*
        if(args.from === 0) {
            lf.element.show(elements);
        }*/
        
        return anim;
    },
    
    fadeOut: function(element, args, onComplete, scope) {
        
        args = lf.defaultObjectProperties(args, {
            from:     parseFloat(lf.element.getStyle(element,'opacity')) || 1,
            to:       0,
            duration: 0.5
        });
        
        return this.animation(element,{
            'opacity': {
                from:   args.from,
                to:     args.to
            }
        },function(r) {
            
            if(args.to === 0) {
                lf.element.hide(element);
            }
            
            if(onComplete && scope) {
                onComplete.call(scope,args);
            } else if(onComplete) {
                onComplete(args);
            }
            
        },this, args.duration);
    },
    
    motion: function(element, attributes, duration, easing) {
        var elements = [];
        
        if(lf.isArray(element)) {
            elements = element;
        } else {
            elements.push(element);
        }
        
        for(var c=0;c<elements.length;c++) {
            var animation = new YAHOO.util.Motion(elements[c],attributes, duration, easing);
            animation.animate();
        }
        
        return animation;
    },
    
    easeOut: function() {
        return YAHOO.util.Easing.bounceOut;
    }
};