var CONTEXTPATH = '/';
//是否为IE浏览器
var isIE=navigator.userAgent.toLowerCase().indexOf("msie")!=-1;
//是否为IE6浏览器
var isIE6=navigator.userAgent.toLowerCase().indexOf("msie 6.0")!=-1;
//是否为IE7浏览器
var isIE7=navigator.userAgent.toLowerCase().indexOf("msie 7.0")!=-1&&!window.XDomainRequest;
//是否为IE8浏览器
var isIE8=!!window.XDomainRequest;
//是否为Mozilla系列浏览器
var isGecko=navigator.userAgent.toLowerCase().indexOf("gecko")!=-1;
//判断浏览器兼容模式
var isQuirks=document.compatMode=="BackCompat";
if(isGecko){//如果是Mozilla系列浏览器 添加IE独有的属性及方法
	var p=HTMLElement.prototype;
	p.__defineSetter__("innerText",function(a){
		this.textContent=a;
	});
	p.__defineGetter__("innerText",function(){
		return this.textContent;
	});
	p.insertAdjacentElement=function(a,b){
		switch(a){
			case"beforeBegin":this.parentNode.insertBefore(b,this);break;
			case"afterBegin":this.insertBefore(b,this.firstChild);break;
			case"beforeEnd":this.appendChild(b);break;
			case"afterEnd":
				if(this.nextSibling){
					this.parentNode.insertBefore(b,this.nextSibling);
				}else{
					this.parentNode.appendChild(b);
				}
				break;
		}
	};
	p.insertAdjacentHTML=function(b,d){
		var c=this.ownerDocument.createRange();
		c.setStartBefore(this);
		var a=c.createContextualFragment(d);
		this.insertAdjacentElement(b,a);
	};
	p.attachEvent=function(b,a){
		b=b.substring(2);
		this.addEventListener(b,a,false);
	};
	p.detachEvent=function(b,a){
		b=b.substring(2);
		this.removeEventListener(b,a,false);
	};
	p.__defineGetter__("currentStyle",function(){
		return this.ownerDocument.defaultView.getComputedStyle(this,null);
	});
	p.__defineGetter__("children",function(){
		var b=[];
		for(var a=0;a<this.childNodes.length;a++){
			var c=this.childNodes[a];
			if(c.nodeType==1){
				b.push(c);
			}
		}
		return b;
	});
	p.__defineSetter__("outerHTML",function(b){
		var a=this.ownerDocument.createRange();
		a.setStartBefore(this);
		var c=a.createContextualFragment(b);
		this.parentNode.replaceChild(c,this);
		return b;
	});
	p.__defineGetter__("outerHTML",function(){
		var a;
		var b=this.attributes;
		var d="<"+this.tagName.toLowerCase();
		for(var c=0;c<b.length;c++){
			a=b[c];
			if(a.specified){
				d+=" "+a.name+'="'+a.value+'"';
			}
		}
		if(!this.hasChildNodes){
			return d+">";
		}
		return d+">"+this.innerHTML+"</"+this.tagName.toLowerCase()+">";
	});
	p.__defineGetter__("canHaveChildren",function(){
		switch(this.tagName.toLowerCase()){
			case"area":
			case"base":
			case"basefont":
			case"col":
			case"frame":
			case"hr":
			case"img":
			case"br":
			case"input":
			case"isindex":
			case"link":
			case"meta":
			case"param":
				return false;
		}
		return true;
	});
	Event.prototype.__defineGetter__("srcElement",function(){
		var a=this.target;
		while(a.nodeType!=1){
			a=a.parentNode;
		}
		return a;
	});
	p.__defineGetter__("parentElement",function(){
		if(this.parentNode==this.ownerDocument){
			return null;
		}
		return this.parentNode;
	});
}else{
	try{
		//如果是IE浏览器开启本地存储
		document.documentElement.addBehavior("#default#userdata");
		//背景图进行缓存
		document.execCommand("BackgroundImageCache",false,true);
	}catch(e){
		alert(e);
	}
}


//重写setTimeout使其可以传递参数
var _setTimeout=setTimeout;
window.setTimeout=function(f,c,d){
	var b=Array.prototype.slice.call(arguments,2);
	var a=function(){
		f.apply(null,b);
	};
	return _setTimeout(a,c);
};

//给对象附加方法
var Core={};
Core.attachMethod=function(b){
	if(!b||b["$A"]){
		return;
	}
	if(b.nodeType==9){
		return;
	}
	var c;
	try{
		if(isGecko){
			c=b.ownerDocument.defaultView;
		}else{
			c=b.ownerDocument.parentWindow;
		}
		for(var d in $ES){
			b[d]=c.$ES[d];
		}
	}catch(a){
	}
};

//常量
var Constant={};
Constant.Null="_POTUKER_NULL";

