jQuery(document).ready(function()
{
    var current_domain = window.location.href;
    var regexp = new RegExp(current_domain, 'i');
    
    jQuery('a[href^="http://"]').each(function(i)
    {
        var href = jQuery(this).attr('href');
        
        if (   href.match(regexp)
            || href.match(/sokuto\.(fi|org)/))
        {
            return;
        }
        
        jQuery(this)
            .attr('target', '_blank')
            .addClass('external-link');
        
        if (   !jQuery(this).attr('title')
            && (regs = href.match(/^http:\/\/([^\/]+)/)))
        {
            jQuery(this).attr('title', regs[1] + ' »');
        }
    });
    
    jQuery('#content a img').each(function(i)
    {
        jQuery(this).parent().addClass('image');
    });
    
    jQuery('#content ul.images').each(function()
    {
        jQuery(this).find('li a').lightBox();
    });
});