﻿var At=[0],JS={},Nav={},Control={},Search={},Set={},C={},K={},Lang={},Tran={},MYUI={};
var Hot=Slide=Fade=Blend=Chaos={},_drop,_map,_mask,_hint,_div,_win,_nosize;
function Select_Before(c){return true};
function Select_After(c,p){};
function Act_Before(o,c,p){return true};
function Act_After(o,c,p){};
function Upload_After(v){};
function Login_Before(p){};
function Login_After(p){};

String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"")};
String.padding=function(c,n){var l=[];for(var i=0;i<n;i++) l.push(c);return l.join('')};
String.prototype.padding=function(c,n){
	var s=this,v=n-s.length;
	if(v<=0) return s;
	for(var i=0;i<v;i++) s=c+s;
	return s;
};
Number.prototype.padding=function(c,n){return this.toString().padding(c,n);};
Date.margin=2000-new Date(2000,1,1).getYear();
Date.arr=[31,28,31,30,31,30,31,31,30,31,30,31];
Date.getDays=function(y,m){
	if(m==1 && (y%400==0 || (y%4==0 && y%100>0))) return 29;
	return Date.arr[m];
};
Date.prototype.getDays=function(){return Date.getDays(this.realYear(),this.getMonth());};
Date.prototype.realYear=function(){return this.getYear()+Date.margin;};
Date.prototype.realMonth=function(){return this.getMonth()+1;};
Date.prototype.equals=function(d){return this.getYear()==d.getYear() && this.getMonth()==d.getMonth() && this.getDate()==d.getDate();};
Date.prototype.toDate=function(){return this.realYear().padding(" ",4)+"/"+this.realMonth().padding("0",2)+"/"+this.getDate().padding("0",2);};

if(typeof(HTMLElement)!="undefined"&&!window.opera){   
  HTMLElement.prototype.__defineGetter__("canHaveChildren",function(){   
	  return !/^(area|base|basefont|col|frame|hr|img|br|input|select|textarea|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());   
  });   
  HTMLElement.prototype.__defineGetter__("outerHTML",function(){   
	  var a=this.attributes,str="<"+this.tagName,i=0;
	  for(;i<a.length;i++)  if(a[i].specified) str+=" "+a[i].name+'="'+a[i].value+'"';   
	  if(!this.canHaveChildren) return str+" />";   
	  return str+">"+this.innerHTML+"</"+this.tagName+">";   
  });   
  HTMLElement.prototype.__defineSetter__("outerHTML",function(s){   
	  var d=document.createElement("DIV");
	  d.innerHTML=s;   
	  for(var i=0;i<d.childNodes.length;i++)this.parentNode.insertBefore(d.childNodes[i],this);   
	  this.parentNode.removeChild(this);   
  });   
}

