MooTools.More={'version':'1.2.3.1'};Element.implement({isDisplayed:function(){return this.getStyle('display')!='none'},toggle:function(){return this[this.isDisplayed()?'hide':'show']()},hide:function(){var d;try{if('none'!=this.getStyle('display'))d=this.getStyle('display')}catch(e){}return this.store('originalDisplay',d||'block').setStyle('display','none')},show:function(display){return this.setStyle('display',display||this.retrieve('originalDisplay')||'block')},swapClass:function(remove,add){return this.removeClass(remove).addClass(add)}});Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(elements,options){this.elements=this.subject=$$(elements);this.parent(options)},compute:function(from,to,delta){var now={};for(var i in from){var iFrom=from[i],iTo=to[i],iNow=now[i]={};for(var p in iFrom)iNow[p]=this.parent(iFrom[p],iTo[p],delta)}return now},set:function(now){for(var i in now){var iNow=now[i];for(var p in iNow)this.render(this.elements[i],p,iNow[p],this.options.unit)}return this},start:function(obj){if(!this.check(obj))return this;var from={},to={};for(var i in obj){var iProps=obj[i],iFrom=from[i]={},iTo=to[i]={};for(var p in iProps){var parsed=this.prepare(this.elements[i],p,iProps[p]);iFrom[p]=parsed.from;iTo[p]=parsed.to}}return this.parent(from,to)}});var Accordion=Fx.Accordion=new Class({Extends:Fx.Elements,options:{display:0,show:false,height:true,width:false,opacity:true,fixedHeight:false,fixedWidth:false,wait:false,alwaysHide:false,trigger:'click',initialDisplayFx:true},initialize:function(){var params=Array.link(arguments,{'container':Element.type,'options':Object.type,'togglers':$defined,'elements':$defined});this.parent(params.elements,params.options);this.togglers=$$(params.togglers);this.container=document.id(params.container);this.previous=-1;if(this.options.alwaysHide)this.options.wait=true;if($chk(this.options.show)){this.options.display=false;this.previous=this.options.show}if(this.options.start){this.options.display=false;this.options.show=false}this.effects={};if(this.options.opacity)this.effects.opacity='fullOpacity';if(this.options.width)this.effects.width=this.options.fixedWidth?'fullWidth':'offsetWidth';if(this.options.height)this.effects.height=this.options.fixedHeight?'fullHeight':'scrollHeight';for(var i=0,l=this.togglers.length;i<l;i++)this.addSection(this.togglers[i],this.elements[i]);this.elements.each(function(el,i){if(this.options.show===i){this.fireEvent('active',[this.togglers[i],el])}else{for(var fx in this.effects)el.setStyle(fx,0)}},this);if($chk(this.options.display))this.display(this.options.display,this.options.initialDisplayFx)},addSection:function(toggler,element){toggler=document.id(toggler);element=document.id(element);var test=this.togglers.contains(toggler);this.togglers.include(toggler);this.elements.include(element);var idx=this.togglers.indexOf(toggler);toggler.addEvent(this.options.trigger,this.display.bind(this,idx));if(this.options.height)element.setStyles({'padding-top':0,'border-top':'none','padding-bottom':0,'border-bottom':'none'});if(this.options.width)element.setStyles({'padding-left':0,'border-left':'none','padding-right':0,'border-right':'none'});element.fullOpacity=1;if(this.options.fixedWidth)element.fullWidth=this.options.fixedWidth;if(this.options.fixedHeight)element.fullHeight=this.options.fixedHeight;element.setStyle('overflow','hidden');if(!test){for(var fx in this.effects)element.setStyle(fx,0)}return this},display:function(index,useFx){useFx=$pick(useFx,true);index=($type(index)=='element')?this.elements.indexOf(index):index;if((this.timer&&this.options.wait)||(index===this.previous&&!this.options.alwaysHide))return this;this.previous=index;var obj={};this.elements.each(function(el,i){obj[i]={};var hide=(i!=index)||(this.options.alwaysHide&&(el.offsetHeight>0));this.fireEvent(hide?'background':'active',[this.togglers[i],el]);for(var fx in this.effects)obj[i][fx]=hide?0:el[this.effects[fx]]},this);return useFx?this.start(obj):this.set(obj)}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(element,options){this.element=this.subject=document.id(element);this.parent(options);var cancel=this.cancel.bind(this,false);if($type(this.element)!='element')this.element=document.id(this.element.getDocument().body);var stopper=this.element;if(this.options.wheelStops){this.addEvent('start',function(){stopper.addEvent('mousewheel',cancel)},true);this.addEvent('complete',function(){stopper.removeEvent('mousewheel',cancel)},true)}},set:function(){var now=Array.flatten(arguments);this.element.scrollTo(now[0],now[1])},compute:function(from,to,delta){return[0,1].map(function(i){return Fx.compute(from[i],to[i],delta)})},start:function(x,y){if(!this.check(x,y))return this;var offsetSize=this.element.getSize(),scrollSize=this.element.getScrollSize();var scroll=this.element.getScroll(),values={x:x,y:y};for(var z in values){var max=scrollSize[z]-offsetSize[z];if($chk(values[z]))values[z]=($type(values[z])=='number')?values[z].limit(0,max):max;else values[z]=scroll[z];values[z]+=this.options.offset[z]}return this.parent([scroll.x,scroll.y],[values.x,values.y])},toTop:function(){return this.start(false,0)},toLeft:function(){return this.start(0,false)},toRight:function(){return this.start('right',false)},toBottom:function(){return this.start(false,'bottom')},toElement:function(el){var position=document.id(el).getPosition(this.element);return this.start(position.x,position.y)},scrollIntoView:function(el,axes,offset){axes=axes?$splat(axes):['x','y'];var to={};el=document.id(el);var pos=el.getPosition(this.element);var size=el.getSize();var scroll=this.element.getScroll();var containerSize=this.element.getSize();var edge={x:pos.x+size.x,y:pos.y+size.y};['x','y'].each(function(axis){if(axes.contains(axis)){if(edge[axis]>scroll[axis]+containerSize[axis])to[axis]=edge[axis]-containerSize[axis];if(pos[axis]<scroll[axis])to[axis]=pos[axis]}if(to[axis]==null)to[axis]=scroll[axis];if(offset&&offset[axis])to[axis]=to[axis]+offset[axis]},this);if(to.x!=scroll.x||to.y!=scroll.y)this.start(to.x,to.y);return this}});Fx.Slide=new Class({Extends:Fx,options:{mode:'vertical'},initialize:function(element,options){this.addEvent('complete',function(){this.open=(this.wrapper['offset'+this.layout.capitalize()]!=0);if(this.open&&Browser.Engine.webkit419)this.element.dispose().inject(this.wrapper)},true);this.element=this.subject=document.id(element);this.parent(options);var wrapper=this.element.retrieve('wrapper');this.wrapper=wrapper||new Element('div',{styles:$extend(this.element.getStyles('margin','position'),{overflow:'hidden'})}).wraps(this.element);this.element.store('wrapper',this.wrapper).setStyle('margin',0);this.now=[];this.open=true},vertical:function(){this.margin='margin-top';this.layout='height';this.offset=this.element.offsetHeight},horizontal:function(){this.margin='margin-left';this.layout='width';this.offset=this.element.offsetWidth},set:function(now){this.element.setStyle(this.margin,now[0]);this.wrapper.setStyle(this.layout,now[1]);return this},compute:function(from,to,delta){return[0,1].map(function(i){return Fx.compute(from[i],to[i],delta)})},start:function(how,mode){if(!this.check(how,mode))return this;this[mode||this.options.mode]();var margin=this.element.getStyle(this.margin).toInt();var layout=this.wrapper.getStyle(this.layout).toInt();var caseIn=[[margin,layout],[0,this.offset]];var caseOut=[[margin,layout],[-this.offset,0]];var start;switch(how){case'in':start=caseIn;break;case'out':start=caseOut;break;case'toggle':start=(layout==0)?caseIn:caseOut}return this.parent(start[0],start[1])},slideIn:function(mode){return this.start('in',mode)},slideOut:function(mode){return this.start('out',mode)},hide:function(mode){this[mode||this.options.mode]();this.open=false;return this.set([-this.offset,0])},show:function(mode){this[mode||this.options.mode]();this.open=true;return this.set([0,this.offset])},toggle:function(mode){return this.start('toggle',mode)}});Element.Properties.slide={set:function(options){var slide=this.retrieve('slide');if(slide)slide.cancel();return this.eliminate('slide').store('slide:options',$extend({link:'cancel'},options))},get:function(options){if(options||!this.retrieve('slide')){if(options||!this.retrieve('slide:options'))this.set('slide',options);this.store('slide',new Fx.Slide(this,this.retrieve('slide:options')))}return this.retrieve('slide')}};Element.implement({slide:function(how,mode){how=how||'toggle';var slide=this.get('slide'),toggle;switch(how){case'hide':slide.hide(mode);break;case'show':slide.show(mode);break;case'toggle':var flag=this.retrieve('slide:flag',slide.open);slide[flag?'slideOut':'slideIn'](mode);this.store('slide:flag',!flag);toggle=true;break;default:slide.start(how,mode)}if(!toggle)this.eliminate('slide:flag');return this}});var SmoothScroll=Fx.SmoothScroll=new Class({Extends:Fx.Scroll,initialize:function(options,context){context=context||document;this.doc=context.getDocument();var win=context.getWindow();this.parent(this.doc,options);this.links=this.options.links?$$(this.options.links):$$(this.doc.links);var location=win.location.href.match(/^[^#]*/)[0]+'#';this.links.each(function(link){if(link.href.indexOf(location)!=0){return}var anchor=link.href.substr(location.length);if(anchor)this.useLink(link,anchor)},this);if(!Browser.Engine.webkit419){this.addEvent('complete',function(){win.location.hash=this.anchor},true)}},useLink:function(link,anchor){var el;link.addEvent('click',function(event){if(el!==false&&!el)el=document.id(anchor)||this.doc.getElement('a[name='+anchor+']');if(el){event.preventDefault();this.anchor=anchor;this.toElement(el);link.blur()}}.bind(this))}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:'px',grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,modifiers:{x:'left',y:'top'}},initialize:function(){var params=Array.link(arguments,{'options':Object.type,'element':$defined});this.element=document.id(params.element);this.document=this.element.getDocument();this.setOptions(params.options||{});var htype=$type(this.options.handle);this.handles=((htype=='array'||htype=='collection')?$$(this.options.handle):document.id(this.options.handle))||this.element;this.mouse={'now':{},'pos':{}};this.value={'start':{},'now':{}};this.selection=(Browser.Engine.trident)?'selectstart':'mousedown';this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};this.attach()},attach:function(){this.handles.addEvent('mousedown',this.bound.start);return this},detach:function(){this.handles.removeEvent('mousedown',this.bound.start);return this},start:function(event){if(this.options.preventDefault)event.preventDefault();this.mouse.start=event.page;this.fireEvent('beforeStart',this.element);var limit=this.options.limit;this.limit={x:[],y:[]};for(var z in this.options.modifiers){if(!this.options.modifiers[z])continue;if(this.options.style)this.value.now[z]=this.element.getStyle(this.options.modifiers[z]).toInt();else this.value.now[z]=this.element[this.options.modifiers[z]];if(this.options.invert)this.value.now[z]*=-1;this.mouse.pos[z]=event.page[z]-this.value.now[z];if(limit&&limit[z]){for(var i=2;i--;i){if($chk(limit[z][i]))this.limit[z][i]=$lambda(limit[z][i])()}}}if($type(this.options.grid)=='number')this.options.grid={x:this.options.grid,y:this.options.grid};this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});this.document.addEvent(this.selection,this.bound.eventStop)},check:function(event){if(this.options.preventDefault)event.preventDefault();var distance=Math.round(Math.sqrt(Math.pow(event.page.x-this.mouse.start.x,2)+Math.pow(event.page.y-this.mouse.start.y,2)));if(distance>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent('start',[this.element,event]).fireEvent('snap',this.element)}},drag:function(event){if(this.options.preventDefault)event.preventDefault();this.mouse.now=event.page;for(var z in this.options.modifiers){if(!this.options.modifiers[z])continue;this.value.now[z]=this.mouse.now[z]-this.mouse.pos[z];if(this.options.invert)this.value.now[z]*=-1;if(this.options.limit&&this.limit[z]){if($chk(this.limit[z][1])&&(this.value.now[z]>this.limit[z][1])){this.value.now[z]=this.limit[z][1]}else if($chk(this.limit[z][0])&&(this.value.now[z]<this.limit[z][0])){this.value.now[z]=this.limit[z][0]}}if(this.options.grid[z])this.value.now[z]-=((this.value.now[z]-(this.limit[z][0]||0))%this.options.grid[z]);if(this.options.style)this.element.setStyle(this.options.modifiers[z],this.value.now[z]+this.options.unit);else this.element[this.options.modifiers[z]]=this.value.now[z]}this.fireEvent('drag',[this.element,event])},cancel:function(event){this.document.removeEvent('mousemove',this.bound.check);this.document.removeEvent('mouseup',this.bound.cancel);if(event){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent('cancel',this.element)}},stop:function(event){this.document.removeEvent(this.selection,this.bound.eventStop);this.document.removeEvent('mousemove',this.bound.drag);this.document.removeEvent('mouseup',this.bound.stop);if(event)this.fireEvent('complete',[this.element,event])}});Element.implement({makeResizable:function(options){var drag=new Drag(this,$merge({modifiers:{x:'width',y:'height'}},options));this.store('resizer',drag);return drag.addEvent('drag',function(){this.fireEvent('resize',drag)}.bind(this))}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false,precalculate:false,includeMargins:true,checkDroppables:true},initialize:function(element,options){this.parent(element,options);this.droppables=$$(this.options.droppables);this.container=document.id(this.options.container);if(this.container&&$type(this.container)!='element')this.container=document.id(this.container.getDocument().body);var position=this.element.getStyle('position');if(position=='static')position='absolute';if([this.element.getStyle('left'),this.element.getStyle('top')].contains('auto'))this.element.position(this.element.getPosition(this.element.offsetParent));this.element.setStyle('position',position);this.addEvent('start',this.checkDroppables,true);this.overed=null},start:function(event){if(this.container){var ccoo=this.container.getCoordinates(this.element.getOffsetParent()),cbs={},ems={};['top','right','bottom','left'].each(function(pad){cbs[pad]=this.container.getStyle('border-'+pad).toInt();ems[pad]=this.element.getStyle('margin-'+pad).toInt()},this);var width=this.element.offsetWidth+ems.left+ems.right;var height=this.element.offsetHeight+ems.top+ems.bottom;if(this.options.includeMargins){$each(ems,function(value,key){ems[key]=0})}if(this.container==this.element.getOffsetParent()){this.options.limit={x:[0-ems.left,ccoo.right-cbs.left-cbs.right-width+ems.right],y:[0-ems.top,ccoo.bottom-cbs.top-cbs.bottom-height+ems.bottom]}}else{this.options.limit={x:[ccoo.left+cbs.left-ems.left,ccoo.right-cbs.right-width+ems.right],y:[ccoo.top+cbs.top-ems.top,ccoo.bottom-cbs.bottom-height+ems.bottom]}}}if(this.options.precalculate){this.positions=this.droppables.map(function(el){return el.getCoordinates()})}this.parent(event)},checkAgainst:function(el,i){el=(this.positions)?this.positions[i]:el.getCoordinates();var now=this.mouse.now;return(now.x>el.left&&now.x<el.right&&now.y<el.bottom&&now.y>el.top)},checkDroppables:function(){var overed=this.droppables.filter(this.checkAgainst,this).getLast();if(this.overed!=overed){if(this.overed)this.fireEvent('leave',[this.element,this.overed]);if(overed)this.fireEvent('enter',[this.element,overed]);this.overed=overed}},drag:function(event){this.parent(event);if(this.options.checkDroppables&&this.droppables.length)this.checkDroppables()},stop:function(event){this.checkDroppables();this.fireEvent('drop',[this.element,this.overed,event]);this.overed=null;return this.parent(event)}});Element.implement({makeDraggable:function(options){var drag=new Drag.Move(this,options);this.store('dragger',drag);return drag}});var Tips=new Class({Implements:[Events,Options],options:{onShow:function(tip){tip.setStyle('visibility','visible')},onHide:function(tip){tip.setStyle('visibility','hidden')},title:'title',text:function(el){return el.get('rel')||el.get('href')},showDelay:100,hideDelay:100,className:null,offset:{x:16,y:16},fixed:false},initialize:function(){var params=Array.link(arguments,{options:Object.type,elements:$defined});if(params.options&&params.options.offsets)params.options.offset=params.options.offsets;this.setOptions(params.options);this.container=new Element('div',{'class':'tip'});this.tip=this.getTip();if(params.elements)this.attach(params.elements)},getTip:function(){return new Element('div',{'class':this.options.className,styles:{visibility:'hidden',display:'none',position:'absolute',top:0,left:0}}).adopt(new Element('div',{'class':'tip-top'}),this.container,new Element('div',{'class':'tip-bottom'})).inject(document.body)},attach:function(elements){var read=function(option,element){if(option==null)return'';return $type(option)=='function'?option(element):element.get(option)};$$(elements).each(function(element){var title=read(this.options.title,element);element.erase('title').store('tip:native',title).retrieve('tip:title',title);element.retrieve('tip:text',read(this.options.text,element));var events=['enter','leave'];if(!this.options.fixed)events.push('move');events.each(function(value){element.addEvent('mouse'+value,element.retrieve('tip:'+value,this['element'+value.capitalize()].bindWithEvent(this,element)))},this)},this);return this},detach:function(elements){$$(elements).each(function(element){['enter','leave','move'].each(function(value){element.removeEvent('mouse'+value,element.retrieve('tip:'+value)||$empty)});element.eliminate('tip:enter').eliminate('tip:leave').eliminate('tip:move');if($type(this.options.title)=='string'&&this.options.title=='title'){var original=element.retrieve('tip:native');if(original)element.set('title',original)}},this);return this},elementEnter:function(event,element){$A(this.container.childNodes).each(Element.dispose);['title','text'].each(function(value){var content=element.retrieve('tip:'+value);if(!content)return;this[value+'Element']=new Element('div',{'class':'tip-'+value}).inject(this.container);this.fill(this[value+'Element'],content)},this);this.timer=$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this,element);this.tip.setStyle('display','block');this.position((!this.options.fixed)?event:{page:element.getPosition()})},elementLeave:function(event,element){$clear(this.timer);this.tip.setStyle('display','none');this.timer=this.hide.delay(this.options.hideDelay,this,element)},elementMove:function(event){this.position(event)},position:function(event){var size=window.getSize(),scroll=window.getScroll(),tip={x:this.tip.offsetWidth,y:this.tip.offsetHeight},props={x:'left',y:'top'},obj={};for(var z in props){obj[props[z]]=event.page[z]+this.options.offset[z];if((obj[props[z]]+tip[z]-scroll[z])>size[z])obj[props[z]]=event.page[z]-this.options.offset[z]-tip[z]}this.tip.setStyles(obj)},fill:function(element,contents){if(typeof contents=='string')element.set('html',contents);else element.adopt(contents)},show:function(el){this.fireEvent('show',[this.tip,el])},hide:function(el){this.fireEvent('hide',[this.tip,el])}});Fx.Marquee=new Class({Extends:Fx.Morph,options:{mode:'horizontal',message:'',revert:true,delay:5000,cssClass:'msg',showEffect:{opacity:1},hideEffect:{opacity:0},revertEffect:{opacity:[0,1]},currentMessage:null},initialize:function(container,options){container=document.id(container);var msg=this.options.currentMessage||(container.getChildren().length==1)?container.getFirst():'';var wrapper=new Element('div',{styles:{position:'relative'},'class':'fxMarqueeWrapper'}).inject(container);this.parent(wrapper,options);this.current=this.wrapMessage(msg)},wrapMessage:function(msg){if(document.id(msg)&&document.id(msg).hasClass('fxMarquee')){var wrapper=document.id(msg)}else{var wrapper=new Element('span',{'class':'fxMarquee',styles:{position:'relative'}});if(document.id(msg))wrapper.grab(document.id(msg));else if($type(msg)=="string")wrapper.set('html',msg)}return wrapper.inject(this.element)},announce:function(options){this.setOptions(options).showMessage();return this},showMessage:function(reverting){(function(){var chain=this.$chain?$A(this.$chain):[];this.clearChain();this.element=document.id(this.element);this.current=document.id(this.current);this.message=document.id(this.message);this.start(this.options.hideEffect).chain(function(){if(reverting){this.message.hide();if(this.current)this.current.show()}else{if(this.message)this.message.dispose();this.message=this.wrapMessage(this.options.message);if(this.current)this.current.hide()}this.start((reverting)?this.options.revertEffect:this.options.showEffect).chain(function(){if(this.$chain)this.$chain.combine(chain);else this.$chain=chain;this.fireEvent((reverting)?'onRevert':'onMessage');if(!reverting&&this.options.revert)this.showMessage(true);else this.callChain.delay(this.options.delay,this)}.bind(this))}.bind(this))}).delay((reverting)?this.options.delay:10,this);return this}});;var xsite="http://www.gamempire.it/",fsite="http://forum.gamempire.it/",pajax=xsite+"includes/ajax.php",rollerx=xsite+"scripts/roller.gif";var fooz=new Date;var unixtime_ms=fooz.getTime();var unixtime=parseInt(unixtime_ms/1000);var unixtimex=unixtime+60*60*24*30;var artab=new Array();artab[1]=new Array();artab[2]=new Array();artab[3]=new Array();function tabber(tabid){artab[tabid][0]=1;var tas=$$('#tabs'+tabid+' .ta'),tabs=$$('#tabs'+tabid+' .tab'),txs=$$('#tabs'+tabid+' .tx'),activo=0;tabs.each(function(tab,z){if(z==0){tab.fade(1);}
else{tab.fade(0);}}.bind(this));tas.each(function(ta,a){if(a==0){ta.setStyle('background-position','-104px -361px')}}.bind(this));txs.each(function(tx,i){if(i!=0){tx.fade(0.3);}
tx.addEvent('mouseenter',function(e){if(activo!=i){tx.fade(0.7);}}.bind(this));tx.addEvent('mouseout',function(e){if(activo!=i){tx.fade(0.3);}}.bind(this));tx.addEvent('click',function(e){if(activo!=i){activo=i;tx.fade(1);txs.each(function(ot,l){if(l!=i){ot.fade(0.3);}});tas.each(function(ta,j){if(j==i){ta.set('opacity','.10');(function(){ta.setStyle('background-position','-104px -361px').fade(1);}).delay(200);}
else{ta.fade(0.1);(function(){ta.setStyle('background-position','-104px -336px').fade(1);}).delay(500);}});tabs.each(function(tab,z){if(i==z){if(artab[tabid][z]!=1){artab[tabid][z]=1;tab.set('html','<div id="loadimg" style="margin-top: 150px; text-align: center; width: 314px;"><img src="'+rollerx+'" /></div>');var takeTab=new Request({method:'post',url:pajax});takeTab.onSuccess=function(responseText,responseXML){tab.set('html',responseText);}
takeTab.send('modific=25&tabid='+tabid+'&ta='+z+'&piatt='+$('piatt').get('html'));}
tab.fade(1);}
else{tab.fade(0);}});}}.bind(this));});}
var takedStinfo=0;var Logy={logyOpen:function(){var logybox=$('logybox'),content=$('logybox_content'),overlay=$('logybox_overlay');if(!Browser.Engine.trident){$$('embed').setStyle('visibility','hidden');}
logybox.setStyle('display','block');content.setStyle('display','block').fade(1);overlay.fade(0.8);},logyStartOpen:function(){var logybox=$('logybox'),contentstart=$('logybox_start_content'),overlay=$('logybox_overlay');if(takedStinfo!=1){$('logybox_start_t').set('html','<img src="'+rollerx+'" style="margin: 260px auto 0;" />');var takeStinfo=new Request({method:'post',url:pajax});takeStinfo.onSuccess=function(responseText,responseXML){takedStinfo=1;$('logybox_start_t').set('html',responseText);$('logybox_start_p0').setStyle('background-position','0 -'+lopBack[p]+'px');}
takeStinfo.send('modific=32');}
if(!Browser.Engine.trident){$$('embed').setStyle('visibility','hidden');}
logybox.setStyle('display','block');contentstart.setStyle('display','block').fade(1);overlay.fade(0.8);},logyBannerOpen:function(){var logybox=$('logybox'),contentbanner=$('logybox_banner_content'),overlay=$('logybox_overlay');var takeBanner=new Request({method:'post',url:pajax});takeBanner.onSuccess=function(responseText,responseXML){$('logybanner_content').set('html',responseText);}
takeBanner.send('modific=36');if(!Browser.Engine.trident){$$('embed').setStyle('visibility','hidden');}
logybox.setStyle('display','block');contentbanner.setStyle('display','block').fade(1);overlay.fade(0.8);},logyClose:function(){var logybox=$('logybox'),content=$('logybox_content'),contentstart=$('logybox_start_content'),contentbanner=$('logybox_banner_content'),overlay=$('logybox_overlay');content.fade(0);contentstart.fade(0);contentbanner.fade(0);overlay.fade(0);(function(){logybox.setStyle('display','none');content.setStyle('display','none');$$('#logybox_content .logydiv').setStyle('display','none');}).delay(800);if(!Browser.Engine.trident){$$('embed').setStyle('visibility','visible');}}};lopBack=new Array(46,215,383);function locont(p){$$('.logyp').setStyle('background-position','');$('logybox_start_p'+p).setStyle('background-position','0 -'+lopBack[p]+'px');$$('#logybox_start_t div').setStyle('display','');$('logybox_start_testo'+p).setStyle('display','block');}
window.addEvent('domready',function(){if($('header')){var ball=$('header').getElement('h1'),cango=1;var ballfx=new Fx.Morph(ball,{duration:1500,link:'cancel',transition:Fx.Transitions.Elastic.easeOut,onStart:function(){cango=0;},onComplete:function(){cango=1;}});var balldrag=new Drag.Move(ball,{onBeforeStart:function(e){if(cango==0){ballfx.cancel();cango=1;}},onComplete:function(){ballfx.start({'top':4,'left':443});}});}
var rwall=Math.round(18*Math.random());$$('body').setStyle('background','url('+xsite+'immagini/sfondi/wall-'+rwall+'.jpg) no-repeat #FFF top center fixed');var content=$('logybox_content'),overlay=$('logybox_overlay');if(overlay){overlay.addEvent('click',function(e){e.stop();Logy.logyClose();}).fade('hide');content.fade('hide');$('logybox_start_content').fade('hide');$('logybox_banner_content').fade('hide');$$('.logybox_close').addEvent('click',function(e){e.stop();Logy.logyClose();});}
if($('logybox_startinfo')){$$('.logyp').each(function(lop,p){if(p==0){lop.setStyle('background-position','0 -'+lopBack[p]+'px');}
lop.addEvent('click',function(e){locont(p);});});$('barra_info').addEvent('click',function(e){Logy.logyStartOpen();});if(Cookie.read('startinfo')==null||Cookie.read('startinfo')<unixtime){Logy.logyStartOpen();Cookie.write('startinfo',unixtimex,{duration:30,path:'/',domain:'.gamempire.it'});}}
if($$('.logyrel')){$$('.logyrel').addEvent('click',function(){Logy.logyOpen();$$('#logybox_content iframe').setStyle('display','block');});}
if($$('.areg')){var takedReg=0;$$('.areg').addEvent('click',function(e){loform=$('logybox_reg_form');losend=$('logybox_reg_send');Logy.logyOpen();$('logybox_reg').setStyle('display','block');loform.setStyle('display','block');losend.setStyle('display','none');if(takedReg!=1){takedReg=1;loform.set('html','<div id="loadimg" style="margin-top: 60px; text-align: center;"><img src="'+rollerx+'" /></div>');var takeReg=new Request({method:'post',url:pajax});takeReg.onSuccess=function(responseText,responseXML){loform.set('html',responseText);losend.set('html','');$('reg_form').addEvent('submit',function(e){e.stop();loform.setStyle('display','none');losend.setStyle('display','block');var doReg=new Request({method:'post',url:pajax}),username=$('reg_username').get('value'),password=$('reg_password').get('value'),email=$('email_reg').get('value');losend.set('html','<div id="loadimg" style="margin-top: 60px; text-align: center;"><img src="'+rollerx+'" /></div>');doReg.onSuccess=function(responseText,responseXML){losend.set('html',responseText);if(responseText.substr(0,8)=="<strong>"){window.logyframe.$('login_input_user').set('value',username);window.logyframe.$('login_input_pwd').set('value',password);$('login_reg').removeEvents('click').addEvent('click',function(e){window.logyframe.$('login_form').submit();});(function(){window.logyframe.$('login_form').submit();}).delay(15000);}
$('backreg').addEvent('click',function(e){e.stop();loform.setStyle('display','block');losend.setStyle('display','none').set('html','');});}
doReg.send('modific=27&username='+username+'&password='+password+'&email='+email);});$('login_reg').addEvent('click',function(){$$('#logybox_content iframe').setStyle('display','block');$('logybox_reg').setStyle('display','none');});}
takeReg.send('modific=26');}});}
if($('login_puls_reg')){$('login_puls_reg').addEvent('click',function(e){window.parent.$$('#logybox_content iframe').setStyle('display','none');window.parent.$$('.areg').fireEvent('click');});}
if($('ricerca_form')){if($('ricerca_form').get('action')==xsite+'cerca/games/'){$$('.ricerca_input').each(function(aut,i){if(i!=2){new Autocompleter.Request.HTML($(aut),pajax,{'indicatorClass':'autocompleter-loading','postVar':'ricerca_txt','autoSubmit':true,'minLength':3,'postData':{'modific':9},'injectChoice':function(choice){var text=choice.getFirst();var value=text.innerHTML;choice.inputValue=value;text.set('html',this.markQueryValue(value));this.addChoiceEvents(choice);}});}});}}
if($('barra_liv')){fade=new Array;fade['livello']=1;fade['punti']=0;var showLivPun=function(){$('barra_liv').fade(fade['livello']);if(fade['livello']==1){fade['livello']=0;}else{fade['livello']=1;}
$('barra_pun').fade(fade['punti']);if(fade['punti']==1){fade['punti']=0;}else{fade['punti']=1;}};var pshowLivPun=showLivPun.create({periodical:4000});pshowLivPun();}
new SmoothScroll({duration:1000},window);var tipz=new Tips('.tips',{showDelay:300,className:'tipz'});var tipd=new Tips('.tipsdown',{showDelay:300,className:'tipd'});var kwock=$$('.kwock'),kwockla=$$('.kwockla'),activo1=30,activo2=40,activo3=50;kwock.each(function(kw,k){ksrc=kw.get('src');if(ksrc==xsite+'immagini/menu/button_onb.png'){activo1=k;}
if(ksrc==xsite+'immagini/menu/button_ony.png'){activo2=k;}
if(ksrc==xsite+'immagini/menu/button_onr.png'){activo3=k;}});kwockla.each(function(kwa,a){if(activo1!=a&&activo2!=a){kwa.fade(0.8);}
kwa.addEvent('mouseenter',function(e){kwock.each(function(kw,i){if(activo1!=i&&activo2!=i&&activo3!=i&&a==i){kw.fade(0.5);kwa.fade(1);}});}.bind(this));kwa.addEvent('mouseout',function(e){kwock.each(function(kw,i){if(activo1!=i&&activo2!=i&&activo3!=i&&a==i){kw.fade(1);kwa.fade(0.8);}});}.bind(this));});var togglers=$$('h3.toggler');var myAccordion=new Accordion($('accordion'),'h3.toggler','div.element',{opacity:false,onActive:function(tog){tog.setStyle('color','#41464D');},onBackground:function(tog){tog.setStyle('color','#528CE0');}});togglers.addEvent('mouseenter',function(){this.fireEvent('click');});tabber(1);var shadv=$('ricerca_index_shadv'),rivar=$$('#ricerca_index_hiadv','#ricerca_index_piatt','#ricerca_index_sez','#ricerca_index_gen'),gianet=0;if(rivar[1]){rivar.fade('hide');var searchSlide=new Fx.Morph('ricerca_index_icons',{duration:1000});$('showadvanced').addEvent('click',function(e){e.stop();shadv.fade(0);if(gianet==0){var takeGener=new Request({method:'post',url:pajax});takeGener.onSuccess=function(responseText,responseXML){rivar[3].set('html',responseText);}
takeGener.send('modific=18');gianet=1;}
(function(){rivar.setStyle('display','block').fade(1);}).delay(500);searchSlide.start({'height':0});});$('hideadvanced').addEvent('click',function(e){e.stop();rivar.fade(0);(function(){shadv.fade(1);rivar[1].selectedIndex=0;rivar[2].selectedIndex=0;rivar[3].selectedIndex=0;}).delay(500);searchSlide.start({'height':47});document.getElementById('ricerca_index_txt').disabled=false;document.getElementById('gen_se').selectedIndex=0;});var takedGame=0;$('apers').addEvent('click',function(e){e.stop();Logy.logyOpen();$('logybox_igamempire').setStyle('display','block');$('logybox_info').setStyle('display','block');if(takedGame!=1){var takeIgame=new Request({method:'post',url:pajax});takeIgame.onSuccess=function(responseText,responseXML){takedGame=1;$('logybox_igamempire').set('html',responseText);}
takeIgame.send('modific=17');}});var takedStat=0;$('astat').addEvent('click',function(e){e.stop();Logy.logyOpen();$('logybox_stat').setStyle('display','block');if(takedStat!=1){var takeStat=new Request({method:'post',url:pajax});takeStat.onSuccess=function(responseText,responseXML){takedStat=1;$('logybox_stat').set('html',responseText);}
takeStat.send('modific=13');}});}
var panactive=0,staferm=[],barra=$('barra_pannello'),barli=$$('#barra_menu li'),divinside=$$('.barra_inside'),presidiv=[],openLi=[],lewi=[110,300,290,0,0,200,435],openMenu=new Fx.Morph('barra_menu',{duration:800,link:'cancel',transition:Fx.Transitions.Quad.easeOut}),roundMenu=new Fx.Morph('barra',{duration:500,link:'cancel',transition:Fx.Transitions.Quad.easeOut}),roundMenuClose=new Fx.Morph('barra_close',{duration:500,link:'cancel',transition:Fx.Transitions.Quad.easeOut});if(barra){barra.addEvent('click',function(e){e.stop();if(panactive==0){barra.setStyle('background-position','-73px -612px');openMenu.start({'height':189,'padding-top':'14px'});$('barra_menu').setStyle('display','block');panactive=1;}
else{barra.setStyle('background-position','-73px -585px');openMenu.start({'height':0,'padding-top':0});(function(){$('barra_menu').setStyle('display','none');}).delay(700);panactive=0;}
divinside.setStyle('display','none');});barra.addEvent('mouseenter',function(e){e.stop();if(panactive==0){barra.setStyle('background-position','-73px -585px');}});barra.addEvent('mouseleave',function(e){e.stop();if(panactive==0){barra.setStyle('background-position','0 -612px');}});$('barra_rdown').addEvent('click',function(e){roundMenu.start({'height':0});(function(){roundMenuClose.start({'height':26});}).delay(500);Cookie.write('barround',1,{duration:365,path:'/',domain:'.gamempire.it'});});$('barra_close').addEvent('click',function(e){roundMenuClose.start({'height':0});(function(){roundMenu.start({'height':26});}).delay(500);Cookie.write('barround',2,{duration:365,path:'/',domain:'.gamempire.it'});});}
$$('body').addEvent('click',function(){if(panactive==1){barra.setStyle('background-position','0 -612px');openMenu.start({'height':0,'padding-top':0});(function(){$('barra_menu').setStyle('display','none');}).delay(700);divinside.setStyle('display','none');panactive=0;}});barli.each(function(li,z){if(z!=3&&z!=4){li.addEvents({'mouseenter':function(){if(panactive==1){$('li'+z).setStyle('background-position','-148px -460px');li.setStyles({'color':'#FFF','background-color':'#4E4E4E'});staferm.each(function(st,s){if(s!=z){staferm[s]=0;}});if(staferm[z]==1){staferm[z]=0;}else{openLi[z].start({'width':[0,lewi[z]]});}
divinside.each(function(div,r){if(r!=z){div.setStyle('display','none');}});$('barra_menu_in'+z).setStyle('display','block');if(z==1||z==2||z==6){if(presidiv[z]!=1){presidiv[z]=1;$('barra_menu_in'+z).set('html','<div id="loadimg" style="margin: 50px auto; text-align: center;"><img src="'+rollerx+'" /></div>');var takeDiv=new Request({method:'post',url:pajax});takeDiv.onSuccess=function(responseText,responseXML){$('barra_menu_in'+z).set('html',responseText);}
fin=z+22;takeDiv.send('modific='+fin);}}}},'mouseleave':function(){if(panactive==1){$('li'+z).setStyle('background-position','-140px -460px');li.setStyles({'color':'#000','background-color':'#5E5E5E'});$('barra_menu_in'+z).setStyle('display','none');}},'click':function(e){e.stop();}});}
else{li.addEvents({'mouseenter':function(){if(panactive==1){li.setStyles({'color':'#FFF','background-color':'#4E4E4E'});divinside.each(function(div,r){if(r!=z){div.setStyle('display','none');}});}},'mouseleave':function(){if(panactive==1){li.setStyles({'color':'#000','background-color':'#5E5E5E'});}}});}}.bind(this));divinside.each(function(div,z){openLi[z]=new Fx.Morph(div,{duration:500,link:'cancel',transition:Fx.Transitions.Quad.easeOut});div.addEvents({'mouseenter':function(e){e.stop();$('li'+z).setStyle('background-position','-148px -460px');barli[z].setStyles({'color':'#000','background-color':'#5E5E5E'});div.setStyle('display','block');},'mouseleave':function(e){e.stop();staferm[z]=1;$('li'+z).setStyle('background-position','-140px -460px');barli[z].setStyles({'color':'#000','background-color':'#5E5E5E'});},'click':function(e){if(z==6){e.stopPropagation();}}});}.bind(this));$$('#barra_menu_in0 li').each(function(li,z){li.addEvents({'click':function(e){e.stop();window.location=xsite+'user/creazione/'+li.get('html').toLowerCase()+'/';}});});if($('barra_news')){fxmq=new Fx.Marquee($('barra_news'),{duration:500,showEffect:{top:[0,0],right:[-100,0],opacity:[0,1]},hideEffect:{top:20},revertEffect:{top:[-30,0],left:[0,0]},revert:false});var annuncia=function(){fxmq.announce({message:$('barra_news_0').get('html')}).chain(function(){fxmq.announce({message:$('barra_news_1').get('html')});}).chain(function(){fxmq.announce({message:$('barra_news_2').get('html')});}).chain(function(){fxmq.announce({message:$('barra_news_3').get('html')});}).chain(function(){fxmq.announce({message:$('barra_news_4').get('html')});}).chain(function(){fxmq.announce({message:$('barra_news_5').get('html')});}).chain(function(){fxmq.announce({message:$('barra_news_6').get('html')});}).chain(function(){fxmq.announce({message:$('barra_news_7').get('html')});}).chain(function(){fxmq.announce({message:$('barra_news_8').get('html')});}).chain(function(){fxmq.announce({message:$('barra_news_9').get('html')});}).chain(function(){annuncia.run();})};annuncia.run();}});var imgLoad=new Image();imgLoad.src=rollerx;function addfurl(irl,addfi){$('ricerca'+addfi+'_form').setProperty('action',xsite+"cerca/"+irl+"/"+$('ricerca'+addfi+'_txt').get('value')+"/").submit();}
function visuaLater(mo){if($('visualater').value==0){unixtimen=unixtime+60*10;Cookie.write('startinfo',unixtimen,{duration:365,path:'/',domain:'.gamempire.it'});$('visualater').value=1;}
else{Cookie.write('startinfo',unixtimex,{duration:365,path:'/',domain:'.gamempire.it'});$('visualater').value=0;}
if(mo==1){if($('visualater').checked==true){$('visualater').checked=false;}
else{$('visualater').checked=true;}}}
function disabSea(i,gor){if(i==0){document.getElementById('ricerca_index_txt').disabled=false;}
else{document.getElementById('ricerca_index_txt').disabled=true;window.location=xsite+"genere/"+gor+"/";}}
function banclick(id){newAjax=new Request({method:'post',url:pajax});newAjax.send('modific=16&id='+id);}
window.pres=0;function hideCompl(){if(window.pres==0){$('automplediv').setStyle('display','none');}}
canperson='Devi essere registrato per poter personalizzare la pagina di Gamempire.<br /><a class="blank" href="'+fsite+'register.php"><strong>Clicca qui per registrarti!</strong></a>';function piattpref(id,piatt){var elemento=$('setpiattpref'),newAjax=new Request({method:'post',url:pajax});elemento.set('html','<div id="loadimg" style="width:280px; text-align:center;"><img src="'+rollerx+'" /></div>');newAjax.onSuccess=function(responseText,responseXML){if(id!=0){if(piatt!=""){elemento.set('html','Hai selezionato la console <span class="c_azzurro"><strong>'+piatt.substr(0,1).toUpperCase()+piatt.substr(1,piatt.length)+'</strong></span> come pagina predefinita.<br /> Per modificare o cancellare la tua preferenza, <strong><a class="c_azzurro" href="javascript:void(0);" onclick="modpiattpref('+id+')">Clicca qui</a></strong>.');}
else{elemento.set('html','Hai selezionato la pagina <strong>generale</strong> come pagina predefinita.<br /> Per modificare o cancellare la tua preferenza, <strong><a class="c_azzurro" href="javascript:void(0);" onclick="modpiattpref('+id+')">Clicca qui</a></strong>.');}}
else{elemento.set('html',canperson);}}
newAjax.send('modific=11&id='+id+'&piatt='+piatt);}
function modpiattpref(id){$('setpiattpref').set('html','<select name="piatt"><option value="" onclick="piattpref('+id+', this.value)">Scegli...</option><option value="" onclick="piattpref('+id+', this.value)">Nessuna</option><option value="pc" onclick="piattpref('+id+', this.value)">Pc</option><option value="ps3" onclick="piattpref('+id+', this.value)">Ps3</option><option value="xbox 360" onclick="piattpref('+id+', this.value)">Xbox 360</option><option value="psp" onclick="piattpref('+id+', this.value)">Psp</option><option value="wii" onclick="piattpref('+id+', this.value)">Wii</option><option value="ds" onclick="piattpref('+id+', this.value)">Ds</option><option value="ps2" onclick="piattpref('+id+', this.value)">Ps2</option></select><br />Seleziona la pagina della tua <span class="c_azzurro">console preferita</span> come pagina predefinita');}
function gome(){document.cookie="gome=1";}
function colorpref(id,color){var elemento=$('setcolorpref'),newAjax=new Request({method:'post',url:pajax});elemento.set('html','<div id="loadimg" style="width:280px; text-align:center;"><img src="'+rollerx+'" /></div>');newAjax.onSuccess=function(responseText,responseXML){if(id!=0){elemento.innerHTML='Il modulo per personalizzare Gamempire cambiando colore non &egrave; ancora attivo.<br />Sarà disponibile a breve.<br />Scusate per l\'imprevisto.';}
else{elemento.innerHTML=canperson;}}
newAjax.send('modific=12&id='+id+'&color='+color);}
function popinfo(info){var w=600;var h=400;var l=Math.floor((screen.width-w)/2);var t=Math.floor((screen.height-h)/2);window.open(xsite+"admin/info.php?info="+info,"","width="+w+",height="+h+",top="+t+",left="+l);}
function apri(perc){window.location=xsite+perc;};var Kwix={start:function(){Kwix.parseKwicks();},parseKwicks:function(){var squeeze_to=115;var max_width=200;var start_widths=new Array();var kwicks=$$('#box_images .kimg');var fx=new Fx.Elements(kwicks,{wait:false,duration:250,transition:Fx.Transitions.Cubic.easeOut});kwicks.each(function(kwick,i){start_widths[i]=kwick.getStyle('width').toInt();kwick.addEvent('mouseenter',function(e){var obj={};obj[i]={'width':[kwick.getStyle('width').toInt(),max_width]};var counter=0;kwicks.each(function(other,j){if(other!=kwick){var w=other.getStyle('width').toInt();if(w!=squeeze_to)obj[j]={'width':[w,squeeze_to]};}});fx.start(obj);});});$('kwick').addEvent('mouseleave',function(e){var obj={};kwicks.each(function(other,j){obj[j]={'width':[other.getStyle('width').toInt(),start_widths[j]]};});fx.start(obj);});}};window.addEvent('domready',function(){Kwix.start();var flashToggle=new Fx.Slide('box_flevid_center',{duration:1200}),flash2Toggle=new Fx.Slide('box_flevid2_center',{duration:1200}),status={'true':'-90','false':'-109'},status2={'true':'-90','false':'-109'};$('toggle_flash').addEvent('click',function(e){e.stop();flashToggle.toggle();flash2Toggle.toggle();});$('toggle_flash2').addEvent('click',function(e){e.stop();flash2Toggle.toggle();flashToggle.toggle();});flash2Toggle.toggle();flashToggle.addEvent('complete',function(){$$('#toggle_flash .box_frecce').setStyle('background-position',status[flashToggle.open]+'px -108px');});flash2Toggle.addEvent('complete',function(){$$('#toggle_flash2 .box_frecce2').setStyle('background-position',status2[flash2Toggle.open]+'px -108px');});tabber(2);tabber(3);});function chPosts(id){var elemento=$('ultimi_post_ul'),newAjax=new Request({method:'post',url:pajax});elemento.set('html','<div id="loadimg" style="width:430px; text-align:center; padding:64px 0;"><img src="'+rollerx+'" /></div>');newAjax.onSuccess=function(responseText,responseXML){elemento.set('html',responseText);}
newAjax.send('modific=10&id='+id);}
function setSond(id,voto){var elemento=$('divsond'),ris_puls=$('sond_ris_puls'),newAjax=new Request({method:'post',url:pajax});elemento.set('html','<div id="loadimg" style="width: 174px; text-align: center;"><img src="'+rollerx+'" /></div>');newAjax.onSuccess=function(responseText,responseXML){ris_puls.setStyles({'display':'block','margin':'10px auto 0'});elemento.setStyles({'text-align':'center','font-size':'14px'}).set('html',responseText);}
newAjax.send('modific=7&id='+id+'&voto='+voto);}
var noobSlide=new Class({initialize:function(params){this.items=params.items;this.mode=params.mode||'vertical';this.modes={horizontal:['left','width'],vertical:['top','height']};this.size=params.size||341;this.box=params.box.setStyle(this.modes[this.mode][1],(this.size*this.items.length)+'px');this.button_event=params.button_event||'click';this.handle_event=params.handle_event||'click';this.onWalk=params.onWalk||null;this.currentIndex=null;this.previousIndex=null;this.nextIndex=null;this.interval=params.interval||6000;this.autoPlay=params.autoPlay||true;this._play=null;this.handles=params.handles||null;if(this.handles){this.addHandleButtons(this.handles);}
this.buttons={previous:[],next:[],play:[],playback:[],stop:[]};if(params.addButtons){for(var action in params.addButtons){this.addActionButtons(action,$type(params.addButtons[action])=='array'?params.addButtons[action]:[params.addButtons[action]]);}}
this.fx=new Fx.Tween(this.box,$extend((params.fxOptions||{duration:500,wait:false}),{property:this.modes[this.mode][0]}));this.walk((params.startItem||0),true,true);},addHandleButtons:function(handles){for(var i=0;i<handles.length;i++){handles[i].addEvent(this.handle_event,this.walk.bind(this,[i,true]));}},addActionButtons:function(action,buttons){for(var i=0;i<buttons.length;i++){switch(action){case'previous':buttons[i].addEvent(this.button_event,this.previous.bind(this,[true]));break;case'next':buttons[i].addEvent(this.button_event,this.next.bind(this,[true]));break;case'play':buttons[i].addEvent(this.button_event,this.play.bind(this,[this.interval,'next',false]));break;case'playback':buttons[i].addEvent(this.button_event,this.play.bind(this,[this.interval,'previous',false]));break;case'stop':buttons[i].addEvent(this.button_event,this.stop.bind(this));break;}
this.buttons[action].push(buttons[i]);}},previous:function(manual){this.walk((this.currentIndex>0?this.currentIndex-1:this.items.length-1),manual);},next:function(manual){this.walk((this.currentIndex<this.items.length-1?this.currentIndex+1:0),manual);},play:function(interval,direction,wait){this.stop();if(!wait){this[direction](false);}
this._play=this[direction].periodical(interval,this,[false]);},stop:function(){$clear(this._play);},walk:function(item,manual,noFx){if(item!=this.currentIndex){this.currentIndex=item;this.previousIndex=this.currentIndex+(this.currentIndex>0?-1:this.items.length-1);this.nextIndex=this.currentIndex+(this.currentIndex<this.items.length-1?1:1-this.items.length);if(manual){this.stop();}
if(noFx){this.fx.cancel().set((this.size*-this.currentIndex)+'px');}else{this.fx.start(this.size*-this.currentIndex);}
if(manual&&this.autoPlay){this.play(this.interval,'next',true);}
if(this.onWalk){this.onWalk((this.items[this.currentIndex]||null),(this.handles&&this.handles[this.currentIndex]?this.handles[this.currentIndex]:null));}}}});;var Observer=new Class({Implements:[Options,Events],options:{periodical:false,delay:1000},initialize:function(el,onFired,options){this.element=$(el)||$$(el);this.addEvent('onFired',onFired);this.setOptions(options);this.bound=this.changed.bind(this);this.resume();},changed:function(){var value=this.element.get('value');if($equals(this.value,value))return;this.clear();this.value=value;this.timeout=this.onFired.delay(this.options.delay,this);},setValue:function(value){this.value=value;this.element.set('value',value);return this.clear();},onFired:function(){this.fireEvent('onFired',[this.value,this.element]);},clear:function(){$clear(this.timeout||null);return this;},pause:function(){if(this.timer)$clear(this.timer);else this.element.removeEvent('keyup',this.bound);return this.clear();},resume:function(){this.value=this.element.get('value');if(this.options.periodical)this.timer=this.changed.periodical(this.options.periodical,this);else this.element.addEvent('keyup',this.bound);return this;}});var $equals=function(obj1,obj2){return(obj1==obj2||JSON.encode(obj1)==JSON.encode(obj2));};var Autocompleter=new Class({Implements:[Options,Events],options:{minLength:1,markQuery:true,width:'inherit',maxChoices:10,injectChoice:null,customChoices:null,emptyChoices:null,visibleChoices:true,className:'autocompleter-choices',zIndex:42,delay:400,observerOptions:{},fxOptions:{},autoSubmit:false,overflow:false,overflowMargin:25,selectFirst:false,filter:null,filterCase:false,filterSubset:false,forceSelect:false,selectMode:true,choicesMatch:null,multiple:false,separator:', ',separatorSplit:/\s*[,;]\s*/,autoTrim:false,allowDupes:false,cache:true,relative:false},initialize:function(element,options){this.element=$(element);this.setOptions(options);this.build();this.observer=new Observer(this.element,this.prefetch.bind(this),$merge({'delay':this.options.delay},this.options.observerOptions));this.queryValue=null;if(this.options.filter)this.filter=this.options.filter.bind(this);var mode=this.options.selectMode;this.typeAhead=(mode=='type-ahead');this.selectMode=(mode===true)?'selection':mode;this.cached=[];},build:function(){if($(this.options.customChoices)){this.choices=this.options.customChoices;}else{this.choices=new Element('ul',{'class':this.options.className,'styles':{'zIndex':this.options.zIndex}}).inject(document.body);this.relative=false;if(this.options.relative){this.choices.inject(this.element,'after');this.relative=this.element.getOffsetParent();}
this.fix=new OverlayFix(this.choices);}
if(!this.options.separator.test(this.options.separatorSplit)){this.options.separatorSplit=this.options.separator;}
this.fx=(!this.options.fxOptions)?null:new Fx.Tween(this.choices,$merge({'property':'opacity','link':'cancel','duration':200},this.options.fxOptions)).addEvent('onStart',Chain.prototype.clearChain).set(0);this.element.setProperty('autocomplete','off').addEvent((Browser.Engine.trident||Browser.Engine.webkit)?'keydown':'keypress',this.onCommand.bind(this)).addEvent('click',this.onCommand.bind(this,[false])).addEvent('focus',this.toggleFocus.create({bind:this,arguments:true,delay:100})).addEvent('blur',this.toggleFocus.create({bind:this,arguments:false,delay:100}));},destroy:function(){if(this.fix)this.fix.destroy();this.choices=this.selected=this.choices.destroy();},toggleFocus:function(state){this.focussed=state;if(!state)this.hideChoices(true);this.fireEvent((state)?'onFocus':'onBlur',[this.element]);},onCommand:function(e){if(!e&&this.focussed)return this.prefetch();if(e&&e.key&&!e.shift){switch(e.key){case'enter':if(this.element.value!=this.opted)return true;if(this.selected&&this.visible){this.choiceSelect(this.selected);return!!(this.options.autoSubmit);}
break;case'up':case'down':if(!this.prefetch()&&this.queryValue!==null){var up=(e.key=='up');this.choiceOver((this.selected||this.choices)[(this.selected)?((up)?'getPrevious':'getNext'):((up)?'getLast':'getFirst')](this.options.choicesMatch),true);}
return false;case'esc':case'tab':this.hideChoices(true);break;}}
return true;},setSelection:function(finish){var input=this.selected.inputValue,value=input;var start=this.queryValue.length,end=input.length;if(input.substr(0,start).toLowerCase()!=this.queryValue.toLowerCase())start=0;if(this.options.multiple){var split=this.options.separatorSplit;value=this.element.value;start+=this.queryIndex;end+=this.queryIndex;var old=value.substr(this.queryIndex).split(split,1)[0];value=value.substr(0,this.queryIndex)+input+value.substr(this.queryIndex+old.length);if(finish){var tokens=value.split(this.options.separatorSplit).filter(function(entry){return this.test(entry);},/[^\s,]+/);if(!this.options.allowDupes)tokens=[].combine(tokens);var sep=this.options.separator;value=tokens.join(sep)+sep;end=value.length;}}
this.observer.setValue(value);this.opted=value;if(finish||this.selectMode=='pick')start=end;this.element.selectRange(start,end);this.fireEvent('onSelection',[this.element,this.selected,value,input]);},showChoices:function(){var match=this.options.choicesMatch,first=this.choices.getFirst(match);this.selected=this.selectedValue=null;if(this.fix){var pos=this.element.getCoordinates(this.relative),width=this.options.width||'auto';this.choices.setStyles({'left':pos.left,'top':pos.bottom,'width':(width===true||width=='inherit')?pos.width:width});}
if(!first)return;if(!this.visible){this.visible=true;this.choices.setStyle('display','');if(this.fx)this.fx.start(1);this.fireEvent('onShow',[this.element,this.choices]);}
if(this.options.selectFirst||this.typeAhead||first.inputValue==this.queryValue)this.choiceOver(first,this.typeAhead);var items=this.choices.getChildren(match),max=this.options.maxChoices;var styles={'overflowY':'hidden','height':''};this.overflown=false;if(items.length>max){var item=items[max-1];styles.overflowY='scroll';styles.height=item.getCoordinates(this.choices).bottom;this.overflown=true;};this.choices.setStyles(styles);this.fix.show();if(this.options.visibleChoices){var scroll=document.getScroll(),size=document.getSize(),coords=this.choices.getCoordinates();if(coords.right>scroll.x+size.x)scroll.x=coords.right-size.x;if(coords.bottom>scroll.y+size.y)scroll.y=coords.bottom-size.y;window.scrollTo(Math.min(scroll.x,coords.left),Math.min(scroll.y,coords.top));}},hideChoices:function(clear){if(clear){var value=this.element.value;if(this.options.forceSelect)value=this.opted;if(this.options.autoTrim){value=value.split(this.options.separatorSplit).filter($arguments(0)).join(this.options.separator);}
this.observer.setValue(value);}
if(!this.visible)return;this.visible=false;if(this.selected)this.selected.removeClass('autocompleter-selected');this.observer.clear();var hide=function(){this.choices.setStyle('display','none');this.fix.hide();}.bind(this);if(this.fx)this.fx.start(0).chain(hide);else hide();this.fireEvent('onHide',[this.element,this.choices]);},prefetch:function(){var value=this.element.value,query=value;if(this.options.multiple){var split=this.options.separatorSplit;var values=value.split(split);var index=this.element.getSelectedRange().start;var toIndex=value.substr(0,index).split(split);var last=toIndex.length-1;index-=toIndex[last].length;query=values[last];}
if(query.length<this.options.minLength){this.hideChoices();}else{if(query===this.queryValue||(this.visible&&query==this.selectedValue)){if(this.visible)return false;this.showChoices();}else{this.queryValue=query;this.queryIndex=index;if(!this.fetchCached())this.query();}}
return true;},fetchCached:function(){return false;if(!this.options.cache||!this.cached||!this.cached.length||this.cached.length>=this.options.maxChoices||this.queryValue)return false;this.update(this.filter(this.cached));return true;},update:function(tokens){this.choices.empty();this.cached=tokens;var type=tokens&&$type(tokens);if(!type||(type=='array'&&!tokens.length)||(type=='hash'&&!tokens.getLength())){(this.options.emptyChoices||this.hideChoices).call(this);}else{if(this.options.maxChoices<tokens.length&&!this.options.overflow)tokens.length=this.options.maxChoices;tokens.each(this.options.injectChoice||function(token){var choice=new Element('li',{'html':this.markQueryValue(token)});choice.inputValue=token;this.addChoiceEvents(choice).inject(this.choices);},this);this.showChoices();}},choiceOver:function(choice,selection){if(!choice||choice==this.selected)return;if(this.selected)this.selected.removeClass('autocompleter-selected');this.selected=choice.addClass('autocompleter-selected');this.fireEvent('onSelect',[this.element,this.selected,selection]);if(!this.selectMode)this.opted=this.element.value;if(!selection)return;this.selectedValue=this.selected.inputValue;if(this.overflown){var coords=this.selected.getCoordinates(this.choices),margin=this.options.overflowMargin,top=this.choices.scrollTop,height=this.choices.offsetHeight,bottom=top+height;if(coords.top-margin<top&&top)this.choices.scrollTop=Math.max(coords.top-margin,0);else if(coords.bottom+margin>bottom)this.choices.scrollTop=Math.min(coords.bottom-height+margin,bottom);}
if(this.selectMode)this.setSelection();},choiceSelect:function(choice){if(choice)this.choiceOver(choice);this.setSelection(true);this.queryValue=false;this.hideChoices();},filter:function(tokens){return(tokens||this.tokens).filter(function(token){return this.test(token);},new RegExp(((this.options.filterSubset)?'':'^')+this.queryValue.escapeRegExp(),(this.options.filterCase)?'':'i'));},markQueryValue:function(str){return(!this.options.markQuery||!this.queryValue)?str:str.replace(new RegExp('('+((this.options.filterSubset)?'':'^')+this.queryValue.escapeRegExp()+')',(this.options.filterCase)?'':'i'),'<span class="autocompleter-queried">$1</span>');},addChoiceEvents:function(el){return el.addEvents({'mouseover':this.choiceOver.bind(this,[el]),'click':this.choiceSelect.bind(this,[el])});}});var OverlayFix=new Class({initialize:function(el){if(Browser.Engine.trident){this.element=$(el);this.relative=this.element.getOffsetParent();this.fix=new Element('iframe',{'frameborder':'0','scrolling':'no','src':'javascript:false;','styles':{'position':'absolute','border':'none','display':'none','filter':'progid:DXImageTransform.Microsoft.Alpha(opacity=0)'}}).inject(this.element,'after');}},show:function(){if(this.fix){var coords=this.element.getCoordinates(this.relative);delete coords.right;delete coords.bottom;this.fix.setStyles($extend(coords,{'display':'','zIndex':(this.element.getStyle('zIndex')||1)-1}));}
return this;},hide:function(){if(this.fix)this.fix.setStyle('display','none');return this;},destroy:function(){if(this.fix)this.fix=this.fix.destroy();}});Element.implement({getSelectedRange:function(){if(!Browser.Engine.trident)return{start:this.selectionStart,end:this.selectionEnd};var pos={start:0,end:0};var range=this.getDocument().selection.createRange();if(!range||range.parentElement()!=this)return pos;var dup=range.duplicate();if(this.type=='text'){pos.start=0-dup.moveStart('character',-100000);pos.end=pos.start+range.text.length;}else{var value=this.value;var offset=value.length-value.match(/[\n\r]*$/)[0].length;dup.moveToElementText(this);dup.setEndPoint('StartToEnd',range);pos.end=offset-dup.text.length;dup.setEndPoint('StartToStart',range);pos.start=offset-dup.text.length;}
return pos;},selectRange:function(start,end){if(Browser.Engine.trident){var diff=this.value.substr(start,end-start).replace(/\r/g,'').length;start=this.value.substr(0,start).replace(/\r/g,'').length;var range=this.createTextRange();range.collapse(true);range.moveEnd('character',start+diff);range.moveStart('character',start);range.select();}else{this.focus();this.setSelectionRange(start,end);}
return this;}});Autocompleter.Base=Autocompleter;Autocompleter.Request=new Class({Extends:Autocompleter,options:{postData:{},ajaxOptions:{},postVar:'value'},query:function(){var data=$unlink(this.options.postData)||{};data[this.options.postVar]=this.queryValue;var indicator=$(this.options.indicator);if(indicator)indicator.setStyle('display','');var cls=this.options.indicatorClass;if(cls)this.element.addClass(cls);this.fireEvent('onRequest',[this.element,this.request,data,this.queryValue]);this.request.send({'data':data});},queryResponse:function(){var indicator=$(this.options.indicator);if(indicator)indicator.setStyle('display','none');var cls=this.options.indicatorClass;if(cls)this.element.removeClass(cls);return this.fireEvent('onComplete',[this.element,this.request]);}});Autocompleter.Request.JSON=new Class({Extends:Autocompleter.Request,initialize:function(el,url,options){this.parent(el,options);this.request=new Request.JSON($merge({'url':url,'link':'cancel'},this.options.ajaxOptions)).addEvent('onComplete',this.queryResponse.bind(this));},queryResponse:function(response){this.parent();this.update(response);}});Autocompleter.Request.HTML=new Class({Extends:Autocompleter.Request,initialize:function(el,url,options){this.parent(el,options);this.request=new Request.HTML($merge({'url':url,'link':'cancel','update':this.choices},this.options.ajaxOptions)).addEvent('onComplete',this.queryResponse.bind(this));},queryResponse:function(tree,elements){this.parent();if(!elements||!elements.length){this.hideChoices();}else{this.choices.getChildren(this.options.choicesMatch).each(this.options.injectChoice||function(choice){var value=choice.innerHTML;choice.inputValue=value;this.addChoiceEvents(choice.set('html',this.markQueryValue(value)));},this);this.showChoices();}}});Autocompleter.Ajax={Base:Autocompleter.Request,Json:Autocompleter.Request.JSON,Xhtml:Autocompleter.Request.HTML};