﻿//前台管理左栏导航伸缩效果

 var showId1="";
 var type1,idiv1,id1;



function divshow1(div)
{
    
    id1=div.id+"1";
    
    if(showId1!=""&&showId1!=id1)
    {
        idiv1=document.getElementById(showId1);
        idiv1.style.display="none";
        idiv1=document.getElementById(showId1.substring(0,showId1.length-1));
    }

    idiv1=document.getElementById(id1);
    
    type1=idiv1.style.display;
    
    type1=="none" ? type1="" : type1="none";

    idiv1.style.display=type1; 
    
    showId1=id1;  
}

function show1(div)
{
    divshow1(div);
} 


//获得章节内容

function CallBackObject()
{
    this.XmlHttp=this.GetHttpObject();
}

CallBackObject.prototype.GetHttpObject=function()
{
    var xmlHttp;
    if(window.XMLHttpRequest)
    {
	    xmlHttp = new XMLHttpRequest();
	    if(xmlHttp.overrideMimeType)
	    {
		    xmlHttp.overrideMimeType('text/xml');
	    }
    }	
    else
    {
        try
        {
            xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
        }
        catch(e)
        {
	        try
	        {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	        }
	        catch(e)
		    {
		        xmlHttp=false;
		    }
        }
    }
    
    return xmlHttp;
}

CallBackObject.prototype.DoCallBack=function(URL)
{
    if(this.XmlHttp)
    {
        if(this.XmlHttp.readyState==4 || this.XmlHttp.readyState==0)
        {
            var oThis=this;
            this.XmlHttp.open('POST',URL,false);
            this.XmlHttp.onreadystatechange=function(){oThis.ReadyStateChange();}
            this.XmlHttp.send(null);
        }
    }
}

CallBackObject.prototype.ReadyStateChange=function()
{
    if(this.XmlHttp.readyState==4)
    {
        if(this.XmlHttp.status==0)
        {
            this.XmlHttp.abort();
        }
        else if(this.XmlHttp.status==200 && this.XmlHttp.statusText=="OK")
        {
            this.OnComplete(this.XmlHttp.responseText,this.XmlHttp.responseXML);
        }
        else
        {
            this.OnError(this.XmlHttp.status,this.XmlHttp.statusText,this.XmlHttp.responseText);
        }
    }
}

CallBackObject.prototype.OnComplete=function(txt,xml)
{
    var lbl;
    
    lbl=document.getElementById('ctl00_ContentPlaceHolder1_lblContent');
    
    lbl.innerHTML=txt;
}


CallBackObject.prototype.OnError=function(sta,statxt,reqtxt)
{
    alert("错误："+statxt);
}

function getContent(ID)
{
    var httpxml=new CallBackObject();
    httpxml.DoCallBack("default.aspx?ID="+ID);
}










