window.jBr = function(id){
	var o = jBr.id(id),i = parseInt(jBr.att(o,'jbrid'),10);
	if(isNaN(i)){
		i = jBr.E.length;
		jBr.att(o,'jbrid',i);
		jBr.E[i] = {o:o,i:i};
	}
	return jBr.E[i];
}
window.$$ = jBr;
jBr.extend = function(){
	var alvo=this, t=alvo, fonte, p, i=0;
	if(arguments.length>1){
		i++;
		alvo = t = arguments[0];
	}
	for(; fonte=arguments[i]; i++){
		for(var pp in fonte){
			p = fonte[pp];
			if(pp.charAt(0)!='@'){
				if(p&&p.splice){
					var tp = t[pp];
					t[pp] = tp&&tp.splice?tp.concat(p):[].concat(p);
				}else if(p&&(typeof p=='object')){
					t[pp] = jBr.extend(t[pp]||{},p);
				}else t[pp] = p;
				continue;
			}
			if(pp=='@init')p.call(t);
		}
	}
	return alvo;
}
jBr.on = function(e){
	if(!jBr.isFn(this.e[e]))return this;
	var ag=[];
	for(var i=0,v; v=arguments[++i];)ag[i] = v;
	this.e[e].apply(this,ag);
	return this;
};
// *********************** //
//Number
jBr.extend(Number.prototype,{
abs:function(){return Math.abs(this);},
round:function(){return Math.round(this);},
floor:function(){return Math.floor(this);},
ceil:function(){return Math.ceil(this);},
pow:function(ex){return Math.pow(this,ex);},
sqrt:function(){return Math.sqrt(this);},
max:function(a){return Math.max(this,a);},
min:function(a){return Math.min(this,a);}
});
//String
jBr.extend(String.prototype,{
trim:function(s,n){
	var r = this.replace(/^\s*|\s*$/g,'');
	if(s)r = r.replace(/[ \t]{2,}/g,' ');
	if(n){
		r = r.replace(/\r?\n/g,'\n').split('\n');
		for(var i=0; i<r.length; i++)r[i] = r[i].trim();
		r = r.join('\n');
	}
	return r;
},
ltrim:function(){return this.replace(/^\s+\s/g,'');},
rtrim:function(){return this.replace(/\s+\s$/g,'');},
explode:function(){return this.split(' ');},
reverse:function(){return this.split('').reverse().join('');},
sort:function(){return this.split('').sort().join('');},
low:function(){return this.toLowerCase();},
upp:function(){return this.toUpperCase();},
tag:function(c){
	var a = ['À|Á|Â|Ã|Ä|Å','à|á|â|ã|ä|å|ª|@','ß','Ç|¢','ç','È|É|Ê|Ë|€','è|é|ê|ë|&','Ì|Í|Î|Ï','ì|í|î|ï','£','Ñ','ñ','Ò|Ó|Ô|Õ|Ö','ò|ó|ô|õ|ö|º','\\$','†','Ù|Ú|Û|Ü','ù|ú|û|ü','Ý','ý|ÿ','¹','²','³','"|\'|\\?|!|\\.|:|,|;','\\s+','[^\\w-]'];
	var a2 = ['A','a','B','C','c','E','e','I','i','L','N','n','O','o','S','t','U','u','Y','y','1','2','3','','-','_'];
	var r = this;
	for(var i=0; i<a.length; i++)r = r.replace(new RegExp(a[i],'g'),a2[i]);
	if(c===1)return r.low();
	if(c===2)return r.upp();
	return r;
},
ucf:function(){
	var c = this.ltrim().charAt(0);
	return this.replace(c,c.upp());
},
ucw:function(s,n,l){
	if(l==null)l = 3;
	var w = this.trim(!s,!n).explode();
	for(var i=0,v; v=w[i]; i++){
		if(v.length>=l)w[i] = v.ucf();
	}
	return w.join(' ');
},
lpad:function(c,q){
	var v = this;
	for(var i=v.length; i<q; i++)v = c+v;
	return v;
},
rpad:function(c,q){
	var v = this;
	for(var i=v.length; i<q; i++)v += c;
	return v;
},
subs:function(i,f){
	if(i<0)i += this.length;
	if(f<0)f += this.length;
	if(!f&&f!==0)return this.substring(i);
	return this.substring(i,f);
},
Int:function(b){
	var n = parseInt(this,b);
	return n?n:0;
},
Float:function(){
	var n = parseFloat(this);
	return n?n:0;
}
});
// *********************** //
jBr.extend({
id:function(){
	var r=[],t,o,i=0,i2=0,a;
	for(;a=arguments[i++];){
		t = typeof a;
		if(t=='string'){
			if(document.getElementById)o=document.getElementById(a);
			else if(document.all)o=document.all[a];
			else if(document.layers)o=document.layers[a];
			else if(document[a])o=document[a];
		}else if(t=='object')o = a;
		else continue;
		if(o.nodeType==1)r[i2++] = o;
	}
	if(i2==0)return null;
	if(i2==1)return r[0];
	return r;
},
E:[],
att:function(o,n,v){
	if(v!=null){
		o.setAttribute(n,v+'');
		return v+'';
	}
	var r = o.getAttribute('jbrid');
	if(!r)r = '';
	return r;
},
agent:navigator.userAgent.low(),
platform:navigator.platform.low(),
XHTMLNS:'http://www.w3.org/1999/xhtml',
isOpera:function(){
	return(jBr.agent.indexOf('opera')!=-1);
},
isIE:function(b){
	var a='msie ';
	var A = jBr.agent;
	if(jBr.isNum(b))return(jBr.isIE()==b);
	return(A.indexOf(a)!=-1&&!jBr.isOpera()?A.subs(A.indexOf(a)+5).Int():0);
},
isNum:function(a){
	return(typeof a=='number');
},
isFn:function(o){
	return typeof o=='function'&&(!Function.prototype.call||typeof o.call=='function')?true:false;
},
encode:function(o,r){
	o = o||{};
	r = r||null;
	var v='';
	for(var k in o){
		if(!/string|number|boolean/.test(typeof o[k]))continue;
		v += escape(k)+'='+escape(o[k])+'&';
	}
	return v?v.replace(/&$/,''):r;
},
XMLHttpRequest:function(){
	if(typeof XMLHttpRequest!='undefined')return new XMLHttpRequest();
	var a = ['Microsoft.XMLHTTP','Msxml2.XMLHTTP','Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0'];
	for(var i=0,v; v=a[i]; i++){
		try{
			return new ActiveXObject(v);
		}catch(e){}
	}
	return null;
},
opacity:function(o,a,v){
	if(a==100)a = 99.99999;
	o.style.opacity = (a/100)+'';
	o.style.filter = 'alpha(opacity='+a+')';
	if(v===0);
	else if(v===1)o.style.visibility = a?'':'hidden';
	else o.style.display = a?'':'none';
},
before:function(el,ref){
	if(!el.splice)el = [el];
	for(var i=0,o;o=el[i++];)ref.parentNode.insertBefore(o,ref);
},
after:function(el,ref){
	if(!el.splice)el = [el];
	for(var i=el.length,o;o=el[--i];)ref.parentNode.insertAfter(o,ref);
},
append:function(pai,el){
	if(!el.splice)el = [el];
	for(var i=0,o;o=el[i++];)pai.appendChild(o);
},
prepend:function(pai,el){
	if(!pai.firstChild)jBr.append(pai,el);
	else jBr.before(el,pai.firstChild);
},
removeAll:function(el){
	if(!(el&&el.NodeType==1))return;
	while(el.hasChildNodes())el.removeChild(el.lastChild);
},
filho:function(o,el){
	if(!el)el = '';
	var r = [];
	if(!o)return r;
	if(o&&o.nodeType!==1)return r;
	for(var i=0,j=0,v; v=o.childNodes[i]; i++){
		if(v.nodeType!=1)continue;
		if(el&&(','+el+',').indexOf(','+v.nodeName.low()+',')<0)continue;
		r[j++] = v;
	}
	return r;
},
center:function(o,p,a){
	document.body.style.overflowY = 'scroll';
	if(!p)p = document.documentElement;
	var t = ((p.clientHeight/2)+p.scrollTop)-(o.offsetHeight/2);
	var l = ((p.clientWidth/2)+p.scrollLeft)-(o.offsetWidth/2);
	if(!a){
		if(t<p.scrollTop+15)t = p.scrollTop+15;
		if(l<p.scrollLeft+15)l = p.scrollLeft+15;
	}
	o.style.top = t+'px';
	o.style.left = l+'px';
},
each:function(a,fn,ref){
	if(!a)return;
	if(!fn)return;
	if(!a.slice&&!(typeof a=='object'&&'length' in a))a = [a];
	for(var i=0,v; v=a[i]; i++){
		if(fn.call((ref?ref:v),i,v))break;
	}
},
hash:function(){
	var h='',id,hs = function(){
		var _h = window.document.location.hash;
		_h = _h?_h.subs(1):'';
		if(_h!=h){
			h = _h;
			if(window.hashchange)window.hashchange();
		}
	};
	if('onhashchange' in window&&(!$.isIE()||$.isIE()>7)){
		window.onhashchange = function(){
			if(window.hashchange)window.hashchange();
		};
	}else id = setInterval(hs,500);
	hs();
},
addEvent:function(el,ev,fn){
	if(el.attachEvent){//IE
		el.attachEvent('on'+ev,fn);
	}else if(el.addEventListener){//Gecko/W3C
		el.addEventListener(ev,fn,true);
	}else{
		el['on'+ev] = fn;
	}
},
removeEvent:function(el,ev,fn){
	if(el.detachEvent){//IE
		el.detachEvent('on'+ev,fn);
	}else if(el.removeEventListener){//Gecko/W3C
		el.removeEventListener(ev,fn,true);
	}else{
		el['on'+ev] = null;
	}
},
stopEvent:function(e){
	e = e||window.event;
	if(jBr.isIE()){
		e.cancelBubble = true;
		e.returnValue = false;
	}else{
		e.preventDefault();
		e.stopPropagation();
	}
	return false;
},
mouse:{x:0,y:0,fn:null,e:{},
	on:jBr.on,
	move:function(i){
		var _ = this;
		var fn = function(e){
			var e = e||window.event;
			if(e.pageX!=null||e.pageY!=null){
				_.x = e.pageX;
				_.y = e.pageY;
			}else if(e.clientX!=null||e.clientY!=null){
				_.x = e.clientX+document.body.scrollLeft-document.body.clientLeft;
				_.y = e.clientY+document.body.scrollTop-document.body.clientTop;
			}
			_.on('move');
		}
		if(i)jBr.addEvent(document,'mousemove',fn);
		else jBr.removeEvent(document,'mousemove',fn);
		return this;
	}
},
xml:function(x,tipo,ref){
	if(tipo===1){
		if(!x||!('getElementsByTagName' in x))return null;
		var xv = x.getElementsByTagName('*')[0];
		return jBr.xml(xv,2);
	}
	if(!x||x.nodeType!=1)return null;
	var r = {},xn = x.nodeName.low(),xf = jBr.filho(x);
	if(tipo===2)r = function(a){
		if(typeof a=='string')return x.getAttribute(a);
		return null;
	};
	if(!xf.length){
		if(x.firstChild&&x.firstChild.nodeValue)return x.firstChild.nodeValue;
		return '';
	}
	if(!ref)ref = null;
	jBr.each(xf,function(i,v){
		var n = v.nodeName.low();
		if(!r[n]){
			r[n] = [];
			r[n].pai = ref;
			r[n].paix = x;
			r[n].pain = xn;
		}
		var i2 = r[n].length;
		r[n][i2] = function(){
			return jBr.xml(v,0,this[i2]);
		};
		jBr.each(v.attributes,function(){
			r[n][i2][this.name.low()] = this.value;
		});
	});
	return r;
}
});
// *********************** //
// jBr.ajax		v 1.0
jBr.ajax = function(){
	this.a = jBr.XMLHttpRequest();
}
jBr.ajax.prototype = {e:{},
on:jBr.on,
r:function(n,v){
	this.a.setRequestHeader(n,v);
	return this;
},
o:function(url,m,a,s,r){
	a = a?true:false;
	if(!this.a){
		alert('Esse navegador não suporta Ajax.');
		return this;
	}
	this.a.open(m,url,a);
	for(var k in r)this.r(k,r[k]);
	this._fn();
	this.a.send(jBr.encode(s));
	return this;
},
_fn:function(){
	this.on('ini');
	var t = this;
	this.a.onreadystatechange = function(){
		t._onr();
	}
	return this;
},
_onr:function(){
	this.rst = this.a.readyState;
	if(this.rst==4){
		this.stt = this.a.status;
		this.txt = this.a.responseText;
		this.xml = this.a.responseXML;
	}
	this.on('st'+this.rst);
	return this;
},
t:function(){
	return this.a?true:false;
},
c:function(){
	this.e = {};
	return this;
}
};
// *********************** //
jBr.animar = {st:'width',ep:'[a]px',a:100,to:0,min:.2,v:2,t:33,id:null,e:{},
on:jBr.on,
set:function(v,t){
	if(v!=null)this.a = v;
	if(t!=null)this.to = t;
	return this.onset().on('set');
},
onset:function(){
	this.o.style[this.st] = this.ep.replace(/(\[a\])/,this.a);
	return this;
},
time:function(s){
	var _ = this;
	if(!_.id||s)_.id = setTimeout(function(){_.stop().go();},_.t);
	return _;
},
stop:function(){
	clearTimeout(this.id);
	this.id = null;
	return this.on('stop');
},
go:function(t){
	if(t!=null){
		this.stop().to = t;
		this.on('ini');
	}else{
		if(this.id)return this;
		t = this.to;
	}
	if(t!=this.a){
		if(Math.abs((this.a-t)/this.v)<=this.min)this.a = t;
		else this.a += (t-this.a)/this.v;
		this.set().on('run').time();
	}else this.on('fim');
	return this;
}};
// *********************** //
jBr.fade = function(o,e){
	jBr.extend(this,jBr.animar,o);
	this.o = e;
}
// *********************** //
jBr.anime = function(o,e){
	jBr.extend(this,jBr.animar,o);
	this.o = e;
}
// *********************** //
jBr.mask = function(){
	this.divobj;
	this.show = function(){
		if(!$('xdivmasking').o){
			var divEle = document.createElement('div');
			divEle.setAttribute('id','xdivmasking');
			document.body.appendChild(divEle);
			var divSty = jBr.id('xdivmasking').style;
			divSty.position = 'absolute';
			divSty.top = '0px';
			divSty.left = '0px';
			divSty.zIndex = '46';
			divSty.opacity = '.50';
			divSty.backgroundColor = '#000';
			divSty.filter = 'alpha(opacity=50)';

			var divFram = document.createElement('iframe');
			divFram.setAttribute('id','xmaskframe');
			document.body.appendChild(divFram);
			divSty = jBr.id('xmaskframe').style;
			divSty.position = 'absolute';
			divSty.top = '0px';
			divSty.left = '0px'; 
			divSty.zIndex = '1';
			divSty.border = 'none';
			divSty.filter = 'alpha(opacity=0)';
		}
		this.divobj = jBr.id('xdivmasking');
		this.waitifrm = jBr.id('xmaskframe');

		var dsh = document.documentElement.scrollHeight;
		var dch = document.documentElement.clientHeight;
		var dsw = document.documentElement.scrollWidth;
		var dcw = document.documentElement.clientWidth;

		var bdh = (dsh>dch)?dsh:dch;
		var bdw = (dsw>dcw)?dsw:dcw;

		this.waitifrm.style.height = this.divobj.style.height = bdh+'px';
		this.waitifrm.style.width = this.divobj.style.width = bdw+'px';	
		this.waitifrm.style.display = this.divobj.style.display = 'block';
	}
	this.hide = function(){
		this.waitifrm.style.display = this.divobj.style.display = 'none';
	}
}
// *********************** //
jBr.center = function(o,p,a){
	if(!p)p = document.documentElement;
	var t = ((p.clientHeight*0.5)+p.scrollTop)-(o.offsetHeight/2);
	var l = ((p.clientWidth*0.5)+p.scrollLeft)-(o.offsetWidth/2);
	if(!a){
		if(t<p.scrollTop+15)t = p.scrollTop+15;
		if(l<p.scrollLeft+15)l = p.scrollLeft+15;
	}
	o.style.top = t+'px';
	o.style.left = l+'px';
}
// *********************** //
