﻿
function OnImgLoadErr(objimg)
{
    var img = objimg;
    var oldImgUrl = img.src;
    img.src = "http://static.sz5.cn/global/images/imgloaderr.gif";
    img.style.cursor = "hand";
    img.attachEvent('onclick',OpenImgClick);
    img.alt = oldImgUrl;
    img.title = "此网站图片防盗链，请点击打开网站原图.\n源地址:" + oldImgUrl;
}


function OpenImgClick()
{
    var img = window.event.srcElement ;
    if(typeof(img)!="object")
    {
        //alert("typeof(img) = " + typeof(img));
        return;
    }
    
    var openWin = window.open(img.alt);
    if(typeof(openWin)=="undefined"||openWin==null)
    {
        window.location.href = img.alt;
    }
}

function doZoom(fontsize)
{
    var ConDiv = Ob("zoom");
    //alert("typeof(ConDiv) = " + typeof(ConDiv));
    if(typeof(ConDiv)!="undefined")
    {
            ConDiv.style.fontSize = fontsize + "px";
    }
}

/*
/ViewStat.aspx?InfoID={0}^ModuleType={1}^StatContentType={2}^UpdateViewStatField={3}^ViewStatAction={4}
-----ModuleType-----
flea = 4
fenlei = 9
news = 13
-----StatContentType-----
fleainfo=1
newsinfo=2
company=3
-----UpdateViewStatField-----
Clicks = 1, Views = 2, Comments = 3
-----ViewStatAction-----
View=1,Update=2    
*/

function ShowContactView(id,divid)
{
    Ob(HideContactDiv).className = "show";
    Ob(SelfLinkDiv).className = "hide";
    Ob("ViewsSpan").innerHTML = parseInt(Ob("ViewsSpan").innerHTML) + 1;
    
    var ajaxGetView = "http://news.sz5.cn/app/ajaxstat.aspx?p=" + id + "_13_1_2_2"; //更新浏览次数
    //window.open(ajaxGetView);
    var VS = Ob("ViewsSpan");
    var d = document.createElement("DIV");
    var htmlstr = "<iframe style='display:none;' src='"+ ajaxGetView +"'></iframe>";
    d.innerHTML = htmlstr ;
    document.appendChild(d);
}

function SetViewStatSpan(val,field)
{
    if(field=="Clicks")
    {
        Ob("ClickSpan").innerHTML = val ;
    }
    if(field=="Views")
    {
        Ob("ViewsSpan").innerHTML = val ;
    }
}

function allReply(newsID)
{
    alert("暂时未开通评论！");
}