﻿function GetCountHttp() {
    var xhttp = null;
    if (window.XMLHttpRequest) {
        xhttp = new XMLHttpRequest();
    }
    else {
        if (window.ActiveXObject) {
            try {
                xhttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e) {
            }
            if (xhttp == null) {
                try {
                    xhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e) {
                }
            }
        }
    }
    return xhttp;
}

function GetCount(ArtID, DivID) {
    var xhttp = GetCountHttp();

    xhttp.open("GET", "/xn/article/art_count.aspx?id=" + ArtID.toString(), false);

    xhttp.send(null);

    var article_count = xhttp.responseText;
    xhttp.abort();
    xhttp = null;

    document.getElementById(DivID).innerHTML = article_count;
}

function AutoSize(CN,MaxW)
{
	var img_items = document.getElementsByTagName("img")   
    if (img_items) 
	{   
        for (var i=0; i<img_items.length; ++i) 
		{   
            var s_width = img_items[i].width;
            if (s_width > MaxW) {   
                 img_items[i].style.width = MaxW + "px";    
                 img_items[i].onclick = function() {window.open(this.src)};   
                 img_items[i].style.cursor = "pointer";   
                 img_items[i].title = "点击查看原始尺寸";   
             }   
         }   
     }   
}
