﻿function external() {
    var popupRE = /external\[(\d+),(\d+)\]/gi;
    var links = $('a[rel^="external"]');
    var rel, width, height;

    links.click(function() {
        rel = $(this).attr('rel');
        if (rel == "external") {
            window.open($(this).attr('href'));
            return false;
        } else if (rel.match(popupRE)) {
            width = RegExp.$1;
            height = RegExp.$2;
            window.open($(this).attr('href'), '', 'width=' + width + ',height=' + height + ',scrollbars=yes');
            return false;
        }
    });
}

$(document).ready(function() {
    external();
    $('a[rel=lightbox]').colorbox({ rel: 'nofollow' });
});
