function Settings(args) {
    var args_def = {
        "p_id" : "",
        "name" : "",
        "email" : "",
        "website" : "",
        "location_id" : "",
        "template" : "",
        "style" : "",
        "color" : "",
        "languge" : "",
        "time_format" : "",
        "temp_u" : "",
        "winds_u" : "",
        "pres_u" : "",
        "prec_u" : "",
        "vis_u" : ""
    };
    if(typeof args == "undefined") {
        args = new Object();
    }
    for(var index in args_def) {
        if(typeof args[index] == "undefined") args[index] = args_def[index];
    }
    
    this.p_id = args["p_id"];
    this.name = args["name"];
    this.email = args["email"];
    this.website = args["website"];
	this.location_id = args["location_id"];
	this.template = args["template"];
    this.style = args["style"];
	this.color = args["color"];
	this.language = args["language"];
	this.time_format = args["time_format"];
	this.temp_u = args["temp_u"];
	this.winds_u = args["winds_u"];
	this.pres_u = args["pres_u"];
	this.prec_u = args["prec_u"];
	this.vis_u = args["vis_u"];
}

Settings.prototype.upd_vars = function() {
    try { this.location_id = $('location_id').value; } catch(err) {}
    try { this.time_format = get_radio("settings", "time_format"); } catch(err) {}
    try { this.language = $('language').value; } catch(err) {}
    try { this.temp_u = get_radio("settings", "temp_u"); } catch(err) {}
    try { this.winds_u = get_radio("settings", "winds_u"); } catch(err) {}
    try { this.temp_u = get_radio("settings", "temp_u"); } catch(err) {}
    try { this.pres_u = get_radio("settings", "pres_u"); } catch(err) {}
    try { this.prec_u = get_radio("settings", "prec_u"); } catch(err) {}
    try { this.vis_u = get_radio("settings", "vis_u"); } catch(err) {}
    try { this.template = $('template').value; } catch(err) {}
    try { this.style = $('style').value; } catch(err) {}
    try { this.color = $('color').value; } catch(err) {}
    try { this.name = $('name').value; } catch(err) {}
    try { this.email = $('email').value; } catch(err) {}
    try { this.website = $('website').value; } catch(err) {}
}

Settings.prototype.save_cookie = function() {
    setCookie("sett[p_id]", this.p_id, 60);
    setCookie("sett[name]", this.name, 60);
    setCookie("sett[email]", this.email, 60);
    setCookie("sett[website]", this.website, 60);
    setCookie("sett[location_id]", this.location_id, 60);
    setCookie("sett[template]", this.template, 60);
    setCookie("sett[style]", this.style, 60);
    setCookie("sett[color]", this.color, 60);
    setCookie("sett[language]", this.language, 60);        
    setCookie("sett[time_format]", this.time_format, 60);
    setCookie("sett[temp_u]", this.temp_u, 60);
    setCookie("sett[winds_u]", this.winds_u, 60);
    setCookie("sett[pres_u]", this.pres_u, 60);
    setCookie("sett[prec_u]", this.prec_u, 60);
    setCookie("sett[vis_u]", this.vis_u, 60);
}

Settings.prototype.load_cookie  = function() {
    try { this.p_id = getCookie("sett[p_id]"); } catch(err) {}
    try { this.name = getCookie("sett[name]"); } catch(err) {}
    try { this.email = getCookie("sett[email]"); } catch(err) {}
    try { this.website = getCookie("sett[website]"); } catch(err) {}
    try { this.location_id = getCookie("sett[location_id]"); } catch(err) {}
    try { this.template = getCookie("sett[template]"); } catch(err) {}
    try { this.style = getCookie("sett[style]"); } catch(err) {}
    try { this.color = getCookie("sett[color]"); } catch(err) {}
    try { this.language = getCookie("sett[language]"); } catch(err) {}
    try { this.time_format = getCookie("sett[time_format]"); } catch(err) {}
    try { this.temp_u = getCookie("sett[temp_u]"); } catch(err) {}
    try { this.winds_u = getCookie("sett[winds_u]"); } catch(err) {}
    try { this.pres_u = getCookie("sett[pres_u]"); } catch(err) {}
    try { this.prec_u = getCookie("sett[prec_u]"); } catch(err) {}
    try { this.vis_u = getCookie("sett[vis_u]"); } catch(err) {}
}

Settings.prototype.delete_cookie = function() {
    try { deleteCookie("sett[p_id]"); } catch(err) {}
    try { deleteCookie("sett[name]"); } catch(err) {}
    try { deleteCookie("sett[email]"); } catch(err) {}
    try { deleteCookie("sett[website]"); } catch(err) {}
    try { deleteCookie("sett[location_id]"); } catch(err) {}
    try { deleteCookie("sett[template]"); } catch(err) {}
    try { deleteCookie("sett[style]"); } catch(err) {}
    try { deleteCookie("sett[color]"); } catch(err) {}
    try { deleteCookie("sett[language]"); } catch(err) {}
    try { deleteCookie("sett[time_format]"); } catch(err) {}
    try { deleteCookie("sett[temp_u]"); } catch(err) {}
    try { deleteCookie("sett[winds_u]"); } catch(err) {}
    try { deleteCookie("sett[pres_u]"); } catch(err) {}
    try { deleteCookie("sett[prec_u]"); } catch(err) {}
    try { deleteCookie("sett[vis_u]"); } catch(err) {}
}