
function createAjax() {
	var _xmlhttp;
	try {
		_xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch (e) {
		try {
			_xmlhttp=new XMLHttpRequest();
		}
		catch (e) {
			_xmlhttp=false;
		}
	}
	return _xmlhttp;
}

function getweblist(dbpath,contentID,sortID,start,count,length) {
	var xmlhttp=createAjax();
	if (xmlhttp) {
		var content=document.getElementById(contentID);

		xmlhttp.open('get','/softoon/Web/website/Index.nsf/getlist?openagent&sortID='+sortID+'&start='+start+'&dbpath='+dbpath+'&count='+count+'&length='+length+'&n='+Math.random(),true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {
				content.innerHTML=xmlhttp.responseText;        
			}
			else {
				content.innerHTML='<img src="/htmls/images/loading_16x16.gif" align="absmiddle" /> 正在从服务器提取数据，请稍候......';
			}
		}
		xmlhttp.send(null);
	}
}

function getweblistother(dbpath,contentID,sortID,start,count,length) {
	var xmlhttp=createAjax();
	if (xmlhttp) {
		var content=document.getElementById(contentID);

		xmlhttp.open('get','/softoon/Web/website/Index.nsf/getlistother?openagent&sortID='+sortID+'&start='+start+'&dbpath='+dbpath+'&count='+count+'&length='+length+'&n='+Math.random(),true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {
				content.innerHTML=xmlhttp.responseText;        
			}
			else {
				content.innerHTML='<img src="/htmls/images/loading_16x16.gif" align="absmiddle" /> 正在从服务器提取数据，请稍候......';
			}
		}
		xmlhttp.send(null);
	}
}

function getweblistzxtz(dbpath,contentID,sortID,start,count,length) {
	var xmlhttp=createAjax();
	if (xmlhttp) {
		var content=document.getElementById(contentID);

		xmlhttp.open('get','/softoon/Web/website/Index.nsf/getlistzxtz?openagent&sortID='+sortID+'&start='+start+'&dbpath='+dbpath+'&count='+count+'&length='+length+'&n='+Math.random(),true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {
				content.innerHTML=xmlhttp.responseText;        
			}
			else {
				content.innerHTML='<img src="/htmls/images/loading_16x16.gif" align="absmiddle" /> 正在从服务器提取数据，请稍候......';
			}
		}
		xmlhttp.send(null);
	}
}

function getweblistKnowledge(dbpath,contentID,sortID,start,count,length) {
	var xmlhttp=createAjax();
	if (xmlhttp) {
		var content=document.getElementById(contentID);

		xmlhttp.open('get','/softoon/Web/website/Index.nsf/getlistKnowledge?openagent&sortID='+sortID+'&start='+start+'&dbpath='+dbpath+'&count='+count+'&length='+length+'&n='+Math.random(),true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {
				content.innerHTML=xmlhttp.responseText;        
			}
			else {
				content.innerHTML='<img src="/htmls/images/loading_16x16.gif" align="absmiddle" /> 正在从服务器提取数据，请稍候......';
			}
		}
		xmlhttp.send(null);
	}
}

function getweblistZFGZBG(dbpath,contentID,sortID,start,count,length) {
	var xmlhttp=createAjax();
	if (xmlhttp) {
		var content=document.getElementById(contentID);

		xmlhttp.open('get','/softoon/Web/website/Index.nsf/getlistZFGZBG?openagent&sortID='+sortID+'&start='+start+'&dbpath='+dbpath+'&count='+count+'&length='+length+'&n='+Math.random(),true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {
				content.innerHTML=xmlhttp.responseText;        
			}
			else {
				content.innerHTML='<img src="/htmls/images/loading_16x16.gif" align="absmiddle" /> 正在从服务器提取数据，请稍候......';
			}
		}
		xmlhttp.send(null);
	}
}


function getwebcontent(dbpath,contentID,sortID,start,count) {
	var xmlhttp=createAjax();
	if (xmlhttp) {
		var content=document.getElementById(contentID);
		xmlhttp.open('get','/softoon/Web/website/Index.nsf/getCont?openagent&dbpath='+dbpath+'&sort='+sortID+'&start='+start+'&count='+count+'&n='+Math.random(),true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {
				content.innerHTML=unescape(xmlhttp.responseText);
				if(content.innerHTML=="<H2>已执行完代理</H2>"){
					content.innerHTML="该栏目暂时没有记录...";
				}
			}
			else {
				content.innerHTML='<img src="/htmls/images/loading_16x16.gif" align="absmiddle" /> 正在从服务器提取数据，请稍候......';
			}
		}
		xmlhttp.send(null);
	}
}

function getpiclistother(dbpath,contentID,sortID,start,count,length) {
	var xmlhttp=createAjax();
	if (xmlhttp) {
		var content=document.getElementById(contentID);

		xmlhttp.open('get','/softoon/Web/website/Index.nsf/getpiclistother?openagent&sort='+sortID+'&start='+start+'&dbpath='+dbpath+'&count='+count+'&length='+length+'&n='+Math.random(),true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {
				content.innerHTML=xmlhttp.responseText;        
			}
			else {
				content.innerHTML='<img src="/htmls/images/loading_16x16.gif" align="absmiddle" /> 正在从服务器提取数据，请稍候......';
			}
		}
		xmlhttp.send(null);
	}
}



///////////////////////////

function loadlist2(dbNo,ContentObj,titsize,sort,start,count)
{
//说明 loadlist(dbNo[,titsize,sort,count,start])
//dbNo：数据库编号
//titsize:标题长度（可选参数）
//sort：分类号（可选参数）
//count:显示条数（可选参数）
//start:起始条数（可选参数）

if (ContentObj==null)
{
alert("找不到主对象。")
return
}
ContentObj.innerHTML = "<img src=/htmls/images/loading_16x16.gif></img>loading..."
var ArgLen = loadlist2.arguments.length;
if (dbNo=="" ||  dbNo==null)
{
 alert("参数错误\n正确参数为 loadlist(dbNo[,titsize,sort,count,start])");
 return
}
 if(ArgLen<2)
 titsize = null;
 
 
 if(ArgLen>3 && sort!="")
 UrlStr = "/softoon/web/Information/Informations"+dbNo+".nsf/InformationsListSort?ReadViewEntries&RestrictToCategory="+sort
 else
 UrlStr = "/softoon/web/Information/Informations"+dbNo+".nsf/InformationsList?ReadViewEntries"
 if(ArgLen>4 && start!="")
 UrlStr = UrlStr + "&Start="+start
 if(ArgLen>5 && count!="")
 UrlStr = UrlStr + "&Count="+count

 if (document.implementation && document.implementation.createDocument)
 {
  xmlDoc = document.implementation.createDocument("", "", null);
  xmlDoc.onload = createTable(RootEntry);
  //alert("hello");
 }
 else if (window.ActiveXObject)
 {
  xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  xmlDoc.onreadystatechange = function () {
   if (xmlDoc.readyState == 4)
   {

 var Entries = xmlDoc.getElementsByTagName("viewentry");
 ContentObj.innerHTML = ""

 if(Entries.length==0)
 {
  ContentObj.innerHTML ="暂无记录";
  return
 }
 var ulObj = document.createElement('ul');
 ContentObj.appendChild(ulObj);
 for (i=0;i<Entries.length;i++)
 {
     var Title = "无标题";
     var HtmlWindowsPath = "";
     var InformationUNID = "";
     for(j=0;j<Entries[0].childNodes.length;j++)
     {
      
      if( Entries[i].childNodes[j].getAttribute("name")=="Title")
      Title = Entries[i].childNodes[j].text;
      else if( Entries[i].childNodes[j].getAttribute("name")=="HtmlWindowsPath")
      HtmlWindowsPath = Entries[i].childNodes[j].text;
      else if( Entries[i].childNodes[j].getAttribute("name")=="InformationUNID")
      InformationUNID = Entries[i].childNodes[j].text;
      
     }

     if (titsize==null) 
     Titleshort = Title;
     else if(Title.length>titsize)
     Titleshort = Title.substr(0,titsize)+"..."
     else
     Titleshort = Title;
     var liobj = document.createElement('li');
     var aobj =  document.createElement('a');
     aobj.href = "/htmls/"+HtmlWindowsPath+"/"+InformationUNID+".html";
     aobj.target = "_blank";
     aobj.title = Title;
     var theData = document.createTextNode(Titleshort);
	
     aobj.appendChild(theData);
     liobj.appendChild(aobj);
     ulObj.appendChild(liobj);}
}
  };
  //alert("MS");
  }
 else
 {
  alert('Your browser can\'t handle this script');
  return;
 }
 xmlDoc.load(UrlStr);
}


///////////////
function loadlist(dbNo,ContentObj,titsize,sort,start,count)
{
//说明 loadlist(dbNo[,titsize,sort,count,start])
//dbNo：数据库编号
//titsize:标题长度（可选参数）
//sort：分类号（可选参数）
//count:显示条数（可选参数）
//start:起始条数（可选参数）

if (ContentObj==null)
{
alert("找不到主对象。")
return
}
ContentObj.innerHTML = "<img src=/htmls/images/loading_16x16.gif></img>loading..."
var ArgLen = loadlist.arguments.length;
if (dbNo=="" ||  dbNo==null)
{
 alert("参数错误\n正确参数为 loadlist(dbNo[,titsize,sort,count,start])");
 return
}
 if(ArgLen<2)
 titsize = null;
 
 
 if(ArgLen>3 && sort!="")
 UrlStr = "/softoon/web/Information/Informations"+dbNo+".nsf/InformationsListSort?ReadViewEntries&RestrictToCategory="+sort
 else
 UrlStr = "/softoon/web/Information/Informations"+dbNo+".nsf/InformationsList?ReadViewEntries"
 if(ArgLen>4 && start!="")
 UrlStr = UrlStr + "&Start="+start
 if(ArgLen>5 && count!="")
 UrlStr = UrlStr + "&Count="+count

 if (document.implementation && document.implementation.createDocument)
 {
  xmlDoc = document.implementation.createDocument("", "", null);
  xmlDoc.onload = createTable(RootEntry);
  //alert("hello");
 }
 else if (window.ActiveXObject)
 {
  xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  xmlDoc.onreadystatechange = function () {
   if (xmlDoc.readyState == 4)
   createlist(titsize,ContentObj,xmlDoc)
  };
  //alert("MS");
  }
 else
 {
  alert('Your browser can\'t handle this script');
  return;
 }
 xmlDoc.load(UrlStr);
}

function createlist(titsize,ContentObj,xmlDoc)
{

 var Entries = xmlDoc.getElementsByTagName("viewentry");
 ContentObj.innerHTML = ""

 if(Entries.length==0)
 {
  ContentObj.innerHTML ="暂无记录";
  return
 }
 var ulObj = document.createElement('ul');
 ContentObj.appendChild(ulObj);
 for (i=0;i<Entries.length;i++)
 {
     var Title = "无标题";
     var HtmlWindowsPath = "";
     var InformationUNID = "";
     for(j=0;j<Entries[0].childNodes.length;j++)
     {
      
      if( Entries[i].childNodes[j].getAttribute("name")=="Title")
      Title = Entries[i].childNodes[j].text;
      else if( Entries[i].childNodes[j].getAttribute("name")=="HtmlWindowsPath")
      HtmlWindowsPath = Entries[i].childNodes[j].text;
      else if( Entries[i].childNodes[j].getAttribute("name")=="InformationUNID")
      InformationUNID = Entries[i].childNodes[j].text;
      
     }

     if (titsize==null) 
     Titleshort = Title;
     else if(Title.length>titsize)
     Titleshort = Title.substr(0,titsize)+"..."
     else
     Titleshort = Title;
     var liobj = document.createElement('li');
     var aobj =  document.createElement('a');
     aobj.href = "/htmls/"+HtmlWindowsPath+"/"+InformationUNID+".html";
     aobj.target = "_blank";
     aobj.title = Title;
     var theData = document.createTextNode(Titleshort);
	
     aobj.appendChild(theData);
     liobj.appendChild(aobj);
     ulObj.appendChild(liobj);}
}