Array.prototype.indexOf = function(v){
	for(var i=0; i<this.length; i++) if(this[i]==v) return i; 
    return -1;
};
Array.prototype.remove = function(pos){
	if(pos==null||pos<0||pos>=this.length) return;
	for(var i=pos;i<this.length-1;i++) this[i]= this[i+1];
    return this.pop();
};
function $(){
	if(arguments.length <= 1) return document.getElementById(arguments[0]);
	var arr=[];
	for (var i=0;i<arguments.length;i++) arr.push($(arguments[i]));
	return arr;
};
function $$(n,t){
	if(!t) return document.getElementsByTagName(n.toUpperCase());
	if(typeof(n)=="string") return $(n).getElementsByTagName(t.toUpperCase());
	else return n.getElementsByTagName(t.toUpperCase());
};
function $$$(n){return document.getElementsByName(n);};
function ns(s){if(!s) return "";return s.constructor==Array?s[0]:s.toString();}
function using(){
	for(var i=0;i<arguments.length;i++){
		var n=arguments[i];
		if(JS[n]) return;
		JS[n]=1;
		try{
		var s=Http.get("/js/"+n.replace(/\./g,"/")+".js");
		if(s) eval(s);
		}catch(e){alert(n);}
	}
};
var F={
isArray:function(o){ return o&&o.constructor==Array.toString()},
unmask:function(s){
	var a=[];
	for(var i=0;i<s.length;i++) a.push(String.fromCharCode(s.charCodeAt(i)-1));
	return a.join('');
},
xml:function(p){
	var s="";
	for(var e in p)s+="<"+e+">"+Xml.escape(p[e])+"</"+e+">";
	return s;
},
sum:function(a,b){ return (a+b)*(b-a+1)/2 },
factorial:function(a,b){ 
	for(i=a,c=1;i<=b;i++) c=i*c;
	return c;
},
ns:function(s){return F.isArray(s)?s[0].toString():s.toString();},
sort:function(x,y){
	if(typeof(x)=="object") return F.sort(x.key,y.key);
	else if(typeof(x)=="number") return x==y?0:(x>y?1:-1);
	else {
		x=x.toString();y=y.toString();
		if(x.length==y.length) return x==y?0:(x>y?1:-1);
		return x.length>y.length?1:-1;
	}
},
sort2:function(x,y){
	if(typeof(x)=="object") return F.sort(x.value,y.value);
	else return F.sort(x,y);
},
format:function(v,len){
	v=parseFloat(v);
	if(isNaN(v)) return '';
	if(len==null) len=2;
	var base=Math.pow(10,len);
	v=(Math.round(v*base)/base).toString();
	var p=v.indexOf(".")+1;
	if(p==0){ v+="."; p=v.length; }
	for(var i=0;i<len;i++) v+="0";
	return v.substr(0,p+len);
}};
var Flash={
spacer:"|",
size:function(w,h){this.width=w;this.height=h;},
set:function(n,v){this.para={};this.add(n,v);},
add:function(n,v){
	if(!this.para) this.para={};
	if(!this.para[n]) this.para[n]=[];
	this.para[n].push(v);
},
write:function(n){
	var s=[],t=[];
	if(this.para){
		for(var e in this.para){
			var x=[],p=this.para[e];
			for(var i=0;i<p.length;i++) x.push(p[i]);
			t.push(e+"="+x.join(this.spacer));
		}
	}
	if(Nav.FF){
		s.push("<embed type='application/x-shockwave-flash' src='"+this.src+"' quality='high' menu='false' wmode='transparent' width='"+this.width+"' height='"+this.height+"'");
		if(this.bgcolor) s.push(" bgcolor='"+this.bgcolor+"'");
		if(this.para) s.push(" FlashVars='"+t.join("&")+"'");
		s.push("></embed>");
	}
	else{
		s.push("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
		s.push("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width="+this.width+" height="+this.height+">");
		s.push("<param name='movie' value='"+this.src+"' />");
		s.push("<param name=wmode value='transparent'>");
		if(this.bgcolor) s.push("<param name='bgcolor' value='"+this.bgcolor+"'>");
		s.push("<param name='quality' value='high' />");
		s.push("<param name='menu' value='false' />");
		if(this.para) s.push("<param name='FlashVars' value='"+t.join("&")+"'>");
		s.push("</object>");
	}
	if(n) $(n).innerHTML=s.join('');
	else document.write(s.join(''));
}};
var SWFUpload={
	count:0,
	instances:{},
	err:function(file,code,msg){
		switch (code) {
			case -100: return "您添加太多文件队列了!\n" + (msg == 0 ? "" : "您最多只能选择 "+msg+" 个文件。");
			case -110: return "文件太大！";
			case -120: return "文件零字节！";
			case -130: return "文件格式非法！";
			case -280: 
			case -290: return "文件上传取消";
			default: return "文件处理有误，请检查文件是否已损坏或格式不符！";
		}
	},
	create:function(o){
		o.flash="swfupload_"+(this.count++);
		this.instances[o.flash]=o;
		var rnd=Date.parse(new Date());
		if(!o.fileQueueError) o.fileQueueError=function(file,code,msg){alert(SWFUpload.err(file,code,msg));};
		if(!o.fileDialogComplete)o.fileDialogComplete=function(nsel, nlist){$(this.flash).StartUpload()};
		if(!o.uploadStart) o.uploadStart=function(){setTimeout("document.getElementById('"+this.flash+"').ReturnUploadStart(true)",0);return true;};
		if(!o.uploadError) o.uploadError=function(file,code,msg){alert(SWFUpload.err(file,code,msg));};
		var s=[],url=encodeURIComponent((this.domain?"http://"+this.domain:"")+'/upload.ashx?w='+(this.w||700)+'&h='+(this.h||1000)+(this.fill?'&fill=1':'')+(this.keep?'&keep=1':''));
		s.push('<object id="'+o.flash+'" type="application/x-shockwave-flash"');
		if(Nav.FF) s.push(' data="'+(this.domain?"http://"+this.domain:"")+'/js/pic/upload.swf?rnd='+rnd+'"');
		else s.push(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"');
		s.push(' width="110" height="24">');
		s.push('<param name="movie" value="'+(this.domain?"http://"+this.domain:"")+'/js/pic/upload.swf?rnd='+rnd+'" />');
		s.push('<param name="wmode" value="transparent"><param name="quality" value="high" /><param name="menu" value="false" /><param name="allowScriptAccess" value="always" />');
		s.push('<param name="FlashVars" value="movieName='+o.flash+'&uploadURL='+url+'&useQueryString=false&requeueOnError=false&filePostName=Filedata&fileTypes='+(this.ext?this.ext:"*.*")+'&fileTypesDescription=Files&fileSizeLimit='+(this.limit?this.limit:"5")+'%20MB&fileUploadLimit=0&fileQueueLimit=1&debugEnabled=false&buttonImageURL='+encodeURIComponent((this.domain?"http://"+this.domain:"")+'/js/pic/upload.gif')+'&buttonWidth=110&buttonHeight=24&buttonText='+encodeURIComponent('<span class=".txt">'+(this.text?this.text:Lang.upfile)+'</span>')+'&buttonTextTopPadding=2&buttonTextLeftPadding=22&buttonTextStyle='+encodeURIComponent('.txt{font:12px verdana}')+'&buttonAction=-110&buttonDisabled=false&buttonCursor=-2">');
		s.push('</object>');
		return s.join('');
	}
};
var Dom={
at:function(o){o.at=At.length;At.push(o);return o.at;},
create:function(n){return document.createElement(n);},
append:function(n){return document.body.appendChild(document.createElement(n));},
get:function(o,b){
	var v=o.get?o.get(b):o.value;
	if(o.error) throw o.error;
	return v;
},
number:function(n){
	var o=typeof(n)=='string'?$(n):n;
	o.style.imeMode="disabled";
	o.onkeydown=function(ev){
		var e=ev?ev:event;
		if(e.keyCode<48||e.keyCode>57) return false;
	};
},
reset:function(o){
	if(!o||!o.tagName) return;
	if(o.getAttribute("key")) return;
	if(o.type=='hidden') return;
	if(typeof(o.reset)=="function") return o.reset();
	if(o.value) return o.value=o.data!=null?o.data:"";
	if(o.old)o.innerHTML=o.old;
},
event: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){if($(s))$(s).style.display="none";if($(d))$(d).style.display="block";},
cancel:function(){
	var e=window.event||arguments[0];
	if(e.stopPropagation) e.stopPropagation();
	else e.cancelBubble=true;
},
img:function(){
	var o = new Image();
	for(var i=0;i<arguments.length;i++) o.src=arguments[i];
},
qq:function(s,o){
	if(!o) document.write("<a href='tencent://message/?uin="+s+"' title=\""+s+"\"><img src='/js/pic/qqcheck.gif' onload=\"Dom.qqdone('"+s+"',this)\" class='qq' /></a>");
	else{
		if(typeof(o)=="string")o=$(o);
		o.innerHTML="<a href='tencent://message/?uin="+s+"' title=\""+s+"\"><img src='/js/pic/qqcheck.gif' onload=\"Dom.qqdone('"+s+"',this)\" class='qq' /></a>";
	}
},
qqdone:function(s,o){
	var img = document.createElement("IMG");
	o.onload=null;
	img.style.cssText=o.style.cssText;
	img.src="http://wpa.qq.com/pa?p=1:"+s+":15";
	img.onload=function(){ Dom.replace(o,this);};
},
email:function(s){
	var v=F.unmask(s);
	document.write("<a href='mailto:"+v+"'>"+v+"</a>");
},
msn:function(s){
	var v=F.unmask(s);
	document.write("<a href='msnim:chat?contact="+v+"'>"+v+"</a>");
},
label:function(o){var n=o.getAttribute("label");if(!n)n=o.getAttribute("name");return n;},
replace:function(old,o){if(old&&old.parentNode)old.parentNode.replaceChild(o,old);},
remove:function(o){if(o&&o.parentNode)o.parentNode.removeChild(o);},
css:function(url,n){
	var o=$$("HEAD")[0],s=$("mycss");
	if(!s) return;
	if(F.ie)s.href=url;
	else{
		o.removeChild(s);
		s=o.appendChild(document.createElement("link"));
		s.id="mycss";
		s.type="text/css";
		s.rel="stylesheet";
		s.href=url;
	}
},
top:function(o,t,n){
	if (!t)t="TR";
	var f=o.parentNode;
	while (f.tagName!=t)f=f.parentNode;
	if(!n)return f;
	return f.getElementsByTagName(n);
},
scroll:function(){
	var a=document.documentElement,b=document.body;
	return {w:a.scrollWidth||b.scrollWidth,h:a.scrollHeight||b.scrollHeight,t:a.scrollTop||b.scrollTop,l:a.scrollLeft||b.scrollLeft};
},
unpop:function(){
	if(!_drop) return;
	if(_drop.hide) _drop.hide();
	else _drop.style.display="none";
	_drop=null;
},
client:function(){return {w:document.documentElement.clientWidth||document.body.clientWidth,h:document.documentElement.clientHeight||document.body.clientHeight};},
xy:function(o) {
	if(typeof(o)=="string") o=$(o);  
	if(o.parentNode === null || o.style.display == 'none') return {x:0,y:0};
	if(o.getBoundingClientRect) {
		var box = o.getBoundingClientRect();    
		var pos={x:box.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft), y:box.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop)};
		if(Nav.IE){	pos.x-=2;pos.y-=2;}
		return pos;
	}   
	if(document.getBoxObjectFor) {	
		var box = document.getBoxObjectFor(o);                 
		return {x:box.x - (o.style.borderLeftWidth?parseInt(o.style.borderLeftWidth):0), y:box.y - (o.style.borderTopWidth?parseInt(o.style.borderTopWidth):0)};     
	}
	var pos ={x:o.offsetLeft, y:o.offsetTop};
	var p = o.offsetParent;
	while (p&&p!=o) {
		pos.x += p.offsetLeft;
		pos.y += p.offsetTop;
		p = p.offsetParent;
	}
	p=o.parentNode;	
	while (p && p.tagName != 'BODY' && p.tagName != 'HTML'){
		pos.x -= p.scrollLeft;
		pos.y -= p.scrollTop;
		p = p.parentNode;
	}
	return pos;
},
view:function(o,c,fix){
	var tmp=(Nav.IE||c.style.position=="absolute")?0:c.offsetTop;
	var v=o.offsetTop-tmp+o.offsetHeight,t=c.scrollTop,h=c.offsetHeight,p=o.parentNode;
	if(v-o.offsetHeight<=t) c.scrollTop=v-o.offsetHeight-(Nav.IE?1:2);
	else if(v>t+h) c.scrollTop=v-h+1+(fix?fix:0);
}
};
var Xml={
escape: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");
},
unescape:function(s){
	if(s==null)return "";
	if(typeof(s)!="string") return s;
	return s.replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ");
},
load:function(s){
	s="<root>"+(s?s:"")+"</root>";
	var doc=window.ActiveXObject?new ActiveXObject("Microsoft.XMLDOM"):(new DOMParser()).parseFromString(s,'text/xml');
	if(window.ActiveXObject)doc.loadXML(s);
	return doc;
},
toString:function(p){
	var s=[];
	for(var e in p) s.push("<"+e+">"+this.escape(p[e])+"</"+e+">");
	return s.join('');
}};
var Url={
path:function(url){
	if(!url) return location.pathname.toLowerCase();
	url=url.toLowerCase();
	if(url.indexOf("http://")==0){
		url=url.substring(7);
		url=url.substring(url.indexOf('/'));
	}
	return url;
},
head:function(url){
	url=Url.path(url);
	var start=url.lastIndexOf('/')+1;
	var pos=url.indexOf('.',start);
	if(pos>-1) url=url.substring(0,pos);
	else if(url.substring(url.length-1)!="/") return url+"/";
	if((pos=url.indexOf('-',start))>-1) url=url.substring(0,pos);
	return url.replace("+","_");
},
dir:function(url){
	url=Url.path(url);
	if(url.substring(url.length-1)=="/") return url;
	var pos=url.lastIndexOf('/');
	if(pos>-1) return url.substring(0,pos+1);
	return "/";
},
name:function(url){
	url=Url.path(url);
	if(url.substring(url.length-1)=="/") return "";
	var pos=url.lastIndexOf('/');
	if(pos>-1) return url.substring(pos+1);
	return url;
}};
var Http={
queue:[],
create:function(){
	if(window.XMLHttpRequest)return new XMLHttpRequest();
	if (window.ActiveXObject){
		try{return new ActiveXObject("Microsoft.XMLHTTP")}
		catch(e){location="/http.html"}
	}
},
get:function(url){
	var h=Http.create(),ar=arguments,f=null;
	if(ar.length>=3){
		if(ar[1]) url="/getremote.ashx?http://"+arguments[1]+"/"+url;
		if(typeof(ar[2])=="function") f=ar[2];
	}
	else if(ar.length==2){
		if(typeof(ar[1])=="function") f=ar[1];
		else if(ar[1]) url="/getremote.ashx?http://"+arguments[1]+"/"+url;
	}
	h.open("GET",url,(f?true:false));
	if(f) h.onreadystatechange=function(){if(this.readyState<4) return;f(this.responseText);};
	h.send(null);
	if(!f)return h.responseText;
},
call:function(a,p,f,d){
	try{return Http.post(a,p,f,d);}
	catch(e){alert(e.message)}
},
post:function(a,p,c,d){
	if(!a)return;
	if(this.busy){return this.queue.push({a:a,p:p,c:c,d:d})}
	this.busy=true;
	if(c)c.busy=true;
	var s=p==null?"":(typeof(p)=="object"?Xml.toString(p):p),i=a.lastIndexOf('.'),h=this.create(),pre="";
	if(i>-1){
		pre=a.substring(0,i);
		a=a.substring(i+1);
		if(pre.indexOf("/")!=0) pre=Url.dir()+pre;
	}
	else pre=Url.head();
	if(c) h.onreadystatechange=function(){if(h.readyState<4) return;Http.analyse(h,c);};
	h.open("POST",pre+".ashx",c?true:false);
	h.setRequestHeader("SOAPAction", a);
	if(d)h.setRequestHeader("Authorization", d);
	h.setRequestHeader("Content-Type", "text/xml;charset=utf-8");
	if(document.body.lang)h.setRequestHeader("Accept-Language",document.body.lang);
	h.send("<?xml version='1.0'?><"+a+">"+s+"</"+a+">");
	if(!c) return Http.analyse(h);
},
analyse:function(h,c){
var T={};
try{eval(h.responseText);}catch(e){}
try{
	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);}
finally{
	this.busy=false;
	if(this.queue.length>0){var q=this.queue.pop();this.post(q.a,q.p,q.c,q.d);}
}
}};
var Cookie={
get:function(n){
	n+="=";var c=document.cookie,v="";
	if(c.length==0) return v;
	var a=c.indexOf(n);
	if(a==-1) return v;
	a+=n.length;
	var b=c.indexOf(";",a);
	if (b==-1) b=c.length;
	v=unescape(c.substring(a,b));
	return v;
},
set:function(n,v,h){
	var e=h==null?"":"; expires="+new Date((new Date()).getTime() + h * 3600000).toGMTString();
	document.cookie=n+"="+escape(v)+";path=/"+e;
},
load:function(n,v){
	try{
		if(v==null) v="";
		var s=Cookie.get(n);
		if(!s) return v;
		return eval("TxxT="+s);
	}
	catch(e){return v;}
},
save:function(n,o,h){this.set(n,this.toString(o),h);},
toString:function(o){
	if(!o) return "";
	var l=[];
	if(o.constructor==Array){
		for(var i=0;i<o.length;i++) l.push(this.toString(o[i]));
		return "["+l.join()+"]";
	}
	else if(o.constructor==Object){
		for(var e in o) l.push(e+':'+this.toString(o[e]));
		return "{"+l.join()+"}";
	}
	else if(typeof(o)=="string") return '"'+o.replace('"','\"')+'"';
	else return o.toString();
}};
var Check={
number:function(o){
	var v=o.value.trim(),z=o.getAttribute("zero"),a=Dom.label(o);
	if(!v) return o.value="";
	if(v==z) return o.value=z;
	v=parseFloat(v);
	if(isNaN(v)) throw{src:o,message:a+Lang.numerr}; 
	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{src:o,message:a+Lang.numdown+t};
	t=parseInt(o.getAttribute("upper"));
	if(t&&v>t)throw{src:o,message:a+Lang.numup+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();
	if(v.match(/[^\w\s\.,'\(\)<>"\-\&\/\\\?&@%$\:\*\!#]+/i))throw{src:o,message:Dom.label(o)+Lang.en};
},
acc:function(o){
	var v=o.value.trim();
	if(v.match(/[^\w\d_]+/i))throw{src:o,message:Dom.label(o)+Lang.acc};
},
email:function(o){
	var v=o.value.trim();
	if(!v.match(/^[\w.-]+@([0-9a-z\w-]+\.)+[a-z]{1,4}$/i))throw{src:o,message:Dom.label(o)+Lang.email};
	o.value=v;
},
date:function(o){
	var v=o.value.trim();
	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{src:o,message:Dom.label(o)+Lang.date};
	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{src:o,message:a+Lang.web};
	o.value=v;
},
exam:function(o){
	var k=o.getAttribute("kind"),n=o.getAttribute("name");
	try{
		var v=o.value,a=o.getAttribute("label"),t=o.getAttribute("need");
		if((t||v)&&Check[k])Check[k](o);
		v=o.value;
		if(v)v=v.trim();
		if(!a)a=n;
		if (t&&!v)throw{src:o,message:t};
		var m=o.getAttribute("min"),n=o.getAttribute("max");
		if (m&&v.length<m)throw{src:o,message:a+Lang.min[0]+m+Lang.min[1]};
		if (n&&v.length>n) v=v.substr(0,n);
		if ((t=o.getAttribute("equal"))&&$(t)&&$(t).value&&($(t).value.trim()!=v)) throw{src:o,message:o.getAttribute("note")?o.getAttribute("note"):Lang.equal};
		o.value=v;
		Check.warn(o,void(0));
	}
	catch(e){if(e.src) Check.warn(e.src,e);}
},
warn:function(o,e){
	o.error=e;
	var n=o.getAttribute("warn");
	if(!n) n=o.getAttribute("name");
	var d=$("warn_"+n);
	if(!d) return;
	if(o.error) d.error(o.error.message);
	else if(o.value) d.onfinish();
	else d.normal();
}};
var UI={
	init:function(o,c){
		if(o.tagName=="FORM") return false;
		var u=o.getAttribute("ui"),t;
		if((t=o.getAttribute("myset"))&&typeof(t)=="string") eval("o.myset="+t);
		if((t=o.getAttribute("myfocus"))&&typeof(t)=="string") eval("o.myfocus="+t);
		if((t=o.getAttribute("myblur"))&&typeof(t)=="string") eval("o.myblur="+t);
		
		if(c) c.add(o);
		if(!u){
			if(o.type=="text"||o.type=="password"||o.tagName=="TEXTAREA"){ if(c) u="text";}
			else if(o.getAttribute("search")) u="search";
			else if(o.id.indexOf("warn_")>=0) u="warn";
		}
		if(u){
			if(!UI[u]) using("ui."+u);
			if(UI[u].init(o,c)==false) return;
		}
		else if(u=o.getAttribute("myui")){
			if(!MYUI[u]) using("myui."+u);
			if(MYUI[u].init(o,c)==false) return;
		}
		else{
			var n=o.getAttribute("name");
			if(n){
				if(o.type=="hidden"||o.tagName=="SELECT") return o.set=function(v){this.value=v;if(this.myset)this.myset(v)};
				else if(o.type=="radio"||o.type=="checkbox")
				{
					if(o.getAttribute("key")) o.set=function(v){o.value=v;this.checked=false;if(this.myset)this.myset(v)};
					else o.set=function(v){this.checked=(this.value==v?true:false);if(this.myset)this.myset(v)};
					return;
				}
				else if(o.tagName=="IMG") return o.set=function(v){if(this.myset)this.myset(v);else this.src=v;};
				else if(o.tagName=="A") o.set=function(v){if(this.myset)this.myset(v);else this.href=v;};
				else {
					if(o.getAttribute("key")||o.getAttribute("always")) o.get=function(){return this.data;};
					return o.set=function(v){if(this.myset)this.myset(v);else this.innerHTML=v!=null?v:" ";};
				}
			}
		}
		for(var i=0;i<o.childNodes.length;i++)if(o.childNodes[i].nodeType==1) UI.init(o.childNodes[i],c);
	}
};
var Mask={
	show:function(){
		if(_mask)_mask.style.display="none";
		_mask=$("cmask");
		if(!_mask){	_mask=Dom.append("DIV");_mask.id="cmask";}
		Mask.fresh();
	},
	fresh:function(){
		if(!_mask) return;
		var s=Dom.scroll(),c=Dom.client();
		_mask.style.height=Math.max(s.h,c.h)+"px";
		_mask.style.width=Math.max(s.w,c.w)+"px";
		_mask.style.display="block";
	},
	hide:function(){
		if(!_mask) return;
		_mask.style.display="none";
		_mask=null;
	}
};
var Hint={
	show:function(s){
		Mask.show();
		if(_hint) _hint.style.display="none";
		_hint=$("chint");
		if(!_hint){_hint=Dom.append("DIV");_hint.id="chint";}
		if(s) _hint.innerHTML=s;
		Hint.fresh();
	},
	fresh:function(){
		if(!_hint) return;
		var c=Dom.client();
		_hint.style.display="block";
		_hint.style.left=parseInt((c.w-_hint.offsetWidth)/2)+"px";
		_hint.style.top=parseInt(Dom.scroll().t+(c.h-_hint.offsetHeight)/2)+"px";
	},
	hide:function(){
		if(!_hint) return;
		Mask.hide();
		_hint.style.display="none";
		_hint=null;
	}
};
Nav.Agent= navigator.userAgent.toLowerCase();
Nav.Strict=document.compatMode == "CSS1Compat";
Nav.Opera = Nav.Agent.indexOf("opera") > -1;
Nav.Chrome = (Nav.Agent.indexOf("chrome") > -1);
Nav.Safari = Nav.Agent.indexOf('safari') > -1;
Nav.IE = !Nav.Opera && Nav.Agent.indexOf("msie") > -1;
Nav.IE6 = !Nav.Opera && Nav.Agent.indexOf("msie 6") > -1;
Nav.IE7 = !Nav.Opera && Nav.Agent.indexOf("msie 7") > -1;
Nav.FF = Nav.Agent.indexOf("firefox/")>-1;
Nav.FF3 = Nav.Agent.indexOf("firefox/3.")>-1;
Nav.FF2 = Nav.Agent.indexOf("firefox/2.")>-1;
Nav.Gecko = !Nav.Safari && Nav.Agent.indexOf("gecko") > -1;
Nav.Windows = (Nav.Agent.indexOf("windows") > -1 || Nav.Agent.indexOf("win32") > -1);
Nav.Mac = (Nav.Agent.indexOf("macintosh") > -1 || Nav.Agent.indexOf("mac os x") > -1);

function init(o){
	if(Nav.IE){
		try{document.close();document.execCommand('BackgroundImageCache', false, true);}
		catch(e){}
	}
	using("lan."+(document.body.lang?document.body.lang:"zh"));
	if(!o)o=document.body;
	else if(typeof(o)=="string")o=$(o);
	UI.init(o);
	//document.body.style.visibility="visible";
	for(var e in Control){
		var c=Control[e];
		if(c.search && Search[c.search]) Search[c.search].control.push(e);
		if(c.preload) c.load();
		if(c.cmd&&c.auto)c.select();
	}
	document.onkeydown=function(){
		if(!_map) return;
		var k=window.event?window.event.keyCode:arguments[0].which;
		_map.process(k);
	};
	document.onclick=function(){Dom.unpop();};
	window.onresize=function(){
		if(_nosize) return _nosize=null;
		Dom.unpop();
		if(_hint)setTimeout("Hint.fresh()",10);
		else if(_mask)setTimeout("Mask.fresh()",10);
	};
	window.onscroll=function(){if(_hint) Hint.fresh();}
};
