
var $=function(){var elements=new Array();for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof element=='string')element=document.getElementById(element);if(arguments.length==1)return element;elements.push(element);}return elements;};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 _cssval=function(val,ref){if(/[%]/.test(val)){if(ref){var x=$E(ref.parentNode).getWidth();var p=val.replace(/[%]/gi,'');return(x*p/100)+'px';}}return(is_number(val)?val+'px':(is_string(val)?val:''));};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 $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=is_object(js)?js:{};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('AppleWebKit/')>-1,Gecko: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($(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)return[];var newList=[];for(var i=0;i<this.length;i++){if(this[i]!=value){newList.push(this[i]);}}this.length=0;for(var i=0;i<newList.length;i++){this.push(newList[i]);}this.clean();return this;},popIndex:function(index){if(this.length==0)return[];var newList=new Array();for(var i=0;i<this.length;i++){if(i!=index)newList.push(this[i]);}this.length=0;for(var i=0;i<newList.length;i++){this.push(newList[i]);}this.clean();return this;},clean:function(){if(this.length==0)return[];var newList=[];for(var i=0;i<this.length;i++)if(this[i]!=null)newList.push(this[i]);this.length=0;for(var i=0;i<newList.length;i++){this.push(newList[i]);}return this;},exists:function(value){if(this.length==0)return false;var exists=false;for(var i=0;i<this.length;i++){if(this[i]==value)return true;}return exists;},first:function(){return this.length>0?this[0]:null;},last:function(){return this.length>0?this[this.length-1]:null;},index_of:function(item,offset){if(offset>this.length-1||offset==null)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.exists(array[i]))tmp.push(array[i]);for(i=0;i<tmp.length;i++)this.push(tmp[i]);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.exists(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;};js.Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=Base64._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;var enc1,enc2,enc3,enc4;var 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=Base64._utf8_decode(output);return output;},_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;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}return string;}};String.prototype.fromBase64=function(){return js.Base64.decode(this);};String.prototype.toBase64=function(){return js.Base64.encode(this);};js.eventobject={list:null,add:function(evname,callback){if(!is_object(this.list))this.list={};if(!_def(this.list['on'+evname]))this.list['on'+evname]=[];if(is_function(callback)){this.list['on'+evname].push(callback);return this.list['on'+evname].length-1;}return false;},remove:function(id){this.list['on'+evName][i]=null;this.list['on'+evName].clean();},dispatch:function(object,name,event){event=event||window.event;var evData={};if(event){evData.key=event.charCode||event.keyCode||0;evData.char=evData.key>32?String.fromCharCode(evData.key):null;evData.x=(_def('pageX',event)?event.pageX:event.clientX);evData.y=(_def('pageY',event)?event.pageY:event.clientY);var documentPos=js.element._prototype.getPosition.inScope(object.parentNode)()||{x:0,y:0};evData.left=evData.x-documentPos.x;evData.top=evData.y-documentPos.y;evData.CTRL=event.ctrlKey;evData.ALT=event.altKey;evData.SHIFT=event.shiftKey;evData.origin=event['target']||event['srcElement']||event['originalTarget']||null;evData.button=event.button;evData.event=event;}var list=this.list['on'+name];var v,result=true;for(var i=0;i<list.length;i++)if(is_function(list[i])){v=list[i](evData);if(v===false)result=false;}return result;}};js.events={attach:function(object,event,callback){if(!_def(object)||!is_object(object))return false;if(!_def('_events',object)){object._events=$clone(js.eventobject);object['on'+event]=function(e){e=e||window.event;this._events.dispatch(this,event,e);}.inScope(object);}return object._events.add(event,callback);},deattach:function(object,event,index){if(object._events.list['on'+event]&&object._events.list['on'+event][index])object._events.list['on'+event][index]=null;object._events.list['on'+event].clean();},getEventSource:function(ev){ev=ev||window.event;if(!ev)return null;return ev['target']?ev.target:ev.srcElement;}};js.loader={list:[],loaded:false,run:function(){foreach(this.list,function(f){f();});this.loaded=true;},init:function(){if(!!document.all)setTimeout("js.loader.run();",999);else js.loader.run();},add:function(f){if(is_function(f)){if(js.loader.loaded)f();else js.loader.list.push(f);}}};js.events.attach(window,'load',js.loader.init);js.mouse={x:0,y:0,lastEvent:null,source:null,getMouseXY:function(event){event=event||window.event;js.mouse.lastEvent=event;js.mouse.source=js.events.getEventSource(event);if(js.browserinfo().IE){if(_def(event.clientX)){js.mouse.x=(event.clientX+document.body.scrollLeft)||0;js.mouse.y=(event.clientY+document.body.scrollTop)||0;}}else{js.mouse.x=event.pageX;js.mouse.y=event.pageY;}if(js.mouse.x<0)js.mouse.x=0;if(js.mouse.y<0)js.mouse.y=0;return true;}};js.events.attach(document,'mousemove',js.mouse.getMouseXY);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(){var 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){if(source)for(var property in source)try{this.style[property]=source[property];}catch(e){Debug.log('Invalid CSS value for "'+property+'": '+source[property]);}return this;},cssText:function(text){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();var value=String(item[1]).trim();if(key&&value)obj[key]=value;}if(this.style){for(var k in obj)this.style[k]=obj[k];}}return this;},addClass:function(){var list=this.className.split(' ');if(arguments.length>0)for(var i=0;i<arguments.length;i++){var name=arguments[i];if(!list.exists(name))list.push(name);}this.className=list.join(' ').trim();return this;},removeClass:function(){var list=this.className.split(' ');if(arguments.length>0)for(var i=0;i<arguments.length;i++){list.popValue(arguments[i]);}this.className=list.join(' ').trim();return this;},haveClass:function(name){list=this.className.split(' ');return list.exists(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){$extend(this,k);return this;},append:function(element){element=$(element);if(!element)return false;this.appendChild(element);return this;},appendTo:function(element){element=$(element);if(!element)return this;element.appendChild(this);return this;},appendAsFirst:function(element){element=$(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 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(p,v){this[p]=v;return this;},getAttrib:function(name){var attr=this.attributes.getNamedItem(name);if(attr)return attr.value;return null;},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(event,callback){js.events.attach(this,event,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=$(element);if(!element)return null;if(!element.byClass)$extend(element,js.element._prototype);return element;};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:'+_cssval(effect.start.w)+';height:'+_cssval(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(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(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,start:is_number(param.start)?param.start:0,end:is_number(param.end)?param.end:100,object:object,callback:param.callback||null});if(effect.end>100)effect.end=100;if(effect.end<0)if(effect.start=='auto')effect.start=effect.object.getCSS('opacity');else if(effect.start<0)effect.start=0;effect._step=function(){var diff=this.end-this.start;var value=Math.abs(Math.ceil(Math.abs(diff/this.factor)));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();}this.object.style.opacity=this.start/100;this.object.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(obj,ev,callback){js.drag.callback=callback;js.drag.capabilities={x:false,y:true};js.drag.drag(obj,ev);return false;},startDragX:function(obj,ev,callback){js.drag.callback=callback;js.drag.capabilities={x:true,y:false};js.drag.drag(obj,ev);return false;},startDrag:function(obj,ev,callback){js.drag.callback=callback;js.drag.capabilities={x:true,y:true};js.drag.drag(obj,ev);return false;},drag:function(el,ev){js.drag.objectEvent=ev||window.ev;js.drag.element=$E(el);js.drag.evindex=js.events.attach(document,'mousemove',js.drag.moveObject);js.drag.evindex2=js.events.attach(document,'mouseup',js.drag.stopDrag);js.drag.getMouseOffset(js.drag.element,js.drag.objectEvent);},stopDrag:function(){js.drag.element=null;js.drag.objectEvent=null;js.events.deattach(document,'mousemove',js.drag.evindex);js.events.deattach(document,'mouseup',js.drag.evindex2);js.drag.evindex=0;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)||['{','['].exists(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=$(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){$(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=$(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=$(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;element.submit();return true;}};js.forms.element={serialize:function(element){element=$(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=$(element);var method=element.tagName.toLowerCase();var parameter=js.forms.element.serializers[method](element);if(parameter)return parameter[1];}};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];}};var pa={i:0,m:1,r:false,c:0,wi:0,hg:0,l:[],s:'',u:[],add:function(f,u){pa.l.push(f);pa.u.push(u||'#');},n:function(){if(!$('brg'))pa.stop();if(pa.r)return;if(pa.i==pa.m)pa.i=0;pa.i++;pa.r=true;switch(pa.s){case'vscroll':js.fx.move({object:'album-images',start:{y:(-(pa.hg)*(pa.i-1)),x:0},end:{y:(-(pa.hg)*pa.i),x:0},callback:function(){pa.r=false;}})._start();break;case'morph':break;case'hscroll':default:js.fx.move({object:'album-images',start:{x:(-(pa.wi)*(pa.i-1)),y:0},end:{x:(-(pa.wi)*pa.i),y:0},callback:function(){pa.r=false;}})._start();}},p:function(){if(!$('brg'))pa.stop();if(pa.r)return;if(pa.i==0)pa.i=m;pa.i--;pa.r=true;switch(pa.s){case'vscroll':js.fx.move({object:'album-images',start:{y:(-(pa.hg)*(pa.i+1)),x:0},end:{y:(-(pa.hg)*pa.i),x:0},callback:function(){pa.r=false;}})._start();break;case'morph':break;case'hscroll':default:js.fx.move({object:'album-images',start:{x:(-(pa.wi)*(pa.i+1)),y:0},end:{x:(-(pa.wi)*pa.i),y:0},callback:function(){pa.r=false;}})._start();break;}},auto:function(){pa.stop();pa.c=setInterval(pa.n,3500);},pause:function(){pa.r=true;pa.stop();},stop:function(){if(pa.c)clearInterval(pa.c);},resume:function(){pa.r=false;pa.auto();},si:function(i){pa.i=i;js.fx.move({object:'album-images',start:{x:(-(pa.wi)*(pa.i)),y:0},end:{x:(-(pa.wi)*i),y:0},callback:function(){pa.r=false;}})._start();},init:function(w,h,s){if(!pa.l.length)return;if(w)pa.wi=w;if(h)pa.hg=h;pa.m=pa.l.length;pa.i=0;s=s||'hscroll';$E('acontainer').css({width:pa.wi+'px',height:pa.hg+'px'}).className=s;for(var i=0;i<pa.l.length;i++){$$('span').css({width:pa.wi+'px',height:pa.hg+'px'}).append($$('a').set('href',pa.u[i]).set('onclick',function(){if(this.href!='#')window.open('','_blank').document.location.href=this.href;return false;}).append($$('img').set('src','/content/'+pa.wi+'x'+pa.hg+'/'+pa.l[i]))).appendTo('album-images');$$('a').set('onclick',pa.si.callWith([i])).appendTo('bl').set('href','#');}
$$('span').css({width:pa.wi+'px',height:pa.hg+'px'}).append($$('img').set('src','/content/'+pa.wi+'x'+pa.hg+'/'+pa.l.first())).appendTo('album-images');$E('album-images').css({width:((pa.m+1)*pa.wi)+'px'});}};
