﻿try{if(GlobalPath==undefined)var cc="00";}catch(e){GlobalPath="";}
try{if(IsShowLoading==undefined)var cc="00";}catch(e){IsShowLoading="false";}
 function $(id){if(document.getElementById(id)){return document.getElementById(id); }else{return null}}
 function CreateHttpRequest(){
try{return new ActiveXObject('MSXML2.XMLHTTP.4.0');}
catch(e){
try{return new ActiveXObject('MSXML2.XMLHTTP.3.0');}
catch(e){
try{return new ActiveXObject('MSXML2.XMLHTTP.2.6');}
catch(e){
try{return new ActiveXObject('MSXML2.XMLHTTP');}
catch(e){
try{return new ActiveXObject('Microsoft.XMLHTTP');}
catch(e){
try{return new XMLHttpRequest();}
catch(e){return null;}}}}}}}
 
var Class = {
  create: function() {
    return function() {
      this.initialize.apply(this, arguments);
    }
  }
}

var cmdReader = Class.create();
cmdReader.prototype = {
	initialize: function(divid,mydata,fsuccess) {//divid代表要显示数据的moduleid，params代表一些dmodule设置参数
        var myurl=GlobalPath+"Common/XslDsResult.aspx";//提交页面

		this.url = myurl;
		//document.write(myurl);
		this.data=mydata;
		this.params=mydata;
		this.divid=divid;
		this.fsuccess=fsuccess;
		this.showload();
		this.getRss();	
	},
	
	showload:function(){
	try{
	
	if(IsShowLoading=="true"){
	document.getElementById(this.divid).innerHTML="";
		var loading = document.createElement('span');
		loading.setAttribute('id','loading'+this.divid);
		loading.innerHTML="<div class='msg'><img src='"+GlobalPath+"images/load.gif'> 正在加载...</div>"
		document.getElementById(this.divid).appendChild(loading);
}
		}catch(e){alert(e.name+e.message);}
		 
	},
	
	
	
	getRss:function() {
		
		try{
		this.http_request=CreateHttpRequest();
		var othis = this;
		this.http_request.onreadystatechange = function(){othis.callback();};
		
		this.http_request.open("post", this.url, true);
		if(navigator.userAgent.indexOf("Firefox")<0&&navigator.userAgent.indexOf("Safari")<0)this.http_request.setrequestheader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
		this.http_request.send(this.data);
		
		//this.http_request.open("get", this.url, true);
		//this.http_request.send(null);
		}catch(e){alert(e.name+e.message);}
	},
	
	callback:function() {
		if (this.http_request.readyState == 4)
		 { 
			if (this.http_request.status == 200) {this.loadready(this.http_request.responseText);}
			 else {
				//alert("您所请求的页面有异常。");
				this.getRss();}	
		 }
	},
	
	loadready:function(text)
	{
	
	try
	{
	    //rowscount=parseInt(rowscount,10);
	    
	    if(IsShowLoading=="true"){
	    var loading = document.getElementById('loading'+this.divid);
		document.getElementById(this.divid).removeChild(loading);
		}document.getElementById(this.divid).innerHTML="";
		var put=text;//alert(text);document.write(put);
	    $(this.divid).innerHTML=put;
	    if(this.fsuccess)this.fsuccess();
	}catch(e){}
	
	}
	
	
	
	}
	
