/**
 * Handle external links in a standards compliant way
 *
 */
Ah.ExternalLink = new Class({
    
    _element: null,
    _href: 'http://www.livevalidation.com',
    _target: '_blank',
    
    initialize: function( el, target, href ){
        this._element = $(el);
        this._href = this._element.href || href || this._href;
        this._target = target || this._target;
        function callback(e){ 
            window.open(this._href, this._target);
            e.stop();
        }
        this._element.addEvent('click', callback.bindWithEvent(this) );
    }
    
});

// static function to parse page for external links and set them up for you
Ah.ExternalLink.parseLinks = function( class_to_replace, target ){
    var class_to_replace = class_to_replace || 'external';
    $$('a').each(function(link){
        if( link.hasClass(class_to_replace) || link.rel.test('external')  ) new Ah.ExternalLink( link, target );
    });
}