//ID对象选择器
function $(a){
	if(typeof(a)=="string"){
		a=document.getElementById(a);
		if(!a){
			return null;
		}
	}
	if(a){
		Core.attachMethod(a);
	}
	return a;
}
//获取表单远素值
function $V(b){
	var a=b;
	b=$(b);
	if(!b){
		alert("表单元素不存在:"+a);
		return null;
	}
	switch(b.type.toLowerCase()){
		case"submit":
		case"hidden":
		case"password":
		case"textarea":
		case"file":
		case"image":
		case"select-one":
		case"text":
			return b.value;
		case"checkbox":
		case"radio":
			if(b.checked){
				return b.value;
			}else{
				return null;
			}
		default:
			return"";
	}
}
//设置表单元素值
function $S(c,b){
	var a=c;
	c=$(c);
	if(!b&&b!=0){
		b="";
	}
	if(!c){
		alert("表单元素不存在:"+a);
		return;
	}
	switch(c.type.toLowerCase()){
		case"submit":
		case"hidden":
		case"password":
		case"textarea":
		case"button":
		case"file":
		case"image":
		case"select-one":
		case"text":
			c.value=b;
			break;
		case"checkbox":
		case"radio":
			if(c.value==""+b){
				c.checked=true;
			}else{
				c.checked=false;
			}
			break;
	}
}
//标记对象选择器
function $T(d,g){
	g=$(g);
	g=g||document;
	var f=g.getElementsByTagName(d);
	var b=[];
	var a=f.length;
	for(var c=0;c<a;c++){
		b.push($(f[c]));
	}
	return b;
}
//名字对象选择器
function $N(c){
	if(typeof(c)=="string"){
		c=document.getElementsByName(c);
		if(!c||c.length==0){
			return null;
		}
		var a=[];
		for(var b=0;b<c.length;b++){
			var d=c[b];
			if(d.getAttribute("ztype")=="select"){
				d=d.parentNode;
			}
			Core.attachMethod(d);
			a.push(d);
		}
		c=a;
	}
	return c;
}
//名子获取表单元素值
function $NV(d){
	d=$N(d);
	if(!d){
		return null;
	}
	var a=[];
	for(var c=0;c<d.length;c++){
		var b=$V(d[c]);
		if(b!=null){
			a.push(b);
		}
	}
	return a.length==0?null:a;
}
//名子设置表单元素值
function $NS(f,d){
	f=$N(f);
	if(!f){
		return;
	}
	if(!f[0]){
		return $S(f,d);
	}
	if(f[0].type=="checkbox"){
		if(d==null){
			d=new Array(4);
		}
		var a=d;
		if(!isArray(d)){
			a=d.split(",");
		}
		for(var b=0;b<a.length;b++){
			for(var c=0;c<f.length;c++){
				if(f[c].checked){
					continue;
				}
				$S(f[c],a[b]);
			}
		}
		return;
	}
	for(var c=0;c<f.length;c++){
		$S(f[c],d);
	}
}
//获取表单
function $F(a){
	if(!a){
		return document.forms[0];
	}else{
		a=$(a);
		if(a&&a.tagName.toLowerCase()!="form"){
			return null;
		}
		return a;
	}
}
//URL编码
function encodeURL(a){
	return encodeURI(a).replace(/=/g,"%3D").replace(/\+/g,"%2B").replace(/\?/g,"%3F").replace(/\&/g,"%26");
}
//HTML编码
function htmlEncode(a){
	return a.replace(/&/g,"&amp;").replace(/\"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/ /g,"&nbsp;");
}
//HTML解码
function htmlDecode(a){
	return a.replace(/\&quot;/g,'"').replace(/\&lt;/g,"<").replace(/\&gt;/g,">").replace(/\&nbsp;/g," ").replace(/\&amp;/g,"&");
}
//是否为INT类型
function isInt(a){
	return/^\-?\d+$/.test(""+a);
}
//是否为数字
function isNumber(d){
	var b=""+d;
	for(var a=0;a<d.length;a++){
		var c=d.charAt(a);
		if(c!="."&&c!="E"&&isNaN(parseInt(c))){
			return false;
		}
	}
	return true;
}
//是否为Undefined
function isUndefined(variable) {
	return typeof variable == 'undefined' ? true : false;
}
//是否为时间
function isTime(c){
	var a=c.split(":");
	if(a.length!=3){
		return false;
	}
	var b=new Date();
	b.setHours(a[0]);
	b.setMinutes(a[1]);
	b.setSeconds(a[2]);
	return b.toString().indexOf("Invalid")<0;
}
//是否为日期
function isDate(c){
	var a=c.split("-");
	if(a.length!=3){
		return false;
	}
	var b=new Date();
	b.setFullYear(a[0]);
	b.setMonth(a[1]);
	b.setDay(a[2]);
	return b.toString().indexOf("Invalid")<0;
}
//是否为数组
function isArray(a){
	if(!a){
		return false;
	}
	if(a.constructor.toString().indexOf("Array")==-1){
		return false;
	}else{
		return true;
	}
}
//获取事件
function getEvent(a){
	return window.event||a;
}
//停止事件
function stopEvent(a){
	a=getEvent(a);
	if(!a){
		return;
	}
	if(isGecko){
		//a.preventDefault();
		a.stopPropagation();
	}
	a.cancelBubble=true;
	a.returnValue=false;
}
//停止部分事件
function stopPartEvent(a){
	a=getEvent(a);
	if(!a){
		return;
	}
	if(isGecko){
		a.stopPropagation();
	}
	a.cancelBubble=true;
}
//取消事件
function cancelEvent(a){
	a=getEvent(a);
	a.cancelBubble=true;
}
//获取事件上方位
function getEventPosition(b){
	b=getEvent(b);
	var f={x:b.clientX,y:b.clientY};
	var d;
	if(isGecko){
		d=b.srcElement.ownerDocument.defaultView;
	}else{
		d=b.srcElement.ownerDocument.parentWindow;
	}
	var a,c;
	while(d!=d.parent){
		if(d.frameElement){
			pos2=$ES.getPosition(d.frameElement);
			f.x+=pos2.x;
			f.y+=pos2.y;
		}
		a=Math.max(d.document.body.scrollLeft,d.document.documentElement.scrollLeft);
		c=Math.max(d.document.body.scrollTop,d.document.documentElement.scrollTop);
		f.x-=a;
		f.y-=c;
		d=d.parent;
	}
	return f;
}
//转成XML对象
function toXMLDOM(a){
	var f;
	try{
		try{
			f=new ActiveXObject("Microsoft.XMLDOM");
		}catch(b){
			f=new ActiveXObject("Msxml2.DOMDocument");
		}
		f.loadXML(a);
	}catch(d){
		var c=new DOMParser();
		f=c.parseFromString(a,"text/xml");
	}
	return f;
}

//锁定图片大小
function changeImgSize(obj,maxImageWidth,maxImageHeight){
	//$(obj).$A("resized","1");
	if($(obj).$A("width") > $(obj).$A("height")){
		if($(obj).$A("width") > maxImageWidth){
			$(obj).style.width = maxImageWidth;
		}
	}else{
		if($(obj).$A("height") > maxImageHeight){
			$(obj).style.height = maxImageHeight;
		}
	}
}
//为String添加是否开始包含
String.prototype.startWith=function(a){
	return this.indexOf(a)==0;
};
//为String添加是否结束包含
String.prototype.endWith=function(a){
	return this.charAt(this.length-1)==a;
};
//为String添加忽略空格
String.prototype.trim=function(){
	return this.replace(/(^\s*)|(\s*$)/g,"");
};
//为String添加左边添加
String.prototype.leftPad=function(g,f){
	if(!isNaN(f)){
		var b="";
		for(var d=this.length;d<f;d++){
			b=b.concat(g);
		}
		b=b.concat(this);
		return b;
	}
	return null;
};
//为String添加右边添加
String.prototype.rightPad=function(g,f){
	if(!isNaN(f)){
		var b=this;
		for(var d=this.length;d<f;d++){
			b=b.concat(g);
		}
		return b;
	}
	return null;
};
//为Array添加复制方法
Array.prototype.clone=function(){
	var a=this.length;
	var c=[];
	for(var b=0;b<a;b++){
		if(typeof(this[b])=="undefined"||this[b]==null){
			c[b]=this[b];
			continue;
		}
		if(this[b].constructor==Array){
			c[b]=this[b].clone();
		}else{
			c[b]=this[b];
		}
	}
	return c;
};
//为Array添加插入方法
Array.prototype.insert=function(b,d){
	if(isNaN(b)||b<0||b>this.length){
		this.push(d);
	}else{
		var a=this.slice(b);
		this[b]=d;
		for(var c=0;c<a.length;c++){
			this[b+1+c]=a[c];
		}
	}
	return this;
};
//为Array添加移除方法
Array.prototype.remove=function(b){
	for(var a=0;a<this.length;a++){
		if(b==this[a]){
			this.splice(a,1);
		}
	}
};
//为Array添加迭代方法
Array.prototype.each=function(d){
	var a=this.length;
	for(var c=0;c<a;c++){
		try{
			d(this[c],c);
		}catch(b){
			alert("Array.prototype.each:"+b.message);
		}
	}
};

var Form={};
//设置表单值
Form.setValue=function(d,b){
	b=$F(b);
	for(var a=0;a<b.elements.length;a++){
		var g=$(b.elements[a]);
		if(g.$A("ztype")=="select"){
			g=g.parentElement;
		}
		if(g.type=="checkbox"||g.type=="radio"){
			if(g.name){
				$NS(g.name,d.get(g.name));
				continue;
			}
		}
		var f=g.id.toLowerCase();
		if(d.get(f)){
			$S(g,d.get(f));
		}
	}
};
//获取表单数据
Form.getData=function(g){
	g=$F(g);
	if(!g){
		alert("查找表单元素失败!"+g);
		return;
	}
	var d=new DataCollection();
	var b=g.elements;
	for(var f=0;f<b.length;f++){
		var h=$(b[f]);
		var a=h.id;
		if(!h.type){
			continue;
		}
		if(h.type=="checkbox"||h.type=="radio"){
			if(h.name){
				d.add(h.name,$NV(h.name));
				continue;
			}
		}
		if(!a){
			continue;
		}
		if(h.$A("ztype")=="select"){
			h=h.parentElement;
		}
		d.add(h.id,$V(h));
	}
	return d;
};
var $ES={};
//获取对象属性
$ES.$A=function(a,b){
	b=b||this;
	b=$(b);
	return b.getAttribute?b.getAttribute(a):null;
};
//标记获取对象子对象
$ES.$T=function(a,b){
	b=b||this;
	b=window.$(b);
	return window.$T(a,b);
};
//对象是否隠藏
$ES.visible=function(a){
	a=a||this;
	a=$(a);
	if(a.style.display=="none"){
		return false;
	}
	return true;
};
//对象状态
$ES.toggle=function(a){
	a=a||this;
	a=$(a);
	$ES[$ES.visible(a)?"hide":"show"](a);
};
//对象转成字符串
$ES.toString=function(b,d,h){
	h=h||this;
	var a=[];
	var g=0;
	for(var j in h){
		if(!d||g>=d){
			var c=null;
			try{
				c=h[j];
			}catch(f){
			}
			if(!b){
				if(typeof(c)=="function"){
					c="function()";
				}else{
					if((""+c).length>100){
						c=(""+c).substring(0,100)+"...";
					}
				}
			}
			a.push(j+":"+c);
		}
		g++;
	}
	return a.join("\n");
};
//对象隠藏
$ES.hide=function(a){
	a=a||this;
	a=$(a);
	a.style.display="none";
};
//对象获取焦点
$ES.focusEx=function(b){
	b=b||this;
	b=$(b);
	try{
		b.focus();
	}catch(a){
	}
};
//对象显示
$ES.show=function(a){
	a=a||this;
	a=$(a);
	a.style.display="";
};
//获取对象表单
$ES.getForm=function(a){
	a=a||this;
	a=$(a);
	if(isIE){
		a=a.parentElement;
	}else{
		if(isGecko){
			a=a.parentNode;
		}
	}
	if(!a){
		return null;
	}
	if(a.tagName.toLowerCase()=="form"){
		return a;
	}else{
		return $ES.GetForm(a);
	}
};
//禁用对象
$ES.disable=function(d){
	d=d||this;
	d=$(d);
	if(d.tagName.toLowerCase()=="form"){
		var c=d.elements;
		for(var b=0;b<c.length;b++){
			var a=c[b];
			d.blur();
			d.disabled="true";
		}
	}else{
		d.disabled="true";
	}
};
//启用对象
$ES.enable=function(d){
	d=d||this;
	d=$(d);
	if(d.tagName.toLowerCase()=="form"){
		var c=d.elements;
		for(var b=0;b<c.length;b++){
			var a=c[b];d.disabled="";
		}
	}else{
		d.disabled="";
	}
};

var proy;
//动态改变高度
$ES.changeHeight=function(startNum,endNum){	
	var p = $(this);
	p.style.height=startNum+'px';
	if(startNum<endNum){
		proy = setInterval(function(){changeAddition(p,endNum)},10);
	}else{
		proy = setInterval(function(){changedecrease(p,endNum)},10);
	}
};
function changeAddition(p,y) {
	var cy = parseInt(p.style.height,10);
	if(cy<y) {
		p.style.height = (cy + Math.ceil((y-cy)/5))+"px";
	} else {
		clearInterval(proy);
	}
}
function changedecrease(p,y) {
	var cy = parseInt(p.style.height,10);
	if(cy>y) {
		if((cy - Math.ceil(cy/5))>=y){
			p.style.height = (cy - Math.ceil(cy/5)) +"px";
		}else{
			p.style.height = y +"px";
		}
	} else {
		clearInterval(proy);
	}
}

//屏幕滚动到对象
$ES.scrollTo=function(b){
	b=b||this;
	b=$(b);
	var a=b.x?b.x:b.offsetLeft,c=b.y?b.y:b.offsetTop;
	window.scrollTo(a,c);
};
//获取对象尺寸
$ES.getDimensions=function(g){
	g=g||this;
	g=$(g);
	var j;
	if(g.tagName.toLowerCase()=="script"){
		j={width:0,height:0};
	}else{
		if($ES.visible(g)){
			if(isIE&&g.offsetWidth==0&&g.offsetHeight==0){
				j={width:g.currentStyle.width.replace(/\D/g,""),height:g.currentStyle.height.replace(/\D/g,"")};
			}else{
				j={width:g.offsetWidth,height:g.offsetHeight};
			}
		}else{
			var d=g.style;
			var f=d.visibility;
			var k=d.position;
			var b=d.display;
			d.visibility="hidden";
			d.position="absolute";
			d.display="block";
			var a=g.clientWidth;
			var c=g.clientHeight;
			d.display=b;
			d.position=k;
			d.visibility=f;
			j={width:a,height:c};
		}
	}
	return j;
};
//获取对象方位
$ES.getPosition=function(m){
	m=m||this;
	m=$(m);
	var k=m.ownerDocument;
	if(m.parentNode===null||m.style.display=="none"){
		return false;
	}
	var l=null;
	var j=[];
	var g;
	if(m.getBoundingClientRect){
		g=m.getBoundingClientRect();
		var c=Math.max(k.documentElement.scrollTop,k.body.scrollTop);
		var d=Math.max(k.documentElement.scrollLeft,k.body.scrollLeft);
		var b=g.left+d-k.documentElement.clientLeft;
		var a=g.top+c-k.documentElement.clientTop;
		if(isIE){
			b--;
			a--;
		}
		return{x:b,y:a};
	}else{
		if(k.getBoxObjectFor){
			g=k.getBoxObjectFor(m);
			var h=(m.style.borderLeftWidth)?parseInt(m.style.borderLeftWidth):0;
			var f=(m.style.borderTopWidth)?parseInt(m.style.borderTopWidth):0;
			j=[g.x-h,g.y-f];
		}
	}
	if(m.parentNode){
		l=m.parentNode;
	}else{
		l=null;
	}
	while(l&&l.tagName!="BODY"&&l.tagName!="HTML"){
		j[0]-=l.scrollLeft;
		j[1]-=l.scrollTop;
		if(l.parentNode){
			l=l.parentNode;
		}else{
			l=null;
		}
	}
	return{x:j[0],y:j[1]};
};
//获取对象方位2
$ES.getPositionEx=function(c){
	c=c||this;
	c=$(c);
	var f=$ES.getPosition(c);
	var d=window;
	var a,b;
	while(d!=d.parent){
		if(d.frameElement){
			pos2=$ES.getPosition(d.frameElement);
			f.x+=pos2.x;
			f.y+=pos2.y;
		}
		a=Math.max(d.document.body.scrollLeft,d.document.documentElement.scrollLeft);
		b=Math.max(d.document.body.scrollTop,d.document.documentElement.scrollTop);
		f.x-=a;
		f.y-=b;
		d=d.parent;
	}
	return f;
};
//获取对象父对象
$ES.getParent=function(a,b){
	b=b||this;
	b=$(b);
	while(b){
		if(b.tagName.toLowerCase()==a.toLowerCase()){
			return $(b);
		}
		b=b.parentElement;
	}
	return null;
};
//以属性名获取父对象
$ES.getParentByAttr=function(a,c,b){
	b=b||this;
	b=$(b);
	while(b){
		if(b.getAttribute(a)==c){
			return $(b);
		}
		b=b.parentElement;
	}
	return null;
};
//获取顶级窗口
$ES.getTopLevelWindow=function(){
	var a=window;
	while(a!=a.parent){
		a=a.parent;
	}
	return a;
};
//是否使用某样式
$ES.hasClassName=function(a,b){
	b=b||this;
	b=$(b);
	return(new RegExp(("(^|\\s)"+a+"(\\s|$)"),"i").test(b.className));
};
//添加样式
$ES.addClassName=function(b,d,c){
	c=c||this;
	c=$(c);
	var a=c.className;
	a=a?a:"";
	if(!new RegExp(("(^|\\s)"+b+"(\\s|$)"),"i").test(a)){
		if(d){
			c.className=b+((a.length>0)?" ":"")+a;
		}else{
			c.className=a+((a.length>0)?" ":"")+b;
		}
	}
	return c.className;
};
//移除样式
$ES.removeClassName=function(b,c){
	c=c||this;
	c=$(c);
	var a=new RegExp(("(^|\\s)"+b+"(?=\\s|$)"),"i");
	c.className=c.className.replace(a,"").replace(/^\s+|\s+$/g,"");
	return c.className;
};
//计算对象方位
$ES.computePosition=function(c,m,b,l,k,q,g,j){
	var o=j?j.document:document;
	var d=isQuirks?o.body.clientWidth:o.documentElement.clientWidth;
	var a=isQuirks?o.body.clientHeight:o.documentElement.clientHeight;
	var n=Math.max(o.documentElement.scrollLeft,o.body.scrollLeft);
	var f=Math.max(o.documentElement.scrollTop,o.body.scrollTop);
	if(!k||k.toLowerCase()=="all"){
		if(l-f+g-a<0){
			if(b-n+q-d<0){
				return{x:b,y:l};
			}else{
				return{x:b-q,y:l};
			}
		}
		if(c-n+q-d<0){
			return{x:c,y:m-g};
		}else{
			return{x:c-q,y:m-g};
		}
	}else{
		if(k.toLowerCase()=="right"){
			if(l-f+g-a<0){
				if(b-n+q-d<0){
					return{x:b,y:l};
				}
			}
			return{x:c,y:m-g};
		}else{
			if(k.toLowerCase()=="left"){
				if(l-f+g-a<0){
					if(b-n-q>0){
						return{x:b,y:l};
					}
				}
				return{x:c-q,y:m-g};
			}
		}
	}
};

var Server={};
Server.RequestMap={};
Server.AjaxURL="ajax_";
Server.ContextPath=CONTEXTPATH;
Server.Pool=[];
//获取XMLHttpRequest对象
Server.getXMLHttpRequest=function(){
	for(var b=0;b<Server.Pool.length;b++){
		if(Server.Pool[b][1]=="0"){
			Server.Pool[b][1]="1";
			return Server.Pool[b][0];
		}
	}
	var c;
	if(window.XMLHttpRequest){
		c=new XMLHttpRequest();
	}else{
		if(window.ActiveXObject){
			for(var b=5;b>1;b--){
				try{
					if(b==2){
						c=new ActiveXObject("Microsoft.XMLHTTP");
					}else{
						c=new ActiveXObject("Msxml2.XMLHTTP."+b+".0");
					}
				}catch(a){
				}
			}
		}
	}
	Server.Pool.push([c,"1"]);
	return c;
};
//载入网址
Server.loadURL=function(a,c){
	var b=Server.getXMLHttpRequest();
	b.open("GET",Server.ContextPath+a,true);
	b.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	b.onreadystatechange=function(){
		if(b.readyState==4&&b.status==200){
			try{
				if(c){
					c(b.responseText);
				}
			}finally{
				for(var d=0;d<Server.Pool.length;d++){
					if(Server.Pool[d][0]==b){
						Server.Pool[d][1]="0";
						break;
					}
				}
				b=null;
				c=null;
			}
		}
	};
	b.send(null);
};
//载入新角本文件
Server.loadScript=function(a){
	document.write('<script type="text/javascript" src="'+Server.ContextPath+a+'"><\/script>');
};
//载入新CSS
Server.loadCSS=function(a){
	if(isGecko){
		var b=document.createElement("LINK");
		b.rel="stylesheet";
		b.type="text/css";
		b.href=a;
		document.getElementsByTagName("HEAD")[0].appendChild(b);
	}else{
		document.createStyleSheet(a);
	}
};
//设置一个值的请求
Server.getOneValue=function(c,b,d){
	if(b&&b.prototype==DataCollection.prototype){
		Server.sendRequest(c,b,d);
	}else{
		var a=new DataCollection();
		a.add("_Param0",b);
		Server.sendRequest(c,a,d);
	}
};
//发用一个请求
Server.sendRequest=function(b,d,g,h,a){
	var f;
	if(b.indexOf(".")==-1){
		alert("请求资源出错");
		return;
	}
	var gets = b.split('.');
	if(h!=null&&Server.RequestMap[h]){
		f=Server.RequestMap[h];
		f.abort();
	}else{
		f=Server.getXMLHttpRequest();
	}
	var filename = Server.AjaxURL + gets[0];
	f.open("POST",Server.ContextPath+filename,true);
	f.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	var c="Method="+gets[1]+"&Data=";
	if(d){
		c+=encodeURL(htmlEncode(d.toXML()));
	}
	c+="&Url="+encodeURL(window.location.pathname);
	Server._ResponseDC=null;
	f.onreadystatechange=function(){
		Server.onRequestComplete(f,g);
	};
	f.send(c);
};
//处理回调函数
Server.onRequestComplete=function(Request,func){
	if(Request.readyState==4&&Request.status==200){
		try{
			var xmlDoc=Request.responseXML;
			var dc=new DataCollection();
			if(xmlDoc){
				if(dc.parseXML(xmlDoc)){
					dc.Status=dc.get("_POTUKER_STATUS");
					dc.Message=dc.get("_POTUKER_MESSAGE");
					if(dc.get("_POTUKER_SCRIPT")){
						eval(dc.get("_POTUKER_SCRIPT"));
					}
				}
				Server._ResponseDC=dc;
				xmlDoc=null;
			}else{
				dc.Status=0;
				dc.Message="服务器发生异常,未获取到数据!";
			}
			if(func){
				func(dc);
			}
		}finally{
			for(var i=0;i<Server.Pool.length;i++){
				if(Server.Pool[i][0]==Request){
					Server.Pool[i][1]="0";
					break;
				}
			}
			Request=null;
			func=null;
		}
	}
};
//获取response
Server.getResponse=function(){
	return Server._ResponseDC;
};

var Page={};
Page.clickFunctions=[];
//页面单击
Page.click=function(b){
	for(var a=0;a<Page.clickFunctions.length;a++){
		Page.clickFunctions[a](b);
	}
	if(window!=window.parent){
		window.parent.Page.click();
	}
};
//添加单击
Page.onClick=function(a){
	Page.clickFunctions.push(a);
};
//未知
Page._Sort=function(b,a){
	var d=b[1];
	var c=a[1];
	if(typeof(d)=="number"){
		if(typeof(c)=="number"){
			if(d>c){
				return 1;
			}else{
				if(d==c){
					return 0;
				}else{
					return -1;
				}
			}
		}
		return -1;
	}else{
		if(typeof(c)=="number"){
			return 1;
		}else{
			return 0;
		}
	}
};
Page.loadFunctions=[];
//页面载入
Page.load=function(){
	if(window._OnLoad){
		try{
			window._OnLoad();
		}catch(b){
		}
	}
	Page.loadFunctions.sort(Page._Sort);
	for(var a=0;a<Page.loadFunctions.length;a++){
		try{
			Page.loadFunctions[a][0]();
		}catch(b){
		}
	}
};
//添加页面载入
Page.onLoad=function(b,a){
	Page.loadFunctions.push([b,a]);
};
Page.mouseDownFunctions=[];
//鼠标按下
Page.mousedown=function(b){
	for(var a=0;a<Page.mouseDownFunctions.length;a++){
		Page.mouseDownFunctions[a](b);
	}
};
//添加鼠标按下
Page.onMouseDown=function(a){
	Page.mouseDownFunctions.push(a);
};
Page.mouseUpFunctions=[];
//鼠标弹起
Page.mouseup=function(b){
	for(var a=0;a<Page.mouseUpFunctions.length;a++){
		Page.mouseUpFunctions[a](b);
	}
};
//添加鼠标弹起
Page.onMouseUp=function(a){
	Page.mouseUpFunctions.push(a);
};
Page.mouseMoveFunctions=[];
//鼠标移动
Page.mousemove=function(b){
	for(var a=0;a<Page.mouseMoveFunctions.length;a++){
		Page.mouseMoveFunctions[a](b);
	}
};
//添加鼠标移动
Page.onMouseMove=function(a){
	Page.mouseMoveFunctions.push(a);
};
//添加相关事件
if(document.attachEvent){
	document.attachEvent("onclick",Page.click);
	document.attachEvent("onmousedown",Page.mousedown);
	window.attachEvent("onload",Page.load);
	document.attachEvent("onmouseup",Page.mouseup);
	document.attachEvent("onmousemove",Page.mousemove);
}else{
	document.addEventListener("click",Page.click,false);
	document.addEventListener("mousedown",Page.mousedown,false);
	window.addEventListener("load",Page.load,false);
	document.addEventListener("mouseup",Page.mouseup,false);
	document.addEventListener("mousemove",Page.mousemove,false);
}


function DataTable(){
	this.Columns=null;
	this.Values=null;
	this.Rows=null;
	this.ColMap={};
	DataTable.prototype.getRowCount=function(){
		return this.Rows.length;
	};
	DataTable.prototype.getColCount=function(){
		return this.Columns.length;
	};
	DataTable.prototype.getColName=function(a){
		return this.Columns[a];
	};
	DataTable.prototype.get2=function(b,a){
		return this.Rows[b].get2(a);
	};
	DataTable.prototype.get=function(a,b){
		return this.Rows[a].get(b);
	};
	DataTable.prototype.getDataRow=function(a){
		return this.Rows[a];
	};
	DataTable.prototype.init=function(d,a){
		this.Values=a;
		this.Columns=[];
		this.Rows=[];
		for(var c=0;c<d.length;c++){
			var b={};
			b.Name=d[c][0].toLowerCase();
			b.Type=d[c][1];
			this.Columns[c]=b;
			this.ColMap[b.Name]=c;
		}
		for(var c=0;c<a.length;c++){
			var f=new DataRow(this,c);
			this.Rows[c]=f;
		}
	};
	DataTable.prototype.toString=function(){
		var a=[];
		a.push("<columns><![CDATA[[");
		for(var c=0;c<this.Columns.length;c++){
			if(c!=0){
				a.push(",");
			}
			a.push("[");
			a.push('"'+this.Columns[c].Name+'",');
			a.push(this.Columns[c].Type);
			a.push("]");
		}
		a.push("]]]></columns>");
		a.push("<values><![CDATA[[");
		for(var c=0;c<this.Values.length;c++){
			if(c!=0){a.push(",")}a.push("[");
			for(var b=0;b<this.Columns.length;b++){
				if(b!=0){
					a.push(",");
				}
				if(this.Values[c][b]==null||typeof(this.Values[c][b])=="undefined"){
					a.push('"_POTUKER_NULL"');
				}else{
					a.push('"'+this.Values[c][b]+'"');
				}
			}
			a.push("]");
		}
		a.push("]]]></values>");
		return a.join("");
	};
}
function DataRow(b,a){
	this.DT=b;
	this.Index=a;
	DataRow.prototype.get2=function(c){
		return this.DT.Values[this.Index][c];
	};
	DataRow.prototype.getColCount=function(){
		return this.DT.Columns.length;
	};
	DataTable.prototype.getColName=function(c){
		return this.DT.Columns[c];
	};
	DataRow.prototype.get=function(d){
		d=d.toLowerCase();
		var f=this.DT.ColMap[d];
		if(typeof(f)=="undefined"){
			return null;
		}
		return this.DT.Values[this.Index][f];
	};
	DataRow.prototype.set=function(f,d){
		f=f.toLowerCase();
		var g=this.DT.ColMap[f];
		if(typeof(g)=="undefined"){
			return;
		}
		this.DT.Values[this.Index][g]=d;
	};
	DataRow.prototype.set2=function(c,d){
		this.DT.Values[this.Index][c]=d;
	};
}
function DataCollection(){
	this.map={};
	this.valuetype={};
	this.keys=[];
	DataCollection.prototype.get=function(ID){
		if(typeof(ID)=="number"){
			return this.map[this.keys[ID]];
		}
		return this.map[ID];
	};
	DataCollection.prototype.getKey=function(index){
		return this.keys[index];
	};
	DataCollection.prototype.size=function(){
		return this.keys.length;
	};
	DataCollection.prototype.remove=function(ID){
		if(typeof(ID)=="number"){
			this.map[this.keys[ID]]=null;
			this.keys[ID];
		}
		return this.map[ID];
	};
	DataCollection.prototype.toQueryString=function(){
		var arr=[];
		for(var i=0;i<this.keys.length;i++){
			if(this.map[this.keys[i]]==null||this.map[this.keys[i]]==""){
				continue;
			}
			if(i!=0){
				arr.push("&");
			}
			arr.push(this.keys[i]+"="+this.map[this.keys[i]]);
		}
		return arr.join("");
	};
	DataCollection.prototype.parseXML=function(xmlDoc){
		var coll=xmlDoc.documentElement;
		if(!coll){
			return false;
		}
		var nodes=coll.childNodes;
		var len=nodes.length;
		for(var i=0;i<len;i++){
			var node=nodes[i];
			var Type=node.getAttribute("Type");
			var ID=node.getAttribute("ID");
			this.valuetype[ID]=Type;
			if(Type=="String"){
				var v=node.firstChild.nodeValue;
				if(v==Constant.Null){
					v=null;
				}
				this.map[ID]=v;
			}else{
				if(Type=="StringArray"){
					this.map[ID]=eval("["+node.firstChild.nodeValue+"]");
				}else{
					if(Type=="DataTable"||Type=="Schema"||Type=="SchemaSet"){
						this.parseDataTable(node,"DataTable");
					}else{
						this.map[ID]=node.getAttribute("Value");
					}
				}
			}
			this.keys.push(ID);
		}
		return true;
	};
	DataCollection.prototype.parseDataTable=function(node,strType){
		var cols=node.childNodes[0].childNodes[0].nodeValue;
		cols="var _TMP1 = "+cols+"";
		eval(cols);
		cols=_TMP1;
		var values=node.childNodes[1].childNodes[0].nodeValue;
		values="var _TMP2 = "+values+"";
		eval(values);
		values=_TMP2;
		var obj;
		obj=new DataTable();
		obj.init(cols,values);
		this.add(node.getAttribute("ID"),obj);
	};
	DataCollection.prototype.toXML=function(){
		var arr=[];
		arr.push('<?xml version="1.0" encoding="UTF-8"?>');
		arr.push("<collection>");
		for(var ID in this.map){
			try{
				var v=this.map[ID];
				arr.push('<element ID="'+ID+'" Type="'+this.valuetype[ID]+'">');
				if(this.valuetype[ID]=="DataTable"){
					arr.push(v.toString());
				}else{
					if(this.valuetype[ID]=="String"){
						if(v==null||typeof(v)=="undefined"){
							arr.push("<![CDATA["+Constant.Null+"]]>");
						}else{
							arr.push("<![CDATA["+v+"]]>");
						}
					}else{
						arr.push(v);
					}
				}
				arr.push("</element>");
			}catch(ex){
				alert("DataCollection.toXML():"+ID+","+ex.message);
			}
		}
		arr.push("</collection>");
		return arr.join("");
	};
	DataCollection.prototype.add=function(ID,Value,Type){
		this.map[ID]=Value;
		this.keys.push(ID);
		if(Type){
			this.valuetype[ID]=Type;
		}else{
			if(Value&&Value.getDataRow){
				this.valuetype[ID]="DataTable";
			}else{
				this.valuetype[ID]="String";
			}
		}
	};
}
var Cookie={};
Cookie.Spliter="_POTUKER_SPLITER_";
Cookie.get=function(c){
	var d=document.cookie.split("; ");
	for(i=0;i<d.length;i++){
		var a=d[i].split("=");
		var f=a[0].trim();
		var b=a[1]?a[1].trim():"";
		if(f==c){
			return unescape(b);
		}
	}
	return null;
};
Cookie.getAll=function(){
	var f=document.cookie.split("; ");
	var g=[];
	for(i=0;i<f.length;i++){
		var b=f[i].split("=");
		var k=b[0].trim();
		var c=b[1]?b[1].trim():"";
		if(k.indexOf(Cookie.Spliter)>=0){
			continue;
		}
		if(c.indexOf("^"+Cookie.Spliter)==0){
			var a=c.substring(Cookie.Spliter.length+1,c.indexOf("$"));
			var h=[c];
			for(var d=1;d<a;d++){
				h.push(Cookie.get(k+Cookie.Spliter+d));
			}
			c=h.join("");
			c=c.substring(c.indexOf("$")+1);
		}
		g.push([k,unescape(c)]);
	}
	return g;
};
Cookie.set=function(b,l,c,m,f,a,k){
	if(!k){
		var l=escape(l);
	}
	if(!b||!l){
		return false;
	}
	if(!m){
		m="/";
	}
	if(c!=null){
		if(/^[0-9]+$/.test(c)){
			c=new Date(new Date().getTime()+c*1000).toGMTString();
		}else{
			var d=DateTime.parseDate(c);
			if(d){
				c=d.toGMTString();
			}else{
				c=undefined;
			}
		}
	}
	if(!k){
		Cookie.remove(b,m,f);
	}
	var h=b+"="+l+";"+((c)?" expires="+c+";":"")+((m)?"path="+m+";":"")+((f)?"domain="+f+";":"")+((a&&a!=0)?"secure":"");
	if(h.length<4096){
		document.cookie=h;
	}else{
		var j=Math.ceil(l.length*1/3800);
		for(var g=0;g<j;g++){
			if(g==0){
				Cookie.set(b,"^"+Cookie.Spliter+"|"+j+"$"+l.substr(0,3800),c,m,f,a,true);
			}else{
				Cookie.set(b+Cookie.Spliter+g,l.substr(g*3800,3800),c,m,f,a,true);
			}
		}
	}
	return true;
};
Cookie.remove=function(c,f,d){
	var b=Cookie.get(c);
	if(!c||b==null){
		return false;
	}
	if(escape(b).length>3800){
		var a=Math.ceil(escape(b).length*1/3800);
		for(i=1;i<a;i++){
			document.cookie=c+Cookie.Spliter+i+"=;"+((f)?"path="+f+";":"")+((d)?"domain="+d+";":"")+"expires=Thu, 01-Jan-1970 00:00:01 GMT;";
		}
	}
	document.cookie=c+"=;"+((f)?"path="+f+";":"")+((d)?"domain="+d+";":"")+"expires=Thu, 01-Jan-1970 00:00:01 GMT;";
	return true;
};
var Misc={};
Misc.copyToClipboard=function(h){
	if(h==null){
		return;
	}
	if(window.clipboardData){
		window.clipboardData.setData("Text",h);
	}else{
		if(window.netscape){
			try{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}catch(c){
				Dialog.alert("Firefox自动复制功能未启用！<br>请<a href='about:config' target='_blank'>点击此处</a> 将’signed.applets.codebase_principal_support’设置为’true’");
			}
			var d=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);
			if(!d){
				return;
			}
			var b=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
			if(!b){
				return;
			}
			b.addDataFlavor("text/unicode");
			var g=new Object();
			var a=new Object();
			var g=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
			var j=h;
			g.data=j;
			b.setTransferData("text/unicode",g,j.length*2);
			var f=Components.interfaces.nsIClipboard;
			if(!d){
				return;
			}
			d.setData(b,null,f.kGlobalClipboard);
		}else{
			alert("该浏览器不支持自动复制功能！");
			return;
		}
	}
	Dialog.alert("己复制文字：<br><br><font color='red'>"+h+"</font><br><br>到剪贴板",null,400,200);
};
Misc.lockSelect=function(a){
	if(!a){
		a=document.body;
	}
	if(isGecko){
		a.style.MozUserSelect="none";
		a.style.MozUserInput="none";
	}else{
		document.selection.empty();
		a.onselectstart=stopEvent;
	}
};
Misc.unlockSelect=function(a){
	if(!a){
		a=document.body;
	}
	if(isGecko){
		a.style.MozUserSelect="";
		a.style.MozUserInput="";
	}else{
		a.onselectstart=null;
	}
};
Misc.lockScroll=function(a){
	if(!a){
		a=window;
	}
	if(isIE){
		a.document.body.attachEvent("onmousewheel",a.stopEvent);
	}else{
		a.addEventListener("DOMMouseScroll",a.stopEvent,false);
	}
};
Misc.unlockScroll=function(a){
	if(!a){
		a=window;
	}
	if(isIE){
		a.document.body.detachEvent("onmousewheel",a.stopEvent);
		a.document.body.detachEvent("onmousewheel",a.stopEvent);
	}else{
		a.removeEventListener("DOMMouseScroll",a.stopEvent,false);
	}
};
Misc.debug=function(event){
	if(event.altKey&&event.shiftKey&&event.ctrlKey&&event.keyCode==68){
		alert(eval(prompt("请输入要执行的JavaScript语句:")));
	}
};
Misc.switchTab=function(identify,index,count,func){
	for(var i=0;i<count;i++) {
		if (i != index) {
			$("Tab_" + identify + "_" + i).removeClassName('upH3');
			$("List_" + identify + "_" + i).removeClassName('upBox');
		}
	}
	$("Tab_" + identify + "_" + index).addClassName('upH3');
	$("List_" + identify + "_" + index).addClassName('upBox');
	if(func){
		func("List_" + identify + "_" + index,index);
	}
};
Misc.more = function(id){
	var height = $("nlist" + id).$T("table")[0].clientHeight;
	if ($("nlist" + id).clientHeight == 60) {
		$("nlist" + id).changeHeight(60,height);
	}else{
		$("nlist" + id).changeHeight(height,60);
	}
};
Misc.showTime=function(str){
	today=new Date(); 
	var year=today.getYear();
	var month=today.getMonth()+1;
	var day=today.getDate();
	var hours = today.getHours(); 
	var minutes = today.getMinutes(); 
	var seconds = today.getSeconds(); 
	var timeValue= hours;
	timeValue += ((minutes < 10) ? ":0" : ":") + minutes+""; 
	timeValue+=((seconds < 10) ? ":0" : ":") + seconds+"";
	var timetext=year+"-"+month+"-"+day+" "+timeValue
	$(str).innerText = timetext;
	setTimeout(function(){
		Misc.showTime(str);
	},1000); 
};
Page.onLoad(function(){
	Misc.showTime("time");
	$(document).onclick = function(){ setTimeout(function() { $("autoAutomatic").addClassName('displayNone'); }, 200) };
	if (isIE) {
		$("autoAutomatic").attachEvent("onclick",stopPartEvent);
		$("searchBox").$T("input").each(function(a){
			a.attachEvent("onclick",stopPartEvent);
		});
	} else {
		$("autoAutomatic").addEventListener("click",stopPartEvent,false);
		$("searchBox").$T("input").each(function(a){
			a.addEventListener("click",stopPartEvent,false);
		});
	}
	$("keyword").onclick = function() { $('autoAutomatic').removeClassName('displayNone'); };
},2);

