function SetLeftMenuCurrentItems(pageIDAry) {

    if (pageIDAry) {
        var len = pageIDAry.length;
        for (var i = 0; i < len; ++i) {
            $("#leftMenu_" + pageIDAry[i]).css("display", "");
            $("#leftMenu_" + pageIDAry[i]).addClass("current");
        }
    }
}

function HideAllColor() {
    if (childPageIDAry) {
        var len = childPageIDAry.length;
        for (var i = 0; i < len; ++i) {
            id = childPageIDAry[i];
            $("#colorName_" + id).css("display", "none");
            $("#colorText_" + id).css("display", "none");
            $("#sampleImage_" + id).fadeOut();
        }
    }
}
function SelectColor(id) {
	if($("#colorName_" + id).css("display")=="none")
	{
		HideAllColor();
		$("#colorName_" + id).css("display", "");
		$("#colorText_" + id).css("display", "");
		$("#sampleImage_" + id).fadeIn();
	}
}

function SetLeftMenuCurrentItemsNoColor(pageIDAry) {

    if (pageIDAry) {
        var len = pageIDAry.length;
        for (var i = 0; i < len; ++i) {
            $("#leftMenu_" + pageIDAry[i]).css("display", "");
        }
    }
}


function InitCommonLeftMenu(currentID) {
    var root = null;
    var target = $("#leftMenuItem_" + currentID);
    var group = $("#leftMenuGroup_" + currentID);
    var hasChild = ($("#leftMenuGroup_" + currentID).length > 0);

    if (hasChild) {
        root = target.parent().parent();
        root.find("> ul > li").show();
        group.find(" > ul > li ").show();

    }
    else {
        root = target.parent().parent().parent().parent();
        root.find("> ul > li").show();
        target.parent().find("> li").show();
    }

    target.addClass("current");
	//Bold Header
    root.find("> ul > li").each(function() {
        var split_ = $(this).attr("id").split("_", 2);
        var type = split_[0].split("leftMenu", 2);
        if (type[1] == "Item") {
            var title = "<b>" + $(this).find("a").html() + "</b>";
            $(this).find("a").html(title);
        }
    });
    root.show();

    var tmpContainer = $("<div/>");
    tmpContainer.append(root);

    $("ul.leftMenuRoot").html("");
    $("ul.leftMenuRoot").append(root);
}

function InitMuseummLeftMenu(type, currentID) {

    var root = null;
    var group = null;
    var target = $("#leftMenuItem_" + currentID);

    var museumRoot = null;

    if (type == "LISTING") {
        root = target.parent().parent();
        museumRoot = target;
        museumRoot.addClass("current");
    }
    else if (type == "DETAIL") {
        root = target.parent().parent().parent().parent();
        museumRoot = target.parent().parent().prev();
        target.addClass("current");
		target.show();
    }
    else if (type == "ITEM") {
        root = target.parent().parent().parent().parent().parent().parent();
        museumRoot = target.parent().parent().parent().parent().prev();
        var parent = target.parent().parent().prev();
        parent.addClass("current");
		parent.show();
    }
	
   //Bold Header
    root.find("> ul > li").each(function() {
        var split_ = $(this).attr("id").split("_", 2);
        var type = split_[0].split("leftMenu", 2);
        if (type[1] == "Item") {
            var title = "<b>" + $(this).find("a").html() + "</b>";
            $(this).find("a").html(title);
        }
    });
    root.show();
    root.find("> ul > li").show();

    group = museumRoot.next();
    group.show();
    group.find("> ul > li").show();

    var tmpContainer = $("<div/>");
    tmpContainer.append(root);

    $("ul.leftMenuRoot").html("");
    $("ul.leftMenuRoot").append(root);

}


function InitSeriesLeftMenu(currentID ,isParent) {

    var root = null;
    var parent = null;
    var target = $("#leftMenuItem_" + currentID);

    if (isParent) {
        root = $("#leftMenuGroup_" + currentID);
    }
    else {
        root = target.parent().parent();
    }

    root.show();
    root.find("> ul > li").show();

    root.find("> ul > li").each(function () {
        var split_ = $(this).attr("id").split("_", 2);
        var type = split_[0].split("leftMenu", 2);
        if (type[1] == "Item") {
            var title = "<b>" + $(this).find("a").html() + "</b>";
            $(this).find("a").html(title);
        }
    });

    var tmpContainer = $("<div/>");
    tmpContainer.append(root);

    $("ul.leftMenuRoot").html("");
    $("ul.leftMenuRoot").append(root);

    target.addClass("current");

}
