﻿function loadcss(rootpath) {
    var css = getcookie("usercss");
    if (css != "") {
        applycss(css, rootpath);
    }
    else {
        css = "brown_1";
        applycss(css, rootpath);
    }
}
function setcss(css, rootpath) {
    setcookie("usercss", css);
    var styledivid = 'style_default';
    if (checkObj(styledivid)) {
        document.getElementById(styledivid).className = 'stylebox_default';
    }
    styledivid = 'style_red_1';
    if (checkObj(styledivid)) {
        document.getElementById(styledivid).className = 'stylebox_red_1';
    }
    styledivid = 'style_blue_1';
    if (checkObj(styledivid)) {
        document.getElementById(styledivid).className = 'stylebox_blue_1';
    }
    styledivid = 'style_brown_1';
    if (checkObj(styledivid)) {
        document.getElementById(styledivid).className = 'stylebox_brown_1';
    }
    styledivid = 'style_purple_1';
    if (checkObj(styledivid)) {
        document.getElementById(styledivid).className = 'stylebox_purple_1';
    }
    
    document.getElementById('style_' + css).className = 'stylebox_' + css + ' stylebox_border';

    loadcss(rootpath);
}
function applycss(css, rootpath) {
    var lcid = "lc1";
    if (checkObj(lcid)) {
        document.getElementById(lcid).href = rootpath + '/skins/' + css + '/common.css';
    }
    lcid = "lc2";
    if (checkObj(lcid)) {
        document.getElementById(lcid).href = rootpath + '/skins/' + css + '/default.css';
    }
    lcid = "lc3";
    if (checkObj(lcid)) {
        document.getElementById(lcid).href = rootpath + '/skins/' + css + '/board.css';
    }
    lcid = "lc4";
    if (checkObj(lcid)) {
        document.getElementById(lcid).href = rootpath + '/skins/' + css + '/topic.css';
    }
    lcid = "lc5";
    if (checkObj(lcid)) {
        document.getElementById(lcid).href = rootpath + '/skins/' + css + '/user.css';
    }
    lcid = "lc6";
    if (checkObj(lcid)) {
        document.getElementById(lcid).href = rootpath + '/skins/' + css + '/post.css';
    }
    lcid = "lc7";
    if (checkObj(lcid)) {
        document.getElementById(lcid).href = rootpath + '/skins/' + css + '/misc.css';
    }
}