function Select_Before(){return true};
function Select_After(){};
function Act_Before(){return true};
function Act_After(){};
function Login_Before(){};
function Login_After(){};
String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"")};
function analyse(h,a,c,b){
try{
	if(!h.responseXML) throw{message:"调用Web服务程序产生错误！"};
	var s=h.responseText;
	var T={},p=s.indexOf("<"+a+"Result>");
	if(p==-1){
		if(s.indexOf("Response xmlns=\""+Space+"\" />")==-1) throw{message:s};
	}
	else eval(F.htmUnbox(s.substring(p+a.length+8,s.indexOf("</"+a+"Result>"))));
	h=null;
	if(b){
	for(var e in List)
	{
		if(T[e]&&List[e].father)
		{
			var d=T[e],fd=T[List[e].father],fk=List[List[e].father].key,j=0;
			for(var n in d)if(d[e].constructor!=Array)d[e]=[d[e]];
			for(var i=0;i<fd[fk].length;i++)
			{   fd[e]=[];
				var t={};
				for(var n in d)t[n]=[];
				for(;j<d[fk].length;j++)
				{
					if(d[fk][j]==fd[fk][i])
					{
						for(var n in d)t[n][t[n].length]=d[n][j];
				    }
				}
				fd[e][i][fd[e][i].length]=t;
			}
			delete(T[e]);
		}
	}}
	if(T.logout)Login_Before(T);else if(T.login)Login_After(T);
	if(T.script)eval(T.script);
	if(T.alert)alert(T.alert);
	if(c){
		if(typeof(c)=="object")c.adapt(T);
		else c(T);
	}
	return T;
}
catch(e){if(typeof(c)=="object")c.abort(e);else alert(e.message);}
};
var Space="http://ciecco/",Control={},Search={},List={},SET={},K={},
Service={
queue:[],
call:function(a,p,c,b){
	if(!a) return;
	if(this.busy){return this.queue.push({a:a,p:p,c:c,b:b})}
	this.busy=true;
	var d=SET.dir;
	if(a.indexOf("/")==0){a=a.substring(1);d=""}
	var i=a.indexOf("."),n=i<0?"main":a.substring(0,i);a=i<0?a:a.substring(i+1,a.length),h=F.xmlHttp();
	h.onreadystatechange=function(){
		if(h.readyState<4)return;
		analyse(h,a,c,b);
		Service.busy=false;
		if(Service.queue.length>0){
			var q=Service.queue.pop();
			Service.call(q.a,q.p,q.c,q.b);
		}
	};
	h.open("POST","http://"+location.host+"/service/"+(d?d+"/":"")+n+".asmx",(c?true:false));
	h.setRequestHeader("SOAPAction", Space + a);
	h.setRequestHeader("Content-Type", "text/xml;charset=utf-8");
	h.send("<?xml version='1.0'?><soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body><"+a+" xmlns='"+Space+"'>"+(p==null?"":p)+"</"+a+"></soap:Body></soap:Envelope>");
}},
Cookie={
get:function(n){
  var c=document.cookie,v="";
  n=n+"=";
  if(c.length > 0)
  { 
    var a=c.indexOf(n);
    if(a!=-1)
    { 
      a+=n.length;
      var b=document.cookie.indexOf(";",a);
      if (b==-1) b=c.length;
      v=unescape(c.substring(a,b))
    }
  }
  return v;
},
set:function(n,v,h){
  var e = "";
  if(h!=null)
  {
    e=new Date((new Date()).getTime() + h * 3600000);
    e="; expires=" + e.toGMTString();
  }
  document.cookie=n+"="+escape(v)+";path=/"+e;
},
cn:function(n){
	var s=Cookie.get(n);if(!s) return "";
	var l=Cookie.get(n).split("|");s="";
	for(var i=0;i<l.length;i++)	{s+=String.fromCharCode(parseInt(l[i],16));	}
	return s;
}},
Check={
number:function(o){
	var v=o.value.trim(),z=o.getAttribute("zero"),a=o.getAttribute("label");
	if(!a)a=o.getAttribute("name");
	if(!v) return o.value="";
	if(v==z) return o.value=z;
	v=parseFloat(v);
	if(isNaN(v)) throw{message:a+"含有不正确字符，请输入数字！"}; 
	if(v==0&&z)return o.value=z;
	if(!o.getAttribute("neg"))v=Math.abs(v);
	var t=parseInt(o.getAttribute("lower")),s=parseInt(o.getAttribute("scale"));
	if(t&&v<t)throw{message:a+"数值不能小于"+t+"！"};
	t=parseInt(o.getAttribute("upper"));
	if(t&&v>t)throw{message:a+"数值不能大于"+t+ "！"};
	if(!s) return o.value=parseInt(v);
	var r=v.toString(),p=r.indexOf("."),l=0;
	p<0?r+=".":l=r.length-1-p;
	for (var i=0;i<(s-l);i++) r+="0";
	o.value=r;
},
en:function(o){
	var v=o.value.trim(),a=o.getAttribute("label");
	if(!a)a=o.getAttribute("name");
	if(v.match(/[^\w\s]+/i))throw{message:a+"只能输入字母、数字和下划线！"};
	o.value=v;
},
email:function(o){
	var v=o.value.trim();
	if(!v.match(/^[\w.-]+@([0-9a-z][\w-]+\.)+[a-z]{2,3}$/i))throw{message:"请输入正确的Email地址！"};
	o.value=v;
},
date:function(o){
	var v=o.value.trim(),a=o.getAttribute("label");
	if(!a)a=o.getAttribute("name");
	if (!v) return o.value=v;
	if(!v.match(/^(?:([0-9]{4}-(?:(?:0?[1,3-9]|1[0-2])-(?:29|30)|((?:0?[13578]|1[02])-31)))|([0-9]{4}-(?:0?[1-9]|1[0-2])-(?:0?[1-9]|1\d|2[0-8]))|(((?:(\d\d(?:0[48]|[2468][048]|[13579][26]))|(?:0[48]00|[2468][048]00|[13579][26]00))-0?2-29)))$/i))
	throw{message:"输入的"+a+"日期格式不正确"};
	o.value=v;
},
web:function(o){
	var v=o.value.trim(),a=o.getAttribute("label");
	if(!a)a=o.getAttribute("name");
	if (!v) return o.value=v;
	if(!v.match(/^(http:\/\/)?(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$/i))
	throw{message:"输入的"+a+"网址格式不正确"};
	o.value=v;
},
tel:function(o){
	var v=o.value.trim(),a=o.getAttribute("label");
	if(!a)a=o.getAttribute("name");
	if (!v) return o.value=v;
	if(!v.match(/^((\(\d{3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}$/))
	throw{message:"请输入正确的电话号码！"};
	o.value=v;
},
mobile:function(o){
	var v=o.value.trim(),a=o.getAttribute("label");
	if(!a)a=o.getAttribute("name");
	if (!v) return o.value=v;
	if(!v.match(/^((\(\d{3}\))|(\d{3}\-))?13\d{9}$/))
	throw{message:"请输入正确的移动电话号码！"};
	o.value=v;
},

focus:function(o){
	var n=o.getAttribute("name"),d=document.getElementById("warn_"+n);
	if(d){
		d.className="class_hover";
		var s=d.getAttribute("hover");
		if(s)d.innerHTML=s;
	}
},
exam:function(o){
	var k=o.getAttribute("kind"),n=o.getAttribute("name"),d=document.getElementById("warn_"+n),v=o.value;
	if(typeof(v)=="string")v=v.trim();
	try
	{
		if(this[k])this[k](o);
		var a=o.getAttribute("label"),t=o.getAttribute("need");
		if(!a)a=n;
		if (t&&!v)throw{message:t};
		var m=o.getAttribute("min"),n=o.getAttribute("max");
		if (m&&v.length<m)throw{message:a+"必须大于"+m+"个字符！"};
		if (n&&v.length>n)throw{message:a+"不能超过"+n+"个字符！"};
		if ((t=o.getAttribute("equal"))&&(document.getElementById(t).value.trim()!=v))
			throw{message:"两次密码输入不相同，请重新输入！"};
		if(o.tagName=="INPUT")o.value=v;
		o.error=void(0);
		if(d){
			d.className="class_finish";
			var s=d.getAttribute("finish");
			d.innerHTML=s?s:d.old;
		}
	}
	catch(e){
		o.error=e;
		if(d){
			d.className="class_error";
			d.innerHTML=e.message;
		}
	}
}},
F={
ie:(window.ActiveXObject!=null?true:false),
call:function(a,p,f){try{Service.call(a,p?(p.indexOf("</")>-1?p:"<id>"+p+"</id>"):"",f?f:void(0))}catch(e){alert(e.message)}},
exec:function(a,p){
try{
	var d=SET.dir;
	if(a.indexOf("/")==0){a=a.substring(1);d=""}
	var i=a.indexOf("."),n=i<0?"main":a.substring(0,i);a=i<0?a:a.substring(i+1,a.length),h=F.xmlHttp();
	h.open("POST","http://"+location.host+"/service/"+(d?d+"/":"")+n+".asmx",false);
	h.setRequestHeader("SOAPAction", Space + a);
	h.setRequestHeader("Content-Type", "text/xml;charset=utf-8");
	h.send("<?xml version='1.0'?><soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body><"+a+" xmlns='"+Space+"'>"+(p==null?"":p)+"</"+a+"></soap:Body></soap:Envelope>");
	return analyse(h,a);} catch(e){alert(e.message)}
},
xmlInbox:function(s){if(s==null)return "";return s.toString().replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"\\r").replace(/\n/g,"\\n");},
xmlUnbox:function(s){if(s==null)return "";return s.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")},
htmInbox:function(s){if(s==null)return "";return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>")},
htmUnbox:function(s){if(s==null)return "";return s.replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ")},
addCss:function(url){
	var o=document.getElementsByTagName("HEAD")[0],s=document.getElementById("mycss");
	//if(s)o.removeChild(s);
	s=o.appendChild(document.createElement("link"));
	//s.id="mycss";
	s.type="text/css";
	s.rel="stylesheet";
	s.href=url;
},
addEvent:function(o,n,f){
	if(window.attachEvent) o.attachEvent("on"+n,function(){f(o)});
	else o.addEventListener(n,function(){f(o)},false)
},
tran:function(s,d)
{
	document.getElementById(s).style.display="none";
	document.getElementById(d).style.display="block";
},
xmlHttp:function(){
	try	{
		if(window.XMLHttpRequest)return new XMLHttpRequest();
		if (window.ActiveXObject){
			try{return new ActiveXObject("MSXML2.XMLHTTP")}
			catch(e){ 
				try{return new ActiveXObject("Microsoft.XMLHTTP")}
				catch(e){location="http.html"}
			}
		}
	}catch(e){location="http.html";}
},
empty:function(o){for(var e in o)return false;return true},
top:function(o,t){
	if (!t)t="TR";
	var f=o.parentNode;
	while (f.tagName!=t)f=f.parentNode;
	return f;
},
addEvent:function(o,n,f){
	if(window.attachEvent) o.attachEvent("on"+n,function(){f(o)});
	else o.addEventListener(n,function(){f(o)},false)
},
getValue:function(o){
	var v=o.value;
	if(o.tagName=="INPUT"||o.tagName=="TEXTAREA"||o.tagName=="SELECT"||o.getAttribute("need")){
		Check.exam(o);
		v=o.value;
	}
	else if(v==void(0)){v=o.innerHTML;}
	if(o.error)throw o.error;
	if(v)return v;
},
get:function(o){
	var v;
	if(o.id=="key") return this.getValue(o);
	if(o.type=="checkbox"||o.type=="radio"){if(o.checked)v=o.value;}
	else if(o.tagName=="INPUT"||o.tagName=="TEXTAREA"||o.tagName=="SELECT"||o.getAttribute("need")){
		Check.exam(o);
		v=o.value;
	}
	else v=o.value;
	if(o.error)throw o.error;
	if(!o.data){ if(v) return v;}
	else if(o.data!=v) return v;
},
assign:function(o,c){
	var t=o.getAttribute("inbox");
	if(t){eval("o.inbox="+t)};
	switch(o.getAttribute("group"))
	{	case "radio":
			o.set=function(v){this.value=this.data=v;if(this.kid[v])this.kid[v].checked=true;};
			o.kid={};
			var l=o.getElementsByTagName("INPUT");
			for (var i=0;i<l.length;i++)
			{	l[i].onclick=function(){o.value=this.value};
				o.kid[l[i].value]=l[i];
				if(l[i].checked)o.value=l[i].value;
			}
			return;
		case "checkbox":
			o.kid={};
			var l=o.getElementsByTagName("INPUT");
			o.set=function(v){
				this.value=this.data=v;
				for (var e in this.kid)this.kid[e].checked=false;
				var l=v.split(",");
				for (var i=0; i<l.length; i++)
					if (this.kid[l[i]])this.kid[l[i]].checked=true;
			};
			for (var i=0; i<l.length; i++)
			{	l[i].onclick=function(){
				if(this.checked){
					var m=o.getAttribute("maxsel");
					if(this.checked && m && o.value.toString().split(',').length>=m){ 
						alert("您最多只能选择"+m+"项");
						return this.checked=false;
					}
					o.value=(!o.value?this.value:o.value+","+this.value);
				}
				else
					o.value=(","+(!o.value?"":o.value)+",").replace(","+this.value+",",",").replace(/^,|,$/g,"");
				};
				o.kid[l[i].value]=l[i];
				o.value=(l[i].checked?(!o.value?l[i].value:o.value+","+l[i].value):("," + (!o.value?"":o.value) + ",").replace("," + l[i].value + ",",",").replace(/^,|,$/g,""));
			}
			return;
		case "order":
			c.all["order"]=o;
			o.root=c.name;
			var l=o.getElementsByTagName("*");
			for (var i=0;i<l.length;i++) 
			{	if(l[i].getAttribute("field")){
				l[i].onclick=function(){
					var s=this.getAttribute("by"),n=this.getAttribute("field");
					this.setAttribute("by",s=s=="desc"?"asc":"desc");
					if(o.pre)o.pre.style.backgroundImage="none";
					this.style.backgroundImage="url(/js/pic/"+s+".gif)";
					o.pre=this;
					o.value=n.indexOf(",")>=0?n.replace(","," "+s+",")+" "+s:n+" "+s;
					Search[o.root].select();
				};
				var s=l[i].getAttribute("by");
				if(s)
				{	l[i].style.backgroundImage="url(/js/pic/"+s+".gif)";
                 	var n=l[i].getAttribute("field");
					o.value=n.indexOf(",")>=0?n.replace(","," "+s+",")+" "+s:n+" "+s;
					o.pre=l[i];
				}
				}
			}
			return;
		case "link":
			o.root=c.name;
			var l=o.getElementsByTagName("A");
			for (var i=0;i<l.length;i++) 
			{	if(l[i].getAttribute("data")!=void(0)){
				l[i].onclick=function(){
					if(o.pre)o.pre.className="none";
					this.className="focus";
					o.pre=this;
					o.value=this.getAttribute("data");
					Search[o.root].select();
					this.blur();
					return false;
				};
				if(l[i].className=="focus"){
					o.value=l[i].getAttribute("data");
					o.pre=l[i];
				}}
			}
			return;
	}
	if(o.tagName=="TEXTAREA"||o.type=="text"||o.type=="password")
	{
		o.set=function(v){this.value=this.data=v;if(this.inbox)this.inbox(v)};
		F.addEvent(o,"focus",Check.focus);
		var blurstr=o.onblur;
		if(blurstr==null){o.onblur=function(){Check.exam(this);}};
	}
	else if(o.type=="hidden")
	{
		o.set=function(v){this.value=v;if(this.inbox)this.inbox(v)};
	}
	else if(o.type=="radio"||o.type=="checkbox")
	{
		if(o.id=="key") o.set=function(v){o.value=v;this.checked=false;if(this.inbox)this.inbox(v)};
		else o.set=function(v){this.checked=(this.value==v?true:false);if(this.inbox)this.inbox(v)};
	}
	else if(o.tagName=="SELECT")
	{	o.set=function(v){
			if(v.constructor==Array)
			{	var t=parseInt(this.getAttribute("start"));
				if(t)this.length=t;
				for(var i=0;i<v.length;i++)
				{	var p=0;
					for(var e in v[i])
					{	if(p==1){this.options[this.length]=new Option(v[i][e],t);break};
						t=v[i][e];
						p++;
					}
				}
			}
			else
			{
				this.value=this.data=v;
				if(this.inbox)this.inbox(v);
			}
		}
	}
	else if(o.tagName=="IMG")o.set=function(v){this.data=v;if(this.inbox)this.inbox(v);else this.src=v;};
	else if(o.tagName=="A")o.set=function(v){this.data=v;if(this.inbox)this.inbox(v);else this.href=v;};
	else o.set=function(v){this.data=v;if(this.inbox)this.inbox(v);else this.innerHTML=v;};
},
split:function(s){
	var o={};
	if(!s||s=="")return o;	
	try
	{	var l=s.split("&");
		for (i=0; i<l.length; i++)
		{	var t=l[i].split("=");
			if(t.length!=2) continue;
			o[t[0].trim()]=unescape(t[1].trim());
		}
	}catch(e){}
	return o;
},
reset:function(o){
	if(o.id=="key") return;
	if(o.value)o.value=o.defaultValue;
	if(o.checked)o.checked=o.defaultChecked;
	if(o.selectedIndex)o.selectedIndex=0;
	if(o.old!=void(0))o.innerHTML=o.old;
},
search:function(n,o){
if(!Search[n])
Search[n]={
	name:n,
	all:{},
	control:[],
	select:function(){
		try	{
			var p=this.xml();
			for (var i=0;i<this.control.length;i++) Control[this.control[i]].select(p);
		}
		catch(e){alert(e.message)}
	},
	reset:function(){for(var e in this.all) F.reset(this.all[e])},
	xml:function(){
		var p="";
		for(var e in this.all)
		{	
			var t=F.getValue(this.all[e]);
			if(t)p+="<"+e+">"+ F.xmlInbox(t)+"</"+e+">";
		}
		return p;
	},
	init:function(o){
		var n=o.getAttribute("name"),t;
		if(t=o.getAttribute("para"))
		{
			eval("t={"+t+"}");
			for(var e in t)
			{	var v=t[e];
				this.all[e]={gd:function(){return v}};
			}
		}
		if(t=o.getAttribute("act"))
		{	o.setAttribute("root",this.name);
			if(t=="reset") o.onclick=function(){Search[this.getAttribute("root")].reset()};
			else o.onclick=function(){Search[this.getAttribute("root")].select()};
		}
		else if(n)
		{	F.assign(o,this);
			this.all[n]=o;
			if(F.query[n])o.set(F.query[n]);
		}
		if(o.getAttribute("group"))return;
		for(var i=0;i<o.childNodes.length;i++)if(o.childNodes[i].nodeType==1)this.init(o.childNodes[i]);
	}};
	Search[n].init(o);
},
control:function(n,o,b){
	if(!Control[n])
	Control[n]={
		name:n,
		busy:false,
		all:{},
		para:{},
		info:{},
		cache:{},
		control:{},
		table:{},
		init:function(o){	
				var t;
				if(o.id.indexOf("warn_")>=0){
					o.old=o.innerHTML;
					this.info[o.id]=o;
				}
				if(t=o.getAttribute("search")) return F.search(t,o);
				if(t=o.getAttribute("act"))
				{
					o.setAttribute("root",this.name);
					if(t=="reset")return o.onclick=function(){
						this.blur();
						var c=Control[this.getAttribute("root")];
						c.source=this;
						c.reset();
						return false;};
					else if(t=="key")return o.onclick=function(){
						this.blur();
						var c=Control[this.getAttribute("root")],p=F.getValue(c.key);
						c.source=this;
						c.act(p);
						return false};
					else if(t=="keylist")return o.onclick=function(){
						this.blur();
						var c=Control[this.getAttribute("root")],p=c.keylist();
						c.source=this;
						c.act(p);
						return false};
					else return o.onclick=function(){
						this.blur();
						var c=Control[this.getAttribute("root")];
						c.source=this;
						c.submit();
						return false};
				}
				var n=o.getAttribute("name");
				if(o.getAttribute("list"))
				{	if(t=o.tHead){
					for(var i=0;i<t.childNodes.length;i++)if(t.childNodes[i].nodeType==1)this.init(t.childNodes[i])};
					if(t=o.tFoot){
					for(var i=0;i<t.childNodes.length;i++)if(t.childNodes[i].nodeType==1)this.init(t.childNodes[i])};
					return this.all[n]=F.list(n,o,this);
				}
				switch(t=o.getAttribute("group"))
				{	case "page":
						var l=o.getElementsByTagName("IMG");
						for(var i=0;i<l.length;i++)
						{	l[i].setAttribute("root",this.name);
							l[i].onmousedown=function(){this.parentNode.bgColor="#FF9900"};
							l[i].onmouseup=function(){this.parentNode.bgColor="#EEEEEE"};
							l[i].onclick=i==0?
							function(){var c=Control[this.getAttribute("root")],p=parseInt(F.getValue(c.all.page));c.page(isNaN(p)?1:p+1)}:
							function(){var c=Control[this.getAttribute("root")],p=parseInt(F.getValue(c.all.page));c.page(isNaN(p)?1:p-1)};
						}
						l=o.getElementsByTagName("INPUT")[0];
						l.setAttribute("root",this.name);
						l.onkeypress=function(e){e=window.event||e;var code=e.keyCode||e.which;if(code!=13) return;var c=Control[this.getAttribute("root")],p=parseInt(this.value);c.page(isNaN(p)?1:p)};
						break;
					case "pageturn":
						o.setAttribute("root",this.name);
						o.set=function(s){
							this.innerHTML="";
							if(!s)return;
							s=s.split("|");
							var c=Control[this.getAttribute("root")],p=parseInt(s[0]),n=parseInt(s[1]);
							if (!n) return;
							if (n==1) return this.innerHTML="<font color=#ff0000>共 1 页</font>";
							var q=parseInt(o.getAttribute("scale"));
							if(!q)q=5;
							var p1=p-q<1?1:p-q,p2=p+q>n?n:p+q;
							for(var i=p1-1;i<=p2+1;i++)
							{	var b=(p==i);
								var a=this.appendChild(document.createElement(b?"span":"a"));
								if(b)
								{	a.style.fontWeight="bold";
									a.style.color="#F00";
								}
								else
								{	a.className="link";
									a.href=".";
									if(i==p1-1)a.onclick=function(){c.page(1);return false};
									else if(i==p2+1)a.onclick=function(){c.page(n);return false};
									else{a.p=i;a.onclick=function(){c.page(this.p);return false}};
								}
								if(i==p1-1)a.innerHTML="首页";
								else if(i==p2+1)a.innerHTML="尾页";
								else a.innerHTML="["+i+"]";
								this.appendChild(document.createTextNode(" "));
							}
						}
						this.all["pageturn"]=o;
						return;
				}
				if(n){ F.assign(o); this.all[n]=o;}
				if(o.id=="key") this.key=o;
				if(!o.getAttribute("group") || o.getAttribute("group")=="page")
				for(var i=0;i<o.childNodes.length;i++)if(o.childNodes[i].nodeType==1)this.init(o.childNodes[i]);
		},
		keylist:function(){
			var t;
			for(var e in this.table){if(!(t=List[this.table[e]]).father) return t.keylist()}
		},
		selected:function(){
			var t;
			for(var e in this.table){if(!(t=List[this.table[e]]).father) return t.selected()}
		},
		act:function(p){
			if(this.busy)return;
			if(!Act_Before(this.source,this,p)) return;
			this.busy=true;
			try{Service.call(this.source.getAttribute("cmd"),"<id>"+F.xmlInbox(p)+"</id>",this)}
			catch(e){this.abort(e)}
		},
		submit:function(){
			if(this.busy)return;
			var p={},t,i=0;
			try
			{	for(var e in this.all)if((t=F.get(this.all[e]))!=null){p[e]=t;i++;}
				for(var e in this.para) if(!p[e]&&this.para[e]) p[e]=this.para[e];
				if(!Act_Before(this.source,this,p)) return;
				if(i==0)throw {message:"您还没有修改任何信息，不能提交空表单！"}
				this.busy=true;
				var s=""
				for(var e in p) s+=" " + e + "=\"" + F.xmlInbox(p[e]) + "\"";
				Service.call(this.source.getAttribute("cmd"),"<data><row"+s+"/></data>",this);
			}
			catch(e){this.abort(e)}
			return false;
		},
		page:function(p){this.fresh(p)},
		abort:function(e){
			this.source=null;
			this.busy=false;
			alert(e.message);
		},
		fresh:function(p){
			if(this.busy)return;
			if(!Select_Before(this)) return;
			this.busy=true;
			this.action="select";
			var t;
			if(p)
			{	if(this.all.page)this.all.page.set(p);
				for(var e in this.table)if(!List[e].father)List[e].wait();
			}
			var s="";
			for(var e in this.all)
			switch(e)
			{	case "page":
				case "pagesize":
				case "maxcount":
				case "order":
					s+="<"+e+">"+F.getValue(this.all[e])+"</"+e+">";				
			}
			try{Service.call(this.cmd,"<para>"+this.oldpara+s+"</para>",this,true)}
			catch(e){this.abort(e)}
		},
		paraxml:function(){
			var p="";
			for(var e in this.para)p+="<"+e+">"+this.para[e]+"</"+e+">";
			return p;
		},
		select:function(s){
			if(this.busy)return;
			if(!s)s=this.search?Search[this.search].xml():"";
			s+=this.paraxml();
			this.oldpara=s;
			if(t=this.all.maxcount)t.set(0);
			this.fresh(1);
		},
		reset:function(){
			for(var e in this.all)F.reset(this.all[e]);
			for(var e in this.info)F.reset(this.info[e]);
		},
		adapt:function(d){
			if(this.action=="select"){
				for(var e in this.all)
					this.all[e].set(d[e]!=null?d[e]:((e=="page"||e=="pagesize"||e=="maxcount"||e=="maxpage")?0:""));
				this.action="";
				this.busy=false;
				Select_After(this,d);
			}
			else{
				for(var e in d) if(this.all[e])this.all[e].set(d[e]);
				this.action="";
				this.busy=false;
				Act_After(this.source,this,d);
			}
			this.source=null;
			if(this.all.validcode)
			{	this.all.validcode.set("");
				var t=document.getElementById("validpic");
				t.src=t.src;
			}
		}
		};
	var c=Control[n];
	if(o.getAttribute("control"))
	{
		var t;
		if(t=o.getAttribute("cmd"))c.cmd=t;
		if(t=o.getAttribute("select")){c.cmd=t;c.auto=true;}
		if(t=o.getAttribute("para"))eval("c.para="+t);
		if(!(t=o.getAttribute("key")))t="common";
		if(t!="none") c.search=t;
	}
	c.init(o);
},
list:function(n,o,p){
	if(!List[n])
	List[n]={
		name:n,
		ref:o,
		base:[],
		col:1,
		row:[],
		all:[],
		wait:function(b){
			var s=this.ref.tBodies;
			if(s[1]||s[2])
			{
				if(s[2])s[2].style.display=b?"none":"";
				s[0].style.display=b==1?"":"none";
				s[1].style.display=b==2?"":"none";
			}
		},
		kind:o.getAttribute("list"),
		init:function(o,k){
			if(!this.all[k])this.all[k]=[];
			var n=o.getAttribute("act");
			if(n=="key")
			{   o.setAttribute("root",this.name);
				o.setAttribute("line",k);
				return o.onclick=function(){
					var l=List[this.getAttribute("root")],k=parseInt(this.getAttribute("line")),p=F.getValue(l.all[k][l.key]);
					l.source=this;
					l.act(k,p);
					return false;
				};
			}
			else if(n=="submit")
			{   o.setAttribute("root",this.name);
				o.setAttribute("line",k);
				return o.onclick=function(){
					var l=List[this.getAttribute("root")],k=parseInt(this.getAttribute("line"));
					l.source=this;
					l.submit(k);
					return false;
				};				
			}
			if(n=o.getAttribute("name"))
			{	if(o.getAttribute("list"))
				{	(this.all[k][n]=F.list(n,o,p)).father=this.name;
					if(n=o.tHead){
					for(var i=0;i<n.childNodes.length;i++)if(n.childNodes[i].nodeType==1)this.init(n.childNodes[i],k)};
					if(n=o.tFoot){
					for(var i=0;i<n.childNodes.length;i++)if(n.childNodes[i].nodeType==1)this.init(n.childNodes[i],k)};
					return;
				}
				F.assign(o);
				if(o.id=="key")this.key=n;
				this.all[k][n]=o;
			}
			for(var i=0;i<o.childNodes.length;i++)if(o.childNodes[i].nodeType==1)this.init(o.childNodes[i],k);
		},
		act:function(k,p){
			if(this.busy)return;
			if(!Act_Before(this.source,this.all[k],p)) return;
			var cmd=this.source.getAttribute("cmd");
			if(!cmd)return;
			this.busy=true;
			this.line=k;
			try{Service.call(cmd,"<id>"+F.xmlInbox(p)+"</id>",this)}
			catch(e){this.abort(e)}
		},
		submit:function(k){
			if(this.busy)return;
			var p={},t,i=0;
			try
			{
				for(var e in this.all[k])if((t=F.get(this.all[k][e]))!=null){p[e]=t;i++;}
				if(!Act_Before(this.source,this.all[k],p)) return;
				if(i==0)throw {message:"您还没有修改任何信息，不能提交空表单！"};
				this.busy=true;
				this.line=k;
				var s=""
				for(var e in p) s+=" " + e + "=\"" + F.xmlInbox(p[e]) + "\"";
				Service.call(this.source.getAttribute("cmd"),"<data><row"+s+"/></data>",this);
			}
			catch(e){this.abort(e)}
		},
		abort:function(e){
			this.source=null;
			this.busy=false;
			alert(e.message);
		},
		adapt:function(d){
			for(var e in d)
			{	if(this.all[this.line][e])this.all[this.line][e].set(d[e]);	}
			this.busy=false;
			Act_After(this.source,this.all[this.line],d);
			this.source=null;
		},
		gen:function(m){
				var b=this.base,u=this.row.length,c=this.col;
				if(this.kind=="grid")
				{
					for(var i=u;i<m;i++)
					{	var k=Math.floor(i/c);
						if(k>=this.row.length)	this.row[k]=b[0].root.appendChild(b[0].ref.cloneNode(true));
						for(var j=0;j<c;j++) this.init(this.row[k].cells[j],i*c+j);
					}
				}
				else
				{
					for(var i=u;i<m;i++)
					{	this.row[i]=[];
						for(var j=0;j<b.length;j++)
						{	var tr=b[j].root.appendChild(b[j].ref.cloneNode(true));
							tr.className=i%2==0?"r1":"r2";
							this.init(this.row[i][j]=tr,i);
						}
					}
				}
		},
		selected:function(){
			var p=[];
			if(!this.key)return p;
			for(var i=0;i<this.all.length;i++)
				if(this.all[i][this.key].checked && this.all[i][this.key].value) p[p.length]=this.all[i];
			return p;
		},
		keylist:function(){
			var p=this.selected(),s="";
			for(var e in p)s+=F.get(p[e][this.key])+",";
			return s.substring(0,s.length-1);
		},
		set:function(v){
				var r=this.row,c=this.col,l=0;
				for(var e in v){l=v[e].length;break};
				if(l==0)return this.wait(2);
				if(this.all.length<l) this.gen(l);
				for(var i=0;i<this.all.length;i++){
					for(var e in this.all[i]) this.all[i][e].set(i<l&&v[e]?v[e][i]:"");
				}
				l=Math.floor((l-1)/c)+1;
				var k=0;
				for(;k<l;k++)for(var j=0;j<r[k].length;j++) r[k][j].style.display="";
				for(;k<r.length;k++)for(var j=0;j<r[k].length;j++) r[k][j].style.display="none";
				this.wait(1);
		}
	};
	var t=List[n],h=o.tBodies[0],l=h.childNodes,b=h.rows[0].bgColor,w=h.rows[0].cells.length;
	switch(t.kind)
	{	case "flat":
			for(var i=0;i<l.length;i++)
			{	if(l[i].nodeType==1)
					t.base[t.base.length]={root:l[i],ref:l.removeChild(l[i].cells[1])};
			}
			break;
		case "grid":
			var tr=h.rows,k=0;
			for(var i=0;i<tr.length;i++)
			{	t.row[i]=[tr[i]];
				var td=tr[i].cells;
				for(var j=0;j<td.length;j++){t.init(td[j],k);k++}
				if(i==0)t.col=td.length;
				t.base[t.base.length]={root:h,ref:tr[i]};
			}
			break;
		default:
			while(l.length>0)
			{	var e=h.removeChild(l[0]);
				if(e.nodeType==1)
					t.base[t.base.length]={root:h,ref:e};
			}
			break;
	};
	if(o.getAttribute("loading"))
	{	var u=o.tBodies.length,m=(m=o.getAttribute("min"))?parseInt(m):200,
		f=function(s){
			var p=o.insertBefore(document.createElement("tbody"),o.tFoot),v=p.appendChild(document.createElement("tr")).appendChild(document.createElement("td"));
			p.style.display="none";
			v.colSpan=w;
			if(b)v.bgColor=b;
			v.vAlign="middle";
			v.align="center";
			v.style.height=m+"px";
			v.innerHTML=s;
		};
		if(u<2)f("<div style='font-size:20px;color:#999;letter-spacing:15px;line-height:40px;text-align:center'>您输入的内容没有被列入查询范围<br/>请尝试其他条件查询</div>");
		if(u<3)f("<div style='letter-spacing:1px;line-height:24px'>服务器正在传送数据，请稍候..<br/><img src='/js/pic/loading.gif' width=187 height=10></div>");
	}
	if(!p.table[n])p.table[n]=t.name;
	return t;
}};
F.query=F.split(location.search.replace("?",""));
function init(o){
	if(Cookie.get("islogin")!="ok") Login_Before();
	if(!o)o=document.body;
	initLoop(o);
	for(var e in Control){
		var c=Control[e];
		if(c.search){
			if(Search[c.search])Search[c.search].control[Search[c.search].control.length]=e;
			else c.search=void(0);
		}
		if(c.cmd&&c.auto)c.select();
	}
};
function initLoop(o){
	var n;
	if(n=o.getAttribute("control"))F.control(n,o);
	else if(n=o.getAttribute("search")) F.search(n,o);
	else {for(var i=0;i<o.childNodes.length;i++)if(o.childNodes[i].nodeType==1)initLoop(o.childNodes[i]);}
};
function selectAll(n,o){
var l=document.getElementById(n).tBodies[0].getElementsByTagName("INPUT");
for(var i=0;i<l.length;i++)if(l[i].id=="key"&&l[i].type=="checkbox")l[i].checked=o.checked?true:false;
}