// Cookie scripts courtesy of WebCoder.com
// http://www.webcoder.com

// Use this function to retrieve a cookie.
function getCookie(name){
    var cname = name + "=";
    var dc = document.cookie;
    if (dc.length > 0) {
        begin = dc.indexOf(cname);
        if (begin != -1) {
            begin += cname.length;
            end = dc.indexOf(";", begin);
            if (end == -1) end = dc.length;
            return unescape(dc.substring(begin, end));
        }
    }
return null;
}

// Use this function to save a cookie.
function setCookie(name, value, expires) {
    document.cookie = name + "=" + escape(value) + "; path=/" +
    ((expires == null) ? "" : "; expires=" + expires.toGMTString());
}

// Use this function to delete a cookie.
function delCookie(name) {
    document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
}


// Color scripts courtesy of JavaScript.com
// http://webdeveloper.earthweb.com

// Background color:
function bgcolor(code){
    document.bgColor=code;
}
// Foreground (text) color:
function fgcolor(code){
    document.fgColor=code;
}
// (Unvisited) link color:
function linkcolor(code){
    document.linkColor=code;
}
// Visited link color:
function vlinkcolor(code){
    document.vlinkColor=code;
}


// Scripts courtesy of Rob van der Woude's Scripting Pages
// http://www.robvanderwoude.com

// Code for color settings
// Save the settings:
function savesettings() {
    var exp = new Date();
    // Set expiration date 365 days ahead
    exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 365));
    setCookie('bgcolor',    document.bgColor,    exp);
    setCookie('fgcolor',    document.fgColor,    exp);
    setCookie('linkcolor',  document.linkColor,  exp);
    setCookie('vlinkcolor', document.vlinkColor, exp);
    return true;
}
// Load previously saved settings:
function loadsettings() {
    var _bgcolor    = getCookie('bgcolor');
    if (_bgcolor    != null) document.bgColor    = _bgcolor;
    var _fgcolor    = getCookie('fgcolor');
    if (_fgcolor    != null) document.fgColor    = _fgcolor;
    var _linkcolor  = getCookie('linkcolor');
    if (_linkcolor  != null) document.linkColor  = _linkcolor;
    var _vlinkcolor = getCookie('vlinkcolor');
    if (_vlinkcolor != null) document.vlinkColor = _vlinkcolor;
    return true;
}
// Delete settings and restore defaults:
function delsettings() {
    delCookie('bgcolor');
    bgcolor('White');
    delCookie('fgcolor');
    fgcolor('#0000a0');
    delCookie('linkcolor');
    linkcolor('#006000');
    delCookie('vlinkcolor');
    vlinkcolor('#ff0000');
}


