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;};window.addEvent('domready',function(){var elenco=$('elenco'),eltr=$$('#elenco tr');zoomElenco=new Array();zoomElenco2=new Array();isDefi=new Array();isDefi2=new Array();if(elenco){eltr.each(function(tr,i){tr.addEvent('mouseenter',function(e){e.stop();if(isDefi[i]!=1){zoomElenco[i]=new Fx.Morph('img_'+i,{'link':'chain',duration:200});isDefi[i]=1;}
zoomElenco[i].start({'width':[100]});}.bind(this));tr.addEvent('mouseleave',function(e){e.stop();if(isDefi2[i]!=1){zoomElenco2[i]=new Fx.Morph('img_'+i,{'link':'chain',duration:200});isDefi2[i]=1;}
zoomElenco2[i].start({'width':[85]});}.bind(this));}.bind(this));}
adv_rightbar=$('adv_rightbarx');$$('.banner_close').addEvent('click',function(e){e.stop();adv_rightbar.fade(0);var hBan=new Fx.Morph(adv_rightbar,{duration:800});hBan.start({'height':0,'margin-top':0});(function(){adv_rightbar.setStyle('display','none');}).delay(800);});var selected=$('selected');if(selected){var firstDiv=new Element('div',{id:'backmove'}),secondtDiv=new Element('div',{id:'backmove_left'}),wipag=958;firstDiv.inject('overbox');secondtDiv.inject(firstDiv);var backmove=$('backmove');if(selected.getProperty('class')=='empto'){empto=1;}else{empto=0;}
var sBody=($(document.body).getCoordinates().width-wipag)/2,leftstart=selected.getCoordinates().left;if(empto==1){backmove.fade(0);var widthstart=10;}
else{var widthstart=selected.getCoordinates().width;}
var bgmoveFx=new Fx.Morph(backmove,{duration:800,'link':'cancel','transition':Fx.Transitions.Sine.easeOut});var bgexpandFx=new Fx.Morph('backmove_left',{duration:800,'link':'cancel','transition':Fx.Transitions.Sine.easeOut});if(document.all){bgmoveFx.start({'left':leftstart-sBody+1});}
else{bgmoveFx.start({'left':leftstart-sBody});}
bgexpandFx.start({'width':widthstart});var alf=$$('#alfabetico a');alf.each(function(aaa,i){aaa.addEvent('mouseenter',function(e){e.stop();var sBody=($(document.body).getCoordinates().width-wipag)/2,lcoord=aaa.getCoordinates().left,wcoord=aaa.getCoordinates().width;if(empto==1){backmove.fade(1);}
if(document.all){bgmoveFx.start({'left':lcoord-sBody+1});}
else{bgmoveFx.start({'left':lcoord-sBody});}
bgexpandFx.start({'width':wcoord});}.bind(this));aaa.addEvent('click',function(e){leftstart=aaa.getCoordinates().left;widthstart=aaa.getCoordinates().width;}.bind(this));}.bind(this));$('alfabetico').addEvent('mouseleave',function(e){e.stop();if(empto==1){(function(){backmove.fade(0)}).delay(300);}
if(document.all){bgmoveFx.start({'left':leftstart-sBody+1});}
else{bgmoveFx.start({'left':leftstart-sBody});}
bgexpandFx.start({'width':widthstart});}.bind(this));}
function showFriendMail(){Logy.logyOpen();$('logybox_emailfriend').setStyle('display','block');$('logybox_emailfriend').set('html','<div id="loadimg" style="width: 300px; margin-top: 80px; text-align: center;"><img src="'+rollerx+'" /></div>');var takeEmail=new Request({method:'post',url:pajax});takeEmail.onSuccess=function(responseText,responseXML){$('logybox_emailfriend').set('html',responseText);$('segnal_puls').addEvent('click',function(e){var sendEmail=new Request({method:'post',url:pajax});sendEmail.onSuccess=function(responseText,responseXML){$('logybox_emailfriend').set('html',responseText);$('backmail').addEvent('click',function(e){e.stop();showFriendMail();});}
var linkx=$('linkx').get('value'),titolo=$('titolo').get('value'),piattaforma=$('piattaforma').get('value'),autore=$('autore').get('value'),data=$('data').get('value'),type=$('type').get('value'),friendmail=$('friendmail').get('value'),tuamail=$('tuamail').get('value'),tuonome=$('tuonome').get('value'),friendcomment=$('friendcomment').get('value');$('logybox_emailfriend').set('html','<div id="loadimg" style="width: 300px; margin-top: 80px; text-align: center;"><img src="'+rollerx+'" /></div>');sendEmail.send('modific=15&linkx='+linkx+'&titolo='+titolo+'&piattaforma='+piattaforma+'&autore='+autore+'&data='+data+'&type='+type+'&friendmail='+friendmail+'&tuamail='+tuamail+'&tuonome='+tuonome+'&friendcomment='+friendcomment);});}
var infox=$('aemail').get('rel');takeEmail.send('modific=14&info='+infox);}
if($('aemail')){$('aemail').addEvent('click',function(e){e.stop();showFriendMail();});}
if($('atag')){$('atag').addEvent('click',function(e){e.stop();Logy.logyOpen();$('logybox_tag').setStyle('display','block').set('html','<div id="loadimg" style="width: 300px; margin-top: 80px; text-align: center;"><img src="'+rollerx+'" /></div>');var takeTag=new Request({method:'post',url:pajax});takeTag.onSuccess=function(responseText,responseXML){$('logybox_tag').set('html',responseText);$('tag_puls').addEvent('click',function(e){var sendTag=new Request({method:'post',url:pajax});sendTag.onSuccess=function(responseText,responseXML){$('logybox_tag').set('html',responseText);}
var tags=str_replace('&','#-#',htmlentities($('tags').get('value'))),id=$('id').get('value'),type=$('type').get('value');$('logybox_tag').set('html','<div id="loadimg" style="width: 300px; margin-top: 80px; text-align: center;"><img src="'+rollerx+'" /></div>');sendTag.send('modific=22&tags='+tags+'&id='+id+'&type='+type);});}
var info=$('atag').get('rel');takeTag.send('modific=21&info='+info);});}
$$('.delimg').each(function(del,d){del.fade(0).addEvents({'mouseenter':function(){del.fade(1);}.bind(this),'mouseout':function(){del.fade(0);}.bind(this),'click':function(){if(confirm('Sei sicuro di voler cancellare questa immagine?')){id=del.getParent().get('id').substr(2);d=del.get('id').substr(8+id.length);var senDel=new Request({method:'post',url:pajax});senDel.onSuccess=function(responseText,responseXML){$$('#tab_'+id+' .delimg').each(function(tab,t){dx=tab.get('id').substr(8+id.length);if(dx>d){$('delimg_'+id+'_'+dx).set('id','delimg_'+id+'_'+(dx-1));}});del.getParent().fade(0);(function(){del.getParent().dispose();}).delay(800);$$('#tab_'+id+' .visimg').addEvent('click',function(e){e.stop();alert("Siccome hai cancellato delle immagini, per permetterti di visualizzare le altre verrā aggiornata la pagina.");window.location.href=unescape(window.location.pathname);});}
senDel.send('modific=35&id='+id+'&num='+d);}}});});$$('.visimg').each(function(vis,v){vis.addEvents({'mouseenter':function(){vis.getParent().getParent().getChildren('.delimg').fade(0.5);},'mouseout':function(){vis.getParent().getParent().getChildren('.delimg').fade(0);}});});if($('sgames')){function setRicind(aj,va){theSearch(aj);$('ricerca_index_puls').setProperty("onclick","theSearch('"+aj+"');");$('ricerca_puls').setProperty("onclick","theSearch('"+aj+"');");ritx=$('ricerca_index_txt').get('value');if(ritx=="Cerca videogioco..."||ritx=="Cerca news..."||ritx=="Cerca tags..."||ritx=="Cerca forum..."){$('ricerca_index_txt').set('value','Cerca '+va+'...');}
ritx2=$('ricerca_txt').get('value');if(ritx2=="Cerca videogioco..."||ritx2=="Cerca news..."||ritx2=="Cerca tags..."||ritx2=="Cerca forum..."){$('ricerca_txt').set('value','Cerca '+va+'...');}
$('ricerca_index_txt').setPropertys({"onclick":"if(this.value=='Cerca "+va+"...')this.value='';","onblur":"if(this.value=='')this.value='Cerca "+va+"...';"});$('ricerca_txt').setProperty({"onclick":"if(this.value=='Cerca "+va+"...')this.value='';","onblur":"if(this.value=='')this.value='Cerca "+va+"...';"});$('type_sep').set('html','Ricerca '+va);if((aj=="games"||aj=="tagsg")&&$('box_news_search_center')){$('box_news_search_center').setProperty('id','box_ricerca_center');}
else if($('box_ricerca_center')){$('box_ricerca_center').setProperty('id','box_news_search_center');}}
$('sgames').addEvent('click',function(e){setRicind('games','videogioco');});$('stagsg').addEvent('click',function(e){setRicind('tagsg','tags');});$('stagsn').addEvent('click',function(e){setRicind('tagsn','tags');});$('snews').addEvent('click',function(e){setRicind('news','news');});$('sforum').addEvent('click',function(e){setRicind('forum','forum');});}});wiOpen=new Array();function openDispose(nom){if($('open_'+nom)){wiOpen[nom]=new Fx.Morph('open_'+nom,{duration:1000,transition:Fx.Transitions.Sine.easeOut});$('open_'+nom).fade(0);(function(){wiOpen[nom].start({'width':0,'margin':0});}).delay(400);}}
function openApp(id,type,app){$('resopen_'+id).set('html','<img src="'+rollerx+'" align="center" />');var putApp=new Request({method:'post',url:pajax});putApp.onSuccess=function(responseText,responseXML){openDispose('approva_'+id);openDispose('disapprova_'+id);var putResapp=new Request({method:'post',url:pajax});putResapp.onSuccess=function(responseText2,responseXML){$('resopen_'+id).set('html',responseText);$('open_numgrey_'+id).set('html',responseText2).fade('hide').setStyle('display','block').fade(1);}
putResapp.send('modific=33&id='+id+'&type='+type);}
putApp.send('modific=31&id='+id+'&type='+type+'&app='+app);}
stapprov=0;function appComm(id,app){if(stapprov==0){stapprov=1;$('divapp_'+id).set('html','<img src="'+xsite+'scripts/roller-mini.gif" />');var comApp=new Request({method:'post',url:pajax});comApp.onSuccess=function(responseText,responseXML){$('divapp_'+id).set('html',responseText);stapprov=0;}
comApp.send('modific=31&id='+id+'&type=commento&app='+app);}}
function openMod(id,type){window.location=xsite+'user/creazione/'+type+'/'+id+'/';}
function openCanc(id,type,ne){if(confirm("Sei sicuro di voler cancellare questo articolo? La tua azione sar&agrave; registrata e se inappropriata, perderai molti punti.")){if(ne==0){$('resopen_'+id).set('html','<img src="'+rollerx+'" align="center" />');}
var putApp=new Request({method:'post',url:pajax});putApp.onSuccess=function(responseText,responseXML){if(ne==0){openDispose('approva_'+id);openDispose('disapprova_'+id);openDispose('modifica_'+id);openDispose('cancella_'+id);openDispose('segnala_'+id);$('resopen_'+id).set('html',responseText);}
else{$('liart_'+type+'_'+id).dispose();}}
putApp.send('modific=34&id='+id+'&type='+type);}}
var startSegn=0,initiaSegn=0;function openSegn(id,type,motivo){if(initiaSegn==0){openSegna=new Fx.Morph('open_segnalacase_'+id,{duration:1500,link:'cancel',transition:Fx.Transitions.Quad.easeOut});openSegnins=new Fx.Morph('open_segnalains_'+id,{duration:1500,link:'cancel',transition:Fx.Transitions.Quad.easeOut});initiaSegn=1;}
if(startSegn==0){vase1=140;vase2=31;vase3=36;startSegn=1;}
else{if(motivo==0){vase1=0;vase2=0;vase3=0;startSegn=0;}
else{vase1=32;vase2=31;vase3=36;startSegn=1;}}
openSegna.start({'height':vase1,'margin-top':vase3});openSegnins.start({'height':vase2});if(motivo!=0){$('open_segnalacase_'+id).set('html','<img src="'+rollerx+'" align="center" />');var newAjax=new Request({method:'post',url:pajax});newAjax.onSuccess=function(responseText,responseXML){$('open_segnalacase_'+id).set('html',responseText);openDispose('segnala_'+id);}
newAjax.send('modific=20&id='+id+'&type='+type+'&motivo='+motivo);}}
function addPrefer(id){$('scheda_preferito').set('html','<img src="'+rollerx+'" align="center" />');var newAjax=new Request({method:'post',url:pajax});newAjax.onSuccess=function(responseText,responseXML){$('scheda_preferito').set('html',responseText);}
newAjax.send('modific=1&id='+id);}
function delPrefer(id){if(confirm('Sei sicuro di voler cancellare questo gioco dai tuoi preferiti?')){var elemento=$('divpref'),newAjax=new Request({method:'post',url:pajax});elemento.set('html','<div id="loadimg" style="width: 560px; text-align: center;"><img src="'+rollerx+'" /></div>');newAjax.onSuccess=function(responseText,responseXML){elemento.removeChild($('loadimg')).removeChild($('pref_'+id)).set('html',elemento.get('html')+responseText);}
newAjax.send('modific=4&id='+id);}}
function delAllPrefer(){if(confirm('Sei sicuro di voler cancellare tutti i tuoi preferiti?')){var elemento=$('divpref'),newAjax=new Request({method:'post',url:pajax});elemento.set('html','<div id="loadimg" style="width: 560px; text-align: center;"><img src="'+rollerx+'" /></div>');newAjax.onSuccess=function(responseText,responseXML){elemento.removeChild($('loadimg')).set('html',responseText);$('canctot').setStyle('display','none');}
newAjax.send('modific=5');}}
function addComment(id,id_art,dove,user_id){utente=$('utente').get('value');email=$('email').get('value');commento=$('commento').get('value');var privacy=0;if($('privacy').checked==true){privacy=1;}
message="modific=2&id="+id+"&id_art="+id_art+"&dove="+dove+"&utente="+utente+"&email="+email+"&commento="+escape(commento)+"&privacy="+privacy;if(user_id==0){recaptcha_challenge_field=$('recaptcha_challenge_field').get('value');recaptcha_response_field=$('recaptcha_response_field').get('value');message+="&recaptcha_challenge_field="+recaptcha_challenge_field+"&recaptcha_response_field="+recaptcha_response_field;}
var elemento=$('proxcomm'),newAjax=new Request({method:'post',url:pajax});elemento.set('html','<div id="loadimg" style="width: 630px; text-align: center;"><img src="'+rollerx+'" /></div>');$('commenta').setStyle('display','none');newAjax.onSuccess=function(responseText,responseXML){elemento.removeChild($('loadimg'));if(!$('response')){newel=document.createElement("div");newel.setAttribute("id","response");$('commenti').appendChild(newel);}
else{$('response').setStyle('display','');}
if(responseText.substr(0,2)!="<p"){$('response').set('html','<strong>Il tuo commento &egrave; stato inviato.</strong><br />Grazie per la partecipazione.');elemento.set('html',responseText);}
else{$('response').set('html',responseText+'<br /><br /><a href="javascript: tornComm()">Torna al commento</a>');}}
newAjax.send(message);}
function tornComm(){$('commenta').setStyle('display','');$('response').setStyle('display','none');}
function delComment(id,utente,idutente,mod){if(confirm('Sei sicuro di voler cancellare questo commento?')){var elemento=$('visuacomm'),newAjax=new Request({method:'post',url:pajax});elemento.set('html',elemento.get('html')+'<div id="loadimg" style="width: 630px; text-align: center;"><img src="'+rollerx+'" /></div>');newAjax.onSuccess=function(responseText,responseXML){elemento.removeChild($('loadimg'));$('response').set('html','<a href="javascript: tornComm()">Torna al commento</a>');if(mod==1){$('trfc_'+id).dispose();$('trsc_'+id).dispose();}
else if(mod==2){$('proxcomm').set('html','');}}
newAjax.send('modific=3&id='+id+'&utente='+utente+'&idutente='+idutente);}}
String.prototype.br2nl=function(){var nl;if(typeof arguments[0]!='undefined'){nl=arguments[0];}
else{nl='\r\n';}
return this.replace(/\<br(\s*\/|)\>/g,nl);}
function editComment(id){var commento=$('trsc_'+id),edit=$('edit_'+id);thecomm=commento.get('html');commento.set('html','<textarea id="area_'+id+'" cols="73" rows="3" onchange="sendComment('+id+', this.value)">'+thecomm.replace(/<br\s*\/?>/mg,"\r")+'</textarea>');edit.set('onclick','').set('title','Invia modifica');}
function sendComment(id,commfin){var elemento=$('trsc_'+id);elemento.innerHTML='<div id="loadimg" style="width: 610px; text-align: center;"><img src="'+rollerx+'" /></div>';var sendComm=new Request({method:'post',url:pajax});sendComm.onSuccess=function(responseText,responseXML){$('trsc_'+id).innerHTML=responseText;$('edit_'+id).set('onclick','editComment('+id+')').set('title','Modifica commento');}
sendComm.send("modific=19&id="+id+"&commento="+commfin);}
var stasegn=0;function segnComment(id){if(stasegn==0){stasegn=1;$('divsegn_'+id).set('html',$('divsegn_'+id).get('html')+'<img src="'+xsite+'scripts/roller-mini.gif" />');$('segnal_'+id).setStyle('display','none');var comSegn=new Request({method:'post',url:pajax});comSegn.onSuccess=function(responseText,responseXML){$$('#divsegn_'+id+' img').dispose();$('segnal_'+id).removeClass('ico-segnal').addClass('ico-segnalato').setStyle('display','');stasegn=0;}
comSegn.send('modific=20&id='+id+'&type=commento');}}
function controlloComm(id,id_art,dove,user_id){var cag=new Custom.Alert('<span class="titalert">Gamempire Alert</span>','<b>Attenzione!</b> <br /><br /> <span class="little">Non hai inserito il tuo nickname.</span>',{content:'html',text:{confirmButtonText:'',closeButtonText:''},width:315,height:238,opacify:true,draggable:true,zones:{box:'box4',head:'head4',body:'body4',buttonBox:'buttonBox4'},buttons:{closeButton:'cancelButton4',confirmButton:'confirmButton4'},overlay:'#000'});var f=0;var e=0;var ok=true;var a=$('email');if($('utente').value==''){cag.create();$('utente').focus();return false;}
else if(a.value==''){cag.create();cag.setText('<b>Attenzione!</b> <br /><br /> <span class="little">Non hai inserito l\'email.</span>');$('email').focus();return false;}
else if(a.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/)==-1){cag.create();cag.setText('<b>Attenzione!</b> <br /><br /> <span class="little">L\'email inserita non č valida</span>');$('email').focus();return false;}
else if($('commento').value.length<19){cag.create();cag.setText('<b>Attenzione!</b> <br /><br /> <span class="little">Il commento deve essere composto da almeno 20 caratteri.</span>');$('commento').focus();return false;}
else if($('recaptcha_challenge_field')&&$('recaptcha_response_field').value==''){cag.create();cag.setText('<b>Attenzione!</b> <br /><br /> <span class="little">Non hai inserito il codice di sicurezza</span>');$('commento').focus();return false;}
else{addComment(id,id_art,dove,user_id);}}
var maxc=500;function contatoreComm(){if($('commento').value.length>maxc){$('commento').value=$('commento').value.substring(0,maxc);}
$('sottocomm').set('html','('+(maxc-$('commento').value.length)+' caratteri rimanenti)');}
function theSearch(mode){var elemento=$('search');ricerca_txt=$('ricerca_index_txt').get('value');piatt_se=$('ricerca_index_piatt').get('value');if($('gen_se')){gen_se=$('gen_se').get('value');}
else{gen_se="";}
if(mode=="games"){sez_se=$('ricerca_index_sez').get('value');}
else{sez_se="";}
pagina=1;if(mode+ricerca_txt+piatt_se+sez_se+gen_se+pagina==recode){alert('Non hai cambiato nessun parametro di ricerca');}
else{recode=mode+ricerca_txt+piatt_se+sez_se+gen_se+pagina;if(ricerca_txt=="Cerca videogioco..."||ricerca_txt=="Cerca news..."||ricerca_txt=="Cerca tags..."||ricerca_txt=="Cerca forum..."){ricerca_txt="";}
if(ricerca_txt==""){ricerca_display="Nessun dato immesso";}else{ricerca_display=ricerca_txt;}
elemento.set('html','<div id="loadimg" style="width: 649px; text-align: center; margin: 10px 0px;"><img src="'+rollerx+'" /></div>');switch(mode){case'games':message="modific=8&piatt_se="+piatt_se+"&sez_se="+sez_se+"&gen_se="+gen_se+"&pagina="+pagina+"&statag=0";break;case'news':message="modific=29&piatt_se="+piatt_se+"&statag=0";break;case'tagsg':message="modific=8&piatt_se="+piatt_se+"&statag=1";break;case'tagsn':message="modific=29&piatt_se="+piatt_se+"&statag=1";break;case'forum':message="modific=30&piatt_se="+piatt_se;break;}
message+="&ricerca_txt="+ricerca_txt;var takeSearch=new Request({method:'post',url:pajax});takeSearch.onSuccess=function(responseText,responseXML){if(gen_se!=""){$('tit_ricerca').set('html',gen_se);}
else{$('tit_ricerca').set('html',ricerca_display);}
elemento.set('html',responseText);}
takeSearch.send(message);}}
function textSize(plumin,id){if(id==0){idbox='box';}else{idbox='box_trucchi_center';}
sizeFo=$('box').getStyle('font-size').toInt();if(plumin==0){sizeFo--;}
else if(plumin==1){sizeFo++;}
if(sizeFo>10&&sizeFo<19){$(idbox).setStyle('font-size',sizeFo);}}
function str_replace(search,replace,subject){var f=search,r=replace,s=subject;var ra=r instanceof Array,sa=s instanceof Array,f=[].concat(f),r=[].concat(r),i=(s=[].concat(s)).length;while(j=0,i--){if(s[i]){while(s[i]=s[i].split(f[j]).join(ra?r[j]||"":r[0]),++j in f){};}};return sa?s:s[0];}
function htmlentities(string,quote_style){var histogram={},symbol='',tmp_str='',i=0;tmp_str=string.toString();if(false===(histogram=get_html_translation_table('HTML_ENTITIES',quote_style))){return false;}
for(symbol in histogram){entity=histogram[symbol];tmp_str=tmp_str.split(symbol).join(entity);}
return tmp_str;}
function get_html_translation_table(table,quote_style){var entities={},histogram={},decimal=0,symbol='';var constMappingTable={},constMappingQuoteStyle={};var useTable={},useQuoteStyle={};useTable=(table?table.toUpperCase():'HTML_SPECIALCHARS');useQuoteStyle=(quote_style?quote_style.toUpperCase():'ENT_COMPAT');constMappingTable[0]='HTML_SPECIALCHARS';constMappingTable[1]='HTML_ENTITIES';constMappingQuoteStyle[0]='ENT_NOQUOTES';constMappingQuoteStyle[2]='ENT_COMPAT';constMappingQuoteStyle[3]='ENT_QUOTES';if(!isNaN(useTable)){useTable=constMappingTable[useTable];}
if(!isNaN(useQuoteStyle)){useQuoteStyle=constMappingQuoteStyle[useQuoteStyle];}
if(useTable=='HTML_SPECIALCHARS'){entities['60']='&lt;';entities['62']='&gt;';entities['38']='&amp;';}else if(useTable=='HTML_ENTITIES'){entities['38']='&amp;';entities['60']='&lt;';entities['62']='&gt;';entities['160']='&nbsp;';entities['161']='&iexcl;';entities['162']='&cent;';entities['163']='&pound;';entities['164']='&curren;';entities['165']='&yen;';entities['166']='&brvbar;';entities['167']='&sect;';entities['168']='&uml;';entities['169']='&copy;';entities['170']='&ordf;';entities['171']='&laquo;';entities['172']='&not;';entities['173']='&shy;';entities['174']='&reg;';entities['175']='&macr;';entities['176']='&deg;';entities['177']='&plusmn;';entities['178']='&sup2;';entities['179']='&sup3;';entities['180']='&acute;';entities['181']='&micro;';entities['182']='&para;';entities['183']='&middot;';entities['184']='&cedil;';entities['185']='&sup1;';entities['186']='&ordm;';entities['187']='&raquo;';entities['188']='&frac14;';entities['189']='&frac12;';entities['190']='&frac34;';entities['191']='&iquest;';entities['192']='&Agrave;';entities['193']='&Aacute;';entities['194']='&Acirc;';entities['195']='&Atilde;';entities['196']='&Auml;';entities['197']='&Aring;';entities['198']='&AElig;';entities['199']='&Ccedil;';entities['200']='&Egrave;';entities['201']='&Eacute;';entities['202']='&Ecirc;';entities['203']='&Euml;';entities['204']='&Igrave;';entities['205']='&Iacute;';entities['206']='&Icirc;';entities['207']='&Iuml;';entities['208']='&ETH;';entities['209']='&Ntilde;';entities['210']='&Ograve;';entities['211']='&Oacute;';entities['212']='&Ocirc;';entities['213']='&Otilde;';entities['214']='&Ouml;';entities['215']='&times;';entities['216']='&Oslash;';entities['217']='&Ugrave;';entities['218']='&Uacute;';entities['219']='&Ucirc;';entities['220']='&Uuml;';entities['221']='&Yacute;';entities['222']='&THORN;';entities['223']='&szlig;';entities['224']='&agrave;';entities['225']='&aacute;';entities['226']='&acirc;';entities['227']='&atilde;';entities['228']='&auml;';entities['229']='&aring;';entities['230']='&aelig;';entities['231']='&ccedil;';entities['232']='&egrave;';entities['233']='&eacute;';entities['234']='&ecirc;';entities['235']='&euml;';entities['236']='&igrave;';entities['237']='&iacute;';entities['238']='&icirc;';entities['239']='&iuml;';entities['240']='&eth;';entities['241']='&ntilde;';entities['242']='&ograve;';entities['243']='&oacute;';entities['244']='&ocirc;';entities['245']='&otilde;';entities['246']='&ouml;';entities['247']='&divide;';entities['248']='&oslash;';entities['249']='&ugrave;';entities['250']='&uacute;';entities['251']='&ucirc;';entities['252']='&uuml;';entities['253']='&yacute;';entities['254']='&thorn;';entities['255']='&yuml;';}else{throw Error("Table: "+useTable+' not supported');return false;}
if(useQuoteStyle!='ENT_NOQUOTES'){entities['34']='&quot;';}
if(useQuoteStyle=='ENT_QUOTES'){entities['39']='&#039;';}
for(decimal in entities){symbol=String.fromCharCode(decimal)
histogram[symbol]=entities[decimal];}
return histogram;};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};