// JavaScript Document
//start:
//var loader=new net.contentloader(url,mydeal)
//function mydeal(){
//alert(this.url+"loaded! Here's the content:\n\n"+this.req.responseText)
//}
//本文件为暂时之用，将在不久改进
/*屏蔽所有的js错误*/
function killerrors() { 
return true; 
} 
window.onerror = killerrors; 
//-->

var net=new Object();
net.ready_state_uninitialized=0;
net.ready_state_loading=1;
net.ready_state_loaded=2;
net.ready_state_interactive=3;
net.ready_state_complete=4;

net.contentloader=function(url,onload,onerror){
this.url=url;
this.req=null;
this.onload=onload;
this.onerror=onerror?onerror:this.defaulterror;
this.loadxmldoc(url);
}

net.contentloader.prototype={
	loadxmldoc:function(url){
		if(window.XMLHttpRequest){
			this.req=new XMLHttpRequest()
			}else if(window.ActiveXObject){
				this.req=new ActiveXObject("Microsoft.XMLHTTP");
				}
		if(this.req){
			try{
				var loader=this;
				this.req.open('GET',url,true);
				this.req.onreadystatechange=function(){
					loader.onReadyState.call(loader);
					}
				this.req.send(null);
				}catch(e){
					this.onerror.call(this);
					}
			}
		},
	onReadyState:function(){
		var req=this.req;
		var ready=req.readyState;
		if(ready==net.ready_state_complete){
			var httpstatus=req.status;
			if(httpstatus==200||httpstatus==0){
				this.onload.call(this);
				}else{
					this.onerror.call(this);
					}
			}
		},
		defaulterror:function(){
			alert("Error:"
				  +"\n\nreadyState: "+this.req.readyState
				  +"\nStatus: "+this.req.status
				  +"\nheaders: "+this.req.getAllResponseHeaders()
				  );
			}
	
		
	}
//根据
function getspid(){
	var yu=location.href;
	var ul=yu.split("/");
	var htm=ul[ul.length-1];
	if(yu.indexOf(".php")==-1){
		var reg=/-[0-9]+/i
		var nm=reg.exec(htm);
		var ns=nm[0].substr(1);
		var spid=new Number(ns);
	}else{
		var reg=/=[0-9]+/i
		var nm=reg.exec(htm);
		var ns=nm[0].substr(1);
		var spid=new Number(ns);
	}
	return spid;
}
	//var sobj=new Array();
	var sk=0;//当前对象索引
	var sg=0;//对象索引
	var gobj=new Array();
function getsp(id,objid){
		obj=document.getElementById(objid);
		gobj[sg]=obj;//保存当前对象到数据，为对象提供顺序调用
		var url="/cms/include/suipian_show.php?id="+id+"&position="+sg;
		sg++;
		var loader=new net.contentloader(url,putdata);
	}
	
	
function getspdiv(id,objid){
		obj=document.getElementById(objid);
		gobj[sg]=obj;//保存当前对象到数据，为对象提供顺序调用
		//var url="/cms/include/suipian_fenye.php?id="+id+"&position="+sg;
		var url="/cms/include/x.php?id="+id+"&position="+sg;
		sg++;
		var loader=new net.contentloader(url,putdata);
	}
function putdata(){
		var result=this.req.responseText;
		
		var rl=result.split("!@#!");
		var res=rl[0];
		var position=new Number(rl[1]);
		
		if(res.length>20){
			while(res.indexOf("&lt;")>-1){
				res=res.replace("&lt;","<");
			}
			while(res.indexOf("&gt;")>-1){
				res=res.replace("&gt;",">");
			}
			while(res.indexOf("&quot;")>-1){
				res=res.replace("&quot;",'"');
			}
			while(res.indexOf("&amp;")>-1){
				res=res.replace("&amp;",'&');
			}
			//setsp(res,sk);
			gobj[position].innerHTML=res;
			sk++;
			//obj.innerHTML=res;
		}
	}
function getsp_dr(spid,num,objid){
		obj=document.getElementById(objid);
		gobj[sg]=obj;//保存当前对象到数据，为对象提供顺序调用
		var url="/cms/include/suipian_dr_show.php?id="+spid+"&num="+num+"&position="+sg;
		sg++;
		var loader=new net.contentloader(url,putdata2);
	}
function putdata2(){
		var result=this.req.responseText;
		var rl=result.split("!@#!");
		var res=rl[0];
		var position=new Number(rl[1]);
		
		if(res.length>20){
			while(res.indexOf("&lt;")>-1){
				res=res.replace("&lt;","<");
			}
			while(res.indexOf("&gt;")>-1){
				res=res.replace("&gt;",">");
			}
			while(res.indexOf("&quot;")>-1){
				res=res.replace("&quot;",'"');
			}
			while(res.indexOf("&amp;")>-1){
				res=res.replace("&amp;",'&');
			}
			//setsp(res,sk);
			gobj[position].innerHTML=res;
			sk++;
			//obj.innerHTML=res;
		}
	}

function getsp1(id,objid){
		getsp(id,objid)
	}
function getsp2(id,objid){
		getsp(id,objid)
	}
function getsp3(id,objid){
		getsp(id,objid)
	}
function getsp4(id,objid){
		getsp(id,objid)
	}
function getsp5(id,objid){
		getsp(id,objid)
	}
function getsp6(id,objid){
		getsp(id,objid)
	}
function getsp7(id,objid){
		getsp(id,objid)
	}
function getsp8(id,objid){
		getsp(id,objid)
	}
function getsp9(id,objid){
		getsp(id,objid)
	}
function getsp11(id,objid){
		getsp(id,objid)
	}
function getsp10(id,objid){
		getsp(id,objid)
	}
function getsp12(id,objid){
		getsp(id,objid)
	}
