/**
 * Pro Wrestling EVE jQuery functions
 *
 * @author Martin Bean <martin@mcbwebdesign.co.uk>
 */
$(document).ready(function() {
    externalLinks('a[rel=external]');
    initLightbox('a[rel=lightbox]');
    popupWindow('a[rel=popup]');
});

function externalLinks(elm) {
    $(elm).each(function() {
        // append ' (opens in a new window)' to <a> title
        $(this).click(function() {
            window.open(this.href);
            return false;
        });
    });
};

function initLightbox(elm) {
    var images_dir = 'tpl/eve/assets/images/lightbox/';
    $(elm).lightBox({
        imageLoading:images_dir + 'lightbox-ico-loading.gif',
        imageBtnPrev:images_dir + 'lightbox-btn-prev.gif',
        imageBtnNext:images_dir + 'lightbox-btn-next.gif',
        imageBtnClose:images_dir + 'lightbox-btn-close.gif',
        imageBlank:images_dir + 'lightbox-blank.gif'
    });
};

function popupWindow(elm) {
    $(elm).click(function() {
        window.open(this.href, null, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=450,height=450,left=100,top=100');
        return false;
    });
};