<script language="jscript" runat="server">
Array.prototype.joinex=function(spli){
	var _ary=[];
	for(var i=0; i < this.length; i++){
		if(this[i] != ""){_ary.push(this[i]);}
	}
	return _ary.join(spli);
};
var my={};
function SetSetting(key,value){
	if(!value){value="";}
	my[key] = value;
	Session(key) = value;
}
function stringw(sss){
	return new String(	sss);
}
function jo(data){
	var ty = typeof(data) ;
	//var co = data.constructor ;
	//number,string,date,VBArray,boolean
	switch(ty){
		case "number":
			return jo.number(data);
			break;
		case "string":
			return jo.string(data);
			break;
		case "date":
			return jo.date(data);
			break;
		default:
			return {name:"jo",version:"1.0"}
	}
}

//var jo={
	jo.name="jo";
	jo.version="1.0";
	jo.url = Request.ServerVariables("URL");
	jo.host = Request.ServerVariables("HTTP_HOST");
	jo.port = Request.ServerVariables("SERVER_PORT");
	jo.remoteip = Request.ServerVariables("REMOTE_ADDR");
	jo.localip = Request.ServerVariables("LOCAL_ADDR");
	jo.method = Request.ServerVariables("REQUEST_METHOD");
	jo.protocol = Request.ServerVariables("SERVER_PROTOCOL");
	jo.software = Request.ServerVariables("SERVER_SOFTWARE");
	jo.ev = function(vars){
		return Request.ServerVariables(vars);
	};
	jo.Isinstall = function(ObjStr){
		try{
			var _tempObj=new ActiveXObject(ObjStr);	
			_tempObj=null;
			return true;
		}catch(ex){
			return false;
		}
	};
	jo.getobj = function(ObjStr){
		try{
			return new ActiveXObject(ObjStr);	
		}catch(ex){
			return null;
		}
	};
	jo.fso = function(){
		var _fso=this.getobj("Scripting.FileSystemObject");
		if(_fso && arguments.length>0){
			this.FileOrFolder=arguments[0];
			return {
				me:_fso,
				errmsg:"",
				FileOrFolder:arguments[0],
				FileExists:function(){return this.me.fileexists(this.FileOrFolder);},
				FolderExists:function(){return this.me.folderexists(this.FileOrFolder);},
				FileDelete:function(){
					if(this.FileExists()){
						try{
							this.me.deleteFile(this.FileOrFolder);
							return true;
						}catch(ex){
							errmsg=ex.description;
							return false;
						}
					}else{
						return false;
					}
				},
				FolderDelete:function(){
					if(this.FolderExists()){
						try{
							this.me.deleteFolder(this.FileOrFolder);
							return true;
						}catch(ex){
							this.errmsg=ex.description;
							return false;
						}
					}else{
						return false;
					}
				}
			}
		}
		return _fso;
	};
	jo.stream = function(){
		var _stream=this.getobj("Adodb.Stream");
		if(_stream && arguments.length>0){
			_stream.type=arguments[0];
			if(arguments.length==2){
				_stream.mode=arguments[1];
			}
		}
		return _stream;
	};
	jo.connection = function(){
		var _conn = this.getobj("Adodb.connection");
		if(_conn && arguments.length>0){
			return {
				me:_conn,
				errmsg:"",
				connectionString:arguments[0],
				open:function(){
					if(this.isopen){return true;}
					try{
						this.me.open(this.connectionString);
						this.isopen=true;
						return true;
					}catch(ex){
						this.errmsg=ex.description;
						return false;
					}
				},
				close:function(){if(this.isopen){this.me.close();this.isopen=false;}},
				isopen:false,
				execute:function(v1,v2){
					if(v1){
						try{
							if(!v2){
								return this.me.execute(v1);
							}else{
								this.me.execute(v1,v2);
							}
						}catch(ex){
							this.errmsg=ex.description;
							return false;
						}
					}else{
						this.errmsg="参数为空";
						return false;
					}
				},
				getvalue:function(SQL,Index){
					var rs= jo.recordset(SQL,this.me,1,1);
					rs.open();
					var _temp = rs.get(Index);
					rs.close();
					return _temp;
				}
			};
		}
		return _conn;
	};
	jo.recordset = function(){
		var _recordset =this.getobj("Adodb.Recordset");
		if(_recordset && arguments.length==4){
			var v1=arguments[1].state ? arguments[1] : arguments[1].me;
			return {
				me:_recordset,
				errmsg:"",
				sql:arguments[0],
				conn:v1,
				v1:arguments[2],
				v2:arguments[3],
				isopen:false,
				param:new __HashTable(),
				fields:function(){
					return this.me.fields;	
				},
				addnew:function(){
					this.errmsg="";
					try{
						this.me.addnew();
					}catch(ex){
						this.errmsg = ex.description;
					}
				},
				getobject:function(){
					var _tempo = new Object();
					for(var i=0;i<this.me.fields.count;i++){
						_tempo[this.me.fields(i).name]=this.me.fields(i).value;
					}
					return _tempo;
				},
				getjsonstr:function(){
					var _str="{";
					for(var i=0;i<this.me.fields.count;i++){
						var val=this.me.fields(i).value;
						if(typeof val=="string"){val=val.replace(/\"/igm,"\\\"");}
						if(val==null){val="";}
						_str+="\"" + this.me.fields(i).name + "\":\"" + val + "\",";
					}	
					if(_str!="{"){_str = _str.substr(0,_str.length-1);}
					_str += "}";
					return _str
				},
				Delete:function(){
					this.errmsg="";
					try{
						this.me.Delete();
					}catch(ex){
						this.errmsg = ex.description;
					}	
				},
				getrows:function(){return this.me.getRows();},
				update:function(){
					this.errmsg="";
					try{
						this.me.update();
					}catch(ex){
						this.errmsg = ex.description;
					}		
				},
				open:function(){
					this.errmsg="";
					if(this.isopen){return true;}
					try{
						this.me.open(this.sql,this.conn,this.v1,this.v2);
						this.isopen=true;
						return true;
					}catch(ex){
						this.errmsg=ex.description;
						return false;
					}
				},
				close:function(){
					if(this.isopen){
						this.me.close();
						this.isopen=false;
					}
				},
				currentpage:function(page){this.me.absolutepage=page;},
				pagesize:function(pagesize){this.me.pagesize=pagesize;},
				recordcount:function(){return this.me.recordcount},
				pagecount:function(){return this.me.pagecount},
				eof:function(){return this.me.eof},
				bof:function(){return this.me.bof},
				get:function(field){this.errmsg="";try{return this.me(field).value;}catch(ex){this.errmsg=ex.description;return "";}},
				movenext:function(){this.me.movenext()},
				moveprev:function(){this.me.moveprev()},
				movelast:function(){this.me.movelast()},
				movefirst:function(){this.me.movefirst()},
				move:function(index){this.me.move(index)},
				drop:function(){this.me=null;}
			};
		}
		return _recordset;
	};
	jo.document = function(path){
		var xmldomversions = ['MSXML2.DOMDocument','MSXML2.DOMDocument.3.0','MSXML2.DOMDocument.4.0','MSXML2.DOMDocument.5.0','Microsoft.XMLDOM'];
		for (var i=0;i<xmldomversions.length;i++){
			if(this.Isinstall(xmldomversions[i])){
				if(path && typeof(path)=="string"){
					var _dom = {
						me:this.getobj(xmldomversions[i]),
						data:path,
						errmsg:"",
						isReady:false,
						load:function(){
							errmsg="";
							try{
								if(path.substr(1,1)==":"){
									this.me.load(this.data);
								}else{
									this.me.loadXML(this.data);
								}
								return true;
							}catch(ex){
								this.errmsg=ex.description;
								return false;
							}
						},
						getNodes:function(xpath){
							var _temp=this.me.selectNodes(xpath);
							return {
								me:_temp,
								count:_temp.length,
								each:function(fn){
									if(typeof(fn) == "string"){
										eval("fn = " + fn + ";");
									}
									if(this.count<=0){return false;}
									for(var i=0;i<this.me.length;i++){
										var args=[i,this.me[i]];
										if(arguments.length>1){
											for(var k=1;k<=arguments.length;k++){
												args.push(arguments[k]);
											}
										}
										var result=fn.apply(this.me,args);
										if(!result){
											return false;	
										}
									}
									return true;
								}
							};
						},
						getNode:function(xpath){
							return this.me.selectSingleNode(xpath);
						},
						getNodeText:function(xpath){
							try{
								return this.me.selectSingleNode(xpath).text;
							}catch(ex){return null;}
						}
					};
					_dom.isReady = _dom.load();
					return _dom;
				}else{
					return this.getobj(xmldomversions[i]);
				}
			}
		}
		return false;
	};
	jo.number = function(v1){
		if(isNaN(v1)){return {};}
		return {
			me:v1,
			toInt:function(){return parseInt("" + this.me + "");},
			toFix:function(len){
				if(len){return this.me.toFixed(len);}	
				return this.me.toFixed();
			},
			toHex:function(){
				return this.me.toString(16);
			},
			toOct:function(){
				return this.me.toString(8);
			},
			toBin:function(){
				return this.me.toString(2);
			},
			getChar:function(){}
		};
	};
	jo.date = function(v1){
		v1 = typeof v1=="date" ? (new Date(v1)) : (new Date());
		return {
			me:v1,
			year:v1.getYear(),
			fullYear:v1.getFullYear(),
			month:v1.getMonth()+1,
			day:v1.getDate(),
			hour:v1.getHours(),
			minute:v1.getMinutes(),
			second:v1.getSeconds(),
			millisecond:v1.getMilliseconds(),
			weekday:v1.getDay(),
			date:function(){
				return this.fullYear + "-" + this.month + "-" + this.day;
			},
			format:function(formatStr){
				var y=new Array(2),m=new Array(2),d=new Array(2),h=new Array(2),n=new Array(2),s=new Array(2),w,ws=new Array(2),t = new Array(1)
				y[0] = this.fullYear;
				m[0] = this.month;
				d[0] = this.day;
				h[0] = this.hour;
				n[0] = this.minute;
				s[0] = this.second;
				y[1] = this.fullYear;
				m[1] = jo.string("0" +this.month).right(2);
				d[1] = jo.string("0" +this.day).right(2);
				h[1] = jo.string("0" +this.hour).right(2);
				n[1] = jo.string("0" +this.minute).right(2);
				s[1] = jo.string("0" +this.second).right(2);
				ws[0] = "日,一,二,三,四,五,六".split(",");
				ws[1] = "Sun,Mon,Tues,Wed,Thur,Fri,Sat".split(",");
				t[0] = this.millisecond;
				w=this.weekday-1;
				
				var returnStr;
				returnStr = formatStr.replace(/yyyy/igm,y[0]);
				returnStr = returnStr.replace(/y/igm,y[1]);
				returnStr = returnStr.replace(/mm/igm,m[1]);
				returnStr = returnStr.replace(/m/igm,m[0]);
				returnStr = returnStr.replace(/dd/igm,d[1]);
				returnStr = returnStr.replace(/d/igm,d[0]);
				returnStr = returnStr.replace(/hh/igm,h[1]);
				returnStr = returnStr.replace(/h/igm,h[0]);
				returnStr = returnStr.replace(/nn/igm,n[1]);
				returnStr = returnStr.replace(/n/igm,n[0]);
				returnStr = returnStr.replace(/ss/igm,s[1]);
				returnStr = returnStr.replace(/s/igm,s[0]);
				returnStr = returnStr.replace(/W/igm,ws[0][w]);
				returnStr = returnStr.replace(/w/igm,ws[1][w]);
				returnStr = returnStr.replace(/t/igm,t[0]);
				return returnStr	;			
			}
		};
	};
	jo.string = function(v1){
		v1 = v1 ? ("" + v1 + "") : "";
		return{
			me:v1,
			value:v1,
			getjson:function(){
				try{
					eval("var jsonStr = (" + this.me + ")");
				}catch(ex){
					var jsonStr = null;
				}
				return jsonStr;
			},
			replace:function(v1,v2,v3){
				if(v3){
					try{
						eval("v1=" + v1 + ";")
					}catch(ex){
					}
				}
				this.me = this.me.replace(v1,v2);	
				return this.me;
			},
			GetRandomString:function(len){
				var Seed = "abcdefghijklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ0123456789";
				var ReturnStr = "";
				for (var i = 1; i <= len; i++)
				{
					ReturnStr += Seed.substr(parseInt(Math.random() * Seed.length), 1);
				}
				return ReturnStr;
			},
			lcase:function(){this.me = this.me.toLowerCase(); return this},
			ucase:function(){this.me = this.me.toUpperCase(); return this},
			trim:function(){this.me= this.me.replace(/^(\s+)|(\s+)$/i,"");return this;},
			ltrim:function(){this.me= this.me.replace(/^(\s+)/i,"");return this;},
			rtrim:function(){this.me= this.me.replace(/(\s+)$/i,"");return this;},
			utf8:function(){this.me= encodeURIComponent(this.me);return this;},
			unutf8:function(){this.me= decodeURIComponent(this.me);return this;},
			utf8_2:function(){this.me= encodeURI(str);return this;},
			int:function(){return parseInt(this.me);},
			dbl:function(){return parseFloat(this.me);},
			isnum:(!isNaN(v1)),
			find:function(str){return this.me.indexOf(str);},
			findRev:function(str){return this.me.lastIndexOf(str);},
			substr:function(position,len){
				return this.me.substr(position-1,len);
			},
			left:function(len){
				return this.me.substr(0,len);	
			},
			right:function(len){
				return this.me.substr(this.me.length-len,len);	
			},
			endWith:function(str){
				return this.me.substr(this.me.length-str.length,str.length)==str;	
			},
			startWith:function(str){
				return this.me.substr(0,str.length)==str;	
			},
			trimEnd:function(str){
				var _temp = this.me;
				while(jo.string(_temp).endWith(str)){
					_temp = _temp.substr(0,	_temp.length-str.length);
				}
				this.me= _temp;
				return this;
			},
			trimStart:function(str){
				var _temp = this.me;
				while(jo.string(_temp).startWith(str)){
					_temp = _temp.substr(str.length);
				}
				this.me= _temp;		
				return this;
			},
			Format:function(Str){
				var arg = arguments;
				if(arg.length<=0){return this;}
				this.me= this.me.replace(/\$(\d*)/igm,function(ma){
					try{
						return arg[parseInt(ma.replace(/\$/igm,""))-1];	
					}catch(ex){
						return ma;
					}	
				});
				return this;
			},
			frombytes:function(bytSource, Cset){
				  var Objstream =jo.stream();
				  var BytesToBstr="";
				  Objstream.Type = 1;
				  Objstream.Mode = 3;
				  Objstream.Open();
				  Objstream.Write(bytSource);
				  Objstream.Position = 0;
				  Objstream.Type = 2;
				  Objstream.CharSet = Cset;
				  BytesToBstr = Objstream.ReadText();
				  Objstream.Close()
				  Objstream = null;
				  return BytesToBstr;
			},
			getchars:function(len){
				if(len>=this.me.length){return this.me;}
				var hasLen=0;
				for(var i=0;i<this.me.length;i++){
					var chr =this.me.charCodeAt(i);
					if(chr>=0 && chr<256){
						hasLen +=0.5;
					}else{
						hasLen +=1;
					}
					if(hasLen>len){
						return this.substr(1,i-1);
					}else if(hasLen==len){
						return this.substr(1,i+1);
					}
				}
				return this.me;
			},
			each:function(fn){
				var _temp="";
				for(var i=0;i<this.me.length;i++){
					_temp+=fn.apply(this.me,[i,this.substr(i+1,1)]);
					
				}	
				return _temp;
			},
			getbin:function(){
				var sss=this.each(function(i,v){
					var chr = v.charCodeAt(0);		
					var _temp = jo.number(chr).toBin();
					return jo.string(_temp).paddingleft("0",_temp.length % 4 ==0 ? 0: (4-_temp.length % 4)) + " ";
				});	
				return jo.string(sss).trim().me;
			},
			getfrombin:function(bin){
				var bins=bin.split(" ");
				var _temp="";
				for(var i=0;i<bins.length;i++){
					var thisbin = bins[i];
					var chr=0;
					for(var j=0;j<thisbin.length;j++){
						chr = chr + parseInt(jo.string(thisbin).substr(j+1,1)) * Math.pow(2,thisbin.length-j-1);
					}
					_temp = _temp + String.fromCharCode(chr);
				}
				return _temp;
			},
			paddingleft:function(str,len){
				if(len==0){return this.me;}
				var _temp=this.me;
				for(var i=1;i<=len;i++){
					_temp = str + _temp;	
				}
				return _temp;
			},
			paddingright:function(str,len){
				if(len==0){return this.me;}
				var _temp=this.me;
				for(var i=1;i<=len;i++){
					_temp +=str;	
				}
				return _temp;
			}
		};
	};
	jo.file = function(filepath){
		return {
			path:filepath,
			exists:jo.fso(this.path).FileExists(),	
			stream:jo.stream(),
			Delete:function(){
				jo.fso(this.path).FileDelete();
				return this;
			},
			size:0,
			open:function(mode,type){
				if(this.stream.state==1){return this;}
				this.stream.mode=mode;
				this.stream.type=type;
				this.stream.open();
				return this;
			},
			close:function(){
				this.stream.close();
				return this;
			},
			readtext:function(charset){
				charset = charset || "GB2312";
				if(!this.exists){return "";}
				this.open(3,2);
				this.stream.charset=charset;
				this.stream.loadfromfile(this.path);
				this.size=this.stream.size;
				var _str = this.stream.readtext();
				this.close();
				return _str;
			},
			readbin:function(){
				if(!this.exists){return "";}
				this.open(3,1);
				this.stream.loadfromfile(this.path);
				this.size=this.stream.size;
				var _str = this.stream.read();
				this.close();
				return _str;
			},
			writetext:function(str,charset,atend){
				this.open(3,2);
				charset = charset || "GB2312";
				this.stream.charset=charset;
				if(atend && this.exists){
					this.stream.loadfromfile(this.path);
					this.stream.position = this.stream.size;
				}
				this.stream.writetext(str);
				this.stream.savetofile(this.path,2);
				this.close();
				return this;
			},
			writebin:function(str,atend){
				this.open(3,1);
				if(atend && this.exists){
					this.stream.loadfromfile(this.path);
					this.stream.position = this.stream.size;
				}
				this.stream.write(str);
				this.stream.savetofile(this.path,2);
				this.close();
				return this;
			}
		};
	};
	jo.folder = function(folderpath){
		return {
			path:folderpath,
			exists:jo.fso(this.path).FolderExists(),	
			Delete:function(){
				jo.fso(this.path).FolderDelete();
				return this;
			},
			get:function(){
				return jo.fso().getFolder(this.path);
			},
			create:function(){
				var oFSO;
				oFSO =server.CreateObject("Scripting.FileSystemObject" );
				var sParent;
				sParent = oFSO.GetParentFolderName( this.path );
				if(sParent == ""){return;}
				if(!jo.fso(sParent).FolderExists()){jo.folder( sParent ).create();}
				if(!oFSO.FolderExists(this.path)){oFSO.CreateFolder(this.path);}
				oFSO = null;
				return this;
			}
		}
	};
	jo.http = function(url,method,data,datatype,charset){
		return new _HttpRequest(url,method,data,datatype,charset);	
	};
	jo.utf8 = function(str){
		return encodeURIComponent(str);
	};
	jo.unutf8 = function(str){
		return decodeURIComponent(str);
	};
	jo.utf8_2 = function(str){
		return encodeURI(str);
	};
	jo.Format = function(Str){
		var arg = arguments;
		if(arg.length<=1){return Str;}
		return Str.replace(/\$(\d*)/igm,function(ma){
			try{
				return arg[parseInt(ma.replace(/\$/igm,""))];	
			}catch(ex){
				return ma;
			}	
		});
	};
	jo.FormatString = function(Str,Data){
		//var reg = new RegExp("\\$(.*?)\\$","igm");
		return Str.replace(/\$(.*?)\$/igm,function(Ma){
			var n = Ma.replace(/\$/igm,"");
			var g = n.split("\/");
			var ss="";
			for(var j = 0;j<g.length;j++){
				ss+="[\"" + g[j] + "\"]"
			}
			try{
				eval("var value=Data" + ss + ";");
			}catch(ex){
				var value="";	
			}	
			return value;
		});
	};
	jo.write = function(str){
		Response.Write(str);
	};
	jo.redirect=function(url,msg){
		if(msg && (typeof msg=="string")){
			jo.write(String.fromCharCode("<".charCodeAt(0)) + "script\>alert('" + msg + "');\</script\>");	
		}
		jo.write(String.fromCharCode("<".charCodeAt(0)) + "script\>window.location='" + url + "';\</script\>");
	};
	jo.CreatePageString = function(RecordCount, PageSize){
		var PageCount ,PageStr, I,URL,CurrentPage;
		CurrentPage = Request.QueryString("page");
		if(CurrentPage =="" || isNaN(CurrentPage)){CurrentPage=1;}
		URL="?" + (Request.QueryString + "&page={$page}").replace(/(\&)?page\=(\d+)/igm,"");
		URL = URL.replace("?&","?");
		CurrentPage = parseInt(CurrentPage);
		RecordCount = parseInt(RecordCount)
		PageSize = parseInt(PageSize)
		if(RecordCount % PageSize == 0){
			Pagecount = RecordCount / PageSize;
		}else{
			Pagecount = parseInt(RecordCount / PageSize) + 1;
		}
		PageStr = "共[" + RecordCount + "]条记录 <a>[" + PageSize + "]</a>条/页 当前[" + CurrentPage + "/" + Pagecount + "]页&nbsp; ";
		PageStr += CurrentPage <= 1 ? "首页&nbsp; " : "<a href=\"" + URL.replace("{$page}",1) + "\">首页</a>&nbsp; ";
		PageStr += CurrentPage <= 1 ? "上一页&nbsp; " : "<a href=\"" + URL.replace("{$page}",CurrentPage - 1) + "\">上一页</a>&nbsp; ";
		PageStr += CurrentPage >= Pagecount ? "下一页&nbsp; " : "<a href=\"" + URL.replace("{$page}",CurrentPage + 1) + "\">下一页</a>&nbsp; ";
		PageStr += CurrentPage >= Pagecount ? "末页&nbsp; " : "<a href=\"" + URL.replace("{$page}",Pagecount) + "\">末页</a>&nbsp; ";
		if(Pagecount>0){
			PageStr = PageStr + "转到第 <select onchange=\"window.location='" + URL + "'.replace('\{\$page\}',this.value);\">";
			for(var I = 1;I<=Pagecount;I++){
				if(I == CurrentPage){
					PageStr += "<option value=\"" + I + "\" selected=\"selected\">" + I + "</option>";
				}else{
					PageStr += "<option value=\"" + I + "\">" + I + "</option>";
				}
			}
			PageStr += "</select> 页"
		}
		return PageStr;
	};
	
	jo.regexp = function(v1,v2){
		var regexp = new RegExp(v1,v2);
		return {
			me:	regexp,
			test:function(str){return this.me.test(str);},
			replace:function(str,replacestr){return str.replace(this.me,replacestr);},
			exec:function(str){
				if(!regexp.global){
					return this.me.exec(str);
				}
				var ary=[];
				var val = this.me.exec(str);
				while(val){
					ary.push(val);
					val = this.me.exec(str)
				}
				return ary;
			}
		};
	};
	jo.SendMail = function(MailAddress, LoginName, LoginPass, Subject, Email, Sender, Content, Fromer) {
		if(this.Isinstall("JMail.Message")){
			var jmail = this.getobj("JMail.Message"); //建立发送邮件的对象 
			jmail.silent = true; //屏蔽例外错误，返回FALSE跟TRUE两值j 
			jmail.Charset = "GB2312"; //邮件的文字编码为国标 
			jmail.ContentType = "text/html"; //邮件的格式为HTML格式 
			jmail.AddRecipient(Email); //邮件收件人的地址 
			jmail.From = Fromer; //发件人的E-MAIL地址 
			jmail.FromName = Sender ;
			jmail.MailServerUserName = LoginName; //'您的邮件服务器登录名 
			jmail.MailServerPassword = LoginPass; //'登录密码 
			jmail.Subject = Subject; //邮件的标题  
			jmail.Body = Content; 
			jmail.Priority = 1; //邮件的紧急程序，1 为最快，5 为最慢， 3 为默认值 
			jmail.Send(MailAddress); //执行邮件发送（通过邮件服务器地址） 
			jmail.Close(); //关闭对象 
			jmail=null;
		}
	};
	jo.joinUrl = function(UriComonpent){
		if(Request.QueryString==""){ 
			return  "?" + UriComonpent
		}else{
			var joinurl="";
			joinurl = "?" + jo.string(Request.QueryString).trim().me + "&" + UriComonpent;
			joinurl = joinurl.replace(/(order|orderby)\=([^\=\&]+)(.*?)(\1)\=([^\=\&]+)/igm,"$1=$5$3");
			joinurl = joinurl.replace(/(order|orderby)\=([^\=\&]+)(.*?)(\1)\=([^\=\&]+)/,"$1=$5$3");
			while(jo.string(joinurl).find("&&")>=0){
				joinurl = joinurl.replace(/&&/igm,"&");
			}
			joinurl = joinurl.replace(/\?&/,"?")
			if(jo.string(joinurl).right(1)=="&"){
				joinurl = jo.string(joinurl).left(joinurl.length-1);
			}
			return                                                                       ;
		}
	};
	jo.IP = function(ip){
		var isIp=true;
		var long=0;
		var sou="";
		ip="" + ip + "";
		if(ip.indexOf(".")<=0){
			isIp = false;	
		}else{
			var complist = ip.split(".");
			if(complist.length!=4){
				isIp = false;	
			}else{
				for(var i=0;i<4;i++){
					if(isNaN(complist[i]) || parseInt(complist[i])<0 || parseInt(complist[i])>255){
						isIp = false;	
						break;
					}else{
						long += parseInt(complist[i]) * Math.pow(256,3-i);
					}	
				}	
			}
		}
		if(!isIp){
			if(!isNaN(ip)){
				ip = parseInt(ip);
				long=ip;
				var ips=new Array(4);
				ips[0]=ip>>>24;
				ips[1]=(ip<<8)>>>24;
				ips[2]=(ip<<16)>>>24;
				ips[3]=(ip<<24)>>>24;
				sou = ips.join(".");
			}
		}else{
			sou = ip;	
		}
		return {
			me:ip,
			is:isIp,
			long:long,
			ip:sou,
			hex:jo(long).toHex()
		};
	};
	jo.end=function(stips){
		if(stips){jo.write(stips);}
		Response.End();
	}
	jo.HashTable = function(){
		return new __HashTable();
	};
