﻿    var oldOnload = window.onload;
    
    var arr = [
        ["关于我","About","Operate.aspx?action=RightBar&item=About"],
        ["座右铭","Maxim","Operate.aspx?action=RightBar&item=Maxim"],
        ["精华文章","BestArticle","Operate.aspx?action=RightBar&item=BestArticle"],
        ["日志分类","BlogSort","Operate.aspx?action=RightBar&item=BlogSort"],
        ["最新评论","NewComment","Operate.aspx?action=RightBar&item=NewComment"],
        ["友情链接","Link","Operate.aspx?action=RightBar&item=Link"],
        ["本站其它","Other","Operate.aspx?action=RightBar&item=Other"]
      ];
    if (typeof(oldOnload) != 'function') {
        window.onload = loadRightBar;
    }
    else {
        window.onload = function() {
            oldOnload();
            loadRightBar();
        }
    }

    function loadRightBar() {
		showCalendar(0);
	    loadXml("Operate.aspx?action=RightBar&item=MusicPlayer", null, $("MusicPlayer"), true);
	    for (var i=0; i<arr.length; i++) {
	        loadXml(arr[i][2], null, $(arr[i][1]), true);
	    }
    }
    
    function changeSize(self) {
        var node = self.parentNode.parentNode.nextSibling;
        if (node.style.display == "none") {
            node.style.display = "";
            self.src = "images/min.gif";
            self.alt = "折叠";
        }
        else {
            node.style.display = "none";
            self.src = "images/max.gif"; 
            self.alt = "展开";
        }   
    }
    
    function writeTable(title,name) {
        var tableStr = '<table class="dragTable" cellspacing="5" cellpadding="0">'
	    + '            <tr>'
	    + '                <td width="90%" class="ListTitle">' + title + '</td>'
	    + '                <td width="10%"><img src="images/min.gif" alt="折叠" style="width: 12px; height: 12px; cursor: hand;" onClick="changeSize(this);" /></td>'
	    + '            </tr><tr>'
		+ '                <td id="' + name + '" colspan="2" class="ListContent">数据加载中...</td>'
        + '            </tr>'
        + '        </table>';
	    document.write(tableStr);
    }
    
    function outputList() {
        for (var i=0; i<arr.length; i++) {
            writeTable(arr[i][0], arr[i][1]);
        }
    }