function a_popup() {
    var a_element=null;
    var a_width=null;
    var a_height=null;
    var a_windowStyle=null;
    var a_customText=null;

    switch (a_popup.arguments.length) {
        case 5:
            a_customText = a_popup.arguments[4];
        case 4:
            a_windowStyle = a_popup.arguments[3];
        case 3:
            a_height = a_popup.arguments[2];
        case 2:
            a_width = a_popup.arguments[1];
        case 1:
            a_element = a_popup.arguments[0];
        default:
    }

    var aTarget = a_element.target;

    if (aTarget==null || aTarget=="") {
        aTarget = "pop";
    }

    /* Because we can't do real design work - only kludge things up */
    if (a_element.href!=null && a_element.href.match(/\/(fs|dar|floor_selector)\.asp/)) {
        aTarget = "eieio";
    }

    if (a_windowStyle==null) {
        a_windowStyle = "titlebar,scrollbars=yes,resizable=yes";
    }

    if (a_width==null || a_width <=0) {
        a_width=400;
    }
    if (a_height==null || a_height <=0) {
        a_height=400;
    }

    a_windowStyle+= (",left="+((screen.availWidth - a_width) / 2));
    a_windowStyle+= (",width="+a_width);

    a_windowStyle+= (",top="+(((screen.availHeight - a_height) / 2 ) - 30));
    a_windowStyle+= (",height="+a_height);



    var w;
    if (a_customText!=null) {
        w = window.open('', aTarget, a_windowStyle);
        try {
            w.document.close();
            w.document.open();
            w.document.writeln(a_customText);
            try {
                w.document.close();
            } catch(e){}
        } catch(e){}
    } else {
        w = window.open(a_element.href, aTarget, a_windowStyle);
    }
    w.focus();

    return false;
}


/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, path, expires, domain, secure) {
  document.cookie = name + "=" + escape(value) +
                    ((expires) ? "; expires=" + expires.toGMTString() : "") +
                    ((path) ? "; path=" + path : "") +
                    ((domain) ? "; domain=" + domain : "") +
                    ((secure) ? "; secure" : "");
}

/**
 * Gets the value of the specified cookie.
 * Returns null if cookie does not exist.
 */
function getCookie(name) {
  try {
    var cookies = document.cookie;
    var index = cookies.indexOf(name + "=");
    if (index == -1) return null;
    index = cookies.indexOf("=", index) + 1;
    var endstr = cookies.indexOf(";", index);
    if (endstr == -1) endstr = cookies.length;
    return unescape(cookies.substring(index, endstr));
  } catch(e) {
  }
  return null;
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 */
function deleteCookie(name, path) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
                      ((path) ? "; path=" + path : "") +
                      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