//}

//HashTable类
function __HashTable(){
	this.table=[];
}

__HashTable.prototype.Sort = function(order,key){
	if(this.Count()<=0){return ;}
	var isASC = true;
	if(order.toLowerCase()=="asc"){
		isASC=true;
	}else if(order.toLowerCase()=="desc"){
		isASC=false;
	}
	if(key!="key" && key !="value"){key="key";}
	var __temp = null;
	for(var i=0;i<this.Count()-1;i++){
		for(var j=i+1;j<this.Count();j++){
			if(this.table[i][key]>this.table[j][key] == isASC){
				var thevalue=this.table[i];
				this.table[i] = this.table[j];
				this.table[j] = thevalue;
			}
		}
	}
};

__HashTable.prototype.Clear = function(){
	this.table=[];	
};

__HashTable.prototype.FromJson = function(JsonStr){
	var __json = jo(JsonStr).getjson();
	if(__json){
		for(var i in __json){
			this.Add(i,__json[i]);
		}
	}
};

__HashTable.prototype.FromGet=function(SaveData){
	if(!SaveData){this.table=[];}
	this.FromRequest(0);
};

__HashTable.prototype.FromPost=function(SaveData){
	if(!SaveData){this.table=[];}
	this.FromRequest(1);
};

__HashTable.prototype.FromRequest = function(ty,str){
	var __Request = "";
	if(ty==0){
		__Request = "" + Request.QueryString; 
	}else if(ty==1){
		__Request = "" + Request.Form; 
	}else if(ty==2){
		__Request = str;
	}
	var URIComponents = __Request.split("&");
	if(URIComponents.length>0){
		for(var i=0;i<URIComponents.length;i++){
			if(URIComponents[i]==""){continue;}
			var URIComponent = URIComponents[i].split("=");
			if(URIComponent.length==1){
				this.Add(URIComponent[0],"");
			}else if(URIComponent.length==2){
				this.Add(URIComponent[0],URIComponent[1]);
			}
		}
	}
};

