String.prototype.trim=function(){
 return this.replace(/^\s+|\s+$/g, '')
}
String.prototype.clean=function(){
 return this.replace(/\s+/g, ' ').trim()
}
String.prototype.contains=function(s, b){
 return (b) ? (b + this + b).indexOf(b + s + b) > -1 : this.indexOf(s) > -1
}
function removeChilds(e){
     var c;
     while ((c=e.firstChild)){
    	e.removeChild(c);
    }
}
function ACN(e){
	if(arguments.length>=2){
	    util.map(arguments, function(n){
		if(util.isString(n)||util.isNumber(n))
		    n=document.createTextNode(n);    
		if(n)
		    e.appendChild(n)
	    },1)
	}
	return e
}
var d=document,dwr={
	p:function(s,n){
  		var r=new RegExp('[\?&]?' + n + '=([^&]*)[&$]?','gi');
  		return s.match(r)?RegExp.$1:null
	},
	j:function(p){
        var a=arguments;
        for(var i=1;i<a.length;i++){
        	var r=(p||'')+a[i],s=r.match(/.+\.css$/)?'<link href='+r+' type=text/css rel=stylesheet>':'<SCR'+'IPT src='+r+' charset=utf-8 type=text/javas'+'cript ></SCR' + 'IPT>';
			d.write(s)        	
        }
	},
	d:function(v,b){
		if(v){
			var a=v.split(','),e,p=b+'scripts/';
			for(var i=0,l=a.length;i<l;i++){
				e=a[i];
				if('greybox'==e)
					dwr.j(window.GB_ROOT_DIR||p+"greybox/",'gb_styles.css','AJS.js','AJS_fx.js','gb_scripts.js')	
				else if('upload'==e) 
					dwr.j('/dwr/interface/','UploadMonitor.js')
				else if('myself'==e) /* 网页自己的js */
					dwr.j('/jsflow',dwr.r(location.href,'index.html')+'.js')
				else
					dwr.j(p,e+'.js')		
			}
		}		
	},
	e:function(){
		var s=d.getElementsByTagName("script");
		
		
		for(var i=0;i<s.length;i++){
			if(s[i].src&&s[i].src.match(/(.*)scripts\/dwr\.js\??(.+)?$/)){
				var r=RegExp.$1,p=RegExp.$2;
				dwr.j(r,'dwr/engine.js','dwr/util.js','dwr/interface/DWRAction.js','scripts/command.js','scripts/util.js');
				if(p)
					dwr.d(dwr.p(p,'load'),r)		
			}
		}	
	},
	r:function(a,b){
	    if(a.match(/.+\/$/)) a+=b;
	    return a.match(/(?:(?:http|https|ftp)\:\/\/)?[^\/]+([^\.]+)(?:\.html|\.htm).*/)?RegExp.$1:''	
	}
};
dwr.e()
