
var undefined='undefined';function _def(stuff,context){context=context||window;if(!is_string(stuff))return(typeof stuff!=undefined&&stuff!=null);return Boolean(typeof context[stuff]!=undefined&&context[stuff]!=null);};function is_function(stuff){return Boolean(typeof stuff=='function');}function is_array(stuff){return Boolean(stuff instanceof Array)};function is_string(stuff){return Boolean(typeof stuff=='string');}function is_number(stuff){return Boolean(typeof stuff=='number');}function is_object(stuff){return Boolean(typeof stuff=='object'&&stuff!=null);}var find=function(e){return is_string(e)?document.getElementById(e):e;};if(!window.$)var $=find;function foreach(list,callback){if(!list.length||!is_function(callback))return;for(var i=0;i<list.length;i++)callback(list[i]);}var $extend=function(destination,source){destination=destination||{};for(var key in source){if(typeof source[key]!=undefined)destination[key]=source[key];}return destination;};var $clone=function(object){return is_object(object)?$extend({},object):{};};Number.random=function(limit){return Math.ceil(Math.random()*(limit||999999));};Number.prototype.toHex=function(){return this.toString(16);};Number.fromHex=function(hex){return parseInt(hex,16);};Number.prototype.toMoney=function(separator){separator=separator||',';var v=this.toString().replace('.',separator);return v;};Function.prototype.inScope=function(context){var slice=Array.prototype.slice;if(arguments.length<2&&!_def(arguments[0]))return this;var _method=this,args=slice.call(arguments,1);return function(){var a=Array.merge(args,arguments);return _method.apply(context,a);}};Function.prototype.callWith=function(args,context){if(!args)return this;var __method=this;if(!is_array(args))args=[args];return function(){return __method.apply(context,args);};};Function.prototype.extend=function(data){$extend(this,data);return this;};var _asString=function(k){var l=[];for(var j in k){switch(typeof k[j]){case'string':l.push(j+':"'+k[j]+'"\n');break;case'function':l.push(j+':function(){}\n');break;case'object':if(is_array(this[j]))l.push(j+':Array ['+k[j].join(',')+']\n');else{l.push(j+':Object { }\n');}break;case'number':case'boolean':l.push(j+':'+k[j]);break;}}return'Object { \n'+l.join(',')+'\n }';};Date.prototype.setFullDate=function(day,month,year){if(day)this.setDate(day);if(_def(month))this.setMonth(month);if(year)this.setFullYear(year);};var js=_def(window['jQuery'])?jQuery:{};js.pointers={pointers:{},read:function(id){return this.pointers['ptr'+id];},write:function(data){var key='';for(var i in this.pointers)if(this.pointers[i]==data)key=i;if(key==''){do{key='ptr'+Number.random();}while(this.pointers[key]!=null);this.pointers[key]=data;}return key.replace('ptr','');},free:function(id){if(_def(this.pointers['ptr'+id])){if(_def(this.pointers['ptr'+id]._object))$E(this.pointers['ptr'+id]._object).destroy();delete this.pointers['ptr'+id];}}};var _ptr=function(pointer,make){return js.pointers[(make!=null?'write':'read')](pointer);};js.browserinfo=(function(){var ua=navigator.userAgent.toLowerCase();var isOpera=ua.indexOf('opera')>-1;var FF=ua.indexOf('gecko')!=-1&&ua.indexOf('khtml')===-1;var ver=parseFloat(ua.substring(ua.indexOf('msie ')+5))||0;return{Agent:ua,IE:!!document.all,IEVersion:ver,IE6:ver==6,IE7:ver==7,IE8:ver==8,IE9:ver==9,Opera:isOpera,WebKit:ua.indexOf('webkit')!=-1,Chrome:/chrome|chromium/.test(ua),Gecko:FF,Firefox:FF,FF:FF,Safari:ua.indexOf("safari")!=-1}})();js.io={loadScript:function(url){$$('script').extend({type:'text/javascript',language:'javascript',src:url}).appendTo(document.body);},addScript:function(code){var s=$$('script').set('type','text/javascript').set('language','javascript').set('text',code).appendTo(document.body);},loadCSS:function(url){var header=document.getElementsByTagName('head')[0];$$('link').extend({rel:'stylesheet',href:url}).appendTo(header);},addCSS:function(code){if(js.browserinfo().IE){setTimeout(function(){document.body.innerHTML+='<style type="text/css">'+code+'</style>';},1500);}else{var header=document.getElementsByTagName('head')[0];var node=$T(code);$$('style').extend({type:'text/css'}).append(node).appendTo(header);}}};js.debug={'_log':[],fatal:false,log:function(message){if(is_object(message))message=_asString(message);js.debug._log.push(message);if(js.debug._log.length>10)js.debug._log.shift();if(_def(window.console))window.console.log(message);},assert:function(procedure,fallback){try{if(is_string(procedure))procedure=Function(procedure);procedure();}catch(e){if(is_function(fallback))fallback(e);js.debug.log('> assert: '+String(procedure));js.debug.log('< result: '+(e.message||e));}},show:function(){alert('Last lines:\n'+this._log.join("\n"));}};var UID=function(base){var id=null;do{id=base+Number.random();}while(find(id)!=null);return id;};js.cookies={setCookie:function(name,value,days){var dt=new Date();var cookie='';if(days>0){dt.setTime(dt.getTime()+days*24*360000);cookie="; expires="+dt.toGMTString();}document.cookie=name+"="+value+cookie;},getCookie:function(cookie){if(document.cookie){var st=document.cookie.indexOf(cookie);if(st>-1){st=st+cookie.length+1;var end=document.cookie.indexOf(';',st);if(end==-1)end=document.cookie.length;return unescape(document.cookie.substring(st,end));}return null;}return null;}};$extend(window,{portSize:function(){var width=0,height=0;if(document.documentElement&&document.documentElement.clientHeight){width=document.documentElement.clientWidth;height=document.documentElement.clientHeight;}else if(self.innerHeight){width=self.innerWidth;height=self.innerHeight;}else if(document.body.clientHeight){width=document.body.clientWidth;height=document.body.clientHeight;}return{w:width,h:height};},pageSize:function(){var width=0,height=0;if(window.innerHeight&&window.scrollMaxY){width=window.innerWidth+window.scrollMaxX;height=window.innerHeight+window.scrollMaxY;}else if(document.body.offsetHeight){width=document.body.offsetWidth;height=document.body.offsetHeight;}return{w:width,h:height};},pageScroll:function(){var x=0,y=0;if(self.pageYOffset||self.pageXOffset){x=self.pageXOffset;y=self.pageYOffset;}else if(document.documentElement&&(document.documentElement.scrollTop||document.documentElement.scrollLeft)){x=document.documentElement.scrollLeft;y=document.documentElement.scrollTop;}else if(document.body.scrollTop||document.body.scrollLeft){x=document.body.scrollLeft;y=document.body.scrollTop;}return{x:x,y:y};},reload:function(){window.open(document.location.href,'_self');}});$extend(Array.prototype,{popValue:function(value){if(this.length>0)for(var i=0;i<this.length;i++)if(this[i]==value)this.splice(i,1);return this;},popIndex:function(index){if(this.length>0&&this[index])this.splice(i,1);return this;},clean:function(){if(this.length>0)for(var i=0;i<this.length;i++)if(this[i]==null)this.splice(i,1);return this;},exists:function(value){js.debug.log('exists! > '+value);return this.has(value)},has:function(value){if(this.length==0)return false;for(var i=0;i<this.length;i++)if(this[i]==value)return true;return false;},first:function(){return this.length>0?this[0]:null;},last:function(){return this.length>0?this[this.length-1]:null;},indexOf:(is_function(Array.prototype.indexOf)?Array.prototype.indexOf:function(item,offset){if(offset>this.length-1||!_def(offset))offset=0;for(var i=offset;i<this.length;i++)if(this[i]==item)return i;return null;}),foreach:function(processor){for(var i=0;i<this.length;i++)processor(this[i]);return this;},walk:(is_function(Array.prototype.map)?Array.prototype.map:function(iterator){var results=[];for(var i=0;i<this.length;i++)results.push(iterator(this[i]));return results;}),filter:function(funel){var results=[];for(var i=0;i<this.length;i++)if(funel(this[i]))results.push(this[i]);return results;},mergeWith:function(array,exclusive){if(!array||!array.length)return this;exclusive=exclusive||false;if(exclusive){var tmp=[];for(var i=0;i<array.length;i++)if(!this.has(array[i]))tmp.push(array[i]);this.push.apply(this,tmp);tmp.length=0;}else this.push.apply(this,array);return this;}});Array.merge=function(){var arr=new Array();for(var i=0;i<arguments.length;i++){for(var j=0;j<arguments[i].length;j++)if(!arr.has(arguments[i][j]))arr.push(arguments[i][j]);}return arr;};String.prototype.trim=function(){var str=this;if(str==null||str=='undefined'||typeof str=='undefined')return'';return str.replace(/(^\s*)|(\s*$)/g,'');};String.prototype.cut=function(size){var str=this;if(str.length>size)return str.substr(0,size-3)+'...';else return str;};String.utf8_encode=function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}return utftext;};String.utf8_decode=function(string){var result='',i=c=c1=c2=0;while(i<string.length){c=string.charCodeAt(i);if(c<128){result+=String.fromCharCode(c);i++;}else if((c>191)&&(c<224)){c2=string.charCodeAt(i+1);result+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}else{c2=string.charCodeAt(i+1);c3=string.charCodeAt(i+2);result+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}return result;};js.base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=String.utf8_encode(input);while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}output=output+this._keyStr.charAt(enc1)+this._keyStr.charAt(enc2)+this._keyStr.charAt(enc3)+this._keyStr.charAt(enc4);}return output;},decode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4,i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=this._keyStr.indexOf(input.charAt(i++));enc2=this._keyStr.indexOf(input.charAt(i++));enc3=this._keyStr.indexOf(input.charAt(i++));enc4=this._keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}if(enc4!=64){output=output+String.fromCharCode(chr3);}}output=String.utf8_decode(output);return output;}};String.prototype.fromBase64=function(){return js.base64.decode(this);};String.prototype.toBase64=function(){return js.base64.encode(this);};js.event=function(){var list={};var obj=new Object();$extend(obj,{add:function(evname,callback){if(is_function(callback)){if(!_def(list[evname]))list[evname]=new Array();list[evname].push(callback);return true;}return false;},remove:function(callback){for(var i in list)if(list[i].length)list[i].popValue(callback);},dispatch:function(name,event){if(!list[name]||!list[name].length)return true;for(var k,i=0;i<list[name].length;i++){event.name=name;k=list[name][i](event);if(k===false){event.event.returnValue=false;if(is_function(event.event.preventDefault))event.event.preventDefault();if(event.event.stopPropagation)event.event.stopPropagation();return false;}}return true;},connect:function(object,eventName){if(!list[eventName]){var tmp=function(e){obj.dispatch(eventName,js.event.getEvent(e));};if(eventName=='mousewheel'&&js.browserinfo.FF&&object.addEventListener)object.addEventListener('DOMMouseScroll',tmp,false);else object['on'+eventName]=tmp;}}});return obj;};js.event.keynames={k8:'Backspace',k9:'Tab',k13:'Enter',k20:'CapsLock',k27:'Esc',k32:'Space',k33:'PageUp',k34:'PageDown',k35:'End',k36:'Home',k37:'Left',k38:'Up',k39:'Right',k40:'Down',k45:'Insert',k46:'Delete',k144:'NumLock',k112:'F1',k113:'F2',k114:'F3',k115:'F4',k116:'F5',k117:'F6',k118:'F7',k119:'F8',k120:'F9',k121:'F10',k121:'F11',k123:'F12'};$extend(js.event,{connect:function(object,eventNames){if(!object['events'])object.events=js.event();if(!is_array(eventNames))eventNames=[eventNames];for(i=0;i<eventNames.length;i++){object.events.connect(object,eventNames[i]);}object.observe=function(eventName,callback){return object.events.add(eventName,callback);};},getEvent:function(event){if(event&&event.sanitized)return event;event=event||window.event;var evData={sanitized:true,key:0,char:'',x:-1,y:-1,origin:null,left:-1,top:-1,CTRL:false,ALT:false,SHIFT:false,button:false,event:null,mousemap:'',keymap:''};if(event){evData.key=event.charCode||event.keyCode||0;if(evData.key>32){var tmp=String.fromCharCode(evData.key);if(RegExp('^[a-z0-9]{1}$','i').test(tmp))evData.char=tmp;}evData.x=(_def('pageX',event)?event.pageX:event.clientX);evData.y=(_def('pageY',event)?event.pageY:event.clientY);evData.origin=event['target']||event['srcElement']||event['originalTarget']||null;if(event.detail&&Math.abs(event.detail)==3)evData.scroll=-event.detail/3;else if(event.wheelDelta)evData.scroll=event.wheelDelta/120;else evData.scroll=false;evData.detail=event.detail;if(evData.origin&&evData.origin!=document)tmp=js.element._prototype.getPosition(evData.origin.parentNode);if(!tmp)tmp={x:0,y:0};evData.left=evData.x-tmp.x;evData.top=evData.y-tmp.y;evData.CTRL=event.ctrlKey;evData.ALT=event.altKey;evData.SHIFT=event.shiftKey;evData.button=typeof event.button!=undefined&&event.button>0?event.button:(event.which?event.which:false);evData.event=event;evData.keymap=String((evData.CTRL?'Ctrl_':'')+(evData.ALT?'Alt_':'')+(evData.SHIFT?'Shift_':'')+(js.event.keynames['k'+evData.key]?js.event.keynames['k'+evData.key]:(evData.char?evData.char.toUpperCase():''))).replace(/[_]+$/,'');evData.mousemap=String((evData.CTRL?'Ctrl_':'')+(evData.ALT?'Alt_':'')+(evData.SHIFT?'Shift_':'')+(evData.button!==false?'Button'+evData.button:'')+(evData.scroll!==false?'Wheel'+(evData.scroll<0?'Down':'Up'):'')).replace(/[_]+$/,'');}return evData;}});js.mouse={x:0,y:0,elementX:0,elementY:0,events:js.event(),observe:function(eventName,callback){js.mouse.events.add(eventName,callback);},map:function(map){js.mouse._map=map}};js.mouse.map.test=function(e){if(!js.mouse._map)return true;if(_def(e.mousemap,js.mouse._map))js.mouse._map[e.mousemap](e);return true;};js.keyboard={map:function(map){js.keyboard._map=map},events:js.event(),observe:function(eventName,callback){js.keyboard.events.add(eventName,callback);}};js.keyboard.map.test=function(e,k){if(js.keyboard._map&&_def(e.keymap,js.keyboard._map))k=js.keyboard._map[e.keymap](e);if(k===false){e.event.returnValue=false;if(is_function(event.preventDefault))e.event.preventDefault();event.preventDefault=true;return false;}return true;};js.load=function(f){if(is_function(f))js.load.list.push(f);};js.load.list=[];js.event.connect(window,['load']);window.observe('load',function(){for(var i=0;i<js.load.list.length;i++)js.load.list[i]();});js.load(function(){js.event.connect(document,['mousemove','mouseup','mousedown','keyup','keydown','contextmenu','click']);document.observe('mousemove',function(e){js.mouse.events.dispatch('mousemove',e);js.mouse.x=e.x;js.mouse.y=e.y;});document.observe('mousedown',function(e){js.mouse.events.dispatch('mousedown',e);});document.observe('mouseup',function(e){js.mouse.events.dispatch('mouseup',e);js.mouse.map.test(e)});document.observe('click',function(e){js.mouse.events.dispatch('click',e);js.mouse.map.test(e)});document.observe('mousewheel',function(e){js.mouse.events.dispatch('mousewheel',e);js.mouse.map.test(e);});document.observe('keyup',function(e,k){js.keyboard.events.dispatch('keyup',e);js.keyboard.map.test(e)});document.observe('keydown',function(e){js.keyboard.events.dispatch('keydown',e);});});js.element=function(tagname){var element=document.createElement(tagname);$extend(element,js.element._prototype);return element;};js.element._prototype={getHeight:function(){return this.offsetHeight||0;},getWidth:function(){return this.offsetWidth||0;},getSize:function(){with(this){return{h:offsetHeight||0,w:offsetWidth||0};}},getRect:function(){var pos=this.getPosition(this);var size=this.getSize(this);return{x:pos.x,y:pos.y,w:size.w,h:size.h};},getPosition:function(element){element=element||this;var left=0,top=0;if(element.offsetParent){var PO=element.parentNode==document.body?{x:0,y:0}:$E(element.offsetParent).getPosition();while(element.offsetParent){left+=element.offsetLeft;top+=element.offsetTop;element=element.offsetParent;}}else PO={x:0,y:0};left+=element.offsetLeft;top+=element.offsetTop;return{x:left-PO.x,y:top-PO.y};},setPosition:function(x,y){if(!_def(x)||!_def(y))return this;this.css({left:x+'px',top:y+'px'});return this;},setSize:function(width,height){var suffixW='',suffixH='';var reg=/(%|em)/;if(reg.test(width)==false)suffixW='px';if(reg.test(height)==false)suffixH='px';if(width)this.style.width=width+suffixW;if(height)this.style.height=height+suffixH;return this;},show:function(mode){mode=mode||'';if(this.style)this.style.display=mode;return this;},hide:function(){if(this.style)this.style.display='none';return this;},css:function(source){try{if(source)for(var property in source)this.style[property]=source[property];}catch(e){js.debug.log('Invalid CSS value for "'+property+'": '+source[property]);}return this;},cssText:function(text){text=text.trim();if(text!=''){var list=text.split(';');var obj={};for(var i=0;i<list.length;i++){var item=list[i].split(':');var key=String(item[0]).trim();if(key.indexOf('-')!=-1){key=key.split('-');key=key[0]+key[1].substr(0,1).toUpperCase()+key[1].substr(1);}var value=String(item[1]).trim();if(key&&value)obj[key]=value;}if(this.style){this.css(obj);}}return this;},addClass:function(){if(arguments.length>0){var list=this.className.split(' ');for(var i=0;i<arguments.length;i++){if(!list.has(arguments[i]))list.push(arguments[i]);}this.className=list.join(' ').trim();}return this;},removeClass:function(){if(arguments.length>0){var list=this.className.split(' ');for(var i=0;i<arguments.length;i++){list.popValue(arguments[i]);}this.className=list.join(' ').trim();}return this;},haveClass:function(name){return this.className.split(' ').has(name);},toggleClass:function(n){if(this.haveClass(n))this.removeClass(n);else this.addClass(n);},getCenter:function(){var size=this.getSize();var pos=this.getPosition();var scr=portSize();var px=Math.ceil((scr.w-size.w)/2)||pos.x;var py=Math.ceil((scr.h-size.h)/2)||pos.y;if(py<0)py=0;return{x:px,y:py};},center:function(){var pos=this.getCenter();this.setPosition(pos.x,pos.y);return this;},centerX:function(){this.setPosition(this.getCenter().x,this.getPosition().y);return this;},centerY:function(){this.setPosition(this.getPosition().x,this.getCenter().y);return this;},extend:function(k){this.attrib(k);return this;},append:function(){for(var i=0;i<arguments.length;i++){var element=arguments[i];element=$E(element);this.appendChild(element);}return this;},appendTo:function(element){element=find(element);if(!element)return this;element.appendChild(this);return this;},appendAsFirst:function(element){element=find(element);if(!element)return false;element.insertBefore(this,element.firstChild);return this;},appendAfter:function(ref){if(!ref)return this;if(ref.nextSibling==null)ref.parentNode.appendChild(this);else ref.parentNode.insertBefore(this,ref.nextSibling);return this;},findFirst:function(tag){var k=this.getElementsByTagName(tag);if(k)return $E(k[0]);return null;},destroy:function(){if(this.parentNode)this.parentNode.removeChild(this);},clearNodes:function(){while(this.hasChildNodes())this.removeChild(this.firstChild);return this;},update:function(html){this.innerHTML=html;return this;},addHTML:function(htmltext){var html=$$('div').set('innerHTML',htmltext);while(html.hasChildNodes()){this.appendChild(html.firstChild);html.removeChild(html.firstChild);}return this;},getHTML:function(){var html='',tmpnode=$$('div').append(this.cloneNode(true));html=tmpnode.innerHTML;delete tmpnode;return html;},set:function(name,value){this.attrib(name,value);return this;},attrib:function(name,value){if(is_object(name)){for(var i in name){if(typeof i=='string'){this[i]=name[i];if(!is_function(name[i]))this.setAttribute(i,name[i])}}}else if([1,2].has(arguments.length)){if(typeof value==undefined){var attr=this.attributes.getNamedItem(name);if(attr)return attr.value;else return null;}else{this[name]=value;if(!is_function(value))this.setAttribute(name,value)}}return this;},getCSS:function(name){var y;if(this.currentStyle)y=this.currentStyle[name];else if(window.getComputedStyle)y=document.defaultView.getComputedStyle(this,null).getPropertyValue(name);return y;},cleanUp:function(recursive){recursive=recursive||false;for(var i=0;i<this.childNodes.length;i++){var n=this.childNodes[i];if(n.nodeType==3&&String(n.nodeValue).trim().length==0)this.removeChild(n);if(recursive&&n.childNodes.length>0)$E(n).cleanUp(recursive);}return this;},byTag:function(tag){var K=[];if(tag){var list=this.getElementsByTagName(tag);if(list.length>0)for(var i=0;i<list.length;i++)K.push(list[i]);}return K;},byClass:function(tag,className){var list=this.byTag(tag),ret=[];for(var i=0;i<list.length;i++){if($E(list[i]).haveClass(className))ret.push(list[i]);}return ret;},observe:function(eventName,callback){if(!this['events'])this.events=js.event();this.events.connect(this,eventName);this.events.add(eventName,callback);return this;},load:function(url){this.update('carregando...');js.ajax.request({url:url,target:this});return this;},block:function(){this.cssText('opacity:0.5');this._oldonclick=this.onclick;this.onclick=function(){return false;};return this;},unblock:function(){this.cssText('opacity:inherit');this.onclick=this._oldonclick;return this;}};var $$=function(tag){return js.element(tag);};var $T=function(value){return document.createTextNode(value);};var $E=function(element){element=find(element);if(!element)return null;if(!element.byClass){$extend(element,js.element._prototype);}return element;};js.overlay=function(width,height,scroll,onclose){width=width||500;height=height||450;scroll=scroll||false;if(!find('overlay')){var c=function(){js.overlay._object.close()};var overlay=$$('div').cssText('position:fixed;left:0;top:0;background:rgb(252,252,252);zIndex:99;opacity:0.9;filter:alpha(Opacity=90);width:100%').appendAsFirst(document.body).set('id','overlay'),overborder=$$('div').set('id','over-border').cssText('z-index:100;background:#fff;position:fixed;border:1px solid #eee;').appendTo(document.body);$$('a').appendTo(overborder).cssText('position:absolute;z-index:3;left:auto;right:0;top:0;background:#f2f2f2;display:block;border-left:1px solid #ccc;'+'color:#000;font-weight:bold;width:20px;height:20px;text-align:center;text-shadow:1px 1px 0 #fff;border-bottom:1px solid #ccc;'+'font-size:16pt;line-height:20px;overflow:hidden;text-decoration:none').update('&times;').set('onclick',c).set('href','javascript:;');var overlayer=$$('div').appendTo(overborder).set('id','over-layer').cssText('position:absolute;zIndex:2;width:100%;bottom:0;top:0');if(!js.browserinfo.IE){overlayer.cssText('box-shadow:0 0 1px rgba(0, 0, 0, .25), 0 1px 5px 3px rgba(0, 0, 0, .05), 0 5px 4px -3px rgba(0, 0, 0, .06);');overlay.cssText('background:rgba(252,252,252,0.9);opacity:1');}else{overlayer.cssText('border:1px solid #eee');overborder.cssText('position:absolute');overlay.cssText('position:absolute');}var o={layer:overlayer,background:overlay,border:overborder,width:width,height:height,scroll:scroll,load:function(u){js.overlay._object.layer.load(u);return this;},show:function(){js.overlay._object.background.show();js.overlay._object.border.show();return this;},hide:function(){overlay.hide();overborder.hide();return this;},close:function(){if(is_function(this.onclose))this.onclose(this);js.overlay._object.layer.clearNodes();js.overlay._object.background.hide();js.overlay._object.border.hide();return this;},onclose:null};overlay.onclick=c;js.overlay._object=o;}else{var o=js.overlay._object;}var s=pageSize(),s2=portSize();if(s.h<s2.h)s.h=s2.h;s2=null;o.background.css({height:Number(s.h)+'px'});s=null;o.show();o.border.setSize(width,height).center();o.layer.setSize(width,height).cssText('overflow:'+(scroll?'auto':'hidden'));js.keyboard.map({Esc:c});return js.overlay._object;};var _px=function(i){return is_number(i)?i+'px':i};js.element._prototype.fx=function(name,param){var e=js.fx[name].inScope(this).call(param);e._init();};js.fx={};js.element._prototype.fxStop=function(yes){this.fxOff=yes!=null?Boolean(yes):true;};js.element._prototype.fxOff=false;js.fx._effectProto={_start:function(){this.timer=setInterval(this._step,this.timeInterval);},_end:function(){clearInterval(this.timer);if(is_function(this.callback))this.callback.inScope(this.object).call();}};js.fx.center=function(param){var moveX=(param.moveX==null||!param.moveX?true:param.moveX);var moveY=(param.moveY==null||!param.moveY?true:param.moveY);var object=$E(param.object||this);var pos=object.getCenter();return js.fx.move({object:this,start:auto,end:{x:pos.x,y:pos.y}});};js.fx.resize=function(param){if(!_def('end',param)||!_def(start,param)){throw"fx.resize: invalid sizes!";return null;}param=param||{};var object=$E(param.object||this);var effect=$clone(js.fx._effectProto);$extend(effect,{factor:param.factor||3,timeInterval:param.timeInterval||1000/24,timer:null,maxValue:40,start:param.start||null,end:param.end||null,object:object,callback:param.callback||null});object.cssText('overflow:hidden;display:block');if(effect.start=='auto')effect.start=object.getSize();object.cssText('width:'+_px(effect.start.w)+';height:'+_px(effect.start.h));effect._step=function(){var diffX=this.start.w-this.end.w,diffY=this.start.h-this.end.h;if(diffX>this.maxValue)diffX=this.maxValue;if(diffY>this.maxValue)diffY=this.maxValue;var valueX=Math.ceil(Math.abs(diffX/this.factor));var valueY=Math.ceil(Math.abs(diffY/this.factor));if(valueX<0)valueX*=-1;if(valueY<0)valueY*=-1;if(this.start.w>this.end.w){this.start.w-=valueX;}else if(this.start.w<this.end.w){this.start.w+=valueX;}else this.start.w=this.end.w;if(this.start.h>this.end.h){this.start.h-=valueY;}else if(this.start.h<this.end.h){this.start.h+=valueY;}else this.start.h=this.end.h;if((valueX==0&&valueY==0)){this._end();return;}this.object.style.width=this.start.w+'px';this.object.style.height=this.start.h+'px';}.inScope(effect);return effect;};js.fx.move=function(param){if(!_def(param.end)||!_def(param.start)){throw"fx.move: invalid positions!";return null;}var effect=$clone(js.fx._effectProto);effect.object=$E(param.object||this);if(!effect.object){throw'fx.move: invalid object!';return null;}$extend(effect,{factor:param.factor||2,timeInterval:param.timeInterval||1000/24,maxValue:40,timer:null,start:param.start||null,end:param.end||null,callback:param.callback||null});if(effect.start=='auto')effect.start=effect.object.getPosition();effect.object.style.top=effect.start.y+'px';effect.object.style.left=effect.start.x+'px';effect._step=function(){var valueX=Math.ceil(Math.abs((this.start.x-this.end.x)/this.factor));var valueY=Math.ceil(Math.abs((this.start.y-this.end.y)/this.factor));if(valueX>this.maxValue)valueX=this.maxValue;if(valueY>this.maxValue)valueY=this.maxValue;if(valueX<0)valueX*=-1;if(valueY<0)valueY*=-1;if(this.start.x>this.end.x){this.start.x-=valueX;}else if(this.start.x<this.end.x){this.start.x+=valueX;}else this.start.x=this.end.x;if(this.start.y>this.end.y){this.start.y-=valueY;}else if(this.start.y<this.end.y){this.start.y+=valueY;}else this.start.y=this.end.y;this.object.style.left=this.start.x+'px';this.object.style.top=this.start.y+'px';if(this.start.x==this.end.x&&this.start.y==this.end.y){this._end();return;}}.inScope(effect);return effect;};js.fx.fade=function(param){param=param||{};var object=$E(param.object||this);var effect=$clone(js.fx._effectProto);$extend(effect,{factor:param.factor||5,duration:1000,timeInterval:param.timeInterval||1000/24,timer:null,limit:0,start:is_number(param.start)?param.start:0,end:is_number(param.end)?param.end:100,object:!is_array(object)?[object]:object,callback:param.callback||null});if(effect.end>100)effect.end=100;if(effect.end<0)if(effect.start<0)effect.start=0;if(effect.start=='auto')effect.start=object.getCSS('opacity');effect._step=function(){var diff=this.end-this.start;var value=Math.abs(Math.ceil(Math.abs(diff/this.factor)));if(this.limit&&value>this.limit)value=this.limit;if(this.start>this.end){this.start-=value;}else if(this.start<this.end){this.start+=value;}else this.start=this.end;if(value==0||this.object._cancelEffects){return this._end();}for(var v=0;v<this.object.length;v++){this.object[v].style.opacity=this.start/100;this.object[v].style.filter='alpha(Opacity='+this.start+')';}return true;}.inScope(effect);return effect;};js.fx.flash=function(param){param=param||{};var object=$E(param.object||this);var effect=$clone(js.fx._effectProto);$extend(effect,{fr:1,fg:1,fb:1,red:0,green:0,blue:0,factor:param.factor||10,timeInterval:param.timeInterval||1000/24,timer:null,start:param.start||'#ffffcc',end:param.end||'#ffffff',object:object,callback:param.callback||null});if(effect.start=='auto')effect.start=effect.object.getCSS('backgroundColor');if(is_string(effect.start))effect.start={r:Number.fromHex(effect.start.substr(1,2)),g:Number.fromHex(effect.start.substr(3,2)),b:Number.fromHex(effect.start.substr(5,2))};else if(is_array(effect.start))effect.start={r:effect.start[0],g:effect.start[1],b:effect.start[2]};if(is_string(effect.end))effect.end={r:Number.fromHex(effect.end.substr(1,2)),g:Number.fromHex(effect.end.substr(3,2)),b:Number.fromHex(effect.end.substr(5,2))};else if(is_array(effect.end))effect.end={r:effect.end[0],g:effect.end[1],b:effect.end[2]};effect.fr=Math.ceil((effect.end.r-effect.start.r)/effect.factor);effect.fg=Math.ceil((effect.end.g-effect.start.g)/effect.factor);effect.fb=Math.ceil((effect.end.b-effect.start.b)/effect.factor);effect.red=effect.start.r;effect.green=effect.start.g;effect.blue=effect.start.b;effect.object.style.backgroundColor='rgb('+this.red+','+this.green+','+this.blue+')';effect._step=function(){this.red+=this.fr;this.green+=this.fg;this.blue+=this.fb;this.object.style.backgroundColor='rgb('+this.red+','+this.green+','+this.blue+')';if(this.red>=this.end.r&&this.green>=this.end.g&&this.blue>=this.end.b)this._end();}.inScope(effect);return effect;};js.drag={objectEvent:null,element:null,mouseOffset:null,capabilities:{x:false,y:false},callback:null,startDragY:function(object,event,callback){js.drag.callback=callback;js.drag.capabilities={x:false,y:true};js.drag.drag(object,event);return false;},startDragX:function(object,event,callback){js.drag.callback=callback;js.drag.capabilities={x:true,y:false};js.drag.drag(object,event);return false;},startDrag:function(object,event,callback){js.drag.callback=callback;js.drag.capabilities={x:true,y:true};js.drag.drag(object,event);return false;},drag:function(object,event){js.drag.element=$E(object);js.drag.objectEvent=event||window.event;document.observe('mousemove',js.drag.moveObject);document.observe('mouseup',js.drag.stopDrag);js.drag.getMouseOffset(js.drag.element,js.drag.objectEvent);},stopDrag:function(){js.drag.element=null;js.drag.objectEvent=null;document.events.remove(js.drag.moveObject);document.events.remove(js.drag.stopDrag);js.drag.capabilities={x:false,y:false};if(is_function(js.drag.callback))js.drag.callback();js.drag.callback=null;},moveObject:function(ev){if(js.drag.element==null)return;var MO=js.drag.mouseOffset;if(js.drag.capabilities.x==true){var pleft=ev.x-MO.x;js.drag.element.style.left=pleft+'px';}if(js.drag.capabilities.y==true){var ptop=ev.y-MO.y;js.drag.element.style.top=ptop+'px';}},mouseCoords:function(ev){ev=ev||window.event;if(!ev||ev==null){return{x:0,y:0};}if(ev.pageX||ev.pageY)return{x:ev.pageX,y:ev.pageY};else return{x:ev.clientX,y:ev.clientY};},getMouseOffset:function(target,ev){if(!target){js.drag.mouseOffset={x:0,y:0};}else{var docPos=target.getPosition();var mousePos=js.drag.mouseCoords(ev);js.drag.mouseOffset={x:mousePos.x-docPos.x,y:mousePos.y-docPos.y};}return js.drag.mouseOffset;}};js.ajax={};js.ajax.getTransport=function(){var requestElements=["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","MICROSOFT.XMLHTTP.1.0","MICROSOFT.XMLHTTP.1","MICROSOFT.XMLHTTP"];var requestElement;if(typeof XMLHttpRequest=='undefined'&&typeof ActiveXObject!='undefined'){for(var a=0;a<requestElements.length;a++){var b=requestElements[a];try{new ActiveXObject(b);requestElement=b;break;}catch(c){}}if(typeof requestElement=='undefined'){throw"Este navegador não dá suporte ao site. Atualize-o!";}}if(typeof requestElement!='undefined')return new ActiveXObject(requestElement);else return new XMLHttpRequest;};js.ajax.response={text:null,xml:null,status:null,error:null,target:null,object:null,onSuccess:null,onError:null,process:function(){switch(this.object.readyState){case 1:case 2:case 3:break;case 4:this.text=this.object.responseText;this.xml=this.object.responseXML||null;this.status=this.object.status;if(this.status==200){if(_def('target',this)){this.target=$E(this.target);this.target.clearNodes();if(RegExp('\.(gif|jpe?g|png|bmp)','i').test(this.url)&&!is_function(this.onSuccess))$$('img').set('src',this.url+'?'+this.query).appendTo(this.target);else $E(this.target).innerHTML=this.text;}js.ajax.jsRun(this.text);if(is_function(this.onSuccess))this.onSuccess(this);}else{this.error=this.object.statusText;if(is_function(this.onError))this.onError(this);}}}};js.ajax.request=function(params){return $clone(js.ajax.requestObject).get(params);};js.ajax.repeat=function(params){if(!_def('time',params)||params.time==0)return 0;var t=function(){$clone(js.ajax.requestObject).get(params);};t();return setInterval(t,params.time);};js.ajax.requestObject={target:null,method:null,loader:false,async:true,url:'',query:null,request:null,get:function(params){var response=$clone(js.ajax.response);response.object=js.ajax.getTransport();if(!response.object){throw"Ajax: unable to find transport object!";return null;}params=params||{};this.target=params.target||null;this.method=String(params.method||'GET').toUpperCase();response.onSuccess=params.onSuccess||null;response.onError=params.onError||null;this.url=params.url;this.async=Boolean(params.async||true);if(this.url=='')return null;if(this.url.indexOf('?')===-1)this.url+='?';var u=this.url.split('?');this.query=u[1];this.url=u[0];response.target=this.target;var isGet=this.method=='GET';var isPost=this.method=='POST';if(isGet)this.query+='&rand='+Number.random();var reqURL=this.url+(isGet?'?'+this.query:'');response.object.open(this.method,reqURL,this.async);if(isPost)response.object.setRequestHeader("Content-Type","application/x-www-form-urlencoded");response.object.setRequestHeader("X-Ajax","RDA Ajax Lib rev. 5");response.object.onreadystatechange=response.process.inScope(response);try{response.object.send(isGet?null:this.query);}catch(err){throw"Ajax: exception on XHR.Send: "+err;}return response;}};js.ajax.jsRun=function(text){if(!text)return false;var start=0;var end=0;var re='<script[^>]*>([\\S\\s]*?)<\/script>';var all=new RegExp(re,'img');var one=new RegExp(re,'im');all=text.match(all)||[];foreach(all,function(code){if(!code)return;code=code.match(one);code=code.length>1?code[1]:'';if(code){code='js.debug.assert(function(){\n'+code+'\n});';js.io.addScript(code);}});return true;};js.ajax.json=function(url,callback){if(url.indexOf('?')===-1)url+='?';return js.io.loadScript(url+'&cback='+callback);};js.ajax.load=function(url,target){if(!url)return;target=target||null;js.ajax.request({url:url,target:target});};var json={_ev:function(t){if(!is_string(t)||['{','['].has(t.substring(0,1)))return null;return eval(t);},load:function(url,callback,method){method=method||'get';if(!_def(callback)||!is_function(callback))return false;if(url.indexOf(location.host)!=-1)js.ajax.request({url:url,method:method,onSuccess:function(e){json.run(e,callback);}});else js.io.loadScript(url);return true;},run:function(e,cb){e=e&&e.text?e.text:'';cb(e);}};js.forms={serialize:function(form){form=$E(form);if(!form)return'';var elements=js.forms.getElements(form);var queryComponents=[];for(var i=0;i<elements.length;i++){var queryComponent=js.forms.element.serialize(elements[i]);if(queryComponent)queryComponents.push(queryComponent);}return queryComponents.join('&');},getElements:function(form){form=$E(form);if(!form)return[];var elements=[];for(tagName in js.forms.element.serializers){var tagElements=form.getElementsByTagName(tagName);for(var j=0;j<tagElements.length;j++)elements.push(tagElements[j]);}return elements;},getInputs:function(form,typeName,name){form=find(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)return inputs;var matchingInputs=new Array();for(var i=0;i<inputs.length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))continue;matchingInputs.push(input);}return matchingInputs;},disable:function(form){var elements=js.forms.getElements(form);for(var i=0;i<elements.length;i++){var element=elements[i];element.blur();element.disabled='true';}},enable:function(form){var elements=js.forms.getElements(form);for(var i=0;i<elements.length;i++){var element=elements[i];element.disabled='';}},reset:function(form){find(form).reset();},focusFirst:function(element){var list=js.forms.getInputs(element,'text');if(list.length>0)list[0].focus();},send:function(element,target,callback){var form=find(element);if(!form)return false;var method=form.method||'post';target=target||form.target;var action=(form.action||'').split('?');action=action.first()+'?'+action.last()+'&'+js.forms.serialize(form);return js.ajax.request({url:action,target:target,method:form.method,onSuccess:callback});},sendAsFrame:function(element,callback){element=find(element);var id=UID('frame');var sendComplete=function(){var e=this;var doc=(e.contentDocument?e.contentDocument:(e.contentWindow?e.contentWindow.document:window.frames[id].document));if(!doc||doc.location.href=="about:blank")return;var result=doc.body.innerHTML;this.parentNode.removeChild(this);if(callback)callback(result);};var frame=$$('iframe').extend({src:"about:blank",id:id,name:id,onload:sendComplete,width:1,height:1,frameborder:0});document.body.appendChild(frame);element.target=id;return true;}};js.forms.element={serialize:function(element){element=find(element);var method=element.tagName.toLowerCase();var parameter=js.forms.element.serializers[method](element);if(parameter){var key=encodeURIComponent(parameter[0]);if(key.length==0)return'';if(parameter[1].constructor!=Array)parameter[1]=[parameter[1]];var res=[];for(var k=0;k<parameter[1].length;k++)res.push(key+'='+encodeURIComponent(parameter[1][k]));return res.join('|');}return'';},getValue:function(element){element=find(element);var method=element.tagName.toLowerCase();var parameter=js.forms.element.serializers[method](element);if(parameter)return parameter[1];return null;}};js.forms.element.serializers={input:function(element){switch(element.type.toLowerCase()){case'submit':case'hidden':case'password':case'text':return js.forms.element.serializers.textarea(element);case'checkbox':case'radio':return js.forms.element.serializers.inputSelector(element);}return false;},inputSelector:function(element){if(element.checked)return[element.name,element.value];return null;},textarea:function(element){return[element.name,element.value];},select:function(element){return js.forms.element.serializers[element.type=='select-one'?'selectOne':'selectMany'](element);},selectOne:function(element){var value='',opt,index=element.selectedIndex;if(!element.length)return[element.name,value];if(index>=0){opt=element.options[index];value=opt.value;if(!value&&!('value'in opt))value=opt.text;}return[element.name,value];},selectMany:function(element){var value=[];for(var i=0;i<element.length;i++){var opt=element.options[i];if(opt.selected){var optValue=opt.value;if(!optValue&&!('value'in opt))optValue=opt.text;value.push(optValue);}}return[element.name,value];}};js.twitter={user:'',count:5,init:function(data){$extend(js.twitter,data);js.twitter.start();},start:function(){js.io.loadScript('http://twitter.com/statuses/user_timeline.json?screen_name='+js.twitter.user+'&callback=js.twitter.process&count='+js.twitter.count+'&clientsource=TWITTERINC_WIDGET');},process:function(list){if(list.length>0){$E('twitter-list').clearNodes();list.foreach(js.twitter.addPost);}},addPost:function(data){var t=$E('twitter-list');if(!t)return;var li=$$('li').addClass('list-item');$$('div').addClass('text').set('innerHTML',data.text).appendTo(li);var d=data.created_at.split(' ');var Months=['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],Prefs=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],newdate='';newdate+=d[2]+' de '+Months[Prefs.indexOf(d[1])];if(new Date().getFullYear()!=d[5])newdate+=' de '+d[5];var newtime=d[3].split(':');newdate+=', '+(newtime[0]-3)+':'+newtime[1];$$('div').addClass('date').set('innerHTML',newdate).appendTo(li);li.appendTo(t);}};var Form={};Form.Validator={rules:{},addRule:function(form,theField,rule,extra){form=$E(form);if(!form.id)form.setAttribute('id',UID('form-'));field=$E(theField);if(!field){throw'Validator: invalid field "'+theField+'"!';return false;}
if(!Form.Validator.rules[form.id])
Form.Validator.rules[form.id]=[];Form.Validator.rules[form.id].push({field:field,rule:rule,re:null,extra:extra});},removeRule:function(form,field){form=$E(form);field=$E(field);var list=Form.Validator.rules[form.id];for(var i=0;i<list.lenght;i++){if(list[i].field==field)
list[i]=null;}
list.clean();},check:function(form){form=$E(form);var list=Form.Validator.rules[form.id];var formValid=true;for(var i=0;i<list.length;i++){if(list[i].field){list[i].re=new RegExp(list[i].rule);var valid=(list[i].re.exec(list[i].field.value)!=null);if(typeof list[i].extra=='function'){valid=list[i].extra(list[i].field);}
if(!valid){$E(list[i].field.parentNode).addClass('invalid').removeClass('valid');}
else{$E(list[i].field.parentNode).removeClass('invalid').addClass('valid');}
formValid=formValid&&valid;}}
return formValid;}};var pp={};pp.a=function(u){js.ajax.load('/pp/'+u,'pparea');};pp.pg=function(a){js.ajax.load('/pp/page/'+a,'upane');};pp.rs=function(i){if(confirm('Confirmar a reserva do brinde?\n\nOs pontos só serão debitados da sua conta após a retirada.'))js.ajax.load('/pp/reserva/'+i)};pp.updatePicture=function(){js.overlay(400,125,false).load('/pp/page/changePicture');};pp.msg=function(id){js.overlay(400,400,true).load('/pp/msg/'+id);};var msg=function(a,target){target=target?$E(target):document.body;if($E('ui-warning'))$E('ui-warning').destroy();$$('div').set('id','ui-warning').addClass('ui-warning').update(a).appendAsFirst(target);setTimeout(umsg,4000);return;};var umsg=function(){js.fx.fade({object:'ui-warning',start:100,end:0,callback:function(){$E('ui-warning').destroy();}})._start();};function lback(a){var k='dlogin';switch(a){case'e_key':msg('Chave inválida!',k);break;case'e_email':msg('Seu email não está correto!\n\nE-mails têm formato nome@dominio.',k);break;case'e_pwd':msg('Você não informou uma senha!',k);break;case'e_invalid':msg('Sua senha está incorreta. Você já tem um cadastro?',k);break;case'e_ok':window.open('/pp/','_self');break;}}
function pwd(){js.overlay(300,160,false).load('/pp/pwd/form');}(function(){('abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,mark,menu,meter,nav,output,progress,section,time,video'.split(',')).walk($$);})();
