﻿// JScript 文件
 
 var xmlHttp;    
        function createXMLHttpRequest()
        {
           if(window.ActiveXObject)
            {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            else if(window.XMLHttpRequest)
            {
                xmlHttp = new XMLHttpRequest();
            }
        }
      
        pageOpen = new Date();
    function GetResidentTime() {
     
        var localurl=location.href;
      // alert("aaaaaaaaaaaa");
      if(localurl.indexOf("ggid=")>=0)
       {
        var local =localurl.substr(localurl.indexOf("ggid=")+5,localurl.length-localurl.indexOf("ggid=")); 
        var ggid=local;  
        pageClose = new Date();
      
        time =( pageClose.getTime() - pageOpen.getTime())/1000;
        
      //  alert(time+" time "+Math.round(time));
        
            createXMLHttpRequest();
            var url = "/js/AddGuanggao.ashx?timesapn="+time+"&ggid="+ggid;
            xmlHttp.open("GET",url,true);
            xmlHttp.onreadystatechange = showResult;
            xmlHttp.send(null);
         }
    }
    
    function showResult()
    { 
   
            if(xmlHttp.readyState==4)
            {
          
                if(xmlHttp.status==200)
                {
                  
                }
            } 
    }
   //window.onbeforeunload = GetResidentTime;
 
    window.onunload=GetResidentTime;