/*
 * $HeadURL: http://selma.exit10.local/repos/kol-website/trunk/www-bor/js/link-icons.js $
 * $LastChangedRevision: 1155 $
 * $LastChangedDate: 2011-03-08 13:18:40 -0600 (Tue, 08 Mar 2011) $
 * $LastChangedBy: dshifflett $
 */

$(function() {
    document.initializeLinkIcons = function() {
        if(!this.href)
            return;
        
        var iconToUse = false;
        if(this.href.match(/\.pdf$/i))
            iconToUse = 'src="/images/layout/icons/pdf.gif" alt="[PDF]" width="16" height="16"';
        else if(
            this.href.match(/^[^\:]+\:/i) &&
            this.href.split('/').length > 2 &&
            window.location.href.split('/').length > 2 &&
            this.href.split('/')[2].toLowerCase() != window.location.href.split('/')[2].toLowerCase()
        )
            iconToUse = 'src="/images/layout/icons/offsite.gif" alt="[Offsite]" width="12" height="10"';
        
        if(iconToUse) {
            var jqThis = $(this);
            jqThis
                .wrapInner('<span />')
                .append(' <img ' + iconToUse + ' />')
                .addClass('IconLink');
        }
    }
    
    $('#interiorDetail div.CmsMarkup a').each(document.initializeLinkIcons);
});

