﻿K2046.Switcher = function(options) {
    if (!options) {
        return;
    }
    //alert("1");
    options.Delay = options.Delay || 0;
    if (options.Delay > 0) {
        setTimeout(function() {
            options.Delay = 0;
            K2046.Switcher(options);
        }, options.Delay);
        return;
    }
    //alert("2");
    options.Root = options.Root || 0;
    options.Prefix = options.Prefix || "sw";
    options.Css = options.Css || "hover";
    options.Index = options.Index || 0;
    for (var x = options.Root; x >= 0; x++) {
        var me = K2046.$(options.Prefix + "_menu_" + x);
        var cl = K2046.$(options.Prefix + "_child_" + x);
        if (!me || !cl) {
            break; ;
        }
        me.className = "";
        cl.style.display = "none";
    }
    var menu = K2046.$(options.Prefix + "_menu_" + options.Index);
    var child = K2046.$(options.Prefix + "_child_" + options.Index);
    if (menu && child) {
        menu.className = options.Css;
        child.style.display = "";
    }
};