    var xmlrequest;
    var _Page;
    var _PageTimer;
    
    _Page = 1;

    function beginRollPage(){
        
        _PageTimer = setInterval( 'AutoJump()', 15000);
        
    }
    
    function stopRollPage(){
        
        clearInterval( _PageTimer);
        
    }

    function AutoJump(){
    
        _Page ++;
        
        JumpPage( _Page);    
        
    }

    function JumpPage( page){
        
        getChartList( page);
        
    }
    
    function getChartList( page){

        var url;
    
        url = './xml/xml_article_chart_list.asp?jump=' + page;

        if( window.XMLHttpRequest) xmlrequest = new XMLHttpRequest();
        else if( window.ActiveXObject) xmlrequest = new ActiveXObject('Microsoft.XMLHTTP');
        
        xmlrequest.open( 'GET', url, false);
              
        if( navigator.appName == 'Netscape'){

            xmlrequest.send( null);
            setChartList();
        
        }
        
        else{

            xmlrequest.onreadystatechange = setChartList;
            xmlrequest.send( null);
            
        }        
        
    }

    function setChartList(){
        
        var i, j;
        var total;
        var currentpage, totalpages;
        var xmlroot, xmlsingle;
        var serialno, subject, brief, thumb, url;
        var content;

        if( xmlrequest.readyState == 4 && xmlrequest.status == 200){ 

            xmlroot = xmlrequest.responseXML.documentElement;

            if( xmlroot.selectSingleNode('./result/totalpages').firstChild.nodeValue != null) totalpages = parseInt( xmlroot.selectSingleNode('./result/totalpages').firstChild.nodeValue);
            if( xmlroot.selectSingleNode('./result/currentpage').firstChild.nodeValue != null) currentpage = parseInt( xmlroot.selectSingleNode('./result/currentpage').firstChild.nodeValue);

            _Page = currentpage;

            total = parseInt( xmlroot.selectNodes('./result/single').length);

            if( total > 0){

                content = '<table width="528" border="0" cellpadding="0" cellspacing="0">';
                content += ' <tr>';
                content += '  <td width="25" align="center" valign="top">';
                
                if( currentpage != 1) content += '   <div style="width:22px;height:23px;"></div><a href="javascript: JumpPage(' + ( currentpage - 1) + ');" onmouseout="ImageRestore();" onmouseover="ImageOver( \'prev-page\', \'./images/arrow_left_over.png\');"><img src="./images/arrow_left.png" width="15" height="150" border="0" id="prev-page" alt="上一頁"></a>';
                
                else content += '   <div style="width:22px;height:23px;"></div><img src="./images/arrow_left_over.png" width="15" height="150">';
                                            
                content +='  </td>';

                j = 0;

                for( i = 0; i < total; i ++){
                    
                    j ++;
                    
                    serialno = xmlroot.selectNodes('./result/single/serialno')[i].firstChild.nodeValue;
                    subject = xmlroot.selectNodes('./result/single/subject')[i].firstChild.nodeValue;
                    brief = xmlroot.selectNodes('./result/single/brief')[i].firstChild.nodeValue;
                    thumb = xmlroot.selectNodes('./result/single/thumb')[i].firstChild.nodeValue;
                    
                    url = 'article_view.asp?sn=' + serialno;

                    content +='  <td width="230" align="center" valign="top">';
                    content +='   <table width="230" cellpadding="0" cellspacing="0" border="0">';
                    content +='    <tr><td width="230" height="22" valign="top" class="black_12x_b"><div style="width:230px;height:16px;overflow:hidden" title="' + subject + '"><a href="' + url + '" class="blue_lnk">' + subject + '</a></td></tr>';
                    content +='    <tr><td width="230" height="155" valign="top"><a href="' + url + '"><img src="' + thumb + '" width="228" height="150" class="pt"></a></td></tr>';
                    content +='    <tr><td width="230" class="black_11x"><div style="width:230px;height:50px;overflow:hidden">' + brief + '</div></td></tr>';
                    content +='    <tr><td width="230" height="22" align="right" class="black_12x"><a href="' + url + '" class="black_lnk">詳全文</a> <img src="./images/arrow_blue.gif" width="11" height="11"></td></tr>';
                    content +='   </table>';
                    content +='  </td>';
                    
                    if( j == 1) content += '  <td width="18" background="./images/line_gray.gif"></td>';                   
                    
                    if( j == 2) j = 0;
                    
                } 
 
                if( j == 1) content += '  <td width="230" align="center" valign="top"></td>';

                content += '  <td width="25" align="center" valign="top">';  
        
                if( currentpage != totalpages) content += '   <div style="width:22px;height:23px;"></div><a href="javascript: JumpPage(' + ( currentpage + 1) + ');" onmouseout="ImageRestore();" onmouseover="ImageOver( \'next-page\', \'./images/arrow_right_over.png\');"><img src="./images/arrow_right.png" width="15" height="150" border="0" id="next-page" alt="下一頁"></a>';
                
                else content += '   <div style="width:22px;height:23px;"></div><img src="./images/arrow_right_over.png" width="15" height="150">';
                
                if( currentpage == totalpages) _Page = 0;

                content += '  </td>';
                content += ' </tr>';
                content += '</table>';

                document.getElementById('ArticleChart').innerHTML = content;
                
            }

        }    
        
    }

