var _POPUP_FEATURES = '';

function raw_popup(url, target, features) {
    if (isUndefined(features)) features = _POPUP_FEATURES;
    if (isUndefined(target  )) target   = '_blank';
    var theWindow = window.open(url, target, features);
    theWindow.focus();
    return theWindow;
}

function link_popup(src, features) {
    return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', features);
}

function event_popup(e) {
    link_popup(e.currentTarget);
    e.preventDefault();
}

function isUndefined(v) {
    var undef;
    return v===undef;
}
function event_popup_features(features) {
    return function(e) { link_popup(e.currentTarget, features); e.preventDefault() }
}

var _POPUP_REBRAND = '';

function raw_popup_rebrand(url, target, features) {
    if (isUndefined(features)) features = _POPUP_REBRAND;
    if (isUndefined(target  )) target   = '_blank';
    var theWindow = window.open(url, target, features);
    theWindow.focus();
    return theWindow;
}

function link_popup_rebrand(src, features) {
    return raw_popup_rebrand(src.getAttribute('href'), src.getAttribute('target') || '_blank', features);
}

function event_popup(e) {
    link_popup_rebrand(e.currentTarget);
    e.preventDefault();
}

function event_popup_features(features) {
    return function(e) { link_popup_rebrand(e.currentTarget, features); e.preventDefault() }
}

var _POPUP_CLAUSES = '';

function raw_popup_clauses(url, target, clauses) {
    if (isUndefined(clauses)) clauses = _POPUP_CLAUSES;
    if (isUndefined(target  )) target   = '_blank';
    var theWindow = window.open(url, target, clauses);
    theWindow.focus();
    return theWindow;
}

function link_popup_clauses(src, clauses) {
    return raw_popup_clauses(src.getAttribute('href'), src.getAttribute('target') || '_blank', clauses);
}

function event_popup(e) {
    link_popup_clauses(e.currentTarget);
    e.preventDefault();
}

function event_popup_clauses(clauses) {
    return function(e) { link_popup_clauses(e.currentTarget, clauses); e.preventDefault() }
}