
var translations=new Array();translations['Score']='Score';translations['Added']='Added';translations['Played']='Played';translations['gameURL']='game';translations['searchURL']='search';translations['mygamesURL']='mygames';translations['defectURL']='defect';translations['mailafriendURL']='mailafriend';translations['reportbrokenURL']='reportbroken';translations['highscoresURL']='highscores';translations['contactURL']='contact';translations['voteURL']='vote';translations['newsletterURL']='newsletter';translations['reactionURL']='reaction';translations['challengeURL']='challenge';translations['enqueteURL']='enquete';translations['previous']='previous';translations['next']='next';translations['go to my games']='go to my games';translations['search game']='search game';translations['No games are saved in \'my games\'.']='No games are saved in \'my games\'.';translations['No space is left to save another game.<br/>First delete a game from the list.']='No space is left to save another game.<br/>First delete a game from the list.';translations['Game saved']='Game saved';translations['bad']='bad';translations['moderate']='moderate';translations['reasonable']='reasonable';translations['good']='good';translations['very good']='very good';translations['You rated this game']='You rated this game';translations['You didn\'t vote yet']='You didn\'t vote yet';translations['A wrong mail address is given!']='A wrong mail address is given!';translations['Game is loaded. Click here to start the game.']='Game is loaded. Click here to start the game.';translations['Step 1']='Step 1';translations['Step 2']='Step 2';translations['Step 3']='Step 3';translations['Click the download button below:']='Click the download button below:';translations['Click the yellow bar in the top of the screen and select "Download".']='Click the yellow bar in the top of the screen and select \"Download\".';translations['Select "Save" in the bottom bar.']='Select \"Save\" in the bottom bar.';translations['Click "Save" and select a location to store the file.']='Click \"Save\" and select a location to store the file.';translations['Choose \'Run\' and follow the onscreen instructions for the installation.']='Choose \'Run\' and follow the onscreen instructions for the installation.';translations['Open the downloaded file and follow the onscreen instructions for the installation.']='Open the downloaded file and follow the onscreen instructions for the installation.';translations['Show all results']='Show all results';translations['Show more results']='Show more results';translations['Show less results']='Show less results';translations['staticURL']='http://static.funnygames.eu/';translations['domainExtension']='eu';var MooTools={'version':'1.2.0','build':''};var Native=function(options){options=options||{};var afterImplement=options.afterImplement||function(){};var generics=options.generics;generics=(generics!==false);var legacy=options.legacy;var initialize=options.initialize;var protect=options.protect;var name=options.name;var object=initialize||legacy;object.constructor=Native;object.$family={name:'native'};if(legacy&&initialize)object.prototype=legacy.prototype;object.prototype.constructor=object;if(name){var family=name.toLowerCase();object.prototype.$family={name:family};Native.typize(object,family);}
var add=function(obj,name,method,force){if(!protect||force||!obj.prototype[name])obj.prototype[name]=method;if(generics)Native.genericize(obj,name,protect);afterImplement.call(obj,name,method);return obj;};object.implement=function(a1,a2,a3){if(typeof a1=='string')return add(this,a1,a2,a3);for(var p in a1)add(this,p,a1[p],a2);return this;};object.alias=function(a1,a2,a3){if(typeof a1=='string'){a1=this.prototype[a1];if(a1)add(this,a2,a1,a3);}else{for(var a in a1)this.alias(a,a1[a],a2);}
return this;};return object;};Native.implement=function(objects,properties){for(var i=0,l=objects.length;i<l;i++)objects[i].implement(properties);};Native.genericize=function(object,property,check){if((!check||!object[property])&&typeof object.prototype[property]=='function')object[property]=function(){var args=Array.prototype.slice.call(arguments);return object.prototype[property].apply(args.shift(),args);};};Native.typize=function(object,family){if(!object.type)object.type=function(item){return($type(item)===family);};};Native.alias=function(objects,a1,a2,a3){for(var i=0,j=objects.length;i<j;i++)objects[i].alias(a1,a2,a3);};(function(objects){for(var name in objects)Native.typize(objects[name],name);})({'boolean':Boolean,'native':Native,'object':Object});(function(objects){for(var name in objects)new Native({name:name,initialize:objects[name],protect:true});})({'String':String,'Function':Function,'Number':Number,'Array':Array,'RegExp':RegExp,'Date':Date});(function(object,methods){for(var i=methods.length;i--;i)Native.genericize(object,methods[i],true);return arguments.callee;})
(Array,['pop','push','reverse','shift','sort','splice','unshift','concat','join','slice','toString','valueOf','indexOf','lastIndexOf'])
(String,['charAt','charCodeAt','concat','indexOf','lastIndexOf','match','replace','search','slice','split','substr','substring','toLowerCase','toUpperCase','valueOf']);function $chk(obj){return!!(obj||obj===0);};function $clear(timer){clearTimeout(timer);clearInterval(timer);return null;};function $defined(obj){return(obj!=undefined);};function $empty(){};function $arguments(i){return function(){return arguments[i];};};function $lambda(value){return(typeof value=='function')?value:function(){return value;};};function $extend(original,extended){for(var key in(extended||{}))original[key]=extended[key];return original;};function $unlink(object){var unlinked;switch($type(object)){case'object':unlinked={};for(var p in object)unlinked[p]=$unlink(object[p]);break;case'hash':unlinked=$unlink(object.getClean());break;case'array':unlinked=[];for(var i=0,l=object.length;i<l;i++)unlinked[i]=$unlink(object[i]);break;default:return object;}
return unlinked;};function $merge(){var mix={};for(var i=0,l=arguments.length;i<l;i++){var object=arguments[i];if($type(object)!='object')continue;for(var key in object){var op=object[key],mp=mix[key];mix[key]=(mp&&$type(op)=='object'&&$type(mp)=='object')?$merge(mp,op):$unlink(op);}}
return mix;};function $pick(){for(var i=0,l=arguments.length;i<l;i++){if(arguments[i]!=undefined)return arguments[i];}
return null;};function $random(min,max){return Math.floor(Math.random()*(max-min+1)+min);};function $splat(obj){var type=$type(obj);return(type)?((type!='array'&&type!='arguments')?[obj]:obj):[];};var $time=Date.now||function(){return new Date().getTime();};function $try(){for(var i=0,l=arguments.length;i<l;i++){try{return arguments[i]();}catch(e){}}
return null;};function $type(obj){if(obj==undefined)return false;if(obj.$family)return(obj.$family.name=='number'&&!isFinite(obj))?false:obj.$family.name;if(obj.nodeName){switch(obj.nodeType){case 1:return'element';case 3:return(/\S/).test(obj.nodeValue)?'textnode':'whitespace';}}else if(typeof obj.length=='number'){if(obj.callee)return'arguments';else if(obj.item)return'collection';}
return typeof obj;};var Hash=new Native({name:'Hash',initialize:function(object){if($type(object)=='hash')object=$unlink(object.getClean());for(var key in object)this[key]=object[key];return this;}});Hash.implement({getLength:function(){var length=0;for(var key in this){if(this.hasOwnProperty(key))length++;}
return length;},forEach:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key))fn.call(bind,this[key],key,this);}},getClean:function(){var clean={};for(var key in this){if(this.hasOwnProperty(key))clean[key]=this[key];}
return clean;}});Hash.alias('forEach','each');function $H(object){return new Hash(object);};Array.implement({forEach:function(fn,bind){for(var i=0,l=this.length;i<l;i++)fn.call(bind,this[i],i,this);}});Array.alias('forEach','each');function $A(iterable){if(iterable.item){var array=[];for(var i=0,l=iterable.length;i<l;i++)array[i]=iterable[i];return array;}
return Array.prototype.slice.call(iterable);};function $each(iterable,fn,bind){var type=$type(iterable);((type=='arguments'||type=='collection'||type=='array')?Array:Hash).each(iterable,fn,bind);};var Browser=new Hash({Engine:{name:'unknown',version:''},Platform:{name:(navigator.platform.match(/mac|win|linux/i)||['other'])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime)},Plugins:{}});if(window.opera)Browser.Engine={name:'presto',version:(document.getElementsByClassName)?950:925};else if(window.ActiveXObject)Browser.Engine={name:'trident',version:(window.XMLHttpRequest)?5:4};else if(!navigator.taintEnabled)Browser.Engine={name:'webkit',version:(Browser.Features.xpath)?420:419};else if(document.getBoxObjectFor!=null)Browser.Engine={name:'gecko',version:(document.getElementsByClassName)?19:18};Browser.Engine[Browser.Engine.name]=Browser.Engine[Browser.Engine.name+Browser.Engine.version]=true;if(window.orientation!=undefined)Browser.Platform.name='ipod';Browser.Platform[Browser.Platform.name]=true;Browser.Request=function(){return $try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject('MSXML2.XMLHTTP');});};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var version=($try(function(){return navigator.plugins['Shockwave Flash'].description;},function(){return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');})||'0 r0').match(/\d+/g);return{version:parseInt(version[0]||0+'.'+version[1]||0),build:parseInt(version[2]||0)};})();function $exec(text){if(!text)return text;if(window.execScript){window.execScript(text);}else{var script=document.createElement('script');script.setAttribute('type','text/javascript');script.text=text;document.head.appendChild(script);document.head.removeChild(script);}
return text;};Native.UID=1;var $uid=(Browser.Engine.trident)?function(item){return(item.uid||(item.uid=[Native.UID++]))[0];}:function(item){return item.uid||(item.uid=Native.UID++);};var Window=new Native({name:'Window',legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(win){$uid(win);if(!win.Element){win.Element=$empty;if(Browser.Engine.webkit)win.document.createElement("iframe");win.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{};}
return $extend(win,Window.Prototype);},afterImplement:function(property,value){window[property]=Window.Prototype[property]=value;}});Window.Prototype={$family:{name:'window'}};new Window(window);var Document=new Native({name:'Document',legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(doc){$uid(doc);doc.head=doc.getElementsByTagName('head')[0];doc.html=doc.getElementsByTagName('html')[0];doc.window=doc.defaultView||doc.parentWindow;if(Browser.Engine.trident4)$try(function(){doc.execCommand("BackgroundImageCache",false,true);});return $extend(doc,Document.Prototype);},afterImplement:function(property,value){document[property]=Document.Prototype[property]=value;}});Document.Prototype={$family:{name:'document'}};new Document(document);Array.implement({every:function(fn,bind){for(var i=0,l=this.length;i<l;i++){if(!fn.call(bind,this[i],i,this))return false;}
return true;},filter:function(fn,bind){var results=[];for(var i=0,l=this.length;i<l;i++){if(fn.call(bind,this[i],i,this))results.push(this[i]);}
return results;},clean:function(){return this.filter($defined);},indexOf:function(item,from){var len=this.length;for(var i=(from<0)?Math.max(0,len+from):from||0;i<len;i++){if(this[i]===item)return i;}
return-1;},map:function(fn,bind){var results=[];for(var i=0,l=this.length;i<l;i++)results[i]=fn.call(bind,this[i],i,this);return results;},some:function(fn,bind){for(var i=0,l=this.length;i<l;i++){if(fn.call(bind,this[i],i,this))return true;}
return false;},associate:function(keys){var obj={},length=Math.min(this.length,keys.length);for(var i=0;i<length;i++)obj[keys[i]]=this[i];return obj;},link:function(object){var result={};for(var i=0,l=this.length;i<l;i++){for(var key in object){if(object[key](this[i])){result[key]=this[i];delete object[key];break;}}}
return result;},contains:function(item,from){return this.indexOf(item,from)!=-1;},extend:function(array){for(var i=0,j=array.length;i<j;i++)this.push(array[i]);return this;},getLast:function(){return(this.length)?this[this.length-1]:null;},getRandom:function(){return(this.length)?this[$random(0,this.length-1)]:null;},include:function(item){if(!this.contains(item))this.push(item);return this;},combine:function(array){for(var i=0,l=array.length;i<l;i++)this.include(array[i]);return this;},erase:function(item){for(var i=this.length;i--;i){if(this[i]===item)this.splice(i,1);}
return this;},empty:function(){this.length=0;return this;},flatten:function(){var array=[];for(var i=0,l=this.length;i<l;i++){var type=$type(this[i]);if(!type)continue;array=array.concat((type=='array'||type=='collection'||type=='arguments')?Array.flatten(this[i]):this[i]);}
return array;},hexToRgb:function(array){if(this.length!=3)return null;var rgb=this.map(function(value){if(value.length==1)value+=value;return value.toInt(16);});return(array)?rgb:'rgb('+rgb+')';},rgbToHex:function(array){if(this.length<3)return null;if(this.length==4&&this[3]==0&&!array)return'transparent';var hex=[];for(var i=0;i<3;i++){var bit=(this[i]-0).toString(16);hex.push((bit.length==1)?'0'+bit:bit);}
return(array)?hex:'#'+hex.join('');}});Function.implement({extend:function(properties){for(var property in properties)this[property]=properties[property];return this;},create:function(options){var self=this;options=options||{};return function(event){var args=options.arguments;args=(args!=undefined)?$splat(args):Array.slice(arguments,(options.event)?1:0);if(options.event)args=[event||window.event].extend(args);var returns=function(){return self.apply(options.bind||null,args);};if(options.delay)return setTimeout(returns,options.delay);if(options.periodical)return setInterval(returns,options.periodical);if(options.attempt)return $try(returns);return returns();};},pass:function(args,bind){return this.create({arguments:args,bind:bind});},attempt:function(args,bind){return this.create({arguments:args,bind:bind,attempt:true})();},bind:function(bind,args){return this.create({bind:bind,arguments:args});},bindWithEvent:function(bind,args){return this.create({bind:bind,event:true,arguments:args});},delay:function(delay,bind,args){return this.create({delay:delay,bind:bind,arguments:args})();},periodical:function(interval,bind,args){return this.create({periodical:interval,bind:bind,arguments:args})();},run:function(args,bind){return this.apply(bind,$splat(args));}});Number.implement({limit:function(min,max){return Math.min(max,Math.max(min,this));},round:function(precision){precision=Math.pow(10,precision||0);return Math.round(this*precision)/precision;},times:function(fn,bind){for(var i=0;i<this;i++)fn.call(bind,i,this);},toFloat:function(){return parseFloat(this);},toInt:function(base){return parseInt(this,base||10);}});Number.alias('times','each');(function(math){var methods={};math.each(function(name){if(!Number[name])methods[name]=function(){return Math[name].apply(null,[this].concat($A(arguments)));};});Number.implement(methods);})(['abs','acos','asin','atan','atan2','ceil','cos','exp','floor','log','max','min','pow','sin','sqrt','tan']);String.implement({test:function(regex,params){return((typeof regex=='string')?new RegExp(regex,params):regex).test(this);},contains:function(string,separator){return(separator)?(separator+this+separator).indexOf(separator+string+separator)>-1:this.indexOf(string)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,'');},clean:function(){return this.replace(/\s+/g,' ').trim();},camelCase:function(){return this.replace(/-\D/g,function(match){return match.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(match){return('-'+match.charAt(0).toLowerCase());});},capitalize:function(){return this.replace(/\b[a-z]/g,function(match){return match.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,'\\$1');},toInt:function(base){return parseInt(this,base||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(array){var hex=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(hex)?hex.slice(1).hexToRgb(array):null;},rgbToHex:function(array){var rgb=this.match(/\d{1,3}/g);return(rgb)?rgb.rgbToHex(array):null;},stripScripts:function(option){var scripts='';var text=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){scripts+=arguments[1]+'\n';return'';});if(option===true)$exec(scripts);else if($type(option)=='function')option(scripts,text);return text;},substitute:function(object,regexp){return this.replace(regexp||(/\\?\{([^}]+)\}/g),function(match,name){if(match.charAt(0)=='\\')return match.slice(1);return(object[name]!=undefined)?object[name]:'';});}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(value){for(var key in this){if(this.hasOwnProperty(key)&&this[key]===value)return key;}
return null;},hasValue:function(value){return(Hash.keyOf(this,value)!==null);},extend:function(properties){Hash.each(properties,function(value,key){Hash.set(this,key,value);},this);return this;},combine:function(properties){Hash.each(properties,function(value,key){Hash.include(this,key,value);},this);return this;},erase:function(key){if(this.hasOwnProperty(key))delete this[key];return this;},get:function(key){return(this.hasOwnProperty(key))?this[key]:null;},set:function(key,value){if(!this[key]||this.hasOwnProperty(key))this[key]=value;return this;},empty:function(){Hash.each(this,function(value,key){delete this[key];},this);return this;},include:function(key,value){var k=this[key];if(k==undefined)this[key]=value;return this;},map:function(fn,bind){var results=new Hash;Hash.each(this,function(value,key){results.set(key,fn.call(bind,value,key,this));},this);return results;},filter:function(fn,bind){var results=new Hash;Hash.each(this,function(value,key){if(fn.call(bind,value,key,this))results.set(key,value);},this);return results;},every:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key)&&!fn.call(bind,this[key],key))return false;}
return true;},some:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key)&&fn.call(bind,this[key],key))return true;}
return false;},getKeys:function(){var keys=[];Hash.each(this,function(value,key){keys.push(key);});return keys;},getValues:function(){var values=[];Hash.each(this,function(value){values.push(value);});return values;},toQueryString:function(base){var queryString=[];Hash.each(this,function(value,key){if(base)key=base+'['+key+']';var result;switch($type(value)){case'object':result=Hash.toQueryString(value,key);break;case'array':var qs={};value.each(function(val,i){qs[i]=val;});result=Hash.toQueryString(qs,key);break;default:result=key+'='+encodeURIComponent(value);}
if(value!=undefined)queryString.push(result);});return queryString.join('&');}});Hash.alias({keyOf:'indexOf',hasValue:'contains'});var Event=new Native({name:'Event',initialize:function(event,win){win=win||window;var doc=win.document;event=event||win.event;if(event.$extended)return event;this.$extended=true;var type=event.type;var target=event.target||event.srcElement;while(target&&target.nodeType==3)target=target.parentNode;if(type.test(/key/)){var code=event.which||event.keyCode;var key=Event.Keys.keyOf(code);if(type=='keydown'){var fKey=code-111;if(fKey>0&&fKey<13)key='f'+fKey;}
key=key||String.fromCharCode(code).toLowerCase();}else if(type.match(/(click|mouse|menu)/i)){doc=(!doc.compatMode||doc.compatMode=='CSS1Compat')?doc.html:doc.body;var page={x:event.pageX||event.clientX+doc.scrollLeft,y:event.pageY||event.clientY+doc.scrollTop};var client={x:(event.pageX)?event.pageX-win.pageXOffset:event.clientX,y:(event.pageY)?event.pageY-win.pageYOffset:event.clientY};if(type.match(/DOMMouseScroll|mousewheel/)){var wheel=(event.wheelDelta)?event.wheelDelta/120:-(event.detail||0)/3;}
var rightClick=(event.which==3)||(event.button==2);var related=null;if(type.match(/over|out/)){switch(type){case'mouseover':related=event.relatedTarget||event.fromElement;break;case'mouseout':related=event.relatedTarget||event.toElement;}
if(!(function(){while(related&&related.nodeType==3)related=related.parentNode;return true;}).create({attempt:Browser.Engine.gecko})())related=false;}}
return $extend(this,{event:event,type:type,page:page,client:client,rightClick:rightClick,wheel:wheel,relatedTarget:related,target:target,code:code,key:key,shift:event.shiftKey,control:event.ctrlKey,alt:event.altKey,meta:event.metaKey});}});Event.Keys=new Hash({'enter':13,'up':38,'down':40,'left':37,'right':39,'esc':27,'space':32,'backspace':8,'tab':9,'delete':46});Event.implement({stop:function(){return this.stopPropagation().preventDefault();},stopPropagation:function(){if(this.event.stopPropagation)this.event.stopPropagation();else this.event.cancelBubble=true;return this;},preventDefault:function(){if(this.event.preventDefault)this.event.preventDefault();else this.event.returnValue=false;return this;}});var Class=new Native({name:'Class',initialize:function(properties){properties=properties||{};var klass=function(empty){for(var key in this)this[key]=$unlink(this[key]);for(var mutator in Class.Mutators){if(!this[mutator])continue;Class.Mutators[mutator](this,this[mutator]);delete this[mutator];}
this.constructor=klass;if(empty===$empty)return this;var self=(this.initialize)?this.initialize.apply(this,arguments):this;if(this.options&&this.options.initialize)this.options.initialize.call(this);return self;};$extend(klass,this);klass.constructor=Class;klass.prototype=properties;return klass;}});Class.implement({implement:function(){Class.Mutators.Implements(this.prototype,Array.slice(arguments));return this;}});Class.Mutators={Implements:function(self,klasses){$splat(klasses).each(function(klass){$extend(self,($type(klass)=='class')?new klass($empty):klass);});},Extends:function(self,klass){var instance=new klass($empty);delete instance.parent;delete instance.parentOf;for(var key in instance){var current=self[key],previous=instance[key];if(current==undefined){self[key]=previous;continue;}
var ctype=$type(current),ptype=$type(previous);if(ctype!=ptype)continue;switch(ctype){case'function':if(!arguments.callee.caller)self[key]=eval('('+String(current).replace(/\bthis\.parent\(\s*(\))?/g,function(full,close){return'arguments.callee._parent_.call(this'+(close||', ');})+')');self[key]._parent_=previous;break;case'object':self[key]=$merge(previous,current);}}
self.parent=function(){return arguments.callee.caller._parent_.apply(this,arguments);};self.parentOf=function(descendant){return descendant._parent_.apply(this,Array.slice(arguments,1));};}};var Chain=new Class({chain:function(){this.$chain=(this.$chain||[]).extend(arguments);return this;},callChain:function(){return(this.$chain&&this.$chain.length)?this.$chain.shift().apply(this,arguments):false;},clearChain:function(){if(this.$chain)this.$chain.empty();return this;}});var Events=new Class({addEvent:function(type,fn,internal){type=Events.removeOn(type);if(fn!=$empty){this.$events=this.$events||{};this.$events[type]=this.$events[type]||[];this.$events[type].include(fn);if(internal)fn.internal=true;}
return this;},addEvents:function(events){for(var type in events)this.addEvent(type,events[type]);return this;},fireEvent:function(type,args,delay){type=Events.removeOn(type);if(!this.$events||!this.$events[type])return this;this.$events[type].each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);return this;},removeEvent:function(type,fn){type=Events.removeOn(type);if(!this.$events||!this.$events[type])return this;if(!fn.internal)this.$events[type].erase(fn);return this;},removeEvents:function(type){for(var e in this.$events){if(type&&type!=e)continue;var fns=this.$events[e];for(var i=fns.length;i--;i)this.removeEvent(e,fns[i]);}
return this;}});Events.removeOn=function(string){return string.replace(/^on([A-Z])/,function(full,first){return first.toLowerCase();});};var Options=new Class({setOptions:function(){this.options=$merge.run([this.options].extend(arguments));if(!this.addEvent)return this;for(var option in this.options){if($type(this.options[option])!='function'||!(/^on[A-Z]/).test(option))continue;this.addEvent(option,this.options[option]);delete this.options[option];}
return this;}});Document.implement({newElement:function(tag,props){if(Browser.Engine.trident&&props){['name','type','checked'].each(function(attribute){if(!props[attribute])return;tag+=' '+attribute+'="'+props[attribute]+'"';if(attribute!='checked')delete props[attribute];});tag='<'+tag+'>';}
return $.element(this.createElement(tag)).set(props);},newTextNode:function(text){return this.createTextNode(text);},getDocument:function(){return this;},getWindow:function(){return this.defaultView||this.parentWindow;},purge:function(){var elements=this.getElementsByTagName('*');for(var i=0,l=elements.length;i<l;i++)Browser.freeMem(elements[i]);}});var Element=new Native({name:'Element',legacy:window.Element,initialize:function(tag,props){var konstructor=Element.Constructors.get(tag);if(konstructor)return konstructor(props);if(typeof tag=='string')return document.newElement(tag,props);return $(tag).set(props);},afterImplement:function(key,value){if(!Array[key])Elements.implement(key,Elements.multi(key));Element.Prototype[key]=value;}});Element.Prototype={$family:{name:'element'}};Element.Constructors=new Hash;var IFrame=new Native({name:'IFrame',generics:false,initialize:function(){var params=Array.link(arguments,{properties:Object.type,iframe:$defined});var props=params.properties||{};var iframe=$(params.iframe)||false;var onload=props.onload||$empty;delete props.onload;props.id=props.name=$pick(props.id,props.name,iframe.id,iframe.name,'IFrame_'+$time());iframe=new Element(iframe||'iframe',props);var onFrameLoad=function(){var host=$try(function(){return iframe.contentWindow.location.host;});if(host&&host==window.location.host){var win=new Window(iframe.contentWindow);var doc=new Document(iframe.contentWindow.document);$extend(win.Element.prototype,Element.Prototype);}
onload.call(iframe.contentWindow,iframe.contentWindow.document);};(!window.frames[props.id])?iframe.addListener('load',onFrameLoad):onFrameLoad();return iframe;}});var Elements=new Native({initialize:function(elements,options){options=$extend({ddup:true,cash:true},options);elements=elements||[];if(options.ddup||options.cash){var uniques={},returned=[];for(var i=0,l=elements.length;i<l;i++){var el=$.element(elements[i],!options.cash);if(options.ddup){if(uniques[el.uid])continue;uniques[el.uid]=true;}
returned.push(el);}
elements=returned;}
return(options.cash)?$extend(elements,this):elements;}});Elements.implement({filter:function(filter,bind){if(!filter)return this;return new Elements(Array.filter(this,(typeof filter=='string')?function(item){return item.match(filter);}:filter,bind));}});Elements.multi=function(property){return function(){var items=[];var elements=true;for(var i=0,j=this.length;i<j;i++){var returns=this[i][property].apply(this[i],arguments);items.push(returns);if(elements)elements=($type(returns)=='element');}
return(elements)?new Elements(items):items;};};Window.implement({$:function(el,nocash){if(el&&el.$family&&el.uid)return el;var type=$type(el);return($[type])?$[type](el,nocash,this.document):null;},$$:function(selector){if(arguments.length==1&&typeof selector=='string')return this.document.getElements(selector);var elements=[];var args=Array.flatten(arguments);for(var i=0,l=args.length;i<l;i++){var item=args[i];switch($type(item)){case'element':item=[item];break;case'string':item=this.document.getElements(item,true);break;default:item=false;}
if(item)elements.extend(item);}
return new Elements(elements);},getDocument:function(){return this.document;},getWindow:function(){return this;}});$.string=function(id,nocash,doc){id=doc.getElementById(id);return(id)?$.element(id,nocash):null;};$.element=function(el,nocash){$uid(el);if(!nocash&&!el.$family&&!(/^object|embed$/i).test(el.tagName)){var proto=Element.Prototype;for(var p in proto)el[p]=proto[p];};return el;};$.object=function(obj,nocash,doc){if(obj.toElement)return $.element(obj.toElement(doc),nocash);return null;};$.textnode=$.whitespace=$.window=$.document=$arguments(0);Native.implement([Element,Document],{getElement:function(selector,nocash){return $(this.getElements(selector,true)[0]||null,nocash);},getElements:function(tags,nocash){tags=tags.split(',');var elements=[];var ddup=(tags.length>1);tags.each(function(tag){var partial=this.getElementsByTagName(tag.trim());(ddup)?elements.extend(partial):elements=partial;},this);return new Elements(elements,{ddup:ddup,cash:!nocash});}});Element.Storage={get:function(uid){return(this[uid]||(this[uid]={}));}};Element.Inserters=new Hash({before:function(context,element){if(element.parentNode)element.parentNode.insertBefore(context,element);},after:function(context,element){if(!element.parentNode)return;var next=element.nextSibling;(next)?element.parentNode.insertBefore(context,next):element.parentNode.appendChild(context);},bottom:function(context,element){element.appendChild(context);},top:function(context,element){var first=element.firstChild;(first)?element.insertBefore(context,first):element.appendChild(context);}});Element.Inserters.inside=Element.Inserters.bottom;Element.Inserters.each(function(value,key){var Key=key.capitalize();Element.implement('inject'+Key,function(el){value(this,$(el,true));return this;});Element.implement('grab'+Key,function(el){value($(el,true),this);return this;});});Element.implement({getDocument:function(){return this.ownerDocument;},getWindow:function(){return this.ownerDocument.getWindow();},getElementById:function(id,nocash){var el=this.ownerDocument.getElementById(id);if(!el)return null;for(var parent=el.parentNode;parent!=this;parent=parent.parentNode){if(!parent)return null;}
return $.element(el,nocash);},set:function(prop,value){switch($type(prop)){case'object':for(var p in prop)this.set(p,prop[p]);break;case'string':var property=Element.Properties.get(prop);(property&&property.set)?property.set.apply(this,Array.slice(arguments,1)):this.setProperty(prop,value);}
return this;},get:function(prop){var property=Element.Properties.get(prop);return(property&&property.get)?property.get.apply(this,Array.slice(arguments,1)):this.getProperty(prop);},erase:function(prop){var property=Element.Properties.get(prop);(property&&property.erase)?property.erase.apply(this,Array.slice(arguments,1)):this.removeProperty(prop);return this;},match:function(tag){return(!tag||Element.get(this,'tag')==tag);},inject:function(el,where){Element.Inserters.get(where||'bottom')(this,$(el,true));return this;},wraps:function(el,where){el=$(el,true);return this.replaces(el).grab(el,where);},grab:function(el,where){Element.Inserters.get(where||'bottom')($(el,true),this);return this;},appendText:function(text,where){return this.grab(this.getDocument().newTextNode(text),where);},adopt:function(){Array.flatten(arguments).each(function(element){element=$(element,true);if(element)this.appendChild(element);},this);return this;},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this;},clone:function(contents,keepid){switch($type(this)){case'element':var attributes={};for(var j=0,l=this.attributes.length;j<l;j++){var attribute=this.attributes[j],key=attribute.nodeName.toLowerCase();if(Browser.Engine.trident&&(/input/i).test(this.tagName)&&(/width|height/).test(key))continue;var value=(key=='style'&&this.style)?this.style.cssText:attribute.nodeValue;if(!$chk(value)||key=='uid'||(key=='id'&&!keepid))continue;if(value!='inherit'&&['string','number'].contains($type(value)))attributes[key]=value;}
var element=new Element(this.nodeName.toLowerCase(),attributes);if(contents!==false){for(var i=0,k=this.childNodes.length;i<k;i++){var child=Element.clone(this.childNodes[i],true,keepid);if(child)element.grab(child);}}
return element;case'textnode':return document.newTextNode(this.nodeValue);}
return null;},replaces:function(el){el=$(el,true);el.parentNode.replaceChild(this,el);return this;},hasClass:function(className){return this.className.contains(className,' ');},addClass:function(className){if(!this.hasClass(className))this.className=(this.className+' '+className).clean();return this;},removeClass:function(className){this.className=this.className.replace(new RegExp('(^|\\s)'+className+'(?:\\s|$)'),'$1').clean();return this;},toggleClass:function(className){return this.hasClass(className)?this.removeClass(className):this.addClass(className);},getComputedStyle:function(property){if(this.currentStyle)return this.currentStyle[property.camelCase()];var computed=this.getWindow().getComputedStyle(this,null);return(computed)?computed.getPropertyValue([property.hyphenate()]):null;},empty:function(){$A(this.childNodes).each(function(node){Browser.freeMem(node);Element.empty(node);Element.dispose(node);},this);return this;},destroy:function(){Browser.freeMem(this.empty().dispose());return null;},getSelected:function(){return new Elements($A(this.options).filter(function(option){return option.selected;}));},toQueryString:function(){var queryString=[];this.getElements('input, select, textarea').each(function(el){if(!el.name||el.disabled)return;var value=(el.tagName.toLowerCase()=='select')?Element.getSelected(el).map(function(opt){return opt.value;}):((el.type=='radio'||el.type=='checkbox')&&!el.checked)?null:el.value;$splat(value).each(function(val){if(val)queryString.push(el.name+'='+encodeURIComponent(val));});});return queryString.join('&');},getProperty:function(attribute){var EA=Element.Attributes,key=EA.Props[attribute];var value=(key)?this[key]:this.getAttribute(attribute,2);return(EA.Bools[attribute])?!!value:(key)?value:value||null;},getProperties:function(){var args=$A(arguments);return args.map(function(attr){return this.getProperty(attr);},this).associate(args);},setProperty:function(attribute,value){var EA=Element.Attributes,key=EA.Props[attribute],hasValue=$defined(value);if(key&&EA.Bools[attribute])value=(value||!hasValue)?true:false;else if(!hasValue)return this.removeProperty(attribute);(key)?this[key]=value:this.setAttribute(attribute,value);return this;},setProperties:function(attributes){for(var attribute in attributes)this.setProperty(attribute,attributes[attribute]);return this;},removeProperty:function(attribute){var EA=Element.Attributes,key=EA.Props[attribute],isBool=(key&&EA.Bools[attribute]);(key)?this[key]=(isBool)?false:'':this.removeAttribute(attribute);return this;},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this;}});(function(){var walk=function(element,walk,start,match,all,nocash){var el=element[start||walk];var elements=[];while(el){if(el.nodeType==1&&(!match||Element.match(el,match))){elements.push(el);if(!all)break;}
el=el[walk];}
return(all)?new Elements(elements,{ddup:false,cash:!nocash}):$(elements[0],nocash);};Element.implement({getPrevious:function(match,nocash){return walk(this,'previousSibling',null,match,false,nocash);},getAllPrevious:function(match,nocash){return walk(this,'previousSibling',null,match,true,nocash);},getNext:function(match,nocash){return walk(this,'nextSibling',null,match,false,nocash);},getAllNext:function(match,nocash){return walk(this,'nextSibling',null,match,true,nocash);},getFirst:function(match,nocash){return walk(this,'nextSibling','firstChild',match,false,nocash);},getLast:function(match,nocash){return walk(this,'previousSibling','lastChild',match,false,nocash);},getParent:function(match,nocash){return walk(this,'parentNode',null,match,false,nocash);},getParents:function(match,nocash){return walk(this,'parentNode',null,match,true,nocash);},getChildren:function(match,nocash){return walk(this,'nextSibling','firstChild',match,true,nocash);},hasChild:function(el){el=$(el,true);return(!!el&&$A(this.getElementsByTagName(el.tagName)).contains(el));}});})();Element.Properties=new Hash;Element.Properties.style={set:function(style){this.style.cssText=style;},get:function(){return this.style.cssText;},erase:function(){this.style.cssText='';}};Element.Properties.tag={get:function(){return this.tagName.toLowerCase();}};Element.Properties.href={get:function(){return(!this.href)?null:this.href.replace(new RegExp('^'+document.location.protocol+'\/\/'+document.location.host),'');}};Element.Properties.html={set:function(){return this.innerHTML=Array.flatten(arguments).join('');}};Native.implement([Element,Window,Document],{addListener:function(type,fn){if(this.addEventListener)this.addEventListener(type,fn,false);else this.attachEvent('on'+type,fn);return this;},removeListener:function(type,fn){if(this.removeEventListener)this.removeEventListener(type,fn,false);else this.detachEvent('on'+type,fn);return this;},retrieve:function(property,dflt){var storage=Element.Storage.get(this.uid);var prop=storage[property];if($defined(dflt)&&!$defined(prop))prop=storage[property]=dflt;return $pick(prop);},store:function(property,value){var storage=Element.Storage.get(this.uid);storage[property]=value;return this;},eliminate:function(property){var storage=Element.Storage.get(this.uid);delete storage[property];return this;}});Element.Attributes=new Hash({Props:{'html':'innerHTML','class':'className','for':'htmlFor','text':(Browser.Engine.trident)?'innerText':'textContent'},Bools:['compact','nowrap','ismap','declare','noshade','checked','disabled','readonly','multiple','selected','noresize','defer'],Camels:['value','accessKey','cellPadding','cellSpacing','colSpan','frameBorder','maxLength','readOnly','rowSpan','tabIndex','useMap']});Browser.freeMem=function(item){if(!item)return;if(Browser.Engine.trident&&(/object/i).test(item.tagName)){for(var p in item){if(typeof item[p]=='function')item[p]=$empty;}
Element.dispose(item);}
if(item.uid&&item.removeEvents)item.removeEvents();};(function(EA){var EAB=EA.Bools,EAC=EA.Camels;EA.Bools=EAB=EAB.associate(EAB);Hash.extend(Hash.combine(EA.Props,EAB),EAC.associate(EAC.map(function(v){return v.toLowerCase();})));EA.erase('Camels');})(Element.Attributes);window.addListener('unload',function(){window.removeListener('unload',arguments.callee);document.purge();if(Browser.Engine.trident)CollectGarbage();});Element.Properties.events={set:function(events){this.addEvents(events);}};Native.implement([Element,Window,Document],{addEvent:function(type,fn){var events=this.retrieve('events',{});events[type]=events[type]||{'keys':[],'values':[]};if(events[type].keys.contains(fn))return this;events[type].keys.push(fn);var realType=type,custom=Element.Events.get(type),condition=fn,self=this;if(custom){if(custom.onAdd)custom.onAdd.call(this,fn);if(custom.condition){condition=function(event){if(custom.condition.call(this,event))return fn.call(this,event);return false;};}
realType=custom.base||realType;}
var defn=function(){return fn.call(self);};var nativeEvent=Element.NativeEvents[realType]||0;if(nativeEvent){if(nativeEvent==2){defn=function(event){event=new Event(event,self.getWindow());if(condition.call(self,event)===false)event.stop();};}
this.addListener(realType,defn);}
events[type].values.push(defn);return this;},removeEvent:function(type,fn){var events=this.retrieve('events');if(!events||!events[type])return this;var pos=events[type].keys.indexOf(fn);if(pos==-1)return this;var key=events[type].keys.splice(pos,1)[0];var value=events[type].values.splice(pos,1)[0];var custom=Element.Events.get(type);if(custom){if(custom.onRemove)custom.onRemove.call(this,fn);type=custom.base||type;}
return(Element.NativeEvents[type])?this.removeListener(type,value):this;},addEvents:function(events){for(var event in events)this.addEvent(event,events[event]);return this;},removeEvents:function(type){var events=this.retrieve('events');if(!events)return this;if(!type){for(var evType in events)this.removeEvents(evType);events=null;}else if(events[type]){while(events[type].keys[0])this.removeEvent(type,events[type].keys[0]);events[type]=null;}
return this;},fireEvent:function(type,args,delay){var events=this.retrieve('events');if(!events||!events[type])return this;events[type].keys.each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);return this;},cloneEvents:function(from,type){from=$(from);var fevents=from.retrieve('events');if(!fevents)return this;if(!type){for(var evType in fevents)this.cloneEvents(from,evType);}else if(fevents[type]){fevents[type].keys.each(function(fn){this.addEvent(type,fn);},this);}
return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};(function(){var $check=function(event){var related=event.relatedTarget;if(related==undefined)return true;if(related===false)return false;return($type(this)!='document'&&related!=this&&related.prefix!='xul'&&!this.hasChild(related));};Element.Events=new Hash({mouseenter:{base:'mouseover',condition:$check},mouseleave:{base:'mouseout',condition:$check},mousewheel:{base:(Browser.Engine.gecko)?'DOMMouseScroll':'mousewheel'}});})();Element.Properties.styles={set:function(styles){this.setStyles(styles);}};Element.Properties.opacity={set:function(opacity,novisibility){if(!novisibility){if(opacity==0){if(this.style.visibility!='hidden')this.style.visibility='hidden';}else{if(this.style.visibility!='visible')this.style.visibility='visible';}}
if(!this.currentStyle||!this.currentStyle.hasLayout)this.style.zoom=1;if(Browser.Engine.trident)this.style.filter=(opacity==1)?'':'alpha(opacity='+opacity*100+')';this.style.opacity=opacity;this.store('opacity',opacity);},get:function(){return this.retrieve('opacity',1);}};Element.implement({setOpacity:function(value){return this.set('opacity',value,true);},getOpacity:function(){return this.get('opacity');},setStyle:function(property,value){switch(property){case'opacity':return this.set('opacity',parseFloat(value));case'float':property=(Browser.Engine.trident)?'styleFloat':'cssFloat';}
property=property.camelCase();if($type(value)!='string'){var map=(Element.Styles.get(property)||'@').split(' ');value=$splat(value).map(function(val,i){if(!map[i])return'';return($type(val)=='number')?map[i].replace('@',Math.round(val)):val;}).join(' ');}else if(value==String(Number(value))){value=Math.round(value);}
this.style[property]=value;return this;},getStyle:function(property){switch(property){case'opacity':return this.get('opacity');case'float':property=(Browser.Engine.trident)?'styleFloat':'cssFloat';}
property=property.camelCase();var result=this.style[property];if(!$chk(result)){result=[];for(var style in Element.ShortStyles){if(property!=style)continue;for(var s in Element.ShortStyles[style])result.push(this.getStyle(s));return result.join(' ');}
result=this.getComputedStyle(property);}
if(result){result=String(result);var color=result.match(/rgba?\([\d\s,]+\)/);if(color)result=result.replace(color[0],color[0].rgbToHex());}
if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(result)))){if(property.test(/^(height|width)$/)){var values=(property=='width')?['left','right']:['top','bottom'],size=0;values.each(function(value){size+=this.getStyle('border-'+value+'-width').toInt()+this.getStyle('padding-'+value).toInt();},this);return this['offset'+property.capitalize()]-size+'px';}
if(Browser.Engine.presto&&String(result).test('px'))return result;if(property.test(/(border(.+)Width|margin|padding)/))return'0px';}
return result;},setStyles:function(styles){for(var style in styles)this.setStyle(style,styles[style]);return this;},getStyles:function(){var result={};Array.each(arguments,function(key){result[key]=this.getStyle(key);},this);return result;}});Element.Styles=new Hash({left:'@px',top:'@px',bottom:'@px',right:'@px',width:'@px',height:'@px',maxWidth:'@px',maxHeight:'@px',minWidth:'@px',minHeight:'@px',backgroundColor:'rgb(@, @, @)',backgroundPosition:'@px @px',color:'rgb(@, @, @)',fontSize:'@px',letterSpacing:'@px',lineHeight:'@px',clip:'rect(@px @px @px @px)',margin:'@px @px @px @px',padding:'@px @px @px @px',border:'@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',borderWidth:'@px @px @px @px',borderStyle:'@ @ @ @',borderColor:'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',zIndex:'@','zoom':'@',fontWeight:'@',textIndent:'@px',opacity:'@'});Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};['Top','Right','Bottom','Left'].each(function(direction){var Short=Element.ShortStyles;var All=Element.Styles;['margin','padding'].each(function(style){var sd=style+direction;Short[style][sd]=All[sd]='@px';});var bd='border'+direction;Short.border[bd]=All[bd]='@px @ rgb(@, @, @)';var bdw=bd+'Width',bds=bd+'Style',bdc=bd+'Color';Short[bd]={};Short.borderWidth[bdw]=Short[bd][bdw]=All[bdw]='@px';Short.borderStyle[bds]=Short[bd][bds]=All[bds]='@';Short.borderColor[bdc]=Short[bd][bdc]=All[bdc]='rgb(@, @, @)';});(function(){Element.implement({scrollTo:function(x,y){if(isBody(this)){this.getWindow().scrollTo(x,y);}else{this.scrollLeft=x;this.scrollTop=y;}
return this;},getSize:function(){if(isBody(this))return this.getWindow().getSize();return{x:this.offsetWidth,y:this.offsetHeight};},getScrollSize:function(){if(isBody(this))return this.getWindow().getScrollSize();return{x:this.scrollWidth,y:this.scrollHeight};},getScroll:function(){if(isBody(this))return this.getWindow().getScroll();return{x:this.scrollLeft,y:this.scrollTop};},getScrolls:function(){var element=this,position={x:0,y:0};while(element&&!isBody(element)){position.x+=element.scrollLeft;position.y+=element.scrollTop;element=element.parentNode;}
return position;},getOffsetParent:function(){var element=this;if(isBody(element))return null;if(!Browser.Engine.trident)return element.offsetParent;while((element=element.parentNode)&&!isBody(element)){if(styleString(element,'position')!='static')return element;}
return null;},getOffsets:function(){var element=this,position={x:0,y:0};if(isBody(this))return position;while(element&&!isBody(element)){position.x+=element.offsetLeft;position.y+=element.offsetTop;if(Browser.Engine.gecko){if(!borderBox(element)){position.x+=leftBorder(element);position.y+=topBorder(element);}
var parent=element.parentNode;if(parent&&styleString(parent,'overflow')!='visible'){position.x+=leftBorder(parent);position.y+=topBorder(parent);}}else if(element!=this&&(Browser.Engine.trident||Browser.Engine.webkit)){position.x+=leftBorder(element);position.y+=topBorder(element);}
element=element.offsetParent;if(Browser.Engine.trident){while(element&&!element.currentStyle.hasLayout)element=element.offsetParent;}}
if(Browser.Engine.gecko&&!borderBox(this)){position.x-=leftBorder(this);position.y-=topBorder(this);}
return position;},getPosition:function(relative){if(isBody(this))return{x:0,y:0};var offset=this.getOffsets(),scroll=this.getScrolls();var position={x:offset.x-scroll.x,y:offset.y-scroll.y};var relativePosition=(relative&&(relative=$(relative)))?relative.getPosition():{x:0,y:0};return{x:position.x-relativePosition.x,y:position.y-relativePosition.y};},getCoordinates:function(element){if(isBody(this))return this.getWindow().getCoordinates();var position=this.getPosition(element),size=this.getSize();var obj={left:position.x,top:position.y,width:size.x,height:size.y};obj.right=obj.left+obj.width;obj.bottom=obj.top+obj.height;return obj;},computePosition:function(obj){return{left:obj.x-styleNumber(this,'margin-left'),top:obj.y-styleNumber(this,'margin-top')};},position:function(obj){return this.setStyles(this.computePosition(obj));}});Native.implement([Document,Window],{getSize:function(){var win=this.getWindow();if(Browser.Engine.presto||Browser.Engine.webkit)return{x:win.innerWidth,y:win.innerHeight};var doc=getCompatElement(this);return{x:doc.clientWidth,y:doc.clientHeight};},getScroll:function(){var win=this.getWindow();var doc=getCompatElement(this);return{x:win.pageXOffset||doc.scrollLeft,y:win.pageYOffset||doc.scrollTop};},getScrollSize:function(){var doc=getCompatElement(this);var min=this.getSize();return{x:Math.max(doc.scrollWidth,min.x),y:Math.max(doc.scrollHeight,min.y)};},getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var size=this.getSize();return{top:0,left:0,bottom:size.y,right:size.x,height:size.y,width:size.x};}});var styleString=Element.getComputedStyle;function styleNumber(element,style){return styleString(element,style).toInt()||0;};function borderBox(element){return styleString(element,'-moz-box-sizing')=='border-box';};function topBorder(element){return styleNumber(element,'border-top-width');};function leftBorder(element){return styleNumber(element,'border-left-width');};function isBody(element){return(/^(?:body|html)$/i).test(element.tagName);};function getCompatElement(element){var doc=element.getDocument();return(!doc.compatMode||doc.compatMode=='CSS1Compat')?doc.html:doc.body;};})();Native.implement([Window,Document,Element],{getHeight:function(){return this.getSize().y;},getWidth:function(){return this.getSize().x;},getScrollTop:function(){return this.getScroll().y;},getScrollLeft:function(){return this.getScroll().x;},getScrollHeight:function(){return this.getScrollSize().y;},getScrollWidth:function(){return this.getScrollSize().x;},getTop:function(){return this.getPosition().y;},getLeft:function(){return this.getPosition().x;}});Native.implement([Document,Element],{getElements:function(expression,nocash){expression=expression.split(',');var items,local={};for(var i=0,l=expression.length;i<l;i++){var selector=expression[i],elements=Selectors.Utils.search(this,selector,local);if(i!=0&&elements.item)elements=$A(elements);items=(i==0)?elements:(items.item)?$A(items).concat(elements):items.concat(elements);}
return new Elements(items,{ddup:(expression.length>1),cash:!nocash});}});Element.implement({match:function(selector){if(!selector)return true;var tagid=Selectors.Utils.parseTagAndID(selector);var tag=tagid[0],id=tagid[1];if(!Selectors.Filters.byID(this,id)||!Selectors.Filters.byTag(this,tag))return false;var parsed=Selectors.Utils.parseSelector(selector);return(parsed)?Selectors.Utils.filter(this,parsed,{}):true;}});var Selectors={Cache:{nth:{},parsed:{}}};Selectors.RegExps={id:(/#([\w-]+)/),tag:(/^(\w+|\*)/),quick:(/^(\w+|\*)$/),splitter:(/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),combined:(/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)["']?(.*?)["']?)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)};Selectors.Utils={chk:function(item,uniques){if(!uniques)return true;var uid=$uid(item);if(!uniques[uid])return uniques[uid]=true;return false;},parseNthArgument:function(argument){if(Selectors.Cache.nth[argument])return Selectors.Cache.nth[argument];var parsed=argument.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!parsed)return false;var inta=parseInt(parsed[1]);var a=(inta||inta===0)?inta:1;var special=parsed[2]||false;var b=parseInt(parsed[3])||0;if(a!=0){b--;while(b<1)b+=a;while(b>=a)b-=a;}else{a=b;special='index';}
switch(special){case'n':parsed={a:a,b:b,special:'n'};break;case'odd':parsed={a:2,b:0,special:'n'};break;case'even':parsed={a:2,b:1,special:'n'};break;case'first':parsed={a:0,special:'index'};break;case'last':parsed={special:'last-child'};break;case'only':parsed={special:'only-child'};break;default:parsed={a:(a-1),special:'index'};}
return Selectors.Cache.nth[argument]=parsed;},parseSelector:function(selector){if(Selectors.Cache.parsed[selector])return Selectors.Cache.parsed[selector];var m,parsed={classes:[],pseudos:[],attributes:[]};while((m=Selectors.RegExps.combined.exec(selector))){var cn=m[1],an=m[2],ao=m[3],av=m[4],pn=m[5],pa=m[6];if(cn){parsed.classes.push(cn);}else if(pn){var parser=Selectors.Pseudo.get(pn);if(parser)parsed.pseudos.push({parser:parser,argument:pa});else parsed.attributes.push({name:pn,operator:'=',value:pa});}else if(an){parsed.attributes.push({name:an,operator:ao,value:av});}}
if(!parsed.classes.length)delete parsed.classes;if(!parsed.attributes.length)delete parsed.attributes;if(!parsed.pseudos.length)delete parsed.pseudos;if(!parsed.classes&&!parsed.attributes&&!parsed.pseudos)parsed=null;return Selectors.Cache.parsed[selector]=parsed;},parseTagAndID:function(selector){var tag=selector.match(Selectors.RegExps.tag);var id=selector.match(Selectors.RegExps.id);return[(tag)?tag[1]:'*',(id)?id[1]:false];},filter:function(item,parsed,local){var i;if(parsed.classes){for(i=parsed.classes.length;i--;i){var cn=parsed.classes[i];if(!Selectors.Filters.byClass(item,cn))return false;}}
if(parsed.attributes){for(i=parsed.attributes.length;i--;i){var att=parsed.attributes[i];if(!Selectors.Filters.byAttribute(item,att.name,att.operator,att.value))return false;}}
if(parsed.pseudos){for(i=parsed.pseudos.length;i--;i){var psd=parsed.pseudos[i];if(!Selectors.Filters.byPseudo(item,psd.parser,psd.argument,local))return false;}}
return true;},getByTagAndID:function(ctx,tag,id){if(id){var item=(ctx.getElementById)?ctx.getElementById(id,true):Element.getElementById(ctx,id,true);return(item&&Selectors.Filters.byTag(item,tag))?[item]:[];}else{return ctx.getElementsByTagName(tag);}},search:function(self,expression,local){var splitters=[];var selectors=expression.trim().replace(Selectors.RegExps.splitter,function(m0,m1,m2){splitters.push(m1);return':)'+m2;}).split(':)');var items,match,filtered,item;for(var i=0,l=selectors.length;i<l;i++){var selector=selectors[i];if(i==0&&Selectors.RegExps.quick.test(selector)){items=self.getElementsByTagName(selector);continue;}
var splitter=splitters[i-1];var tagid=Selectors.Utils.parseTagAndID(selector);var tag=tagid[0],id=tagid[1];if(i==0){items=Selectors.Utils.getByTagAndID(self,tag,id);}else{var uniques={},found=[];for(var j=0,k=items.length;j<k;j++)found=Selectors.Getters[splitter](found,items[j],tag,id,uniques);items=found;}
var parsed=Selectors.Utils.parseSelector(selector);if(parsed){filtered=[];for(var m=0,n=items.length;m<n;m++){item=items[m];if(Selectors.Utils.filter(item,parsed,local))filtered.push(item);}
items=filtered;}}
return items;}};Selectors.Getters={' ':function(found,self,tag,id,uniques){var items=Selectors.Utils.getByTagAndID(self,tag,id);for(var i=0,l=items.length;i<l;i++){var item=items[i];if(Selectors.Utils.chk(item,uniques))found.push(item);}
return found;},'>':function(found,self,tag,id,uniques){var children=Selectors.Utils.getByTagAndID(self,tag,id);for(var i=0,l=children.length;i<l;i++){var child=children[i];if(child.parentNode==self&&Selectors.Utils.chk(child,uniques))found.push(child);}
return found;},'+':function(found,self,tag,id,uniques){while((self=self.nextSibling)){if(self.nodeType==1){if(Selectors.Utils.chk(self,uniques)&&Selectors.Filters.byTag(self,tag)&&Selectors.Filters.byID(self,id))found.push(self);break;}}
return found;},'~':function(found,self,tag,id,uniques){while((self=self.nextSibling)){if(self.nodeType==1){if(!Selectors.Utils.chk(self,uniques))break;if(Selectors.Filters.byTag(self,tag)&&Selectors.Filters.byID(self,id))found.push(self);}}
return found;}};Selectors.Filters={byTag:function(self,tag){return(tag=='*'||(self.tagName&&self.tagName.toLowerCase()==tag));},byID:function(self,id){return(!id||(self.id&&self.id==id));},byClass:function(self,klass){return(self.className&&self.className.contains(klass,' '));},byPseudo:function(self,parser,argument,local){return parser.call(self,argument,local);},byAttribute:function(self,name,operator,value){var result=Element.prototype.getProperty.call(self,name);if(!result)return false;if(!operator||value==undefined)return true;switch(operator){case'=':return(result==value);case'*=':return(result.contains(value));case'^=':return(result.substr(0,value.length)==value);case'$=':return(result.substr(result.length-value.length)==value);case'!=':return(result!=value);case'~=':return result.contains(value,' ');case'|=':return result.contains(value,'-');}
return false;}};Selectors.Pseudo=new Hash({empty:function(){return!(this.innerText||this.textContent||'').length;},not:function(selector){return!Element.match(this,selector);},contains:function(text){return(this.innerText||this.textContent||'').contains(text);},'first-child':function(){return Selectors.Pseudo.index.call(this,0);},'last-child':function(){var element=this;while((element=element.nextSibling)){if(element.nodeType==1)return false;}
return true;},'only-child':function(){var prev=this;while((prev=prev.previousSibling)){if(prev.nodeType==1)return false;}
var next=this;while((next=next.nextSibling)){if(next.nodeType==1)return false;}
return true;},'nth-child':function(argument,local){argument=(argument==undefined)?'n':argument;var parsed=Selectors.Utils.parseNthArgument(argument);if(parsed.special!='n')return Selectors.Pseudo[parsed.special].call(this,parsed.a,local);var count=0;local.positions=local.positions||{};var uid=$uid(this);if(!local.positions[uid]){var self=this;while((self=self.previousSibling)){if(self.nodeType!=1)continue;count++;var position=local.positions[$uid(self)];if(position!=undefined){count=position+count;break;}}
local.positions[uid]=count;}
return(local.positions[uid]%parsed.a==parsed.b);},index:function(index){var element=this,count=0;while((element=element.previousSibling)){if(element.nodeType==1&&++count>index)return false;}
return(count==index);},even:function(argument,local){return Selectors.Pseudo['nth-child'].call(this,'2n+1',local);},odd:function(argument,local){return Selectors.Pseudo['nth-child'].call(this,'2n',local);}});Element.Events.domready={onAdd:function(fn){if(Browser.loaded)fn.call(this);}};(function(){var domready=function(){if(Browser.loaded)return;Browser.loaded=true;window.fireEvent('domready');document.fireEvent('domready');};switch(Browser.Engine.name){case'webkit':(function(){(['loaded','complete'].contains(document.readyState))?domready():arguments.callee.delay(50);})();break;case'trident':var temp=document.createElement('div');(function(){($try(function(){temp.doScroll('left');return $(temp).inject(document.body).set('html','temp').dispose();}))?domready():arguments.callee.delay(50);})();break;default:window.addEvent('load',domready);document.addEvent('DOMContentLoaded',domready);}})();var JSON=new Hash({encode:function(obj){switch($type(obj)){case'string':return'"'+obj.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case'array':return'['+String(obj.map(JSON.encode).filter($defined))+']';case'object':case'hash':var string=[];Hash.each(obj,function(value,key){var json=JSON.encode(value);if(json)string.push(JSON.encode(key)+':'+json);});return'{'+string+'}';case'number':case'boolean':return String(obj);case false:return'null';}
return null;},$specialChars:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},$replaceChars:function(chr){return JSON.$specialChars[chr]||'\\u00'+Math.floor(chr.charCodeAt()/16).toString(16)+(chr.charCodeAt()%16).toString(16);},decode:function(string,secure){if($type(string)!='string'||!string.length)return null;if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'')))return null;return eval('('+string+')');}});Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this);}});var Cookie=new Class({Implements:Options,options:{path:false,domain:false,duration:false,secure:false,document:document},initialize:function(key,options){this.key=key;this.setOptions(options);},write:function(value){value=encodeURIComponent(value);if(this.options.domain)value+='; domain='+this.options.domain;if(this.options.path)value+='; path='+this.options.path;if(this.options.duration){var date=new Date();date.setTime(date.getTime()+this.options.duration*24*60*60*1000);value+='; expires='+date.toGMTString();}
if(this.options.secure)value+='; secure';this.options.document.cookie=this.key+'='+value;return this;},read:function(){var value=this.options.document.cookie.match('(?:^|;)\\s*'+this.key.escapeRegExp()+'=([^;]*)');return(value)?decodeURIComponent(value[1]):null;},dispose:function(){new Cookie(this.key,$merge(this.options,{duration:-1})).write('');return this;}});Cookie.write=function(key,value,options){return new Cookie(key,options).write(value);};Cookie.read=function(key){return new Cookie(key).read();};Cookie.dispose=function(key,options){return new Cookie(key,options).dispose();};var Swiff=new Class({Implements:[Options],options:{id:null,height:1,width:1,container:null,properties:{},params:{quality:'high',allowScriptAccess:'always',wMode:'transparent',swLiveConnect:true},callBacks:{},vars:{}},toElement:function(){return this.object;},initialize:function(path,options){this.instance='Swiff_'+$time();this.setOptions(options);options=this.options;var id=this.id=options.id||this.instance;var container=$(options.container);Swiff.CallBacks[this.instance]={};var params=options.params,vars=options.vars,callBacks=options.callBacks;var properties=$extend({height:options.height,width:options.width},options.properties);var self=this;for(var callBack in callBacks){Swiff.CallBacks[this.instance][callBack]=(function(option){return function(){return option.apply(self.object,arguments);};})(callBacks[callBack]);vars[callBack]='Swiff.CallBacks.'+this.instance+'.'+callBack;}
params.flashVars=Hash.toQueryString(vars);if(Browser.Engine.trident){properties.classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';params.movie=path;}else{properties.type='application/x-shockwave-flash';properties.data=path;}
var build='<object id="'+id+'"';for(var property in properties)build+=' '+property+'="'+properties[property]+'"';build+='>';for(var param in params){if(params[param])build+='<param name="'+param+'" value="'+params[param]+'" />';}
build+='</object>';this.object=((container)?container.empty():new Element('div')).set('html',build).firstChild;},replaces:function(element){element=$(element,true);element.parentNode.replaceChild(this.toElement(),element);return this;},inject:function(element){$(element,true).appendChild(this.toElement());return this;},remote:function(){return Swiff.remote.apply(Swiff,[this.toElement()].extend(arguments));}});Swiff.CallBacks={};Swiff.remote=function(obj,fn){var rs=obj.CallFunction('<invoke name="'+fn+'" returntype="javascript">'+__flash__argumentsToXML(arguments,2)+'</invoke>');return eval(rs);};var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:'ignore',transition:function(p){return-(Math.cos(Math.PI*p)-1)/2;}},initialize:function(options){this.subject=this.subject||this;this.setOptions(options);this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();var wait=this.options.wait;if(wait===false)this.options.link='cancel';},step:function(){var time=$time();if(time<this.time+this.options.duration){var delta=this.options.transition((time-this.time)/this.options.duration);this.set(this.compute(this.from,this.to,delta));}else{this.set(this.compute(this.from,this.to,1));this.complete();}},set:function(now){return now;},compute:function(from,to,delta){return Fx.compute(from,to,delta);},check:function(caller){if(!this.timer)return true;switch(this.options.link){case'cancel':this.cancel();return true;case'chain':this.chain(caller.bind(this,Array.slice(arguments,1)));return false;}
return false;},start:function(from,to){if(!this.check(arguments.callee,from,to))return this;this.from=from;this.to=to;this.time=0;this.startTimer();this.onStart();return this;},complete:function(){if(this.stopTimer())this.onComplete();return this;},cancel:function(){if(this.stopTimer())this.onCancel();return this;},onStart:function(){this.fireEvent('start',this.subject);},onComplete:function(){this.fireEvent('complete',this.subject);if(!this.callChain())this.fireEvent('chainComplete',this.subject);},onCancel:function(){this.fireEvent('cancel',this.subject).clearChain();},pause:function(){this.stopTimer();return this;},resume:function(){this.startTimer();return this;},stopTimer:function(){if(!this.timer)return false;this.time=$time()-this.time;this.timer=$clear(this.timer);return true;},startTimer:function(){if(this.timer)return false;this.time=$time()-this.time;this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);return true;}});Fx.compute=function(from,to,delta){return(to-from)*delta+from;};Fx.Durations={'short':250,'normal':500,'long':1000};Fx.CSS=new Class({Extends:Fx,prepare:function(element,property,values){values=$splat(values);var values1=values[1];if(!$chk(values1)){values[1]=values[0];values[0]=element.getStyle(property);}
var parsed=values.map(this.parse);return{from:parsed[0],to:parsed[1]};},parse:function(value){value=$lambda(value)();value=(typeof value=='string')?value.split(' '):$splat(value);return value.map(function(val){val=String(val);var found=false;Fx.CSS.Parsers.each(function(parser,key){if(found)return;var parsed=parser.parse(val);if($chk(parsed))found={value:parsed,parser:parser};});found=found||{value:val,parser:Fx.CSS.Parsers.String};return found;});},compute:function(from,to,delta){var computed=[];(Math.min(from.length,to.length)).times(function(i){computed.push({value:from[i].parser.compute(from[i].value,to[i].value,delta),parser:from[i].parser});});computed.$family={name:'fx:css:value'};return computed;},serve:function(value,unit){if($type(value)!='fx:css:value')value=this.parse(value);var returned=[];value.each(function(bit){returned=returned.concat(bit.parser.serve(bit.value,unit));});return returned;},render:function(element,property,value,unit){element.setStyle(property,this.serve(value,unit));},search:function(selector){if(Fx.CSS.Cache[selector])return Fx.CSS.Cache[selector];var to={};Array.each(document.styleSheets,function(sheet,j){var href=sheet.href;if(href&&href.contains('://')&&!href.contains(document.domain))return;var rules=sheet.rules||sheet.cssRules;Array.each(rules,function(rule,i){if(!rule.style)return;var selectorText=(rule.selectorText)?rule.selectorText.replace(/^\w+/,function(m){return m.toLowerCase();}):null;if(!selectorText||!selectorText.test('^'+selector+'$'))return;Element.Styles.each(function(value,style){if(!rule.style[style]||Element.ShortStyles[style])return;value=String(rule.style[style]);to[style]=(value.test(/^rgb/))?value.rgbToHex():value;});});});return Fx.CSS.Cache[selector]=to;}});Fx.CSS.Cache={};Fx.CSS.Parsers=new Hash({Color:{parse:function(value){if(value.match(/^#[0-9a-f]{3,6}$/i))return value.hexToRgb(true);return((value=value.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[value[1],value[2],value[3]]:false;},compute:function(from,to,delta){return from.map(function(value,i){return Math.round(Fx.compute(from[i],to[i],delta));});},serve:function(value){return value.map(Number);}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(value,unit){return(unit)?value+unit:value;}},String:{parse:$lambda(false),compute:$arguments(1),serve:$arguments(0)}});Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(element,options){this.element=this.subject=$(element);this.parent(options);},set:function(property,now){if(arguments.length==1){now=property;property=this.property||this.options.property;}
this.render(this.element,property,now,this.options.unit);return this;},start:function(property,from,to){if(!this.check(arguments.callee,property,from,to))return this;var args=Array.flatten(arguments);this.property=this.options.property||args.shift();var parsed=this.prepare(this.element,this.property,args);return this.parent(parsed.from,parsed.to);}});Element.Properties.tween={set:function(options){var tween=this.retrieve('tween');if(tween)tween.cancel();return this.eliminate('tween').store('tween:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('tween')){if(options||!this.retrieve('tween:options'))this.set('tween',options);this.store('tween',new Fx.Tween(this,this.retrieve('tween:options')));}
return this.retrieve('tween');}};Element.implement({tween:function(property,from,to){this.get('tween').start(arguments);return this;},fade:function(how){var fade=this.get('tween'),o='opacity',toggle;how=$pick(how,'toggle');switch(how){case'in':fade.start(o,1);break;case'out':fade.start(o,0);break;case'show':fade.set(o,1);break;case'hide':fade.set(o,0);break;case'toggle':var flag=this.retrieve('fade:flag',this.get('opacity')==1);fade.start(o,(flag)?0:1);this.store('fade:flag',!flag);toggle=true;break;default:fade.start(o,arguments);}
if(!toggle)this.eliminate('fade:flag');return this;},highlight:function(start,end){if(!end){end=this.retrieve('highlight:original',this.getStyle('background-color'));end=(end=='transparent')?'#fff':end;}
var tween=this.get('tween');tween.start('background-color',start||'#ffff88',end).chain(function(){this.setStyle('background-color',this.retrieve('highlight:original'));tween.callChain();}.bind(this));return this;}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(element,options){this.element=this.subject=$(element);this.parent(options);},set:function(now){if(typeof now=='string')now=this.search(now);for(var p in now)this.render(this.element,p,now[p],this.options.unit);return this;},compute:function(from,to,delta){var now={};for(var p in from)now[p]=this.parent(from[p],to[p],delta);return now;},start:function(properties){if(!this.check(arguments.callee,properties))return this;if(typeof properties=='string')properties=this.search(properties);var from={},to={};for(var p in properties){var parsed=this.prepare(this.element,p,properties[p]);from[p]=parsed.from;to[p]=parsed.to;}
return this.parent(from,to);}});Element.Properties.morph={set:function(options){var morph=this.retrieve('morph');if(morph)morph.cancel();return this.eliminate('morph').store('morph:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('morph')){if(options||!this.retrieve('morph:options'))this.set('morph',options);this.store('morph',new Fx.Morph(this,this.retrieve('morph:options')));}
return this.retrieve('morph');}};Element.implement({morph:function(props){this.get('morph').start(props);return this;}});(function(){var old=Fx.prototype.initialize;Fx.prototype.initialize=function(options){old.call(this,options);var trans=this.options.transition;if(typeof trans=='string'&&(trans=trans.split(':'))){var base=Fx.Transitions;base=base[trans[0]]||base[trans[0].capitalize()];if(trans[1])base=base['ease'+trans[1].capitalize()+(trans[2]?trans[2].capitalize():'')];this.options.transition=base;}};})();Fx.Transition=function(transition,params){params=$splat(params);return $extend(transition,{easeIn:function(pos){return transition(pos,params);},easeOut:function(pos){return 1-transition(1-pos,params);},easeInOut:function(pos){return(pos<=0.5)?transition(2*pos,params)/2:(2-transition(2*(1-pos),params))/2;}});};Fx.Transitions=new Hash({linear:$arguments(0)});Fx.Transitions.extend=function(transitions){for(var transition in transitions)Fx.Transitions[transition]=new Fx.Transition(transitions[transition]);};Fx.Transitions.extend({Pow:function(p,x){return Math.pow(p,x[0]||6);},Expo:function(p){return Math.pow(2,8*(p-1));},Circ:function(p){return 1-Math.sin(Math.acos(p));},Sine:function(p){return 1-Math.sin((1-p)*Math.PI/2);},Back:function(p,x){x=x[0]||1.618;return Math.pow(p,2)*((x+1)*p-x);},Bounce:function(p){var value;for(var a=0,b=1;1;a+=b,b/=2){if(p>=(7-4*a)/11){value=-Math.pow((11-6*a-11*p)/4,2)+b*b;break;}}
return value;},Elastic:function(p,x){return Math.pow(2,10*--p)*Math.cos(20*p*Math.PI*(x[0]||1)/3);}});['Quad','Cubic','Quart','Quint'].each(function(transition,i){Fx.Transitions[transition]=new Fx.Transition(function(p){return Math.pow(p,[i+2]);});});var Request=new Class({Implements:[Chain,Events,Options],options:{url:'',data:'',headers:{'X-Requested-With':'XMLHttpRequest','Accept':'text/javascript, text/html, application/xml, text/xml, */*'},async:true,format:false,method:'post',link:'ignore',isSuccess:null,emulation:true,urlEncoded:true,encoding:'utf-8',evalScripts:false,evalResponse:false},initialize:function(options){this.xhr=new Browser.Request();this.setOptions(options);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers=new Hash(this.options.headers);},onStateChange:function(){if(this.xhr.readyState!=4||!this.running)return;this.running=false;this.status=0;$try(function(){this.status=this.xhr.status;}.bind(this));if(this.options.isSuccess.call(this,this.status)){this.response={text:this.xhr.responseText,xml:this.xhr.responseXML};this.success(this.response.text,this.response.xml);}else{this.response={text:null,xml:null};this.failure();}
this.xhr.onreadystatechange=$empty;},isSuccess:function(){return((this.status>=200)&&(this.status<300));},processScripts:function(text){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader('Content-type')))return $exec(text);return text.stripScripts(this.options.evalScripts);},success:function(text,xml){this.onSuccess(this.processScripts(text),xml);},onSuccess:function(){this.fireEvent('complete',arguments).fireEvent('success',arguments).callChain();},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent('complete').fireEvent('failure',this.xhr);},setHeader:function(name,value){this.headers.set(name,value);return this;},getHeader:function(name){return $try(function(){return this.xhr.getResponseHeader(name);}.bind(this));},check:function(caller){if(!this.running)return true;switch(this.options.link){case'cancel':this.cancel();return true;case'chain':this.chain(caller.bind(this,Array.slice(arguments,1)));return false;}
return false;},send:function(options){if(!this.check(arguments.callee,options))return this;this.running=true;var type=$type(options);if(type=='string'||type=='element')options={data:options};var old=this.options;options=$extend({data:old.data,url:old.url,method:old.method},options);var data=options.data,url=options.url,method=options.method;switch($type(data)){case'element':data=$(data).toQueryString();break;case'object':case'hash':data=Hash.toQueryString(data);}
if(this.options.format){var format='format='+this.options.format;data=(data)?format+'&'+data:format;}
if(this.options.emulation&&['put','delete'].contains(method)){var _method='_method='+method;data=(data)?_method+'&'+data:_method;method='post';}
if(this.options.urlEncoded&&method=='post'){var encoding=(this.options.encoding)?'; charset='+this.options.encoding:'';this.headers.set('Content-type','application/x-www-form-urlencoded'+encoding);}
if(data&&method=='get'){url=url+(url.contains('?')?'&':'?')+data;data=null;}
this.xhr.open(method.toUpperCase(),url,this.options.async);this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(value,key){if(!$try(function(){this.xhr.setRequestHeader(key,value);return true;}.bind(this)))this.fireEvent('exception',[key,value]);},this);this.fireEvent('request');this.xhr.send(data);if(!this.options.async)this.onStateChange();return this;},cancel:function(){if(!this.running)return this;this.running=false;this.xhr.abort();this.xhr.onreadystatechange=$empty;this.xhr=new Browser.Request();this.fireEvent('cancel');return this;}});(function(){var methods={};['get','post','put','delete','GET','POST','PUT','DELETE'].each(function(method){methods[method]=function(){var params=Array.link(arguments,{url:String.type,data:$defined});return this.send($extend(params,{method:method.toLowerCase()}));};});Request.implement(methods);})();Element.Properties.send={set:function(options){var send=this.retrieve('send');if(send)send.cancel();return this.eliminate('send').store('send:options',$extend({data:this,link:'cancel',method:this.get('method')||'post',url:this.get('action')},options));},get:function(options){if(options||!this.retrieve('send')){if(options||!this.retrieve('send:options'))this.set('send',options);this.store('send',new Request(this.retrieve('send:options')));}
return this.retrieve('send');}};Element.implement({send:function(url){var sender=this.get('send');sender.send({data:this,url:url||sender.options.url});return this;}});Request.HTML=new Class({Extends:Request,options:{update:false,evalScripts:true,filter:false},processHTML:function(text){var match=text.match(/<body[^>]*>([\s\S]*?)<\/body>/i);text=(match)?match[1]:text;var container=new Element('div');return $try(function(){var root='<root>'+text+'</root>',doc;if(Browser.Engine.trident){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async=false;doc.loadXML(root);}else{doc=new DOMParser().parseFromString(root,'text/xml');}
root=doc.getElementsByTagName('root')[0];for(var i=0,k=root.childNodes.length;i<k;i++){var child=Element.clone(root.childNodes[i],true,true);if(child)container.grab(child);}
return container;})||container.set('html',text);},success:function(text){var options=this.options,response=this.response;response.html=text.stripScripts(function(script){response.javascript=script;});var temp=this.processHTML(response.html);response.tree=temp.childNodes;response.elements=temp.getElements('*');if(options.filter)response.tree=response.elements.filter(options.filter);if(options.update)$(options.update).empty().adopt(response.tree);if(options.evalScripts)$exec(response.javascript);this.onSuccess(response.tree,response.elements,response.html,response.javascript);}});Element.Properties.load={set:function(options){var load=this.retrieve('load');if(load)send.cancel();return this.eliminate('load').store('load:options',$extend({data:this,link:'cancel',update:this,method:'get'},options));},get:function(options){if(options||!this.retrieve('load')){if(options||!this.retrieve('load:options'))this.set('load',options);this.store('load',new Request.HTML(this.retrieve('load:options')));}
return this.retrieve('load');}};Element.implement({load:function(){this.get('load').send(Array.link(arguments,{data:Object.type,url:String.type}));return this;}});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(options){this.parent(options);this.headers.extend({'Accept':'application/json','X-Request':'JSON'});},success:function(text){this.response.json=JSON.decode(text,this.options.secure);this.onSuccess(this.response.json,text);}});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=$(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){var now=[];var x=2;x.times(function(i){now[i]=Fx.compute(from[i],to[i],delta);});return now;},start:function(how,mode){if(!this.check(arguments.callee,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=(this.wrapper['offset'+this.layout.capitalize()]==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;}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{'x':0,'y':0},wheelStops:true},initialize:function(element,options){this.element=this.subject=$(element);this.parent(options);var cancel=this.cancel.bind(this,false);if($type(this.element)!='element')this.element=$(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){var now=[];var x=2;x.times(function(i){now.push(Fx.compute(from[i],to[i],delta));});return now;},start:function(x,y){if(!this.check(arguments.callee,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=$(el).getPosition(this.element);return this.start(position.x,position.y);}});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(arguments.callee,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 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=$(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):$(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.fireEvent('beforeStart',this.element);this.mouse.start=event.page;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).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.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);},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);}});Element.implement({makeResizable:function(options){return new Drag(this,$merge({modifiers:{'x':'width','y':'height'}},options));}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false},initialize:function(element,options){this.parent(element,options);this.droppables=$$(this.options.droppables);this.container=$(this.options.container);if(this.container&&$type(this.container)!='element')this.container=$(this.container.getDocument().body);element=this.element;var current=element.getStyle('position');var position=(current!='static')?current:'absolute';if(element.getStyle('left')=='auto'||element.getStyle('top')=='auto')element.position(element.getPosition(element.offsetParent));element.setStyle('position',position);this.addEvent('start',function(){this.checkDroppables();},true);},start:function(event){if(this.container){var el=this.element,cont=this.container,ccoo=cont.getCoordinates(el.offsetParent),cps={},ems={};['top','right','bottom','left'].each(function(pad){cps[pad]=cont.getStyle('padding-'+pad).toInt();ems[pad]=el.getStyle('margin-'+pad).toInt();},this);var width=el.offsetWidth+ems.left+ems.right,height=el.offsetHeight+ems.top+ems.bottom;var x=[ccoo.left+cps.left,ccoo.right-cps.right-width];var y=[ccoo.top+cps.top,ccoo.bottom-cps.bottom-height];this.options.limit={x:x,y:y};}
this.parent(event);},checkAgainst:function(el){el=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.overed=overed;this.fireEvent('enter',[this.element,overed]);}else{this.overed=null;}}},drag:function(event){this.parent(event);if(this.droppables.length)this.checkDroppables();},stop:function(event){this.checkDroppables();this.fireEvent('drop',[this.element,this.overed]);this.overed=null;return this.parent(event);}});Element.implement({makeDraggable:function(options){return new Drag.Move(this,options);}});Hash.Cookie=new Class({Extends:Cookie,options:{autoSave:true},initialize:function(name,options){this.parent(name,options);this.load();},save:function(){var value=JSON.encode(this.hash);if(!value||value.length>4096)return false;if(value=='{}')this.dispose();else this.write(value);return true;},load:function(){this.hash=new Hash(JSON.decode(this.read(),true));return this;}});Hash.Cookie.implement((function(){var methods={};Hash.each(Hash.prototype,function(method,name){methods[name]=function(){var value=method.apply(this.hash,arguments);if(this.options.autoSave)this.save();return value;};});return methods;})());var Color=new Native({initialize:function(color,type){if(arguments.length>=3){type="rgb";color=Array.slice(arguments,0,3);}else if(typeof color=='string'){if(color.match(/rgb/))color=color.rgbToHex().hexToRgb(true);else if(color.match(/hsb/))color=color.hsbToRgb();else color=color.hexToRgb(true);}
type=type||'rgb';switch(type){case'hsb':var old=color;color=color.hsbToRgb();color.hsb=old;break;case'hex':color=color.hexToRgb(true);break;}
color.rgb=color.slice(0,3);color.hsb=color.hsb||color.rgbToHsb();color.hex=color.rgbToHex();return $extend(color,this);}});Color.implement({mix:function(){var colors=Array.slice(arguments);var alpha=($type(colors.getLast())=='number')?colors.pop():50;var rgb=this.slice();colors.each(function(color){color=new Color(color);for(var i=0;i<3;i++)rgb[i]=Math.round((rgb[i]/100*(100-alpha))+(color[i]/100*alpha));});return new Color(rgb,'rgb');},invert:function(){return new Color(this.map(function(value){return 255-value;}));},setHue:function(value){return new Color([value,this.hsb[1],this.hsb[2]],'hsb');},setSaturation:function(percent){return new Color([this.hsb[0],percent,this.hsb[2]],'hsb');},setBrightness:function(percent){return new Color([this.hsb[0],this.hsb[1],percent],'hsb');}});function $RGB(r,g,b){return new Color([r,g,b],'rgb');};function $HSB(h,s,b){return new Color([h,s,b],'hsb');};function $HEX(hex){return new Color(hex,'hex');};Array.implement({rgbToHsb:function(){var red=this[0],green=this[1],blue=this[2];var hue,saturation,brightness;var max=Math.max(red,green,blue),min=Math.min(red,green,blue);var delta=max-min;brightness=max/255;saturation=(max!=0)?delta/max:0;if(saturation==0){hue=0;}else{var rr=(max-red)/delta;var gr=(max-green)/delta;var br=(max-blue)/delta;if(red==max)hue=br-gr;else if(green==max)hue=2+rr-br;else hue=4+gr-rr;hue/=6;if(hue<0)hue++;}
return[Math.round(hue*360),Math.round(saturation*100),Math.round(brightness*100)];},hsbToRgb:function(){var br=Math.round(this[2]/100*255);if(this[1]==0){return[br,br,br];}else{var hue=this[0]%360;var f=hue%60;var p=Math.round((this[2]*(100-this[1]))/10000*255);var q=Math.round((this[2]*(6000-this[1]*f))/600000*255);var t=Math.round((this[2]*(6000-this[1]*(60-f)))/600000*255);switch(Math.floor(hue/60)){case 0:return[br,t,p];case 1:return[q,br,p];case 2:return[p,br,t];case 3:return[p,q,br];case 4:return[t,p,br];case 5:return[br,p,q];}}
return false;}});String.implement({rgbToHsb:function(){var rgb=this.match(/\d{1,3}/g);return(rgb)?hsb.rgbToHsb():null;},hsbToRgb:function(){var hsb=this.match(/\d{1,3}/g);return(hsb)?hsb.hsbToRgb():null;}});var Group=new Class({initialize:function(){this.instances=Array.flatten(arguments);this.events={};this.checker={};},addEvent:function(type,fn){this.checker[type]=this.checker[type]||{};this.events[type]=this.events[type]||[];if(this.events[type].contains(fn))return false;else this.events[type].push(fn);this.instances.each(function(instance,i){instance.addEvent(type,this.check.bind(this,[type,instance,i]));},this);return this;},check:function(type,instance,i){this.checker[type][i]=true;var every=this.instances.every(function(current,j){return this.checker[type][j]||false;},this);if(!every)return;this.checker[type]={};this.events[type].each(function(event){event.call(this,this.instances,instance);},this);}});var Asset=new Hash({javascript:function(source,properties){properties=$extend({onload:$empty,document:document,check:$lambda(true)},properties);var script=new Element('script',{'src':source,'type':'text/javascript'});var load=properties.onload.bind(script),check=properties.check,doc=properties.document;delete properties.onload;delete properties.check;delete properties.document;script.addEvents({load:load,readystatechange:function(){if(['loaded','complete'].contains(this.readyState))load();}}).setProperties(properties);if(Browser.Engine.webkit419)var checker=(function(){if(!$try(check))return;$clear(checker);load();}).periodical(50);return script.inject(doc.head);},css:function(source,properties){return new Element('link',$merge({'rel':'stylesheet','media':'screen','type':'text/css','href':source},properties)).inject(document.head);},image:function(source,properties){properties=$merge({'onload':$empty,'onabort':$empty,'onerror':$empty},properties);var image=new Image();var element=$(image)||new Element('img');['load','abort','error'].each(function(name){var type='on'+name;var event=properties[type];delete properties[type];image[type]=function(){if(!image)return;if(!element.parentNode){element.width=image.width;element.height=image.height;}
image=image.onload=image.onabort=image.onerror=null;event.delay(1,element,element);element.fireEvent(name,element,1);};});image.src=element.src=source;if(image&&image.complete)image.onload.delay(1);return element.setProperties(properties);},images:function(sources,options){options=$merge({onComplete:$empty,onProgress:$empty},options);if(!sources.push)sources=[sources];var images=[];var counter=0;sources.each(function(source){var img=new Asset.image(source,{'onload':function(){options.onProgress.call(this,counter,sources.indexOf(source));counter++;if(counter==sources.length)options.onComplete();}});images.push(img);});return new Elements(images);}});var Sortables=new Class({Implements:[Events,Options],options:{snap:4,opacity:1,clone:false,revert:false,handle:false,constrain:false},initialize:function(lists,options){this.setOptions(options);this.elements=[];this.lists=[];this.idle=true;this.addLists($$($(lists)||lists));if(!this.options.clone)this.options.revert=false;if(this.options.revert)this.effect=new Fx.Morph(null,$merge({duration:250,link:'cancel'},this.options.revert));},attach:function(){this.addLists(this.lists);return this;},detach:function(){this.lists=this.removeLists(this.lists);return this;},addItems:function(){Array.flatten(arguments).each(function(element){this.elements.push(element);var start=element.retrieve('sortables:start',this.start.bindWithEvent(this,element));(this.options.handle?element.getElement(this.options.handle)||element:element).addEvent('mousedown',start);},this);return this;},addLists:function(){Array.flatten(arguments).each(function(list){this.lists.push(list);this.addItems(list.getChildren());},this);return this;},removeItems:function(){var elements=[];Array.flatten(arguments).each(function(element){elements.push(element);this.elements.erase(element);var start=element.retrieve('sortables:start');(this.options.handle?element.getElement(this.options.handle)||element:element).removeEvent('mousedown',start);},this);return $$(elements);},removeLists:function(){var lists=[];Array.flatten(arguments).each(function(list){lists.push(list);this.lists.erase(list);this.removeItems(list.getChildren());},this);return $$(lists);},getClone:function(event,element){if(!this.options.clone)return new Element('div').inject(document.body);if($type(this.options.clone)=='function')return this.options.clone.call(this,event,element,this.list);return element.clone(true).setStyles({'margin':'0px','position':'absolute','visibility':'hidden','width':element.getStyle('width')}).inject(this.list).position(element.getPosition(element.getOffsetParent()));},getDroppables:function(){var droppables=this.list.getChildren();if(!this.options.constrain)droppables=this.lists.concat(droppables).erase(this.list);return droppables.erase(this.clone).erase(this.element);},insert:function(dragging,element){var where='inside';if(this.lists.contains(element)){this.list=element;this.drag.droppables=this.getDroppables();}else{where=this.element.getAllPrevious().contains(element)?'before':'after';}
this.element.inject(element,where);this.fireEvent('sort',[this.element,this.clone]);},start:function(event,element){if(!this.idle)return;this.idle=false;this.element=element;this.opacity=element.get('opacity');this.list=element.getParent();this.clone=this.getClone(event,element);this.drag=new Drag.Move(this.clone,{snap:this.options.snap,container:this.options.constrain&&this.element.getParent(),droppables:this.getDroppables(),onSnap:function(){event.stop();this.clone.setStyle('visibility','visible');this.element.set('opacity',this.options.opacity||0);this.fireEvent('start',[this.element,this.clone]);}.bind(this),onEnter:this.insert.bind(this),onCancel:this.reset.bind(this),onComplete:this.end.bind(this)});this.clone.inject(this.element,'before');this.drag.start(event);},end:function(){this.drag.detach();this.element.set('opacity',this.opacity);if(this.effect){var dim=this.element.getStyles('width','height');var pos=this.clone.computePosition(this.element.getPosition(this.clone.offsetParent));this.effect.element=this.clone;this.effect.start({top:pos.top,left:pos.left,width:dim.width,height:dim.height,opacity:0.25}).chain(this.reset.bind(this));}else{this.reset();}},reset:function(){this.idle=true;this.clone.destroy();this.fireEvent('complete',this.element);},serialize:function(){var params=Array.link(arguments,{modifier:Function.type,index:$defined});var serial=this.lists.map(function(list){return list.getChildren().map(params.modifier||function(element){return element.get('id');},this);},this);var index=params.index;if(this.lists.length==1)index=0;return $chk(index)&&index>=0&&index<this.lists.length?serial[index]:serial;}});var Tips=new Class({Implements:[Events,Options],options:{onShow:function(tip){tip.setStyle('visibility','visible');},onHide:function(tip){tip.setStyle('visibility','hidden');},showDelay:100,hideDelay:100,className:null,offsets:{x:16,y:16},fixed:false},initialize:function(){var params=Array.link(arguments,{options:Object.type,elements:$defined});this.setOptions(params.options||null);this.tip=new Element('div').inject(document.body);if(this.options.className)this.tip.addClass(this.options.className);var top=new Element('div',{'class':'tip-top'}).inject(this.tip);this.container=new Element('div',{'class':'tip'}).inject(this.tip);var bottom=new Element('div',{'class':'tip-bottom'}).inject(this.tip);this.tip.setStyles({position:'absolute',top:0,left:0,visibility:'hidden'});if(params.elements)this.attach(params.elements);},attach:function(elements){$$(elements).each(function(element){var title=element.retrieve('tip:title',element.get('title'));var text=element.retrieve('tip:text',element.get('rel')||element.get('href'));var enter=element.retrieve('tip:enter',this.elementEnter.bindWithEvent(this,element));var leave=element.retrieve('tip:leave',this.elementLeave.bindWithEvent(this,element));element.addEvents({mouseenter:enter,mouseleave:leave});if(!this.options.fixed){var move=element.retrieve('tip:move',this.elementMove.bindWithEvent(this,element));element.addEvent('mousemove',move);}
element.store('tip:native',element.get('title'));element.erase('title');},this);return this;},detach:function(elements){$$(elements).each(function(element){element.removeEvent('mouseenter',element.retrieve('tip:enter')||$empty);element.removeEvent('mouseleave',element.retrieve('tip:leave')||$empty);element.removeEvent('mousemove',element.retrieve('tip:move')||$empty);element.eliminate('tip:enter').eliminate('tip:leave').eliminate('tip:move');var original=element.retrieve('tip:native');if(original)element.set('title',original);});return this;},elementEnter:function(event,element){$A(this.container.childNodes).each(Element.dispose);var title=element.retrieve('tip:title');if(title){this.titleElement=new Element('div',{'class':'tip-title'}).inject(this.container);this.fill(this.titleElement,title);}
var text=element.retrieve('tip:text');if(text){this.textElement=new Element('div',{'class':'tip-text'}).inject(this.container);this.fill(this.textElement,text);}
this.timer=$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);this.position((!this.options.fixed)?event:{page:element.getPosition()});},elementLeave:function(event){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this);},elementMove:function(event){this.position(event);},position:function(event){var size=window.getSize(),scroll=window.getScroll();var tip={x:this.tip.offsetWidth,y:this.tip.offsetHeight};var props={x:'left',y:'top'};for(var z in props){var pos=event.page[z]+this.options.offsets[z];if((pos+tip[z]-scroll[z])>size[z])pos=event.page[z]-this.options.offsets[z]-tip[z];this.tip.setStyle(props[z],pos);}},fill:function(element,contents){(typeof contents=='string')?element.set('html',contents):element.adopt(contents);},show:function(){this.fireEvent('show',this.tip);},hide:function(){this.fireEvent('hide',this.tip);}});var SmoothScroll=new Class({Extends:Fx.Scroll,initialize:function(options,context){context=context||document;var doc=context.getDocument(),win=context.getWindow();this.parent(doc,options);this.links=(this.options.links)?$$(this.options.links):$$(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&&$(anchor))this.useLink(link,anchor);},this);if(!Browser.Engine.webkit419)this.addEvent('complete',function(){win.location.hash=this.anchor;},true);},useLink:function(link,anchor){link.addEvent('click',function(event){this.anchor=anchor;this.toElement(anchor);event.stop();}.bind(this));}});var Slider=new Class({Implements:[Events,Options],options:{onTick:function(position){if(this.options.snap)position=this.toPosition(this.step);this.knob.setStyle(this.property,position);},snap:false,offset:0,range:false,wheel:false,steps:100,mode:'horizontal'},initialize:function(element,knob,options){this.setOptions(options);this.element=$(element);this.knob=$(knob);this.previousChange=this.previousEnd=this.step=-1;this.element.addEvent('mousedown',this.clickedElement.bind(this));if(this.options.wheel)this.element.addEvent('mousewheel',this.scrolledElement.bindWithEvent(this));var offset,limit={},modifiers={'x':false,'y':false};switch(this.options.mode){case'vertical':this.axis='y';this.property='top';offset='offsetHeight';break;case'horizontal':this.axis='x';this.property='left';offset='offsetWidth';}
this.half=this.knob[offset]/2;this.full=this.element[offset]-this.knob[offset]+(this.options.offset*2);this.min=$chk(this.options.range[0])?this.options.range[0]:0;this.max=$chk(this.options.range[1])?this.options.range[1]:this.options.steps;this.range=this.max-this.min;this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;this.stepWidth=this.stepSize*this.full/Math.abs(this.range);this.knob.setStyle('position','relative').setStyle(this.property,-this.options.offset);modifiers[this.axis]=this.property;limit[this.axis]=[-this.options.offset,this.full-this.options.offset];this.drag=new Drag(this.knob,{snap:0,limit:limit,modifiers:modifiers,onDrag:this.draggedKnob.bind(this),onStart:this.draggedKnob.bind(this),onComplete:function(){this.draggedKnob();this.end();}.bind(this)});if(this.options.snap){this.drag.options.grid=Math.ceil(this.stepWidth);this.drag.options.limit[this.axis][1]=this.full;}},set:function(step){if(!((this.range>0)^(step<this.min)))step=this.min;if(!((this.range>0)^(step>this.max)))step=this.max;this.step=Math.round(step);this.checkStep();this.end();this.fireEvent('tick',this.toPosition(this.step));return this;},clickedElement:function(event){var dir=this.range<0?-1:1;var position=event.page[this.axis]-this.element.getPosition()[this.axis]-this.half;position=position.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+dir*this.toStep(position));this.checkStep();this.end();this.fireEvent('tick',position);},scrolledElement:function(event){var mode=(this.options.mode=='horizontal')?(event.wheel<0):(event.wheel>0);this.set(mode?this.step-this.stepSize:this.step+this.stepSize);event.stop();},draggedKnob:function(){var dir=this.range<0?-1:1;var position=this.drag.value.now[this.axis];position=position.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+dir*this.toStep(position));this.checkStep();},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;this.fireEvent('change',this.step);}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent('complete',this.step+'');}},toStep:function(position){var step=(position+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(step-=step%this.stepSize):step;},toPosition:function(step){return(this.full*Math.abs(this.min-step))/(this.steps*this.stepSize)-this.options.offset;}});var Scroller=new Class({Implements:[Events,Options],options:{area:20,velocity:1,onChange:function(x,y){this.element.scrollTo(x,y);}},initialize:function(element,options){this.setOptions(options);this.element=$(element);this.listener=($type(this.element)!='element')?$(this.element.getDocument().body):this.element;this.timer=null;this.coord=this.getCoords.bind(this);},start:function(){this.listener.addEvent('mousemove',this.coord);},stop:function(){this.listener.removeEvent('mousemove',this.coord);this.timer=$clear(this.timer);},getCoords:function(event){this.page=(this.listener.get('tag')=='body')?event.client:event.page;if(!this.timer)this.timer=this.scroll.periodical(50,this);},scroll:function(){var size=this.element.getSize(),scroll=this.element.getScroll(),pos=this.element.getPosition(),change={'x':0,'y':0};for(var z in this.page){if(this.page[z]<(this.options.area+pos[z])&&scroll[z]!=0)
change[z]=(this.page[z]-this.options.area-pos[z])*this.options.velocity;else if(this.page[z]+this.options.area>(size[z]+pos[z])&&size[z]+size[z]!=scroll[z])
change[z]=(this.page[z]-size[z]+this.options.area-pos[z])*this.options.velocity;}
if(change.y||change.x)this.fireEvent('change',[scroll.x+change.x,scroll.y+change.y]);}});var 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},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=$(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);},addSection:function(toggler,element,pos){toggler=$(toggler);element=$(element);var test=this.togglers.contains(toggler);var len=this.togglers.length;this.togglers.include(toggler);this.elements.include(element);if(len&&(!test||pos)){pos=$pick(pos,len-1);toggler.inject(this.togglers[pos],'before');element.inject(toggler,'after');}else if(this.container&&!test){toggler.inject(this.container);element.inject(this.container);}
var idx=this.togglers.indexOf(toggler);toggler.addEvent('click',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){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 this.start(obj);}});var GETDATA=new Array();var sGet=window.location.search;if(sGet)
{sGet=sGet.substr(1);var sNVPairs=sGet.split("&");for(var i=0;i<sNVPairs.length;i++)
{var sNV=sNVPairs[i].split("=");var sName=sNV[0];var sValue=sNV[1];GETDATA[sName]=sValue;}}
var clsCategory=new Class({initialize:function(games)
{this.games=games;this.spliced=false;},show:function(currentPage)
{currentPage=parseInt(currentPage);Cookie.write('fg_last_category',location.pathname+'|'+currentPage,'/');$('categoryGames').empty();this.sort();var count=0;var limitStart=currentPage*15;if(parseInt(GETDATA['more'])>0)
{hidden=parseInt(GETDATA['more']);}else{hidden=0;}
if(hidden!=0&&this.spliced==false){this.games.splice(0,hidden);this.spliced=true;}
this.games.each(function(game,key){count++;if(count>limitStart&&count<(limitStart+16)){switch($('sortBy').get('value')){case'1':case'2':score=Math.round(game.s*10)/10;if(isNaN(score))
{score='-';}
sortShow=translations["Score"]+': '+score;break;case'3':sortShow=translations["Added"]+': '+game.ds;break;case'4':sortShow=translations["Played"]+': '+game.h;break;}
var html='<div class="gamePageVersion"><a onmouseover="ddrivetip(\''+addslashes(game.d)+'\');" onmouseout="hideddrivetip();" href="/'+translations["gameURL"]+'/'+game.c+'.html"><strong>'
+game.t+'</strong><br/><img src="'+translations["staticURL"]+'screenshots/'+game.i+'.jpg" width="185px" height="145px"><div align="center" style="font-size: 11px; font-weight:normal;">'+sortShow+'</div></a></div>';new Element('div',{'class':'categoryGame'}).set('html',html).injectInside($('categoryGames'));}});new Element('br',{'clear':'both'}).injectInside($('categoryGames'));if($('var_bottom')){$('var_bottom').style.backgroundPosition='bottom';$('var_bottom').style.marginBottom='-1px';}
if(count%15!=0){pages=((count-(count%15))/15)+1;}else{pages=(count/15);}
if($('pageNumbers1')){$('pageNumbers1').empty();$('pageNumbers2').empty();if(currentPage<5){minPage=currentPage-5;maxPage=currentPage+(10-currentPage);}else if(pages-currentPage<5){minPage=currentPage-(10-(pages-currentPage));maxPage=currentPage+5;}else{minPage=currentPage-5;maxPage=currentPage+5;}
if(minPage>0){new Element('a',{'href':'javascript: category.show(0)'}).set('html','&lt;&lt;&nbsp;').injectInside($('pageNumbers1'));new Element('a',{'href':'javascript: category.show(0)'}).set('html','&lt;&lt;&nbsp;').injectInside($('pageNumbers2'));}
if(currentPage>0){new Element('a',{'href':'javascript: category.show('+(currentPage-1)+')'}).set('html','&lt;vorige').injectInside($('pageNumbers1'));new Element('a',{'href':'javascript: category.show('+(currentPage-1)+')'}).set('html','&lt;vorige').injectInside($('pageNumbers2'));}
for(i=0;i<=(pages-1);i++){if(i>minPage&&i<maxPage){if(i==currentPage){new Element('a',{'class':'pageNumberOver','href':'javascript: category.show('+i+')','styles':{'color':'#FFFFFF'}}).set('html',i+1).injectInside($('pageNumbers1'));new Element('a',{'class':'pageNumberOver','href':'javascript: category.show('+i+')','styles':{'color':'#FFFFFF'}}).set('html',i+1).injectInside($('pageNumbers2'));}else{new Element('a',{'href':'javascript: category.show('+i+')'}).set('html',i+1).injectInside($('pageNumbers1'));new Element('a',{'href':'javascript: category.show('+i+')'}).set('html',i+1).injectInside($('pageNumbers2'));}}}
if((currentPage+1)!=pages){new Element('a',{'href':'javascript: category.show('+(currentPage+1)+')'}).set('html','volgende&gt;').injectInside($('pageNumbers1'));new Element('a',{'href':'javascript: category.show('+(currentPage+1)+')'}).set('html','volgende&gt;').injectInside($('pageNumbers2'));}
if(maxPage<pages-1){new Element('a',{'href':'javascript: category.show('+(pages-1)+')'}).set('html','&nbsp;&gt;&gt;').injectInside($('pageNumbers1'));new Element('a',{'href':'javascript: category.show('+(pages-1)+')'}).set('html','&nbsp;&gt;&gt;').injectInside($('pageNumbers2'));}}},sort:function()
{switch($('sortBy').get('value'))
{case'1':this.games.sort(this.sortAlphabeticAsc);break;case'2':this.games.sort(this.sortByScoreDesc);break;case'3':this.games.sort(this.sortByDateDesc);break;case'4':this.games.sort(this.sortByHitsDesc);break;}},sortByDateDesc:function(a,b)
{return(a.da>b.da)?-1:1;},sortAlphabeticAsc:function(a,b)
{return(a.t>b.t)?1:-1;},sortByScoreDesc:function(a,b)
{return(a.s<b.s)?1:-1;},sortByHitsDesc:function(a,b)
{return b.h-a.h;}});var clsMyGames=new Class({initialize:function(div_id)
{this.games=new Hash.Cookie('myGames',{duration:60*60*24*365,path:'/',autoSave:false});this.workdiv=div_id;},show:function()
{var myGamesDiv=$(this.workdiv);if(myGamesDiv){myGamesDiv.set('html','');new Element('ul',{'id':'myGamesList'}).injectInside(myGamesDiv);if(this.games.getLength()>0)
{this.games.each(function(game,key){var link='';link+='<a href="/'+translations["gameURL"]+'/'+game.gamecode+'.html" onMouseOver="ddrivetip(\'<img src='+translations["staticURL"]+'/screenshots/'+key+'.jpg width=185 height=145 />\',185,2);" onMouseOut="hideddrivetip();">'+game.title+'</a>';link+='<span class="myGamesRemove"><a href="javascript:removeMyGame(\''+key+'\');">X</a></span>';new Element('li',{'class':'myGamesItem','id':'myGames_'+key}).set('html',link).injectInside($('myGamesList'));});}else{myGamesDiv.getParent().setStyle('display','none');}}},showThumbs:function()
{var myGamesDiv=$(this.workdiv);myGamesDiv.set('html','');new Element('ul',{'id':'myGamesList'}).injectInside(myGamesDiv);if(this.games.getLength()>0)
{this.games.each(function(game,key){var link='';link+='<a class="myGamesRemoveFixed" style="color:#FF0000; font-weight:bold;" href="javascript:removeMyGame(\''+key+'\');">X</a>';link+='<a style="font-weight: bold;" href="/'+translations["gameURL"]+'/'+game.gamecode+'.html">'+game.title;link+='<br/><img src="'+translations["staticURL"]+'/screenshots/'+key+'.jpg"';if(typeof game.desc!='undefined'&&$chk(game.desc)){link+='onmouseover="ddrivetip(\''+game.desc+'\');" onmouseout="hideddrivetip();"';}
link+='><br/><div class="categoryGameScore">'+translations["Score"]+': '+game.score+'</div></a>';new Element('div',{'class':'categoryGame'}).set('html',link).injectInside(myGamesDiv);});new Element('br',{'clear':'both'}).injectInside(myGamesDiv);}else{new Element('h4').set('html',translations["No games are saved in \'my games\'."]).injectInside(myGamesDiv);}},remove:function(key)
{this.games.erase(key);this.games.save();this.show();},addCurrentGame:function()
{if(this.id>'')
{this.games.set(this.id,this.fields);var keys=this.games.getKeys();if(keys.length>=20||!this.games.save())
{if($('gameMessage'))
$('gameMessage').innerHTML=translations["No space is left to save another game.<br/>First delete a game from the list."];}
else
{$('myGamesAdd').dispose();$('myGamesAlready').style.display='block';if($('gameMessage'))
$('gameMessage').innerHTML=translations["Game saved"];}}},setCurrentGame:function(id,fields)
{if(this.games.has(id))
{if($('myGamesAdd'))
$('myGamesAdd').dispose();if($('myGamesAlready'))
$('myGamesAlready').style.display='block';}
else
{this.id=id;this.fields=fields;if($('myGamesAlready'))
$('myGamesAlready').style.display='none';if($('myGamesAdd'))
$('myGamesAdd').style.display='block';}}});var clsGame=new Class({initialize:function(game,cat,data)
{this.game=game;this.category=cat;this.data=data;this.myGames=new clsMyGames;this.myGames.setCurrentGame(game,data);},addToMyGames:function()
{this.myGames.addCurrentGame();},challengeafriend:function(mailform)
{new Request.HTML({url:'/'+translations["gameURL"]+'/'+translations["challengeURL"],onSuccess:function(tree,elem,html,scripts)
{responseType=html.substr(0,html.indexOf(':'));message=html.substr(html.indexOf(':')+1);switch(responseType)
{case'OK':$('uitdaging').style.height='15px';$('uitdaging').set('html',message);opened=false;break;case'ERROR':$('resulttext').set('html',message);break;}}}).post($('form1'));},reportBroken:function()
{new Request.HTML({url:'/'+translations["defectURL"]+'/',update:'gameMessage'}).post({'game_id':this.game});},addHit:function()
{new Request.HTML({url:'/addhit'}).post({'game_id':this.game,'category_id':this.category});},resize:function(percentage)
{var gh=$('gameHolder');var mp=1+(percentage/100);gh.setStyle('width',(gh.getStyle('width').toInt()*mp));gh.setStyle('height',(gh.getStyle('height').toInt()*mp));}});var clsTabbox=new Class({initialize:function(game,score,votes,versions)
{this.game=game;this.score=score;this.votes=votes;this.gamekey=game;this.tabs=['description','more','reactions','share'];this.scrollpos=0;this.games=versions;if(this.games>1){$('game_backbutton').setStyle('display','block');}},switchTab:function(to)
{this.tabs.each(function(tab,index){var button=$('tabbutton_'+tab);if(button){var content=$('tab_'+tab);if(tab==to)
{button.addClass('active');content.setStyle('display','block');}
else
{button.removeClass('active');content.setStyle('display','none');}}});var holder=$('var_holder')||$('game_var_holder');if(holder){holder.setStyle('background-repeat','no-repeat');holder.setStyle('background-repeat','repeat-y');}},showScore:function(showScore,showText)
{if(showText)$('sterren_tekst').set('html',this.starText);if(showScore==0)showScore=0.1;var width=Math.round((showScore*9.5)-1);if(parseInt(width)<=0){width=56;}
$('sterren_balk').style.width=width+'px';},showChoice:function(choice)
{var choices=new Array(translations["bad"]+' (2)',translations["moderate"]+' (4)',translations["reasonable"]+' (6)',translations["good"]+' (8)',translations["very good"]+' (10)');$('sterren_tekst').set('html','<b>'+choices[(choice/2)-1]+'</b>');this.showScore(choice,false);},showStars:function()
{var votes=new Hash.Cookie('FG_session_gv',{duration:30*24*60*60});if(votes.has(this.gamekey))
{this.starText=translations["You rated this game"]+' '+(votes.get(this.gamekey).toInt())+'.';}
else
{var stars=$$('img.ster');stars.each(function(star,index){star.setStyle('cursor','pointer');star.addEvent('click',function(){objTabbox.vote((index+1)*2);});star.addEvent('mouseover',function(){objTabbox.showChoice((index+1)*2);});star.addEvent('mouseout',function(){objTabbox.showScore(objTabbox.score,true);});});this.starText=translations["You didn\'t vote yet"];}
$('sterren_tekst').set('html',this.starText);this.showScore(this.score,true);},vote:function(choice)
{var textdiv=$('sterren_tekst');var cookieVotes=new Hash.Cookie('FG_session_gv',{duration:30*24*60*60});if(cookieVotes.has(this.gamekey))
{return;}
else
{cookieVotes.set(this.gamekey,choice);cookieVotes.save();new Request.HTML({url:'/'+translations["voteURL"]+'/',update:textdiv}).get({'game':this.game,'vote':choice});var choices=new Array(translations["bad"],translations["moderate"],translations["reasonable"],translations["good"],translations["very good"]);var newscore=Math.round(((this.score*this.votes)+choice)/(this.votes+1)*10)/10;$('score').innerHTML=newscore;if(newscore>0){var textscore=translations["bad"];}
if(newscore>2){var textscore=translations["moderate"];}
if(newscore>4){var textscore=translations["reasonable"];}
if(newscore>6){var textscore=translations["good"];}
if(newscore>8){var textscore=translations["very good"];}
$('scoreDescription').innerHTML=textscore;$('votes').innerHTML=this.votes+1;var width=Math.round((Math.round(newscore)*9.5)-1);$('sterren_balk').style.width=width+'px';var stars=$$('img.ster');stars.each(function(star,index){star.removeEvents();star.setStyle('cursor','default');});this.showScore(newscore,false);}},mailafriend:function()
{new Request.HTML({url:'/'+translations['mailafriendURL'],update:'mailafriend_result'}).post($('mailafriend'));},postReaction:function()
{if(formChecked){new Request.HTML({url:'/'+translations['reactionURL'],onSuccess:function(tree,elems,html,js){if(html.substr(0,2)=='F:'){if($('captcha_notice')){$('captcha_notice').set('html',html.substr(2));$('captcha_notice').setStyle('display','inline');}else{alert(html.substr(2));}}else{$('insertMessage_result').set('html',html);var slider=new Fx.Slide('makeReactionInner');slider.slideOut();}}}).post($('insertMessage'));}},gameScroll:function(by)
{var orgpos=this.scrollpos;this.scrollpos+=by.toInt();if(this.scrollpos<0){this.scrollpos=0;}
$('game_container_'+orgpos).setStyle('display','none');$('game_container_'+this.scrollpos).setStyle('display','block');if(this.scrollpos>0){$('game_forwardbutton').setStyle('display','block');}else{$('game_forwardbutton').setStyle('display','none');}
if(this.scrollpos<this.games-1){$('game_backbutton').setStyle('display','block');}else{$('game_backbutton').setStyle('display','none');}}});function highscorePostName(e){do_send=true;have_error=false;if(e.username&&$chk(e.username.value))
{nameck=Cookie.write('userName',e.username.value,{duration:31,path:'/'});}
if(e.email&&$chk(e.email.value))
{have_error=true;mailck=Cookie.write('mailAdres',e.email.value,{duration:31,path:'/'});if(!isEmail(e.email.value))
{do_send=false;}}
if(do_send)
{namePosted=true;redirected=false;e.send();if(have_error)
$('error').set('html','');$('highscore').style.display='none';startLoading();}else{$('error').set('html',translations["A wrong mail address is given!"]);}
return false;}
function submitNewsletter(){new Request.HTML({url:'/'+translations["newsletterURL"],update:'newsletter_text'}).post($('newsletter_form'));}
function submitContact(name){if(typeof name=="undefined"){name='contact'}
new Request.HTML({url:'/'+translations["contactURL"],update:'contact_text',evalScripts:false,onSuccess:function(tree,elem,html,scripts){eval(scripts);}}).post($(name));}
function postEnquete(){if($('enquete_form'))
{tws_Session_age=parseInt($('enquete_form').age.value);if(!isNaN(tws_Session_age)&&tws_Session_age>1)
{tws_Session_gender=$('enquete_form').gender[0].checked?$('enquete_form').gender[0].value:($('enquete_form').gender[1].checked?$('enquete_form').gender[1].value:'');value=tws_Session_age+"|"+tws_Session_gender;Cookie.write("fg_enq",value,{duration:365,path:'/'});$('tabbox').setStyle('margin-top',$('enquete_div').style.marginTop);$('enquete_div').setStyle('display','none');if(typeof tws_Session!='undefined')tws_Session.ping(tws_Session_pageType+"|"+value,tws_Session_counters);}}}
function emptyBox(box){if(box.value=="naam van het spel..."){box.value="";}}
function setBanner(bannerHTML)
{obj=document.getElementById('bannerTop');if(obj)
{obj.innerHTML=bannerHTML;}}
function setSWF(flash,width,height,opts,flashvarsobj)
{if(typeof opts["allowNetworking"]=='undefined'){opts["allowNetworking"]='internal';}
if(typeof opts["wmode"]=='undefined'){opts["wmode"]='opaque';}
html='';html=html+'<object id="gameObject" type="application/x-shockwave-flash" data="'+flash+'" width="'+width+'" height="'+height+'" style="outline-width: 0pt; margin-bottom:-3px;';if(typeof opts["bgcolor"]!='undefined'){html=html+' background-color: #'+opts["bgcolor"]+';';}
html=html+'">';html=html+'<param name="movie" value="'+flash+'">';flashvars_param='';flashvars_embed='';if($chk(flashvarsobj))
{flashvars_param='<param name="FlashVars" value="tmp=ok';flashvars_embed='FlashVars="tmp=ok';$each(flashvarsobj,function(value,key)
{flashvars_param=flashvars_param+'&'+key+'='+value;flashvars_embed=flashvars_embed+'&'+key+'='+value;});flashvars_param=flashvars_param+'">';flashvars_embed=flashvars_embed+'"';}else{if(typeof opts["externalLinks"]=='undefined'||opts["externalLinks"]===0){html=html+'<param name="allowScriptAccess" value="sameDomain">';html=html+'<param name="allowNetworking" value="'+opts["allowNetworking"]+'">';}else if(opts["externalLinks"]===1){html=html+'<param name="allowNetworking" value="all">';}}
html=html+'<param name="quality" value="high">';if(opts["wmode"]!=false){html=html+'<param name="wmode" value="'+opts["wmode"]+'">';}
html=html+flashvars_param;html=html+'</object>';$('game_replace').set('html',html);}
function setDCR(flash,width,height)
{html='';html=html+'<object id="gameObject" CLASSID="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,0,0" width="'+width+'" height="'+height+'" bgcolor="#FAFDF1">';html=html+'<param name="src" value="'+flash+'">';html=html+'<param name="wmode" value="opaque">  ';html=html+'<embed id="gameEmbed" wmode="opaque" SRC="'+flash+'" width="100%" height="100%" pluginspage="http://www.macromedia.com/shockwave/download/" bgcolor="#FAFDF1"></embed>';html=html+'</object>';$('game_replace').set('html',html);}
function loadFlash(page,target,width,height,bgcolor){document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'">'
+'<param name="quality" value="high" />'
+'<param name="movie" value="'+page+'?clickTAG='+target+'" />'
+'<param name="flashvars" value="clickTAG='+target+'">'
+'<param name="bgcolor" value="'+bgcolor+'" />'
+'<param name="wmode" value="transparent" />'
+'<embed src="'+page+'?clickTAG='+target+'" flahsVars="clickTAG='+target+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" clickTAG="'+target+'" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" wmode="transparent"></embed>'
+'</object>');}
function launchPopup(file,width,height,type){var left=(screen.width/2)-(width/2);var top=(screen.height/2)-(height/2);var extra=0;var options="top="+top+","
+"left="+left+","
+"toolbar=0,"
+"location=0,"
+"directories=0,"
+"status=0,"
+"menubar=0,";if(type=='scroll'||type=='both'){options=options+"scrollbars=0,";extra=16;}else{options=options+"scrollbars=0,";}
if(type=='resize'||type=='both'){options=options+"resizable=1,";}else{options=options+"resizable=0,";}
options=options+"width="+(width+extra)+","
+"height="+height;time=new Date();mywindow=window.open(file,"mywindow_"+time.getTime(),options);mywindow.focus();}
function isEmail(string)
{var emailRegExp=new RegExp("^['a-z0-9\._-]+@([a-z0-9_-]+\.)+[a-z]{2,6}$","i");return emailRegExp.test(string);}
var formChecked=false;function checkForm(formname){formChecked=false;elems=$(formname).elements;checkradio=false;r=0;radiofields=new Array();tel=0;for(i=0;i<elems.length;i++){if(elems[i].type!='button'&&elems[i].type!='submit'){element=null;element=document.getElementById(elems[i].id);element_notice=document.getElementById(elems[i].name+'_notice');if(element_notice)
element_notice.style.display='none';if(element){if(element.className.indexOf('_req')>=0)
element.className=elems[i].className.replace('_req','');if(elems[i].value==''||elems[i].value==' '||elems[i].value=='  '){tel=tel+1;if(elems[i].className.indexOf('_req')==-1){elems[i].className=elems[i].className+'_req';if(element_notice)
element_notice.style.display='inline';}}else{if(elems[i].type=='checkbox'){if(elems[i].checked==false){tel=tel+1;if(elems[i].className.indexOf('_req')==-1){elems[i].className=elems[i].className+'_req';}}}
if(elems[i].type=='radio'){checkradio=true;radiofields[r]=elems[i].name;r++;}
if(elems[i].name.substr(0,5)=='email'){if(!isEmail(elems[i].value)||elems[i].value=='naam@emailadres.nl'){tel=tel+1;if(elems[i].className.indexOf('_req')==-1){elems[i].className=elems[i].className+'_req';if(element_notice)
element_notice.style.display='inline';}}}
if(elems[i].name.indexOf('password')>=0&&elems[i].value!=''&&$(elems[i].id+'2')){if(elems[i].value!=$(elems[i].id+'2').value){tel=tel+1;if(elems[i].className.indexOf('_req')==-1){elems[i].className=elems[i].className+'_req';if(element_notice)
element_notice.style.display='inline';}}}
if(elems[i].name.indexOf('email')>=0&&elems[i].value!=''&&$(elems[i].id+'2')){if(elems[i].value!=$(elems[i].id+'2').value){tel=tel+1;if(elems[i].className.indexOf('_req')==-1){elems[i].className=elems[i].className+'_req';if(element_notice)
element_notice.style.display='inline';}}}}}}}
if(tel==0){formChecked=true;try{document[formname].submit();}catch(err){$(formname).submit();}}else{return tel;}}
function textCounter(field,cntfield,maxlimit)
{if(field.value.length>maxlimit)
{field.value=field.value.substring(0,maxlimit);}
else
{cntfield.value=maxlimit-field.value.length;}}
function insertSmilie(tag,form,field)
{document.forms[form].elements[field].value+=tag;document.forms[form].elements[field].focus();}
function startLoading()
{divh=0;if($('banner')){$('banner').setStyle('display','block');divh=$('banner').offsetHeight;}
if($('zoom')){$('zoom').style.display='none';}
if($('pagelink')){$('pagelink').style.display='none';}
if(divh<240){redirect();}
else
{$('loadContainer').setStyle('display','block');$('redirect').setStyle('display','block');setTimeout('setLoadBar(100)',100);}}
function getFlashMovieObject(movieName)
{if(window.document[movieName])
{return window.document[movieName];}
if(navigator.appName.indexOf("Microsoft Internet")==-1)
{if(document.embeds&&document.embeds[movieName])
{return document.embeds[movieName];}}
else
{return document.getElementById(movieName);}}
function setLoadBar(amount)
{sbt=showbannertime;if(typeof banner_defaults["bannertime"]!=='undefined'&&parseInt(banner_defaults["bannertime"])>0){sbt=banner_defaults["bannertime"];}
rdt=redirecttime;allow_redirect=true;if(typeof banner_defaults["showbanner"]!=='undefined'&&parseInt(banner_defaults["bannertime"])>0){rdt=banner_defaults["showbanner"];allow_redirect=false;}
limit=(sbt*1000)-100;i=(amount/limit)*336;percent=Math.round((amount/limit)*100);if(parseInt($('loadbar').getStyle('width'))<=parseInt(i)){$('loadbar').setStyle('width',parseInt(i));$('loadpercent').set('html',percent+'%');}
if(!redirectlinkshow&&amount/1000>rdt){if(allow_redirect&&$('google_ads_div_Funnygames_336x280_Mochiads')){redirect();}else{$('redirectlink').set('html','<a href="javascript: redirect();">'+translations["Game is loaded. Click here to start the game."]+'</a>');redirectlinkshow=true;}}
if(amount>=(sbt*1000)){redirect();}else{setTimeout('setLoadBar('+(amount+100)+')',100);}}
function redirect()
{if(!redirected)
{if($('banner_container')){$('banner_container').setStyle('display','none');}
if($('banner')){$('banner').setStyle('display','none');}
if($('highscore_text')){$('highscore_text').setStyle('display','block');}
if($('game_replace')){if(typeof game_popup!='undefined'&&game_popup){$('game_replace').setStyle('position','relative');$('game_replace').setStyle('top','0px');$('game_replace').setStyle('left','0px');$('game_replace').setStyle('margin','0px auto');}else{$('game_replace').setStyle('top','0px');$('game_replace').setStyle('left','50%');$('game_replace').setStyle('margin-left',-(game_width/2));if($('enquete_div')){$('enquete_div').setStyle('margin-top',(game_height+20));}else if($('tabbox')){$('tabbox').setStyle('margin-top',(game_height+20));}else{window.addEvent('domready',function(){if($('enquete_div')){$('enquete_div').setStyle('margin-top',(game_height+20));}else if($('tabbox')){$('tabbox').setStyle('margin-top',(game_height+20));}});}}
$('game_replace').setStyle('width',game_width);$('game_replace').setStyle('height',game_height);}
if($('zoom')){$('zoom').style.display='block';}
if($('pagelink')&&$('google_ads_div_FunnyGames_tekstlink')){$('pagelink').style.display='block';}
if($('subContent_sliderBar')){$('subContent_sliderBar').setStyle('display','block');}
var cookie=Cookie.read('fg_enq');if(!cookie)
{if($('enquete_div')){$('enquete_div').setStyle('display','block');}else{window.addEvent('domready',function(){if($('enquete_div')){$('enquete_div').setStyle('display','block');}});}}
else
{if($('tabbox')){$('tabbox').setStyle('margin-top',(game_height+20));}else{window.addEvent('domready',function(){if($('tabbox')){$('tabbox').setStyle('margin-top',(game_height+20));}});}}
iframe=$('game_iframe');if(iframe){iframe.setStyle('visibility','visible');}
if($('loadContainer')){$('loadContainer').setStyle('display','none');}
if($('redirect')){$('redirect').setStyle('display','none');}
if($('var_bottom')){$('var_bottom').setStyle('backgroundPosition','bottom');}
redirected=true;}}
var offsetfromcursorX=12
var offsetfromcursorY=10
var offsetdivfrompointerX=14
var offsetdivfrompointerY=9
var ie=document.all
var ns6=document.getElementById&&!document.all
var enabletip1=false
var enabletip2=false
if(ie)
ieaftrek=9
else
ieaftrek=1
var tipobj1=null;var tipobj2=null;var pointerobj=null;var pointerobj2=null;function ietruebody()
{return(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body}
function ddrivetip(thetext,thewidth,type,thecolor)
{if(ns6||ie)
{tipobj1=document.all?document.all["dhtmltooltip1"]:document.getElementById?document.getElementById("dhtmltooltip1"):""
tipobj2=document.all?document.all["dhtmltooltip2"]:document.getElementById?document.getElementById("dhtmltooltip2"):""
pointerobj=document.all?document.all["dhtmlpointer"]:document.getElementById?document.getElementById("dhtmlpointer"):""
pointerobj2=document.all?document.all["dhtmlpointer2"]:document.getElementById?document.getElementById("dhtmlpointer2"):""
if(type==1||typeof type=="undefined"){if(typeof thewidth!="undefined")tipobj1.style.width=thewidth+"px"
if(typeof thecolor!="undefined"&&thecolor!="")tipobj1.style.backgroundColor=thecolor
if(tipobj1){tipobj1.innerHTML=thetext
enabletip1=true}}else if(type==2){if(typeof thewidth!="undefined")tipobj2.style.width=thewidth+"px"
if(typeof thecolor!="undefined"&&thecolor!="")tipobj2.style.backgroundColor=thecolor
if(tipobj2){tipobj2.innerHTML=thetext
enabletip2=true}}
return false}}
function positiontip(e)
{if(typeof do_ech_mousemove!="undefined"&&do_ech_mousemove){ech_mousemove(e)}
if(enabletip1||enabletip2)
{var nondefaultpos=false
var curX=(ns6)?e.pageX:event.clientX+ietruebody().scrollLeft;var curY=(ns6)?e.pageY:event.clientY+ietruebody().scrollTop;var winwidth=ie&&!window.opera?ietruebody().clientWidth:window.innerWidth-20
var winheight=ie&&!window.opera?ietruebody().clientHeight:window.innerHeight-20
var rightedge=ie&&!window.opera?winwidth-event.clientX-offsetfromcursorX:winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera?winheight-event.clientY-offsetfromcursorY:winheight-e.clientY-offsetfromcursorY
var leftedge=(offsetfromcursorX<0)?offsetfromcursorX*(-1):-1000
if(rightedge<tipobj1.offsetWidth||rightedge<tipobj2.offsetWidth)
{tipobj1.style.left=curX-tipobj1.offsetWidth+"px"
tipobj2.style.left=curX-tipobj2.offsetWidth+"px"
nondefaultpos=true}
else if(curX<leftedge)
{tipobj1.style.left="5px"
tipobj2.style.left="5px"}
else
{tipobj1.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
tipobj2.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
pointerobj2.style.left=curX+offsetfromcursorX+"px"}
tipobj1.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
tipobj2.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj2.style.top=curY+offsetfromcursorY+"px"
pointerobj2.style.visibility="visible"
pointerobj.style.visibility="hidden"
if(enabletip1){tipobj1.style.visibility="visible"}else if(enabletip2){tipobj2.style.visibility="visible"}}}
function hideddrivetip()
{if(ns6||ie)
{enabletip1=false
enabletip2=false
tipobj1=document.all?document.all["dhtmltooltip1"]:document.getElementById?document.getElementById("dhtmltooltip1"):"";tipobj2=document.all?document.all["dhtmltooltip2"]:document.getElementById?document.getElementById("dhtmltooltip2"):"";pointerobj=document.all?document.all["dhtmlpointer"]:document.getElementById?document.getElementById("dhtmlpointer"):"";pointerobj2=document.all?document.all["dhtmlpointer2"]:document.getElementById?document.getElementById("dhtmlpointer2"):"";if(tipobj1){tipobj1.style.visibility="hidden";tipobj1.style.left="-1000px";tipobj1.style.backgroundColor='';tipobj1.style.width='';}
if(tipobj2){tipobj2.style.visibility="hidden";tipobj2.style.left="-1000px";tipobj2.style.backgroundColor='';tipobj2.style.width='';}
if(pointerobj){pointerobj.style.visibility="hidden";}
if(pointerobj2){pointerobj2.style.visibility="hidden";}}}
document.onmousemove=positiontip;function noError()
{return true;}
var opened=false;var startHeight=258;var first=true;var mailCount=1;var fetched_height=false;function togglechallenge(do_action,mail,name)
{if(!fetched_height)
{fetched_height=$('uitdaging').getStyle('height');}
if(!opened||do_action=='show')
{$('uitdaging').setStyle('height',startHeight);opened=true;}
else
{$('uitdaging').setStyle('height',fetched_height);opened=false;}
if(mail!=undefined)
{document.getElementById('naar_email').value=mail;}
if(name!=undefined)
{document.getElementById('naar_naam').value=name;}}
function moreChallenges()
{mailCount++;new_table='<div id="challengers_table_'+mailCount+'"><table style="width: 100%;"><tr>';new_table+='<td style="width: 40px;">Naam:</td><td style="width: 90px;"><input class="formfield" name="to_name['+mailCount+']" id="to_name['+mailCount+']" type="text" style="width: 85px;"/></td>';new_table+='<td style="width: 40px;">E-mail:</td><td style="width: 130px;"><input class="formfield" name="to_email['+mailCount+']" id="to_email['+mailCount+']" type="text" style="width: 125px;"/></td>';new_table+='</tr></table></div><div id="challengers"></div>';obj=document.getElementById('challengers');obj.id=('challengers_'+mailCount);obj.innerHTML=new_table;if(first)
{first=false;startHeight=startHeight+30;}
else
{startHeight=startHeight+26;}
$('uitdaging').style.height=startHeight+'px';$('lessPeople').style.display='block';}
function lessChallenges()
{if(mailCount>1)
{startHeight=startHeight-26;$('uitdaging').style.height=startHeight+'px';obj_name='challengers_table_'+mailCount;obj=document.getElementById(obj_name);obj.innerHTML="";obj.style.display='none';obj.id=obj.id+'_removed';mailCount=mailCount-1;}
else
{$('lessPeople').style.display='none';}}
function replayGame(gotoURL)
{req=new Request.HTML({url:'/highscores/preventname'}).post({"play_again":"yes"});window.location=gotoURL;}
function showHighscorePage(code,type,page)
{req=new Request.HTML({url:'/'+translations["highscoresURL"]+'/'+code+'/'+type+'/'+page,onComplete:function(tree,elem,html,script){$('tab_'+type).set('html',html);}}).send();}
function addslashes(str){return(str+'').replace(/([\\"'])/g,"\\$1").replace(/\0/g,"\\0").replace(/([\n\r])/g,"");}
var divids=new Array();for(x=0;x<23;x++){divids[x]=new Array();}
divids[0]['id']='game_var_cadre_title';divids[1]['id']='game_title_repeat';divids[2]['id']='header_holder';divids[3]['id']='header_repeat';divids[4]['id']='menu_holder';divids[5]['id']='menu_repeat';divids[6]['id']='game_var_holder_repeat';divids[7]['id']='game_var_holder';divids[8]['id']='game_var_cadre_holder';divids[9]['id']='game_var_cadre_holder_middle';divids[10]['id']='game_var_cadre_bottom_repeat';divids[11]['id']='game_var_cadre_bottom';divids[12]['id']='game_var_cadre_top';divids[13]['id']='game_var_main_top_repeat';divids[14]['id']='game_var_main_top';divids[15]['id']='main_bg_top_repeat';divids[16]['id']='main_bg_top';divids[17]['id']='bottom_repeat';divids[18]['id']='bottom_holder';divids[19]['id']='var_bottom_repeat';divids[20]['id']='game_var_bottom';divids[21]['id']='footer';divids[22]['id']='bottom_flags';var game_sizes=[400,500,600,700,800,900,1000,1100];function set_original_sizes(){for(var i=0;i<divids.length;i++){if($(divids[i]['id'])){divids[i]['width']=$(divids[i]['id']).offsetWidth;divids[i]['height']=$(divids[i]['id']).offsetHeight;}}}
function set_original(){if(parseInt($('game_replace').style.width.substr(0,$('game_replace').style.width.indexOf('px')))>$('game_original_width').value){while(parseInt($('game_replace').style.width.substr(0,$('game_replace').style.width.indexOf('px')))>$('game_original_width').value){zoom(0);}}else{while(parseInt($('game_replace').style.width.substr(0,$('game_replace').style.width.indexOf('px')))<$('game_original_width').value){zoom(1);}}}
function zoom(type){var current_size=-1;for(var x=0;x<game_sizes.length&&current_size<0;x++){if(parseInt($('game_replace').offsetWidth-game_sizes[x])<100&&parseInt($('game_replace').offsetWidth-game_sizes[x])>=0){if(type==0){next_width=game_sizes[x-1];}else if(type==1){next_width=game_sizes[x+1];}
next_height=$('game_original_height').value*(next_width/$('game_original_width').value);current_size=x;}}
diff_width=next_width-$('game_replace').offsetWidth;diff_height=next_height-$('game_replace').offsetHeight;if(next_width>400){$('zoom_out').setStyle('display','block');}else{$('zoom_out').setStyle('display','none');}
if(next_width>600||(type==0&&next_width>=600)){if(diff_width+$('game_var_cadre_top').offsetWidth<divids[12]['width']){diff_width=divids[12]['width']-$('game_var_cadre_top').offsetWidth;}
var halfbannerLeft=$('halfbanner').style.left;if($('halfbanner').style.left==''){mHalfbanner=470+diff_width+$('header_repeat').offsetWidth;}else{mHalfbanner=parseInt(halfbannerLeft.substr(0,halfbannerLeft.indexOf('px')))+diff_width;}
var uberholderMarginLeft=$('uberholder').style.marginLeft;if($('uberholder').style.marginLeft==''){if($('game_original_width').value>640){mUberholder=((($('game_original_width').value-640)/2)*-1)-365-(diff_width/2);}else{mUberholder=-365-(diff_width/2);}}else{mUberholder=uberholderMarginLeft.substr(0,uberholderMarginLeft.indexOf('px'))-(diff_width/2);}
var skyScraperLeft=$('skyScraper').style.left;if($('skyScraper').style.left==''){if($('game_original_width').value>=640){mSkyScraper=parseInt($('game_original_width').value)+diff_width+100;}else if($('game_original_width').value>600){mSkyScraper=next_width+((parseInt($('game_original_width').value)+diff_width-600)/2)+70;}else{mSkyScraper=next_width+140;}}else{mSkyScraper=parseInt(skyScraperLeft.substr(0,skyScraperLeft.indexOf('px')))+diff_width;}
var suggestboxLeft=$('suggestbox').style.left;if($('suggestbox').style.left==''){mSuggestbox=466+diff_width;}else{mSuggestbox=parseInt(suggestboxLeft.substr(0,suggestboxLeft.indexOf('px')))+diff_width;}
for(var y=0;y<divids.length;y++){if($(divids[y]['id'])!=null){$(divids[y]['id']).setStyle('width',$(divids[y]['id']).offsetWidth+diff_width+'px');}}
if(obj=$('sideHeaderLeft')){obj.style.left=Math.floor(parseInt(obj.style.left)-diff_width)+'px';}
if(obj=$('sideHeaderCenter')){obj.style.left=Math.floor(parseInt(obj.style.left)-diff_width/2)+'px';}
if(obj=$('b_header_center')){obj.style.left=Math.floor(parseInt(obj.style.left)-diff_width/2)+'px';}
$('game_var_cadre_holder_right').style.left=(356+diff_width)+'px';$('uberholder').style.marginLeft=mUberholder+'px';$('skyScraper').style.left=mSkyScraper+'px';$('tabbox').style.marginLeft=(next_width-608)/2+'px';$('halfbanner').style.left=mHalfbanner+'px';$('suggestbox').style.left=mSuggestbox+'px';$('gameHolder').style.marginLeft=($('game_var_cadre_top').offsetWidth-next_width)/2+'px';$('gameHolder').style.marginRight=($('game_var_cadre_top').offsetWidth-next_width)/2+'px';}
$('game_replace').style.width=next_width+'px';$('game_replace').style.height=next_height+'px';$('game_replace').setStyle('margin-left',-(next_width/2));if($('enquete_div')&&$('enquete_div').style.display=='block'){$('enquete_div').setStyle('margin-top',(next_height+20));}else{$('tabbox').setStyle('margin-top',(next_height+20));}
if(next_width==1100){$('zoom_in').setStyle('display','none');}else{$('zoom_in').setStyle('display','block');}
if(next_width==400&&type==0){$('zoom_out').setStyle('display','none');}else{$('zoom_out').setStyle('display','block');}}
function showDownloadSteps(link,gameid)
{var show_IE=true;source_n='/images/'+translations['domainExtension']+'/download_now.gif';source_o='/images/'+translations['domainExtension']+'/download_now_over.gif';button_link='<a href="'+link+'" '+(gameid?'onclick="document.location.href=\''+link+'\'; if (typeof tws_Session != \'undefined\') tws_Session.ping(tws_Session_counters, \'downloads\', \'Download'+gameid+'\'); return false;"':'')+'><img src="'+source_n+'" onmouseover="this.src=\''+source_o+'\'" onmouseout="this.src=\''+source_n+'\'"></a>';if(Browser.Engine.gecko){show_IE=false;html='<p>'+translations["Step 1"]+': '+translations["Click the download button below:"]+'</p>';html=html+button_link;html=html+'<p>'+translations["Step 2"]+': '+translations["Click \"Save\" and select a location to store the file."]+'</p>';html=html+'<p>'+translations["Step 3"]+': '+translations["Open the downloaded file and follow the onscreen instructions for the installation."]+'</p>';}
if(Browser.Engine.webkit){show_IE=false;html='<p>'+translations["Step 1"]+': '+translations["Click the download button below:"]+'</p>';html=html+button_link;html=html+'<p>'+translations["Step 2"]+': '+translations["Select \"Save\" in the bottom bar."]+'</p>';html=html+'<p>'+translations["Step 3"]+': '+translations["Choose 'Run' and follow the onscreen instructions for the installation."]+'</p>';}
if(Browser.Engine.presto){show_IE=false;html='<p>'+translations["Step 1"]+': '+translations["Click the download button below:"]+'</p>';html=html+button_link;html=html+'<p>'+translations["Step 2"]+': '+translations["Choose 'Run' and follow the onscreen instructions for the installation."]+'</p>';}
if(Browser.Engine.trident||show_IE){html='<p>'+translations["Step 1"]+': '+translations["Click the download button below:"]+'</p>';html=html+button_link;html=html+'<p>'+translations["Step 2"]+': '+translations["Choose 'Run' and follow the onscreen instructions for the installation."]+'</p>';}
document.write(html);}
var plugin={'flash':{'name':'Shockwave Flash','installed':false,version:0,'checkVersion':true,'startVersion':3,'ActiveX':'ShockwaveFlash.ShockwaveFlash','mime':'application/x-shockwave-flash'},'director':{'name':'Shockwave Director','installed':false,version:0,'checkVersion':false,'startVersion':7,'ActiveX':'SWCtl.SWCtl','mime':'application/x-director'}};for(var i in plugin){if(navigator.mimeTypes&&navigator.mimeTypes.length)
{x=navigator.mimeTypes[plugin[i].mime];if(x&&x.enabledPlugin)
{plugin[i].installed=true;y=x.enabledPlugin.description;plugin[i].description=y;plugin[i].version=y.substr(0,y.indexOf('.')).substr(y.substr(0,y.indexOf('.')).lastIndexOf(' '));}}
else if(navigator.userAgent.indexOf("MSIE")>=0&&(navigator.appVersion.indexOf("Win")!=-1))
{if(plugin[i].checkVersion==true){if(versionIsInstalledIE(plugin[i].ActiveX+'.',1))
{plugin[i].installed=true;found=false;for(var k=plugin[i].startVersion;found==false;k++)
{if(!versionIsInstalledIE(plugin[i].ActiveX+'.',k))
{found=true;plugin[i].version=k-1;}}}else{plugin[i].installed=false;}}else{plugin[i].installed=versionIsInstalledIE(plugin[i].ActiveX,'');}}else{plugin[i].installed=false;}}
function versionIsInstalledIE(component,version)
{component_version=component+''+version;try
{flash=new ActiveXObject(component_version);return true;}
catch(e)
{return false;}}
plugin.java={'name':'Java','installed':navigator.javaEnabled(),version:0,'checkVersion':false,'ActiveX':'','mime':''};var selected=0;var resultcount=0;var showresults=5;var globalname='';var globalresults='';function suggestsearch()
{text=$('searchInput').value;if(text.length>2&&text!=translations["search game"]+'...'){$('suggestbox').style.display='block';if(globalname!=text){globalname=text;var jsonRequest=new Request.JSON({url:'/'+translations["gameURL"]+'/suggestsearch',onSuccess:function(results)
{suggest_active=true;globalresults=results;fillsuggestbox(results);}}).post({'text':text});}else{fillsuggestbox(globalresults);}
window.onclick=function(){hideSuggestSearch();};document.onclick=function(){hideSuggestSearch();};}}
function hideSuggestSearch()
{if(!suggest_active){$('suggestbox').style.display='none';window.onclick=function(){};document.onclick=function(){};}}
function fillsuggestbox(results)
{if(results.length>0){if(results.length<5){showresults=5;}
resultcount=(showresults<results.length)?showresults:results.length;$('suggestbox').style.height=((showresults<results.length)?(resultcount*32+35):(resultcount*32))+'px';$('suggestbox').innerHTML='';for(var i=0;i<resultcount;i++)
{var div=document.createElement("div");if(selected==(i+1)){classText=' class="search_active"';}else{classText=' class="search_inactive"';}
html='<a'+classText+' href="/'+translations["gameURL"]+'/'+results[i].code+'.html" onMouseOver="ddrivetip(\'<img src='+translations['staticURL']+'screenshots/'+results[i].screen_id+'.jpg width=185 height=145 />\',185,2);" onMouseOut="hideddrivetip();">';html=html+'<img src="'+translations["staticURL"]+'screenshots/'+results[i].screen_id+'.jpg" width="33px" height="26px" alt="'+results[i].name+'" title="'+results[i].name+'" />';html=html+'<div class="suggestlink">'+results[i].name+'</div>'
html=html+'</a>';div.innerHTML=html;$('suggestbox').appendChild(div);};if(showresults>5&&showresults<results.length){var all_results=document.createElement("div");all_results.innerHTML='<a class="search_showall" style="background-position: 0px -16px;" href="" onclick="javascript:showresults = 5; fillsuggestbox(globalresults); return false;">'+translations["Show less results"]+'</a>';$('suggestbox').appendChild(all_results);}else if(showresults<=5&&showresults<results.length){var all_results=document.createElement("div");all_results.innerHTML='<a class="search_showall" href="" onclick="javascript:showresults = 10; fillsuggestbox(globalresults); return false;">'+translations["Show more results"]+'</a>';$('suggestbox').appendChild(all_results);}
if(showresults<results.length){var all_results=document.createElement("div");all_results.innerHTML='<a class="search_showall" href="/'+translations["searchURL"]+'/?s='+$('searchInput').value+'">'+translations["Show all results"]+' ('+results.length+')</a>';$('suggestbox').appendChild(all_results);}
if(selected<=1||selected>resultcount){show=0;}else{show=selected-1;}}}
function setSearchLargeScreenshot(info)
{if($('search_big_screenshot')){$('search_big_screenshot').src=translations['staticURL']+'screenshots/'+info.screen_id+'.jpg';$('search_big_screenshot').alt=info.name
$('search_big_screenshot').title=info.name;$('search_big_screenshot_link').href='/'+translations["gameURL"]+'/'+info.code+'.html';}}
function showOverlay(url){try
{showOverlayBox('overlay_content');}
catch(err)
{if(!$('overlay_content')){div=document.createElement('div');div.id='overlay_content';$('uberholder').appendChild(div);}}
new Request.HTML({url:url,evalScripts:false,onSuccess:function(tree,elem,html,scripts)
{$('overlay_content').set('html',html);eval(scripts);}}).get();}
function submitLogin()
{new Request.HTML({url:'/user/index/login',onSuccess:function(tree,elem,html,scripts)
{eval(scripts);}}).post($('login_frm'));}
function submitRetrieve()
{if($('password'))
{if($('password').value==''||$('password').value!=$('password2').value)
{$('retrieve_response').innerHTML='Passwords do not match!';return false;}}else{new Request.HTML({url:'/user/index/retrievepassword',onSuccess:function(tree,elem,html,scripts)
{eval(scripts);}}).post($('retrieve_frm'));return true;}}
function submitForm(formname,url)
{new Request.HTML({url:url,onSuccess:function(tree,elem,html,scripts)
{eval(scripts);if(formname=='modify_frm'||formname=='editpassword_frm'){location.reload();}}}).post($(formname));}
function setLoginVars(reloadFavorites)
{try{hideOverlay();if(reloadFavorites){reloadFavorites();}}catch(err){parent.hideOverlay();if(reloadFavorites){parent.reloadFavorites();}}
if(parent.document.getElementById('login_link')){parent.document.getElementById('mydata_link').innerHTML='Mijn gegevens';parent.document.getElementById('login_bull').innerHTML='&bull;';parent.document.getElementById('login_link').href="/user/index/logout/";parent.document.getElementById('login_link').innerHTML='Log uit';parent.document.getElementById('login_link').onclick=function(){};}}
function checkLoggedIn()
{new Request.HTML({url:'/user/index/islogged',onSuccess:function(tree,elem,html,scripts)
{if(html=='ok'){if(parent.document.getElementById('login_link')){parent.document.getElementById('mydata_link').innerHTML='Mijn gegevens';parent.document.getElementById('login_bull').innerHTML='&bull;';parent.document.getElementById('login_link').href="/user/index/logout/";parent.document.getElementById('login_link').innerHTML='Log uit';parent.document.getElementById('login_link').onclick=function(){};}}}}).get();}
function hideOverlay()
{try{hideOverlayBox('overlay_content');}catch(err){if($('overlay')){}
if($('overlay_content')){$('overlay_content').destroy();}}}
function reloadFavorites()
{if(parent.document.getElementById('myfavourites')){qmark=parent.document.getElementById('myfavourites').src.indexOf('?');if(qmark>0){thesrc=parent.document.getElementById('myfavourites').src.substr(0,qmark);}else{thesrc=parent.document.getElementById('myfavourites').src;}
parent.document.getElementById('myfavourites').src=thesrc+'?time'+(new Date).getTime()}}
function pageHeight()
{var result=0;if(window.innerHeight&&window.scrollMaxY)result=window.innerHeight+window.scrollMaxY;else if(document.body.scrollHeight>document.body.offsetHeight)result=document.body.scrollHeight;else result=document.body.offsetHeight;var result2=Math.max(document.body&&document.body.scrollHeight||0,document.documentElement&&document.documentElement.scrollHeight||0);if(result2>result)result=result2;return result;}
function scrollY()
{if(typeof(window.pageYOffset)=='number')return window.pageYOffset;else if(document.body&&(document.body.scrollLeft||document.body.scrollTop))return document.body.scrollTop;else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop))return document.documentElement.scrollTop;return 0;}
function showOverlayBox(boxName)
{if(Browser.Engine.name!='presto')
$(boxName).style.top=scrollY()+'px';$(boxName).style.display="block";$('overlaybox').style.height=pageHeight()+'px';$('overlaybox').style.display="block";}
function hideOverlayBox(boxName)
{$('overlaybox').style.display="none";$(boxName).style.display="none";if($('overlay_content')){$('overlay_content').innerHTML='';}}
function showEditFields()
{$('static_edit_fields').style.display="none";$('form_edit_fields').style.display="block";}
function hideEditFields()
{$('static_edit_fields').style.display="block";$('form_edit_fields').style.display="none";}
function showChangePasswordFields()
{$('static_password_fields').style.display="none";$('form_password_fields').style.display="block";}
function hideChangePasswordFields()
{$('static_password_fields').style.display="block";$('form_password_fields').style.display="none";}
function getXMLDoc(xml)
{try
{xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.loadXML(xml);}
catch(e)
{parser=new DOMParser();xmlDoc=parser.parseFromString(xml,"text/xml");}
return xmlDoc;}
function getNodeContent(node)
{var result="";if(node&&node.firstChild)
{result=node.firstChild.nodeValue;}
return result;}
function getgeodata()
{if(!Cookie.read('geoip')){new Request({url:'/getgeodata',onSuccess:function(text,xml){Cookie.write('geoip',text,'/');}}).get();}}
function setgeodata()
{if(Cookie.read('geoip')){geoip=getXMLDoc(Cookie.read('geoip'));try{geoip_continent_code=getNodeContent(geoip.getElementsByTagName('geoip_continent_code')[0]);geoip_country_code=getNodeContent(geoip.getElementsByTagName('geoip_country_code')[0]);geoip_country_name=getNodeContent(geoip.getElementsByTagName('geoip_country_name')[0]);geoip_region=getNodeContent(geoip.getElementsByTagName('geoip_region')[0]);geoip_city=getNodeContent(geoip.getElementsByTagName('geoip_city')[0]);geoip_dma_code=getNodeContent(geoip.getElementsByTagName('geoip_dma_code')[0]);geoip_area_code=getNodeContent(geoip.getElementsByTagName('geoip_area_code')[0]);geoip_latitude=getNodeContent(geoip.getElementsByTagName('geoip_latitude')[0]);geoip_longitude=getNodeContent(geoip.getElementsByTagName('geoip_longitude')[0]);region_code=getNodeContent(geoip.getElementsByTagName('region_code')[0]);if(Cookie.read("banner_env")=='testorder'){window.addEvent('domready',function(){notify=document.createElement('div');notify.style.position='fixed';notify.style.top='60px';notify.style.right='0px';notify.style.width='150px';notify.style.height='35px';notify.style.border='1px solid red';notify.style.backgroundColor='#004D72';notify.style.color='white';notify.style.textAlign='center';notify.style.zIndex='2147483647';notify.innerHTML='Current Region:<br/><strong>'+region_code+'</strong>';document.getElementById('index').appendChild(notify);});}
GA_googleAddAttr("Region",region_code);}catch(e){}}}
getgeodata();function gcom(game_id,session,score,uname){if(game.game&&game.game==game_id&&score>=0){f=document.createElement('form');f.id='submitform';f.name='submotform';f.action='/submitscore';f.method='POST';i1=document.createElement('input');i1.type='hidden';i1.name='session';i1.value=session;f.appendChild(i1);i2=document.createElement('input');i2.type='hidden';i2.name='score';i2.value=score;f.appendChild(i2);i3=document.createElement('input');i3.type='hidden';i3.name='game_id';i3.value=game.game;f.appendChild(i3);if(typeof uname!='undefined'&&uname!==null)
{i4=document.createElement('input');i4.type='hidden';i4.name='username';i4.value=uname;f.appendChild(i4);}
document.body.appendChild(f);$('submitform').submit();}}
var Slimbox=(function(){var F=window,n=Browser.Engine.trident4,u,g,G=-1,o,w,E,v,y,M,s,m={},t=new Image(),K=new Image(),I,a,h,q,J,e,H,c,A,L,x,i,d,C;F.addEvent("domready",function(){$(document.body).adopt($$(I=new Element("div",{id:"lbOverlay",events:{click:D}}),a=new Element("div",{id:"lbCenter"}),H=new Element("div",{id:"lbBottomContainer"})).setStyle("display","none"));h=new Element("div",{id:"lbImage"}).injectInside(a).adopt(q=new Element("div",{styles:{position:"relative"}}).adopt(J=new Element("a",{id:"lbPrevLink",href:"#",events:{click:B}}),e=new Element("a",{id:"lbNextLink",href:"#",events:{click:f}})));c=new Element("div",{id:"lbBottom"}).injectInside(H).adopt(new Element("a",{id:"lbCloseLink",href:"#",events:{click:D}}),A=new Element("div",{id:"lbCaption"}),L=new Element("div",{id:"lbNumber"}),new Element("div",{styles:{clear:"both"}}))});function z(){var N=F.getScroll(),O=F.getSize();$$(a,H).setStyle("left",N.x+(O.x/2));if(v){I.setStyles({left:N.x,top:N.y,width:O.x,height:O.y})}}function l(N){["object",n?"select":"embed"].forEach(function(P){Array.forEach(document.getElementsByTagName(P),function(Q){if(N){Q._slimbox=Q.style.visibility}Q.style.visibility=N?"hidden":Q._slimbox})});I.style.display=N?"":"none";var O=N?"addEvent":"removeEvent";F[O]("scroll",z)[O]("resize",z);document[O]("keydown",p)}function p(O){var N=O.code;return u.closeKeys.contains(N)?D():u.nextKeys.contains(N)?f():u.previousKeys.contains(N)?B():false}function B(){return b(w)}function f(){return b(E)}function b(N){if(N>=0){G=N;o=g[N][0];w=(G||(u.loop?g.length:0))-1;E=((G+1)%g.length)||(u.loop?0:-1);r();a.className="lbLoading";m=new Image();m.onload=k;m.src=o}return false}function k(){a.className="";d.set(0);h.setStyles({backgroundImage:"url("+o+")",display:""});q.setStyle("width",m.width);$$(q,J,e).setStyle("height",m.height);A.set("html",g[G][1]||"");L.set("html",(((g.length>1)&&u.counterText)||"").replace(/{x}/,G+1).replace(/{y}/,g.length));if(w>=0){t.src=g[w][0]}if(E>=0){K.src=g[E][0]}M=h.offsetWidth;s=h.offsetHeight;var P=Math.max(0,y-(s/2)),N=0,O;if(a.offsetHeight!=s){N=i.start({height:s,top:P})}if(a.offsetWidth!=M){N=i.start({width:M,marginLeft:-M/2})}O=function(){H.setStyles({width:M,top:P+s,marginLeft:-M/2,visibility:"hidden",display:""});d.start(1)};if(N){i.chain(O)}else{O()}}function j(){if(w>=0){J.style.display=""}if(E>=0){e.style.display=""}C.set(-c.offsetHeight).start(0);H.style.visibility=""}function r(){m.onload=$empty;m.src=t.src=K.src=o;i.cancel();d.cancel();C.cancel();$$(J,e,h,H).setStyle("display","none")}function D(){if(G>=0){r();G=w=E=-1;a.style.display="none";x.cancel().chain(l).start(0)}return false}Element.implement({slimbox:function(N,O){$$(this).slimbox(N,O);return this}});Elements.implement({slimbox:function(N,Q,P){Q=Q||function(R){return[R.href,R.title]};P=P||function(){return true};var O=this;O.removeEvents("click").addEvent("click",function(){var R=O.filter(P,this);return Slimbox.open(R.map(Q),R.indexOf(this),N)});return O}});return{open:function(P,O,N){u=$extend({loop:false,overlayOpacity:0.8,overlayFadeDuration:400,resizeDuration:400,resizeTransition:false,initialWidth:250,initialHeight:250,imageFadeDuration:400,captionAnimationDuration:400,counterText:"Image {x} of {y}",closeKeys:[27,88,67],previousKeys:[37,80],nextKeys:[39,78]},N||{});x=new Fx.Tween(I,{property:"opacity",duration:u.overlayFadeDuration});i=new Fx.Morph(a,$extend({duration:u.resizeDuration,link:"chain"},u.resizeTransition?{transition:u.resizeTransition}:{}));d=new Fx.Tween(h,{property:"opacity",duration:u.imageFadeDuration,onComplete:j});C=new Fx.Tween(c,{property:"margin-top",duration:u.captionAnimationDuration});if(typeof P=="string"){P=[[P,O]];O=0}y=F.getScrollTop()+(F.getHeight()/2);M=u.initialWidth;s=u.initialHeight;a.setStyles({top:Math.max(0,y-(s/2)),width:M,height:s,marginLeft:-M/2,display:""});v=n||(I.currentStyle&&(I.currentStyle.position!="fixed"));if(v){I.style.position="absolute"}x.set(0).start(u.overlayOpacity);z();l(1);g=P;u.loop=u.loop&&(g.length>1);return b(O)}}})();Slimbox.scanPage=function(){$$(document.links).filter(function(el){return el.rel&&el.rel.test(/^lightbox/i);}).slimbox({},null,function(el){return(this==el)||((this.rel.length>8)&&(this.rel==el.rel));});};window.addEvent("domready",Slimbox.scanPage);