if(isIE){
	document.attachEvent("onkeyup",Misc.debug);
}else{
	document.addEventListener("keyup",Misc.debug,false);
}

function Marquee(){
    this.Content = [];    //显示内容
    this.Speed = 20;    //上移速度
    this.Object = {};    //marquee容器对象
    this.Pause = true;    //是否停留
    this.Start = function(){
        var o = this.Object;
        var Pause = this.Pause;
        var Stop = false;
        var Stop2 = false;
        o.onmouseover = function(){
            Stop = Stop2 = true;
        }
        o.onmouseout = function(){
            Stop = Stop2 = false;
        }
        var BodyHtml = [];
		for(var i = 0; i < this.Content.length ; i++){
			BodyHtml.push(this.Content[i].text);
			//alert(this.Content[i].text);
		}
        var Dv = document.createElement("div");
        Dv.innerHTML = BodyHtml.join("<br />");
        o.appendChild(Dv);
        var DvHeight = Dv.offsetHeight;
        Dv.innerHTML += "<br />" + Dv.innerHTML;
        setInterval(function(){
            if(!Stop){
                o.scrollTop ++;
                if(o.scrollTop == o.scrollHeight - o.offsetHeight){
                    o.scrollTop = DvHeight - o.offsetHeight;
                }
                if(Pause){
                    if(o.scrollTop % o.offsetHeight == 0){
                        Stop = true;
                        setTimeout(function(){
                            Stop = Stop2;
                        }, 3000);
                    }
                }
            }
        }, this.Speed);
    }
}