__HashTable.prototype.Exists = function(key){
	if(this.Count()<=0){return false;}
	for(var i=0;i< this.Count();i++){
		if(this.table[i]["key"].toLowerCase()==key.toLowerCase()){return true;}
	}
	return false;
}

__HashTable.prototype.JsonString = function(){
	if(this.Count()<=0){return "";}
	var str = "{";
	for(var i=0;i< this.Count();i++){
		var val = this.table[i]["value"];
		if(typeof val=="string"){val=val.replace(/\"/igm,"\\\"");}
		if(val==null){continue;}
		str += "\"" + this.table[i]["key"] + "\":\"" + val + "\",";
	}
	if(str!="{"){
		str = str.substr(0,str.length-1);	
	}
	return str + "}";	
};
__HashTable.prototype.join=function(){
	if(this.Count()<=0){return "";}
	var str = "";
	for(var i=0;i< this.Count();i++){
		str += this.table[i]["key"] + "=" + this.table[i]["value"] + "&";
	}
	if(str!=""){
		str = str.substr(0,str.length-1);	
	}
	return str;		
};
__HashTable.prototype.URIString = function(charset){
	charset ? charset : (charset="")
	if(this.Count()<=0){return "";}
	var str = "";
	for(var i=0;i< this.Count();i++){
		if(charset.toLowerCase()=="gb2312"){
			str += this.table[i]["key"] + "=" + escape(this.table[i]["value"]) + "&";
		}else if(charset.toLowerCase()=="gbk"){
			str += this.table[i]["key"] + "=" + Server.URLEncode(this.table[i]["value"]) + "&";
		}else if(charset.toLowerCase()=="no"){
			str += this.table[i]["key"] + "=" + this.table[i]["value"] + "&";
		}else{
			str += this.table[i]["key"] + "=" + encodeURIComponent(this.table[i]["value"]) + "&";
		}
	}
	if(str!=""){
		str = str.substr(0,str.length-1);	
	}
	return str;	
};

