﻿addCount(); //count it

function GetNewsID(url)
{
   var reg = /http:\/\/(?:.+)\d\/(.+)\.shtml/gi;
   return url.replace(reg,"$1");
}
function addCount(){
    //创建XMLHttpRequest对象
    var xmlhttp
    try{
        xmlhttp = new XMLHttpRequest();
    }catch(e){
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    //创建请求结果处理程序
    xmlhttp.onreadystatechange = function(){
        if(4 == xmlhttp.readyState){
            if(200 == xmlhttp.status){
                //success
            }else{
                //error
            }
        }
    }
    if(typeof(newsid)=='undefined')
	    xmlhttp.open("post","/CGI/NewsCounter.aspx?Nid="+GetNewsID(location.href),true);
    else xmlhttp.open("post","/CGI/NewsCounter.aspx?Nid="+newsid,true);
    xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    xmlhttp.send(null);
}