$ES.computePositionEx=function(a,f){
	var d=$ES.getPositionEx(a);
	var c=$ES.getDimensions(a);
	var b=$ES.getDimensions(f);
	return $ES.computePosition(d.x+c.width,d.y,d.x+c.width,d.y+c.height,"all",b.width,b.height,$ES.getTopLevelWindow());
};

var Dialog={};
Dialog.hiddenobj = new Array();
Dialog.floatwinhandle = new Array();
Dialog.floatscripthandle = new Array();
Dialog.floattabs = new Array();
Dialog.floatwins = new Array();
Dialog.InFloat = '';
Dialog.floatwinreset = 0;
Dialog.floatwinopened = 0;
Dialog.win=function(action, script, w, h){
	var actione = action.split('_');
	action = actione[0];
	var handlekey = actione[1];
	var layerid = 'floatwin_' + handlekey;
	if(isIE) {
		var objs = $('wrap').$T("OBJECT");
	} else {
		var objs = $('wrap').$T("EMBED");
	}
	if(action == 'open') {
		Server.loadCSS('styles/dialog.css');
		Dialog.floatwinhandle[handlekey + '_0'] = layerid;
		if(!Dialog.floatwinopened) {
			$('wrap').onkeydown = Dialog.wrapkeyhandle;
			for(i = 0;i < objs.length; i ++) {
				if(objs[i].style.visibility != 'hidden') {
					objs[i].setAttribute("oldvisibility", objs[i].style.visibility);
					objs[i].style.visibility = 'hidden';
				}
			}
		}
		var clientWidth = document.body.clientWidth;
		var clientHeight = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
		var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
		if(script && script != -1) {
			if(script.lastIndexOf('/') != -1) {
				script = script.substr(script.lastIndexOf('/') + 1);
			}
			var scriptfile = script.split('?');
			scriptfile = scriptfile[0];
			if(Dialog.floatwinreset || Dialog.floatscripthandle[scriptfile] && Dialog.floatscripthandle[scriptfile][0] != script) {
				if(!isUndefined(Dialog.floatscripthandle[scriptfile])) {
					$('append_parent').removeChild($(Dialog.floatscripthandle[scriptfile][1]));
					$('append_parent').removeChild($(Dialog.floatscripthandle[scriptfile][1] + '_mask'));
				}
				Dialog.floatwinreset = 0;
			}
			Dialog.floatscripthandle[scriptfile] = [script, layerid];
		}
		if(!$(layerid)) {
			Dialog.floattabs[layerid] = new Array();
			div = document.createElement('div');
			div.className = 'floatwin';
			div.id = layerid;
			div.style.width = w + 'px';
			div.style.height = h + 'px';
			div.style.left = Dialog.floatwinhandle[handlekey + '_1'] = ((clientWidth - w) / 2) + 'px';
			div.style.position = 'absolute';
			div.style.zIndex = '999';
			div.onkeydown = Dialog.keyhandle;
			$('append_parent').appendChild(div);
			$(layerid).style.display = '';
			$(layerid).style.top = Dialog.floatwinhandle[handlekey + '_2'] = ((clientHeight - h) / 2 + scrollTop) + 'px';
			$(layerid).innerHTML = '<div><h3 class="float_ctrl"><em><img src="images/loading.gif"> 加载中...</em><span><a href="javascript:;" class="float_close" onclick="Dialog.floatwinreset = 1;Dialog.win(\'close_' + handlekey + '\');">&nbsp</a></span></h3></div>';
			divmask = document.createElement('div');
			divmask.className = 'floatwinmask';
			divmask.id = layerid + '_mask';
			divmask.style.width = (parseInt($(layerid).style.width) + 14) + 'px';
			divmask.style.height = (parseInt($(layerid).style.height) + 14) + 'px';
			divmask.style.left = (parseInt($(layerid).style.left) - 6) + 'px';
			divmask.style.top = (parseInt($(layerid).style.top) - 6) + 'px';
			divmask.style.position = 'absolute';
			divmask.style.zIndex = '998';
			//divmask.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=60,finishOpacity=100,style=0)';
			//divmask.style.opacity = 0.6;
			$('append_parent').appendChild(divmask);
			if(script && script != -1) {
				script += (script.search(/\?/) > 0 ? '&' : '?') + 'infloat=yes&handlekey=' + handlekey;
				try {
					//ajaxget(script, layerid, '', '', '', scrollpos);
				} catch(e) {
					//setTimeout("ajaxget('" + script + "', '" + layerid + "', '', '', '', '" + scrollpos + "')", 1000);
				}
			} else if(script == -1) {
				$(layerid).innerHTML = '<div><h3 class="float_ctrl"><em id="' + layerid + '_title"></em><span><a href="javascript:;" class="float_close" onclick="Dialog.floatwinreset = 1;Dialog.win(\'close_' + handlekey + '\');">&nbsp</a></span></h3></div><div id="' + layerid + '_content"></div>';
				if(handlekey == 'confirm'){
					$(layerid).style.zIndex = '1101';
					$(layerid + '_mask').style.zIndex = '1100';
				}else{
					$(layerid).style.zIndex = '1099';
					$(layerid + '_mask').style.zIndex = '1098';
				}
			}
		} else {
			$(layerid).style.width = w + 'px';
			$(layerid).style.height = h + 'px';
			$(layerid).style.display = '';
			$(layerid).style.top = Dialog.floatwinhandle[handlekey + '_2'] = ((clientHeight - h) / 2 + scrollTop) + 'px';
			$(layerid + '_mask').style.width = (parseInt($(layerid).style.width) + 14) + 'px';
			$(layerid + '_mask').style.height = (parseInt($(layerid).style.height) + 14) + 'px';
			$(layerid + '_mask').show();
			$(layerid + '_mask').style.top = (parseInt($(layerid).style.top) - 6) + 'px';
		}
		Dialog.floatwins[Dialog.floatwinopened] = handlekey;
		Dialog.floatwinopened++;
	} else if(action == 'close' && Dialog.floatwinhandle[handlekey + '_0']) {
		Dialog.floatwinopened--;
		for(i = 0;i < Dialog.floatwins.length; i++) {
			if(handlekey == Dialog.floatwins[i]) {
				Dialog.floatwins[i] = null;
			}
		}
		if(!Dialog.floatwinopened) {
			for(i = 0;i < objs.length; i ++) {
				if(objs[i].attributes['oldvisibility']) {
					objs[i].style.visibility = objs[i].attributes['oldvisibility'].nodeValue;
					objs[i].removeAttribute('oldvisibility');
				}
			}
			$('wrap').onkeydown = null;
		}
		hiddenobj = new Array();
		$(layerid + '_mask').hide();
		$(layerid).hide();
	} else if(action == 'size' && Dialog.floatwinhandle[handlekey + '_0']) {
		if(!Dialog.floatwinhandle[handlekey + '_3']) {
			var clientWidth = document.body.clientWidth;
			var clientHeight = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
			var w = clientWidth > 800 ? clientWidth * 0.9 : 800;
			var h = clientHeight * 0.9;
			Dialog.floatwinhandle[handlekey + '_3'] = $(layerid).style.left;
			Dialog.floatwinhandle[handlekey + '_4'] = $(layerid).style.top;
			Dialog.floatwinhandle[handlekey + '_5'] = $(layerid).style.width;
			Dialog.floatwinhandle[handlekey + '_6'] = $(layerid).style.height;
			$(layerid).style.left = Dialog.floatwinhandle[handlekey + '_1'] = ((clientWidth - w) / 2) + 'px';
			$(layerid).style.top = Dialog.floatwinhandle[handlekey + '_2'] = ((document.documentElement.clientHeight - h) / 2 + document.documentElement.scrollTop) + 'px';
			$(layerid).style.width = w + 'px';
			$(layerid).style.height = h + 'px';
		} else {
			$(layerid).style.left = Dialog.floatwinhandle[handlekey + '_1'] = Dialog.floatwinhandle[handlekey + '_3'];
			$(layerid).style.top = Dialog.floatwinhandle[handlekey + '_2'] = Dialog.floatwinhandle[handlekey + '_4'];
			$(layerid).style.width = Dialog.floatwinhandle[handlekey + '_5'];
			$(layerid).style.height = Dialog.floatwinhandle[handlekey + '_6'];
			Dialog.floatwinhandle[handlekey + '_3'] = '';
		}
		$(layerid + '_mask').style.width = (parseInt($(layerid).style.width) + 14) + 'px';
		$(layerid + '_mask').style.height = (parseInt($(layerid).style.height) + 14) + 'px';
		$(layerid + '_mask').style.left = (parseInt($(layerid).style.left) - 6) + 'px';
		$(layerid + '_mask').style.top = (parseInt($(layerid).style.top) - 6) + 'px';
	}
};
Dialog.alert=function(msg, script, width, height){
	Dialog.win('open_confirm', -1, !width ? 400 : width, !height ? 130 : height);
	$('floatwin_confirm_title').innerHTML = '提示信息';
	$('floatwin_confirm_content').innerHTML = '<p>' + msg + '</p>' +(script ? '<input class="button" type="button" onclick="' + script + ';Dialog.win(\'close_confirm\');" value="确定" />' : '<button onclick="Dialog.win(\'close_confirm\');">确定</button>');
	//$('floatwin_confirm_content').innerHTML = msg +  '<br /><button id="floatwin_confirm_submit">确定</button>';
};
Dialog.confirm=function(msg, script, width, height){
	Dialog.win('open_confirm', -1, !width ? 300 : width, !height ? 130 : height);
	$('floatwin_confirm_title').innerHTML = '提示信息';
	$('floatwin_confirm_content').innerHTML = '<p>' + msg + '</p><input class="button" type="button" onclick="' + script + ';Dialog.win(\'close_confirm\');" value="确定" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="button" type="button" onclick="Dialog.win(\'close_confirm\');" value="取消" />';
};
Dialog.content=function(title, divname, func, width, height){
	if(!divname){
		return;
	}
	Dialog.win('open_'+divname, -1, !width ? 300 : width, !height ? 110 : height);
	$('floatwin_'+divname+'_title').innerHTML = title;
	if(!$('floatwin_'+divname+'_body')){
		$('floatwin_'+divname+'_content').innerHTML = '<p id="floatwin_'+divname+'_body"></p><input class="button" type="button" id="floatwin_'+divname+'_submit" value="确定" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="button" type="button" onclick="Dialog.win(\'close_'+divname+'\');" value="取消" />';
		$('floatwin_'+divname+'_body').appendChild($(divname));
	}
	if(func){
		$('floatwin_'+divname+'_submit').onclick = func;
	}else{
		$('floatwin_'+divname+'_submit').onclick = function(){
			Dialog.win('close_'+divname+'');
		}
	}
};
Dialog.wrapkeyhandle=function(e) {
	e = isIE ? event : e;
	if(e.keyCode == 9) {
		stopEvent(e);
	} else if(e.keyCode == 27) {
		for(i = Dialog.floatwins.length - 1;i >= 0; i--) {
			Dialog.win('close_' + Dialog.floatwins[i]);
		}
	}
};
Dialog.keyhandle=function(e) {
	e = isIE ? event : e;
	if(e.keyCode == 9) {
		stopEvent(e);
		var obj = isIE ? e.srcElement : e.target;
		var srcobj = obj;
		j = 0;
		while(obj.className.indexOf('floatbox') == -1) {
			obj = obj.parentNode;
		}
		obj.id = obj.id ? obj.id : 'floatbox_' + Math.random();
		if(!Dialog.floattabs[obj.id]) {
			Dialog.floattabs[obj.id] = new Array();
			var alls = obj.$T("*");
			for(i = 0;i < alls.length;i++) {
				if(alls[i].getAttribute('tabindex') == 1) {
					Dialog.floattabs[obj.id][j] = alls[i];
					j++;
				}
			}
		}
		if(Dialog.floattabs[obj.id].length > 0) {
			for(i = 0;i < Dialog.floattabs[obj.id].length;i++) {
				if(srcobj == Dialog.floattabs[obj.id][i]) {
					j = e.shiftKey ? i - 1 : i + 1;break;
				}
			}
			if(j < 0) {
				j = Dialog.floattabs[obj.id].length - 1;
			}
			if(j > Dialog.floattabs[obj.id].length - 1) {
				j = 0;
			}
			do{
				focusok = 1;
				try{ Dialog.floattabs[obj.id][j].focus(); } catch(e) {
					focusok = 0;
				}
				if(!focusok) {
					j = e.shiftKey ? j - 1 : j + 1;
					if(j < 0) {
						j = Dialog.floattabs[obj.id].length - 1;
					}
					if(j > Dialog.floattabs[obj.id].length - 1) {
						j = 0;
					}
				}
			} while(!focusok);
		}
	}
};

