
ark.widget.Highlighter = function() {

    return {
        highlight: function(target) {
            if( typeof target == 'string' ) {
                var elt = YAHOO.util.Dom.get(target);
            } else {
                var elt = target;
            }
            if( elt ) {
                ark.widget.Highlighter._fade_in(elt);
           }
        },
        _fade_in: function(elt) {
            // SAVE THE ORIGINAL ONE
            var bg = YAHOO.util.Dom.getStyle(elt,'background-color');
            var attributes = {
            backgroundColor: { from: 'rgb(255,255,255)', to: 'rgb(255,255,0)' }
            };
            var anim = new YAHOO.util.ColorAnim(elt,attributes,0.6);
            var cb = function() {
                var cb2 = function() {
                    ark.widget.Highlighter._fade_out(elt,bg);
                };
                setTimeout(cb2,2000);
            };
            anim.onComplete.subscribe(cb);
            anim.animate();
        },
        _fade_out: function(elt,bg) {
            var attributes = {
            backgroundColor: { from: 'rgb(255,255,0)', to: 'rgb(255,255,255)' }
            };
            var anim = new YAHOO.util.ColorAnim(elt,attributes,1);
            var cb = function() {
                YAHOO.util.Dom.setStyle(elt,'background-color',bg);
            }
            anim.onComplete.subscribe(cb);
            anim.animate();
        }
    }
} ();

