
use=function(s){
	var css=/\.css$/.test(s);
	this._use_file_list = this._use_file_list || [];
	var url = css||/\.js/.test(s)?s:s.replace(/\./g,'/')+'.js';
	if(this._use_file_list.index(url)==-1){
		$.ajax(url,{async:0,onload:function(e){
			if(css){
				var a = e.text.replace(/\}/g,function(c,i,s){return /,|\'|\"/.test(s.charAt(i+1))?c:';'+c}).split(';}'),u=location.href;
				s=u.slice(0,u.lastIndexOf('/'))+'/'+s.slice(0,s.lastIndexOf('/')+1);
				a.each(function(c){if(c){
					var i=c.indexOf('*/');c=c.slice(i<0?0:i+2)+'}';
					c=c.replace(/url\([a-z]+[^\)]*\)/g,function(c){c='url('+s+c.replace(/^url\(|^\'|^\"|\'$|\"$/g,'');return c;});
					c=c.replace(/src=\'[a-z]+[^\']*\'/img,function(c){c='src=\''+s+c.replace(/^src=\'/g,'');return c;});
					var l=c.split('{');$A(l[0].split(',')).each(function(s){if(l[1])$.addRule(s+'{'+l[1])})}});
			}else  (new Function(e.text))();
		}});
		this._use_file_list.push(url);
	}
};

Class={create:function(){return function(){this.initialize.apply(this,arguments)}}};
window._root=document.documentElement;
Object.each=function(o,f){for(var i in o)f(i,o[i])};
Object.extend=function(o,t){if(typeof o=='string'){var a=o.split('.'),o=window;a.each(function(t,l){if(a[l+1]=='prototype')o[t]=Class.create();	o[t]=o[t]||{};o=o[t]})}for(var i in t)o[i]=t[i];return o};
Object.join=function(o){var s='';Object.each(o,function(key,value){s+='&'+key+'='+encodeURIComponent(value)});return s.slice(1)};
Function.prototype.bind=function(){var t=this,o=arguments[0];return function(){var a=$A(arguments);a.push(window.event);return t.apply(o,a)}};

var $A=function(a){var t=[];for(var i=0,l=a.length;i<l;i++)t.push(a[i]);return t};
Object.extend(Array.prototype,{
	each:function(o){for(var i=0,l=this.length;i<l;i++)o(this[i],i)},
	remove:function(o){for(var i=0;i<this.length;i++)if(this[i]==o)return this.removeAt(i)},
	index:function(o){for(var i=0;i<this.length;i++)if(this[i]==o)return i;return -1;},
	removeAt:function(i){var t=this,i=i||0,a=t[i];t.splice(i,1);return a},
	add:function(o){this.push(o)},
	addAt:function(index,o){var t=this;for(var i=t.length;i>index;i--)t[i]=t[i-1];t[index]=o}
});

Object.extend(String.prototype,{
	isInt:function(){return isNaN(parseInt(this,10))?false:true;},
	toInt:function(){return this.isInt()?parseInt(this,10):0},
	trim:function(){return this.replace(/(^\s*)|(\s*$)/g,'')}
});
Object.extend('Try',{
	these:function(){for(var i=0;i<arguments.length;i++)try{return arguments[i]()}catch(e){}}
});

Object.extend('Event.dispatcher',{
	addListener:function(event, handler){var name='__q_'+event.toLowerCase();this[name]=this[name]||[];this[name].push(handler)},
	dispatchEvent:function(o){if(o.type)o.type=o.type.toLowerCase();this.dispatchQueue(o)},
	dispatchQueue:function(o){var q=this['__q_'+o.type]||[];q.each(function(v){typeof v=='object'?v[o.type||'handleEvent'](o):v.apply(this,[o])})}
});

Object.extend('Ajax',{
	getTransoprt:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')})||false},
	getXmlDocument:function(){return Try.these(function(){return new ActiveXObject('Msxml2.XMLDOM')},function(){return new ActiveXObject('Microsoft.XmlDom')},function(){return document.implementation.createDocument("","",null)})||false}
});
Object.extend(Object.extend('Ajax.Request.prototype',Event.dispatcher),{
	initialize:function(url,o){var t=this;t.transport=Ajax.getTransoprt();t.options=Object.extend({method:'get',async:true,parameters:'',mimeType:'text'},o||{});t.request(url)},
	request:function(u){
		var t=this,o=t.options,p=t.transport;
		//u?u+=(u.indexOf('?')>-1?'&':'?')+'rn='+Math.random():'';
		p.open(o.method,encodeURI(u),o.async?true:false);
		if(!$.ie)p.overrideMimeType(o.mimeType=='xml'?'text/xml':'text/html');
		p.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		$.ie?p.onreadystatechange = t.onState.bind(t):p.onload=function(){this.onState(200)}.bind(t);
		p.send(typeof o.parameters=='string'?o.parameters:Object.join(o.parameters));
	},
	onState:function(status){
		var t = this.transport,o=this.options;
		if(status==200){
			
			var r=t.responseText,e={type:'onload',text:r,transport:t};this.text=r;
		
			if(o.mimeType=='xml'){r=Ajax.getXmlDocument();$.ie?r.loadXML(t.responseText):$.whitespace(r=t.responseXML||{});this.xml=e.xml=r}
			
			if(o.onload)o.onload(e);
			if(o.container)$(o.container).innerHTML=r;
			setTimeout(function(){this.dispatchEvent(e)}.bind(this),10);
			
		}else if(typeof status =='number'){if(o.onfailure)o.onfailure({transport:t});setTimeout("this.dispatchEvent({type:'onfailure'})",0);}
		else if(t.readyState==4)this.onState(t.status);
	}
});

function $(o,d){var d=d||document,o=d.getElementById(o)||o;return typeof o=='object'&&o!=d.body&&o!=d&&o!=window?o:this.initialize?this.initialize(o):new $(o)};
$.prototype={
	initialize:function(o){
		var t = this;
		if(!t.load)t._addEvent(['load','contextmenu','paste','resize','click','dblclick','mousedown','mouseup','mouseover','mouseout','keydown','keyup','change','select','mousemove','blur','focus','drag']);
		typeof o!='string'?this.elements=[o||'']:o.split(' ').each(function(o){t.find(o).elements});
	},
	each:function(o){this.elements.each(o);return this},
	find:function(o){
		var t=this,a=t.elements||[document];
		t.elements=[];
		!o?this.elements=a:typeof o!='string'?this.elements=[o||'']:o.split(',').each(function(o){																		
			if(/^#/.exec(o))t.elements.push($(o.replace(/^#/,''),a[0].ownerDocument||a[0]));
			else if(o.isInt())a.each(function(a){t.elements.push(a.childNodes[o])});
			else{
				var obj=/^\./.exec(o)?{key:'className',value:o.replace(/^\./,'')}:{key:'tagName',value:o.toUpperCase()};
				a.each(function(o){$A(o.getElementsByTagName('*')).each(function(o){if(o[obj.key]==obj.value)t.elements.push(o)})});
			}
		});
		return t;
	},
	id:function(t){return t?this.each(function(o){o.id=t}):this.elements[0].id},
	css:function(t){return this.each(function(o){Object.each(t,function(k,v){o.style[k]=v})})},
	style:function(k,v){
		var n=this.elements[0],f=k,k=$.ie?k:k.replace(/[A-Z]/g,function(c){return "-"+c});
		return v?this.each(function(o){o.style[k]=v}):Try.these(function(){return n.currentStyle[k]},function(){return document.defaultView.getComputedStyle(n, null).getPropertyValue(k)},function(){return n.style[f]})
	},
	html:function(t){return typeof(t)=='string'?this.each(function(o){o.innerHTML = t}):this.elements[0]?this.elements[0].innerHTML:null},
	append:function(m,t){
			var n=[],d=document;
			t?n.push(t.parentNode.insertBefore(typeof m=='string'?d.createElement(m):m,t)):this.each(function(o){n.push(o.appendChild(typeof m=='string'?d.createElement(m):m))});
			this.elements = n;
		return this;
	},
	removeChild:function(){return this.each(function(n){$A(n.childNodes||[]).each(function(n){n.parentNode.removeChild(n);n=null;})})},
	remove:function(){this.each(function(n){n.parentNode.removeChild(n);n=null;})},
	parent:function(){this.elements=[this.last().parentNode];return this},
	first:function(){return this.elements[0]},
	last:function(){return this.elements[this.elements.length-1]},
	attr:function(k,v){
		if(typeof(k)=='string')return v?this.each(function(n){n[k]=v}):this.first()[k];
		else return this.each(function(n){Object.each(k,function(k,v){n[k]=v})});
	},
	addClass:function(t){var t=t;return this.each(function(o){o.className=t})},
	alphaImage:function(u){
		var c={cssText:'float:left;'};
		if(!$.w3){this.append('div').css({cssText:";float:left;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+u+"',sizingMethod='scale')"});c.filter="alpha(opacity=0)"}
		return this.append('img').css(c).attr('src',u);
	},
	toggle:function(over,out){return this.mouseover(over).mouseout(out)},
	whitespace:function(){this.elements.each(function(o){$A(o.childNodes||[]).each(function(o){o.nodeType==3&&!/\S/.test(o.nodeValue)?$.remove(o):$.whitespace(o)})})},
	_addEvent:function(a){var t=this;a.each(function(i){t[i]=function(f){return t.each(function(n){$.ie?n.attachEvent('on'+i,f.bind(n)):n.addEventListener(i,f.bind(n),false)})}});}
};
Object.extend('$',{
	ie:document.all?true:false,
	ff:document.getFeature?true:false,
	w3:window.XMLHttpRequest?true:false,
	cache:function(key,val,day){
		var night=1001,d=new Date(),items=document.cookie.split(';');d.setTime(d.getTime()+(day?day:night)*24*60*60*1000);
		val?document.cookie=key+'='+val+';expires='+d.toGMTString()+';path=/;domain='+document.domain:items.each(function(i){i=i.split('=');i[0].trim()==key?val=decodeURIComponent(i[1]).trim():''});
		return val;
	},
	mouseX:function(e){return e.pageX||e.clientX},
	mouseY:function(e){return e.pageY||e.clientY},
	getXY:function(o){var x=0,y=0;while(o){x+=o.offsetLeft;y+=o.offsetTop;o=o.offsetParent}return {x:x,y:y}},
	getRule:function(t,d){var t=t,s='',d=d||document;$A(d.styleSheets).each(function(o){$A(o.rules||o.cssRules).each(function(o){if(o.selectorText==t)s=o.style})});return s},
	addRule:function(t,i,d){var i=i||0,d=d||document,s=d.styleSheets[i],a=t.split('{');$.ie?s.addRule(a[0],a[1].replace(/}$/gm,'')):s.insertRule(t,s.cssRules.length)},
	ajax:function(t,o){return new Ajax.Request(t,o)},
	ready:function(o){var d=document;if($.ie&&!d.isReady){d.isReady=o;(function(){try{d.documentElement.doScroll("left")}catch(e){setTimeout(arguments.callee,0);return}o()})()}else if($.ff)d.addEventListener("DOMContentLoaded",o,0);else $(window).load(o);}
});
Object.each($.prototype,function(t){$[t]=function(){var a=$A(arguments),n=a.removeAt(0),n=n.tagName?n:$(n),o=new $().find(n);return o[t].apply(o,a)}});