function _LeftPad(b,d,a){
	b=""+b;
	return b.leftPad(d,a);
}

function fetchOffset(obj) {
	var left_offset = obj.offsetLeft;
	var top_offset = obj.offsetTop;
	while((obj = obj.offsetParent) != null) {
		left_offset += obj.offsetLeft;
		top_offset += obj.offsetTop;
	}
	return { 'left' : left_offset, 'top' : top_offset };
}

//LiSelect
var selectopen = null;
var hiddencheckstatus = 0;
function loadselect(id, showinput, pageobj, pos, method) {
	var obj = $(id);
	var objname = $(id).name;
	var objoffset = fetchOffset(obj);
	objoffset['width'] = isIE ? (obj.offsetWidth ? obj.offsetWidth : parseInt(obj.currentStyle.width)) : obj.offsetWidth;
	objoffset['height'] = isIE ? (obj.offsetHeight ? obj.offsetHeight : parseInt(obj.currentStyle.height)) : obj.offsetHeight;
	pageobj = !pageobj ? '' : pageobj;
	showinput = !showinput ? 0 : showinput;
	pos = !pos ? 0 : 1;
	method = !method ? 0 : 1;
	var maxlength = 0;
	var defaultopt = '', defaultv = '';
	var lis = '<ul onfocus="loadselect_keyinit(event, 1)" onblur="loadselect_keyinit(event, 2)" class="newselect" id="' + objname + '_selectmenu" style="' + (!pos ? 'z-index:999;position: absolute; width: ' + objoffset['width'] + 'px;' : '') + 'display: none">';
	for(var i = 0;i < obj.options.length;i++){
		lis += '<li ' + (obj.options[i].selected ? 'class="current" ' : '') + 'k_id="' + id + '" k_value="' + obj.options[i].value + '" onclick="loadselect_liset(\'' + objname + '\', ' + showinput + ', \'' + id + '\',' + (showinput ? 'this.innerHTML' : '\'' + obj.options[i].value + '\'') + ',this.innerHTML, ' + i + ')">' + obj.options[i].innerHTML + '</li>';
		maxlength = obj.options[i].value.length > maxlength ? obj.options[i].value.length : maxlength;
		if(obj.options[i].selected) {
			defaultopt = obj.options[i].innerHTML;
			defaultv = obj.options[i].value;
			if($(objname)) {
				$(objname).setAttribute('selecti', i);
			}
		}
	}
	lis += '</ul>';
	if(showinput) {
		inp = '<input autocomplete="off" class="newselect" id="' + objname + '_selectinput" onclick="loadselect_viewmenu(this, \'' + objname + '\', 0, \'' + pageobj + '\');stopEvent(event)" onchange="loadselect_inputset(\'' + id + '\', this.value);loadselect_viewmenu(this, \'' + objname + '\', 0, \'' + pageobj + '\')" value="' + defaultopt + '" style="width: ' + objoffset['width'] + 'px;height: ' + objoffset['height'] + 'px;" tabindex="1" />';
	} else {
		inp = '<a href="javascript:;" hidefocus="true" class="loadselect" id="' + objname + '_selectinput"' + (!obj.disabled ? ' onfocus="loadselect_keyinit(event, 1)" onblur="loadselect_keyinit(event, 2)" onmouseover="this.focus()" onmouseout="this.blur()" onkeyup="loadselect_key(this, event, \'' + objname + '\', \'' + pageobj + '\')" onclick="loadselect_viewmenu(this, \'' + objname + '\', 0, \'' + pageobj + '\');stopEvent(event)"' : '') + ' tabindex="1">' + defaultopt + '</a>';
	}
	obj.options.length = 0;
	if(defaultopt) {
		obj.options[0]= showinput ? new Option('', defaultopt) : new Option('', defaultv);
	}
	obj.style.width = objoffset['width'] + 'px';
	obj.style.display = 'none';
	if(!method) {
		obj.outerHTML += inp + lis;
	} else {
		if(showinput) {
			var inpobj = document.createElement("input");
		} else {
			var inpobj = document.createElement("a");
		}
		obj.parentNode.appendChild(inpobj);
		inpobj.outerHTML = inp;
		var lisobj = document.createElement("ul");
		obj.parentNode.appendChild(lisobj);
		lisobj.outerHTML = lis;
	}
}

