﻿// JScript 文件
var xmlHttp;
var vId;
///NewsMode的配置等等
function fun(flag,last_replayer,showMoreInf,showLenth,imageShow,selectIco,ico,img,Catalog_id,item,value,id)
{   
    if(item.style.color=="red")
        return;
    AjaxFun(showMoreInf,showLenth,imageShow,flag,last_replayer,value,id,img); 
    for(var i=0;i<item.parentNode.cells.length;i++)
    {
        if( item.parentNode.cells[i]==item)
           continue;
        item.parentNode.cells[i].background=ico;//"<%= Ico%>";
//        item.parentNode.cells[i].style.color="white";
        //item.parentNode.cells[i].style.fontSize="14px";
        //item.parentNode.cells[i].style.fontWeight="normal";
    }       
     item.background=selectIco;//"<%=SelectIco %>";   
     item.style.color="red";
     //item.style.fontSize="14px";
     //item.style.fontWeight="normal";
  //   alert(document.getElementById(id).id+1);
  ////////////////////////////////////////////////////////////////////////////////////////
     document.getElementById((document.getElementById(id).id+1)).href="more.aspx?id="+Catalog_id+"&selectItem="+item.innerText;
}

function AjaxFun(showMoreInf,showLenth,imageShow,flag,last_replayer,value,id,img)
{
    vId = id;
    createXMLHTTP();//创建XMLHttpRequest对象
    var url="tmpAjax.aspx";
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    xmlHttp.onreadystatechange=checkUserName;
    xmlHttp.send("value="+value+"&vid="+id+"&showMoreInf="+showMoreInf+"&showTime="+flag+"&imageShow="+imageShow+"&img="+img+"&last_replayer="+last_replayer+"&showLenth="+showLenth);
}

function checkUserName()
{
    if(xmlHttp.readyState==1)//判断对象状态
    {
        document.getElementById(vId).innerText="Loading...";
    }
    if(xmlHttp.readyState==4)//判断对象状态
    {
        if(xmlHttp.status==200)//信息成功返回，开始处理信息
        {
     //   document.write(xmlHttp.responseText);
           document.getElementById(vId).outerHTML=xmlHttp.responseText;
          // alert(xmlHttp.responseText);
           //alert("感谢您的参与!!!");
        }
    }
}

function createXMLHTTP()
{
    if(window.XMLHttpRequest)
    {
        xmlHttp=new XMLHttpRequest();//mozilla浏览器
    }
    else if(window.ActiveXObject)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");//IE老版本
        }
        catch(e)
        {}
        try
        {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");//IE新版本
        }
        catch(e)
        {}
        if(!xmlHttp)
        {
            window.alert("不能创建XMLHttpRequest对象实例！");
            return false;
        }
    }
}