﻿    var xmlHttp;
    var key;
    var id;
    var inID=1;     

    function pageloading()
        {

        }
        
        
        
    function execute()
        {
            var nowurl = location.toString().split(".");
            var nowurls = nowurl[2].toString().split("-")[1];
            id = nowurls;
            //document.write(id);
            request();
            
        }
        
        
    function request()
    {
        if (inID == 1) {
            requrl("/AjaxResponse.aspx?cmd=return_View_ViewNumber&id=" + id);
            requrl("/AjaxResponse.aspx?cmd=addcount&id=" + id);
        }
        else if (inID == 2)
        { requrl("/AjaxResponse.aspx?cmd=return_view_comment&id=" + id); }
    }
    
    
    
    function requrl(openurl)
        { 
            var url=openurl;
            createXML();
            xmlHttp.onreadystatechange = handleStateChange;
            xmlHttp.open("get",url,true);
            xmlHttp.send(null);
        }
    
    
    
    function handleStateChange()
        {
            if (xmlHttp.readyState == 4 )
                {
                    if (xmlHttp.status == 200)
                        {
                            var responseXML=xmlHttp.responseText;
                            
                            if (inID==1)
                            {
                                try
                                {
                                    document.getElementById("View_ViewNumber").innerHTML = responseXML;
                                }
                                catch(e)
                                 {
                                    //有错误，例如无控件
                                 }    
                            }
                            
                            else if (inID==2)
                            {
                                try
                                {
                                     document.getElementById("View_Comment").innerHTML=responseXML;
                                }
                                catch(e)
                                 {
                                    //有错误，例如无控件
                                 }    
                            }
                         
                            if (inID < 2 ) 
                            {
                             
                                inID+=1;
                                request()
                            }

                        }
                }
       }

    
    
    function createXML() {
        if (window.ActiveXObject) {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        else
            {
                xmlHttp=new XMLHttpRequest();
            }
        }
        
        
    //容错代码            
    function killErrors() {
    return true;
    }

    window.onerror = killErrors;