function loadselect_keyinit(e, a) {
	if(a == 1) {
		if(document.attachEvent) {
			document.body.attachEvent('onkeydown', loadselect_keyhandle);
		} else {
			document.body.addEventListener('keydown', loadselect_keyhandle, false);
		}
	} else {
		if(document.attachEvent) {
			document.body.detachEvent('onkeydown', loadselect_keyhandle);
		} else {
			document.body.removeEventListener('keydown', loadselect_keyhandle, false);
		}
	}
}

function loadselect_keyhandle(e) {
	e = is_ie ? event : e;
	if(e.keyCode == 40 || e.keyCode == 38) stopEvent(e);
}

function loadselect_key(ctrlobj, e, objname, pageobj) {
	value = e.keyCode;
	if(value == 40 || value == 38) {
		if($(objname + '_selectmenu').style.display == 'none') {
			loadselect_viewmenu(ctrlobj, objname, 0, pageobj);
		} else {
			lis = $(objname + '_selectmenu').getElementsByTagName('LI');
			selecti = $(objname).getAttribute('selecti');
			lis[selecti].className = '';
			if(value == 40) {
				selecti = parseInt(selecti) + 1;
			} else if(value == 38) {
				selecti = parseInt(selecti) - 1;
			}
			if(selecti < 0) {
				selecti = lis.length - 1
			} else if(selecti > lis.length - 1) {
				selecti = 0;
			}
			lis[selecti].className = 'current';
			$(objname).setAttribute('selecti', selecti);
			lis[selecti].parentNode.scrollTop = lis[selecti].offsetTop;
		}
	} else if(value == 13) {
		lis = $(objname + '_selectmenu').getElementsByTagName('LI');
		for(i = 0;i < lis.length;i++) {
			if(lis[i].className == 'current') {
				loadselect_liset(objname, 0, lis[i].getAttribute('k_id'), lis[i].getAttribute('k_value'), lis[i].innerHTML, i);
				break;
			}
		}
	}
}

