var Prototype={Version:"1.5.1.1",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:(document.createElement("div").__proto__!==document.createElement("form").__proto__)},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};var Class={create:function(){return function(){this.initialize.apply(this,arguments)}}};var Abstract=new Object();Object.extend=function(a,c){for(var b in c){a[b]=c[b]}return a};Object.extend(Object,{inspect:function(a){try{if(a===undefined){return"undefined"}if(a===null){return"null"}return a.inspect?a.inspect():a.toString()}catch(b){if(b instanceof RangeError){return"..."}throw b}},toJSON:function(a){var c=typeof a;switch(c){case"undefined":case"function":case"unknown":return;case"boolean":return a.toString()}if(a===null){return"null"}if(a.toJSON){return a.toJSON()}if(a.ownerDocument===document){return}var b=[];for(var e in a){var d=Object.toJSON(a[e]);if(d!==undefined){b.push(e.toJSON()+": "+d)}}return"{"+b.join(", ")+"}"},keys:function(a){var b=[];for(var c in a){b.push(c)}return b},values:function(b){var a=[];for(var c in b){a.push(b[c])}return a},clone:function(a){return Object.extend({},a)}});Function.prototype.bind=function(){var a=this,c=$A(arguments),b=c.shift();return function(){return a.apply(b,c.concat($A(arguments)))}};Function.prototype.bindAsEventListener=function(c){var a=this,b=$A(arguments),c=b.shift();return function(d){return a.apply(c,[d||window.event].concat(b))}};Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(a){$R(0,this,true).each(a);return this},toPaddedString:function(c,b){var a=this.toString(b||10);return"0".times(c-a.length)+a},toJSON:function(){return isFinite(this)?this.toString():"null"}});Date.prototype.toJSON=function(){return'"'+this.getFullYear()+"-"+(this.getMonth()+1).toPaddedString(2)+"-"+this.getDate().toPaddedString(2)+"T"+this.getHours().toPaddedString(2)+":"+this.getMinutes().toPaddedString(2)+":"+this.getSeconds().toPaddedString(2)+'"'};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.callback(this)}finally{this.currentlyExecuting=false}}}};Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,{gsub:function(e,c){var a="",d=this,b;c=arguments.callee.prepareReplacement(c);while(d.length>0){if(b=d.match(e)){a+=d.slice(0,b.index);a+=String.interpret(c(b));d=d.slice(b.index+b[0].length)}else{a+=d,d=""}}return a},sub:function(c,a,b){a=this.gsub.prepareReplacement(a);b=b===undefined?1:b;return this.gsub(c,function(d){if(--b<0){return d[0]}return a(d)})},scan:function(b,a){this.gsub(b,a);return this},truncate:function(b,a){b=b||30;a=a===undefined?"...":a;return this.length>b?this.slice(0,b-a.length)+a:this},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var b=new RegExp(Prototype.ScriptFragment,"img");var a=new RegExp(Prototype.ScriptFragment,"im");return(this.match(b)||[]).map(function(c){return(c.match(a)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML:function(){var a=arguments.callee;a.text.data=this;return a.div.innerHTML},unescapeHTML:function(){var a=document.createElement("div");a.innerHTML=this.stripTags();return a.childNodes[0]?(a.childNodes.length>1?$A(a.childNodes).inject("",function(b,c){return b+c.nodeValue}):a.childNodes[0].nodeValue):""},toQueryParams:function(b){var a=this.strip().match(/([^?#]*)(#.*)?$/);if(!a){return{}}return a[1].split(b||"&").inject({},function(e,f){if((f=f.split("="))[0]){var c=decodeURIComponent(f.shift());var d=f.length>1?f.join("="):f[0];if(d!=undefined){d=decodeURIComponent(d)}if(c in e){if(e[c].constructor!=Array){e[c]=[e[c]]}e[c].push(d)}else{e[c]=d}}return e})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(c){var a="";for(var b=0;b<c;b++){a+=this}return a},camelize:function(){var d=this.split("-"),a=d.length;if(a==1){return d[0]}var c=this.charAt(0)=="-"?d[0].charAt(0).toUpperCase()+d[0].substring(1):d[0];for(var b=1;b<a;b++){c+=d[b].charAt(0).toUpperCase()+d[b].substring(1)}return c},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()},dasherize:function(){return this.gsub(/_/,"-")},inspect:function(b){var a=this.gsub(/[\x00-\x1f\\]/,function(c){var d=String.specialChar[c[0]];return d?d:"\\u00"+c[0].charCodeAt().toPaddedString(2,16)});if(b){return'"'+a.replace(/"/g,'\\"')+'"'}return"'"+a.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(a){return this.sub(a||Prototype.JSONFilter,"#{1}")},isJSON:function(){var a=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(a)},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())},include:function(a){return this.indexOf(a)>-1},startsWith:function(a){return this.indexOf(a)===0},endsWith:function(a){var b=this.length-a.length;return b>=0&&this.lastIndexOf(a)===b},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)}});if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(){return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}})}String.prototype.gsub.prepareReplacement=function(b){if(typeof b=="function"){return b}var a=new Template(b);return function(c){return a.evaluate(c)}};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});with(String.prototype.escapeHTML){div.appendChild(text)}var Template=Class.create();Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;Template.prototype={initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){return this.template.gsub(this.pattern,function(b){var c=b[1];if(c=="\\"){return b[2]}return c+String.interpret(a[b[3]])})}};var $break={},$continue=new Error('"throw $continue" is deprecated, use "return" instead');var Enumerable={each:function(b){var a=0;try{this._each(function(d){b(d,a++)})}catch(c){if(c!=$break){throw c}}return this},eachSlice:function(c,b){var a=-c,d=[],e=this.toArray();while((a+=c)<e.length){d.push(e.slice(a,a+c))}return d.map(b)},all:function(b){var a=true;this.each(function(d,c){a=a&&!!(b||Prototype.K)(d,c);if(!a){throw $break}});return a},any:function(b){var a=false;this.each(function(d,c){if(a=!!(b||Prototype.K)(d,c)){throw $break}});return a},collect:function(b){var a=[];this.each(function(d,c){a.push((b||Prototype.K)(d,c))});return a},detect:function(b){var a;this.each(function(d,c){if(b(d,c)){a=d;throw $break}});return a},findAll:function(b){var a=[];this.each(function(d,c){if(b(d,c)){a.push(d)}});return a},grep:function(c,b){var a=[];this.each(function(f,e){var d=f.toString();if(d.match(c)){a.push((b||Prototype.K)(f,e))}});return a},include:function(a){var b=false;this.each(function(c){if(c==a){b=true;throw $break}});return b},inGroupsOf:function(b,a){a=a===undefined?null:a;return this.eachSlice(b,function(c){while(c.length<b){c.push(a)}return c})},inject:function(a,b){this.each(function(d,c){a=b(a,d,c)});return a},invoke:function(b){var a=$A(arguments).slice(1);return this.map(function(c){return c[b].apply(c,a)})},max:function(b){var a;this.each(function(d,c){d=(b||Prototype.K)(d,c);if(a==undefined||d>=a){a=d}});return a},min:function(b){var a;this.each(function(d,c){d=(b||Prototype.K)(d,c);if(a==undefined||d<a){a=d}});return a},partition:function(c){var b=[],a=[];this.each(function(e,d){((c||Prototype.K)(e,d)?b:a).push(e)});return[b,a]},pluck:function(b){var a=[];this.each(function(d,c){a.push(d[b])});return a},reject:function(b){var a=[];this.each(function(d,c){if(!b(d,c)){a.push(d)}});return a},sortBy:function(a){return this.map(function(c,b){return{value:c,criteria:a(c,b)}}).sort(function(f,e){var d=f.criteria,c=e.criteria;return d<c?-1:d>c?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var b=Prototype.K,a=$A(arguments);if(typeof a.last()=="function"){b=a.pop()}var c=[this].concat(a).map($A);return this.map(function(e,d){return b(c.pluck(d))})},size:function(){return this.toArray().length},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">"}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});var $A=Array.from=function(d){if(!d){return[]}if(d.toArray){return d.toArray()}else{var b=[];for(var a=0,c=d.length;a<c;a++){b.push(d[a])}return b}};if(Prototype.Browser.WebKit){$A=Array.from=function(d){if(!d){return[]}if(!(typeof d=="function"&&d=="[object NodeList]")&&d.toArray){return d.toArray()}else{var b=[];for(var a=0,c=d.length;a<c;a++){b.push(d[a])}return b}}}Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(b){for(var a=0,c=this.length;a<c;a++){b(this[a])}},clear:function(){this.length=0;return this},first:function(){return this[0]},last:function(){return this[this.length-1]},compact:function(){return this.select(function(a){return a!=null})},flatten:function(){return this.inject([],function(b,a){return b.concat(a&&a.constructor==Array?a.flatten():[a])})},without:function(){var a=$A(arguments);return this.select(function(b){return !a.include(b)})},indexOf:function(a){for(var b=0,c=this.length;b<c;b++){if(this[b]==a){return b}}return -1},reverse:function(a){return(a!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(a){return this.inject([],function(d,c,b){if(0==b||(a?d.last()!=c:!d.include(c))){d.push(c)}return d})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var a=[];this.each(function(b){var c=Object.toJSON(b);if(c!==undefined){a.push(c)}});return"["+a.join(", ")+"]"}});Array.prototype.toArray=Array.prototype.clone;function $w(a){a=a.strip();return a?a.split(/\s+/):[]}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var e=[];for(var b=0,c=this.length;b<c;b++){e.push(this[b])}for(var b=0,c=arguments.length;b<c;b++){if(arguments[b].constructor==Array){for(var a=0,d=arguments[b].length;a<d;a++){e.push(arguments[b][a])}}else{e.push(arguments[b])}}return e}}var Hash=function(a){if(a instanceof Hash){this.merge(a)}else{Object.extend(this,a||{})}};Object.extend(Hash,{toQueryString:function(b){var a=[];a.add=arguments.callee.addPair;this.prototype._each.call(b,function(d){if(!d.key){return}var c=d.value;if(c&&typeof c=="object"){if(c.constructor==Array){c.each(function(e){a.add(d.key,e)})}return}a.add(d.key,c)});return a.join("&")},toJSON:function(a){var b=[];this.prototype._each.call(a,function(d){var c=Object.toJSON(d.value);if(c!==undefined){b.push(d.key.toJSON()+": "+c)}});return"{"+b.join(", ")+"}"}});Hash.toQueryString.addPair=function(a,c,b){a=encodeURIComponent(a);if(c===undefined){this.push(a)}else{this.push(a+"="+(c==null?"":encodeURIComponent(c)))}};Object.extend(Hash.prototype,Enumerable);Object.extend(Hash.prototype,{_each:function(b){for(var a in this){var c=this[a];if(c&&c==Hash.prototype[a]){continue}var d=[a,c];d.key=a;d.value=c;b(d)}},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},merge:function(a){return $H(a).inject(this,function(b,c){b[c.key]=c.value;return b})},remove:function(){var a;for(var b=0,c=arguments.length;b<c;b++){var d=this[arguments[b]];if(d!==undefined){if(a===undefined){a=d}else{if(a.constructor!=Array){a=[a]}a.push(d)}}delete this[arguments[b]]}return a},toQueryString:function(){return Hash.toQueryString(this)},inspect:function(){return"#<Hash:{"+this.map(function(a){return a.map(Object.inspect).join(": ")}).join(", ")+"}>"},toJSON:function(){return Hash.toJSON(this)}});function $H(a){if(a instanceof Hash){return a}return new Hash(a)}if(function(){var a=0,c=function(d){this.key=d};c.prototype.key="foo";for(var b in new c("bar")){a++}return a>1}()){Hash.prototype._each=function(c){var a=[];for(var b in this){var d=this[b];if((d&&d==Hash.prototype[b])||a.include(b)){continue}a.push(b);var e=[b,d];e.key=b;e.value=d;c(e)}}}ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize:function(c,a,b){this.start=c;this.end=a;this.exclusive=b},_each:function(a){var b=this.start;while(this.include(b)){a(b);b=b.succ()}},include:function(a){if(a<this.start){return false}if(this.exclusive){return a<this.end}return a<=this.end}});var $R=function(c,a,b){return new ObjectRange(c,a,b)};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(d,b,c,a){this.each(function(f){if(typeof f[d]=="function"){try{f[d].apply(f,[b,c,a])}catch(g){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:""};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(typeof this.options.parameters=="string"){this.options.parameters=this.options.parameters.toQueryParams()}}};Ajax.Request=Class.create();Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{_complete:false,initialize:function(b,a){this.transport=Ajax.getTransport();this.setOptions(a);this.request(b)},request:function(a){this.url=a;this.method=this.options.method;var c=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){c._method=this.method;this.method="post"}this.parameters=c;if(c=Hash.toQueryString(c)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+c}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){c+="&_="}}}try{if(this.options.onCreate){this.options.onCreate(this.transport)}Ajax.Responders.dispatch("onCreate",this,this.transport);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){setTimeout(function(){this.respondToReadyState(1)}.bind(this),10)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||c):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(b){this.dispatchException(b)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var e={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){e["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){e.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(typeof c.push=="function"){for(var b=0,d=c.length;b<d;b+=2){e[c[b]]=c[b+1]}}else{$H(c).each(function(f){e[f.key]=f.value})}}for(var a in e){this.transport.setRequestHeader(a,e[a])}},success:function(){return !this.transport.status||(this.transport.status>=200&&this.transport.status<300)},respondToReadyState:function(a){var c=Ajax.Request.Events[a];var g=this.transport,b=this.evalJSON();if(c=="Complete"){try{this._complete=true;(this.options["on"+this.transport.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(g,b)}catch(d){this.dispatchException(d)}var f=this.getHeader("Content-type");if(f&&f.strip().match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)){this.evalResponse()}}try{(this.options["on"+c]||Prototype.emptyFunction)(g,b);Ajax.Responders.dispatch("on"+c,this,g,b)}catch(d){this.dispatchException(d)}if(c=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},getHeader:function(a){try{return this.transport.getResponseHeader(a)}catch(b){return null}},evalJSON:function(){try{var a=this.getHeader("X-JSON");return a?a.evalJSON():null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(a,c,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};this.transport=Ajax.getTransport();this.setOptions(b);var d=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(f,e){this.updateContent();d(f,e)}).bind(this);this.request(c)},updateContent:function(){var b=this.container[this.success()?"success":"failure"];var a=this.transport.responseText;if(!this.options.evalScripts){a=a.stripScripts()}if(b=$(b)){if(this.options.insertion){new this.options.insertion(b,a)}else{b.update(a)}}if(this.success()){if(this.onComplete){setTimeout(this.onComplete.bind(this),10)}}}});Ajax.PeriodicalUpdater=Class.create();Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(a,c,b){this.setOptions(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=c;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(b){if(arguments.length>1){for(var a=0,d=[],c=arguments.length;a<c;a++){d.push($(arguments[a]))}return d}if(typeof b=="string"){b=document.getElementById(b)}return Element.extend(b)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(f,a){var c=[];var e=document.evaluate(f,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,d=e.snapshotLength;b<d;b++){c.push(e.snapshotItem(b))}return c};document.getElementsByClassName=function(b,a){var c=".//*[contains(concat(' ', @class, ' '), ' "+b+" ')]";return document._getElementsByXPath(c,a)}}else{document.getElementsByClassName=function(g,j){var d=($(j)||document.body).getElementsByTagName("*");var a=[],b,f=new RegExp("(^|\\s)"+g+"(\\s|$)");for(var e=0,c=d.length;e<c;e++){b=d[e];var h=b.className;if(h.length==0){continue}if(h==g||h.match(f)){a.push(Element.extend(b))}}return a}}if(!window.Element){var Element={}}Element.extend=function(e){var f=Prototype.BrowserFeatures;if(!e||!e.tagName||e.nodeType==3||e._extended||f.SpecificElementExtensions||e==window){return e}var b={},d=e.tagName,a=Element.extend.cache,c=Element.Methods.ByTag;if(!f.ElementExtensions){Object.extend(b,Element.Methods),Object.extend(b,Element.Methods.Simulated)}if(c[d]){Object.extend(b,c[d])}for(var h in b){var g=b[h];if(typeof g=="function"&&!(h in e)){e[h]=a.findOrStore(g)}}e._extended=Prototype.emptyFunction;return e};Element.extend.cache={findOrStore:function(a){return this[a]=this[a]||function(){return a.apply(null,[this].concat($A(arguments)))}}};Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){$(a).style.display="none";return a},show:function(a){$(a).style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:function(b,a){a=typeof a=="undefined"?"":a.toString();$(b).innerHTML=a.stripScripts();setTimeout(function(){a.evalScripts()},10);return b},replace:function(c,b){c=$(c);b=typeof b=="undefined"?"":b.toString();if(c.outerHTML){c.outerHTML=b.stripScripts()}else{var a=c.ownerDocument.createRange();a.selectNodeContents(c);c.parentNode.replaceChild(a.createContextualFragment(b.stripScripts()),c)}setTimeout(function(){b.evalScripts()},10);return c},inspect:function(b){b=$(b);var a="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(f){var e=f.first(),c=f.last();var d=(b[e]||"").toString();if(d){a+=" "+c+"="+d.inspect(true)}});return a+">"},recursivelyCollect:function(a,c){a=$(a);var b=[];while(a=a[c]){if(a.nodeType==1){b.push(Element.extend(a))}}return b},ancestors:function(a){return $(a).recursivelyCollect("parentNode")},descendants:function(a){return $A($(a).getElementsByTagName("*")).each(Element.extend)},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling}return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild)){return[]}while(a&&a.nodeType!=1){a=a.nextSibling}if(a){return[a].concat($(a).nextSiblings())}return[]},previousSiblings:function(a){return $(a).recursivelyCollect("previousSibling")},nextSiblings:function(a){return $(a).recursivelyCollect("nextSibling")},siblings:function(a){a=$(a);return a.previousSiblings().reverse().concat(a.nextSiblings())},match:function(b,a){if(typeof a=="string"){a=new Selector(a)}return a.match($(b))},up:function(b,d,a){b=$(b);if(arguments.length==1){return $(b.parentNode)}var c=b.ancestors();return d?Selector.findElement(c,d,a):c[a||0]},down:function(b,c,a){b=$(b);if(arguments.length==1){return b.firstDescendant()}var d=b.descendants();return c?Selector.findElement(d,c,a):d[a||0]},previous:function(b,d,a){b=$(b);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(b))}var c=b.previousSiblings();return d?Selector.findElement(c,d,a):c[a||0]},next:function(c,d,b){c=$(c);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(c))}var a=c.nextSiblings();return d?Selector.findElement(a,d,b):a[b||0]},getElementsBySelector:function(){var a=$A(arguments),b=$(a.shift());return Selector.findChildElements(b,a)},getElementsByClassName:function(a,b){return document.getElementsByClassName(b,a)},readAttribute:function(c,a){c=$(c);if(Prototype.Browser.IE){if(!c.attributes){return null}var b=Element._attributeTranslations;if(b.values[a]){return b.values[a](c,a)}if(b.names[a]){a=b.names[a]}var d=c.attributes[a];return d?d.nodeValue:null}return c.getAttribute(a)},getHeight:function(a){return $(a).getDimensions().height},getWidth:function(a){return $(a).getDimensions().width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(!(a=$(a))){return}var c=a.className;if(c.length==0){return false}if(c==b||c.match(new RegExp("(^|\\s)"+b+"(\\s|$)"))){return true}return false},addClassName:function(a,b){if(!(a=$(a))){return}Element.classNames(a).add(b);return a},removeClassName:function(a,b){if(!(a=$(a))){return}Element.classNames(a).remove(b);return a},toggleClassName:function(a,b){if(!(a=$(a))){return}Element.classNames(a)[a.hasClassName(b)?"remove":"add"](b);return a},observe:function(){Event.observe.apply(Event,arguments);return $A(arguments).first()},stopObserving:function(){Event.stopObserving.apply(Event,arguments);return $A(arguments).first()},cleanWhitespace:function(b){b=$(b);var c=b.firstChild;while(c){var a=c.nextSibling;if(c.nodeType==3&&!/\S/.test(c.nodeValue)){b.removeChild(c)}c=a}return b},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(b,a){b=$(b),a=$(a);while(b=b.parentNode){if(b==a){return true}}return false},scrollTo:function(a){a=$(a);var b=Position.cumulativeOffset(a);window.scrollTo(b[0],b[1]);return a},getStyle:function(b,c){b=$(b);c=c=="float"?"cssFloat":c.camelize();var d=b.style[c];if(!d){var a=document.defaultView.getComputedStyle(b,null);d=a?a[c]:null}if(c=="opacity"){return d?parseFloat(d):1}return d=="auto"?null:d},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(a,c,b){a=$(a);var e=a.style;for(var d in c){if(d=="opacity"){a.setOpacity(c[d])}else{e[(d=="float"||d=="cssFloat")?(e.styleFloat===undefined?"cssFloat":"styleFloat"):(b?d:d.camelize())]=c[d]}}return a},setOpacity:function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;return a},getDimensions:function(c){c=$(c);var g=$(c).getStyle("display");if(g!="none"&&g!=null){return{width:c.offsetWidth,height:c.offsetHeight}}var b=c.style;var f=b.visibility;var d=b.position;var a=b.display;b.visibility="hidden";b.position="absolute";b.display="block";var h=c.clientWidth;var e=c.clientHeight;b.display=a;b.position=d;b.visibility=f;return{width:h,height:e}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(window.opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=a.style.overflow||"auto";if((Element.getStyle(a,"overflow")||"visible")!="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a}};Object.extend(Element.Methods,{childOf:Element.Methods.descendantOf,childElements:Element.Methods.immediateDescendants});if(Prototype.Browser.Opera){Element.Methods._getStyle=Element.Methods.getStyle;Element.Methods.getStyle=function(a,b){switch(b){case"left":case"top":case"right":case"bottom":if(Element._getStyle(a,"position")=="static"){return null}default:return Element._getStyle(a,b)}}}else{if(Prototype.Browser.IE){Element.Methods.getStyle=function(a,b){a=$(a);b=(b=="float"||b=="cssFloat")?"styleFloat":b.camelize();var c=a.style[b];if(!c&&a.currentStyle){c=a.currentStyle[b]}if(b=="opacity"){if(c=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(c[1]){return parseFloat(c[1])/100}}return 1}if(c=="auto"){if((b=="width"||b=="height")&&(a.getStyle("display")!="none")){return a["offset"+b.capitalize()]+"px"}return null}return c};Element.Methods.setOpacity=function(a,d){a=$(a);var c=a.getStyle("filter"),b=a.style;if(d==1||d===""){b.filter=c.replace(/alpha\([^\)]*\)/gi,"");return a}else{if(d<0.00001){d=0}}b.filter=c.replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+(d*100)+")";return a};Element.Methods.update=function(c,b){c=$(c);b=typeof b=="undefined"?"":b.toString();var a=c.tagName.toUpperCase();if(["THEAD","TBODY","TR","TD"].include(a)){var d=document.createElement("div");switch(a){case"THEAD":case"TBODY":d.innerHTML="<table><tbody>"+b.stripScripts()+"</tbody></table>";depth=2;break;case"TR":d.innerHTML="<table><tbody><tr>"+b.stripScripts()+"</tr></tbody></table>";depth=3;break;case"TD":d.innerHTML="<table><tbody><tr><td>"+b.stripScripts()+"</td></tr></tbody></table>";depth=4}$A(c.childNodes).each(function(e){c.removeChild(e)});depth.times(function(){d=d.firstChild});$A(d.childNodes).each(function(e){c.appendChild(e)})}else{c.innerHTML=b.stripScripts()}setTimeout(function(){b.evalScripts()},10);return c}}else{if(Prototype.Browser.Gecko){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1)?0.999999:(b==="")?"":(b<0.00001)?0:b;return a}}}}Element._attributeTranslations={names:{colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",datetime:"dateTime",accesskey:"accessKey",tabindex:"tabIndex",enctype:"encType",maxlength:"maxLength",readonly:"readOnly",longdesc:"longDesc"},values:{_getAttr:function(a,b){return a.getAttribute(b,2)},_flag:function(a,b){return $(a).hasAttribute(b)?b:null},style:function(a){return a.style.cssText.toLowerCase()},title:function(a){var b=a.getAttributeNode("title");return b.specified?b.nodeValue:null}}};(function(){Object.extend(this,{href:this._getAttr,src:this._getAttr,type:this._getAttr,disabled:this._flag,checked:this._flag,readonly:this._flag,multiple:this._flag})}).call(Element._attributeTranslations.values);Element.Methods.Simulated={hasAttribute:function(b,d){var a=Element._attributeTranslations,c;d=a.names[d]||d;c=$(b).getAttributeNode(d);return c&&c.specified}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div").__proto__){window.HTMLElement={};window.HTMLElement.prototype=document.createElement("div").__proto__;Prototype.BrowserFeatures.ElementExtensions=true}Element.hasAttribute=function(a,b){if(a.hasAttribute){return a.hasAttribute(b)}return Element.Methods.Simulated.hasAttribute(a,b)};Element.addMethods=function(c){var h=Prototype.BrowserFeatures,d=Element.Methods.ByTag;if(!c){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var b=c;c=arguments[1]}if(!b){Object.extend(Element.Methods,c||{})}else{if(b.constructor==Array){b.each(g)}else{g(b)}}function g(k){k=k.toUpperCase();if(!Element.Methods.ByTag[k]){Element.Methods.ByTag[k]={}}Object.extend(Element.Methods.ByTag[k],c)}function a(n,l,k){k=k||false;var m=Element.extend.cache;for(var p in n){var o=n[p];if(!k||!(p in l)){l[p]=m.findOrStore(o)}}}function e(m){var k;var l={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(l[m]){k="HTML"+l[m]+"Element"}if(window[k]){return window[k]}k="HTML"+m+"Element";if(window[k]){return window[k]}k="HTML"+m.capitalize()+"Element";if(window[k]){return window[k]}window[k]={};window[k].prototype=document.createElement(m).__proto__;return window[k]}if(h.ElementExtensions){a(Element.Methods,HTMLElement.prototype);a(Element.Methods.Simulated,HTMLElement.prototype,true)}if(h.SpecificElementExtensions){for(var j in Element.Methods.ByTag){var f=e(j);if(typeof f=="undefined"){continue}a(d[j],f.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag};var Toggle={display:Element.toggle};Abstract.Insertion=function(a){this.adjacency=a};Abstract.Insertion.prototype={initialize:function(b,c){this.element=$(b);this.content=c.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content)}catch(d){var a=this.element.tagName.toUpperCase();if(["TBODY","TR"].include(a)){this.insertContent(this.contentFromAnonymousTable())}else{throw d}}}else{this.range=this.element.ownerDocument.createRange();if(this.initializeRange){this.initializeRange()}this.insertContent([this.range.createContextualFragment(this.content)])}setTimeout(function(){c.evalScripts()},10)},contentFromAnonymousTable:function(){var a=document.createElement("div");a.innerHTML="<table><tbody>"+this.content+"</tbody></table>";return $A(a.childNodes[0].childNodes[0].childNodes)}};var Insertion=new Object();Insertion.Before=Class.create();Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){this.range.setStartBefore(this.element)},insertContent:function(a){a.each((function(b){this.element.parentNode.insertBefore(b,this.element)}).bind(this))}});Insertion.Top=Class.create();Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(true)},insertContent:function(a){a.reverse(false).each((function(b){this.element.insertBefore(b,this.element.firstChild)}).bind(this))}});Insertion.Bottom=Class.create();Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(this.element)},insertContent:function(a){a.each((function(b){this.element.appendChild(b)}).bind(this))}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){this.range.setStartAfter(this.element)},insertContent:function(a){a.each((function(b){this.element.parentNode.insertBefore(b,this.element.nextSibling)}).bind(this))}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);var Selector=Class.create();Selector.prototype={initialize:function(a){this.expression=a.strip();this.compileMatcher()},compileMatcher:function(){if(Prototype.BrowserFeatures.XPath&&!(/\[[\w-]*?:/).test(this.expression)){return this.compileXPathMatcher()}var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(typeof c[i]=="function"?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var f=this.expression,g=Selector.patterns,b=Selector.xpath,d,a;if(Selector._cache[f]){this.xpath=Selector._cache[f];return}this.matcher=[".//*"];while(f&&d!=f&&(/\S/).test(f)){d=f;for(var c in g){if(a=f.match(g[c])){this.matcher.push(typeof b[c]=="function"?b[c](a):new Template(b[c]).evaluate(a));f=f.replace(a[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(a){a=a||document;if(this.xpath){return document._getElementsByXPath(this.xpath,a)}return this.matcher(a)},match:function(a){return this.findElements(document).include(a)},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}};Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(a){if(a[1]=="*"){return""}return"[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:"[@#{1}]",attr:function(a){a[3]=a[5]||a[6];return new Template(Selector.xpath.operators[a[2]]).evaluate(a)},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];if(!b){return""}if(typeof b==="function"){return b(a)}return new Template(Selector.xpath.pseudos[a[1]]).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",checked:"[@checked]",disabled:"[@disabled]",enabled:"[not(@disabled)]",not:function(b){var j=b[6],h=Selector.patterns,a=Selector.xpath,f,b,c;var g=[];while(j&&f!=j&&(/\S/).test(j)){f=j;for(var d in h){if(b=j.match(h[d])){c=typeof a[d]=="function"?a[d](b):new Template(a[d]).evaluate(b);g.push("("+c.substring(1,c.length-1)+")");j=j.replace(b[0],"");break}}}return"[not("+g.join(" and ")+")]"},"nth-child":function(a){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",a)},"nth-last-child":function(a){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",a)},"nth-of-type":function(a){return Selector.xpath.pseudos.nth("position() ",a)},"nth-last-of-type":function(a){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",a)},"first-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-of-type"](a)},"last-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](a)},"only-of-type":function(a){var b=Selector.xpath.pseudos;return b["first-of-type"](a)+b["last-of-type"](a)},nth:function(g,e){var h,j=e[6],d;if(j=="even"){j="2n+0"}if(j=="odd"){j="2n+1"}if(h=j.match(/^(\d+)$/)){return"["+g+"= "+h[1]+"]"}if(h=j.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(h[1]=="-"){h[1]=-1}var f=h[1]?Number(h[1]):1;var c=h[2]?Number(h[2]):0;d="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(d).evaluate({fragment:g,a:f,b:c})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);   c = false;',className:'n = h.className(n, r, "#{1}", c); c = false;',id:'n = h.id(n, r, "#{1}", c);        c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}"); c = false;',attr:function(a){a[3]=(a[5]||a[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(a)},pseudo:function(a){if(a[6]){a[6]=a[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(a)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|\s|(?=:))/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\]]*?)\4|([^'"][^\]]*?)))?\]/},handlers:{concat:function(d,c){for(var e=0,f;f=c[e];e++){d.push(f)}return d},mark:function(a){for(var b=0,c;c=a[b];b++){c._counted=true}return a},unmark:function(a){for(var b=0,c;c=a[b];b++){c._counted=undefined}return a},index:function(a,d,f){a._counted=true;if(d){for(var b=a.childNodes,e=b.length-1,c=1;e>=0;e--){node=b[e];if(node.nodeType==1&&(!f||node._counted)){node.nodeIndex=c++}}}else{for(var e=0,c=1,b=a.childNodes;node=b[e];e++){if(node.nodeType==1&&(!f||node._counted)){node.nodeIndex=c++}}}},unique:function(b){if(b.length==0){return b}var d=[],e;for(var c=0,a=b.length;c<a;c++){if(!(e=b[c])._counted){e._counted=true;d.push(Element.extend(e))}}return Selector.handlers.unmark(d)},descendant:function(a){var d=Selector.handlers;for(var c=0,b=[],e;e=a[c];c++){d.concat(b,e.getElementsByTagName("*"))}return b},child:function(a){var f=Selector.handlers;for(var e=0,d=[],g;g=a[e];e++){for(var b=0,c=[],k;k=g.childNodes[b];b++){if(k.nodeType==1&&k.tagName!="!"){d.push(k)}}}return d},adjacent:function(a){for(var c=0,b=[],e;e=a[c];c++){var d=this.nextElementSibling(e);if(d){b.push(d)}}return b},laterSibling:function(a){var d=Selector.handlers;for(var c=0,b=[],e;e=a[c];c++){d.concat(b,Element.nextSiblings(e))}return b},nextElementSibling:function(a){while(a=a.nextSibling){if(a.nodeType==1){return a}}return null},previousElementSibling:function(a){while(a=a.previousSibling){if(a.nodeType==1){return a}}return null},tagName:function(b,a,e,j){e=e.toUpperCase();var d=[],f=Selector.handlers;if(b){if(j){if(j=="descendant"){for(var c=0,g;g=b[c];c++){f.concat(d,g.getElementsByTagName(e))}return d}else{b=this[j](b)}if(e=="*"){return b}}for(var c=0,g;g=b[c];c++){if(g.tagName.toUpperCase()==e){d.push(g)}}return d}else{return a.getElementsByTagName(e)}},id:function(b,a,j,f){var g=$(j),d=Selector.handlers;if(!b&&a==document){return g?[g]:[]}if(b){if(f){if(f=="child"){for(var c=0,e;e=b[c];c++){if(g.parentNode==e){return[g]}}}else{if(f=="descendant"){for(var c=0,e;e=b[c];c++){if(Element.descendantOf(g,e)){return[g]}}}else{if(f=="adjacent"){for(var c=0,e;e=b[c];c++){if(Selector.handlers.previousElementSibling(g)==e){return[g]}}}else{b=d[f](b)}}}}for(var c=0,e;e=b[c];c++){if(e==g){return[g]}}return[]}return(g&&Element.descendantOf(g,a))?[g]:[]},className:function(b,a,c,d){if(b&&d){b=this[d](b)}return Selector.handlers.byClassName(b,a,c)},byClassName:function(c,b,f){if(!c){c=Selector.handlers.descendant([b])}var h=" "+f+" ";for(var e=0,d=[],g,a;g=c[e];e++){a=g.className;if(a.length==0){continue}if(a==f||(" "+a+" ").include(h)){d.push(g)}}return d},attrPresence:function(c,b,a){var e=[];for(var d=0,f;f=c[d];d++){if(Element.hasAttribute(f,a)){e.push(f)}}return e},attr:function(a,h,g,j,b){if(!a){a=h.getElementsByTagName("*")}var k=Selector.operators[b],d=[];for(var e=0,c;c=a[e];e++){var f=Element.readAttribute(c,g);if(f===null){continue}if(k(f,j)){d.push(c)}}return d},pseudo:function(b,c,e,a,d){if(b&&d){b=this[d](b)}if(!b){b=a.getElementsByTagName("*")}return Selector.pseudos[c](b,e,a)}},pseudos:{"first-child":function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(Selector.handlers.previousElementSibling(e)){continue}c.push(e)}return c},"last-child":function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(Selector.handlers.nextElementSibling(e)){continue}c.push(e)}return c},"only-child":function(b,g,a){var e=Selector.handlers;for(var d=0,c=[],f;f=b[d];d++){if(!e.previousElementSibling(f)&&!e.nextElementSibling(f)){c.push(f)}}return c},"nth-child":function(b,c,a){return Selector.pseudos.nth(b,c,a)},"nth-last-child":function(b,c,a){return Selector.pseudos.nth(b,c,a,true)},"nth-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,false,true)},"nth-last-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,true,true)},"first-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,false,true)},"last-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,true,true)},"only-of-type":function(b,d,a){var c=Selector.pseudos;return c["last-of-type"](c["first-of-type"](b,d,a),d,a)},getIndices:function(d,c,e){if(d==0){return c>0?[c]:[]}return $R(1,e).inject([],function(a,b){if(0==(b-c)%d&&(b-c)/d>=0){a.push(b)}return a})},nth:function(c,t,v,r,e){if(c.length==0){return[]}if(t=="even"){t="2n+0"}if(t=="odd"){t="2n+1"}var q=Selector.handlers,p=[],d=[],g;q.mark(c);for(var o=0,f;f=c[o];o++){if(!f.parentNode._counted){q.index(f.parentNode,r,e);d.push(f.parentNode)}}if(t.match(/^\d+$/)){t=Number(t);for(var o=0,f;f=c[o];o++){if(f.nodeIndex==t){p.push(f)}}}else{if(g=t.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(g[1]=="-"){g[1]=-1}var w=g[1]?Number(g[1]):1;var u=g[2]?Number(g[2]):0;var x=Selector.pseudos.getIndices(w,u,c.length);for(var o=0,f,k=x.length;f=c[o];o++){for(var n=0;n<k;n++){if(f.nodeIndex==x[n]){p.push(f)}}}}}q.unmark(c);q.unmark(d);return p},empty:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.tagName=="!"||(e.firstChild&&!e.innerHTML.match(/^\s*$/))){continue}c.push(e)}return c},not:function(a,d,k){var g=Selector.handlers,l,c;var j=new Selector(d).findElements(k);g.mark(j);for(var f=0,e=[],b;b=a[f];f++){if(!b._counted){e.push(b)}}g.unmark(j);return e},enabled:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(!e.disabled){c.push(e)}}return c},disabled:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.disabled){c.push(e)}}return c},checked:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.checked){c.push(e)}}return c}},operators:{"=":function(b,a){return b==a},"!=":function(b,a){return b!=a},"^=":function(b,a){return b.startsWith(a)},"$=":function(b,a){return b.endsWith(a)},"*=":function(b,a){return b.include(a)},"~=":function(b,a){return(" "+b+" ").include(" "+a+" ")},"|=":function(b,a){return("-"+b.toUpperCase()+"-").include("-"+a.toUpperCase()+"-")}},matchElements:function(f,g){var e=new Selector(g).findElements(),d=Selector.handlers;d.mark(e);for(var c=0,b=[],a;a=f[c];c++){if(a._counted){b.push(a)}}d.unmark(e);return b},findElement:function(b,c,a){if(typeof c=="number"){a=c;c=false}return Selector.matchElements(b,c||"*")[a||0]},findChildElements:function(e,g){var j=g.join(","),g=[];j.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(h){g.push(h[1].strip())});var d=[],f=Selector.handlers;for(var c=0,b=g.length,a;c<b;c++){a=new Selector(g[c].strip());f.concat(d,a.findElements(e))}return(b>1)?f.unique(d):d}});function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){$(a).reset();return a},serializeElements:function(c,a){var b=c.inject({},function(d,f){if(!f.disabled&&f.name){var e=f.name,g=$(f).getValue();if(g!=null){if(e in d){if(d[e].constructor!=Array){d[e]=[d[e]]}d[e].push(g)}else{d[e]=g}}}return d});return a?b:Hash.toQueryString(b)}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(a){return $A($(a).getElementsByTagName("*")).inject([],function(b,c){if(Form.Element.Serializers[c.tagName.toLowerCase()]){b.push(Element.extend(c))}return b})},getInputs:function(g,c,d){g=$(g);var a=g.getElementsByTagName("input");if(!c&&!d){return $A(a).map(Element.extend)}for(var e=0,h=[],f=a.length;e<f;e++){var b=a[e];if((c&&b.type!=c)||(d&&b.name!=d)){continue}h.push(Element.extend(b))}return h},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(a){return $(a).getElements().find(function(b){return b.type!="hidden"&&!b.disabled&&["input","select","textarea"].include(b.tagName.toLowerCase())})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(b,a){b=$(b),a=Object.clone(a||{});var c=a.parameters;a.parameters=b.serialize(true);if(c){if(typeof c=="string"){c=c.toQueryParams()}Object.extend(a.parameters,c)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(b.readAttribute("action"),a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Hash.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(a.type))){a.select()}}catch(b){}return a},disable:function(a){a=$(a);a.blur();a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(a){switch(a.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(a);default:return Form.Element.Serializers.textarea(a)}},inputSelector:function(a){return a.checked?a.value:null},textarea:function(a){return a.value},select:function(a){return this[a.type=="select-one"?"selectOne":"selectMany"](a)},selectOne:function(b){var a=b.selectedIndex;return a>=0?this.optionValue(b.options[a]):null},selectMany:function(d){var a,e=d.length;if(!e){return null}for(var c=0,a=[];c<e;c++){var b=d.options[c];if(b.selected){a.push(this.optionValue(b))}}return a},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=function(){};Abstract.TimedObserver.prototype={initialize:function(a,b,c){this.frequency=b;this.element=$(a);this.callback=c;this.lastValue=this.getValue();this.registerCallback()},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},onTimerEvent:function(){var a=this.getValue();var b=("string"==typeof this.lastValue&&"string"==typeof a?this.lastValue!=a:String(this.lastValue)!=String(a));if(b){this.callback(this.element,a);this.lastValue=a}}};Form.Element.Observer=Class.create();Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create();Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=function(){};Abstract.EventObserver.prototype={initialize:function(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback.bind(this))},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}};Form.Element.EventObserver=Class.create();Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create();Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.serialize(this.element)}});if(!window.Event){var Event=new Object()}Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,element:function(a){return $(a.target||a.srcElement)},isLeftClick:function(a){return(((a.which)&&(a.which==1))||((a.button)&&(a.button==1)))},pointerX:function(a){return a.pageX||(a.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))},pointerY:function(a){return a.pageY||(a.clientY+(document.documentElement.scrollTop||document.body.scrollTop))},stop:function(a){if(a.preventDefault){a.preventDefault();a.stopPropagation()}else{a.returnValue=false;a.cancelBubble=true}},findElement:function(c,b){var a=Event.element(c);while(a.parentNode&&(!a.tagName||(a.tagName.toUpperCase()!=b.toUpperCase()))){a=a.parentNode}return a},observers:false,_observeAndCache:function(d,c,b,a){if(!this.observers){this.observers=[]}if(d.addEventListener){this.observers.push([d,c,b,a]);d.addEventListener(c,b,a)}else{if(d.attachEvent){this.observers.push([d,c,b,a]);d.attachEvent("on"+c,b)}}},unloadCache:function(){if(!Event.observers){return}for(var a=0,b=Event.observers.length;a<b;a++){Event.stopObserving.apply(this,Event.observers[a]);Event.observers[a][0]=null}Event.observers=false},observe:function(d,c,b,a){d=$(d);a=a||false;if(c=="keypress"&&(Prototype.Browser.WebKit||d.attachEvent)){c="keydown"}Event._observeAndCache(d,c,b,a)},stopObserving:function(d,c,b,a){d=$(d);a=a||false;if(c=="keypress"&&(Prototype.Browser.WebKit||d.attachEvent)){c="keydown"}if(d.removeEventListener){d.removeEventListener(c,b,a)}else{if(d.detachEvent){try{d.detachEvent("on"+c,b)}catch(f){}}}}});if(Prototype.Browser.IE){Event.observe(window,"unload",Event.unloadCache,false)}var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},realOffset:function(b){var a=0,c=0;do{a+=b.scrollTop||0;c+=b.scrollLeft||0;b=b.parentNode}while(b);return[c,a]},cumulativeOffset:function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;b=b.offsetParent}while(b);return[c,a]},positionedOffset:function(b){var a=0,d=0;do{a+=b.offsetTop||0;d+=b.offsetLeft||0;b=b.offsetParent;if(b){if(b.tagName=="BODY"){break}var c=Element.getStyle(b,"position");if(c=="relative"||c=="absolute"){break}}}while(b);return[d,a]},offsetParent:function(a){if(a.offsetParent){return a.offsetParent}if(a==document.body){return a}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return a}}return document.body},within:function(b,a,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,c)}this.xcomp=a;this.ycomp=c;this.offset=this.cumulativeOffset(b);return(c>=this.offset[1]&&c<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(b,a,d){var c=this.realOffset(b);this.xcomp=a+c[0]-this.deltaX;this.ycomp=d+c[1]-this.deltaY;this.offset=this.cumulativeOffset(b);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+b.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+b.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},page:function(d){var a=0,c=0;var b=d;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body){if(Element.getStyle(b,"position")=="absolute"){break}}}while(b=b.offsetParent);b=d;do{if(!window.opera||b.tagName=="BODY"){a-=b.scrollTop||0;c-=b.scrollLeft||0}}while(b=b.parentNode);return[c,a]},clone:function(c,e){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});c=$(c);var d=Position.page(c);e=$(e);var f=[0,0];var b=null;if(Element.getStyle(e,"position")=="absolute"){b=Position.offsetParent(e);f=Position.page(b)}if(b==document.body){f[0]-=document.body.offsetLeft;f[1]-=document.body.offsetTop}if(a.setLeft){e.style.left=(d[0]-f[0]+a.offsetLeft)+"px"}if(a.setTop){e.style.top=(d[1]-f[1]+a.offsetTop)+"px"}if(a.setWidth){e.style.width=c.offsetWidth+"px"}if(a.setHeight){e.style.height=c.offsetHeight+"px"}},absolutize:function(b){b=$(b);if(b.style.position=="absolute"){return}Position.prepare();var d=Position.positionedOffset(b);var f=d[1];var e=d[0];var c=b.clientWidth;var a=b.clientHeight;b._originalLeft=e-parseFloat(b.style.left||0);b._originalTop=f-parseFloat(b.style.top||0);b._originalWidth=b.style.width;b._originalHeight=b.style.height;b.style.position="absolute";b.style.top=f+"px";b.style.left=e+"px";b.style.width=c+"px";b.style.height=a+"px"},relativize:function(a){a=$(a);if(a.style.position=="relative"){return}Position.prepare();a.style.position="relative";var c=parseFloat(a.style.top||0)-(a._originalTop||0);var b=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=c+"px";a.style.left=b+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth}};if(Prototype.Browser.WebKit){Position.cumulativeOffset=function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body){if(Element.getStyle(b,"position")=="absolute"){break}}b=b.offsetParent}while(b);return[c,a]}}Element.addMethods();Page=Class.create();Page.prototype={initialize:function(a,b,d,c){if(a!=null){this.url=a}if(b!=null){this.window=b}if(d!=null){this.param=d}this.identification=false;this.current_ajax=null},visible_all_div:function(c){var d=this;$(c).show();var b=c.getElementsByTagName("div");var a=$A(b);a.each(function(e){d.visible_all_div(e)})},hidden_all_onglet:function(d){var e=false;var c=null;var b=$("content").getElementsByTagName("div");var a=$A(b);a.each(function(f){if((f.id)==d){c=f;e=true}$(f).hide()});if(e){this.visible_all_div(c)}return !e},load:function(b,a){if(this.identification&&!authentification.isconnected){alert_message("Vous devez être identifié pour accéder à cette page.");return}scroll(0,0);var d=this;if(b){authentification.selected_page=this.url}select_menu(this.url);if(!a){dhtmlHistory.add("section:"+this.url.substr(this.url.indexOf("-")+1,this.url.lastIndexOf(".")-this.url.indexOf("-")-1),null)}if(this.window==null){this.window=false}if(this.param==null){this.param=""}if(this.hidden_all_onglet(this.url)){new Ajax.Request(d.url+"?"+d.param,{method:"get",onSuccess:function(e){var f=null;if(d.window){f=mywindow.create_windows_move(d.url,e.responseText)}else{f=create.div({id:d.url});$(f).update(e.responseText)}if(authentification.selected_page!=d.url){f.hide()}$("content").appendChild(f);d.afterload()}})}else{this.reload()}var c=document.body.clientHeight;document.getElementById("footer").style.bottom=0},afterload:function(){},unload:function(){if($(this.url)){$(this.url).remove()}},reload:function(){},ajax_request:function(a,b){if(this.current_ajax!=null){this.current_ajax.transport.abort()}this.current_ajax=new Ajax.Request(a,b)}};function alert_message(a){$("alert_message").style.display="block";$("alert_message").update(a);setTimeout("$('alert_message').style.display = \"none\"",5000)}function print_minimenu(d,c){var a=$("minimenu");var b="";if(d){b="<b>"+c+"</b> | ";b+='<a id="link_minimenu_friend" href="#" onclick="javascript: if (Windows.getWindow(\'friend_window\')) Windows.getWindow(\'friend_window\').show(); return false;" title="Mes amis"><img src="public/img/friend.png" alt="friend"/></a> |';b+='<a id="link_minimenu_message" href="carte-message.html" onclick="message.load(true); return false" title="Mes messages"><img src="public/img/mail.png" alt="Mes Messages"/></a> | ';b+='<a id="link_minimenu_parametres" href="carte-profil.html" onclick="profil.load(true); return false" title="Mes parametres"><img src="public/img/parameters.png" alt="Mes parametres"/></a> | ';b+='<a id="link_minimenu_deconnection" href="carte-authentification.html?action=deconnexion" title="Deconnection" ><img src="public/img/logout.png" alt="deconnection"/></a>'}$(a).update(b)}function print_menu(c){var a=$("menu");var b='<li id="menu_ajax-welcome.html"><a href="carte-welcome.html" onclick="welcome.load(true); return false" title="Accueil">Accueil</a></li>';b+='<li id="menu_ajax-search.html"><a href="carte-recherche.html" onclick="searchcards.load(true); return false;" title="Recherche de cartes">Cartes</a></li>';b+='<li id="menu_ajax-search_person.html"><a href="carte-recherche_membre.html" onclick="searchpeople.load(true); return false;" title="Recherche de membres">Membres</a></li>';if(c){b+='<li id="menu_ajax-card.html"><a href="carte-card.html" onclick="mycards.load(true); return false;" title="Mes cartes">Mes cartes</a></li>';b+='<li id="menu_ajax-trade.html"><a href="carte-trade.html" onclick="trade.load(true); return false;" title="Mes échanges">Echanges</a></li>'}else{b+='<li id="menu_ajax-subscription.html"><a href="carte-inscription.html" onclick="subscription.load(true); return false;" title="Inscription">Inscription</a></li>'}b+='<li id="menu_ajax-forum.html"><a href="carte-forum.html" onclick="forum.load(true); return false;" title="Forum">Forum</a></li>';$(a).update(b);select_menu(authentification.selected_page)}function select_menu(c){c="menu_"+c;var b=$("menu").getElementsByTagName("li");var a=$A(b);a.each(function(d){if(d.id==c){$(d).addClassName("current")}else{$(d).removeClassName("current")}})}function chargerJS(b){var a=document.getElementsByTagName("head")[0];var c=document.createElement("script");c.type="text/javascript";c.src=b;a.appendChild(c)}function chargerCSS(c){var a=document.getElementsByTagName("head")[0];var b=document.createElement("link");b.type="text/css";b.rel="stylesheet";b.href=c;b.media="screen";a.appendChild(b)}function scrollToElement(b){var a=0;var c=0;while(b!=null){a+=b.offsetLeft;c+=b.offsetTop;b=b.offsetParent}window.scrollTo(a,c)}var pages_array=new Array();function dhtmlHistoy_initialize(){dhtmlHistory.initialize();dhtmlHistory.addListener(handleHistoryChange);pages_array.welcome=welcome;pages_array.search=searchcards;pages_array.search_person=searchpeople;pages_array.message=message;pages_array.profil=profil;pages_array.card=mycards;pages_array.trade=trade;pages_array.forum=forum;pages_array.subscription=subscription;pages_array.user_agreement=agreement}function handleHistoryChange(a,b){if(a==""){a="section:welcome"}a=a.replace(/section\:/,"");if(a=="forum_forum"){forum.topic.id="";forum.forum.id="";forum.category.id=b.id;forum.category.name=b.name;forum.load(true,true);return}if(a=="forum_topic"){forum.topic.id="";forum.forum.id=b.id;forum.forum.name=b.name;forum.load(true,true);return}if(a=="forum_post"){forum.topic.id=b.id;forum.topic.name=b.name;forum.load(true,true);return}if(a=="forum"){forum.topic.id="";forum.forum.id="";forum.category.id="";forum.load(true,true);return}pages_array[a].load()}function init_page(){chargerCSS("public/css/window.css");chargerCSS("public/css/alphacube.css");chargerCSS("public/css/default.css");chargerCSS("public/css/alert.css");authentification.login("","",false);dhtmlHistoy_initialize()}var myGlobalHandlers={onCreate:function(){$("loading").style.visibility="visible"},onComplete:function(){if(Ajax.activeRequestCount==0){$("loading").style.visibility="hidden"}}};Ajax.Responders.register(myGlobalHandlers);Create=Class.create();Create.prototype={initialize:function(){},div:function(c){var b={classname:"",text:"",id:""};Object.extend(b,c||{});var a=document.createElement("div");a.setAttribute("id",b.id);$(a).addClassName(b.classname);$(a).update(b.text);return a},p:function(c){var b={classname:"",text:"",id:""};Object.extend(b,c||{});var a=document.createElement("p");a.setAttribute("id",b.id);$(a).addClassName(b.classname);$(a).update(b.text);return a},form:function(c){var b={classname:"",id:"",name:"",action:"",method:"get",onsubmit:null};Object.extend(b,c||{});var a=document.createElement("form");a.setAttribute("id",b.id);a.setAttribute("name",b.name);a.action=b.action;a.setAttribute("method",b.method);$(a).addClassName(b.classname);a.onsubmit=b.onsubmit;return a},input:function(c){var b={classname:"",id:"",type:"text",name:"",value:"",onclick:null,size:"",checked:false};Object.extend(b,c||{});var a=document.createElement("input");a.setAttribute("id",b.id);$(a).addClassName(b.classname);$(a).setAttribute("type",b.type);if(b.size=="1"){$(a).style.width="15px"}if(b.type=="submit"){$(a).addClassName("button")}$(a).setAttribute("size",b.size);$(a).setAttribute("name",b.name);$(a).setAttribute("value",b.value);$(a).checked=b.checked;a.onclick=b.onclick;return a},option:function(c){var b={classname:"",id:"",name:"",value:"",text:""};Object.extend(b,c||{});var a=document.createElement("option");$(a).addClassName(b.classname);a.setAttribute("id",b.id);a.setAttribute("name",b.name);a.setAttribute("value",b.value);a.text=b.text;return a},textarea:function(c){var b={classname:"",text:"",id:"",cols:"50",rows:"5",name:""};Object.extend(b,c||{});var a=document.createElement("textarea");a.setAttribute("id",b.id);$(a).addClassName(b.classname);$(a).setAttribute("rows",b.rows);$(a).setAttribute("cols",b.cols);$(a).setAttribute("name",b.name);$(a).value=b.text;return a},label:function(c){var b={classname:"",text:"",id:"",fore:""};Object.extend(b,c||{});var a=document.createElement("label");a.setAttribute("id",b.id);$(a).addClassName(b.classname);$(a).setAttribute("for",b.fore);$(a).update(b.text);return a},h:function(c){var b={classname:"",text:"",id:"",lvl:"1"};Object.extend(b,c||{});b.lvl=parseInt(b.lvl);if(!b.lvl||b.lvl<1||b.lvl>4){b.lvl="1"}var a=document.createElement("h"+b.lvl);a.setAttribute("id",b.id);$(a).addClassName(b.classname);$(a).update(b.text);return a},textnode:function(c){var b={text:""};Object.extend(b,c||{});var a=document.createTextNode(b.text);return a},table:function(c){var b={id:"",name:"",border:"",bordercolor:"",width:null,height:null,classname:"res"};Object.extend(b,c||{});var a=document.createElement("table");a.setAttribute("id",b.id);a.setAttribute("name",b.name);a.setAttribute("border",b.border);a.setAttribute("bordercolor",b.bordercolor);if(b.width!=null){a.style.width=b.width+"px"}if(b.height!=null){a.style.height=b.height+"px"}$(a).addClassName(b.classname);return a},tbody:function(c){var b={classname:"",id:""};Object.extend(b,c||{});var a=document.createElement("tbody");a.setAttribute("id",b.id);$(a).addClassName(b.classname);return a},thead:function(c){var b={classname:"",id:""};Object.extend(b,c||{});var a=document.createElement("thead");a.setAttribute("id",b.id);$(a).addClassName(b.classname);return a},th:function(c){var b={classname:"res",text:"",id:"",width:null,height:null,colspan:1};Object.extend(b,c||{});var a=document.createElement("th");if(b.height!=null){a.setAttribute("height",b.height)}if(b.width!=null){a.setAttribute("width",b.width)}a.setAttribute("id",b.id);a.colSpan=b.colspan;$(a).addClassName(b.classname);$(a).update(b.text);return a},tr:function(c){var b={id:"",classname:"res",onclick:null,rowspan:1,colspan:1};Object.extend(b,c||{});var a=document.createElement("tr");a.setAttribute("id",b.id);a.colSpan=b.colspan;a.rowSpan=b.rowspan;a.onclick=b.onclick;$(a).addClassName(b.classname);return a},td:function(c){var b={width:null,height:null,id:"",classname:"res",text:"",onclick:null,img:"",rowspan:1,colspan:1,size:""};Object.extend(b,c||{});var a=document.createElement("td");a=$(a);a.setAttribute("id",b.id);a.colSpan=b.colspan;a.rowSpan=b.rowspan;if(b.height!=null){a.setAttribute("height",b.height)}if(b.width!=null){a.setAttribute("width",b.width)}a.colSpan=b.colspan;a.onclick=b.onclick;a.addClassName(b.classname);if(b.img!=""){if(b.onclick!=null){a.appendChild(create.a({text:b.text,img:b.img}))}else{a.appendChild(this.img({src:b.img,text:b.text}))}}else{if(b.onclick!=null){a.appendChild(create.a({text:b.text,size:b.size}))}else{a.update(b.text)}}return a},ul:function(c){var b={id:"",classname:"",text:"",onclick:""};Object.extend(b,c||{});var a=document.createElement("ul");a.setAttribute("id",b.id);$(a).addClassName(b.classname);return a},li:function(c){var b={id:"",classname:"",text:"",onclick:"",size:""};Object.extend(b,c||{});var a=document.createElement("li");a.setAttribute("id",b.id);$(a).addClassName(b.classname);if(b.onclick!=""){a.appendChild(this.a({text:b.text,onclick:b.onclick,size:b.size}))}else{$(a).update(b.text)}return a},a:function(d){var b={id:"",classname:"",text:"",onclick:"",href:"#",img:"",size:"",title:""};Object.extend(b,d||{});var a=document.createElement("a");a.setAttribute("id",b.id);a.setAttribute("href",b.href);if(b.title==""){a.setAttribute("title",b.text)}else{a.setAttribute("title",b.title)}a.onclick=b.onclick;$(a).addClassName(b.classname);if(b.size!=""){b.text=(b.text).truncate(b.size)}if(b.img!=""){a.appendChild(this.img({src:b.img,text:b.text}))}else{var c=create.td({text:b.text});a.appendChild(this.textnode({text:c.innerHTML}))}return a},img:function(c){var b={id:"",text:"",onclick:"",border:0,width:null,height:null,src:""};Object.extend(b,c||{});var a=document.createElement("img");a.setAttribute("id",b.id);if(b.height!=null){a.setAttribute("height",b.height)}if(b.width!=null){a.setAttribute("width",b.width)}a.alt=b.text;a.title=b.text;a.border=b.border;a.src=b.src;a.onclick=b.onclick;return a},window:function(d,b){var c={maximizable:false,className:"alphacube",resizable:true,hideEffect:Element.hide,showEffect:Element.show,minWidth:10,width:200,height:200,destroyOnClose:true,onDestroy:function(){$(b).remove()}};Object.extend(c,d||{});var a=new Window(c);a.setContent(b,false,false);a.show();return a},pages:function(g,b,f,c){for(var e=0;e<g.childNodes.length;){g.removeChild(g.childNodes[e])}g.appendChild(create.textnode({text:"Pages : "}));var d=f-3;if(d<1){d=1}var a=f+4;if(a>b){a=b}if(d!=1){g.appendChild(create.a({text:1,onclick:new Function(c.replace(/__i__/,1))}));g.appendChild(create.textnode({text:"..."}))}for(e=d;e<=a;e++){g.appendChild(create.textnode({text:" "}));if(e==f){g.appendChild(create.textnode({text:e}))}else{g.appendChild(create.a({text:e,onclick:new Function(c.replace(/__i__/,e))}))}}if(a!=b){g.appendChild(create.textnode({text:"..."}));g.appendChild(create.a({text:b,onclick:new Function(c.replace(/__i__/,b))}))}g.show();return g}};create=new Create();function create_td_picture_game(d,b){var c=create.td({id:d});var a=document.createElement("img");a.border=0;a.alt=b;a.title=b;a.src="public/img/game/"+b.toLowerCase()+".jpg";c.appendChild(a);return c}function create_div_menu(c){var b=create.div({id:c});b.align="right";var a='<a href="#" onClick="javascript:mywindow.become_window(this.parentNode.parentNode); return false;"><img src="public/img/window.jpg" border="0"></a>';b.innerHTML=a;return b}function validateJSON(jsonText){return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(jsonText.replace(/"(\\.|[^"\\])*"/g,"")))&&eval("("+jsonText+")")}window.dhtmlHistory={initialize:function(){if(this.isInternetExplorer()==false){return}if(historyStorage.hasKey("DhtmlHistory_pageLoaded")==false){this.fireOnNewListener=false;this.firstLoad=true;historyStorage.put("DhtmlHistory_pageLoaded",true)}else{this.fireOnNewListener=true;this.firstLoad=false}},addListener:function(a){this.listener=a;if(this.fireOnNewListener==true){this.fireHistoryEvent(this.currentLocation);this.fireOnNewListener=false}},add:function(c,d){var a=this;var b=function(){if(a.currentWaitTime>0){a.currentWaitTime=a.currentWaitTime-a.WAIT_TIME}c=a.removeHash(c);var f=document.getElementById(c);if(f!=undefined||f!=null){var e="Exception: History locations can not have the same value as _any_ id's that might be in the document, due to a bug in Internet Explorer; please ask the developer to choose a history location that does not match any HTML id's in this document. The following ID is already taken and can not be a location: "+c;throw e}historyStorage.put(c,d);a.ignoreLocationChange=true;this.ieAtomicLocationChange=true;a.currentLocation=c;window.location.hash=c;if(a.isInternetExplorer()){a.iframe.src="blank.html?"+c}this.ieAtomicLocationChange=false};window.setTimeout(b,this.currentWaitTime);this.currentWaitTime=this.currentWaitTime+this.WAIT_TIME},isFirstLoad:function(){if(this.firstLoad==true){return true}else{return false}},isInternational:function(){return false},getVersion:function(){return"0.03"},getCurrentLocation:function(){var a=this.removeHash(window.location.hash);return a},currentLocation:null,listener:null,iframe:null,ignoreLocationChange:null,WAIT_TIME:200,currentWaitTime:0,fireOnNewListener:null,firstLoad:null,ieAtomicLocationChange:null,create:function(){var a=this.getCurrentLocation();this.currentLocation=a;if(this.isInternetExplorer()){document.write("<iframe style='border: 0px; width: 1px; height: 1px; position: absolute; bottom: 0px; right: 0px; visibility: visible;' name='DhtmlHistoryFrame' id='DhtmlHistoryFrame' src='blank.html?"+a+"'></iframe>");this.WAIT_TIME=400}var b=this;window.onunload=function(){b.firstLoad=null};if(this.isInternetExplorer()==false){if(historyStorage.hasKey("DhtmlHistory_pageLoaded")==false){this.ignoreLocationChange=true;this.firstLoad=true;historyStorage.put("DhtmlHistory_pageLoaded",true)}else{this.ignoreLocationChange=false;this.fireOnNewListener=true}}else{this.ignoreLocationChange=true}if(this.isInternetExplorer()){this.iframe=document.getElementById("DhtmlHistoryFrame")}var b=this;var c=function(){b.checkLocation()};setInterval(c,100)},fireHistoryEvent:function(a){var b=historyStorage.get(a);this.listener.call(null,a,b)},checkLocation:function(){if(this.isInternetExplorer()==false&&this.ignoreLocationChange==true){this.ignoreLocationChange=false;return}if(this.isInternetExplorer()==false&&this.ieAtomicLocationChange==true){return}var a=this.getCurrentLocation();if(a==this.currentLocation){return}this.ieAtomicLocationChange=true;if(this.isInternetExplorer()&&this.getIFrameHash()!=a){this.iframe.src="blank.html?"+a}else{if(this.isInternetExplorer()){return}}this.currentLocation=a;this.ieAtomicLocationChange=false;this.fireHistoryEvent(a)},getIFrameHash:function(){var a=document.getElementById("DhtmlHistoryFrame");var c=a.contentWindow.document;var b=new String(c.location.search);if(b.length==1&&b.charAt(0)=="?"){b=""}else{if(b.length>=2&&b.charAt(0)=="?"){b=b.substring(1)}}return b},removeHash:function(a){if(a==null||a==undefined){return null}else{if(a==""){return""}else{if(a.length==1&&a.charAt(0)=="#"){return""}else{if(a.length>1&&a.charAt(0)=="#"){return a.substring(1)}else{return a}}}}},iframeLoaded:function(a){if(this.ignoreLocationChange==true){this.ignoreLocationChange=false;return}var b=new String(a.search);if(b.length==1&&b.charAt(0)=="?"){b=""}else{if(b.length>=2&&b.charAt(0)=="?"){b=b.substring(1)}}if(this.pageLoadEvent!=true){window.location.hash=b}this.fireHistoryEvent(b)},isInternetExplorer:function(){var a=navigator.userAgent.toLowerCase();if(document.all&&a.indexOf("msie")!=-1){return true}else{return false}}};window.historyStorage={debugging:false,storageHash:new Object(),hashLoaded:false,put:function(a,b){this.assertValidKey(a);if(this.hasKey(a)){this.remove(a)}this.storageHash[a]=b;this.saveHashTable()},get:function(a){this.assertValidKey(a);this.loadHashTable();var b=this.storageHash[a];if(b==undefined){return null}else{return b}},remove:function(a){this.assertValidKey(a);this.loadHashTable();delete this.storageHash[a];this.saveHashTable()},reset:function(){this.storageField.value="";this.storageHash=new Object()},hasKey:function(a){this.assertValidKey(a);this.loadHashTable();if(typeof this.storageHash[a]=="undefined"){return false}else{return true}},isValidKey:function(a){if(typeof a!="string"){a=a.toString()}var b=/^[a-zA-Z0-9_ \!\@\#\$\%\^\&\*\(\)\+\=\:\;\,\.\/\?\|\\\~\{\}\[\]]*$/;return b.test(a)},storageField:null,init:function(){var b="position: absolute; top: -1000px; left: -1000px;";if(this.debugging==true){b="width: 30em; height: 30em;"}var a="<form id='historyStorageForm' method='GET' style='"+b+"'><textarea id='historyStorageField' style='"+b+"'left: -1000px;' name='historyStorageField'></textarea></form>";this.storageField=new Object()},assertValidKey:function(a){if(this.isValidKey(a)==false){throw"Please provide a valid key for window.historyStorage, key= "+a}},loadHashTable:function(){if(this.hashLoaded==false){var serializedHashTable=this.storageField.value;if(serializedHashTable!=""&&serializedHashTable!=null){this.storageHash=eval("("+serializedHashTable+")")}this.hashLoaded=true}},saveHashTable:function(){this.loadHashTable();var a=JSON.stringify(this.storageHash);this.storageField.value=a}};Array.prototype.______array="______array";var JSON={org:"http://www.JSON.org",copyright:"(c)2005 JSON.org",license:"http://www.crockford.com/JSON/license.html",stringify:function(a){var g,e,b,f="",d;switch(typeof a){case"object":if(a){if(a.______array=="______array"){for(e=0;e<a.length;++e){d=this.stringify(a[e]);if(f){f+=","}f+=d}return"["+f+"]"}else{if(typeof a.toString!="undefined"){for(e in a){d=a[e];if(typeof d!="undefined"&&typeof d!="function"){d=this.stringify(d);if(f){f+=","}f+=this.stringify(e)+":"+d}}return"{"+f+"}"}}}return"null";case"number":return isFinite(a)?String(a):"null";case"string":b=a.length;f='"';for(e=0;e<b;e+=1){g=a.charAt(e);if(g>=" "){if(g=="\\"||g=='"'){f+="\\"}f+=g}else{switch(g){case"\b":f+="\\b";break;case"\f":f+="\\f";break;case"\n":f+="\\n";break;case"\r":f+="\\r";break;case"\t":f+="\\t";break;default:g=g.charCodeAt();f+="\\u00"+Math.floor(g/16).toString(16)+(g%16).toString(16)}}}return f+'"';case"boolean":return String(a);default:return"null"}},parse:function(m){var d=0;var a=" ";function l(n){throw {name:"JSONError",message:n,at:d-1,text:m}}function g(){a=m.charAt(d);d+=1;return a}function j(){while(a!=""&&a<=" "){g()}}function k(){var p,q="",o,n;if(a=='"'){outer:while(g()){if(a=='"'){g();return q}else{if(a=="\\"){switch(g()){case"b":q+="\b";break;case"f":q+="\f";break;case"n":q+="\n";break;case"r":q+="\r";break;case"t":q+="\t";break;case"u":n=0;for(p=0;p<4;p+=1){o=parseInt(g(),16);if(!isFinite(o)){break outer}n=n*16+o}q+=String.fromCharCode(n);break;default:q+=a}}else{q+=a}}}}l("Bad string")}function h(){var n=[];if(a=="["){g();j();if(a=="]"){g();return n}while(a){n.push(c());j();if(a=="]"){g();return n}else{if(a!=","){break}}g();j()}}l("Bad array")}function e(){var n,p={};if(a=="{"){g();j();if(a=="}"){g();return p}while(a){n=k();j();if(a!=":"){break}g();p[n]=c();j();if(a=="}"){g();return p}else{if(a!=","){break}}g();j()}}l("Bad object")}function f(){var p="",o;if(a=="-"){p="-";g()}while(a>="0"&&a<="9"){p+=a;g()}if(a=="."){p+=".";while(g()&&a>="0"&&a<="9"){p+=a}}if(a=="e"||a=="E"){p+="e";g();if(a=="-"||a=="+"){p+=a;g()}while(a>="0"&&a<="9"){p+=a;g()}}o=+p;if(!isFinite(o)){l("Bad number")}else{return o}}function b(){switch(a){case"t":if(g()=="r"&&g()=="u"&&g()=="e"){g();return true}break;case"f":if(g()=="a"&&g()=="l"&&g()=="s"&&g()=="e"){g();return false}break;case"n":if(g()=="u"&&g()=="l"&&g()=="l"){g();return null}break}l("Syntax error")}function c(){j();switch(a){case"{":return e();case"[":return h();case'"':return k();case"-":return f();default:return a>="0"&&a<="9"?f():b()}}return c()}};window.historyStorage.init();window.dhtmlHistory.create();mouse_pos_x=0;mouse_pos_y=0;window_loaded=false;MyWindow=Class.create();MyWindow.prototype={initialize:function(){this.nb=0;this.loaded=0;var a=this;Event.observe(document,"mousemove",a.update_pos,false)},update_pos:function(a){mouse_pos_x=Event.pointerX(a);mouse_pos_y=Event.pointerY(a)},become_window:function(b){var a=b.id;this.aspect_window_move(b,{length:450,height:300});load_page(a,true)},aspect_window_move:function(h,g,m){if(this.loaded!=2){if(this.loaded==0){this.element=h;this.params=g;this.is_uniq=m;this.loaded=1}if(window_loaded){this.loaded=2}}if(h==null){h=this.element;g=this.params;m=this.is_uniq}var e={length:200,height:200,top:mouse_pos_y,left:mouse_pos_x,center:false,destroyonclose:true,id:null,title:""};Object.extend(e,g||{});if(g.left==null){e.left-=(e.length/2);e.top-=(e.height/2)}if(e.left<0){e.left=0}if(e.top<0){e.top=0}var k=this;var l=null;if(e.id!=""){l=Windows.getWindow(e.id)}if(!l){l=new Window({maximizable:false,className:"alphacube",resizable:true,hideEffect:Element.hide,showEffect:Element.show,minWidth:150,width:e.length,height:e.height,top:e.top,left:e.left,destroyOnClose:e.destroyonclose,onDestroy:function(){$(h).remove()},id:e.id,title:e.title})}if(e.center){l.showCenter()}var d=h.getElementsByTagName("div");for(var j=0;j<d.length;++j){var c=/menu_window$/;if(c.exec(d[j].id)!=null){h.removeChild(d[j]);break}}if(m==null){var f=h.id;this.nb++;h.id="window_"+this.nb;var a=h.getElementsByTagName("form");var b=$A(a);b.each(function(o){if(typeof o.action=="string"){o.action=(o.action).sub(f,h.id)}});var n=h.getElementsByTagName("a");var b=$A(n);b.each(function(o){if(typeof o.onclick=="string"){o.onclick=(o.onclick).sub(f,h.id)}})}l.setContent(h,false,false);l.show();return l},load_window:function(d,c){var b={page_name:"",param:"",length:200,height:400};Object.extend(b,d||{});var a=this;new Ajax.Request(b.page_name+"?"+b.param,{method:"get",onSuccess:function(f){var e=a.create_windows_move(b.page_name,f.responseText);a.aspect_window_move(e,b,true);if(c!="function"){c()}}})},create_windows_move:function(e,b){var d=create.div({id:e});var a=create_div_menu(e+"menu_window");var c=create.div({id:e+"content_window",text:b});d.appendChild(c);return d}};mywindow=new MyWindow();var Window=Class.create();Window.keepMultiModalWindow=false;Window.hasEffectLib=(typeof Effect!="undefined");Window.resizeEffectDuration=0.4;Window.prototype={initialize:function(){var c;var b=0;if(arguments.length>0){if(typeof arguments[0]=="string"){c=arguments[0];b=1}else{c=arguments[0]?arguments[0].id:null}}if(!c){c="window_"+new Date().getTime()}if($(c)){alert("Window "+c+" is already registered in the DOM! Make sure you use setDestroyOnClose() or destroyOnClose: true in the constructor")}this.options=Object.extend({className:"dialog",blurClassName:null,minWidth:100,minHeight:20,resizable:true,closable:true,minimizable:true,maximizable:true,draggable:true,userData:null,showEffect:(Window.hasEffectLib?Effect.Appear:Element.show),hideEffect:(Window.hasEffectLib?Effect.Fade:Element.hide),showEffectOptions:{},hideEffectOptions:{},effectOptions:null,parent:document.body,title:"&nbsp;",url:null,onload:Prototype.emptyFunction,width:200,height:300,opacity:1,recenterAuto:true,wiredDrag:false,closeCallback:null,destroyOnClose:false,gridX:1,gridY:1},arguments[b]||{});if(this.options.blurClassName){this.options.focusClassName=this.options.className}if(typeof this.options.top=="undefined"&&typeof this.options.bottom=="undefined"){this.options.top=this._round(Math.random()*500,this.options.gridY)}if(typeof this.options.left=="undefined"&&typeof this.options.right=="undefined"){this.options.left=this._round(Math.random()*500,this.options.gridX)}if(this.options.effectOptions){Object.extend(this.options.hideEffectOptions,this.options.effectOptions);Object.extend(this.options.showEffectOptions,this.options.effectOptions);if(this.options.showEffect==Element.Appear){this.options.showEffectOptions.to=this.options.opacity}}if(Window.hasEffectLib){if(this.options.showEffect==Effect.Appear){this.options.showEffectOptions.to=this.options.opacity}if(this.options.hideEffect==Effect.Fade){this.options.hideEffectOptions.from=this.options.opacity}}if(this.options.hideEffect==Element.hide){this.options.hideEffect=function(){Element.hide(this.element);if(this.options.destroyOnClose){this.destroy()}}.bind(this)}if(this.options.parent!=document.body){this.options.parent=$(this.options.parent)}this.element=this._createWindow(c);this.element.win=this;this.eventMouseDown=this._initDrag.bindAsEventListener(this);this.eventMouseUp=this._endDrag.bindAsEventListener(this);this.eventMouseMove=this._updateDrag.bindAsEventListener(this);this.eventOnLoad=this._getWindowBorderSize.bindAsEventListener(this);this.eventMouseDownContent=this.toFront.bindAsEventListener(this);this.eventResize=this._recenter.bindAsEventListener(this);this.topbar=$(this.element.id+"_top");this.bottombar=$(this.element.id+"_bottom");this.content=$(this.element.id+"_content");Event.observe(this.topbar,"mousedown",this.eventMouseDown);Event.observe(this.bottombar,"mousedown",this.eventMouseDown);Event.observe(this.content,"mousedown",this.eventMouseDownContent);Event.observe(window,"load",this.eventOnLoad);Event.observe(window,"resize",this.eventResize);Event.observe(window,"scroll",this.eventResize);Event.observe(this.options.parent,"scroll",this.eventResize);if(this.options.draggable){var a=this;[this.topbar,this.topbar.up().previous(),this.topbar.up().next()].each(function(d){d.observe("mousedown",a.eventMouseDown);d.addClassName("top_draggable")});[this.bottombar.up(),this.bottombar.up().previous(),this.bottombar.up().next()].each(function(d){d.observe("mousedown",a.eventMouseDown);d.addClassName("bottom_draggable")})}if(this.options.resizable){this.sizer=$(this.element.id+"_sizer");Event.observe(this.sizer,"mousedown",this.eventMouseDown)}this.useLeft=null;this.useTop=null;if(typeof this.options.left!="undefined"){this.element.setStyle({left:parseFloat(this.options.left)+"px"});this.useLeft=true}else{this.element.setStyle({right:parseFloat(this.options.right)+"px"});this.useLeft=false}if(typeof this.options.top!="undefined"){this.element.setStyle({top:parseFloat(this.options.top)+"px"});this.useTop=true}else{this.element.setStyle({bottom:parseFloat(this.options.bottom)+"px"});this.useTop=false}this.storedLocation=null;this.setOpacity(this.options.opacity);if(this.options.zIndex){this.setZIndex(this.options.zIndex)}if(this.options.destroyOnClose){this.setDestroyOnClose(true)}this._getWindowBorderSize();this.width=this.options.width;this.height=this.options.height;this.visible=false;this.constraint=false;this.constraintPad={top:0,left:0,bottom:0,right:0};if(this.width&&this.height){this.setSize(this.options.width,this.options.height)}this.setTitle(this.options.title);Windows.register(this)},destroy:function(){this._notify("onDestroy");Event.stopObserving(this.topbar,"mousedown",this.eventMouseDown);Event.stopObserving(this.bottombar,"mousedown",this.eventMouseDown);Event.stopObserving(this.content,"mousedown",this.eventMouseDownContent);Event.stopObserving(window,"load",this.eventOnLoad);Event.stopObserving(window,"resize",this.eventResize);Event.stopObserving(window,"scroll",this.eventResize);Event.stopObserving(this.content,"load",this.options.onload);if(this._oldParent){var c=this.getContent();var a=null;for(var b=0;b<c.childNodes.length;b++){a=c.childNodes[b];if(a.nodeType==1){break}a=null}if(a){this._oldParent.appendChild(a)}this._oldParent=null}if(this.sizer){Event.stopObserving(this.sizer,"mousedown",this.eventMouseDown)}if(this.options.url){this.content.src=null}if(this.iefix){Element.remove(this.iefix)}Element.remove(this.element);Windows.unregister(this)},setCloseCallback:function(a){this.options.closeCallback=a},getContent:function(){return this.content},setContent:function(h,g,b){var a=$(h);if(null==a){throw"Unable to find element '"+h+"' in DOM"}this._oldParent=a.parentNode;var f=null;var e=null;if(g){f=Element.getDimensions(a)}if(b){e=Position.cumulativeOffset(a)}var c=this.getContent();this.setHTMLContent("");c=this.getContent();c.appendChild(a);a.show();if(g){this.setSize(f.width,f.height)}if(b){this.setLocation(e[1]-this.heightN,e[0]-this.widthW)}},setHTMLContent:function(a){if(this.options.url){this.content.src=null;this.options.url=null;var b='<div id="'+this.getId()+'_content" class="'+this.options.className+'_content"> </div>';$(this.getId()+"_table_content").innerHTML=b;this.content=$(this.element.id+"_content")}this.getContent().innerHTML=a},setAjaxContent:function(b,a,d,c){this.showFunction=d?"showCenter":"show";this.showModal=c||false;a=a||{};this.setHTMLContent("");this.onComplete=a.onComplete;if(!this._onCompleteHandler){this._onCompleteHandler=this._setAjaxContent.bind(this)}a.onComplete=this._onCompleteHandler;new Ajax.Request(b,a);a.onComplete=this.onComplete},_setAjaxContent:function(a){Element.update(this.getContent(),a.responseText);if(this.onComplete){this.onComplete(a)}this.onComplete=null;this[this.showFunction](this.showModal)},setURL:function(a){if(this.options.url){this.content.src=null}this.options.url=a;var b="<iframe frameborder='0' name='"+this.getId()+"_content'  id='"+this.getId()+"_content' src='"+a+"' width='"+this.width+"' height='"+this.height+"'> </iframe>";$(this.getId()+"_table_content").innerHTML=b;this.content=$(this.element.id+"_content")},getURL:function(){return this.options.url?this.options.url:null},refresh:function(){if(this.options.url){$(this.element.getAttribute("id")+"_content").src=this.options.url}},setCookie:function(b,c,o,e,a){b=b||this.element.id;this.cookie=[b,c,o,e,a];var m=WindowUtilities.getCookie(b);if(m){var n=m.split(",");var k=n[0].split(":");var j=n[1].split(":");var l=parseFloat(n[2]),f=parseFloat(n[3]);var g=n[4];var d=n[5];this.setSize(l,f);if(g=="true"){this.doMinimize=true}else{if(d=="true"){this.doMaximize=true}}this.useLeft=k[0]=="l";this.useTop=j[0]=="t";this.element.setStyle(this.useLeft?{left:k[1]}:{right:k[1]});this.element.setStyle(this.useTop?{top:j[1]}:{bottom:j[1]})}},getId:function(){return this.element.id},setDestroyOnClose:function(){this.options.destroyOnClose=true},setConstraint:function(a,b){this.constraint=a;this.constraintPad=Object.extend(this.constraintPad,b||{});if(this.useTop&&this.useLeft){this.setLocation(parseFloat(this.element.style.top),parseFloat(this.element.style.left))}},_initDrag:function(b){if(Event.element(b)==this.sizer&&this.isMinimized()){return}if(Event.element(b)!=this.sizer&&this.isMaximized()){return}if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize()}this.pointer=[this._round(Event.pointerX(b),this.options.gridX),this._round(Event.pointerY(b),this.options.gridY)];if(this.options.wiredDrag){this.currentDrag=this._createWiredElement()}else{this.currentDrag=this.element}if(Event.element(b)==this.sizer){this.doResize=true;this.widthOrg=this.width;this.heightOrg=this.height;this.bottomOrg=parseFloat(this.element.getStyle("bottom"));this.rightOrg=parseFloat(this.element.getStyle("right"));this._notify("onStartResize")}else{this.doResize=false;var a=$(this.getId()+"_close");if(a&&Position.within(a,this.pointer[0],this.pointer[1])){this.currentDrag=null;return}this.toFront();if(!this.options.draggable){return}this._notify("onStartMove")}Event.observe(document,"mouseup",this.eventMouseUp,false);Event.observe(document,"mousemove",this.eventMouseMove,false);WindowUtilities.disableScreen("__invisible__","__invisible__",this.overlayOpacity);document.body.ondrag=function(){return false};document.body.onselectstart=function(){return false};this.currentDrag.show();Event.stop(b)},_round:function(b,a){return a==1?b:b=Math.floor(b/a)*a},_updateDrag:function(b){var a=[this._round(Event.pointerX(b),this.options.gridX),this._round(Event.pointerY(b),this.options.gridY)];var l=a[0]-this.pointer[0];var k=a[1]-this.pointer[1];if(this.doResize){var j=this.widthOrg+l;var d=this.heightOrg+k;l=this.width-this.widthOrg;k=this.height-this.heightOrg;if(this.useLeft){j=this._updateWidthConstraint(j)}else{this.currentDrag.setStyle({right:(this.rightOrg-l)+"px"})}if(this.useTop){d=this._updateHeightConstraint(d)}else{this.currentDrag.setStyle({bottom:(this.bottomOrg-k)+"px"})}this.setSize(j,d);this._notify("onResize")}else{this.pointer=a;if(this.useLeft){var c=parseFloat(this.currentDrag.getStyle("left"))+l;var g=this._updateLeftConstraint(c);this.pointer[0]+=g-c;this.currentDrag.setStyle({left:g+"px"})}else{this.currentDrag.setStyle({right:parseFloat(this.currentDrag.getStyle("right"))-l+"px"})}if(this.useTop){var f=parseFloat(this.currentDrag.getStyle("top"))+k;var e=this._updateTopConstraint(f);this.pointer[1]+=e-f;this.currentDrag.setStyle({top:e+"px"})}else{this.currentDrag.setStyle({bottom:parseFloat(this.currentDrag.getStyle("bottom"))-k+"px"})}this._notify("onMove")}if(this.iefix){this._fixIEOverlapping()}this._removeStoreLocation();Event.stop(b)},_endDrag:function(a){WindowUtilities.enableScreen("__invisible__");if(this.doResize){this._notify("onEndResize")}else{this._notify("onEndMove")}Event.stopObserving(document,"mouseup",this.eventMouseUp,false);Event.stopObserving(document,"mousemove",this.eventMouseMove,false);Event.stop(a);this._hideWiredElement();this._saveCookie();document.body.ondrag=null;document.body.onselectstart=null},_updateLeftConstraint:function(b){if(this.constraint&&this.useLeft&&this.useTop){var a=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;if(b<this.constraintPad.left){b=this.constraintPad.left}if(b+this.width+this.widthE+this.widthW>a-this.constraintPad.right){b=a-this.constraintPad.right-this.width-this.widthE-this.widthW}}return b},_updateTopConstraint:function(c){if(this.constraint&&this.useLeft&&this.useTop){var a=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var b=this.height+this.heightN+this.heightS;if(c<this.constraintPad.top){c=this.constraintPad.top}if(c+b>a-this.constraintPad.bottom){c=a-this.constraintPad.bottom-b}}return c},_updateWidthConstraint:function(a){if(this.constraint&&this.useLeft&&this.useTop){var b=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;var c=parseFloat(this.element.getStyle("left"));if(c+a+this.widthE+this.widthW>b-this.constraintPad.right){a=b-this.constraintPad.right-c-this.widthE-this.widthW}}return a},_updateHeightConstraint:function(b){if(this.constraint&&this.useLeft&&this.useTop){var a=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var c=parseFloat(this.element.getStyle("top"));if(c+b+this.heightN+this.heightS>a-this.constraintPad.bottom){b=a-this.constraintPad.bottom-c-this.heightN-this.heightS}}return b},_createWindow:function(a){var f=this.options.className;var d=document.createElement("div");d.setAttribute("id",a);d.className="dialog";var e;if(this.options.url){e='<iframe frameborder="0" name="'+a+'_content"  id="'+a+'_content" src="'+this.options.url+'"> </iframe>'}else{e='<div id="'+a+'_content" class="'+f+'_content"> </div>'}var g=this.options.closable?"<div class='"+f+"_close' id='"+a+"_close' onclick='Windows.close(\""+a+"\", event)'> </div>":"";var h=this.options.minimizable?"<div class='"+f+"_minimize' id='"+a+"_minimize' onclick='Windows.minimize(\""+a+"\", event)'> </div>":"";var j=this.options.maximizable?"<div class='"+f+"_maximize' id='"+a+"_maximize' onclick='Windows.maximize(\""+a+"\", event)'> </div>":"";var c=this.options.resizable?"class='"+f+"_sizer' id='"+a+"_sizer'":"class='"+f+"_se'";var b="../themes/default/blank.gif";d.innerHTML=g+h+j+"      <table id='"+a+"_row1' class=\"top table_window\">        <tr>          <td class='"+f+"_nw'></td>          <td class='"+f+"_n'><div id='"+a+"_top' class='"+f+"_title title_window'>"+this.options.title+"</div></td>          <td class='"+f+"_ne'></td>        </tr>      </table>      <table id='"+a+"_row2' class=\"mid table_window\">        <tr>          <td class='"+f+"_w'></td>            <td id='"+a+"_table_content' class='"+f+"_content' valign='top'>"+e+"</td>          <td class='"+f+"_e'></td>        </tr>      </table>        <table id='"+a+"_row3' class=\"bot table_window\">        <tr>          <td class='"+f+"_sw'></td>            <td class='"+f+"_s'><div id='"+a+"_bottom' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td>            <td "+c+"></td>        </tr>      </table>    ";Element.hide(d);this.options.parent.insertBefore(d,this.options.parent.firstChild);Event.observe($(a+"_content"),"load",this.options.onload);return d},changeClassName:function(a){var b=this.options.className;var c=this.getId();$A(["_close","_minimize","_maximize","_sizer","_content"]).each(function(d){this._toggleClassName($(c+d),b+d,a+d)}.bind(this));this._toggleClassName($(c+"_top"),b+"_title",a+"_title");$$("#"+c+" td").each(function(d){d.className=d.className.sub(b,a)});this.options.className=a},_toggleClassName:function(c,b,a){if(c){c.removeClassName(b);c.addClassName(a)}},setLocation:function(c,b){c=this._updateTopConstraint(c);b=this._updateLeftConstraint(b);var a=this.currentDrag||this.element;a.setStyle({top:c+"px"});a.setStyle({left:b+"px"});this.useLeft=true;this.useTop=true},getLocation:function(){var a={};if(this.useTop){a=Object.extend(a,{top:this.element.getStyle("top")})}else{a=Object.extend(a,{bottom:this.element.getStyle("bottom")})}if(this.useLeft){a=Object.extend(a,{left:this.element.getStyle("left")})}else{a=Object.extend(a,{right:this.element.getStyle("right")})}return a},getSize:function(){return{width:this.width,height:this.height}},setSize:function(c,b,a){c=parseFloat(c);b=parseFloat(b);if(!this.minimized&&c<this.options.minWidth){c=this.options.minWidth}if(!this.minimized&&b<this.options.minHeight){b=this.options.minHeight}if(this.options.maxHeight&&b>this.options.maxHeight){b=this.options.maxHeight}if(this.options.maxWidth&&c>this.options.maxWidth){c=this.options.maxWidth}if(this.useTop&&this.useLeft&&Window.hasEffectLib&&Effect.ResizeWindow&&a){new Effect.ResizeWindow(this,null,null,c,b,{duration:Window.resizeEffectDuration})}else{this.width=c;this.height=b;var f=this.currentDrag?this.currentDrag:this.element;f.setStyle({width:c+this.widthW+this.widthE+"px"});f.setStyle({height:b+this.heightN+this.heightS+"px"});if(!this.currentDrag||this.currentDrag==this.element){var d=$(this.element.id+"_content");d.setStyle({height:b+"px"});d.setStyle({width:c+"px"})}}},updateHeight:function(){this.setSize(this.width,this.content.scrollHeight,true)},updateWidth:function(){this.setSize(this.content.scrollWidth,this.height,true)},toFront:function(){if(this.element.style.zIndex<Windows.maxZIndex){this.setZIndex(Windows.maxZIndex+1)}if(this.iefix){this._fixIEOverlapping()}},getBounds:function(b){if(!this.width||!this.height||!this.visible){this.computeBounds()}var a=this.width;var c=this.height;if(!b){a+=this.widthW+this.widthE;c+=this.heightN+this.heightS}var d=Object.extend(this.getLocation(),{width:a+"px",height:c+"px"});return d},computeBounds:function(){if(!this.width||!this.height){var a=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0,this.options.className);if(this.height){this.width=a+5}else{this.height=a+5}}this.setSize(this.width,this.height);if(this.centered){this._center(this.centerTop,this.centerLeft)}},show:function(b){this.visible=true;if(b){if(typeof this.overlayOpacity=="undefined"){var a=this;setTimeout(function(){a.show(b)},10);return}Windows.addModalWindow(this);this.modal=true;this.setZIndex(Windows.maxZIndex+1);Windows.unsetOverflow(this)}else{if(!this.element.style.zIndex){this.setZIndex(Windows.maxZIndex+1)}}if(this.oldStyle){this.getContent().setStyle({overflow:this.oldStyle})}this.computeBounds();this._notify("onBeforeShow");if(this.options.showEffect!=Element.show&&this.options.showEffectOptions){this.options.showEffect(this.element,this.options.showEffectOptions)}else{this.options.showEffect(this.element)}this._checkIEOverlapping();WindowUtilities.focusedWindow=this;this._notify("onShow")},showCenter:function(a,c,b){this.centered=true;this.centerTop=c;this.centerLeft=b;this.show(a)},isVisible:function(){return this.visible},_center:function(c,b){var d=WindowUtilities.getWindowScroll(this.options.parent);var a=WindowUtilities.getPageSize(this.options.parent);if(typeof c=="undefined"){c=(a.windowHeight-(this.height+this.heightN+this.heightS))/2}c+=d.top;if(typeof b=="undefined"){b=(a.windowWidth-(this.width+this.widthW+this.widthE))/2}b+=d.left;this.setLocation(c,b);this.toFront()},_recenter:function(b){if(this.centered){var a=WindowUtilities.getPageSize(this.options.parent);var c=WindowUtilities.getWindowScroll(this.options.parent);if(this.pageSize&&this.pageSize.windowWidth==a.windowWidth&&this.pageSize.windowHeight==a.windowHeight&&this.windowScroll.left==c.left&&this.windowScroll.top==c.top){return}this.pageSize=a;this.windowScroll=c;if($("overlay_modal")){$("overlay_modal").setStyle({height:(a.pageHeight+"px")})}if(this.options.recenterAuto){this._center(this.centerTop,this.centerLeft)}}},hide:function(){this.visible=false;if(this.modal){Windows.removeModalWindow(this);Windows.resetOverflow()}this.oldStyle=this.getContent().getStyle("overflow")||"auto";this.getContent().setStyle({overflow:"hidden"});this.options.hideEffect(this.element,this.options.hideEffectOptions);if(this.iefix){this.iefix.hide()}if(!this.doNotNotifyHide){this._notify("onHide")}},close:function(){if(this.visible){if(this.options.closeCallback&&!this.options.closeCallback(this)){return}if(this.options.destroyOnClose){var a=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var b=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){b();a()}}else{this.options.hideEffectOptions.afterFinish=function(){a()}}}Windows.updateFocusedWindow();this.doNotNotifyHide=true;this.hide();this.doNotNotifyHide=false;this._notify("onClose")}},minimize:function(){if(this.resizing){return}var a=$(this.getId()+"_row2");if(!this.minimized){this.minimized=true;var d=a.getDimensions().height;this.r2Height=d;var c=this.element.getHeight()-d;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height-d,{duration:Window.resizeEffectDuration})}else{this.height-=d;this.element.setStyle({height:c+"px"});a.hide()}if(!this.useTop){var b=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(b+d)+"px"})}}else{this.minimized=false;var d=this.r2Height;this.r2Height=null;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height+d,{duration:Window.resizeEffectDuration})}else{var c=this.element.getHeight()+d;this.height+=d;this.element.setStyle({height:c+"px"});a.show()}if(!this.useTop){var b=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(b-d)+"px"})}this.toFront()}this._notify("onMinimize");this._saveCookie()},maximize:function(){if(this.isMinimized()||this.resizing){return}if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize()}if(this.storedLocation!=null){this._restoreLocation();if(this.iefix){this.iefix.hide()}}else{this._storeLocation();Windows.unsetOverflow(this);var g=WindowUtilities.getWindowScroll(this.options.parent);var b=WindowUtilities.getPageSize(this.options.parent);var f=g.left;var e=g.top;if(this.options.parent!=document.body){g={top:0,left:0,bottom:0,right:0};var d=this.options.parent.getDimensions();b.windowWidth=d.width;b.windowHeight=d.height;e=0;f=0}if(this.constraint){b.windowWidth-=Math.max(0,this.constraintPad.left)+Math.max(0,this.constraintPad.right);b.windowHeight-=Math.max(0,this.constraintPad.top)+Math.max(0,this.constraintPad.bottom);f+=Math.max(0,this.constraintPad.left);e+=Math.max(0,this.constraintPad.top)}var c=b.windowWidth-this.widthW-this.widthE;var a=b.windowHeight-this.heightN-this.heightS;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,e,f,c,a,{duration:Window.resizeEffectDuration})}else{this.setSize(c,a);this.element.setStyle(this.useLeft?{left:f}:{right:f});this.element.setStyle(this.useTop?{top:e}:{bottom:e})}this.toFront();if(this.iefix){this._fixIEOverlapping()}}this._notify("onMaximize");this._saveCookie()},isMinimized:function(){return this.minimized},isMaximized:function(){return(this.storedLocation!=null)},setOpacity:function(a){if(Element.setOpacity){Element.setOpacity(this.element,a)}},setZIndex:function(a){this.element.setStyle({zIndex:a});Windows.updateZindex(a,this)},setTitle:function(a){if(!a||a==""){a="&nbsp;"}Element.update(this.element.id+"_top",a)},getTitle:function(){return $(this.element.id+"_top").innerHTML},setStatusBar:function(b){var a=$(this.getId()+"_bottom");if(typeof(b)=="object"){if(this.bottombar.firstChild){this.bottombar.replaceChild(b,this.bottombar.firstChild)}else{this.bottombar.appendChild(b)}}else{this.bottombar.innerHTML=b}},_checkIEOverlapping:function(){if(!this.iefix&&(navigator.appVersion.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Opera")<0)&&(this.element.getStyle("position")=="absolute")){new Insertion.After(this.element.id,'<iframe id="'+this.element.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.element.id+"_iefix")}if(this.iefix){setTimeout(this._fixIEOverlapping.bind(this),50)}},_fixIEOverlapping:function(){Position.clone(this.element,this.iefix);this.iefix.style.zIndex=this.element.style.zIndex-1;this.iefix.show()},_getWindowBorderSize:function(b){var c=this._createHiddenDiv(this.options.className+"_n");this.heightN=Element.getDimensions(c).height;c.parentNode.removeChild(c);var c=this._createHiddenDiv(this.options.className+"_s");this.heightS=Element.getDimensions(c).height;c.parentNode.removeChild(c);var c=this._createHiddenDiv(this.options.className+"_e");this.widthE=Element.getDimensions(c).width;c.parentNode.removeChild(c);var c=this._createHiddenDiv(this.options.className+"_w");this.widthW=Element.getDimensions(c).width;c.parentNode.removeChild(c);var c=document.createElement("div");c.className="overlay_"+this.options.className;document.body.appendChild(c);var a=this;setTimeout(function(){a.overlayOpacity=($(c).getStyle("opacity"));c.parentNode.removeChild(c)},10);if(Prototype.Browser.IE){this.heightS=$(this.getId()+"_row3").getDimensions().height;this.heightN=$(this.getId()+"_row1").getDimensions().height}if(Prototype.Browser.WebKit&&Prototype.Browser.WebKitVersion<420){this.setSize(this.width,this.height)}if(this.doMaximize){this.maximize()}if(this.doMinimize){this.minimize()}},_createHiddenDiv:function(b){var a=document.body;var c=document.createElement("div");c.setAttribute("id",this.element.id+"_tmp");c.className=b;c.style.display="none";c.innerHTML="";a.insertBefore(c,a.firstChild);return c},_storeLocation:function(){if(this.storedLocation==null){this.storedLocation={useTop:this.useTop,useLeft:this.useLeft,top:this.element.getStyle("top"),bottom:this.element.getStyle("bottom"),left:this.element.getStyle("left"),right:this.element.getStyle("right"),width:this.width,height:this.height}}},_restoreLocation:function(){if(this.storedLocation!=null){this.useLeft=this.storedLocation.useLeft;this.useTop=this.storedLocation.useTop;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,this.storedLocation.top,this.storedLocation.left,this.storedLocation.width,this.storedLocation.height,{duration:Window.resizeEffectDuration})}else{this.element.setStyle(this.useLeft?{left:this.storedLocation.left}:{right:this.storedLocation.right});this.element.setStyle(this.useTop?{top:this.storedLocation.top}:{bottom:this.storedLocation.bottom});this.setSize(this.storedLocation.width,this.storedLocation.height)}Windows.resetOverflow();this._removeStoreLocation()}},_removeStoreLocation:function(){this.storedLocation=null},_saveCookie:function(){if(this.cookie){var a="";if(this.useLeft){a+="l:"+(this.storedLocation?this.storedLocation.left:this.element.getStyle("left"))}else{a+="r:"+(this.storedLocation?this.storedLocation.right:this.element.getStyle("right"))}if(this.useTop){a+=",t:"+(this.storedLocation?this.storedLocation.top:this.element.getStyle("top"))}else{a+=",b:"+(this.storedLocation?this.storedLocation.bottom:this.element.getStyle("bottom"))}a+=","+(this.storedLocation?this.storedLocation.width:this.width);a+=","+(this.storedLocation?this.storedLocation.height:this.height);a+=","+this.isMinimized();a+=","+this.isMaximized();WindowUtilities.setCookie(a,this.cookie)}},_createWiredElement:function(){if(!this.wiredElement){if(Prototype.Browser.IE){this._getWindowBorderSize()}var b=document.createElement("div");b.className="wired_frame "+this.options.className+"_wired_frame";b.style.position="absolute";this.options.parent.insertBefore(b,this.options.parent.firstChild);this.wiredElement=$(b)}if(this.useLeft){this.wiredElement.setStyle({left:this.element.getStyle("left")})}else{this.wiredElement.setStyle({right:this.element.getStyle("right")})}if(this.useTop){this.wiredElement.setStyle({top:this.element.getStyle("top")})}else{this.wiredElement.setStyle({bottom:this.element.getStyle("bottom")})}var a=this.element.getDimensions();this.wiredElement.setStyle({width:a.width+"px",height:a.height+"px"});this.wiredElement.setStyle({zIndex:Windows.maxZIndex+30});return this.wiredElement},_hideWiredElement:function(){if(!this.wiredElement||!this.currentDrag){return}if(this.currentDrag==this.element){this.currentDrag=null}else{if(this.useLeft){this.element.setStyle({left:this.currentDrag.getStyle("left")})}else{this.element.setStyle({right:this.currentDrag.getStyle("right")})}if(this.useTop){this.element.setStyle({top:this.currentDrag.getStyle("top")})}else{this.element.setStyle({bottom:this.currentDrag.getStyle("bottom")})}this.currentDrag.hide();this.currentDrag=null;if(this.doResize){this.setSize(this.width,this.height)}}},_notify:function(a){if(this.options[a]){this.options[a](this)}else{Windows.notify(a,this)}}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:10,overlayShowEffectOptions:{duration:0.5},overlayHideEffectOptions:{duration:0.5},addObserver:function(a){this.removeObserver(a);this.observers.push(a)},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b==a})},notify:function(a,b){this.observers.each(function(c){if(c[a]){c[a](a,b)}})},getWindow:function(a){return this.windows.detect(function(b){return b.getId()==a})},getFocusedWindow:function(){return this.focusedWindow},updateFocusedWindow:function(){this.focusedWindow=this.windows.length>=2?this.windows[this.windows.length-2]:null},register:function(a){this.windows.push(a)},addModalWindow:function(a){if(this.modalWindows.length==0){WindowUtilities.disableScreen(a.options.className,"overlay_modal",a.overlayOpacity,a.getId(),a.options.parent)}else{if(Window.keepMultiModalWindow){$("overlay_modal").style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex+=1;WindowUtilities._hideSelect(this.modalWindows.last().getId())}else{this.modalWindows.last().element.hide()}WindowUtilities._showSelect(a.getId())}this.modalWindows.push(a)},removeModalWindow:function(a){this.modalWindows.pop();if(this.modalWindows.length==0){WindowUtilities.enableScreen()}else{if(Window.keepMultiModalWindow){this.modalWindows.last().toFront();WindowUtilities._showSelect(this.modalWindows.last().getId())}else{this.modalWindows.last().element.show()}}},register:function(a){this.windows.push(a)},unregister:function(a){this.windows=this.windows.reject(function(b){return b==a})},closeAll:function(){this.windows.each(function(a){Windows.close(a.getId())})},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function(a){if(a){a.close()}})},minimize:function(c,a){var b=this.getWindow(c);if(b&&b.visible){b.minimize()}Event.stop(a)},maximize:function(c,a){var b=this.getWindow(c);if(b&&b.visible){b.maximize()}Event.stop(a)},close:function(c,a){var b=this.getWindow(c);if(b){b.close()}if(a){Event.stop(a)}},blur:function(b){var a=this.getWindow(b);if(!a){return}if(a.options.blurClassName){a.changeClassName(a.options.blurClassName)}if(this.focusedWindow==a){this.focusedWindow=null}a._notify("onBlur")},focus:function(b){var a=this.getWindow(b);if(!a){return}if(this.focusedWindow){this.blur(this.focusedWindow.getId())}if(a.options.focusClassName){a.changeClassName(a.options.focusClassName)}this.focusedWindow=a;a._notify("onFocus")},unsetOverflow:function(a){this.windows.each(function(b){b.oldOverflow=b.getContent().getStyle("overflow")||"auto";b.getContent().setStyle({overflow:"hidden"})});if(a&&a.oldOverflow){a.getContent().setStyle({overflow:a.oldOverflow})}},resetOverflow:function(){this.windows.each(function(a){if(a.oldOverflow){a.getContent().setStyle({overflow:a.oldOverflow})}})},updateZindex:function(a,b){if(a>this.maxZIndex){this.maxZIndex=a;if(this.focusedWindow){this.blur(this.focusedWindow.getId())}}this.focusedWindow=b;if(this.focusedWindow){this.focus(this.focusedWindow.getId())}}};var Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(d,c){if(d&&typeof d!="string"){Dialog._runAjaxRequest(d,c,Dialog.confirm);return}d=d||"";c=c||{};var f=c.okLabel?c.okLabel:"Ok";var a=c.cancelLabel?c.cancelLabel:"Cancel";c=Object.extend(c,c.windowParameters||{});c.windowParameters=c.windowParameters||{};c.className=c.className||"alert";var b="class ='"+(c.buttonClass?c.buttonClass+" ":"")+" ok_button'";var e="class ='"+(c.buttonClass?c.buttonClass+" ":"")+" cancel_button'";var d="      <div class='"+c.className+"_message'>"+d+"</div>        <div class='"+c.className+"_buttons'>          <input type='button' value='"+f+"' onclick='Dialog.okCallback()' "+b+"/>          <input type='button' value='"+a+"' onclick='Dialog.cancelCallback()' "+e+"/>        </div>    ";return this._openDialog(d,c)},alert:function(c,b){if(c&&typeof c!="string"){Dialog._runAjaxRequest(c,b,Dialog.alert);return}c=c||"";b=b||{};var d=b.okLabel?b.okLabel:"Ok";b=Object.extend(b,b.windowParameters||{});b.windowParameters=b.windowParameters||{};b.className=b.className||"alert";var a="class ='"+(b.buttonClass?b.buttonClass+" ":"")+" ok_button'";var c="      <div class='"+b.className+"_message'>"+c+"</div>        <div class='"+b.className+"_buttons'>          <input type='button' value='"+d+"' onclick='Dialog.okCallback()' "+a+"/>        </div>";return this._openDialog(c,b)},info:function(b,a){if(b&&typeof b!="string"){Dialog._runAjaxRequest(b,a,Dialog.info);return}b=b||"";a=a||{};a=Object.extend(a,a.windowParameters||{});a.windowParameters=a.windowParameters||{};a.className=a.className||"alert";var b="<div id='modal_dialog_message' class='"+a.className+"_message'>"+b+"</div>";if(a.showProgress){b+="<div id='modal_dialog_progress' class='"+a.className+"_progress'>  </div>"}a.ok=null;a.cancel=null;return this._openDialog(b,a)},setInfoMessage:function(a){$("modal_dialog_message").update(a)},closeInfo:function(){Windows.close(this.dialogId)},_openDialog:function(e,d){var c=d.className;if(!d.height&&!d.width){d.width=WindowUtilities.getPageSize(d.options.parent||document.body).pageWidth/2}if(d.id){this.dialogId=d.id}else{var b=new Date();this.dialogId="modal_dialog_"+b.getTime();d.id=this.dialogId}if(!d.height||!d.width){var a=WindowUtilities._computeSize(e,this.dialogId,d.width,d.height,5,c);if(d.height){d.width=a+5}else{d.height=a+5}}d.effectOptions=d.effectOptions;d.resizable=d.resizable||false;d.minimizable=d.minimizable||false;d.maximizable=d.maximizable||false;d.draggable=d.draggable||false;d.closable=d.closable||false;var f=new Window(d);f.getContent().innerHTML=e;f.showCenter(true,d.top,d.left);f.setDestroyOnClose();f.cancelCallback=d.onCancel||d.cancel;f.okCallback=d.onOk||d.ok;return f},_getAjaxContent:function(a){Dialog.callFunc(a.responseText,Dialog.parameters)},_runAjaxRequest:function(c,b,a){if(c.options==null){c.options={}}Dialog.onCompleteFunc=c.options.onComplete;Dialog.parameters=b;Dialog.callFunc=a;c.options.onComplete=Dialog._getAjaxContent;new Ajax.Request(c.url,c.options)},okCallback:function(){var a=Windows.focusedWindow;if(!a.okCallback||a.okCallback(a)){$$("#"+a.getId()+" input").each(function(b){b.onclick=null});a.close()}},cancelCallback:function(){var a=Windows.focusedWindow;$$("#"+a.getId()+" input").each(function(b){b.onclick=null});a.close();if(a.cancelCallback){a.cancelCallback(a)}}};if(Prototype.Browser.WebKit){var array=navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/));Prototype.Browser.WebKitVersion=parseFloat(array[1])}var WindowUtilities={getWindowScroll:function(parent){var T,L,W,H;parent=parent||document.body;if(parent!=document.body){T=parent.scrollTop;L=parent.scrollLeft;W=parent.scrollWidth;H=parent.scrollHeight}else{var w=window;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}}return{top:T,left:L,width:W,height:H}},getPageSize:function(d){d=d||document.body;var c,g;var e,b;if(d!=document.body){c=d.getWidth();g=d.getHeight();b=d.scrollWidth;e=d.scrollHeight}else{var f,a;if(window.innerHeight&&window.scrollMaxY){f=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){f=document.body.scrollWidth;a=document.body.scrollHeight}else{f=document.body.offsetWidth;a=document.body.offsetHeight}}if(self.innerHeight){c=self.innerWidth;g=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){c=document.documentElement.clientWidth;g=document.documentElement.clientHeight}else{if(document.body){c=document.body.clientWidth;g=document.body.clientHeight}}}if(a<g){e=g}else{e=a}if(f<c){b=c}else{b=f}}return{pageWidth:b,pageHeight:e,windowWidth:c,windowHeight:g}},disableScreen:function(c,a,d,e,b){WindowUtilities.initLightbox(a,c,function(){this._disableScreen(c,a,d,e)}.bind(this),b||document.body)},_disableScreen:function(c,b,e,f){var d=$(b);var a=WindowUtilities.getPageSize(d.parentNode);if(f&&Prototype.Browser.IE){WindowUtilities._hideSelect();WindowUtilities._showSelect(f)}d.style.height=(a.pageHeight+"px");d.style.display="none";if(b=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayShowEffectOptions){d.overlayOpacity=e;new Effect.Appear(d,Object.extend({from:0,to:e},Windows.overlayShowEffectOptions))}else{d.style.display="block"}},enableScreen:function(b){b=b||"overlay_modal";var a=$(b);if(a){if(b=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayHideEffectOptions){new Effect.Fade(a,Object.extend({from:a.overlayOpacity,to:0},Windows.overlayHideEffectOptions))}else{a.style.display="none";a.parentNode.removeChild(a)}if(b!="__invisible__"){WindowUtilities._showSelect()}}},_hideSelect:function(a){if(Prototype.Browser.IE){a=a==null?"":"#"+a+" ";$$(a+"select").each(function(b){if(!WindowUtilities.isDefined(b.oldVisibility)){b.oldVisibility=b.style.visibility?b.style.visibility:"visible";b.style.visibility="hidden"}})}},_showSelect:function(a){if(Prototype.Browser.IE){a=a==null?"":"#"+a+" ";$$(a+"select").each(function(b){if(WindowUtilities.isDefined(b.oldVisibility)){try{b.style.visibility=b.oldVisibility}catch(c){b.style.visibility="visible"}b.oldVisibility=null}else{if(b.style.visibility){b.style.visibility="visible"}}})}},isDefined:function(a){return typeof(a)!="undefined"&&a!=null},initLightbox:function(e,c,a,b){if($(e)){Element.setStyle(e,{zIndex:Windows.maxZIndex+1});Windows.maxZIndex++;a()}else{var d=document.createElement("div");d.setAttribute("id",e);d.className="overlay_"+c;d.style.display="none";d.style.position="absolute";d.style.top="0";d.style.left="0";d.style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex++;d.style.width="100%";b.insertBefore(d,b.firstChild);if(Prototype.Browser.WebKit&&e=="overlay_modal"){setTimeout(function(){a()},10)}else{a()}}},setCookie:function(b,a){document.cookie=a[0]+"="+escape(b)+((a[1])?"; expires="+a[1].toGMTString():"")+((a[2])?"; path="+a[2]:"")+((a[3])?"; domain="+a[3]:"")+((a[4])?"; secure":"")},getCookie:function(c){var b=document.cookie;var e=c+"=";var d=b.indexOf("; "+e);if(d==-1){d=b.indexOf(e);if(d!=0){return null}}else{d+=2}var a=document.cookie.indexOf(";",d);if(a==-1){a=b.length}return unescape(b.substring(d+e.length,a))},_computeSize:function(e,a,b,g,d,f){var j=document.body;var c=document.createElement("div");c.setAttribute("id",a);c.className=f+"_content";if(g){c.style.height=g+"px"}else{c.style.width=b+"px"}c.style.position="absolute";c.style.top="0";c.style.left="0";c.style.display="none";c.innerHTML=e;j.insertBefore(c,j.firstChild);var h;if(g){h=$(c).getDimensions().width+d}else{h=$(c).getDimensions().height+d}j.removeChild(c);return h}};window_loaded=true;String.prototype.parseColor=function(){var a="#";if(this.slice(0,4)=="rgb("){var c=this.slice(4,this.length-1).split(",");var b=0;do{a+=parseInt(c[b]).toColorPart()}while(++b<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var b=1;b<4;b++){a+=(this.charAt(b)+this.charAt(b)).toLowerCase()}}if(this.length==7){a=this.toLowerCase()}}}return(a.length==7?a:(arguments[0]||this))};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(b){return(b.nodeType==3?b.nodeValue:(b.hasChildNodes()?Element.collectTextNodes(b):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(a,b){return $A($(a).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:((c.hasChildNodes()&&!Element.hasClassName(c,b))?Element.collectTextNodesIgnoreClass(c,b):""))}).flatten().join("")};Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:(b/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){try{a=$(a);var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(b){}};Array.prototype.call=function(){var a=arguments;this.each(function(b){b.apply(this,a)})};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},tagifyText:function(a){if(typeof Builder=="undefined"){throw ("Effect.tagifyText requires including script.aculo.us' builder.js library")}var b="position:relative";if(Prototype.Browser.IE){b+=";zoom:1"}a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){a.insertBefore(Builder.node("span",{style:b},d==" "?String.fromCharCode(160):d),c)});Element.remove(c)}})},multiple:function(b,c){var e;if(((typeof b=="object")||(typeof b=="function"))&&(b.length)){e=b}else{e=$(b).childNodes}var a=Object.extend({speed:0.1,delay:0},arguments[2]||{});var d=a.delay;$A(e).each(function(g,f){new c(g,Object.extend(a,{delay:f*a.speed+d}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(b,c){b=$(b);c=(c||"appear").toLowerCase();var a=Object.extend({queue:{position:"end",scope:(b.id||"global"),limit:1}},arguments[2]||{});Effect[b.visible()?Effect.PAIRS[c][1]:Effect.PAIRS[c][0]](b,a)}};var Effect2=Effect;Effect.Transitions={linear:Prototype.K,sinoidal:function(a){return(-Math.cos(a*Math.PI)/2)+0.5},reverse:function(a){return 1-a},flicker:function(a){var a=((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4;return(a>1?1:a)},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(b,a){a=a||5;return(Math.round((b%(1/a))*a)==0?((b*a*2)-Math.floor(b*a*2)):1-((b*a*2)-Math.floor(b*a*2)))},none:function(a){return 0},full:function(a){return 1}};Effect.ScopedQueue=Class.create();Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(b){var c=new Date().getTime();var a=(typeof b.options.queue=="string")?b.options.queue:b.options.queue.position;switch(a){case"front":this.effects.findAll(function(d){return d.state=="idle"}).each(function(d){d.startOn+=b.finishOn;d.finishOn+=b.finishOn});break;case"with-last":c=this.effects.pluck("startOn").max()||c;break;case"end":c=this.effects.pluck("finishOn").max()||c;break}b.startOn+=c;b.finishOn+=c;if(!b.options.queue.limit||(this.effects.length<b.options.queue.limit)){this.effects.push(b)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(a){this.effects=this.effects.reject(function(b){return b==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var c=new Date().getTime();for(var b=0,a=this.effects.length;b<a;b++){this.effects[b]&&this.effects[b].loop(c)}}});Effect.Queues={instances:$H(),get:function(a){if(typeof a!="string"){return a}if(!this.instances[a]){this.instances[a]=new Effect.ScopedQueue()}return this.instances[a]}};Effect.Queue=Effect.Queues.get("global");Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"};Effect.Base=function(){};Effect.Base.prototype={position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+"Internal"]?"this.options."+eventName+"Internal(this);":"")+(options[eventName]?"this.options."+eventName+"(this);":""))}if(options.transition===false){options.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;eval('this.render = function(pos){ if(this.state=="idle"){this.state="running";'+codeForEvent(options,"beforeSetup")+(this.setup?"this.setup();":"")+codeForEvent(options,"afterSetup")+'};if(this.state=="running"){pos=this.options.transition(pos)*'+this.fromToDelta+"+"+this.options.from+";this.position=pos;"+codeForEvent(options,"beforeUpdate")+(this.update?"this.update(pos);":"")+codeForEvent(options,"afterUpdate")+"}}");this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).add(this)}},loop:function(c){if(c>=this.startOn){if(c>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var b=(c-this.startOn)/this.totalTime,a=Math.round(b*this.totalFrames);if(a>this.currentFrame){this.render(b);this.currentFrame=a}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},inspect:function(){var a=$H();for(property in this){if(typeof this[property]!="function"){a[property]=this[property]}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}};Effect.Parallel=Class.create();Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");if(b.finish){b.finish(a)}b.event("afterFinish")})}});Effect.Event=Class.create();Object.extend(Object.extend(Effect.Event.prototype,Effect.Base.prototype),{initialize:function(){var a=Object.extend({duration:0},arguments[0]||{});this.start(a)},update:Prototype.emptyFunction});Effect.Opacity=Class.create();Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(a)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create();Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(a)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({left:Math.round(this.options.x*a+this.originalLeft)+"px",top:Math.round(this.options.y*a+this.originalTop)+"px"})}});Effect.MoveBy=function(b,a,c){return new Effect.Move(b,Object.extend({x:c,y:a},arguments[3]||{}))};Effect.Scale=Class.create();Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(b,c){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:c},arguments[2]||{});this.start(a)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(b){this.originalStyle[b]=this.element.style[b]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(a){var b=(this.options.scaleFrom/100)+(this.factor*a);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*b+this.fontSizeType})}this.setDimensions(this.dims[0]*b,this.dims[1]*b)},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(a,e){var f={};if(this.options.scaleX){f.width=Math.round(e)+"px"}if(this.options.scaleY){f.height=Math.round(a)+"px"}if(this.options.scaleFromCenter){var c=(a-this.dims[0])/2;var b=(e-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){f.top=this.originalTop-c+"px"}if(this.options.scaleX){f.left=this.originalLeft-b+"px"}}else{if(this.options.scaleY){f.top=-c+"px"}if(this.options.scaleX){f.left=-b+"px"}}}this.element.setStyle(f)}});Effect.Highlight=Class.create();Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(a)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")}this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(b,c,d){return b+(Math.round(this._base[d]+(this._delta[d]*a)).toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=Class.create();Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(a){this.element=$(a);this.start(arguments[1]||{})},setup:function(){Position.prepare();var b=Position.cumulativeOffset(this.element);if(this.options.offset){b[1]+=this.options.offset}var a=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);this.scrollStart=Position.deltaY;this.delta=(b[1]>a?a:b[1])-this.scrollStart},update:function(a){Position.prepare();window.scrollTo(Position.deltaX,this.scrollStart+(a*this.delta))}});Effect.Fade=function(c){c=$(c);var a=c.getInlineOpacity();var b=Object.extend({from:c.getOpacity()||1,to:0,afterFinishInternal:function(d){if(d.options.to!=0){return}d.element.hide().setStyle({opacity:a})}},arguments[1]||{});return new Effect.Opacity(c,b)};Effect.Appear=function(b){b=$(b);var a=Object.extend({from:(b.getStyle("display")=="none"?0:b.getOpacity()||0),to:1,afterFinishInternal:function(c){c.element.forceRerendering()},beforeSetup:function(c){c.element.setOpacity(c.options.from).show()}},arguments[1]||{});return new Effect.Opacity(b,a)};Effect.Puff=function(b){b=$(b);var a={opacity:b.getInlineOpacity(),position:b.getStyle("position"),top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};return new Effect.Parallel([new Effect.Scale(b,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(c){Position.absolutize(c.effects[0].element)},afterFinishInternal:function(c){c.effects[0].element.hide().setStyle(a)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(b){b.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(b){b=$(b);var a=b.getDimensions();return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(c){c.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(c){c.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(b){b=$(b);var a=b.getInlineOpacity();return new Effect.Appear(b,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(c){new Effect.Scale(c.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(d){d.element.makePositioned().makeClipping()},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned().setStyle({opacity:a})}})}},arguments[1]||{}))};Effect.DropOut=function(b){b=$(b);var a={top:b.getStyle("top"),left:b.getStyle("left"),opacity:b.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(b,{x:0,y:100,sync:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(c){c.effects[0].element.makePositioned()},afterFinishInternal:function(c){c.effects[0].element.hide().undoPositioned().setStyle(a)}},arguments[1]||{}))};Effect.Shake=function(b){b=$(b);var a={top:b.getStyle("top"),left:b.getStyle("left")};return new Effect.Move(b,{x:20,y:0,duration:0.05,afterFinishInternal:function(c){new Effect.Move(c.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(d){new Effect.Move(d.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(e){new Effect.Move(e.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(f){new Effect.Move(f.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(g){new Effect.Move(g.element,{x:-20,y:0,duration:0.05,afterFinishInternal:function(h){h.element.undoPositioned().setStyle(a)}})}})}})}})}})}})};Effect.SlideDown=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.SlideUp=function(b){b=$(b).cleanWhitespace();var a=b.down().getStyle("bottom");return new Effect.Scale(b,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(c){c.element.makePositioned();c.element.down().makePositioned();if(window.opera){c.element.setStyle({top:""})}c.element.makeClipping().show()},afterUpdateInternal:function(c){c.element.down().setStyle({bottom:(c.dims[0]-c.element.clientHeight)+"px"})},afterFinishInternal:function(c){c.element.hide().undoClipping().undoPositioned().setStyle({bottom:a});c.element.down().undoPositioned()}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){b.element.makeClipping()},afterFinishInternal:function(b){b.element.hide().undoClipping()}})};Effect.Grow=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var g=c.getDimensions();var h,f;var e,d;switch(b.direction){case"top-left":h=f=e=d=0;break;case"top-right":h=g.width;f=d=0;e=-g.width;break;case"bottom-left":h=e=0;f=g.height;d=-g.height;break;case"bottom-right":h=g.width;f=g.height;e=-g.width;d=-g.height;break;case"center":h=g.width/2;f=g.height/2;e=-g.width/2;d=-g.height/2;break}return new Effect.Move(c,{x:h,y:f,duration:0.01,beforeSetup:function(j){j.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(j){new Effect.Parallel([new Effect.Opacity(j.element,{sync:true,to:1,from:0,transition:b.opacityTransition}),new Effect.Move(j.element,{x:e,y:d,sync:true,transition:b.moveTransition}),new Effect.Scale(j.element,100,{scaleMode:{originalHeight:g.height,originalWidth:g.width},sync:true,scaleFrom:window.opera?1:0,transition:b.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(k){k.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(k){k.effects[0].element.undoClipping().undoPositioned().setStyle(a)}},b))}})};Effect.Shrink=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var f=c.getDimensions();var e,d;switch(b.direction){case"top-left":e=d=0;break;case"top-right":e=f.width;d=0;break;case"bottom-left":e=0;d=f.height;break;case"bottom-right":e=f.width;d=f.height;break;case"center":e=f.width/2;d=f.height/2;break}return new Effect.Parallel([new Effect.Opacity(c,{sync:true,to:0,from:1,transition:b.opacityTransition}),new Effect.Scale(c,window.opera?1:0,{sync:true,transition:b.scaleTransition,restoreAfterFinish:true}),new Effect.Move(c,{x:e,y:d,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(g){g.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(g){g.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a)}},b))};Effect.Pulsate=function(c){c=$(c);var b=arguments[1]||{};var a=c.getInlineOpacity();var e=b.transition||Effect.Transitions.sinoidal;var d=function(f){return e(1-Effect.Transitions.pulse(f,b.pulses))};d.bind(e);return new Effect.Opacity(c,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(f){f.element.setStyle({opacity:a})}},b),{transition:d}))};Effect.Fold=function(b){b=$(b);var a={top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};b.makeClipping();return new Effect.Scale(b,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(c){new Effect.Scale(b,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(d){d.element.hide().undoClipping().setStyle(a)}})}},arguments[1]||{}))};Effect.Morph=Class.create();Object.extend(Object.extend(Effect.Morph.prototype,Effect.Base.prototype),{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({style:{}},arguments[1]||{});if(typeof b.style=="string"){if(b.style.indexOf(":")==-1){var d="",a="."+b.style;$A(document.styleSheets).reverse().each(function(e){if(e.cssRules){cssRules=e.cssRules}else{if(e.rules){cssRules=e.rules}}$A(cssRules).reverse().each(function(f){if(a==f.selectorText){d=f.style.cssText;throw $break}});if(d){throw $break}});this.style=d.parseStyle();b.afterFinishInternal=function(e){e.element.addClassName(e.options.style);e.transforms.each(function(f){if(f.style!="opacity"){e.element.style[f.style]=""}})}}else{this.style=b.style.parseStyle()}}else{this.style=$H(b.style)}this.start(b)},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b)){b="#ffffff"}b=b.parseColor();return $R(0,2).map(function(c){return parseInt(b.slice(c*2+1,c*2+3),16)})}this.transforms=this.style.map(function(g){var f=g[0],e=g[1],d=null;if(e.parseColor("#zzzzzz")!="#zzzzzz"){e=e.parseColor();d="color"}else{if(f=="opacity"){e=parseFloat(e);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(e)){var c=e.match(/^([\+\-]?[0-9\.]+)(.*)$/);e=parseFloat(c[1]);d=(c.length==3)?c[2]:null}}}var b=this.element.getStyle(f);return{style:f.camelize(),originalValue:d=="color"?a(b):parseFloat(b||0),targetValue:d=="color"?a(e):e,unit:d}}.bind(this)).reject(function(b){return((b.originalValue==b.targetValue)||(b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))))})},update:function(a){var d={},b,c=this.transforms.length;while(c--){d[(b=this.transforms[c]).style]=b.unit=="color"?"#"+(Math.round(b.originalValue[0]+(b.targetValue[0]-b.originalValue[0])*a)).toColorPart()+(Math.round(b.originalValue[1]+(b.targetValue[1]-b.originalValue[1])*a)).toColorPart()+(Math.round(b.originalValue[2]+(b.targetValue[2]-b.originalValue[2])*a)).toColorPart():b.originalValue+Math.round(((b.targetValue-b.originalValue)*a)*1000)/1000+b.unit}this.element.setStyle(d,true)}});Effect.Transform=Class.create();Object.extend(Effect.Transform.prototype,{initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(b){var c=$H(b).values().first();this.tracks.push($H({ids:$H(b).keys().first(),effect:Effect.Morph,options:{style:c}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var b=[$(a.ids)||$$(a.ids)].flatten();return b.map(function(c){return new a.effect(c,Object.extend({sync:true},a.options))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.prototype.parseStyle=function(){var b=document.createElement("div");b.innerHTML='<div style="'+this+'"></div>';var c=b.childNodes[0].style,a=$H();Element.CSS_PROPERTIES.each(function(d){if(c[d]){a[d]=c[d]}});if(Prototype.Browser.IE&&this.indexOf("opacity")>-1){a.opacity=this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]}return a};Element.morph=function(a,b){new Effect.Morph(a,Object.extend({style:b},arguments[2]||{}));return a};["getInlineOpacity","forceRerendering","setContentZoom","collectTextNodes","collectTextNodesIgnoreClass","morph"].each(function(a){Element.Methods[a]=Element[a]});Element.Methods.visualEffect=function(b,c,a){s=c.dasherize().camelize();effect_class=s.charAt(0).toUpperCase()+s.substring(1);new Effect[effect_class](b,a);return $(b)};Element.addMethods();Effect.ResizeWindow=Class.create();Object.extend(Object.extend(Effect.ResizeWindow.prototype,Effect.Base.prototype),{initialize:function(g,f,e,d,a){this.window=g;this.window.resizing=true;var c=g.getSize();this.initWidth=parseFloat(c.width);this.initHeight=parseFloat(c.height);var b=g.getLocation();this.initTop=parseFloat(b.top);this.initLeft=parseFloat(b.left);this.width=d!=null?parseFloat(d):this.initWidth;this.height=a!=null?parseFloat(a):this.initHeight;this.top=f!=null?parseFloat(f):this.initTop;this.left=e!=null?parseFloat(e):this.initLeft;this.dx=this.left-this.initLeft;this.dy=this.top-this.initTop;this.dw=this.width-this.initWidth;this.dh=this.height-this.initHeight;this.r2=$(this.window.getId()+"_row2");this.content=$(this.window.getId()+"_content");this.contentOverflow=this.content.getStyle("overflow")||"auto";this.content.setStyle({overflow:"hidden"});if(this.window.options.wiredDrag){this.window.currentDrag=g._createWiredElement();this.window.currentDrag.show();this.window.element.hide()}this.start(arguments[5])},update:function(b){var c=Math.floor(this.initWidth+this.dw*b);var a=Math.floor(this.initHeight+this.dh*b);var e=Math.floor(this.initTop+this.dy*b);var d=Math.floor(this.initLeft+this.dx*b);if(window.ie){if(Math.floor(a)==0){this.r2.hide()}else{if(Math.floor(a)>1){this.r2.show()}}}this.r2.setStyle({height:a});this.window.setSize(c,a);this.window.setLocation(e,d)},finish:function(a){if(this.window.options.wiredDrag){this.window._hideWiredElement();this.window.element.show()}this.window.setSize(this.width,this.height);this.window.setLocation(this.top,this.left);this.r2.setStyle({height:null});this.content.setStyle({overflow:this.contentOverflow});this.window.resizing=false}});Effect.ModalSlideDown=function(b){var c=WindowUtilities.getWindowScroll();var a=b.getStyle("height");b.setStyle({top:-(parseFloat(a)-c.top)+"px"});b.show();return new Effect.Move(b,Object.extend({x:0,y:parseFloat(a)},arguments[1]||{}))};Effect.ModalSlideUp=function(b){var a=b.getStyle("height");return new Effect.Move(b,Object.extend({x:0,y:-parseFloat(a)},arguments[1]||{}))};PopupEffect=Class.create();PopupEffect.prototype={initialize:function(a){this.html=$(a);this.options=Object.extend({className:"popup_effect",duration:0.4},arguments[1]||{})},show:function(d,b){var a=Position.cumulativeOffset(this.html);var c=this.html.getDimensions();var f=d.win.getBounds();this.window=d.win;if(!this.div){this.div=document.createElement("div");this.div.className=this.options.className;this.div.style.height=c.height+"px";this.div.style.width=c.width+"px";this.div.style.top=a[1]+"px";this.div.style.left=a[0]+"px";this.div.style.position="absolute";document.body.appendChild(this.div)}if(this.options.fromOpacity){this.div.setStyle({opacity:this.options.fromOpacity})}this.div.show();var e="top:"+f.top+";left:"+f.left+";width:"+f.width+";height:"+f.height;if(this.options.toOpacity){e+=";opacity:"+this.options.toOpacity}new Effect.Morph(this.div,{style:e,duration:this.options.duration,afterFinish:this._showWindow.bind(this)})},hide:function(d,b){var a=Position.cumulativeOffset(this.html);var c=this.html.getDimensions();this.window.visible=true;var f=this.window.getBounds();this.window.visible=false;this.window.element.hide();this.div.style.height=f.height;this.div.style.width=f.width;this.div.style.top=f.top;this.div.style.left=f.left;if(this.options.toOpacity){this.div.setStyle({opacity:this.options.toOpacity})}this.div.show();var e="top:"+a[1]+"px;left:"+a[0]+"px;width:"+c.width+"px;height:"+c.height+"px";if(this.options.fromOpacity){e+=";opacity:"+this.options.fromOpacity}new Effect.Morph(this.div,{style:e,duration:this.options.duration,afterFinish:this._hideDiv.bind(this)})},_showWindow:function(){this.div.hide();this.window.element.show()},_hideDiv:function(){this.div.hide()}};if(typeof Effect=="undefined"){throw ("accordion.js requires including script.aculo.us' effects.js library!")}var accordion=Class.create();accordion.prototype={showAccordion:null,currentAccordion:null,duration:null,effects:[],animating:false,initialize:function(b,c){if(!$(b)){throw (b+" doesn't exist!");return false}this.options=Object.extend({resizeSpeed:8,classNames:{toggle:"accordion_toggle",toggleActive:"accordion_toggle_active",content:"accordion_content"},defaultSize:{height:null,width:null},direction:"vertical",onEvent:"click"},c||{});this.duration=((11-this.options.resizeSpeed)*0.15);var a=$$("#"+b+" ."+this.options.classNames.toggle);a.each(function(d){Event.observe(d,this.options.onEvent,this.activate.bind(this,d),false);if(this.options.onEvent=="click"){}if(this.options.direction=="horizontal"){var e=$H({width:"0px"})}else{var e=$H({height:"0px"})}e.merge({display:"none"});this.currentAccordion=$(d.next(0)).setStyle(e)}.bind(this))},activate:function(a){if(this.animating){return false}this.effects=[];this.currentAccordion=$(a.next(0));this.currentAccordion.setStyle({display:"block"});this.currentAccordion.previous(0).addClassName(this.options.classNames.toggleActive);if(this.options.direction=="horizontal"){this.scaling=$H({scaleX:true,scaleY:false})}else{this.scaling=$H({scaleX:false,scaleY:true})}if(this.currentAccordion==this.showAccordion){this.deactivate()}else{this._handleAccordion()}},deactivate:function(){var a=$H({duration:this.duration,scaleContent:false,transition:Effect.Transitions.sinoidal,queue:{position:"end",scope:"accordionAnimation"},scaleMode:{originalHeight:this.options.defaultSize.height?this.options.defaultSize.height:this.currentAccordion.scrollHeight,originalWidth:this.options.defaultSize.width?this.options.defaultSize.width:this.currentAccordion.scrollWidth},afterFinish:function(){this.showAccordion.setStyle({height:"auto",display:"none"});this.showAccordion=null;this.animating=false}.bind(this)});a.merge(this.scaling);this.showAccordion.previous(0).removeClassName(this.options.classNames.toggleActive);new Effect.Scale(this.showAccordion,0,a)},_handleAccordion:function(){var a=$H({sync:true,scaleFrom:0,scaleContent:false,transition:Effect.Transitions.sinoidal,scaleMode:{originalHeight:this.options.defaultSize.height?this.options.defaultSize.height:this.currentAccordion.scrollHeight,originalWidth:this.options.defaultSize.width?this.options.defaultSize.width:this.currentAccordion.scrollWidth}});a.merge(this.scaling);this.effects.push(new Effect.Scale(this.currentAccordion,100,a));if(this.showAccordion){this.showAccordion.previous(0).removeClassName(this.options.classNames.toggleActive);a=$H({sync:true,scaleContent:false,transition:Effect.Transitions.sinoidal});a.merge(this.scaling);this.effects.push(new Effect.Scale(this.showAccordion,0,a))}new Effect.Parallel(this.effects,{duration:this.duration,queue:{position:"end",scope:"accordionAnimation"},beforeStart:function(){this.animating=true}.bind(this),afterFinish:function(){if(this.showAccordion){this.showAccordion.setStyle({display:"none"})}$(this.currentAccordion).setStyle({height:"auto"});this.showAccordion=this.currentAccordion;this.animating=false}.bind(this)})}};if("a".replace(/a/,function(){return"b"})!="b"){(function(){var a=String.prototype.replace;String.prototype.replace=function(k,c){if(typeof c!="function"){return a.apply(this,arguments)}var e=""+this;var h=c;if(!(k instanceof RegExp)){var g=e.indexOf(k);return(g==-1?e:a.apply(e,[k,h(k,g,e)]))}var b=k;var l=[];var f=b.lastIndex;var j;while((j=b.exec(e))!=null){var g=j.index;var d=j.concat(g,e);l.push(e.slice(f,g),h.apply(null,d).toString());if(!b.global){f+=RegExp.lastMatch.length;break}else{f=b.lastIndex}}l.push(e.slice(f));return l.join("")}})()}var CodeHighlighter={styleSets:new Array};CodeHighlighter.addStyle=function(a,c){if([].push){this.styleSets.push({name:a,rules:c,ignoreCase:arguments[2]||false})}function b(){if(typeof Event!="undefined"&&typeof Event.onReady=="function"){return Event.onReady(CodeHighlighter.init.bind(CodeHighlighter))}var d=window.onload;if(typeof window.onload!="function"){window.onload=function(){CodeHighlighter.init()}}else{window.onload=function(){d();CodeHighlighter.init()}}}if(this.styleSets.length==1){b()}};CodeHighlighter.init=function(){if(!document.getElementsByTagName){return}if("a".replace(/a/,function(){return"b"})!="b"){return}var d=document.getElementsByTagName("CODE");d.filter=function(j){var g=new Array;for(var h=0;h<this.length;h++){if(j(this[h])){g[g.length]=this[h]}}return g};var f=new Array;f.toString=function(){var h=new Array;for(var g=0;g<this.length;g++){h.push(this[g].exp)}return h.join("|")};function a(g,h){var j=(typeof h.exp!="string")?String(h.exp).substr(1,String(h.exp).length-2):h.exp;f.push({className:g,exp:"("+j+")",length:(j.match(/(^|[^\\])\([^?]/g)||"").length+1,replacement:h.replacement||null})}function e(h,g){return h.replace(new RegExp(f,(g)?"gi":"g"),function(){var n=0,m=1,o;while(o=f[n++]){if(arguments[m]){if(!o.replacement){return'<span class="'+o.className+'">'+arguments[0]+"</span>"}else{var p=o.replacement.replace("$0",o.className);for(var l=1;l<=o.length-1;l++){p=p.replace("$"+l,arguments[m+l])}return p}}else{m+=o.length}}})}function b(l){var g;f.length=0;var k=d.filter(function(m){return(m.className.indexOf(l.name)>=0)});for(var j in l.rules){a(j,l.rules[j])}for(var h=0;h<k.length;h++){if(/MSIE/.test(navigator.appVersion)&&k[h].parentNode.nodeName=="PRE"){k[h]=k[h].parentNode;g=k[h].innerHTML.replace(/(<code[^>]*>)([^<]*)<\/code>/i,function(){return arguments[1]+e(arguments[2],l.ignoreCase)+"</code>"});g=g.replace(/\n( *)/g,function(){var m="";for(var n=0;n<arguments[1].length;n++){m+="&nbsp;"}return"\n"+m});g=g.replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;");g=g.replace(/\n(<\/\w+>)?/g,"<br />$1").replace(/<br \/>[\n\r\s]*<br \/>/g,"<p><br></p>")}else{g=e(k[h].innerHTML,l.ignoreCase)}k[h].innerHTML=g}}for(var c=0;c<this.styleSets.length;c++){b(this.styleSets[c])}};CodeHighlighter.addStyle("javascript",{comment:{exp:/(\/\/[^\n]*\n?)|(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)/},brackets:{exp:/\(|\)/},string:{exp:/'[^']*'|"[^"]*"/},keywords:{exp:/\b(arguments|break|case|continue|default|delete|do|else|false|for|function|if|in|instanceof|new|null|return|switch|this|true|typeof|var|void|while|with)\b/},global:{exp:/\b(toString|valueOf|window|element|prototype|constructor|document|escape|unescape|parseInt|parseFloat|setTimeout|clearTimeout|setInterval|clearInterval|NaN|isNaN|Infinity)\b/},erb:{exp:/&lt;%=(.+)%&gt;/}});CodeHighlighter.addStyle("html",{comment:{exp:/&lt;!\s*(--([^-]|[\r\n]|-[^-])*--\s*)&gt;/},tag:{exp:/(&lt;\/?)([a-zA-Z]+\s?)/,replacement:'$1<span class="$0">$2</span>'},string:{exp:/'[^']*'|"[^"]*"/},attribute:{exp:/\b([a-zA-Z-:]+)(=)/,replacement:'<span class="$0">$1</span>$2'},doctype:{exp:/&lt;!DOCTYPE([^&]|&[^g]|&g[^t])*&gt;/}});Authentification=Class.create();Authentification.prototype=Object.extend(new Page("ajax-authentification.html",false),{afterload:function(){$("ident_error").update(this.message);this.message=""},reload:function(){this.afterload()},initialize:function(){this.isconnected=false;this.pseudo="";this.message="";this.id_user="";this.selected_page="ajax-welcome.html"},settingup:function(c,b){var e=this;var d=validateJSON(c);switch(d[0]){case"succeed":var a=$("logform");a.pseudo.style.display="none";a.pass.style.display="none";a.getElementsByTagName("label")[0].style.display="none";a.pseudo.value="";a.pass.value="";a.submit.value="";a.style.display="none";a.action.value="";if(e.id_user!=d[1]){mycards.unload();trade.unload();message.unload()}e.id_user=d[1];e.pseudo=d[2];e.isconnected=true;friend.load();if(e.selected_page=="ajax-profil.html"||e.selected_page=="ajax-identification.html"){welcome.load(true)}profil.unload();pseudoUcfirst=e.pseudo.charAt(0).toUpperCase()+e.pseudo.substr(1);print_minimenu(true,pseudoUcfirst);print_menu(true);break;case"failed":e.message="<i>Pseudo et/ou mot de passe erronés.</i><br/>";if(b){e.load(true)}e.settingup_loginform();break;case"empty":e.message="<i>Veuillez remplir tous les champs.</i><br/>";if(b){e.load(true)}e.settingup_loginform();break;case"deco":e.settingup_loginform();e.pseudo="";e.id_user="";e.isconnected=false;profil.unload();mycards.unload();trade.unload();message.unload();welcome.load(true);break;default:break}},settingup_loginform:function(){print_minimenu(false,"");print_menu(false);var a=$("logform");friend.logout();a.pseudo.style.display="inline";a.pseudo.value="Pseudo";a.pass.style.display="inline";a.pass.value="Pass";a.getElementsByTagName("label")[0].style.display="inline";a.submit.value="Go!";a.submit.style.left="0px";a.action.value="connexion"},login:function(c,b){var a=this;this.ajax_request("json-authentification.html",{method:"get",parameters:{is_submitted:"false",action:"connexion"},onSuccess:function(d){a.settingup(d.responseText,false)}})},connexion:function(b){var a=this;this.ajax_request("json-authentification.html",{method:"get",parameters:$(b).serialize(true),onSuccess:function(c){a.settingup(c.responseText,true)}})},forgotten_pass:function(){$("forgot_form").show()},forgot_submit:function(b){var a=this;this.ajax_request("json-authentification.html",{method:"get",parameters:$(b).serialize(true),onSuccess:function(d){var c=d.responseText;alert_message(c)}})}});authentification=new Authentification();Welcome=Class.create();Welcome.prototype=Object.extend(new Page("ajax-welcome.html",false),{afterload:function(){if(this.load_pseudo){perso.pseudo=this.load_pseudo;perso.load(true);this.load_pseudo=null}},reload:function(){this.load_news()},load_news:function(){var a=this;this.ajax_request("json-welcome.html",{method:"get",parameters:{},onSuccess:function(b){var c=validateJSON(b.responseText);a.settingup_news(c)}})},settingup_news:function(f){var c=$("news");while(c.childNodes.length>0){c.removeChild(c.firstChild)}for(var b=0;b<f.length;++b){var d=create.div();var a=create.h({lvl:"3",text:f[b]["title"]+" - "+f[b]["date"]+" ("+f[b]["pseudo"]+")"});var e=create.div({text:f[b]["text"]});d.appendChild(a);d.appendChild(e);$("news").appendChild(d)}}});welcome=new Welcome();Friend=Class.create();Friend.prototype=Object.extend(new Page("ajax-friend.html",false),{initialize:function(){this.updater=null},logout:function(){this.updater.stop();this.updater=null;Windows.getWindow("friend_window").hide()},load:function(){var c=this;var b=function(){c.ajax_request("json-update.html",{method:"get",onSuccess:function(e){if(e.responseText=="unidentified"){authentification.login("","");return}var d=validateJSON(e.responseText);c.update_list(d)}})};var a=mywindow.load_window({page_name:this.url,length:200,height:220,top:190,left:500,destroyonclose:false,id:"friend_window",title:"Mes Amis"},b);if(!this.updater){this.updater=new PeriodicalExecuter(b,60)}},convert_time:function(a){var b=[];a.scan(/\w+/,function(c){b.push(c[0])});return(new Date(b[0],b[1]-1,b[2],b[3],b[4],b[5]))},update_list:function(e){var b=$("friends_list");while(b.childNodes.length>0){b.removeChild(b.firstChild)}if(e[0]!="0"){$("link_minimenu_message").addClassName("newMini")}else{if($("link_minimenu_message").hasClassName("newMini")){$("link_minimenu_message").removeClassName("newMini")}}if(e[1]!="0"){$("menu_ajax-trade.html").addClassName("new")}else{if($("menu_ajax-trade.html").hasClassName("new")){$("menu_ajax-trade.html").removeClassName("new")}}var a=new Date();for(i=2;i<e.length;i++){var d=0;if(e[i][2]!=null){d=this.convert_time(e[i][2])}var c="disconnected_friend";if((a-d)<1800000){c="connected_friend"}this.add_pseudo(e[i][0],e[i][1],c)}},add_pseudo:function(b,e,d){if(d==null){d="disconnected_friend"}var a=create.li({id:b});var f=create.a({text:e,classname:d,onclick:new Function("mywindow.load_window({page_name:'ajax-profil.html', param:'action=summary&id="+b+"', length:350, height:250, title:'"+e+"'}); return false;")});var c=create.a({img:"public/img/delete.PNG",text:"Supprimer",onclick:new Function("friend.del('"+b+"'); return false;")});a.appendChild(f);a.appendChild(c);$("friends_list").appendChild(a)},add:function(a){this.ajax_request("json-friend.html",{method:"get",parameters:{add_friend:escape(a),action:"add_friend"},onSuccess:function(c){var b=validateJSON(c.responseText);alert_message(b)}})},del:function(a){if(!confirm("Etes vous de vouloir supprimer ce contact ?")){return}this.ajax_request("json-friend.html",{method:"get",parameters:{del_friend:escape(a),action:"del_friend"},onSuccess:function(e){var d=validateJSON(e.responseText);var c=$("friends_list").getElementsByTagName("li");var b=$A(c);b.each(function(f){if(f.id==a){$(f).remove()}});alert_message(d)}})},searchadd:function(b){var a=this;this.ajax_request("json-friend.html",{method:"get",parameters:{action:"add_pseudo",add_pseudo:escape($F(b))},onSuccess:function(d){var c=validateJSON(d.responseText);if(c=="failed"){alert_message("Pseudo non trouvé")}else{if(c=="existed"){alert_message("Ami déjà ajouté")}else{a.add_pseudo(c,$F(b),"disconnected_friend");b.value="Pseudo";alert_message("Pseudo ajouté")}}}})}});friend=new Friend();SearchCard=Class.create();SearchCard.prototype=Object.extend(new Page("ajax-search.html",true),{settingup:function(g,o,c){$("search_nb_res").update(o[0]+" cartes trouvées");var e=o[1];var q=$("table_card");if(!q.visible()){q.show()}var k=(q.getElementsByTagName("tbody"))[0];var l=$A(k.getElementsByTagName("tr"));if(e.length==0){$("search_pages").hide();$("search_pages").hide();$(l[20]).show();for(var j=0;j<20;j++){$(l[j]).hide()}return}$(l[20]).hide();var p=Math.ceil(o[0]/20);create.pages($("search_pages"),p,this.page,"searchcards.next_page('ajax-search.html','__i__'); return false");create.pages($("search_pages2"),p,this.page,"searchcards.next_page('ajax-search.html','__i__'); return false");var n=$(k).up();n.removeChild(k);var f=e.length-1;for(var j=f;j>=0;--j){if(!$(l[j]).visible()){$(l[j]).show()}var m="id_card="+e[j]["ID_CARD"]+"&language=";var h=$A(l[j].getElementsByTagName("td"));var a=$A(h[0].getElementsByTagName("img"));var b=a[0];b.alt=e[j]["GAME"];b.title=e[j]["GAME"];b.src="public/img/game/"+(e[j]["GAME"]).toLowerCase()+".jpg";var d=$A(l[j].getElementsByTagName("a"));$(d[0]).update((e[j]["NAME_CARD"]).truncate(20));$(d[0]).title=e[j]["NAME_CARD"];h[1].onclick=new Function("mywindow.load_window({page_name:'ajax-card_detail.html', param:'"+m+"en', length:400, height:380, title:'"+e[j]["NAME_CARD"].replace(/'/g,"\\'")+"'}); return false;");$(d[1]).update((e[j]["FR_NAME_CARD"]).truncate(20));$(d[1]).title=e[j]["FR_NAME_CARD"];h[2].onclick=new Function("mywindow.load_window({page_name:'ajax-card_detail.html', param:'"+m+"fr', length:400, height:380, title:'"+e[j]["FR_NAME_CARD"].replace(/'/g,"\\'")+"'}); return false;");$(h[3]).update(e[j]["NUMBER"]);$(h[4]).update((e[j]["NAME_COLLECTION"]).truncate(18));$(h[5]).update((e[j]["NAME_EDITION"]).truncate(18));$(d[2]).update((e[j]["NB_GOT"]).truncate(15));h[6].onclick=new Function("mywindow.load_window({page_name:'ajax-card_detail.html', param:'action=card_people&type=got&"+m+"', length:250, height:250}); return false;");$(d[3]).update((e[j]["NB_WANT"]).truncate(15));h[7].onclick=new Function("mywindow.load_window({page_name:'ajax-card_detail.html', param:'action=card_people&type=want&"+m+"', length:250, height:250}); return false;");h[8].onclick=new Function("mywindow.load_window({page_name:'ajax-card_detail.html', param:'action=add_card&type=want&"+m+"', length:250, height:300}); return false;");h[9].onclick=new Function("mywindow.load_window({page_name:'ajax-card_detail.html', param:'action=add_card&type=got&"+m+"', length:250, height:300}); return false;")}for(var j=f+1;j<20;j++){$(l[j]).hide()}n.appendChild(k)},fctsearch:function(a,d){var c=this;this.rollin();var b=new Array();if(this.list_edition!=null){b=this.list_edition}this.ajax_request("json-search.html",{method:"post",parameters:{card:escape(d.card.value),state:escape($F(d.state)),language:escape($F(d.language)),spec:escape($F(d.spec)),editions:(b).toJSON(),game:escape(c.loaded_game),page:escape(c.page),order_by:escape(c.order_by),action:"search"},onSuccess:function(f){var e=validateJSON(f.responseText);c.settingup(a,e,d);d.card.focus()}})},load_form:function(b){var a=$("searchcard");a.style.display="block";$(b).style.display="none"},submit_form:function(b,d){if(d==null){this.page=1}var a=$(b).getElementsByTagName("form");var c=$A(a);this.fctsearch($(b),c[0])},next_page:function(a,b){this.page=parseInt(b);this.submit_form(a,this.page)},initialize:function(){this.page=1;this.order_by="";this.loaded_game="";this.list_edition=null},settingup_game:function(h){var b=0;var e=0;var g=h.length;while(e<g){var d=create.ul({classname:"collection"});var c=h[e]["id_collection"];var a=create.li({id:"collection"+h[e]["id_collection"],classname:"collection",size:"16",text:h[e]["fr_name_collection"],onclick:new Function("searchcards.select_collection('"+c+"'); return false")});d.appendChild(a);var f=h[e]["id_edition"];var a=create.li({id:f,text:h[e]["fr_name_edition"],classname:"edition",size:"16",onclick:new Function("searchcards.select_edition('"+f+"'); return false")});d.appendChild(a);while(++e<g&&h[e]["id_collection"]==c){var f=h[e]["id_edition"];var a=create.li({id:f,text:h[e]["fr_name_edition"],classname:"edition",size:"16",onclick:new Function("searchcards.select_edition('"+f+"'); return false")});d.appendChild(a)}$("game_res"+b%4).appendChild(d);b++}$("game_res").show()},clear_game:function(){this.list_edition=null;$("game_res0").update("");$("game_res1").update("");$("game_res2").update("");$("game_res3").update("");this.rollin()},load_editions:function(a){if($("game_res").visible()){$("search_edition").update("Sélectionner des éditions");$("game_res").hide();return}else{$("game_res").show();$("search_edition").update("Cacher les éditions")}if(this.list_edition==null){this.list_edition=new Array();var b=this;this.ajax_request("json-search.html",{method:"post",parameters:{id_game:escape(a),action:"editions"},onSuccess:function(d){var c=validateJSON(d.responseText);b.settingup_game(c)}})}},select_edition:function(g,f){var c=$("game_res").getElementsByTagName("li");var a=$A(c);var b=null;a.each(function(h){if(h.id==g){b=$(h);return}});if(b==null){return}var e=false;var d=new Array();this.list_edition.each(function(h){if(h==g){e=true}else{d.push(h)}});this.list_edition=d;if(!e){$("search_edition").addClassName("edition_clicked")}else{if(this.list_edition.length==0){$("search_edition").removeClassName("edition_clicked")}}if(e&&f!=true){b.removeClassName("clicked");b.addClassName("edition");return}if(f!=false){this.list_edition.push(g);if(!e){b.removeClassName("edition");b.addClassName("clicked")}}},select_collection:function(b){var e=this;var d=$("collection"+b);var c=$(d.up()).getElementsByTagName("li");var a=$A(c);if(d.hasClassName("clicked")){a.each(function(f){e.select_edition(f.id,false)});return}else{a.each(function(f){e.select_edition(f.id,true)});return}},mod_order_by:function(a,b,c){this.order_by=c;this.submit_form(a,this.page)},load_game:function(a){var b=$A($("menu_search").getElementsByTagName("li"));b.each(function(d){if($(d).hasClassName("current")){$(d).removeClassName("current")}});$("menu_search_"+a).addClassName("current");this.clear_game();$("search_option").update();if(a==0){this.loaded_game=""}else{this.loaded_game=a;var c=create.a({id:"search_edition",text:"Sélectionner des éditions",onclick:new Function("searchcards.load_editions("+a+"); return false")});$("search_option").appendChild(c)}},rollin:function(){$("game_res").hide();if($("search_edition")!=null&&$("search_edition")!="undefined"){$("search_edition").update("Sélectionner des éditions");if(this.list_edition==null){$("search_edition").removeClassName("edition_clicked")}}}});searchcards=new SearchCard();SearchPerson=Class.create();SearchPerson.prototype=Object.extend(new Page("ajax-search_person.html",true),{print_array_person:function(f,m){var l=$("search_person_nb_res");var q=m.length;if(q==16){q--;l.update("<br/>Plus de 15 résultats, tu peux préciser ta recherche.<br/><br/>")}else{l.update("<br/>")}var t=create.table({id:"tab_res",name:"tab_res",width:"400"});var h=create.thead({id:"ar_thead"});var a=create.th({id:"ar_th1",text:"Troker"});var o=create.th({id:"ar_th2",text:"Région"});var d=create.th({id:"ar_th2",text:"Pays"});var j=create.tr({id:"ar_tr"});var p=create.tbody({id:"ar_tbody"});j.appendChild(a);j.appendChild(o);j.appendChild(d);h.appendChild(j);if(q==0){var b=create.tr();var n=create.td({text:"Pas de résultats",colspan:3});n.style.textAlign="center";b.appendChild(n);p.appendChild(b)}for(var r=0;r<q;++r){var u=create.tr({id:"ar_tr1_"+r});var g=create.td({id:"ar_td1_"+r,text:m[r][0],classname:"linked",onclick:new Function("mywindow.load_window({page_name:'ajax-profil.html', param:'action=summary&id="+m[r][2]+"', length:350, height:250, title:'"+m[r][0]+"'}); return false;")});var e=create.td({id:"ar_td2_"+r,text:m[r][1]});var c=create.td({id:"ar_td3_"+r,text:m[r][3]});u.appendChild(g);u.appendChild(e);u.appendChild(c);p.appendChild(u)}t.appendChild(h);t.appendChild(p);t.style.position="static";var v=f.getElementsByTagName("div");for(var r=0;r<v.length;++r){var k=/content_window$/;if(k.exec(v[r].id)!=null){v[r].appendChild(t)}}},search_p:function(a,c){var b=this;this.ajax_request("json-search_person.html",{method:"post",parameters:$(c).serialize(true),onSuccess:function(d){var e=validateJSON(d.responseText);b.print_array_person(a,e)}})},search_person:function(d){var b=$(d).getElementsByTagName("div");for(var e=0;e<b.length;++e){var g=/content_window$/;if(g.exec(b[e].id)!=null){var f=b[e].getElementsByTagName("table");for(var c=0;c<f.length;++c){g=/tab_res$/;if(g.exec(f[c].id)!=null){while(f[c].childNodes.length>0){f[c].removeChild(f[c].firstChild)}b[e].removeChild(f[c]);break}}break}}var a=$(d).getElementsByTagName("form");var h=$A(a);this.search_p($(d),h[0])}});searchpeople=new SearchPerson();Profil=Class.create();Profil.prototype=Object.extend(new Page("ajax-profil.html",false),{check_perso:function(a){if($F(a.lastname)==""||$F(a.firstname)==""){alert_message("Vous devez remplir tous les champs obligatoires.");return}this.submit(a,"msg_perso")},check_pass:function(a){if($F(a.profil_pass2)==""||$F(a.profil_old_pass)==""){alert_message("Vous devez remplir tous les champs obligatoires.");return}if($F(a.profil_pass)!=$F(a.profil_pass2)){alert_message("Le mot de passe et la confirmation ne correspondent pas.");return}this.submit(a,"msg_pass")},check_profil:function(b){if($F(b.email)==""||$F(b.country)==""){alert_message("Vous devez remplir tous les champs obligatoires.");return}var a=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(!a.test($F(b.email))){alert_message("Email non valide.");return}this.submit(b,"msg_profil")},submit:function(a,b){this.ajax_request("json-profil.html",{method:"post",parameters:$(a).serialize(true),onSuccess:function(c){var d=validateJSON(c.responseText);$(b).update("<i>"+d[1]+"</i>");$(b).show();setTimeout("$('"+b+"').update('&nbsp;');",5000)}})},callback_avatar:function(b,a){$("profil_avatar").src=a;$("msg_avatar").update("<i>"+b+"</i>");setTimeout("$('msg_avatar').update('&nbsp;');",5000)}});profil=new Profil();CardDetail=Class.create();CardDetail.prototype=Object.extend(new Page("ajax-card_detail.html",true),{dec_nb_card:function(){var a=$("nb_card");if(parseInt(a.value)>1){a.value=parseInt(a.value)-1}},inc_nb_card:function(){var a=$("nb_card");if(parseInt(a.value)<99){a.value=parseInt(a.value)+1}},valid_number:function(a){if(!parseInt(a)||parseInt(a)<1){return 1}if(parseInt(a)>99){return 99}return parseInt(a)},check_number_card:function(){var a=$("nb_card");a.value=this.valid_number(a)},add_the_card:function(a){this.ajax_request("json-card_detail.html",{method:"get",parameters:$(a).serialize(true),onSuccess:function(c){var b=validateJSON(c.responseText);if(b!="added"){alert_message(b)}Windows.getWindow((((((((($(a).up()).up()).up()).up()).up()).up()).up()).up()).id).destroy()}})},mod_card:function(a){this.ajax_request("json-card_detail.html",{method:"get",parameters:$(a).serialize(true),onSuccess:function(c){var b=validateJSON(c.responseText);if(b!="modified"){alert_message(b);return}var d=$(a).up();d.update("Merci de votre contribution.<br/>La modification va être validée prochainement.")}})}});carddetail=new CardDetail();Trade=Class.create();Trade.prototype=Object.extend(new Page("ajax-trade.html",false),{initialize:function(){this.counter_trade=0;this.list_add=new Array();this.list_del=new Array();this.list_mod=new Array();this.id_neg=null;this.id_user=null;this.new_id_user=null;this.new_pseudo=null;this.new_card=null;this.state="undefined";this.identification=true;this.selected_group=null;this.selected_column=null},afterload:function(){if(this.new_id_user==null){this.load_trade()}else{this.reload()}},reload:function(){if(this.new_id_user!=null){this.clear_trade();this.state="";this.id_user=this.new_id_user;this.id_neg=-1;var a=this;this.ajax_request("ajax-trade.html",{method:"get",parameters:{new_pseudo:escape(a.new_pseudo),new_id_user:escape(a.new_id_user),action:"get_trade"},onSuccess:function(b){$("trade_res").update(b.responseText);mycards.initAccordions("accordion_toggle","trade_container","trade_vertical_nested_container");if(a.new_card!=null){a.add_card(a.new_card.col,a.new_card.name,a.new_card.id,a.new_card.id_user,a.new_card.nb,a.new_card.state,a.new_card.language)}a.new_id_user=null;a.new_pseudo=null;a.new_card=null;a.selected_group=null;a.selected_column=null}})}if(this.state!=""){this.load_trade(this.state)}},settingup_trade:function(e){var b=e[0];if(b.NB_UNDEFINED>0){$("menu_trade_undefined").addClassName("new")}if(b.NB_ACCEPTED>0){$("menu_trade_accepted").addClassName("new")}if(b.NB_REFUSED>0){$("menu_trade_refused").addClassName("new")}var f=e[1];var t=create.table({width:550});var o=create.thead();var d=create.tbody();var r=create.tr();var u=create.th({text:"Pseudo",width:100});var l=create.th({text:"Moi",width:200});var w=create.th({text:"Lui",width:200});var k=create.th({text:"Voir",width:50});r.appendChild(u);r.appendChild(l);r.appendChild(w);r.appendChild(k);o.appendChild(r);t.appendChild(o);t.appendChild(d);t.style.position="static";if(f.length==0){var a=create.tr();var m='Pas d\'échange en cours. <br/>Pour commencer un échange, tu peux rechercher les cartes que tu veux avec le formulaire de <a href="carte-recherche.html" onclick="javascript: searchcards.load(true); return false">recherches de cartes</a>, puis en sélectionnant un échangeur potentiel.';if(this.state=="accepted"){m="Pas d'échange accepté."}else{if(this.state=="refused"){m="Pas d'échange refusé."}}var h=create.td({colspan:4,align:"center",text:m});a.appendChild(h);d.appendChild(a)}for(var q=0;q<f.length;q++){var a=create.tr();var c=create.td({text:f[q]["pseudo"]});var n=create.td();var v=create.td();var x=create.td({text:"Voir",classname:"linked",onclick:new Function("trade.load_a_trade('"+f[q]["id_neg"]+"'); return false;")});if(f[q]["unread"]){$(c).addClassName("unread");$(n).addClassName("unread");$(v).addClassName("unread");$(x).addClassName("unread")}var g=create.ul();var y=create.ul();for(var p=0;p<f[q]["my"].length;p++){$(g).appendChild(create.li({text:f[q]["my"][p]}))}for(var p=0;p<f[q]["his"].length;p++){$(y).appendChild(create.li({text:f[q]["his"][p]}))}n.appendChild(g);v.appendChild(y);a.appendChild(c);a.appendChild(n);a.appendChild(v);a.appendChild(x);d.appendChild(a)}$("trade_res").appendChild(t)},load_trade:function(c){this.clear_trade();this.state=c;var b=this;if(c==null){c="undefined"}var a=$A($("menu_trade").getElementsByTagName("li"));a.each(function(d){if($(d).hasClassName("current")){$(d).removeClassName("current")}if($(d).hasClassName("new")){$(d).removeClassName("new")}});$("menu_trade_"+c).addClassName("current");this.ajax_request("json-trade.html",{method:"get",parameters:{state:escape(c)},onSuccess:function(e){var d=validateJSON(e.responseText);b.settingup_trade(d)}})},clear_trade:function(){this.id_neg=null;this.id_user=null;this.selected_group=null;this.selected_column=null;var a=$("trade_res");while(a.childNodes.length>0){a.removeChild(a.firstChild)}this.list_add.clear();this.list_del.clear();this.list_mod.clear()},load_a_trade:function(b){this.clear_trade();this.state="";this.id_neg=b;var a=this;this.selected_group=null;this.selected_column=null;this.ajax_request("ajax-trade.html",{method:"get",parameters:{id_trade:escape(b),action:"get_trade"},onSuccess:function(c){$("trade_res").update(c.responseText);mycards.initAccordions("accordion_toggle","trade_container","trade_vertical_nested_container")}})},add_card:function(b,c,g,h,f,a,e){var j="new"+this.counter_trade++;var d={id:j,name_card:c,id_card:g,id_user:h,nb:f,state:a,language:e};this.list_add.push(d);this.add_card_tab(b-1,h,c,g,j,f,a,e)},add_card_tab:function(d,g,e,n,p,k,b,h){var l=create.tr({id:p});l.onmouseover=new Function("trade.print_detail('"+b+"', '"+h+"')");l.onmouseout=function(){$("trade_card_detail").hide()};var j=create.td({text:e,size:"13",onclick:new Function("mywindow.load_window({page_name:'ajax-card_detail.html', param:'id_card="+n+"', length:400, height:380, title : '"+e.replace(/'/g,"\\'").replace(/"/g,'\\"')+"'}); return false;")});var r=create.td();if(d%2){var o="trade.del_card('"+d+"', '"+p+"'); return false;";var c=create.td({img:"img/delete.PNG",onclick:new Function(o)});var f=create.a({text:"-",onclick:new Function("trade.mod_card('"+d+"', '"+p+"', '-1'); return false"),classname:"linked"});var m=create.a({text:"+",onclick:new Function("trade.mod_card('"+d+"', '"+p+"', '1'); return false"),classname:"linked"});var k=create.input({id:p,type:"text",value:"1",size:"1"});r.appendChild(f);r.appendChild(k);r.appendChild(m)}else{var o="trade.add_card('"+d+"', '"+n+"', '"+g+"','"+k+"', '"+b+"', '"+h+"'); return false;";var c=create.td({img:"img/delete.PNG",onclick:new Function(o)})}$(l).appendChild(j);$(l).appendChild(r);$(l).appendChild(c);var q=$("tab_trade"+d).getElementsByTagName("thead");var a=$A(q);a.each(function(t){$(t).appendChild(l)})},del_card:function(d,b){var f=$("tab_trade"+d);var a=f.getElementsByTagName("tr");var c=$A(a);c.each(function(g){if(g.id==b){$(g).remove()}});if(parseInt(b)){this.list_del.push(b)}else{var e=new Array();this.list_add.each(function(g){if(g.id!=b){e.push(g)}});this.list_add=e}},mod_card:function(e,c,g){var b=parseInt(g);var f=$("tab_trade"+e);var a=f.getElementsByTagName("input");var d=$A(a);d.each(function(h){if(h.id==c){b=b+parseInt($F(h));$(h).value=b}});this.list_add.each(function(h){if(h.id==c){h.nb=b;return}});this.list_mod.each(function(h){if(h.id==c){h.nb=b;return}});this.list_mod.push({id:c,nb:b})},submit_form:function(e){var a=$(this.url).getElementsByTagName("form");var c=$A(a);var d=c[0];var b=this;if(this.id_neg!=-1){this.ajax_request("json-trade.html",{method:"get",parameters:{send:escape($F(d.themessage)),id_trade:escape(b.id_neg),money1:escape($F($("trade_money1"))),money2:escape($F($("trade_money2"))),list_add:b.list_add.toJSON(),list_del:b.list_del.toJSON(),list_mod:b.list_mod.toJSON(),mode:escape(e),action:"send"},onSuccess:function(g){var f=validateJSON(g.responseText);b.load_a_trade(b.id_neg)}})}else{this.ajax_request("json-trade.html",{method:"get",parameters:{send:escape($F(d.themessage)),new_trade:escape(b.id_user),money1:escape($F($("trade_money1"))),money2:escape($F($("trade_money2"))),list_add:b.list_add.toJSON(),list_del:b.list_del.toJSON(),list_mod:b.list_mod.toJSON(),mode:escape(e),action:"send"},onSuccess:function(g){var f=validateJSON(g.responseText);b.load_a_trade(f[0])}})}this.list_add.clear();this.list_del.clear();this.list_mod.clear()},load_with_person:function(h,k,f,c,g,e,a,d){if(h==authentification.id_user){alert_message("Tu ne peux pas faire un échange avec toi même.");return}this.new_id_user=h;var b=g=="want"?2:4;var j=g=="want"?-2:h;if(f!=null){this.new_card={col:b,name:c,id:f,id_user:j,nb:e,state:a,language:d}}else{this.new_card=null}this.new_pseudo=k;this.load(true)},submit_com:function(){var a=$(this.url).getElementsByTagName("form");var c=$A(a);var d=c[0];var b=this;if($F(d.mark)==""||$F(d.themessage)==""||$F(d.themessage)=="Votre commentaire"){alert_message("Veuillez noter et remplir le commentaire puis revalider");return}this.ajax_request("json-trade.html",{method:"get",parameters:{mark:escape($F(d.mark)),themessage:escape($F(d.themessage)),id_user:escape(b.id_user),id_trade:escape(b.id_neg),action:"add_com"},onSuccess:function(f){var e=validateJSON(f.responseText);alert_message(e)}})},print_detail:function(c,f){var e=$("trade_card_detail");for(var b=0;b<e.childNodes.length;){e.removeChild(e.childNodes[b])}var a=create.img({src:"public/img/card/"+c+".png"});var d=create.img({src:"public/img/card/"+f+".jpg"});e.appendChild(a);e.appendChild(d);e.style.left=(mouse_pos_x+20)+"px";e.style.top=(mouse_pos_y-20)+"px";e.show()},load_cards:function(b,a,c){var d=this;if(this.selected_group==b&&this.selected_column==c){this.selected_group=null;this.selected_column=null;return}else{this.selected_group=b}this.ajax_request("ajax-trade.html",{method:"get",parameters:{action:"tab_cards",id_group:b,id_user:a,column:c},onSuccess:function(f){var e=f.responseText;$("trade_nested_accordion_group"+c+"_"+b).update(e)}})}});trade=new Trade();MyCards=Class.create();MyCards.prototype=Object.extend(new Page("ajax-card.html",false),{initialize:function(){this.identification=true;this.type="got";this.selected_group=null;this.selected_game=null;this.groups=null},afterload:function(){this.load_type("got")},reload:function(){this.load_type(this.type)},del_card:function(a,b){if(confirm("Etes vous sur de vouloir supprimer cette carte ?")){this.ajax_request("json-card.html",{method:"get",parameters:{from:escape(a),del:escape(b),action:"delete_card"},onSuccess:function(g){var e=validateJSON(g.responseText);if(e!="deleted"){alert_message(e)}var f=$("got_list");var c=f.getElementsByTagName("tr");var d=$A(c);d.each(function(h){if(h.id==b){$(h).remove()}})}})}},inc_nb:function(e,g,d){var f=$("got_list");var b=f.getElementsByTagName("input");var c=$A(b);var a=0;c.each(function(h){if(h.id==g){a=parseInt(carddetail.valid_number($F(h))+parseInt(d));h.value=a}});this.ajax_request("json-card.html",{method:"get",parameters:{from:escape(e),mod_card:escape(g),new_nb_card:escape(a),action:"edit_card_nb"},onSuccess:function(j){var h=validateJSON(j.responseText);if(h!="updated"){alert_message(h)}}})},mod_state:function(a,c,b){this.ajax_request("json-card.html",{method:"get",parameters:{from:escape(a),mod_card:escape(c),new_state:escape(b),action:"edit_card_state"},onSuccess:function(e){var d=validateJSON(e.responseText);if(d!="updated"){alert_message(d)}}})},mod_language:function(a,c,b){this.ajax_request("json-card.html",{method:"get",parameters:{from:escape(a),mod_card:escape(c),new_language:escape(b),action:"edit_card_language"},onSuccess:function(e){var d=validateJSON(e.responseText);if(d!="updated"){alert_message(d)}}})},mod_spec:function(b,c,a){this.ajax_request("json-card.html",{method:"get",parameters:{from:escape(b),mod_card:escape(c),new_spec:escape(a),action:"edit_card_spec"},onSuccess:function(e){var d=validateJSON(e.responseText);if(d!="updated"){alert_message(d)}}})},load_type:function(b){var a="want";if(b=="want"){a="got"}$(a+"_menu_list").removeClassName("clicked");$(b+"_menu_list").addClassName("clicked");var c=this;this.type=b;this.selected_group=null;this.selected_game=null;this.ajax_request("ajax-card.html",{method:"get",parameters:{type:escape(b),action:"cards"},onSuccess:function(d){c.settingup(d.responseText)}})},settingup:function(a){$("got_list_tab").update(a);this.initAccordions("accordion_toggle","cards_container","cards_vertical_nested_container")},initAccordions:function(e,b,d){var e=$$("."+e);e.each(function(f){$(f.next(0)).setStyle({height:"0px"})});var c=new accordion(b);var a=new accordion(d,{classNames:{toggle:"vertical_accordion_toggle",toggleActive:"vertical_accordion_toggle_active",content:"vertical_accordion_content"}});return},get_selected:function(){var c=$$("#cards_nested_accordion_group"+this.selected_group+" input[type=checkbox]");var b=new Array();var d=0;var a=c.length;this.selected_rows=new Array();for(d=0;d<a;++d){var f=c[d];if(f.checked){var e=f.up().up();b.push(e.id);this.selected_rows.push(e)}}return b},change_group:function(d){var c=this;if(d==-1){return}if(d==-2){mywindow.load_window({page_name:"ajax-card.html",param:"action=create_group&type="+c.type,length:250,height:200});return}var a=this.get_selected();for(var b=0;b<this.selected_rows.length;b++){this.selected_rows[b].remove()}this.ajax_request("json-card.html",{method:"post",parameters:{action:"add_cards_to_group",ids_card:a.toJSON(),id_group:d},onSuccess:function(f){var e=validateJSON(f.responseText);$("cards_group").selectedIndex=0}})},create_group:function(b){var a=this;this.ajax_request("json-card.html",{method:"post",parameters:$(b).serialize(true),onSuccess:function(f){var e=validateJSON(f.responseText);var d=create.option({value:e,text:$F(b.name)});var c=$("cards_group");c.appendChild(d);c.selectedIndex=c.options.length-1;Windows.getWindow((((((((($(b).up()).up()).up()).up()).up()).up()).up()).up()).id).destroy()}})},load_cards:function(a){var b=this;if(this.selected_group==a){this.selected_group=null;return}else{this.selected_group=a}this.ajax_request("ajax-card.html",{method:"get",parameters:{action:"tab_cards",type:b.type,id_group:a},onSuccess:function(d){var c=d.responseText;$("cards_nested_accordion_group"+a).update(c)}})},load_groups:function(c){if(this.selected_game==c){this.selected_game=null;return}else{this.selected_game=c}var b=$("cards_group");for(var e=2;e<b.options.length;){b.options[e].remove()}var a=this.groups[c]["GROUPS"];for(var e=0;e<a.length;e++){if(a[e]["ID_GOT_GROUP"]==null){break}var d=create.option({value:a[e]["ID_GOT_GROUP"],text:a[e]["GOT_GROUP_NAME"]});b.appendChild(d)}},delete_cards:function(){var c=this.get_selected();if(!confirm("Etes vous sur de vouloir supprimer ces "+c.length+" cartes ?")){return}for(var a=0;a<this.selected_rows.length;a++){this.selected_rows[a].remove()}var b=this;this.ajax_request("json-card.html",{method:"get",parameters:{action:"delete	_cards",from:escape(b.type),ids_card:c.toJSON()},onSuccess:function(e){var d=validateJSON(e.responseText)}})},state_cards:function(a){var f=this.get_selected();var b=a.selectedIndex;var e=a.value;for(var c=0;c<this.selected_rows.length;c++){$(this.selected_rows[c]).select("[name=state]")[0].selectedIndex=b}a.selectedIndex=0;var d=this;this.ajax_request("json-card.html",{method:"get",parameters:{action:"state_cards",from:escape(d.type),state:e,ids_card:f.toJSON()},onSuccess:function(h){var g=validateJSON(h.responseText)}})},language_cards:function(a){var f=this.get_selected();var b=a.selectedIndex;var e=a.value;for(var c=0;c<this.selected_rows.length;c++){$(this.selected_rows[c]).select("[name=language]")[0].selectedIndex=b}a.selectedIndex=0;var d=this;this.ajax_request("json-card.html",{method:"get",parameters:{action:"language_cards",from:escape(d.type),language:e,ids_card:f.toJSON()},onSuccess:function(h){var g=validateJSON(h.responseText)}})},spec_cards:function(a){var f=this.get_selected();var b=a.selectedIndex;var e=a.value;for(var c=0;c<this.selected_rows.length;c++){$(this.selected_rows[c]).select("[name=spec]")[0].selectedIndex=b}a.selectedIndex=0;var d=this;this.ajax_request("json-card.html",{method:"get",parameters:{action:"spec_cards",from:escape(d.type),spec:e,ids_card:f.toJSON()},onSuccess:function(h){var g=validateJSON(h.responseText)}})}});mycards=new MyCards();Message=Class.create();Message.prototype=Object.extend(new Page("ajax-message.html",false),{initialize:function(){this.mode="received";this.identification=true;this.current_message=null},afterload:function(){if(this.mode!=""){this.reload()}},reload:function(){if(this.mode!=""){if(this.mode=="write"){this.load_write()}else{this.load_messages(this.mode)}}},clear:function(){this.current_message=null;var a=$("message_res");if(a!=null){while(a.childNodes.length>0){a.removeChild(a.firstChild)}}},load_messages:function(c){this.clear();if(c==null){c="received"}this.mode=c;var b=this;var a=$A($("menu_message").getElementsByTagName("li"));a.each(function(d){if($(d).hasClassName("current")){$(d).removeClassName("current")}if($(d).hasClassName("new")){$(d).removeClassName("new")}});$("menu_message_"+c).addClassName("current");this.ajax_request("json-message.html",{method:"get",parameters:{mode:escape(c)},onSuccess:function(d){var e=validateJSON(d.responseText);b.settingup_messages(e)}})},settingup_messages:function(g){var o=create.table({width:600,id:"message_table"});var k=create.thead();var d=create.tbody();var l=create.tr();var e=create.th({text:"Expéditeur",width:100});var b=create.th({text:"Sujet"});var n=create.th({text:"Date",width:150});l.appendChild(e);l.appendChild(b);l.appendChild(n);k.appendChild(l);if(g.length==0){var l=create.tr();var a=create.td({text:"Pas de messages",colspan:3});a.style.textAlign="center";l.appendChild(a);d.appendChild(l)}for(var c=0;c<g.length;c++){var l=create.tr({id:g[c][1]});var m="linked";if(this.mode!="sent"&&g[c][5]=="0"){m="unread"}var j=create.td({text:g[c][0],classname:m,onclick:new Function("mywindow.load_window({page_name:'ajax-profil.html', param:'action=summary&id="+g[c][2]+"', length:350, height:250, title:'"+g[c][0]+"'}); return false;")});var f=create.td({text:g[c][4],classname:m,onclick:new Function("message.load_a_message('"+g[c][1]+"'); return false")});var h=create.td({text:g[c][3],classname:m,onclick:new Function("message.load_a_message('"+g[c][1]+"'); return false")});l.appendChild(j);l.appendChild(f);l.appendChild(h);d.appendChild(l)}o.appendChild(k);o.appendChild(d);$("message_res").appendChild(o)},load_a_message:function(f){var a=-1;if(this.current_message){$("message_table").deleteRow(this.current_message);a=this.current_message;this.current_message=null}var b=$A($("message_table").getElementsByTagName("tr"));var d=0;var c=false;b.each(function(g){if(g.id==f){c=true;return}if(!c){d++}});d++;if(a==d){return}var e=this;this.ajax_request("json-message.html",{method:"get",parameters:{mess:escape(f),mode:escape(e.mode),action:"get_message"},onSuccess:function(k){var q=validateJSON(k.responseText);var p=create.p({text:q[4]});var g=/^Re:/;var n=(g.exec(q[3])==null)?"Re: "+q[3]:q[3];var h=create.input({type:"button",value:"Répondre ",onclick:new Function("mywindow.load_window({page_name:'ajax-message.html', param:'action=write&pseudo="+q[5]+"&subject="+n+"', length:350, height:250}); return false;")});var o=create.input({type:"button",value:" Supprimer",onclick:new Function("message.delete_message('"+q[7]+"', '"+d+"'); return false")});e.current_message=d;var m=$("message_table").insertRow(d);var l=$A(b[d-1].getElementsByTagName("td"));l.each(function(r){if($(r).hasClassName("unread")){$(r).removeClassName("unread");$(r).addClassName("linked")}});m.id="current_message";var j=create.td({colspan:"3"});j.appendChild(p);j.appendChild(h);j.appendChild(o);m.appendChild(j)}})},settingup_a_message:function(a){var d=create.p({text:"Pseudo : "+a[5]});var b=create.p({text:"Date : "+a[2]});var c=create.p({text:"Sujet : "+a[3]});var g=create.p({text:a[4]});var f=/^Re:/;var h=(f.exec(a[3])==null)?"Re: "+a[3]:a[3];var e=create.a({text:"Répondre",onclick:new Function("message.write('"+a[5]+"', '"+h+"'); return false")});$("message_res").appendChild(d);$("message_res").appendChild(b);$("message_res").appendChild(c);$("message_res").appendChild(g);$("message_res").appendChild(e)},write:function(b,a){this.pseudo=b;this.subject=a;this.mode="write";this.clear();this.load(true)},load_write:function(){var g=this.pseudo;if(g==null){g="Destinataire"}var b=this.subject;if(b==null){b="Sujet"}this.mode="";var a=$A($("menu_message").getElementsByTagName("li"));a.each(function(j){if($(j).hasClassName("current")){$(j).removeClassName("current")}if($(j).hasClassName("new")){$(j).removeClassName("new")}});$("menu_message_new").addClassName("current");var d=create.form({id:"message_form",action:"javascript:message.send($('message_form'))"});var c=create.input({name:"action",type:"hidden",value:"send_message"});var f=create.input({name:"receiver",type:"text",value:g});f.style.display="block";f.onfocus=function(){if(this.value=="Destinataire"){this.value=""}};f.onblur=function(){if(this.value==""){this.value="Destinataire"}};var b=create.input({name:"subject",type:"text",value:b});b.style.display="block";b.maxLength=50;b.onfocus=function(){if(this.value=="Sujet"){this.value=""}};b.onblur=function(){if(this.value==""){this.value="Sujet"}};var h=create.textarea({name:"text",text:"Message"});h.style.display="block";h.onfocus=function(){if(this.value=="Message"){this.value=""}};h.onblur=function(){if(this.value==""){this.value="Message"}};var e=create.input({type:"submit",value:"Envoyer"});e.style.display="block";$(d).appendChild(c);$(d).appendChild(f);$(d).appendChild(b);$(d).appendChild(h);$(d).appendChild(e);$("message_res").appendChild(d)},send:function(b){var a=this;this.ajax_request("json-message.html",{method:"get",parameters:$(b).serialize(true),onSuccess:function(d){var c=validateJSON(d.responseText);alert_message(c[1]);if(!c[0]){return}$(b).reset();a.load_messages();Windows.getWindow(((((((((($(b).up()).up()).up()).up()).up()).up()).up()).up()).up()).id).destroy()}})},delete_message:function(c,a){var b=this;this.ajax_request("json-message.html",{method:"get",parameters:{delete_message:c,action:"delete_message"},onSuccess:function(e){var d=validateJSON(e.responseText);alert_message(d);$("message_table").deleteRow(a-1);$("message_table").deleteRow(a-1);b.current_message=null}})}});message=new Message();Agreement=Class.create();Agreement.prototype=Object.extend(new Page("ajax-user_agreement.html",false),{});agreement=new Agreement();Intro=Class.create();Intro.prototype=Object.extend(new Page("ajax-intro.html",false),{});intro=new Intro();Perso=Class.create();Perso.prototype=Object.extend(new Page("ajax-perso.html",false),{initialize:function(){this.pseudo=null},afterload:function(){this.reload()},reload:function(){var a=this;this.ajax_request("ajax-perso.html",{method:"get",parameters:{pseudo:escape(a.pseudo)},onSuccess:function(b){a.pseudo=null;$("ajax-perso.html").update(b.responseText);a.initAccordions()}})},load_type:function(c,b){var a="want";if(c=="want"){a="got"}$(a+"_menu_perso").removeClassName("clicked");$(c+"_menu_perso").addClassName("clicked");var d=this;this.type=c;this.ajax_request("ajax-perso.html",{method:"get",parameters:{type:escape(c),id_user:(b),action:"cards"},onSuccess:function(e){d.settingup(e.responseText)}})},settingup:function(a){$("got_list_perso").update(a);return},load_cards:function(a){var b=this;if(this.selected_group==a){this.selected_group=null;return}else{this.selected_group=a}this.ajax_request("ajax-perso.html",{method:"get",parameters:{action:"tab_cards",type:b.type,id_group:a,id_user:b.id_user},onSuccess:function(d){var c=d.responseText;$("perso_nested_accordion_group"+a).update(c)}})}});perso=new Perso();Subscription=Class.create();Subscription.prototype=Object.extend(new Page("ajax-subscription.html",false),{check:function(e){var b=false;var a=$A(e.getElementsByTagName("span"));a.each(function(f){$(f).update("&nbsp;")});var d=/^[a-zA-Z0-9_]{4,20}$/;if(d.exec($F(e.new_pseudo))==null){$("error_new_pseudo").update("Uniquement des lettre, des chiffres, et/ou le caractère '_'.");b=true}if($F(e.new_pseudo).length<4||$F(e.new_pseudo).length>15){$("error_new_pseudo").update("La longueur du pseudo doit être entre 4 et 15 caractères.");b=true}if($F(e.profil_pass).length<6||$F(e.profil_pass).length>20){$("error_profil_pass").update("La longueur du mot de passe doit être entre 6 et 20 caractères.");b=true}if($F(e.profil_pass)!=$F(e.profil_pass2)){$("error_profil_pass").update("Le mot de passe et la confirmation ne correspondent pas.");b=true}if($F(e.new_pseudo)==""){$("error_new_pseudo").update("Champ obligatoire");b=true}if($F(e.country)==""){$("error_country").update("Champ obligatoire");b=true}var c=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if($F(e.email)==""){$("error_email").update("Champ obligatoire");b=true}else{if(!c.test($F(e.email))){$("error_email").update("Email non valide");b=true}}if($F(e.profil_pass)==""){$("error_profil_pass").update("Champ obligatoire");b=true}if($F(e.profil_pass2)==""){$("error_profil_pass2").update("Champ obligatoire");b=true}if(!e.accepted.checked){$("subscription_msg").update("Vous devez accepter les conditions pour vous inscrire.");b=true}if(!b){this.submit(e)}},submit:function(a){if(confirm("Confirme ton email : "+$F(a.email)+"\nUn email va t'être envoyé pour valider ton inscription.")){this.ajax_request("json-subscription.html",{method:"post",parameters:$(a).serialize(true),onSuccess:function(b){var c=validateJSON(b.responseText);if(c[0]=="0"){a.style.display="none";$("msg_profil").removeClassName("error_msg")}else{$("msg_profil").addClassName("error_msg")}$("msg_profil").update(c[1])}})}}});subscription=new Subscription();Report=Class.create();Report.prototype=Object.extend(new Page("ajax-report.html",false),{submit_form:function(a){if($F(a.message)==""){alert_message("Description obligatoire");return}this.ajax_request("json-report.html",{method:"post",parameters:$(a).serialize(true),onSuccess:function(c){var b=validateJSON(c.responseText);alert_message(b);Windows.getWindow("bug_report").destroy()}})}});report=new Report();Forum=Class.create();Forum.prototype=Object.extend(new Page("ajax-forum.html",false),{initialize:function(){this.category={id:"",name:""};this.forum={id:"",name:"",page:1};this.topic={id:"",name:"",page:1,watched:0}},afterload:function(){this.load_forum_cat()},reload:function(){$("forum_pages").hide();$("forum_pages2").hide();if(this.topic.id!=""){this.load_forum_post(this.topic.id,this.topic.name,null,this.topic.page);return}if(this.forum.id!=""){this.load_forum_topic(this.forum.id,this.forum.name,null,this.topic.page);return}if(this.category.id!=""){this.load_forum_forum(this.category.id,this.category.name);return}this.load_forum_cat()},renew:function(){this.load_forum_cat()},clear:function(c,b){c=c?c:"content_forum";var a=$(c);while(a.childNodes.length>0){a.removeChild(a.firstChild)}if(!b){a=$("form_forum");while(a.childNodes.length>0){a.removeChild(a.firstChild)}}},settingup_forum_cat:function(c){var j=c[0];var h=c[1];var l="";var d=create.ul({id:"forum"});var k=create.table({id:"forum_cat",classname:"cat"});var t=create.thead();var b=create.tr({id:"tr_cat",classname:"cat"});var n=create.th({id:"name",text:"Jeux",classname:"cat"});var q=create.th({id:"description",text:"Description",classname:"cat"});var g=create.th({id:"last",text:"Posts",classname:"cat"});b.appendChild(n);b.appendChild(q);b.appendChild(g);t.appendChild(b);k.appendChild(t);var a=create.tbody();for(var p=0;p<h.length;++p){if(l!=h[p][0]){var f=create.li({id:"li_forum"});var e=create.a({text:h[p][1],onclick:new Function("forum.load_forum_forum('"+h[p][0]+"', '"+h[p][1]+"'); return false")});f.appendChild(e);d.appendChild(f);var b=create.tr({id:"tr_cat",classname:"cat",onclick:new Function("forum.load_forum_forum('"+h[p][0]+"', '"+h[p][1]+"'); return false")});var r=create.td({id:"name",classname:"cat",text:h[p][1],onclick:"return false"});var m=create.td({id:"description",classname:"cat",text:h[p][2]});var o=create.td({id:"last",classname:"cat",text:h[p][3]});b.appendChild(r);b.appendChild(m);b.appendChild(o);a.appendChild(b)}l=h[p][0]}k.appendChild(a);$("line_forum").appendChild(d);$("content_forum").appendChild(k)},load_forum_cat:function(){this.category={id:"",name:""};this.forum={id:"",name:""};this.topic={id:"",name:""};$("forum_pages").hide();$("forum_pages2").hide();dhtmlHistory.add("section:forum",null);this.clear("line_forum");this.clear("content_forum");this.h_name_forum_name();var a=this;this.ajax_request("json-forum.html",{method:"get",parameters:{description_cat:""},onSuccess:function(c){var b=validateJSON(c.responseText);a.settingup_forum_cat(b)}})},settingup_forum_forum:function(d){var p=d[0];var k=d[1];var m="";var e=create.ul({id:"forum"});var n=create.table({id:"forum_forum",classname:"for"});var v=create.thead();var q=create.tr({id:"tr_forum",classname:"for"});var h=create.th({id:"name",text:"Forum",classname:"for"});var l=create.th({id:"description",text:"Description",classname:"for"});var c=create.th({id:"nb",text:"Sujets",classname:"for"});var r=create.th({id:"last",text:"Derniers messages",classname:"for"});q.appendChild(h);q.appendChild(l);q.appendChild(c);q.appendChild(r);v.appendChild(q);n.appendChild(v);var b=create.tbody();for(var u=0;u<k.length;++u){if(m!=k[u][1]){var j=create.li({id:"li_forum"});var g=create.a({text:k[u][0],onclick:new Function("forum.load_forum_topic('"+k[u][1]+"', '"+k[u][0]+"'); return false")});j.appendChild(g);e.appendChild(j);var t="";if(k[u][5]!=null&&k[u][4]>k[u][5]){t="unread"}var q=create.tr({id:"tr_forum",classname:"for",onclick:new Function("forum.load_forum_topic('"+k[u][1]+"', '"+k[u][0]+"'); return false")});var o=create.td({id:"name",classname:t,text:k[u][0],onclick:"return false"});var f=create.td({id:"description",classname:t,text:k[u][2]});var w=create.td({id:"nb",classname:t,text:k[u][3]});var a=create.td({id:"last",classname:t,text:k[u][6]});q.appendChild(o);q.appendChild(f);q.appendChild(w);q.appendChild(a);b.appendChild(q)}m=k[u][1]}n.appendChild(b);$("line_forum").appendChild(e);$("content_forum").appendChild(n)},load_forum_forum:function(d,c,a){if(d==null){this.load_forum_cat();return}$("forum_pages").hide();$("forum_pages2").hide();this.topic={id:"",name:""};this.category.id=d;this.category.name=c;if(!a){dhtmlHistory.add("section:forum_forum",this.category)}this.clear("line_forum");this.clear("content_forum");this.h_name_forum_name(this.category.name);var b=this;this.ajax_request("json-forum.html",{method:"get",parameters:{id_category:escape(d),action:"forums"},onSuccess:function(f){var e=validateJSON(f.responseText);b.settingup_forum_forum(e)}})},settingup_forum_topic:function(e){var n=Math.ceil(e[0]/30);var h=e[1];create.pages($("forum_pages"),n,this.forum.page,"forum.load_forum_topic('"+this.forum.id+"', '"+this.forum.name+"', null, __i__); return false");create.pages($("forum_pages2"),n,this.forum.page,"forum.load_forum_topic('"+this.forum.id+"', '"+this.forum.name+"', null, __i__); return false");var k="";var a=create.a({text:"Créer un nouveau topic",onclick:new Function("forum.clear(); forum.settingup_form(true); return false")});$("content_forum").appendChild(a);$("content_forum").appendChild(create.div({text:"<br/>"}));var l=create.table({id:"forum_topic",classname:"res"});var t=create.thead();var o=create.tr({id:"tr_forum",classname:"res"});var g=create.th({id:"subject",text:"Sujets",classname:"res"});var j=create.th({id:"answer",text:"Posts",classname:"res"});var d=create.th({id:"author",text:"Auteur",classname:"res"});var p=create.th({id:"last",text:"Derniers messages",classname:"res"});o.appendChild(g);o.appendChild(j);o.appendChild(d);o.appendChild(p);t.appendChild(o);l.appendChild(t);var c=create.tbody();for(var r=0;r<h.length;++r){if(k!=h[r][0]){var q="";if(h[r][6]!=null&&h[r][5]>h[r][6]){q=" unread"}var o=create.tr({id:"tr_forum",classname:"res",onclick:new Function("forum.load_forum_post('"+h[r][0]+"', '"+h[r][1]+"'); return false")});var m=create.td({id:"subject",classname:"linked"+q,text:h[r][1],onclick:"return false"});var f=create.td({id:"answer",classname:"linked"+q,text:h[r][4]});var u=create.td({id:"author",classname:"linked"+q,text:h[r][2],onclick:new Function("mywindow.load_window({page_name:'ajax-profil.html', param:'action=summary&id="+h[r][3]+"', length:350, height:250, title:'"+h[r][2]+"'}); return false;")});var b=create.td({id:"last",classname:"linked"+q,text:h[r][7]});o.appendChild(m);o.appendChild(f);o.appendChild(u);o.appendChild(b);c.appendChild(o)}k=h[r][0]}l.appendChild(c);$("content_forum").appendChild(l)},load_forum_topic:function(e,a,b,d){if(e==null){load_forum_forum(id_category,name_category);return}if(d==null||d==undefined){d=1}this.topic={id:"",name:""};this.forum.id=e;this.forum.name=a;this.forum.page=d;if(!b){dhtmlHistory.add("section:forum_topic",this.forum)}this.clear("content_forum");this.h_name_forum_name(this.forum.name);var c=this;this.ajax_request("json-forum.html",{method:"get",parameters:{id_forum:escape(e),page:escape(d),action:"topics"},onSuccess:function(g){var f=validateJSON(g.responseText);c.settingup_forum_topic(f)}})},settingup_forum_post:function(g,y){this.topic.watched=g[0];var f=g[1];var t=Math.ceil(f[0]/15);var k=f[1];create.pages($("forum_pages"),t,this.topic.page,"forum.load_forum_post('"+this.topic.id+"', '"+this.topic.name+"', null, __i__); return false");create.pages($("forum_pages2"),t,this.topic.page,"forum.load_forum_post('"+this.topic.id+"', '"+this.topic.name+"', null, __i__); return false");if(k.length==0){var m=create.div({text:"Pas de posts sur cette page."});$("content_forum").appendChild(m)}if(authentification.isconnected){var o="Surveiller le topic";if(this.topic.watched!=0){o="Arrêter de surveiller le topic"}var p=create.div();p.style.position="relative";p.style.left="470px";p.style.width="250px";p.style.textAlign="right";var x=create.a({id:"watched_link",text:o,title:"Envoi de mail activé lorsqu'une réponse est postée.",onclick:new Function("forum.watch_topic('"+this.topic.id+"'); return false")});p.appendChild(x);$("content_forum").appendChild(p)}for(var u=0;u<k.length;++u){var m=create.table({classname:"post_forum"});var b=create.tbody();var d=create.tr();var e=create.td({classname:"post_avatar"});var h=create.a({classname:"post_author",text:k[u][2],onclick:new Function("mywindow.load_window({page_name:'ajax-profil.html', param:'action=summary&id="+k[u][3]+"', length:350,height:250, title:'"+k[u][2]+"'}); return false;")});var v="public/img/dragon.gif";if(k[u][5]!=null){v="public/img/avatar/"+k[u][3]+k[u][5]}var c=create.img({text:k[u][2],onclick:new Function("mywindow.load_window({page_name:'ajax-profil.html', param:'action=summary&id="+k[u][3]+"', length:350,height:250, title:'"+k[u][2]+"'}); return false;"),src:v,height:"80",width:"80"});c.width=80;c.height=80;e.appendChild(h);e.appendChild(c);var q=create.td({classname:"post_message"});var w=create.div({text:k[u][4],classname:"post_date"});var j=create.div({id:"post_text"+u,classname:"post_text",text:k[u][1]});q.appendChild(w);q.appendChild(j);if(k[u][3]==authentification.id_user){var n=create.div({id:"div_moderation"+u,classname:"div_moderation"});var r=create.a({text:"Editer ",img:"public/img/forum_edit.png",onclick:new Function("forum.load_edit('"+u+"','"+k[u][0]+"'); return false")});var l=create.a({text:"Supprimer",img:"public/img/forum_delete.png",onclick:new Function("forum.delete_post('"+k[u][0]+"'); return false")});n.appendChild(r);n.appendChild(l);q.appendChild(n)}d.appendChild(e);d.appendChild(q);b.appendChild(d);m.appendChild(b);$("content_forum").appendChild(m)}this.settingup_form(false);if(y){scrollToElement($("form_forum"))}},load_forum_post:function(f,a,c,e,b){if(f==null){load_forum_topic(this.forum.id,this.forum.name);return}if(e==null||e==undefined){e=1}this.topic.id=f;this.topic.name=a;this.topic.page=e;this.topic.watched=0;if(!c){dhtmlHistory.add("section:forum_post",this.topic)}this.clear("content_forum",true);this.h_name_forum_name(this.topic.name);var d=this;this.ajax_request("json-forum.html",{method:"get",parameters:{id_topic:escape(f),page:escape(e),action:"posts"},onSuccess:function(h){var g=validateJSON(h.responseText);d.settingup_forum_post(g,b)}})},settingup_form:function(c){var f=this;if($("form_forum").getElementsByTagName("form").length==1){return}var a=create.form({id:"forum_form",action:"carte-forum.html",onsubmit:new Function("forum.send($('forum_form')); return false")});if(authentification.isconnected){var j=c?"add_topic":"add_post";var b=create.input({type:"hidden",name:"action",value:j});a.appendChild(b);var n=c?"Créer un topic :":"Poster une réponse :";var m=create.h({text:n,lvl:"1"});a.appendChild(m);var l=create.textarea({name:"text",text:"Votre message",cols:80,rows:10});l.onfocus=function(){if(this.value=="Votre message"){this.value=""}};l.onblur=function(){if(this.value==""){this.value="Votre message"}};var e=create.input({type:"submit",value:"Envoyer"});e.style.display="block";if(c){var p=create.input({name:"add_id_forum",type:"hidden",value:this.forum.id});var g=create.input({name:"title",type:"text",value:"Titre"});g.style.display="block";a.appendChild(p);a.appendChild(g)}else{var k=create.input({name:"add_id_topic",type:"hidden",value:this.topic.id});var h=create.div();var o=create.label({text:"Surveiller les réponses sur le topic",fore:"watch_checkbox"});var d=create.input({type:"checkbox",name:"is_watched",id:"watch_checkbox",checked:f.topic.watched!=0});h.appendChild(d);h.appendChild(o);a.appendChild(h);a.appendChild(k)}a.appendChild(l);a.appendChild(e)}else{var l=create.p({text:"Tu dois être identifié pour poster un message."});a.appendChild(l)}$("form_forum").appendChild(a)},send:function(b){var a=this;this.ajax_request("json-forum.html",{method:"post",parameters:$(b).serialize(true),onSuccess:function(e){var d=validateJSON(e.responseText);if(b.text!=null&&b.text!=undefined){$(b.text).value="Votre message"}alert_message(d[1]);if(d[0]!=-1){a.topic.id=d[0];a.topic.name=b.title.value;forum.clear();forum.settingup_form(false);forum.load_forum_post(a.topic.id,a.topic.name)}else{var c=Math.ceil(parseInt(d[2])/15);forum.load_forum_post(a.topic.id,a.topic.name,false,c,true)}}})},h_name_forum_name:function(a){a=a?a:"Liste des Forums";var c=$("h_name_forum");while(c.childNodes.length>0){c.removeChild(c.firstChild)}var b=null;if(this.category.id==""){b=create.a({text:a,onclick:new Function("forum.load_forum_cat(); return false")});$("h_name_forum").appendChild(b)}else{b=create.a({text:this.category.name,onclick:new Function("forum.load_forum_forum('"+this.category.id+"', '"+this.category.name+"'); return false")});$("h_name_forum").appendChild(b)}if(this.forum.id!=""){b=create.a({text:this.forum.name,onclick:new Function("forum.load_forum_topic('"+this.forum.id+"', '"+this.forum.name+"'); return false")});$("h_name_forum").appendChild(create.textnode({text:" >> "}));$("h_name_forum").appendChild(b)}if(this.topic.id!=""){b=create.a({text:this.topic.name,onclick:new Function("forum.load_forum_post('"+this.topic.id+"', '"+this.topic.name+"'); return false")});$("h_name_forum").appendChild(create.textnode({text:" >> "}));$("h_name_forum").appendChild(b)}},load_edit:function(e,c){var a=$("post_text"+e);var b=create.textarea({text:a.innerHTML.replace(/(<BR>)|(<BR\/>)|(<br>)/g,"\n"),cols:70,rows:8});b.style.display="block";a.innerHTML="";var f=create.input({type:"button",value:"Annuler",onclick:new Function("forum.unload_edit("+e+");")});var d=create.input({type:"button",value:"Valider",onclick:new Function("forum.send_edit('"+e+"','"+c+"');")});a.appendChild(b);a.appendChild(f);a.appendChild(d);$("div_moderation"+e).hide()},unload_edit:function(c){var a=$("post_text"+c);var b=a.descendants();a.innerHTML=$(b[0]).getValue().replace(/\n/g,"<BR/>");$("div_moderation"+c).show()},send_edit:function(c,b){var d=this;var a=$("post_text"+c).descendants();this.ajax_request("json-forum.html",{method:"post",parameters:{edit_post:b,message:$(a[0]).getValue(),action:"edit_post"},onSuccess:function(f){var e=validateJSON(f.responseText);d.unload_edit(c)}})},delete_post:function(a){var b=this;this.ajax_request("json-forum.html",{method:"get",parameters:{delete_post:a,action:"delete_post"},onSuccess:function(d){var c=validateJSON(d.responseText);alert_message(c);forum.load_forum_post(b.topic.id,b.topic.name,false,b.topic.page)}})},watch_topic:function(b){var a=this;this.topic.watched=!(this.topic.watched);if(this.topic.watched){$("watched_link").update("Arrêter de surveiller le topic")}else{$("watched_link").update("Surveiller le topic")}$("watch_checkbox").checked=this.topic.watched;this.ajax_request("json-forum.html",{method:"get",parameters:{id_topic:b,action:"watch_topic",to_watch:a.topic.watched},onSuccess:function(d){var c=validateJSON(d.responseText)}})}});forum=new Forum();