__HashTable.prototype.Items=function(key){
	if(this.Count()<=0){return "";}
	for(var i=0;i<this.Count();i++){
		if(this.table[i]["key"].toLowerCase()==key.toLowerCase()){
			return this.table[i]["value"];
		}
	}
	return "";
};

__HashTable.prototype.Keys = function(){
	if(this.Count()<=0){return;}
	var ___str="";
	for(var i=0;i<this.Count();i++){
		___str += this.table[i]["key"] + ", "
	}
	if(___str!=""){___str = ___str.substr(0,___str.length-2)}
	return ___str;
};

__HashTable.prototype.Add = function(key,value,format){
	if(typeof value=="date"){
		if(!format){format="yyyy-mm-dd hh:nn:ss";}
		value=jo.date(value).format(format);
	}
	if(!value){value="";}
	if(this.table.length==0){
		this.table[0]={"key":key,"value":value};
	}else{
		var isIn = false;
		for(var i=0;i<this.table.length;i++){
			if(this.table[i]["key"].toLowerCase()==key.toLowerCase()){
				if(this.table[i]["value"]!=""){
					this.table[i]["value"]= this.table[i]["value"] + ", " + value;
				}else{
					this.table[i]["value"]= value;
				}
				isIn = true;
				break;
			}
		}	
		if(!isIn){
			this.table.push({"key":key,"value":value});	
		}
	}
};

__HashTable.prototype.Count = function(){return this.table.length;};

__HashTable.prototype.Remove = function(key){
	if(this.Count()<=0){return}
	//key = key.toLowerCase();
	var ___temp=[];
	for(var i=0;i<this.Count();i++){
		if(this.table[i]["key"].toLowerCase()!=key.toLowerCase()){
			___temp.push(this.table[i]);
		}	
	}
	this.table=___temp;
};
function utf8(str){
	return encodeURIComponent(str);	
}
function utc(){
	var dat = new Date();
	return Date.UTC(dat.getFullYear(),dat.getMonth(),dat.getDate(),dat.getHours(),dat.getMinutes(),dat.getSeconds());
}
</script>