function AppServer(url, target) {
    this.url = url;
    this.target = url + target;
    this.status = false;
    this.context = null;
    this.webmaster = "adrian.thomas@hsbcib.com";
    this.privacy = "privacy@javaskills.com";
    this.email = "adrian.thomas@javaskills.com";
    this.register = false;
    this.page = null;
    this.cookie = null;
}

// Resolves local(zen) or remote(jplumbers) URLs
AppServer.prototype.resolveUrl = function(remote, local, redirect) {
    var url = local;
    if (this.status == true) {
        url = (this.url ? this.url : "") + (this.context ? this.context : "") + remote;
    }
    else if (redirect != null) {
        if (this.register == true || this.cookie != null) {
            // allow url
        }
        else {
            // url = redirect; // uncomment for redirect
        }
    }
    return url;
}

// Forward page after registration
AppServer.prototype.forward = function(page) {
    this.page = page;
}

// Cookie function (from cookies.js)
function getCookie(name) {
    var dc = document.cookie;
    var index = dc.indexOf(name + "=");
    if (index == -1) return null;
    index = dc.indexOf("=", index) + 1;
    var endstr = dc.indexOf(";", index);
    if (endstr == -1) endstr = dc.length;
    return unescape(dc.substring(index, endstr));
}