var _POPUP_FEATURES = 'location=0,  statusbar=0,  menubar=0,  width=387,  height=500, scrollbars=1, resizable=no';

// These defaults should be changed the way it best fits your site
//var _POPUP_FEATURES = '';

// Hacked about by RM - don't re-use

function raw_popup(url, name) {
    // pops up a window containing url optionally named target, optionally having features
    features = _POPUP_FEATURES;
    var theWindow = window.open(url, name, features);
    theWindow.focus();
    return theWindow;
}

function link_popup(src, name) {
    // to be used in an html event handler as in: <a href="..." onclick="link_popup(this,...)" ...
    // pops up a window grabbing the url from the event source's href
    return raw_popup(src.getAttribute('href'), src.getAttribute('name'));
}

function event_popup(e) {
    // to be passed as an event listener
    // pops up a window grabbing the url from the event source's href
    link_popup(e.currentTarget);
    e.preventDefault();
}