function loadselect_viewmenu(ctrlobj, objname, hidden, pageobj) {
	if(!selectopen) {
		if(document.attachEvent) {
			document.body.attachEvent('onclick', loadselect_hiddencheck);
		} else {
			document.body.addEventListener('click', loadselect_hiddencheck, false);
		}
	}
	var hidden = !hidden ? 0 : 1;
	if($(objname + '_selectmenu').style.display == '' || hidden) {
		$(objname + '_selectmenu').style.display = 'none';
	} else {
		if($(selectopen)) {
			$(selectopen).style.display = 'none';
		}
		var objoffset = fetchOffset(ctrlobj);
		if(pageobj) {
			var InFloate = pageobj.split('_');
			objoffset['left'] -= $(pageobj).scrollLeft + parseInt(floatwinhandle[InFloate[1] + '_1']);
			objoffset['top'] -= $(pageobj).scrollTop + parseInt(floatwinhandle[InFloate[1] + '_2']);
		}
		objoffset['height'] = ctrlobj.offsetHeight;
		$(objname + '_selectmenu').style.display = '';
		selectopen = objname + '_selectmenu';
	}
	hiddencheckstatus = 1;
}

function loadselect_hiddencheck() {
	if(hiddencheckstatus) {
		if($(selectopen)) {
			$(selectopen).style.display = 'none';
		}
		hiddencheckstatus = 0;
	}
}

function loadselect_liset(objname, showinput, obj, v, opt, selecti) {
	var change = 1;
	if(showinput) {
		if($(objname + '_selectinput').value != opt) {
			$(objname + '_selectinput').value = opt;
		} else {
			change = 0;
		}
	} else {
		if($(objname + '_selectinput').innerHTML != opt) {
			$(objname + '_selectinput').innerHTML = opt;
		} else {
			change = 0;
		}
	}
	lis = $(objname + '_selectmenu').getElementsByTagName('LI');
	lis[$(objname).getAttribute('selecti')].className = '';
	lis[selecti].className = 'current';
	$(objname).setAttribute('selecti', selecti);
	$(objname + '_selectmenu').style.display='none';
	if(change) {
		obj = $(obj);
		obj.options.length=0;
		obj.options[0]=new Option('', v);
		eval(obj.getAttribute('change'));
	}
}

function loadselect_inputset(obj, v) {
	obj = $(obj);
	obj.options.length=0;
	obj.options[0]=new Option('', v);
	eval(obj.getAttribute('change'));
}

