// JavaScript Document
var _CALC_FEATURES = 'toolbar=0,scrollbars=0,resizable=1,statusbar=0,menubar=0,width=560,height=230';
var _CALC_URL = 'http://calc.customhouse.com/ratecalc/ratecalc.aspx?pid=1&amp;curr=USD';
var _MAP_FEATURES = 'toolbar=0,scrollbars=1,resizable=1,statusbar=1,menubar=0,width=640,height=480';
var _VIDEO_FEATURES = 'toolbar=0,scrollbars=1,resizable=1,statusbar=1,menubar=0,width=340,height=260';
var _WVP_FEATURES = 'toolbar=0,scrollbars=1,resizable=1,statusbar=1,menubar=0,width=615,height=640';
//toolbar=no, scrollbars=no,resizable=yes,width=390,height=445

function raw_popup(url, target, features) {
    // pops up a window containing url optionally named target, optionally having features
    if (isUndefined(url)) url = src.getAttribute('href');
    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) {
    // 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('target') || '_blank', features);
}

function map_popup(src) {
    return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', _MAP_FEATURES);
}

function calc_popup() {
    return raw_popup(_CALC_URL, '_blank', _CALC_FEATURES);
}

function video_popup(src) {
    return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', _VIDEO_FEATURES);
}

function wvp_popup(src) {
    return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', _WVP_FEATURES);
}
