/*
 *  AdvancedAJAX 2.0 RC2
 *  (c) 2006 Łukasz Lach
 *  mail: anakin@php5.pl
 *  www:  http://advajax.anakin.us/
 *        http://anakin.us/
 * Licensed under Creative Commons GNU Lesser General Public License
 * http://creativecommons.org/licenses/LGPL/2.1/
 */
 
/*  Prototype JavaScript framework, version 1.5.0
 *  (c) 2005-2007 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://prototype.conio.net/
 *
/*--------------------------------------------------------------------------*/

// script.aculo.us scriptaculous.js v1.7.0, Fri Jan 19 19:16:36 CET 2007
// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// 
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// For details, see the script.aculo.us web site: http://script.aculo.us/

// Copyright (c) 2006 SÃ©bastien Gruhier (http://xilinus.com, http://itseb.com)
// 
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// VERSION 0.98

var Prototype={Version:'1.6.0.2',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,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement('div').__proto__&&document.createElement('div').__proto__!==document.createElement('form').__proto__},ScriptFragment:'<script[^>]*>([\\S\\s]*?)<\/script>',JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(x){return x}};if(Prototype.Browser.MobileSafari)Prototype.BrowserFeatures.SpecificElementExtensions=false;var Class={create:function(){var a=null,properties=$A(arguments);if(Object.isFunction(properties[0]))a=properties.shift();function klass(){this.initialize.apply(this,arguments)}Object.extend(klass,Class.Methods);klass.superclass=a;klass.subclasses=[];if(a){var b=function(){};b.prototype=a.prototype;klass.prototype=new b;a.subclasses.push(klass)}for(var i=0;i<properties.length;i++)klass.addMethods(properties[i]);if(!klass.prototype.initialize)klass.prototype.initialize=Prototype.emptyFunction;klass.prototype.constructor=klass;return klass}};Class.Methods={addMethods:function(a){var b=this.superclass&&this.superclass.prototype;var c=Object.keys(a);if(!Object.keys({toString:true}).length)c.push("toString","valueOf");for(var i=0,length=c.length;i<length;i++){var d=c[i],value=a[d];if(b&&Object.isFunction(value)&&value.argumentNames().first()=="$super"){var e=value,value=Object.extend((function(m){return function(){return b[m].apply(this,arguments)}})(d).wrap(e),{valueOf:function(){return e},toString:function(){return e.toString()}})}this.prototype[d]=value}return this}};var Abstract={};Object.extend=function(a,b){for(var c in b)a[c]=b[c];return a};Object.extend(Object,{inspect:function(a){try{if(Object.isUndefined(a))return'undefined';if(a===null)return'null';return a.inspect?a.inspect():String(a)}catch(e){if(e instanceof RangeError)return'...';throw e;}},toJSON:function(a){var b=typeof a;switch(b){case'undefined':case'function':case'unknown':return;case'boolean':return a.toString()}if(a===null)return'null';if(a.toJSON)return a.toJSON();if(Object.isElement(a))return;var c=[];for(var d in a){var e=Object.toJSON(a[d]);if(!Object.isUndefined(e))c.push(d.toJSON()+': '+e)}return'{'+c.join(', ')+'}'},toQueryString:function(a){return $H(a).toQueryString()},toHTML:function(a){return a&&a.toHTML?a.toHTML():String.interpret(a)},keys:function(a){var b=[];for(var c in a)b.push(c);return b},values:function(a){var b=[];for(var c in a)b.push(a[c]);return b},clone:function(a){return Object.extend({},a)},isElement:function(a){return a&&a.nodeType==1},isArray:function(a){return a!=null&&typeof a=="object"&&'splice'in a&&'join'in a},isHash:function(a){return a instanceof Hash},isFunction:function(a){return typeof a=="function"},isString:function(a){return typeof a=="string"},isNumber:function(a){return typeof a=="number"},isUndefined:function(a){return typeof a=="undefined"}});Object.extend(Function.prototype,{argumentNames:function(){var a=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");return a.length==1&&!a[0]?[]:a},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var a=this,args=$A(arguments),object=args.shift();return function(){return a.apply(object,args.concat($A(arguments)))}},bindAsEventListener:function(){var b=this,args=$A(arguments),object=args.shift();return function(a){return b.apply(object,[a||window.event].concat(args))}},curry:function(){if(!arguments.length)return this;var a=this,args=$A(arguments);return function(){return a.apply(this,args.concat($A(arguments)))}},delay:function(){var a=this,args=$A(arguments),timeout=args.shift()*1000;return window.setTimeout(function(){return a.apply(a,args)},timeout)},wrap:function(a){var b=this;return function(){return a.apply(this,[b.bind(this)].concat($A(arguments)))}},methodize:function(){if(this._methodized)return this._methodized;var a=this;return this._methodized=function(){return a.apply(null,[this].concat($A(arguments)))}}});Function.prototype.defer=Function.prototype.delay.curry(0.01);Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+'-'+(this.getUTCMonth()+1).toPaddedString(2)+'-'+this.getUTCDate().toPaddedString(2)+'T'+this.getUTCHours().toPaddedString(2)+':'+this.getUTCMinutes().toPaddedString(2)+':'+this.getUTCSeconds().toPaddedString(2)+'Z"'};var Try={these:function(){var a;for(var i=0,length=arguments.length;i<length;i++){var b=arguments[i];try{a=b();break}catch(e){}}return a}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1')};var PeriodicalExecuter=Class.create({initialize:function(a,b){this.callback=a;this.frequency=b;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer)return;clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute()}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(a,b){var c='',source=this,match;b=arguments.callee.prepareReplacement(b);while(source.length>0){if(match=source.match(a)){c+=source.slice(0,match.index);c+=String.interpret(b(match));source=source.slice(match.index+match[0].length)}else{c+=source,source=''}}return c},sub:function(b,c,d){c=this.gsub.prepareReplacement(c);d=Object.isUndefined(d)?1:d;return this.gsub(b,function(a){if(--d<0)return a[0];return c(a)})},scan:function(a,b){this.gsub(a,b);return String(this)},truncate:function(a,b){a=a||30;b=Object.isUndefined(b)?'...':b;return this.length>a?this.slice(0,a-b.length)+b:String(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 c=new RegExp(Prototype.ScriptFragment,'im');return(this.match(b)||[]).map(function(a){return(a.match(c)||['',''])[1]})},evalScripts:function(){return this.extractScripts().map(function(a){return eval(a)})},escapeHTML:function(){var a=arguments.callee;a.text.data=this;return a.div.innerHTML},unescapeHTML:function(){var c=new Element('div');c.innerHTML=this.stripTags();return c.childNodes[0]?(c.childNodes.length>1?$A(c.childNodes).inject('',function(a,b){return a+b.nodeValue}):c.childNodes[0].nodeValue):''},toQueryParams:function(e){var f=this.strip().match(/([^?#]*)(#.*)?$/);if(!f)return{};return f[1].split(e||'&').inject({},function(a,b){if((b=b.split('='))[0]){var c=decodeURIComponent(b.shift());var d=b.length>1?b.join('='):b[0];if(d!=undefined)d=decodeURIComponent(d);if(c in a){if(!Object.isArray(a[c]))a[c]=[a[c]];a[c].push(d)}else a[c]=d}return a})},toArray:function(){return this.split('')},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(a){return a<1?'':new Array(a+1).join(this)},camelize:function(){var a=this.split('-'),len=a.length;if(len==1)return a[0];var b=this.charAt(0)=='-'?a[0].charAt(0).toUpperCase()+a[0].substring(1):a[0];for(var i=1;i<len;i++)b+=a[i].charAt(0).toUpperCase()+a[i].substring(1);return b},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(c){var d=this.gsub(/[\x00-\x1f\\]/,function(a){var b=String.specialChar[a[0]];return b?b:'\\u00'+a[0].charCodeAt().toPaddedString(2,16)});if(c)return'"'+d.replace(/"/g,'\\"')+'"';return"'"+d.replace(/'/g,'\\\'')+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(a){return this.sub(a||Prototype.JSONFilter,'#{1}')},isJSON:function(){var a=this;if(a.blank())return false;a=this.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'');return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(a)},evalJSON:function(a){var b=this.unfilterJSON();try{if(!a||b.isJSON())return eval('('+b+')')}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 d=this.length-a.length;return d>=0&&this.lastIndexOf(a)===d},empty:function(){return this==''},blank:function(){return/^\s*$/.test(this)},interpolate:function(a,b){return new Template(this,b).evaluate(a)}});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(Object.isFunction(b))return b;var c=new Template(b);return function(a){return c.evaluate(a)}};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({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(f){if(Object.isFunction(f.toTemplateReplacements))f=f.toTemplateReplacements();return this.template.gsub(this.pattern,function(a){if(f==null)return'';var b=a[1]||'';if(b=='\\')return a[2];var c=f,expr=a[3];var d=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;a=d.exec(expr);if(a==null)return b;while(a!=null){var e=a[1].startsWith('[')?a[2].gsub('\\\\]',']'):a[1];c=c[e];if(null==c||''==a[3])break;expr=expr.substring('['==a[3]?a[1].length:a[0].length);a=d.exec(expr)}return b+String.interpret(c)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(b,c){var d=0;b=b.bind(c);try{this._each(function(a){b(a,d++)})}catch(e){if(e!=$break)throw e;}return this},eachSlice:function(a,b,c){b=b?b.bind(c):Prototype.K;var d=-a,slices=[],array=this.toArray();while((d+=a)<array.length)slices.push(array.slice(d,d+a));return slices.collect(b,c)},all:function(c,d){c=c?c.bind(d):Prototype.K;var e=true;this.each(function(a,b){e=e&&!!c(a,b);if(!e)throw $break;});return e},any:function(c,d){c=c?c.bind(d):Prototype.K;var e=false;this.each(function(a,b){if(e=!!c(a,b))throw $break;});return e},collect:function(c,d){c=c?c.bind(d):Prototype.K;var e=[];this.each(function(a,b){e.push(c(a,b))});return e},detect:function(c,d){c=c.bind(d);var e;this.each(function(a,b){if(c(a,b)){e=a;throw $break;}});return e},findAll:function(c,d){c=c.bind(d);var e=[];this.each(function(a,b){if(c(a,b))e.push(a)});return e},grep:function(c,d,e){d=d?d.bind(e):Prototype.K;var f=[];if(Object.isString(c))c=new RegExp(c);this.each(function(a,b){if(c.match(a))f.push(d(a,b))});return f},include:function(b){if(Object.isFunction(this.indexOf))if(this.indexOf(b)!=-1)return true;var c=false;this.each(function(a){if(a==b){c=true;throw $break;}});return c},inGroupsOf:function(b,c){c=Object.isUndefined(c)?null:c;return this.eachSlice(b,function(a){while(a.length<b)a.push(c);return a})},inject:function(c,d,e){d=d.bind(e);this.each(function(a,b){c=d(c,a,b)});return c},invoke:function(b){var c=$A(arguments).slice(1);return this.map(function(a){return a[b].apply(a,c)})},max:function(c,d){c=c?c.bind(d):Prototype.K;var e;this.each(function(a,b){a=c(a,b);if(e==null||a>=e)e=a});return e},min:function(c,d){c=c?c.bind(d):Prototype.K;var e;this.each(function(a,b){a=c(a,b);if(e==null||a<e)e=a});return e},partition:function(c,d){c=c?c.bind(d):Prototype.K;var e=[],falses=[];this.each(function(a,b){(c(a,b)?e:falses).push(a)});return[e,falses]},pluck:function(b){var c=[];this.each(function(a){c.push(a[b])});return c},reject:function(c,d){c=c.bind(d);var e=[];this.each(function(a,b){if(!c(a,b))e.push(a)});return e},sortBy:function(e,f){e=e.bind(f);return this.map(function(a,b){return{value:a,criteria:e(a,b)}}).sort(function(c,d){var a=c.criteria,b=d.criteria;return a<b?-1:a>b?1:0}).pluck('value')},toArray:function(){return this.map()},zip:function(){var c=Prototype.K,args=$A(arguments);if(Object.isFunction(args.last()))c=args.pop();var d=[this].concat(args).map($A);return this.map(function(a,b){return c(d.pluck(b))})},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,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});function $A(a){if(!a)return[];if(a.toArray)return a.toArray();var b=a.length||0,results=new Array(b);while(b--)results[b]=a[b];return results}if(Prototype.Browser.WebKit){$A=function(a){if(!a)return[];if(!(Object.isFunction(a)&&a=='[object NodeList]')&&a.toArray)return a.toArray();var b=a.length||0,results=new Array(b);while(b--)results[b]=a[b];return results}}Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(a){for(var i=0,length=this.length;i<length;i++)a(this[i])},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(a,b){return a.concat(Object.isArray(b)?b.flatten():[b])})},without:function(){var b=$A(arguments);return this.select(function(a){return!b.include(a)})},reverse:function(a){return(a!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(d){return this.inject([],function(a,b,c){if(0==c||(d?a.last()!=b:!a.include(b)))a.push(b);return a})},intersect:function(c){return this.uniq().findAll(function(b){return c.detect(function(a){return b===a})})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']'},toJSON:function(){var c=[];this.each(function(a){var b=Object.toJSON(a);if(!Object.isUndefined(b))c.push(b)});return'['+c.join(', ')+']'}});if(Object.isFunction(Array.prototype.forEach))Array.prototype._each=Array.prototype.forEach;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a,i){i||(i=0);var b=this.length;if(i<0)i=b+i;for(;i<b;i++)if(this[i]===a)return i;return-1};if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(a,i){i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;var n=this.slice(0,i).reverse().indexOf(a);return(n<0)?n:i-n-1};Array.prototype.toArray=Array.prototype.clone;function $w(a){if(!Object.isString(a))return[];a=a.strip();return a?a.split(/\s+/):[]}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var a=[];for(var i=0,length=this.length;i<length;i++)a.push(this[i]);for(var i=0,length=arguments.length;i<length;i++){if(Object.isArray(arguments[i])){for(var j=0,arrayLength=arguments[i].length;j<arrayLength;j++)a.push(arguments[i][j])}else{a.push(arguments[i])}}return a}}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(a,b){var c=this.toString(b||10);return'0'.times(a-c.length)+c},toJSON:function(){return isFinite(this)?this.toString():'null'}});$w('abs round ceil floor').each(function(a){Number.prototype[a]=Math[a].methodize()});function $H(a){return new Hash(a)};var Hash=Class.create(Enumerable,(function(){function toQueryPair(a,b){if(Object.isUndefined(b))return a;return a+'='+encodeURIComponent(String.interpret(b))}return{initialize:function(a){this._object=Object.isHash(a)?a.toObject():Object.clone(a)},_each:function(a){for(var b in this._object){var c=this._object[b],pair=[b,c];pair.key=b;pair.value=c;a(pair)}},set:function(a,b){return this._object[a]=b},get:function(a){return this._object[a]},unset:function(a){var b=this._object[a];delete this._object[a];return b},toObject:function(){return Object.clone(this._object)},keys:function(){return this.pluck('key')},values:function(){return this.pluck('value')},index:function(b){var c=this.detect(function(a){return a.value===b});return c&&c.key},merge:function(a){return this.clone().update(a)},update:function(c){return new Hash(c).inject(this,function(a,b){a.set(b.key,b.value);return a})},toQueryString:function(){return this.map(function(a){var b=encodeURIComponent(a.key),values=a.value;if(values&&typeof values=='object'){if(Object.isArray(values))return values.map(toQueryPair.curry(b)).join('&')}return toQueryPair(b,values)}).join('&')},inspect:function(){return'#<Hash:{'+this.map(function(a){return a.map(Object.inspect).join(': ')}).join(', ')+'}>'},toJSON:function(){return Object.toJSON(this.toObject())},clone:function(){return new Hash(this)}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(a,b,c){this.start=a;this.end=b;this.exclusive=c},_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(a,b,c){return new ObjectRange(a,b,c)};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(b,c,d,f){this.each(function(a){if(Object.isFunction(a[b])){try{a[b].apply(a,[c,d,f])}catch(e){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(a){this.options={method:'post',asynchronous:true,contentType:'application/x-www-form-urlencoded',encoding:'UTF-8',parameters:'',evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters))this.options.parameters=this.options.parameters.toQueryParams();else if(Object.isHash(this.options.parameters))this.options.parameters=this.options.parameters.toObject()}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,c){$super(c);this.transport=Ajax.getTransport();this.request(b)},request:function(a){this.url=a;this.method=this.options.method;var b=Object.clone(this.options.parameters);if(!['get','post'].include(this.method)){b['_method']=this.method;this.method='post'}this.parameters=b;if(b=Object.toQueryString(b)){if(this.method=='get')this.url+=(this.url.include('?')?'&':'?')+b;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))b+='&_='}try{var c=new Ajax.Response(this);if(this.options.onCreate)this.options.onCreate(c);Ajax.Responders.dispatch('onCreate',this,c);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous)this.respondToReadyState.bind(this).defer(1);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=='post'?(this.options.postBody||b):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType)this.onStateChange()}catch(e){this.dispatchException(e)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete))this.respondToReadyState(this.transport.readyState)},setRequestHeaders:function(){var b={'X-Requested-With':'XMLHttpRequest','X-Prototype-Version':Prototype.Version,'Accept':'text/javascript, text/html, application/xml, text/xml, */*'};if(this.method=='post'){b['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)b['Connection']='close'}if(typeof this.options.requestHeaders=='object'){var c=this.options.requestHeaders;if(Object.isFunction(c.push))for(var i=0,length=c.length;i<length;i+=2)b[c[i]]=c[i+1];else $H(c).each(function(a){b[a.key]=a.value})}for(var d in b)this.transport.setRequestHeader(d,b[d])},success:function(){var a=this.getStatus();return!a||(a>=200&&a<300)},getStatus:function(){try{return this.transport.status||0}catch(e){return 0}},respondToReadyState:function(a){var b=Ajax.Request.Events[a],response=new Ajax.Response(this);if(b=='Complete'){try{this._complete=true;(this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||Prototype.emptyFunction)(response,response.headerJSON)}catch(e){this.dispatchException(e)}var c=response.getHeader('Content-type');if(this.options.evalJS=='force'||(this.options.evalJS&&this.isSameOrigin()&&c&&c.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))this.evalResponse()}try{(this.options['on'+b]||Prototype.emptyFunction)(response,response.headerJSON);Ajax.Responders.dispatch('on'+b,this,response,response.headerJSON)}catch(e){this.dispatchException(e)}if(b=='Complete'){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var m=this.url.match(/^\s*https?:\/\/[^\/]*/);return!m||(m[0]=='#{protocol}//#{domain}#{port}'.interpolate({protocol:location.protocol,domain:document.domain,port:location.port?':'+location.port:''}))},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(e){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.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Response=Class.create({initialize:function(a){this.request=a;var b=this.transport=a.transport,readyState=this.readyState=b.readyState;if((readyState>2&&!Prototype.Browser.IE)||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(b.responseText);this.headerJSON=this._getHeaderJSON()}if(readyState==4){var c=b.responseXML;this.responseXML=Object.isUndefined(c)?null:c;this.responseJSON=this._getResponseJSON()}},status:0,statusText:'',getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||''}catch(e){return''}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(e){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader('X-JSON');if(!a)return null;a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(e){this.request.dispatchException(e)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||(a.evalJSON!='force'&&!(this.getHeader('Content-type')||'').include('application/json'))||this.responseText.blank())return null;try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(e){this.request.dispatchException(e)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,d,e,f){this.container={success:(d.success||d),failure:(d.failure||(d.success?null:d))};f=Object.clone(f);var g=f.onComplete;f.onComplete=(function(a,b){this.updateContent(a.responseText);if(Object.isFunction(g))g(a,b)}).bind(this);$super(e,f)},updateContent:function(a){var b=this.container[this.success()?'success':'failure'],options=this.options;if(!options.evalScripts)a=a.stripScripts();if(b=$(b)){if(options.insertion){if(Object.isString(options.insertion)){var c={};c[options.insertion]=a;b.insert(c)}else options.insertion(b,a)}else b.update(a)}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,b,c,d){$super(d);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=b;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=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(a){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++)elements.push($(arguments[i]));return elements}if(Object.isString(a))a=document.getElementById(a);return Element.extend(a)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(a,b){var c=[];var d=document.evaluate(a,$(b)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,length=d.snapshotLength;i<length;i++)c.push(Element.extend(d.snapshotItem(i)));return c}}if(!window.Node)var Node={};if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(){var d=this.Element;this.Element=function(a,b){b=b||{};a=a.toLowerCase();var c=Element.cache;if(Prototype.Browser.IE&&b.name){a='<'+a+' name="'+b.name+'">';delete b.name;return Element.writeAttribute(document.createElement(a),b)}if(!c[a])c[a]=Element.extend(document.createElement(a));return Element.writeAttribute(c[a].cloneNode(false),b)};Object.extend(this.Element,d||{})}).call(window);Element.cache={};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(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();if(Object.isElement(b))return a.update().insert(b);b=Object.toHTML(b);a.innerHTML=b.stripScripts();b.evalScripts.bind(b).defer();return a},replace:function(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();else if(!Object.isElement(b)){b=Object.toHTML(b);var c=a.ownerDocument.createRange();c.selectNode(a);b.evalScripts.bind(b).defer();b=c.createContextualFragment(b.stripScripts())}a.parentNode.replaceChild(b,a);return a},insert:function(a,b){a=$(a);if(Object.isString(b)||Object.isNumber(b)||Object.isElement(b)||(b&&(b.toElement||b.toHTML)))b={bottom:b};var c,insert,tagName,childNodes;for(var d in b){c=b[d];d=d.toLowerCase();insert=Element._insertionTranslations[d];if(c&&c.toElement)c=c.toElement();if(Object.isElement(c)){insert(a,c);continue}c=Object.toHTML(c);tagName=((d=='before'||d=='after')?a.parentNode:a).tagName.toUpperCase();childNodes=Element._getContentFromAnonymousElement(tagName,c.stripScripts());if(d=='top'||d=='after')childNodes.reverse();childNodes.each(insert.curry(a));c.evalScripts.bind(c).defer()}return a},wrap:function(a,b,c){a=$(a);if(Object.isElement(b))$(b).writeAttribute(c||{});else if(Object.isString(b))b=new Element(b,c);else b=new Element('div',b);if(a.parentNode)a.parentNode.replaceChild(b,a);b.appendChild(a);return b},inspect:function(d){d=$(d);var e='<'+d.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(a){var b=a.first(),attribute=a.last();var c=(d[b]||'').toString();if(c)e+=' '+attribute+'='+c.inspect(true)});return e+'>'},recursivelyCollect:function(a,b){a=$(a);var c=[];while(a=a[b])if(a.nodeType==1)c.push(Element.extend(a));return c},ancestors:function(a){return $(a).recursivelyCollect('parentNode')},descendants:function(a){return $(a).select("*")},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(a,b){if(Object.isString(b))b=new Selector(b);return b.match($(a))},up:function(a,b,c){a=$(a);if(arguments.length==1)return $(a.parentNode);var d=a.ancestors();return Object.isNumber(b)?d[b]:Selector.findElement(d,b,c)},down:function(a,b,c){a=$(a);if(arguments.length==1)return a.firstDescendant();return Object.isNumber(b)?a.descendants()[b]:a.select(b)[c||0]},previous:function(a,b,c){a=$(a);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(a));var d=a.previousSiblings();return Object.isNumber(b)?d[b]:Selector.findElement(d,b,c)},next:function(a,b,c){a=$(a);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(a));var d=a.nextSiblings();return Object.isNumber(b)?d[b]:Selector.findElement(d,b,c)},select:function(){var a=$A(arguments),element=$(a.shift());return Selector.findChildElements(element,a)},adjacent:function(){var a=$A(arguments),element=$(a.shift());return Selector.findChildElements(element.parentNode,a).without(element)},identify:function(a){a=$(a);var b=a.readAttribute('id'),self=arguments.callee;if(b)return b;do{b='anonymous_element_'+self.counter++}while($(b));a.writeAttribute('id',b);return b},readAttribute:function(a,b){a=$(a);if(Prototype.Browser.IE){var t=Element._attributeTranslations.read;if(t.values[b])return t.values[b](a,b);if(t.names[b])b=t.names[b];if(b.include(':')){return(!a.attributes||!a.attributes[b])?null:a.attributes[b].value}}return a.getAttribute(b)},writeAttribute:function(a,b,c){a=$(a);var d={},t=Element._attributeTranslations.write;if(typeof b=='object')d=b;else d[b]=Object.isUndefined(c)?true:c;for(var e in d){b=t.names[e]||e;c=d[e];if(t.values[e])b=t.values[e](a,c);if(c===false||c===null)a.removeAttribute(b);else if(c===true)a.setAttribute(b,b);else a.setAttribute(b,c)}return 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;return(c.length>0&&(c==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(c)))},addClassName:function(a,b){if(!(a=$(a)))return;if(!a.hasClassName(b))a.className+=(a.className?' ':'')+b;return a},removeClassName:function(a,b){if(!(a=$(a)))return;a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)"),' ').strip();return a},toggleClassName:function(a,b){if(!(a=$(a)))return;return a[a.hasClassName(b)?'removeClassName':'addClassName'](b)},cleanWhitespace:function(a){a=$(a);var b=a.firstChild;while(b){var c=b.nextSibling;if(b.nodeType==3&&!/\S/.test(b.nodeValue))a.removeChild(b);b=c}return a},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(b,c){b=$(b),c=$(c);var d=c;if(b.compareDocumentPosition)return(b.compareDocumentPosition(c)&8)===8;if(b.sourceIndex&&!Prototype.Browser.Opera){var e=b.sourceIndex,a=c.sourceIndex,nextAncestor=c.nextSibling;if(!nextAncestor){do{c=c.parentNode}while(!(nextAncestor=c.nextSibling)&&c.parentNode)}if(nextAncestor&&nextAncestor.sourceIndex)return(e>a&&e<nextAncestor.sourceIndex)}while(b=b.parentNode)if(b==d)return true;return false},scrollTo:function(a){a=$(a);var b=a.cumulativeOffset();window.scrollTo(b[0],b[1]);return a},getStyle:function(a,b){a=$(a);b=b=='float'?'cssFloat':b.camelize();var c=a.style[b];if(!c){var d=document.defaultView.getComputedStyle(a,null);c=d?d[b]:null}if(b=='opacity')return c?parseFloat(c):1.0;return c=='auto'?null:c},getOpacity:function(a){return $(a).getStyle('opacity')},setStyle:function(a,b){a=$(a);var c=a.style,match;if(Object.isString(b)){a.style.cssText+=';'+b;return b.include('opacity')?a.setOpacity(b.match(/opacity:\s*(\d?\.?\d*)/)[1]):a}for(var d in b)if(d=='opacity')a.setOpacity(b[d]);else c[(d=='float'||d=='cssFloat')?(Object.isUndefined(c.styleFloat)?'cssFloat':'styleFloat'):d]=b[d];return a},setOpacity:function(a,b){a=$(a);a.style.opacity=(b==1||b==='')?'':(b<0.00001)?0:b;return a},getDimensions:function(a){a=$(a);var b=$(a).getStyle('display');if(b!='none'&&b!=null)return{width:a.offsetWidth,height:a.offsetHeight};var c=a.style;var d=c.visibility;var e=c.position;var f=c.display;c.visibility='hidden';c.position='absolute';c.display='block';var g=a.clientWidth;var h=a.clientHeight;c.display=f;c.position=e;c.visibility=d;return{width:g,height:h}},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=Element.getStyle(a,'overflow')||'auto';if(a._overflow!=='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},cumulativeOffset:function(a){var b=0,valueL=0;do{b+=a.offsetTop||0;valueL+=a.offsetLeft||0;a=a.offsetParent}while(a);return Element._returnOffset(valueL,b)},positionedOffset:function(a){var b=0,valueL=0;do{b+=a.offsetTop||0;valueL+=a.offsetLeft||0;a=a.offsetParent;if(a){if(a.tagName=='BODY')break;var p=Element.getStyle(a,'position');if(p!=='static')break}}while(a);return Element._returnOffset(valueL,b)},absolutize:function(a){a=$(a);if(a.getStyle('position')=='absolute')return;var b=a.positionedOffset();var c=b[1];var d=b[0];var e=a.clientWidth;var f=a.clientHeight;a._originalLeft=d-parseFloat(a.style.left||0);a._originalTop=c-parseFloat(a.style.top||0);a._originalWidth=a.style.width;a._originalHeight=a.style.height;a.style.position='absolute';a.style.top=c+'px';a.style.left=d+'px';a.style.width=e+'px';a.style.height=f+'px';return a},relativize:function(a){a=$(a);if(a.getStyle('position')=='relative')return;a.style.position='relative';var b=parseFloat(a.style.top||0)-(a._originalTop||0);var c=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=b+'px';a.style.left=c+'px';a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a},cumulativeScrollOffset:function(a){var b=0,valueL=0;do{b+=a.scrollTop||0;valueL+=a.scrollLeft||0;a=a.parentNode}while(a);return Element._returnOffset(valueL,b)},getOffsetParent: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)},viewportOffset:function(a){var b=0,valueL=0;var c=a;do{b+=c.offsetTop||0;valueL+=c.offsetLeft||0;if(c.offsetParent==document.body&&Element.getStyle(c,'position')=='absolute')break}while(c=c.offsetParent);c=a;do{if(!Prototype.Browser.Opera||c.tagName=='BODY'){b-=c.scrollTop||0;valueL-=c.scrollLeft||0}}while(c=c.parentNode);return Element._returnOffset(valueL,b)},clonePosition:function(a,b){var c=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});b=$(b);var p=b.viewportOffset();a=$(a);var d=[0,0];var e=null;if(Element.getStyle(a,'position')=='absolute'){e=a.getOffsetParent();d=e.viewportOffset()}if(e==document.body){d[0]-=document.body.offsetLeft;d[1]-=document.body.offsetTop}if(c.setLeft)a.style.left=(p[0]-d[0]+c.offsetLeft)+'px';if(c.setTop)a.style.top=(p[1]-d[1]+c.offsetTop)+'px';if(c.setWidth)a.style.width=b.offsetWidth+'px';if(c.setHeight)a.style.height=b.offsetHeight+'px';return a}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:'class',htmlFor:'for'},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(d,e,f){switch(f){case'left':case'top':case'right':case'bottom':if(d(e,'position')==='static')return null;case'height':case'width':if(!Element.visible(e))return null;var g=parseInt(d(e,f),10);if(g!==e['offset'+f.capitalize()])return g+'px';var h;if(f==='height'){h=['border-top-width','padding-top','padding-bottom','border-bottom-width']}else{h=['border-left-width','padding-left','padding-right','border-right-width']}return h.inject(g,function(a,b){var c=d(e,b);return c===null?a:a-parseInt(c,10)})+'px';default:return d(e,f)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(a,b,c){if(c==='title')return b.title;return a(b,c)})}else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(a,b){b=$(b);var c=b.getStyle('position');if(c!=='static')return a(b);b.setStyle({position:'relative'});var d=a(b);b.setStyle({position:c});return d});$w('positionedOffset viewportOffset').each(function(f){Element.Methods[f]=Element.Methods[f].wrap(function(a,b){b=$(b);var c=b.getStyle('position');if(c!=='static')return a(b);var d=b.getOffsetParent();if(d&&d.getStyle('position')==='fixed')d.setStyle({zoom:1});b.setStyle({position:'relative'});var e=a(b);b.setStyle({position:c});return e})});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.0}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(b,c){function stripAlpha(a){return a.replace(/alpha\([^\)]*\)/gi,'')}b=$(b);var d=b.currentStyle;if((d&&!d.hasLayout)||(!d&&b.style.zoom=='normal'))b.style.zoom=1;var e=b.getStyle('filter'),style=b.style;if(c==1||c===''){(e=stripAlpha(e))?style.filter=e:style.removeAttribute('filter');return b}else if(c<0.00001)c=0;style.filter=stripAlpha(e)+'alpha(opacity='+(c*100)+')';return b};Element._attributeTranslations={read:{names:{'class':'className','for':'htmlFor'},values:{_getAttr:function(a,b){return a.getAttribute(b,2)},_getAttrNode:function(a,b){var c=a.getAttributeNode(b);return c?c.value:""},_getEv:function(a,b){b=a.getAttribute(b);return b?b.toString().slice(23,-2):null},_flag:function(a,b){return $(a).hasAttribute(b)?b:null},style:function(a){return a.style.cssText.toLowerCase()},title:function(a){return a.title}}}};Element._attributeTranslations.write={names:Object.extend({cellpadding:'cellPadding',cellspacing:'cellSpacing'},Element._attributeTranslations.read.names),values:{checked:function(a,b){a.checked=!!b},style:function(a,b){a.style.cssText=b?b:''}}};Element._attributeTranslations.has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex '+'encType maxLength readOnly longDesc').each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(v){Object.extend(v,{href:v._getAttr,src:v._getAttr,type:v._getAttr,action:v._getAttrNode,disabled:v._flag,checked:v._flag,readonly:v._flag,multiple:v._flag,onload:v._getEv,onunload:v._getEv,onclick:v._getEv,ondblclick:v._getEv,onmousedown:v._getEv,onmouseup:v._getEv,onmouseover:v._getEv,onmousemove:v._getEv,onmouseout:v._getEv,onfocus:v._getEv,onblur:v._getEv,onkeypress:v._getEv,onkeydown:v._getEv,onkeyup:v._getEv,onsubmit:v._getEv,onreset:v._getEv,onselect:v._getEv,onchange:v._getEv})})(Element._attributeTranslations.read.values)}else if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1)?0.999999:(b==='')?'':(b<0.00001)?0:b;return a}}else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1||b==='')?'':(b<0.00001)?0:b;if(b==1)if(a.tagName=='IMG'&&a.width){a.width++;a.width--}else try{var n=document.createTextNode(' ');a.appendChild(n);a.removeChild(n)}catch(e){}return a};Element.Methods.cumulativeOffset=function(a){var b=0,valueL=0;do{b+=a.offsetTop||0;valueL+=a.offsetLeft||0;if(a.offsetParent==document.body)if(Element.getStyle(a,'position')=='absolute')break;a=a.offsetParent}while(a);return Element._returnOffset(valueL,b)}}if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(b,c){b=$(b);if(c&&c.toElement)c=c.toElement();if(Object.isElement(c))return b.update().insert(c);c=Object.toHTML(c);var d=b.tagName.toUpperCase();if(d in Element._insertionTranslations.tags){$A(b.childNodes).each(function(a){b.removeChild(a)});Element._getContentFromAnonymousElement(d,c.stripScripts()).each(function(a){b.appendChild(a)})}else b.innerHTML=c.stripScripts();c.evalScripts.bind(c).defer();return b}}if('outerHTML'in document.createElement('div')){Element.Methods.replace=function(b,c){b=$(b);if(c&&c.toElement)c=c.toElement();if(Object.isElement(c)){b.parentNode.replaceChild(c,b);return b}c=Object.toHTML(c);var d=b.parentNode,tagName=d.tagName.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var e=b.next();var f=Element._getContentFromAnonymousElement(tagName,c.stripScripts());d.removeChild(b);if(e)f.each(function(a){d.insertBefore(a,e)});else f.each(function(a){d.appendChild(a)})}else b.outerHTML=c.stripScripts();c.evalScripts.bind(c).defer();return b}}Element._returnOffset=function(l,t){var a=[l,t];a.left=l;a.top=t;return a};Element._getContentFromAnonymousElement=function(a,b){var c=new Element('div'),t=Element._insertionTranslations.tags[a];if(t){c.innerHTML=t[0]+b+t[1];t[2].times(function(){c=c.firstChild})}else c.innerHTML=b;return $A(c.childNodes)};Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)},top:function(a,b){a.insertBefore(b,a.firstChild)},bottom:function(a,b){a.appendChild(b)},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},tags:{TABLE:['<table>','</table>',1],TBODY:['<table><tbody>','</tbody></table>',2],TR:['<table><tbody><tr>','</tr></tbody></table>',3],TD:['<table><tbody><tr><td>','</td></tr></tbody></table>',4],SELECT:['<select>','</select>',1]}};(function(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})}).call(Element._insertionTranslations);Element.Methods.Simulated={hasAttribute:function(a,b){b=Element._attributeTranslations.has[b]||b;var c=$(a).getAttributeNode(b);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.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions)return Prototype.K;var c={},ByTag=Element.Methods.ByTag;var d=Object.extend(function(a){if(!a||a._extendedByPrototype||a.nodeType!=1||a==window)return a;var b=Object.clone(c),tagName=a.tagName,property,value;if(ByTag[tagName])Object.extend(b,ByTag[tagName]);for(property in b){value=b[property];if(Object.isFunction(value)&&!(property in a))a[property]=value.methodize()}a._extendedByPrototype=Prototype.emptyFunction;return a},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(c,Element.Methods);Object.extend(c,Element.Methods.Simulated)}}});d.refresh();return d})();Element.hasAttribute=function(a,b){if(a.hasAttribute)return a.hasAttribute(b);return Element.Methods.Simulated.hasAttribute(a,b)};Element.addMethods=function(f){var F=Prototype.BrowserFeatures,T=Element.Methods.ByTag;if(!f){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 g=f;f=arguments[1]}if(!g)Object.extend(Element.Methods,f||{});else{if(Object.isArray(g))g.each(extend);else extend(g)}function extend(a){a=a.toUpperCase();if(!Element.Methods.ByTag[a])Element.Methods.ByTag[a]={};Object.extend(Element.Methods.ByTag[a],f)}function copy(a,b,c){c=c||false;for(var d in a){var e=a[d];if(!Object.isFunction(e))continue;if(!c||!(d in b))b[d]=e.methodize()}}function findDOMClass(a){var b;var c={"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(c[a])b='HTML'+c[a]+'Element';if(window[b])return window[b];b='HTML'+a+'Element';if(window[b])return window[b];b='HTML'+a.capitalize()+'Element';if(window[b])return window[b];window[b]={};window[b].prototype=document.createElement(a).__proto__;return window[b]}if(F.ElementExtensions){copy(Element.Methods,HTMLElement.prototype);copy(Element.Methods.Simulated,HTMLElement.prototype,true)}if(F.SpecificElementExtensions){for(var h in Element.Methods.ByTag){var i=findDOMClass(h);if(Object.isUndefined(i))continue;copy(T[h],i.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={}};document.viewport={getDimensions:function(){var a={};var B=Prototype.Browser;$w('width height').each(function(d){var D=d.capitalize();a[d]=(B.WebKit&&!document.evaluate)?self['inner'+D]:(B.Opera)?document.body['client'+D]:document.documentElement['client'+D]});return a},getWidth:function(){return this.getDimensions().width},getHeight:function(){return this.getDimensions().height},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};var Selector=Class.create({initialize:function(a){this.expression=a.strip();this.compileMatcher()},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath)return false;var e=this.expression;if(Prototype.Browser.WebKit&&(e.include("-of-type")||e.include(":empty")))return false;if((/(\[[\w-]*?:|:checked)/).test(this.expression))return false;return true},compileMatcher:function(){if(this.shouldUseXPath())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(Object.isFunction(c[i])?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 e=this.expression,ps=Selector.patterns,x=Selector.xpath,le,m;if(Selector._cache[e]){this.xpath=Selector._cache[e];return}this.matcher=['.//*'];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){if(m=e.match(ps[i])){this.matcher.push(Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m));e=e.replace(m[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){this.tokens=[];var e=this.expression,ps=Selector.patterns,as=Selector.assertions;var b,p,m;while(e&&b!==e&&(/\S/).test(e)){b=e;for(var i in ps){p=ps[i];if(m=e.match(p)){if(as[i]){this.tokens.push([i,Object.clone(m)]);e=e.replace(m[0],'')}else{return this.findElements(document).include(a)}}}}var c=true,name,matches;for(var i=0,token;token=this.tokens[i];i++){name=token[0],matches=token[1];if(!Selector.assertions[name](a,matches)){c=false;break}}return c},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(m){if(m[1]=='*')return'';return"[local-name()='"+m[1].toLowerCase()+"' or local-name()='"+m[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(m){m[1]=m[1].toLowerCase();return new Template("[@#{1}]").evaluate(m)},attr:function(m){m[1]=m[1].toLowerCase();m[3]=m[5]||m[6];return new Template(Selector.xpath.operators[m[2]]).evaluate(m)},pseudo:function(m){var h=Selector.xpath.pseudos[m[1]];if(!h)return'';if(Object.isFunction(h))return h(m);return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m)},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(m){var e=m[6],p=Selector.patterns,x=Selector.xpath,le,v;var a=[];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in p){if(m=e.match(p[i])){v=Object.isFunction(x[i])?x[i](m):new Template(x[i]).evaluate(m);a.push("("+v.substring(1,v.length-1)+")");e=e.replace(m[0],'');break}}}return"[not("+a.join(" and ")+")]"},'nth-child':function(m){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",m)},'nth-last-child':function(m){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",m)},'nth-of-type':function(m){return Selector.xpath.pseudos.nth("position() ",m)},'nth-last-of-type':function(m){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",m)},'first-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-of-type'](m)},'last-of-type':function(m){m[6]="1";return Selector.xpath.pseudos['nth-last-of-type'](m)},'only-of-type':function(m){var p=Selector.xpath.pseudos;return p['first-of-type'](m)+p['last-of-type'](m)},nth:function(c,m){var d,formula=m[6],predicate;if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';if(d=formula.match(/^(\d+)$/))return'['+c+"= "+d[1]+']';if(d=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(d[1]=="-")d[1]=-1;var a=d[1]?Number(d[1]):1;var b=d[2]?Number(d[2]):0;predicate="[((#{fragment} - #{b}) mod #{a} = 0) and "+"((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(predicate).evaluate({fragment:c,a:a,b:b})}}}},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); c = false;',attr:function(m){m[3]=(m[5]||m[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m)},pseudo:function(m){if(m[6])m[6]=m[6].replace(/"/g,'\\"');return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m)},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]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(a,b){return b[1].toUpperCase()==a.tagName.toUpperCase()},className:function(a,b){return Element.hasClassName(a,b[1])},id:function(a,b){return a.id===b[1]},attrPresence:function(a,b){return Element.hasAttribute(a,b[1])},attr:function(a,b){var c=Element.readAttribute(a,b[1]);return c&&Selector.operators[b[2]](c,b[5]||b[6])}},handlers:{concat:function(a,b){for(var i=0,node;node=b[i];i++)a.push(node);return a},mark:function(a){var b=Prototype.emptyFunction;for(var i=0,node;node=a[i];i++)node._countedByPrototype=b;return a},unmark:function(a){for(var i=0,node;node=a[i];i++)node._countedByPrototype=undefined;return a},index:function(a,b,c){a._countedByPrototype=Prototype.emptyFunction;if(b){for(var d=a.childNodes,i=d.length-1,j=1;i>=0;i--){var e=d[i];if(e.nodeType==1&&(!c||e._countedByPrototype))e.nodeIndex=j++}}else{for(var i=0,j=1,d=a.childNodes;e=d[i];i++)if(e.nodeType==1&&(!c||e._countedByPrototype))e.nodeIndex=j++}},unique:function(a){if(a.length==0)return a;var b=[],n;for(var i=0,l=a.length;i<l;i++)if(!(n=a[i])._countedByPrototype){n._countedByPrototype=Prototype.emptyFunction;b.push(Element.extend(n))}return Selector.handlers.unmark(b)},descendant:function(a){var h=Selector.handlers;for(var i=0,results=[],node;node=a[i];i++)h.concat(results,node.getElementsByTagName('*'));return results},child:function(a){var h=Selector.handlers;for(var i=0,results=[],node;node=a[i];i++){for(var j=0,child;child=node.childNodes[j];j++)if(child.nodeType==1&&child.tagName!='!')results.push(child)}return results},adjacent:function(a){for(var i=0,results=[],node;node=a[i];i++){var b=this.nextElementSibling(node);if(b)results.push(b)}return results},laterSibling:function(a){var h=Selector.handlers;for(var i=0,results=[],node;node=a[i];i++)h.concat(results,Element.nextSiblings(node));return results},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(a,b,c,d){var e=c.toUpperCase();var f=[],h=Selector.handlers;if(a){if(d){if(d=="descendant"){for(var i=0,node;node=a[i];i++)h.concat(f,node.getElementsByTagName(c));return f}else a=this[d](a);if(c=="*")return a}for(var i=0,node;node=a[i];i++)if(node.tagName.toUpperCase()===e)f.push(node);return f}else return b.getElementsByTagName(c)},id:function(a,b,c,d){var e=$(c),h=Selector.handlers;if(!e)return[];if(!a&&b==document)return[e];if(a){if(d){if(d=='child'){for(var i=0,node;node=a[i];i++)if(e.parentNode==node)return[e]}else if(d=='descendant'){for(var i=0,node;node=a[i];i++)if(Element.descendantOf(e,node))return[e]}else if(d=='adjacent'){for(var i=0,node;node=a[i];i++)if(Selector.handlers.previousElementSibling(e)==node)return[e]}else a=h[d](a)}for(var i=0,node;node=a[i];i++)if(node==e)return[e];return[]}return(e&&Element.descendantOf(e,b))?[e]:[]},className:function(a,b,c,d){if(a&&d)a=this[d](a);return Selector.handlers.byClassName(a,b,c)},byClassName:function(a,b,c){if(!a)a=Selector.handlers.descendant([b]);var d=' '+c+' ';for(var i=0,results=[],node,nodeClassName;node=a[i];i++){nodeClassName=node.className;if(nodeClassName.length==0)continue;if(nodeClassName==c||(' '+nodeClassName+' ').include(d))results.push(node)}return results},attrPresence:function(a,b,c,d){if(!a)a=b.getElementsByTagName("*");if(a&&d)a=this[d](a);var e=[];for(var i=0,node;node=a[i];i++)if(Element.hasAttribute(node,c))e.push(node);return e},attr:function(a,b,c,d,e,f){if(!a)a=b.getElementsByTagName("*");if(a&&f)a=this[f](a);var g=Selector.operators[e],results=[];for(var i=0,node;node=a[i];i++){var h=Element.readAttribute(node,c);if(h===null)continue;if(g(h,d))results.push(node)}return results},pseudo:function(a,b,c,d,e){if(a&&e)a=this[e](a);if(!a)a=d.getElementsByTagName("*");return Selector.pseudos[b](a,c,d)}},pseudos:{'first-child':function(a,b,c){for(var i=0,results=[],node;node=a[i];i++){if(Selector.handlers.previousElementSibling(node))continue;results.push(node)}return results},'last-child':function(a,b,c){for(var i=0,results=[],node;node=a[i];i++){if(Selector.handlers.nextElementSibling(node))continue;results.push(node)}return results},'only-child':function(a,b,c){var h=Selector.handlers;for(var i=0,results=[],node;node=a[i];i++)if(!h.previousElementSibling(node)&&!h.nextElementSibling(node))results.push(node);return results},'nth-child':function(a,b,c){return Selector.pseudos.nth(a,b,c)},'nth-last-child':function(a,b,c){return Selector.pseudos.nth(a,b,c,true)},'nth-of-type':function(a,b,c){return Selector.pseudos.nth(a,b,c,false,true)},'nth-last-of-type':function(a,b,c){return Selector.pseudos.nth(a,b,c,true,true)},'first-of-type':function(a,b,c){return Selector.pseudos.nth(a,"1",c,false,true)},'last-of-type':function(a,b,c){return Selector.pseudos.nth(a,"1",c,true,true)},'only-of-type':function(a,b,c){var p=Selector.pseudos;return p['last-of-type'](p['first-of-type'](a,b,c),b,c)},getIndices:function(a,b,d){if(a==0)return b>0?[b]:[];return $R(1,d).inject([],function(c,i){if(0==(i-b)%a&&(i-b)/a>=0)c.push(i);return c})},nth:function(c,d,e,f,g){if(c.length==0)return[];if(d=='even')d='2n+0';if(d=='odd')d='2n+1';var h=Selector.handlers,results=[],indexed=[],m;h.mark(c);for(var i=0,node;node=c[i];i++){if(!node.parentNode._countedByPrototype){h.index(node.parentNode,f,g);indexed.push(node.parentNode)}}if(d.match(/^\d+$/)){d=Number(d);for(var i=0,node;node=c[i];i++)if(node.nodeIndex==d)results.push(node)}else if(m=d.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(m[1]=="-")m[1]=-1;var a=m[1]?Number(m[1]):1;var b=m[2]?Number(m[2]):0;var k=Selector.pseudos.getIndices(a,b,c.length);for(var i=0,node,l=k.length;node=c[i];i++){for(var j=0;j<l;j++)if(node.nodeIndex==k[j])results.push(node)}}h.unmark(c);h.unmark(indexed);return results},'empty':function(a,b,c){for(var i=0,results=[],node;node=a[i];i++){if(node.tagName=='!'||(node.firstChild&&!node.innerHTML.match(/^\s*$/)))continue;results.push(node)}return results},'not':function(a,b,c){var h=Selector.handlers,selectorType,m;var d=new Selector(b).findElements(c);h.mark(d);for(var i=0,results=[],node;node=a[i];i++)if(!node._countedByPrototype)results.push(node);h.unmark(d);return results},'enabled':function(a,b,c){for(var i=0,results=[],node;node=a[i];i++)if(!node.disabled)results.push(node);return results},'disabled':function(a,b,c){for(var i=0,results=[],node;node=a[i];i++)if(node.disabled)results.push(node);return results},'checked':function(a,b,c){for(var i=0,results=[],node;node=a[i];i++)if(node.checked)results.push(node);return results}},operators:{'=':function(a,v){return a==v},'!=':function(a,v){return a!=v},'^=':function(a,v){return a.startsWith(v)},'$=':function(a,v){return a.endsWith(v)},'*=':function(a,v){return a.include(v)},'~=':function(a,v){return(' '+a+' ').include(' '+v+' ')},'|=':function(a,v){return('-'+a.toUpperCase()+'-').include('-'+v.toUpperCase()+'-')}},split:function(a){var b=[];a.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(m){b.push(m[1].strip())});return b},matchElements:function(a,b){var c=$$(b),h=Selector.handlers;h.mark(c);for(var i=0,results=[],element;element=a[i];i++)if(element._countedByPrototype)results.push(element);h.unmark(c);return results},findElement:function(a,b,c){if(Object.isNumber(b)){c=b;b=false}return Selector.matchElements(a,b||'*')[c||0]},findChildElements:function(a,b){b=Selector.split(b.join(','));var c=[],h=Selector.handlers;for(var i=0,l=b.length,selector;i<l;i++){selector=new Selector(b[i].strip());h.concat(c,selector.findElements(a))}return(l>1)?h.unique(c):c}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(a,b){for(var i=0,node;node=b[i];i++)if(node.tagName!=="!")a.push(node);return a},unmark:function(a){for(var i=0,node;node=a[i];i++)node.removeAttribute('_countedByPrototype');return a}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){$(a).reset();return a},serializeElements:function(c,d){if(typeof d!='object')d={hash:!!d};else if(Object.isUndefined(d.hash))d.hash=true;var e,value,submitted=false,submit=d.submit;var f=c.inject({},function(a,b){if(!b.disabled&&b.name){e=b.name;value=$(b).getValue();if(value!=null&&(b.type!='submit'||(!submitted&&submit!==false&&(!submit||e==submit)&&(submitted=true)))){if(e in a){if(!Object.isArray(a[e]))a[e]=[a[e]];a[e].push(value)}else a[e]=value}}return a});return d.hash?f:Object.toQueryString(f)}};Form.Methods={serialize:function(a,b){return Form.serializeElements(Form.getElements(a),b)},getElements:function(c){return $A($(c).getElementsByTagName('*')).inject([],function(a,b){if(Form.Element.Serializers[b.tagName.toLowerCase()])a.push(Element.extend(b));return a})},getInputs:function(a,b,c){a=$(a);var d=a.getElementsByTagName('input');if(!b&&!c)return $A(d).map(Element.extend);for(var i=0,matchingInputs=[],length=d.length;i<length;i++){var e=d[i];if((b&&e.type!=b)||(c&&e.name!=c))continue;matchingInputs.push(Element.extend(e))}return matchingInputs},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(b){var c=$(b).getElements().findAll(function(a){return'hidden'!=a.type&&!a.disabled});var d=c.findAll(function(a){return a.hasAttribute('tabIndex')&&a.tabIndex>=0}).sortBy(function(a){return a.tabIndex}).first();return d?d:c.find(function(a){return['input','select','textarea'].include(a.tagName.toLowerCase())})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(a,b){a=$(a),b=Object.clone(b||{});var c=b.parameters,action=a.readAttribute('action')||'';if(action.blank())action=window.location.href;b.parameters=a.serialize(true);if(c){if(Object.isString(c))c=c.toQueryParams();Object.extend(b.parameters,c)}if(a.hasAttribute('method')&&!b.method)b.method=a.method;return new Ajax.Request(action,b)}};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 Object.toQueryString(c)}}return''},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var c=a.tagName.toLowerCase();Form.Element.Serializers[c](a,b);return 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(e){}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,b){switch(a.type.toLowerCase()){case'checkbox':case'radio':return Form.Element.Serializers.inputSelector(a,b);default:return Form.Element.Serializers.textarea(a,b)}},inputSelector:function(a,b){if(Object.isUndefined(b))return a.checked?a.value:null;else a.checked=!!b},textarea:function(a,b){if(Object.isUndefined(b))return a.value;else a.value=b},select:function(a,b){if(Object.isUndefined(b))return this[a.type=='select-one'?'selectOne':'selectMany'](a);else{var c,value,single=!Object.isArray(b);for(var i=0,length=a.length;i<length;i++){c=a.options[i];value=this.optionValue(c);if(single){if(value==b){c.selected=true;return}}else c.selected=b.include(value)}}},selectOne:function(a){var b=a.selectedIndex;return b>=0?this.optionValue(a.options[b]):null},selectMany:function(a){var b,length=a.length;if(!length)return null;for(var i=0,b=[];i<length;i++){var c=a.options[i];if(c.selected)b.push(this.optionValue(c))}return b},optionValue:function(a){return Element.extend(a).hasAttribute('value')?a.value:a.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,b,c,d){$super(d,c);this.element=$(b);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({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,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(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});if(!window.Event)var Event={};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,KEY_INSERT:45,cache:{},relatedTarget:function(a){var b;switch(a.type){case'mouseover':b=a.fromElement;break;case'mouseout':b=a.toElement;break;default:return null}return Element.extend(b)}});Event.Methods=(function(){var e;if(Prototype.Browser.IE){var f={0:1,1:4,2:2};e=function(a,b){return a.button==f[b]}}else if(Prototype.Browser.WebKit){e=function(a,b){switch(b){case 0:return a.which==1&&!a.metaKey;case 1:return a.which==1&&a.metaKey;default:return false}}}else{e=function(a,b){return a.which?(a.which===b+1):(a.button===b)}}return{isLeftClick:function(a){return e(a,0)},isMiddleClick:function(a){return e(a,1)},isRightClick:function(a){return e(a,2)},element:function(a){var b=Event.extend(a).target;return Element.extend(b.nodeType==Node.TEXT_NODE?b.parentNode:b)},findElement:function(a,b){var c=Event.element(a);if(!b)return c;var d=[c].concat(c.ancestors());return Selector.findElement(d,b,0)},pointer:function(a){return{x:a.pageX||(a.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),y:a.pageY||(a.clientY+(document.documentElement.scrollTop||document.body.scrollTop))}},pointerX:function(a){return Event.pointer(a).x},pointerY:function(a){return Event.pointer(a).y},stop:function(a){Event.extend(a);a.preventDefault();a.stopPropagation();a.stopped=true}}})();Event.extend=(function(){var c=Object.keys(Event.Methods).inject({},function(m,a){m[a]=Event.Methods[a].methodize();return m});if(Prototype.Browser.IE){Object.extend(c,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(a){if(!a)return false;if(a._extendedByPrototype)return a;a._extendedByPrototype=Prototype.emptyFunction;var b=Event.pointer(a);Object.extend(a,{target:a.srcElement,relatedTarget:Event.relatedTarget(a),pageX:b.x,pageY:b.y});return Object.extend(a,c)}}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(Event.prototype,c);return Prototype.K}})();Object.extend(Event,(function(){var h=Event.cache;function getEventID(a){if(a._prototypeEventID)return a._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return a._prototypeEventID=[++arguments.callee.id]}function getDOMEventName(a){if(a&&a.include(':'))return"dataavailable";return a}function getCacheForID(a){return h[a]=h[a]||{}}function getWrappersForEventName(a,b){var c=getCacheForID(a);return c[b]=c[b]||[]}function createWrapper(b,d,e){var f=getEventID(b);var c=getWrappersForEventName(f,d);if(c.pluck("handler").include(e))return false;var g=function(a){if(!Event||!Event.extend||(a.eventName&&a.eventName!=d))return false;Event.extend(a);e.call(b,a)};g.handler=e;c.push(g);return g}function findWrapper(b,d,e){var c=getWrappersForEventName(b,d);return c.find(function(a){return a.handler==e})}function destroyWrapper(a,b,d){var c=getCacheForID(a);if(!c[b])return false;c[b]=c[b].without(findWrapper(a,b,d))}function destroyCache(){for(var a in h)for(var b in h[a])h[a][b]=null}if(window.attachEvent){window.attachEvent("onunload",destroyCache)}return{observe:function(a,b,c){a=$(a);var d=getDOMEventName(b);var e=createWrapper(a,b,c);if(!e)return a;if(a.addEventListener){a.addEventListener(d,e,false)}else{a.attachEvent("on"+d,e)}return a},stopObserving:function(b,c,d){b=$(b);var e=getEventID(b),name=getDOMEventName(c);if(!d&&c){getWrappersForEventName(e,c).each(function(a){b.stopObserving(c,a.handler)});return b}else if(!c){Object.keys(getCacheForID(e)).each(function(a){b.stopObserving(a)});return b}var f=findWrapper(e,c,d);if(!f)return b;if(b.removeEventListener){b.removeEventListener(name,f,false)}else{b.detachEvent("on"+name,f)}destroyWrapper(e,c,d);return b},fire:function(a,b,c){a=$(a);if(a==document&&document.createEvent&&!a.dispatchEvent)a=document.documentElement;var d;if(document.createEvent){d=document.createEvent("HTMLEvents");d.initEvent("dataavailable",true,true)}else{d=document.createEventObject();d.eventType="ondataavailable"}d.eventName=b;d.memo=c||{};if(document.createEvent){a.dispatchEvent(d)}else{a.fireEvent(d.eventType,d)}return Event.extend(d)}}})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize(),loaded:false});(function(){var a;function fireContentLoadedEvent(){if(document.loaded)return;if(a)window.clearInterval(a);document.fire("dom:loaded");document.loaded=true}if(document.addEventListener){if(Prototype.Browser.WebKit){a=window.setInterval(function(){if(/loaded|complete/.test(document.readyState))fireContentLoadedEvent()},0);Event.observe(window,"load",fireContentLoadedEvent)}else{document.addEventListener("DOMContentLoaded",fireContentLoadedEvent,false)}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;fireContentLoadedEvent()}}}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');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},within:function(a,x,y){if(this.includeScrollOffsets)return this.withinIncludingScrolloffsets(a,x,y);this.xcomp=x;this.ycomp=y;this.offset=Element.cumulativeOffset(a);return(y>=this.offset[1]&&y<this.offset[1]+a.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+a.offsetWidth)},withinIncludingScrolloffsets:function(a,x,y){var b=Element.cumulativeScrollOffset(a);this.xcomp=x+b[0]-this.deltaX;this.ycomp=y+b[1]-this.deltaY;this.offset=Element.cumulativeOffset(a);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+a.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+a.offsetWidth)},overlap:function(a,b){if(!a)return 0;if(a=='vertical')return((this.offset[1]+b.offsetHeight)-this.ycomp)/b.offsetHeight;if(a=='horizontal')return((this.offset[0]+b.offsetWidth)-this.xcomp)/b.offsetWidth},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(a,b,c){c=c||{};return Element.clonePosition(b,a,c)}};if(!document.getElementsByClassName)document.getElementsByClassName=function(f){function iter(a){return a.blank()?null:"[contains(concat(' ', @class, ' '), ' "+a+" ')]"}f.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(a,b){b=b.toString().strip();var c=/\s/.test(b)?$w(b).map(iter).join(''):iter(b);return c?document._getElementsByXPath('.//*'+c,a):[]}:function(b,c){c=c.toString().strip();var d=[],classNames=(/\s/.test(c)?$w(c):null);if(!classNames&&!c)return d;var e=$(b).getElementsByTagName('*');c=' '+c+' ';for(var i=0,child,cn;child=e[i];i++){if(child.className&&(cn=' '+child.className+' ')&&(cn.include(c)||(classNames&&classNames.all(function(a){return!a.toString().blank()&&cn.include(' '+a+' ')}))))d.push(Element.extend(child))}return d};return function(a,b){return $(b||document.body).getElementsByClassName(a)}}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(b){this.element.className.split(/\s+/).select(function(a){return a.length>0})._each(b)},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);Element.addMethods();
Object.extend(Event,{_domReady:function(){if(arguments.callee.done){return }arguments.callee.done=true;if(this._timer){clearInterval(this._timer)}this._readyCallbacks.each(function(A){A()});this._readyCallbacks=null},onDOMReady:function(f){if(!this._readyCallbacks){var domReady=this._domReady.bind(this);if(document.addEventListener){document.addEventListener("DOMContentLoaded",domReady,false);/*@cc_on @*//*@if (@_win32)
            document.onreadystatechange = function() {
                if (this.readyState == "complete") domReady(); 
            };
        /*@end @*/}if(/WebKit/i.test(navigator.userAgent)){this._timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){domReady()}},10)}Event.observe(window,"load",domReady);Event._readyCallbacks=[]}Event._readyCallbacks.push(f)}});var Window=Class.create();Window.keepMultiModalWindow=false;Window.prototype={initialize:function(A){this.hasEffectLib=String.prototype.parseColor!=null;this.options=Object.extend({className:"dialog",minWidth:100,minHeight:20,resizable:false,closable:true,minimizable:false,maximizable:false,draggable:false,userData:null,showEffect:Element.show,hideEffect:Element.hide,showEffectOptions:{},hideEffectOptions:{},effectOptions:null,parent:document.getElementsByTagName("body").item(0),title:"&nbsp;",url:null,onload:Prototype.emptyFunction,width:200,height:300,opacity:1,overflow:"auto",recenterAuto:true},arguments[1]||{});if(this.options.effectOptions){Object.extend(this.options.hideEffectOptions,this.options.effectOptions);Object.extend(this.options.showEffectOptions,this.options.effectOptions)}if(this.options.hideEffect==Element.hide){this.options.hideEffect=function(){Element.hide(this.element);if(this.destroyOnClose){this.destroy()}}.bind(this)}this.element=this._createWindow(A);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);if(this.options.recenterAuto){this.eventResize=this._recenter.bindAsEventListener(this)}this.bottombar=$(this.element.id+"_bottom");this.content=$(this.element.id+"_content");Event.observe(this.bottombar,"mousedown",this.eventMouseDown);Event.observe(this.content,"mousedown",this.eventMouseDownContent);Event.observe(window,"load",this.eventOnLoad);if(this.options.recenterAuto){Event.observe(window,"resize",this.eventResize);Event.observe(window,"scroll",this.eventResize)}if(this.options.draggable){this.bottombar.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(arguments[1].left!=null){this.element.setStyle({left:parseFloat(arguments[1].left)+"px"});this.useLeft=true}if(arguments[1].right!=null){this.element.setStyle({right:parseFloat(arguments[1].right)+"px"});this.useLeft=false}if(this.useLeft==null){this.element.setStyle({left:"0px"});this.useLeft=true}if(arguments[1].top!=null){this.element.setStyle({top:parseFloat(arguments[1].top)+"px"});this.useTop=true}if(arguments[1].bottom!=null){this.element.setStyle({bottom:parseFloat(arguments[1].bottom)+"px"});this.useTop=false}if(this.useTop==null){this.element.setStyle({top:"0px"});this.useTop=true}this.storedLocation=null;this.setOpacity(this.options.opacity);if(this.options.zIndex){this.setZIndex(this.options.zIndex)}this.destroyOnClose=false;this._getWindowBorderSize();this.width=this.options.width;this.height=this.options.height;this.visible=false;if(this.width&&this.height){this.setSize(this.options.width,this.options.height)}this.setTitle(this.options.title);Windows.register(this)},destroy:function(){Windows.notify("onDestroy",this);Event.stopObserving(this.bottombar,"mousedown",this.eventMouseDown);Event.stopObserving(this.content,"mousedown",this.eventMouseDownContent);Event.stopObserving(window,"load",this.eventOnLoad);if(this.options.recenterAuto){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(Node.ELEMENT_NODE==A.nodeType){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)},setDelegate:function(A){this.delegate=A},getDelegate:function(){return this.delegate},getContent:function(){return this.content},setContent:function(G,F,B){var A=$(G);if(null==A){throw"Unable to find element '"+G+"' in DOM"}this._oldParent=A.parentNode;var E=null;var D=null;if(F){E=Element.getDimensions(A)}if(B){D=Position.cumulativeOffset(A)}var C=this.getContent();C.appendChild(A);A.show();if(F){this.setSize(E.width,E.height)}if(B){this.setLocation(D[1]-this.heightN,D[0]-this.widthW)}},setAjaxContent:function(B,A,D,C){this.showFunction=D?"showCenter":"show";this.showModal=C||false;if(A==null){A={}}this.onComplete=A.onComplete;A.onComplete=this._setAjaxContent.bind(this);new Ajax.Request(B,A)},_setAjaxContent:function(A){Element.update(this.getContent(),A.responseText);if(this.onComplete){this.onComplete(A)}this[this.showFunction](this.showModal)},setCookie:function(B,C,M,E,A){B=B||this.element.id;this.cookie=[B,C,M,E,A];var K=WindowUtilities.getCookie(B);if(K){var L=K.split(",");var I=L[0].split(":");var H=L[1].split(":");var J=parseFloat(L[2]),F=parseFloat(L[3]);var G=L[4];var D=L[5];this.setSize(J,F);if(G=="true"){this.doMinimize=true}else{if(D=="true"){this.doMaximize=true}}this.useLeft=I[0]=="l";this.useTop=H[0]=="t";this.element.setStyle(this.useLeft?{left:I[1]}:{right:I[1]});this.element.setStyle(this.useTop?{top:H[1]}:{bottom:H[1]})}},getId:function(){return this.element.id},setDestroyOnClose:function(){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()}}this.destroyOnClose=true},_initDrag:function(B){this.pointer=[Event.pointerX(B),Event.pointerY(B)];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"));Windows.notify("onStartResize",this)}else{this.doResize=false;var A=$(this.getId()+"_close");if(A&&Position.within(A,this.pointer[0],this.pointer[1])){return }this.toFront();if(!this.options.draggable){return }Windows.notify("onStartMove",this)}Event.observe(document,"mouseup",this.eventMouseUp,false);Event.observe(document,"mousemove",this.eventMouseMove,false);WindowUtilities.disableScreen("__invisible__","__invisible__");document.body.ondrag=function(){return false};document.body.onselectstart=function(){return false};Event.stop(B)},_updateDrag:function(C){var D=[Event.pointerX(C),Event.pointerY(C)];var B=D[0]-this.pointer[0];var A=D[1]-this.pointer[1];if(this.doResize){this.setSize(this.widthOrg+B,this.heightOrg+A);B=this.width-this.widthOrg;A=this.height-this.heightOrg;if(!this.useLeft){this.element.setStyle({right:(this.rightOrg-B)+"px"})}if(!this.useTop){this.element.setStyle({bottom:(this.bottomOrg-A)+"px"})}}else{this.pointer=D;if(this.useLeft){this.element.setStyle({left:parseFloat(this.element.getStyle("left"))+B+"px"})}else{this.element.setStyle({right:parseFloat(this.element.getStyle("right"))-B+"px"})}if(this.useTop){this.element.setStyle({top:parseFloat(this.element.getStyle("top"))+A+"px"})}else{this.element.setStyle({bottom:parseFloat(this.element.getStyle("bottom"))-A+"px"})}}if(this.iefix){this._fixIEOverlapping()}this._removeStoreLocation();Event.stop(C)},_endDrag:function(A){WindowUtilities.enableScreen("__invisible__");if(this.doResize){Windows.notify("onEndResize",this)}else{Windows.notify("onEndMove",this)}Event.stopObserving(document,"mouseup",this.eventMouseUp,false);Event.stopObserving(document,"mousemove",this.eventMouseMove,false);this._saveCookie();Event.stop(A);document.body.ondrag=null;document.body.onselectstart=null},_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 J="<div class='"+F+"_logo' id='"+A+"_logo'></div>";var G=this.options.closable?"<div class='"+F+"_close' id='"+A+"_close' onclick='AppFramework.hideLightBox(\""+A+"\")'> </div>":"";var H=this.options.minimizable?"<div class='"+F+"_minimize' id='"+A+"_minimize' onclick='Windows.minimize(\""+A+"\", event)'> </div>":"";var I=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=typeof window.opera=="undefined"?"&nbsp;":"";D.innerHTML=G+H+I+J+"<table id='"+A+"_row1' class=\"top table_window\"><tr><td class='"+F+"_nw'>"+B+"</td><td class='"+F+"_n'>"+B+"</td><td class='"+F+"_ne'>"+B+"</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'>&nbsp;</td><td class='"+F+"_s'><div id='"+A+"_bottom' class='status_bar'>&nbsp;</div></td><td "+C+">&nbsp;</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},setLocation:function(B,A){if(B<0){B=0}if(A<0){A=0}this.element.setStyle({top:B+"px"});this.element.setStyle({left:A+"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(B,A){B=parseFloat(B);A=parseFloat(A);if(B<this.options.minWidth){B=this.options.minWidth}if(A<this.options.minHeight){A=this.options.minHeight}if(this.options.maxHeight&&A>this.options.maxHeight){A=this.options.maxHeight}if(this.options.maxWidth&&B>this.options.maxWidth){B=this.options.maxWidth}this.width=B;this.height=A;this.element.setStyle({width:B+this.widthW+this.widthE+"px"});this.element.setStyle({height:A+this.heightN+this.heightS+"px"});var C=$(this.element.id+"_content");C.setStyle({height:A+"px"});C.setStyle({width:B+"px"})},updateHeight:function(){this.setSize(this.width,this.content.scrollHeight)},updateWidth:function(){this.setSize(this.content.scrollWidth,this.height)},toFront:function(){if(Windows.focusedWindow==this){return }this.setZIndex(Windows.maxZIndex+20);Windows.notify("onFocus",this)},show:function(B){if(B){Windows.addModalWindow(this);this.modal=true;this.setZIndex(Windows.maxZIndex+20);Windows.unsetOverflow(this)}if(this.oldStyle){this.getContent().setStyle({overflow:this.oldStyle})}if(!this.width||!this.height){var A=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0);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)}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();this.visible=true;WindowUtilities.focusedWindow=this;Windows.notify("onShow",this)},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();var A=WindowUtilities.getPageSize();if(!C){C=(A.windowHeight-(this.height+this.heightN+this.heightS))/2}C+=D.top;if(!B){B=(A.windowWidth-(this.width+this.widthW+this.widthE))/2}B+=D.left;this.setLocation(C,B);this.toFront()},_recenter:function(B){if(this.modal&&this.centered){var A=WindowUtilities.getPageSize();if($("overlay_modal")){$("overlay_modal").style.height=(A.pageHeight+"px");$("overlay_modal").style.width=(A.pageWidth+"px")}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")||this.options.overflow;this.getContent().setStyle({overflow:"hidden"});this.options.hideEffect(this.element,this.options.hideEffectOptions);if(this.iefix){this.iefix.hide()}Windows.notify("onHide",this)},minimize:function(){var A=$(this.getId()+"_row2");var D=A.getDimensions().height;if(A.visible()){var C=this.element.getHeight()-D;A.hide();this.element.setStyle({height:C+"px"});if(!this.useTop){var B=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(B+D)+"px"})}}else{var C=this.element.getHeight()+D;this.element.setStyle({height:C+"px"});if(!this.useTop){var B=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(B-D)+"px"})}A.show();this.toFront()}Windows.notify("onMinimize",this);this._saveCookie()},maximize:function(){if(this.storedLocation!=null){this._restoreLocation();if(this.iefix){this.iefix.hide()}}else{this._storeLocation();Windows.unsetOverflow(this);var B=WindowUtilities.getWindowScroll();var A=WindowUtilities.getPageSize();this.element.setStyle(this.useLeft?{left:B.left}:{right:B.left});this.element.setStyle(this.useTop?{top:B.top}:{bottom:B.top});this.setSize(A.windowWidth-this.widthW-this.widthE,A.windowHeight-this.heightN-this.heightS);this.toFront();if(this.iefix){this._fixIEOverlapping()}}Windows.notify("onMaximize",this);this._saveCookie()},isMinimized:function(){var A=$(this.getId()+"_row2");return !A.visible()},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;"}},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(A){var B=this._createHiddenDiv(this.options.className+"_n");this.heightN=Element.getDimensions(B).height;B.parentNode.removeChild(B);var B=this._createHiddenDiv(this.options.className+"_s");this.heightS=Element.getDimensions(B).height;B.parentNode.removeChild(B);var B=this._createHiddenDiv(this.options.className+"_e");this.widthE=Element.getDimensions(B).width;B.parentNode.removeChild(B);var B=this._createHiddenDiv(this.options.className+"_w");this.widthW=Element.getDimensions(B).width;B.parentNode.removeChild(B);if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){this.setSize(this.width,this.height)}if(this.doMaximize){this.maximize()}if(this.doMinimize){this.minimize()}},_createHiddenDiv:function(B){var A=document.getElementsByTagName("body").item(0);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;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)}}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:0,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},register:function(A){this.windows.push(A)},addModalWindow:function(A){if(this.modalWindows.length==0){WindowUtilities.disableScreen(A.options.className,"overlay_modal",A.getId())}else{if(Window.keepMultiModalWindow){$("overlay_modal").style.zIndex=Windows.maxZIndex+20;Windows.maxZIndex+=20;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})},close:function(C,A){var B=this.getWindow(C);if(B&&B.visible){if(B.getDelegate()&&!B.getDelegate().canClose(B)){return }this.notify("onClose",B);B.hide()}if(A){Event.stop(A)}},closeAll:function(){this.windows.each(function(A){Windows.close(A.getId())})},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function(A){A.hide()})},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)},unsetOverflow:function(A){this.windows.each(function(B){B.oldOverflow=B.getContent().getStyle("overflow")||B.options.overflow;B.getContent().setStyle({overflow:"hidden"})}.bind(this));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}this.focusedWindow=B}};var Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(D,C){if(typeof D!="string"){Dialog._runAjaxRequest(D,C,Dialog.confirm);return }C=C||{};var G=C.okLabel?C.okLabel:"Ok";var A=C.cancelLabel?C.cancelLabel:"Cancel";var F=C.windowParameters||{};F.className=F.className||"alert";var B="class ='"+(C.buttonClass?C.buttonClass+" ":"")+" ok_button'";var E="class ='"+(C.buttonClass?C.buttonClass+" ":"")+" cancel_button'";var D="<div class='"+F.className+"_message'>"+D+"</div><div class='"+F.className+"_buttons'><input type='button' value='"+G+"' onclick='Dialog.okCallback()'"+B+"/><input type='button' value='"+A+"' onclick='Dialog.cancelCallback()' "+E+"/></div>";return this._openDialog(D,C)},alert:function(C,B){if(typeof C!="string"){Dialog._runAjaxRequest(C,B,Dialog.alert);return }B=B||{};var E=B.okLabel?B.okLabel:"Ok";var D=B.windowParameters||{};D.className=D.className||"alert";var A="class ='"+(B.buttonClass?B.buttonClass+" ":"")+" ok_button'";var C="<div class='"+D.className+"_message'>"+C+"</div><div class='"+D.className+"_buttons'><input type='button' value='"+E+"' onclick='Dialog.okCallback()'"+A+"/></div>";return this._openDialog(C,B)},info:function(C,B){if(typeof C!="string"){Dialog._runAjaxRequest(C,B,Dialog.info);return }B=B||{};B.windowParameters=B.windowParameters||{};var A=B.windowParameters.className||"alert";var C="<div id='modal_dialog_message' class='"+A+"_message'>"+C+"</div>";if(B.showProgress){C+="<div id='modal_dialog_progress' class='"+A+"_progress'>	</div>"}B.windowParameters.ok=null;B.windowParameters.cancel=null;B.windowParameters.className=A;return this._openDialog(C,B)},setInfoMessage:function(A){$("modal_dialog_message").update(A)},closeInfo:function(){Windows.close(this.dialogId)},_openDialog:function(D,C){if(!C.windowParameters.height&&!C.windowParameters.width){C.windowParameters.width=WindowUtilities.getPageSize().pageWidth/2}if(C.id){this.dialogId=C.id}else{var B=new Date();this.dialogId="modal_dialog_"+B.getTime()}if(!C.windowParameters.height||!C.windowParameters.width){var A=WindowUtilities._computeSize(D,this.dialogId,C.windowParameters.width,C.windowParameters.height);if(C.windowParameters.height){C.windowParameters.width=A+5}else{C.windowParameters.height=A+5}}var F=C&&C.windowParameters?C.windowParameters:{};F.resizable=F.resizable||false;F.effectOptions=F.effectOptions||{duration:1};F.minimizable=false;F.maximizable=false;F.closable=false;var E=new Window(this.dialogId,F);E.getContent().innerHTML=D;E.showCenter(true,C.top,C.left);E.setDestroyOnClose();E.cancelCallback=C.cancel;E.okCallback=C.ok;return E},_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.hide()}},cancelCallback:function(){var A=Windows.focusedWindow;$$("#"+A.getId()+" input").each(function(B){B.onclick=null});A.hide();if(A.cancelCallback){A.cancelCallback(A)}}};var isIE=navigator.appVersion.match(/MSIE/)=="MSIE";var WindowUtilities={getWindowScroll:function(){var w=window;var T,L,W,H;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(){var E,A;if(window.innerHeight&&window.scrollMaxY){E=document.body.scrollWidth;A=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){E=document.body.scrollWidth;A=document.body.scrollHeight}else{E=document.body.offsetWidth;A=document.body.offsetHeight}}var C,F;if(self.innerHeight){C=self.innerWidth;F=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){C=document.documentElement.clientWidth;F=document.documentElement.clientHeight}else{if(document.body){C=document.body.clientWidth;F=document.body.clientHeight}}}var D,B;if(A<F){D=F}else{D=A}if(E<C){B=C}else{B=E}return{pageWidth:B,pageHeight:D,windowWidth:C,windowHeight:F}},disableScreen:function(D,C,F){WindowUtilities.initLightbox(C,D);var B=document.getElementsByTagName("body").item(0);var E=$(C);var A=WindowUtilities.getPageSize();if(F&&isIE){WindowUtilities._hideSelect();WindowUtilities._showSelect(F)}E.style.height=(A.pageHeight+"px");E.style.width=(A.windowWidth+"px");E.style.display="block"},enableScreen:function(B){B=B||"overlay_modal";var A=$(B);if(A){A.style.display="none";if(B!="__invisible__"){WindowUtilities._showSelect()}A.parentNode.removeChild(A)}},_hideSelect:function(A){if(isIE){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(isIE){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(D,B){if($(D)){Element.setStyle(D,{zIndex:Windows.maxZIndex+10})}else{var A=document.getElementsByTagName("body").item(0);var C=document.createElement("div");C.setAttribute("id",D);C.className="overlay_"+B;C.style.display="none";C.style.position="absolute";C.style.top="0";C.style.left="0";C.style.zIndex=Windows.maxZIndex+10;C.style.width="100%";A.insertBefore(C,A.firstChild)}},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))},addCss:function(D,A){if((typeof (A)=="undefined")||(typeof (A)=="string"&&A.length==0)){A="default.css"}if(typeof (cssPath)=="undefined"){cssPath=""}var C=$A(document.getElementsByTagName("link"));var E=true;C.each(function(F){if(F.href==A||F.href==cssPath+A){E=false}});if(E){var B=document.createElement("link");B.setAttribute("type","text/css");B.setAttribute("rel","stylesheet");B.setAttribute("href",cssPath+A);B.setAttribute("media","screen");document.getElementsByTagName("head")[0].appendChild(B)}},_computeSize:function(E,H,D,A,F){if(F==null){F=5}var C=document.getElementsByTagName("body").item(0);var G=document.createElement("div");G.setAttribute("id",H);if(A){G.style.height=A+"px"}else{G.style.width=D+"px"}G.style.position="absolute";G.style.top="0";G.style.left="0";G.style.display="none";G.innerHTML=E;C.insertBefore(G,C.firstChild);var B;if(A){B=$(H).getDimensions().width+F}else{B=$(H).getDimensions().height+F}C.removeChild(G);return B}};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,D){var E={};if(this.options.scaleX){E.width=Math.round(D)+"px"}if(this.options.scaleY){E.height=Math.round(A)+"px"}if(this.options.scaleFromCenter){var C=(A-this.dims[0])/2;var B=(D-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){E.top=this.originalTop-C+"px"}if(this.options.scaleX){E.left=this.originalLeft-B+"px"}}else{if(this.options.scaleY){E.top=-C+"px"}if(this.options.scaleX){E.left=-B+"px"}}}this.element.setStyle(E)}});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(I){I.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(I){new Effect.Parallel([new Effect.Opacity(I.element,{sync:true,to:1,from:0,transition:B.opacityTransition}),new Effect.Move(I.element,{x:E,y:D,sync:true,transition:B.moveTransition}),new Effect.Scale(I.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(J){J.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(J){J.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();if(typeof Effect=="undefined"){throw ("controls.js requires including script.aculo.us' effects.js library")}var Autocompleter={};Autocompleter.Base=function(){};Autocompleter.Base.prototype={baseInitialize:function(B,C,A){B=$(B);this.element=B;this.update=$(C);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;if(this.setOptions){this.setOptions(A)}else{this.options=A||{}}this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(D,E){if(!E.style.position||E.style.position=="absolute"){E.style.position="absolute";Position.clone(D,E,{setHeight:false,offsetTop:D.offsetHeight})}Effect.Appear(E,{duration:0.15})};this.options.onHide=this.options.onHide||function(D,E){new Effect.Fade(E,{duration:0.15})};if(typeof (this.options.tokens)=="string"){this.options.tokens=new Array(this.options.tokens)}this.observer=null;this.element.setAttribute("autocomplete","off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this));Event.observe(window,"beforeunload",function(){B.setAttribute("autocomplete","on")})},show:function(){if(Element.getStyle(this.update,"display")=="none"){this.options.onShow(this.element,this.update)}if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,"position")=="absolute")){new Insertion.After(this.update,'<iframe id="'+this.update.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.update.id+"_iefix")}if(this.iefix){setTimeout(this.fixIEOverlapping.bind(this),50)}},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,"display")!="none"){this.options.onHide(this.element,this.update)}if(this.iefix){Element.hide(this.iefix)}},startIndicator:function(){if(this.options.indicator){Element.show(this.options.indicator)}},stopIndicator:function(){if(this.options.indicator){Element.hide(this.options.indicator)}},onKeyPress:function(A){if(this.active){switch(A.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(A);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(A);return ;case Event.KEY_LEFT:case Event.KEY_RIGHT:return ;case Event.KEY_UP:this.markPrevious();this.render();if(Prototype.Browser.WebKit){Event.stop(A)}return ;case Event.KEY_DOWN:this.markNext();this.render();if(Prototype.Browser.WebKit){Event.stop(A)}return }}else{if(A.keyCode==Event.KEY_TAB||A.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&A.keyCode==0)){return }}this.changed=true;this.hasFocus=true;if(this.observer){clearTimeout(this.observer)}this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(B){var A=Event.findElement(B,"LI");if(this.index!=A.autocompleteIndex){this.index=A.autocompleteIndex;this.render()}Event.stop(B)},onClick:function(B){var A=Event.findElement(B,"LI");this.index=A.autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(A){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},render:function(){if(this.entryCount>0){for(var A=0;A<this.entryCount;A++){this.index==A?Element.addClassName(this.getEntry(A),"selected"):Element.removeClassName(this.getEntry(A),"selected")}if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0){this.index--}else{this.index=this.entryCount-1}this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index<this.entryCount-1){this.index++}else{this.index=0}this.getEntry(this.index).scrollIntoView(false)},getEntry:function(A){return this.update.firstChild.childNodes[A]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(F){if(this.options.updateElement){this.options.updateElement(F);return }var C="";if(this.options.select){var A=document.getElementsByClassName(this.options.select,F)||[];if(A.length>0){C=Element.collectTextNodes(A[0],this.options.select)}}else{C=Element.collectTextNodesIgnoreClass(F,"informal")}var E=this.findLastToken();if(E!=-1){var D=this.element.value.substr(0,E+1);var B=this.element.value.substr(E+1).match(/^\s+/);if(B){D+=B[0]}this.element.value=D+C}else{this.element.value=C}this.element.focus();if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,F)}},updateChoices:function(C){if(!this.changed&&this.hasFocus){this.update.innerHTML=C;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var A=0;A<this.entryCount;A++){var B=this.getEntry(A);B.autocompleteIndex=A;this.addObservers(B)}}else{this.entryCount=0}this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else{this.render()}}},addObservers:function(A){Event.observe(A,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(A,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices()}else{this.active=false;this.hide()}},getToken:function(){var B=this.findLastToken();if(B!=-1){var A=this.element.value.substr(B+1).replace(/^\s+/,"").replace(/\s+$/,"")}else{var A=this.element.value}return/\n/.test(A)?"":A},findLastToken:function(){var C=-1;for(var B=0;B<this.options.tokens.length;B++){var A=this.element.value.lastIndexOf(this.options.tokens[B]);if(A>C){C=A}}return C}};Ajax.Autocompleter=Class.create();Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(C,D,B,A){this.baseInitialize(C,D,A);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=B},getUpdatedChoices:function(){this.startIndicator();var A=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,A):A;if(this.options.defaultParams){this.options.parameters+="&"+this.options.defaultParams}new Ajax.Request(this.url,this.options)},onComplete:function(A){this.updateChoices(A.responseText)}});Autocompleter.Local=Class.create();Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base(),{initialize:function(B,D,C,A){this.baseInitialize(B,D,A);this.options.array=C},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(A){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(B){var D=[];var C=[];var H=B.getToken();var G=0;for(var E=0;E<B.options.array.length&&D.length<B.options.choices;E++){var F=B.options.array[E];var I=B.options.ignoreCase?F.toLowerCase().indexOf(H.toLowerCase()):F.indexOf(H);while(I!=-1){if(I==0&&F.length!=H.length){D.push("<li><strong>"+F.substr(0,H.length)+"</strong>"+F.substr(H.length)+"</li>");break}else{if(H.length>=B.options.partialChars&&B.options.partialSearch&&I!=-1){if(B.options.fullSearch||/\s/.test(F.substr(I-1,1))){C.push("<li>"+F.substr(0,I)+"<strong>"+F.substr(I,H.length)+"</strong>"+F.substr(I+H.length)+"</li>");break}}}I=B.options.ignoreCase?F.toLowerCase().indexOf(H.toLowerCase(),I+1):F.indexOf(H,I+1)}}if(C.length){D=D.concat(C.slice(0,B.options.choices-D.length))}return"<ul>"+D.join("")+"</ul>"}},A||{})}});Field.scrollFreeActivate=function(A){setTimeout(function(){Field.activate(A)},1)};Ajax.InPlaceEditor=Class.create();Ajax.InPlaceEditor.defaultHighlightColor="#FFFF99";Ajax.InPlaceEditor.prototype={initialize:function(C,B,A){this.url=B;this.element=$(C);this.options=Object.extend({paramName:"value",okButton:true,okLink:false,okText:"ok",cancelButton:false,cancelLink:true,cancelText:"cancel",textBeforeControls:"",textBetweenControls:"",textAfterControls:"",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(E,D){new Effect.Highlight(D,{startcolor:this.options.highlightcolor})},onFailure:function(D){alert("Error communicating with the server: "+D.responseText.stripTags())},callback:function(D){return Form.serialize(D)},handleLineBreaks:true,loadingText:"Loading...",savingClassName:"inplaceeditor-saving",loadingClassName:"inplaceeditor-loading",formClassName:"inplaceeditor-form",highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,submitOnBlur:false,ajaxOptions:{},evalScripts:false},A||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId=null}}if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl)}this.originalBackground=Element.getStyle(this.element,"background-color");if(!this.originalBackground){this.originalBackground="transparent"}this.element.title=this.options.clickToEditText;this.onclickListener=this.enterEditMode.bindAsEventListener(this);this.mouseoverListener=this.enterHover.bindAsEventListener(this);this.mouseoutListener=this.leaveHover.bindAsEventListener(this);Event.observe(this.element,"click",this.onclickListener);Event.observe(this.element,"mouseover",this.mouseoverListener);Event.observe(this.element,"mouseout",this.mouseoutListener);if(this.options.externalControl){Event.observe(this.options.externalControl,"click",this.onclickListener);Event.observe(this.options.externalControl,"mouseover",this.mouseoverListener);Event.observe(this.options.externalControl,"mouseout",this.mouseoutListener)}},enterEditMode:function(A){if(this.saving){return }if(this.editing){return }this.editing=true;this.onEnterEditMode();if(this.options.externalControl){Element.hide(this.options.externalControl)}Element.hide(this.element);this.createForm();this.element.parentNode.insertBefore(this.form,this.element);if(!this.options.loadTextURL){Field.scrollFreeActivate(this.editField)}if(A){Event.stop(A)}return false},createForm:function(){this.form=document.createElement("form");this.form.id=this.options.formId;Element.addClassName(this.form,this.options.formClassName);this.form.onsubmit=this.onSubmit.bind(this);this.createEditField();if(this.options.textarea){var B=document.createElement("br");this.form.appendChild(B)}if(this.options.textBeforeControls){this.form.appendChild(document.createTextNode(this.options.textBeforeControls))}if(this.options.okButton){var E=document.createElement("input");E.type="submit";E.value=this.options.okText;E.className="editor_ok_button";this.form.appendChild(E)}if(this.options.okLink){var C=document.createElement("a");C.href="#";C.appendChild(document.createTextNode(this.options.okText));C.onclick=this.onSubmit.bind(this);C.className="editor_ok_link";this.form.appendChild(C)}if(this.options.textBetweenControls&&(this.options.okLink||this.options.okButton)&&(this.options.cancelLink||this.options.cancelButton)){this.form.appendChild(document.createTextNode(this.options.textBetweenControls))}if(this.options.cancelButton){var D=document.createElement("input");D.type="submit";D.value=this.options.cancelText;D.onclick=this.onclickCancel.bind(this);D.className="editor_cancel_button";this.form.appendChild(D)}if(this.options.cancelLink){var A=document.createElement("a");A.href="#";A.appendChild(document.createTextNode(this.options.cancelText));A.onclick=this.onclickCancel.bind(this);A.className="editor_cancel editor_cancel_link";this.form.appendChild(A)}if(this.options.textAfterControls){this.form.appendChild(document.createTextNode(this.options.textAfterControls))}},hasHTMLLineBreaks:function(A){if(!this.options.handleLineBreaks){return false}return A.match(/<br/i)||A.match(/<p>/i)},convertHTMLLineBreaks:function(A){return A.replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<p>/gi,"")},createEditField:function(){var E;if(this.options.loadTextURL){E=this.options.loadingText}else{E=this.getText()}var C=this;if(this.options.rows==1&&!this.hasHTMLLineBreaks(E)){this.options.textarea=false;var A=document.createElement("input");A.obj=this;A.type="text";A.name=this.options.paramName;A.value=E;A.style.backgroundColor=this.options.highlightcolor;A.className="editor_field";var B=this.options.size||this.options.cols||0;if(B!=0){A.size=B}if(this.options.submitOnBlur){A.onblur=this.onSubmit.bind(this)}this.editField=A}else{this.options.textarea=true;var D=document.createElement("textarea");D.obj=this;D.name=this.options.paramName;D.value=this.convertHTMLLineBreaks(E);D.rows=this.options.rows;D.cols=this.options.cols||40;D.className="editor_field";if(this.options.submitOnBlur){D.onblur=this.onSubmit.bind(this)}this.editField=D}if(this.options.loadTextURL){this.loadExternalText()}this.form.appendChild(this.editField)},getText:function(){return this.element.innerHTML},loadExternalText:function(){Element.addClassName(this.form,this.options.loadingClassName);this.editField.disabled=true;new Ajax.Request(this.options.loadTextURL,Object.extend({asynchronous:true,onComplete:this.onLoadedExternalText.bind(this)},this.options.ajaxOptions))},onLoadedExternalText:function(A){Element.removeClassName(this.form,this.options.loadingClassName);this.editField.disabled=false;this.editField.value=A.responseText.stripTags();Field.scrollFreeActivate(this.editField)},onclickCancel:function(){this.onComplete();this.leaveEditMode();return false},onFailure:function(A){this.options.onFailure(A);if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;this.oldInnerHTML=null}return false},onSubmit:function(){var A=this.form;var B=this.editField.value;this.onLoading();if(this.options.evalScripts){new Ajax.Request(this.url,Object.extend({parameters:this.options.callback(A,B),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this),asynchronous:true,evalScripts:true},this.options.ajaxOptions))}else{new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(A,B),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this)},this.options.ajaxOptions))}if(arguments.length>1){Event.stop(arguments[0])}return false},onLoading:function(){this.saving=true;this.removeForm();this.leaveHover();this.showSaving()},showSaving:function(){this.oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;Element.addClassName(this.element,this.options.savingClassName);this.element.style.backgroundColor=this.originalBackground;Element.show(this.element)},removeForm:function(){if(this.form){if(this.form.parentNode){Element.remove(this.form)}this.form=null}},enterHover:function(){if(this.saving){return }this.element.style.backgroundColor=this.options.highlightcolor;if(this.effect){this.effect.cancel()}Element.addClassName(this.element,this.options.hoverClassName)},leaveHover:function(){if(this.options.backgroundColor){this.element.style.backgroundColor=this.oldBackground}Element.removeClassName(this.element,this.options.hoverClassName);if(this.saving){return }this.effect=new Effect.Highlight(this.element,{startcolor:this.options.highlightcolor,endcolor:this.options.highlightendcolor,restorecolor:this.originalBackground})},leaveEditMode:function(){Element.removeClassName(this.element,this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this.originalBackground;Element.show(this.element);if(this.options.externalControl){Element.show(this.options.externalControl)}this.editing=false;this.saving=false;this.oldInnerHTML=null;this.onLeaveEditMode()},onComplete:function(A){this.leaveEditMode();this.options.onComplete.bind(this)(A,this.element)},onEnterEditMode:function(){},onLeaveEditMode:function(){},dispose:function(){if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML}this.leaveEditMode();Event.stopObserving(this.element,"click",this.onclickListener);Event.stopObserving(this.element,"mouseover",this.mouseoverListener);Event.stopObserving(this.element,"mouseout",this.mouseoutListener);if(this.options.externalControl){Event.stopObserving(this.options.externalControl,"click",this.onclickListener);Event.stopObserving(this.options.externalControl,"mouseover",this.mouseoverListener);Event.stopObserving(this.options.externalControl,"mouseout",this.mouseoutListener)}}};Ajax.InPlaceCollectionEditor=Class.create();Object.extend(Ajax.InPlaceCollectionEditor.prototype,Ajax.InPlaceEditor.prototype);Object.extend(Ajax.InPlaceCollectionEditor.prototype,{createEditField:function(){if(!this.cached_selectTag){var A=document.createElement("select");var C=this.options.collection||[];var B;C.each(function(E,D){B=document.createElement("option");B.value=(E instanceof Array)?E[0]:E;if((typeof this.options.value=="undefined")&&((E instanceof Array)?this.element.innerHTML==E[1]:E==B.value)){B.selected=true}if(this.options.value==B.value){B.selected=true}B.appendChild(document.createTextNode((E instanceof Array)?E[1]:E));A.appendChild(B)}.bind(this));this.cached_selectTag=A}this.editField=this.cached_selectTag;if(this.options.loadTextURL){this.loadExternalText()}this.form.appendChild(this.editField);this.options.callback=function(D,E){return"value="+encodeURIComponent(E)}}});Form.Element.DelayedObserver=Class.create();Form.Element.DelayedObserver.prototype={initialize:function(B,A,C){this.delay=A||0.5;this.element=$(B);this.callback=C;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(A){if(this.lastValue==$F(this.element)){return }if(this.timer){clearTimeout(this.timer)}this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element)},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element))}};function advAJAX(){this.url=window.location.href;this.method="GET";this.parameters=new Object();this.headers=new Object();this.mimeType=null;this.username=null;this.password=null;this.useJSON=false;this.useCache=false;this.requestDone=false;this.requestAborted=false;this.requestTimedOut=false;this.queryString="";this.responseText=null;this.responseXML=null;this.responseJSON=null;this.status=null;this.statusText=null;this.timeout=0;this.retryCount=0;this.retryDelay=1000;this.retryNo=0;this.repeat=false;this.repeatCount=0;this.repeatNo=0;this.repeatDelay=1000;this.tag=null;this.group=null;this.form=null;this.disableForm=true;this.onInitialization=null;this.onFinalization=null;this.onAbort=null;this.onReadyStateChange=null;this.onLoading=null;this.onLoaded=null;this.onInteractive=null;this.onComplete=null;this.onSuccess=null;this.onFatalError=null;this.onInternalError=null;this.onError=null;this.onTimeout=null;this.onRetryDelay=null;this.onRetry=null;this.onRepeat=null;this.onRepeatDelay=null;this.onGroupEnter=null;this.onGroupLeave=null;this._xhr=null;this._eventHandled=[false];this._timerTimeout=null;this._timerRepeat=null;this.init=function(){(this._xhr!==null)&&this.destroy();if((this._xhr=this._createXHR())===null){return false}if(typeof advAJAX._defaultParameters!="undefined"){this.handleArguments(advAJAX._defaultParameters)}if(typeof this._xhr.overrideMimeType=="function"&&this.mimeType!==null){this._xhr.overrideMimeType(this.mimeType)}this._eventHandled=[this._eventHandled[0],false,false,false,false];var _this=this;this._xhr.onreadystatechange=function(){if(_this.requestAborted){return }_this._raise("ReadyStateChange",_this._xhr.readyState);(!_this._eventHandled[_this._xhr.readyState])&&_this._handleReadyState(_this._xhr.readyState)};return true};this.destroy=function(abort){abort=abort||false;try{abort&&this._xhr.abort();delete this._xhr["onreadystatechange"]}catch(e){}this._xhr=null};this._createXHR=function(){if(typeof XMLHttpRequest!="undefined"){return new XMLHttpRequest()}var xhr=["MSXML2.XMLHttp.6.0","MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp"];for(var i=0;i<xhr.length;i++){try{var xhrObj=new ActiveXObject(xhr[i]);return xhrObj}catch(e){}}this._raise("FatalError");return null};this._handleReadyState=function(readyState){if(this._eventHandled[readyState]){return }this._eventHandled[readyState]=true;switch(readyState){case 1:if(this.retryNo==0&&this.group!==null){if(typeof advAJAX._groupData[this.group]=="undefined"){advAJAX._groupData[this.group]=0;this._raise("GroupEnter",this.group)}advAJAX._groupData[this.group]++}this._raise("Loading",this);break;case 2:this._raise("Loaded",this);break;case 3:this._raise("Interactive",this);break;case 4:window.clearTimeout(this._timerTimeout);if(this.requestAborted){return }this.requestDone=true;this.responseText=this._xhr.responseText;this.responseXML=this._xhr.responseXML;try{this.status=this._xhr.status||null;this.statusText=this._xhr.statusText||null}catch(e){this.status=null;this.statusText=null}this._raise("Complete",this);if(this.status==200){try{var _contentType=this._xhr.getResponseHeader("Content-type");if(_contentType.match(/^text\/javascript/i)){eval(this.responseText)}else{if(_contentType.match(/^text\/x\-json/i)){this.responseJSON=eval("("+this.responseText+")")}}}catch(e){this._raise("InternalError",advAJAX.ERROR_INVALID_EVAL_STRING)}this._raise("Success",this)}else{this._raise("Error",this)}if(this.repeat){if(++this.repeatNo!=this.repeatCount-1){this._raise("RepeatDelay",this);var _this=this;this._timerRepeat=window.setTimeout(function(){_this._raise("Repeat",this);_this.init();_this.run()},this.repeatDelay);return }}this.destroy();(this.disableForm)&&this._switchForm(true);this._handleGroup();this._raise("Finalization",this)}};this._handleGroup=function(){if(this.group===null){return }if(--advAJAX._groupData[this.group]==0){this._raise("GroupLeave",this);delete advAJAX._groupData[this.group]}};this._onTimeout=function(){if(this._xhr==null||this._eventHandled[4]){return }this.requestAborted=this.requestTimedOut=true;this._xhr.abort();this._raise("Timeout");if(this.retryNo++<this.retryCount){this.init();this._raise("RetryDelay",this);var _this=this;this._timerTimeout=window.setTimeout(function(){_this._raise("Retry",_this);_this.run()},this.retryDelay)}else{this.destroy();(this.disableForm)&&this._switchForm(true);this._handleGroup();this._raise("Finalization",this)}};this.run=function(){if(this.init()==false){return false}this.requestAborted=this.requestTimedOut=false;(!this._eventHandled[0])&&(this._raise("Initialization",this))&&(this._eventHandled[0]=true);if(this.retryNo==0&&this.repeatNo==0){if(this.useJSON){if(typeof [].toJSONString!="function"){this._raise("InternalError",advAJAX.ERROR_NO_JSON);return }for(var p in this.parameters){var useJson=typeof [].toJSONString=="function";(this.queryString.length>0)&&(this.queryString+="&");this.queryString+=encodeURIComponent(p)+"="+encodeURIComponent(this.parameters[p].toJSONString())}}else{for(var p in this.parameters){(this.queryString.length>0)&&(this.queryString+="&");if(typeof this.parameters[p]!="object"){this.queryString+=encodeURIComponent(p)+"="+encodeURIComponent(this.parameters[p])}else{if(!(this.parameters[p] instanceof Array)){continue}for(var i=0,cnt=this.parameters[p].length;i<cnt;i++){this.queryString+=encodeURIComponent(p)+"="+encodeURIComponent(this.parameters[p][i])+"&"}this.queryString=this.queryString.slice(0,-1)}}}(this.method=="GET")&&(this.queryString.length>0)&&(this.url+=(this.url.indexOf("?")!=-1?"&":"?")+this.queryString)}(this.disableForm)&&this._switchForm(false);try{this._xhr.open(this.method,this.url,true,this.username||"",this.password||"")}catch(e){this._raise("FatalError",this);return false}var _this=this;(this.timeout>0)&&(this._timerTimeout=window.setTimeout(function(){_this._onTimeout()},this.timeout));if(typeof this._xhr.setRequestHeader=="function"){if(this.method=="GET"&&!this.useCache){this._xhr.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT")}for(var p in this.headers){this._xhr.setRequestHeader(encodeURIComponent(p),encodeURIComponent(this.headers[p]))}}if(this.method=="POST"){try{this._xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded")}catch(e){}this._xhr.send(this.queryString)}else{if(this.method=="GET"){this._xhr.send("")}}};this.getResponseHeader=function(name){return this._xhr.getResponseHeader(name)||null};this.getAllResponseHeaders=function(){return this._xhr.getAllResponseHeaders()||null};this.abort=function(){this.requestAborted=true;window.clearTimeout(this._timerTimeout);window.clearTimeout(this._timerRepeat);this._handleGroup();this._raise("Abort",this);this.destroy();this._raise("Finalization",this)},this._extendObject=function(target,source){for(var p in source){target[p]=source[p]}};this.handleArguments=function(args){(typeof args["form"]=="string")&&(args["form"]=document.getElementById(args["form"]));for(var p in args){if(typeof this[p]=="undefined"){this.parameters[p]=args[p]}else{if(p!="parameters"&&p!="headers"){this[p]=args[p]}else{this._extendObject(this[p],args[p])}}}this.method=this.method.toUpperCase();(typeof this.form=="object")&&(this.form!==null)&&this._appendForm();(args.repeat)&&(this.repeatCount++)};this._switchForm=function(enable){if(typeof this.form!="object"||this.form===null){return }var _f=this.form;for(var i=0;i<_f.elements.length;i++){if(!enable){if(_f.elements[i]["disabled"]){_f.elements[i]["_disabled"]=true}else{_f.elements[i]["disabled"]="disabled"}}else{if(typeof _f.elements[i]["_disabled"]=="undefined"||_f.elements[i]["_disabled"]===null){_f.elements[i]["disabled"]=""}try{delete _f.elements[i]["_disabled"]}catch(e){_f.elements[i]["_disabled"]=null}}}};this._appendForm=function(){var _f=this.form;this.method=_f.getAttribute("method").toUpperCase();this.url=_f.getAttribute("action");for(var i=0;i<_f.elements.length;i++){var _e=_f.elements[i];if(_e.disabled){continue}switch(_e.type){case"text":case"password":case"hidden":case"textarea":this._addParameter(_e.name,_e.value);break;case"select-one":if(_e.selectedIndex>=0){this._addParameter(_e.name,_e.options[_e.selectedIndex].value)}break;case"select-multiple":var _r=[];for(var j=0;j<_e.options.length;j++){if(_e.options[j].selected){_r[_r.length]=_e.options[j].value}}(_r.length>0)&&(this._addParameter(_e.name,_r));break;case"checkbox":case"radio":(_e.checked)&&(this._addParameter(_e.name,_e.value));break}}};this._addParameter=function(name,value){if(typeof this.parameters[name]=="undefined"){this.parameters[name]=value}else{if(typeof this.parameters[name]!="object"){this.parameters[name]=[this.parameters[name],value]}else{this.parameters[name][this.parameters[name].length]=value}}};this._delParameter=function(name){delete this.parameters[name]};this._raise=function(name){for(var i=1,args=[];i<arguments.length;args[args.length]=arguments[i++]){}(typeof this["on"+name]=="function")&&(this["on"+name].apply(null,args));(name=="FatalError")&&this._raise("Finalization",this)}}advAJAX._groupData=new Object();advAJAX._defaultParameters=new Object();advAJAX.get=function(A){return advAJAX._handleRequest("GET",A)};advAJAX.post=function(A){return advAJAX._handleRequest("POST",A)};advAJAX.head=function(A){return advAJAX._handleRequest("HEAD",A)};advAJAX._handleRequest=function(A,B){B=B||{};var C=new advAJAX();C.method=A;C.handleArguments(B);setTimeout(function(){C.run()},0);return C};advAJAX.submit=function(C,A){A=A||{};if(typeof C=="undefined"||C===null){return false}var B=new advAJAX();A["form"]=C;B.handleArguments(A);setTimeout(function(){B.run()},0);return B};advAJAX.assign=function(C,B){B=B||{};(typeof C=="string")&&(C=document.getElementById(C));if(typeof C=="undefined"||C===null){return false}C["_advajax_args"]=B;var A=function(E){E=E||window.event;if(E.preventDefault){E.preventDefault();E.stopPropagation()}else{E.returnValue=false;E.cancelBubble=true}var D=E.target||E.srcElement;return !advAJAX.submit(D,D["_advajax_args"])};if(C.addEventListener){C.addEventListener("submit",A,false)}else{if(C.attachEvent){C.attachEvent("onsubmit",A)}}return true};advAJAX.download=function(B,A){(typeof B=="string")&&(B=document.getElementById(B));if(typeof B=="undefined"||B===null){return false}advAJAX.get({"url":A,"onSuccess":function(C){B.innerHTML=C.responseText}})};advAJAX.setDefaultParameters=function(B){advAJAX._defaultParameters=new Object();for(var A in B){advAJAX._defaultParameters[A]=B[A]}};advAJAX.ERROR_INVALID_EVAL_STRING=-1;advAJAX.ERROR_NO_JSON=-2;(function(){if(typeof gg=="undefined"){gg=function(){}}gg.zhora=(function(){if(typeof GBounds=="undefined"){GBounds=function(){}}var _map;var _mgr;var _ajaxURL="/";var _isAjaxActive=false;var _ajaxRequestCount=0;var _lastMapPos;var _totalMarkerCount=0;var _markerLog=[];var _mapAjaxLog=[];var _request_params=[];function _addToMarkerCount(count){_markerLog=new Array();_mapAjaxLog=new Array();_mgr.clearMarkers()}function _getDistance(point,bound,inner){return inner?Math.min(point.distanceFrom(new GLatLng(point.lat(),bound.lng())),point.distanceFrom(new GLatLng(bound.lat(),point.lng()))):point.distanceFrom(bound)}function _LZ(n){return(n.toString().length<=1?"0":"")+n}function _markerBindFunctions(marker,location){if(location.textURL){marker.bindInfoWindowHtml('<iframe src="'+location.textURL+' " style="width: 300px;height:100px;border: none;" ></iframe>')}}return{setAjaxURL:function(url){_ajaxURL=url;return this},setMarkerBindFunction:function(fn){_markerBindFunctions=fn;return this},setAjaxActive:function(active){_isAjaxActive=active;return this},getMap:function(){return _map},setRequestParams:function(r){if(Object.prototype.toString.call(r)!=="[object Array]"){throw"Request params should be array"}_request_params=r;return this},generateMap:function(mapID){if(GBrowserIsCompatible()){GBounds.prototype.containsPoint=function(point){var outer=this;return(outer.minX<=point.x&&outer.maxX>=point.x&&outer.minY<=point.y&&outer.maxY>=point.y)};var mapObj=document.getElementById(mapID);if(mapObj!="undefined"&&mapObj!=null){_map=new GMap2(mapObj);_map.addControl(new GLargeMapControl());_map.addControl(new GMapTypeControl());_map.addControl(new GScaleControl());_map.enableScrollWheelZoom();_map.enableContinuousZoom();_map.setCenter(new GLatLng(52.2419627,21.0841893),12,G_NORMAL_MAP);_mgr=new MarkerManager(_map);_mapLastPos=_map.getBounds();_geocoder=new GClientGeocoder();var _this=this;GEvent.addListener(_map,"moveend",function(){if(_isAjaxActive){return }var ajaxCacheKey=_map.getZoom()+" "+_map.getBounds().getSouthWest().lat();if((Math.abs(_mapLastPos.getSouthWest().lat()-_map.getBounds().getSouthWest().lat())/Math.abs(_mapLastPos.getSouthWest().lat()-_mapLastPos.getNorthEast().lat())*100>40||Math.abs(_mapLastPos.getSouthWest().lng()-_map.getBounds().getSouthWest().lng())/Math.abs(_mapLastPos.getSouthWest().lng()-_mapLastPos.getNorthEast().lng())*100>40)){_this.showOnMap();_mapLastPos=_map.getBounds();_mapAjaxLog[ajaxCacheKey]=1}else{}});return _map}}else{throw"Sorry, the Google Maps API is not compatible with this browser."}},showOnMap:function(){if(_isAjaxActive){return }_isAjaxActive=true;_ajaxRequestCount++;var request_params=["action=getLocations","latitudeMIN="+_map.getBounds().getSouthWest().lat(),"latitudeMAX="+_map.getBounds().getNorthEast().lat(),"longitudeMIN="+_map.getBounds().getSouthWest().lng(),"longitudeMAX="+_map.getBounds().getNorthEast().lng(),];for(var c=0;c<_request_params.length;c++){request_params.push(_request_params[c])}GDownloadUrl(_ajaxURL,function(response){_isAjaxActive=false;setTimeout(function(){var data=eval("("+response+")");var markers=new Array();if(typeof data=="undefined"||!data){return }if(data.result.status!=0){alert(data.result.errorMsg||"Unknown Error");return }for(var c=0;c<data.result.users.length;c++){if(typeof data.result.users[c].locations=="undefined"){continue}for(var x=0;x<data.result.users[c].locations.length;x++){var location=data.result.users[c].locations[x];if(typeof location.latitude=="undefined"||typeof location.longitude=="undefined"){continue}var recordCache=location.latitude+"z"+_map.getZoom();_markerLog[recordCache]=1;var marker=new GMarker(new GLatLng(location.latitude,location.longitude),{icon:location.iconURL?new GIcon(G_DEFAULT_ICON,location.iconURL):null});_markerBindFunctions(marker,location);markers.push(marker)}}if(markers.length<1){return }_addToMarkerCount(markers.length);_mgr.addMarker(markers.pop(),0);var c=Math.round(_map.getZoom()/2);while(markers.length){var zoomMin=_map.getZoom()-c-1;var zoomMax=_map.getZoom()+c;var markerCount=Math.round(markers.length*0.75);if(markerCount<1){markerCount=markers.length}_mgr.addMarkers(markers.splice(0,markerCount),zoomMin<0?0:zoomMin,zoomMax>17?17:zoomMax);c--}_mgr.refresh()},10)},request_params.join("&"));return this},fillLocationInput:function(input){input=document.getElementById(input);if(!window.google||!google.gears){}try{var geolocation=google.gears.factory.create("beta.geolocation");geolocation.getCurrentPosition(function(p){var address=p.gearsAddress.city+", "+p.gearsAddress.region+", "+p.gearsAddress.country;input.value=address},function(e){throw e.message},{enableHighAccuracy:true,gearsRequestAddress:true})}catch(e){throw e.message;return }}}})()})();function MarkerManager(D,C){var A=this;A.map_=D;A.mapZoom_=D.getZoom();A.projection_=D.getCurrentMapType().getProjection();C=C||{};A.tileSize_=MarkerManager.DEFAULT_TILE_SIZE_;var B=MarkerManager.DEFAULT_MAX_ZOOM_;if(C.maxZoom!=undefined){B=C.maxZoom}A.maxZoom_=B;A.trackMarkers_=C.trackMarkers;var E;if(typeof C.borderPadding=="number"){E=C.borderPadding}else{E=MarkerManager.DEFAULT_BORDER_PADDING_}A.swPadding_=new GSize(-E,E);A.nePadding_=new GSize(E,-E);A.borderPadding_=E;A.gridWidth_=[];A.grid_=[];A.grid_[B]=[];A.numMarkers_=[];A.numMarkers_[B]=0;GEvent.bind(D,"moveend",A,A.onMapMoveEnd_);A.removeOverlay_=function(F){D.removeOverlay(F);A.shownMarkers_--};A.addOverlay_=function(F){D.addOverlay(F);A.shownMarkers_++};A.resetManager_();A.shownMarkers_=0;A.shownBounds_=A.getMapGridBounds_()}MarkerManager.DEFAULT_TILE_SIZE_=1024;MarkerManager.DEFAULT_MAX_ZOOM_=17;MarkerManager.DEFAULT_BORDER_PADDING_=100;MarkerManager.MERCATOR_ZOOM_LEVEL_ZERO_RANGE=256;MarkerManager.prototype.resetManager_=function(){var C=this;var B=MarkerManager.MERCATOR_ZOOM_LEVEL_ZERO_RANGE;for(var A=0;A<=C.maxZoom_;++A){C.grid_[A]=[];C.numMarkers_[A]=0;C.gridWidth_[A]=Math.ceil(B/C.tileSize_);B<<=1}};MarkerManager.prototype.clearMarkers=function(){var A=this;A.processAll_(A.shownBounds_,A.removeOverlay_);A.resetManager_()};MarkerManager.prototype.getTilePoint_=function(C,A,D){var B=this.projection_.fromLatLngToPixel(C,A);return new GPoint(Math.floor((B.x+D.width)/this.tileSize_),Math.floor((B.y+D.height)/this.tileSize_))};MarkerManager.prototype.addMarkerBatch_=function(G,C,A){var D=G.getPoint();if(this.trackMarkers_){GEvent.bind(G,"changed",this,this.onMarkerMoved_)}var F=this.getTilePoint_(D,A,GSize.ZERO);for(var E=A;E>=C;E--){var B=this.getGridCellCreate_(F.x,F.y,E);B.push(G);F.x=F.x>>1;F.y=F.y>>1}};MarkerManager.prototype.isGridPointVisible_=function(A){var C=this;var E=C.shownBounds_.minY<=A.y&&A.y<=C.shownBounds_.maxY;var B=C.shownBounds_.minX;var F=B<=A.x&&A.x<=C.shownBounds_.maxX;if(!F&&B<0){var D=C.gridWidth_[C.shownBounds_.z];F=B+D<=A.x&&A.x<=D-1}return E&&F};MarkerManager.prototype.onMarkerMoved_=function(E,I,G){var C=this;var A=C.maxZoom_;var F=false;var H=C.getTilePoint_(I,A,GSize.ZERO);var D=C.getTilePoint_(G,A,GSize.ZERO);while(A>=0&&(H.x!=D.x||H.y!=D.y)){var B=C.getGridCellNoCreate_(H.x,H.y,A);if(B){if(C.removeFromArray(B,E)){C.getGridCellCreate_(D.x,D.y,A).push(E)}}if(A==C.mapZoom_){if(C.isGridPointVisible_(H)){if(!C.isGridPointVisible_(D)){C.removeOverlay_(E);F=true}}else{if(C.isGridPointVisible_(D)){C.addOverlay_(E);F=true}}}H.x=H.x>>1;H.y=H.y>>1;D.x=D.x>>1;D.y=D.y>>1;--A}if(F){C.notifyListeners_()}};MarkerManager.prototype.removeMarker=function(G){var D=this;var E=D.maxZoom_;var C=false;var A=G.getPoint();var F=D.getTilePoint_(A,E,GSize.ZERO);while(E>=0){var B=D.getGridCellNoCreate_(F.x,F.y,E);if(B){D.removeFromArray(B,G)}if(E==D.mapZoom_){if(D.isGridPointVisible_(F)){D.removeOverlay_(G);C=true}}F.x=F.x>>1;F.y=F.y>>1;--E}if(C){D.notifyListeners_()}};MarkerManager.prototype.addMarkers=function(D,C,E){var B=this.getOptMaxZoom_(E);for(var A=D.length-1;A>=0;A--){this.addMarkerBatch_(D[A],C,B)}this.numMarkers_[C]+=D.length};MarkerManager.prototype.getOptMaxZoom_=function(A){return A!=undefined?A:this.maxZoom_};MarkerManager.prototype.getMarkerCount=function(A){var B=0;for(var C=0;C<=A;C++){B+=this.numMarkers_[C]}return B};MarkerManager.prototype.addMarker=function(A,C,E){var D=this;var B=this.getOptMaxZoom_(E);D.addMarkerBatch_(A,C,B);var F=D.getTilePoint_(A.getPoint(),D.mapZoom_,GSize.ZERO);if(D.isGridPointVisible_(F)&&C<=D.shownBounds_.z&&D.shownBounds_.z<=B){D.addOverlay_(A);D.notifyListeners_()}this.numMarkers_[C]++};GBounds.prototype.containsPoint=function(B){var A=this;return(A.minX<=B.x&&A.maxX>=B.x&&A.minY<=B.y&&A.maxY>=B.y)};MarkerManager.prototype.getGridCellCreate_=function(B,C,D){var F=this.grid_[D];if(B<0){B+=this.gridWidth_[D]}var A=F[B];if(!A){A=F[B]=[];return A[C]=[]}var E=A[C];if(!E){return A[C]=[]}return E};MarkerManager.prototype.getGridCellNoCreate_=function(B,C,D){var E=this.grid_[D];if(B<0){B+=this.gridWidth_[D]}var A=E[B];return A?A[C]:undefined};MarkerManager.prototype.getGridBounds_=function(J,B,C,E){B=Math.min(B,this.maxZoom_);var I=J.getSouthWest();var F=J.getNorthEast();var D=this.getTilePoint_(I,B,C);var G=this.getTilePoint_(F,B,E);var A=this.gridWidth_[B];if(F.lng()<I.lng()||G.x<D.x){D.x-=A}if(G.x-D.x+1>=A){D.x=0;G.x=A-1}var H=new GBounds([D,G]);H.z=B;return H};MarkerManager.prototype.getMapGridBounds_=function(){var A=this;return A.getGridBounds_(A.map_.getBounds(),A.mapZoom_,A.swPadding_,A.nePadding_)};MarkerManager.prototype.onMapMoveEnd_=function(){var A=this;A.objectSetTimeout_(this,this.updateMarkers_,0)};MarkerManager.prototype.objectSetTimeout_=function(A,C,B){return window.setTimeout(function(){C.call(A)},B)};MarkerManager.prototype.refresh=function(){var A=this;if(A.shownMarkers_>0){A.processAll_(A.shownBounds_,A.removeOverlay_)}A.processAll_(A.shownBounds_,A.addOverlay_);A.notifyListeners_()};MarkerManager.prototype.updateMarkers_=function(){var B=this;B.mapZoom_=this.map_.getZoom();var A=B.getMapGridBounds_();if(A.equals(B.shownBounds_)&&A.z==B.shownBounds_.z){return }if(A.z!=B.shownBounds_.z){B.processAll_(B.shownBounds_,B.removeOverlay_);B.processAll_(A,B.addOverlay_)}else{B.rectangleDiff_(B.shownBounds_,A,B.removeCellMarkers_);B.rectangleDiff_(A,B.shownBounds_,B.addCellMarkers_)}B.shownBounds_=A;B.notifyListeners_()};MarkerManager.prototype.notifyListeners_=function(){GEvent.trigger(this,"changed",this.shownBounds_,this.shownMarkers_)};MarkerManager.prototype.processAll_=function(A,C){for(var B=A.minX;B<=A.maxX;B++){for(var D=A.minY;D<=A.maxY;D++){this.processCellMarkers_(B,D,A.z,C)}}};MarkerManager.prototype.processCellMarkers_=function(A,C,E,D){var B=this.getGridCellNoCreate_(A,C,E);if(B){for(var F=B.length-1;F>=0;F--){D(B[F])}}};MarkerManager.prototype.removeCellMarkers_=function(B,C,A){this.processCellMarkers_(B,C,A,this.removeOverlay_)};MarkerManager.prototype.addCellMarkers_=function(B,C,A){this.processCellMarkers_(B,C,A,this.addOverlay_)};MarkerManager.prototype.rectangleDiff_=function(A,B,C){var D=this;D.rectangleDiffCoords(A,B,function(F,E){C.apply(D,[F,E,A.z])})};MarkerManager.prototype.rectangleDiffCoords=function(L,M,B){var H=L.minX;var A=L.minY;var F=L.maxX;var J=L.maxY;var I=M.minX;var C=M.minY;var G=M.maxX;var K=M.maxY;for(var D=H;D<=F;D++){for(var E=A;E<=J&&E<C;E++){B(D,E)}for(var E=Math.max(K+1,A);E<=J;E++){B(D,E)}}for(var E=Math.max(A,C);E<=Math.min(J,K);E++){for(var D=Math.min(F+1,I)-1;D>=H;D--){B(D,E)}for(var D=Math.max(H,G+1);D<=F;D++){B(D,E)}}};MarkerManager.prototype.removeFromArray=function(C,E,D){var B=0;for(var A=0;A<C.length;++A){if(C[A]===E||(D&&C[A]==E)){C.splice(A--,1);B++}}return B};ownerUIN=-1;if(document.all){var console={log:function(){}}}var AppFramework=Class.create();AppFramework.ajaxCache={};AppFramework.dialogs={};AppFramework.hideLightBox=function(A,B){AppFramework.beforeHideLightBox();if(typeof B=="function"){B()}Windows.close(A);AppFramework.afterHideLightBox();AppFramework.dialogs[A].destroy();AppFramework.dialogs[A]=null;$(document.getElementsByTagName("html").item(0)).removeClassName("noscroll");AppFramework.positionLightboxBackground(false)};AppFramework.afterHideLightBox=function(){};AppFramework.beforeHideLightBox=function(){};AppFramework.afterShowLightBox=function(){};AppFramework.beforeShowLightBox=function(){};AppFramework.positionLightboxBackground=function(C){if(!Prototype.Browser.Gecko){return false}if(!C){var B=Math.abs(parseInt($(document.getElementsByTagName("body").item(0)).getStyle("margin-top")));$(document.getElementsByTagName("body").item(0)).setStyle({"margin-top":"0px"});if(typeof document.documentElement.scrollTop!=undefined){document.documentElement.scrollTop=B}else{document.body.scrollTop=B}}else{var A=(typeof document.documentElement.scrollTop!=undefined?document.documentElement.scrollTop:document.body.scrollTop);$(document.getElementsByTagName("body").item(0)).setStyle({"margin-top":"-"+A+"px"})}};AppFramework.defaultDialogParams={className:"gen20-lightbox",resizable:false,minimizable:false,maximizable:false,closable:true,draggable:false,width:400,height:300,hideEffect:Element.hide};AppFramework.PAGINATOR_CURRENT_PAGES=Array();AppFramework.positionBusyIndicator=function(){if(Prototype.Browser.IE&&navigator.userAgent.indexOf("MSIE 6")>-1){$("busyIndicator").setStyle({"top":(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)+10+"px","right":"10px"})}};AppFramework.prototype={RESPONSE_ALL_OK:1,RESPONSE_ERROR_JSON:2,RESPONSE_ERROR_RAISED:3,RESPONSE_ERROR_UNKNOWN:4,RESPONSE_NOTICE:5,RESPONSE_EMAIL_UNCONFIRMED:6,RESPONSE_RESULT_OK:1,RESPONSE_RESULT_FAILED:2,URL:"/get",DEBUG:false,id:0,appid:"",scroller:null,scrollEnd:false,debug:function(A){if(typeof console=="undefined"){this.DEBUG=false}if(!this.DEBUG){return }if(typeof A=="undefined"){return }if(A!==null&&typeof A.Debug=="undefined"&&typeof A.Error=="undefined"){if(typeof A=="object"){}else{}return }if(A!==null&&typeof A.Debug!="undefined"&&A.Debug!=null){for(var B=0;B<A.Debug.length;B++){}}if(A!==null&&typeof A.Error!="undefined"&&A.Error!=null){for(var B=0;B<A.Error.length;B++){}}if(A!==null&&typeof A.ParseTime!="undefined"&&A.ParseTime!=null){}},initialize:function(){if(typeof console=="undefined"){this.DEBUG=false}},error:function(A){},checkResponse:function(A){this.debug(A);this.debug(A.responseJSON);if(typeof A=="undefined"){return this.RESPONSE_ERROR_UNKNOWN}if(A.responseJSON==null){return this.RESPONSE_ERROR_JSON}if(typeof A.responseJSON["Error"]!="undefined"){return this.RESPONSE_ERROR_RAISED}if(typeof A.responseJSON["Notice"]!="undefined"){return this.RESPONSE_NOTICE}if(typeof A.responseJSON["UnconfirmedEmail"]!="undefined"){return this.RESPONSE_EMAIL_UNCONFIRMED}return this.RESPONSE_ALL_OK},getWinCloseButton:function(A){return'<div class="win-close-button"><table style="width: 100%"><tr><td style="text-align: center"><a href="#" class="link-button-center ok" onclick="AppFramework.hideLightBox(\''+A+"')\">OK</a></td></tr></table></div>"},sendRequest:function(D,E,F,A,C){if(ownerUIN<0){return }Object.extend(E,{"appid":this.appid,"action":D,"ownerUIN":ownerUIN,"sessionId":AppFramework.sessionId});var B=this.appid+"_"+D;C=C||false;if(!C&&typeof AppFramework.ajaxCache[B]!="undefined"&&AppFramework.ajaxCache[B]!==null){return false}advAJAX.post({url:this.URL,parameters:E,onSuccess:function(H){var G=this.checkResponse(H);if(G!=this.RESPONSE_ALL_OK){return this.showErrorResponse(G,H,A)}F(H.responseJSON[this.appid])}.bind(this),onError:function(G){var H=Lang.ajaxError;this.showLightBoxStatic("alert",'<div class="alert">'+H+"</div>"+this.getWinCloseButton("alert"),{width:250,height:120});(A=="function")&&A(H)}.bind(this),onInitialization:function(G){AppFramework.ajaxCache[B]=true}.bind(this),onFinalization:function(H){try{delete AppFramework.ajaxCache[B]}catch(G){AppFramework.ajaxCache[B]=null}}.bind(this),group:"botmonster anAKiN mickek yacoos^ steven kazek",onGroupEnter:function(){$("busyIndicator").show();AppFramework.positionBusyIndicator()},onGroupLeave:function(){$("busyIndicator").hide()}})},showErrorResponse:function(B,C,A){switch(B){case this.RESPONSE_ERROR_RAISED:this.showLightBoxStatic("alert",'<div class="alert">'+C.responseJSON.Error.toString()+"</div>"+this.getWinCloseButton("alert"),{width:250,height:120});break;case this.RESPONSE_NOTICE:this.showLightBoxStatic("alert",'<div class="alert">'+C.responseJSON.Notice.toString()+"</div>"+this.getWinCloseButton("alert"),{width:250,height:120});break;case this.RESPONSE_EMAIL_UNCONFIRMED:this.showLightBoxStatic("email-unconfirmed",C.responseJSON.UnconfirmedEmail.toString(),{width:350,height:300});break}return typeof A=="function"?A(C.responseJSON[this.appid]):false},addMark:function(B,D,C,A){C=(C>0)?"up":"down";this.id=D;this.appid=B;Event.stop(A||window.event);this.sendRequest("mark",{"mark":C,"id":D,"appid":B},function(E){if($(B+"_markField_"+D)){new Effect.Fade($(B+"_markField_"+D),{afterFinish:function(){Element.replace($(B+"_markField_"+D),E.html);new Effect.Appear($(B+"_markField_"+D))}})}}.bind(this),null,true)},showModerationDialog:function(C,B,A){B=typeof B!="undefined"?B:"";A=typeof A!="undefined"?A:"";this.showLightBox("moderationDialogId","showModerationDialog",{"type":C,"primaryId":B,"extraId":A},{"height":350,"width":450});return false},moderation:function(D,C,A){var B=false;var F="";var E=$F($("moderationDescriptionId"));$$("#moderationFormId input").each(function(G){if(G.checked==true){B=true;F+=G.value+"; "}});if(E.length==0&&!B){$("moderationDescMissingId").show();$("moderationDescriptionId").addClassName("error");return }this.sendRequest("moderation",{"description":F+E,"type":typeof D=="undefined"?"":D,"primaryId":typeof C=="undefined"?"":C,"extraId":typeof A=="undefined"?"":A},function(G){switch(D){case"AVATAR_MODERATION_ENTRY":Element.remove($(D));break;case"BLOG_MODERATION_ENTRY":case"CALENDAR_MODERATION_ENTRY":case"SONG_MODERATION_ENTRY":case"PHOTO_MODERATION_ENTRY":Element.remove($(D+"_"+C));break;case"NAGLOS_MODERATION_ENTRY":break;default:break}AppFramework.hideLightBox("moderationDialogId")}.bind(this))},getIFramePage:function(E,B,A){var D=E.contentWindow.response;if(typeof D=="undefined"){return null}var C=this.checkResponse(D);if(C!=this.RESPONSE_ALL_OK){E.src="";return this.showErrorResponse(C,D,A)}if(D.responseJSON[this.appid].result==this.RESPONSE_RESULT_OK||D.responseJSON[this.appid].result==this.RESPONSE_RESULT_FAILED){E.src="";return B(D.responseJSON[this.appid])}},showLightBox:function(G,B,H,A,I,C){Editor.cancel();var F=null;var D=null;var E=AppFramework.defaultDialogParams;if(H=="undefined"){H={}}if(A!="undefined"){Object.extend(E,A)}this.sendRequest(B,H,function(J){this._showLightbox(G,E,J.html);if(typeof I=="function"){setTimeout(function(){I(J)},100)}}.bind(this),C)},showLightBoxStatic:function(B,A,D,G){Editor.cancel();var F=null;var C=null;var E=AppFramework.defaultDialogParams;D=Object.extend({height:100},D);if(D!="undefined"){Object.extend(E,D)}this._showLightbox(B,E,A);if(typeof G=="function"){setTimeout(G,100)}},_showLightbox:function(B,C,A){AudioPlayerManager.globalStop();AppFramework.beforeShowLightBox();AppFramework.dialogs[B]=win=new Window(B,C);AppFramework.positionLightboxBackground(true);$(document.getElementsByTagName("html").item(0)).addClassName("noscroll");win.getContent().innerHTML=A;win.showCenter(true,0,0);AppFramework.afterShowLightBox()},setPaginatorCurrentPage:function(B,A){if(typeof AppFramework.PAGINATOR_CURRENT_PAGES!="object"){AppFramework.PAGINATOR_CURRENT_PAGES=Array()}AppFramework.PAGINATOR_CURRENT_PAGES[B]=A},getPaginatorCurrentPage:function(A){if(typeof AppFramework.PAGINATOR_CURRENT_PAGES[A]!="undefined"){return AppFramework.PAGINATOR_CURRENT_PAGES[A]}return 0},getAjaxPage:function(B,C,A){var D=this;this.sendRequest(B,C,function(E){if(E.html){Element.update(A,E.html)}if(E.page){D.setPaginatorCurrentPage(A,E.page)}}.bind(this))},createScroller:function(A,B){this.scroller=new Scroller({listHolder:this.appid+"_list",listScrollHolder:this.appid+"_list_scroll",params:{forumId:A},app:this,action:"viewPacket",scrollSpeed:this.scrollSpeed,direction:B,scrollEnd:this.scrollEnd})},scrollLeft:function(A){if(!this.scroller){this.createScroller(A,"left")}this.scroller.scrollDecrease();return false},scrollRight:function(A){if(!this.scroller){this.createScroller(A,"left")}this.scroller.scrollIncrease();return false},scrollUp:function(A){if(!this.scroller){this.createScroller(A,"top")}this.scroller.scrollDecrease();return false},scrollDown:function(A){if(!this.scroller){this.createScroller(A,"top")}this.scroller.scrollIncrease();return false},scrollUpdate:function(B,A){if(!this.scroller){this.createScroller()}this.scroller.scrollUpdate(B,A);return false}};Object.extend(Form,{getArray:function(A){A=$(A);var B=this.getElements(A);var C=new Object();for(var D=0;D<B.length;D++){if(B[D].name){C[B[D].name]=(B[D].type=="select-one")?B[D].options[B[D].selectedIndex].value:$F(B[D])}}return C}});AppFramework.prototype.inPlaceEdit=function(H,C,B){_params=B||{};defaultParams={onSuccess:Prototype.emptyFunction};_params=$H(defaultParams).merge(B);var J=$(H);var E=J.getElementsByClassName("viewer")[0];var G=J.getElementsByClassName("editor")[0];E.hide();G.show();var I=J.getElementsByClassName("saveBtn")[0];I.onclick=function(){var L=J.getElementsByTagName("form")[0];var M=Form.getArray(L);this.sendRequest(C,M,function(N){if(N.content&&N.result==this.RESPONSE_RESULT_OK){J.getElementsByClassName("content")[0].update(N.content);E.show();G.hide();_params.onSuccess(N)}else{this.showLightBoxStatic("alert",'<div class="alert">'+N.errorMsg+"</div>"+this.getWinCloseButton("alert"),{width:250,height:120})}}.bind(this));return false}.bind(this);var K=J.getElementsByClassName("cancelBtn")[0];K.onclick=function(){E.show();G.hide();return false};var A=J.getElementsByTagName("form")[0];if(A){A.onsubmit=I.onclick;var F=$(A).getElementsBySelector('input[type="text"]');if(F.length>0){F[0].focus()}for(var D=0;D<F.length;D++){Event.observe(F[D],"keydown",function(L){if(L.keyCode==Event.KEY_ESC){K.onclick()}}.bind(this))}}return true};var Scroller=Class.create();Object.extend(Scroller.prototype,{initialize:function(B){this.scrollCurrent=0;this.scrollEnd=false;this.scrollActive=false;this.loadingContent=false;this.options={listHolder:"",listScrollHolder:"",app:null,appid:"",action:"",scrollSpeed:6,params:{},preLoad:true,direction:"top",startPage:0,scrollEnd:false,rangeStart:0,rangeEnd:0};for(var C in B){this.options[C]=B[C]}this.options.appid=B.app.appid;this.rangeStart=this.options.rangeStart;this.rangeEnd=this.options.rangeEnd;if(this.options.action!=""){if(this.options.startPage!=0){this.scrollCurrent=B.startPage;this.startPage=B.startPage;this.rangeEnd=B.startPage;this.rangeStart=B.startPage;$(this.options.listScrollHolder).style["visibility"]="hidden";var A=this.options.direction=="left"?"paddingLeft":"paddingTop";var D=(this.options.direction=="top")?$(this.options.listHolder).getHeight():$(this.options.listHolder).getWidth();$(this.options.listScrollHolder).style[this.options.direction]=-D*this.rangeStart+"px";$(this.options.listScrollHolder).style[A]=D*this.rangeStart+"px";$(this.options.listScrollHolder).style["visibility"]="visible"}if(this.options.preLoad){this.rangeEnd=this.rangeStart+1}if(this.options.scrollEnd){this.scrollEnd=this.options.scrollEnd}}else{this.options.preLoad=false;this.scrollEnd=true;this.scrollCurrent=this.options.startPage}},scrollDecrease:function(){if(this.scrollCurrent-1<0||this.scrollActive||this.loadingContent){return false}this.scrollCurrent--;var B=this.options.direction;if(this.scrollCurrent<this.rangeStart){this.scrollGet(this.scrollCurrent,"prev")}var A=(B=="top")?$(this.options.listHolder).getHeight():$(this.options.listHolder).getWidth();var C=$(this.options.listScrollHolder).getStyle(B);C=C==null?0:parseInt(C.substring(0,C.length-2));this.scrollStart($(this.options.listScrollHolder),C,-A*(this.scrollCurrent),+1,B);return false},scrollIncrease:function(){var B=this.options.preLoad?1:0;var A=this.scrollEnd&&(this.scrollCurrent+B>=this.rangeEnd);if(A||this.scrollActive||this.loadingContent){return false}this.scrollCurrent++;if(!this.scrollEnd&&(this.rangeEnd-B<this.scrollCurrent)){this.scrollGet(this.scrollCurrent,"next")}var D=this.options.direction;var C=(D=="top")?$(this.options.listHolder).getHeight():$(this.options.listHolder).getWidth();var E=$(this.options.listScrollHolder).getStyle(D);E=E==null?0:parseInt(E.substring(0,E.length-2));this.scrollStart($(this.options.listScrollHolder),E,-C*(this.scrollCurrent),-1,D);return false},scrollGet:function(C,A){var D={packet:C};for(var B in this.options.params){D[B]=this.options.params[B]}this.loadingContent=true;this.options.app.sendRequest(this.options.action,D,function(G){if(G.scrollEnd){this.scrollEnd=G.scrollEnd}if(A=="next"){new Insertion.Bottom($(this.options.listScrollHolder),G.html);this.rangeEnd++}else{new Insertion.Top($(this.options.listScrollHolder),G.html);var F=(this.options.direction=="top")?$(this.options.listHolder).getHeight():$(this.options.listHolder).getWidth();var E=this.options.direction=="left"?"paddingLeft":"paddingTop";this.rangeStart--;$(this.options.listScrollHolder).style[E]=F*this.rangeStart+"px"}this.loadingContent=false}.bind(this))},scrollStart:function(B,E,A,D,C){if(D*E>D*A){this.scrollActive=false;B.style[C]=A+"px";return }this.scrollActive=true;E=E+D*this.options.scrollSpeed;setTimeout(function(){B.style[C]=E+"px";this.scrollStart(B,E,A,D,C)}.bind(this),10)},scrollUpdate:function(B,A){$(this.options.listScrollHolder).update(B);this.scrollCurrent=0;this.rangeEnd=1;this.scrollEnd=A}});Event.onDOMReady(function(){Event.observe(window,"scroll",function(){AppFramework.positionBusyIndicator()}.bind(this))});var Cookie={options:{path:false,duration:false},set:function(C,D,B){B=$H(this.options).merge(B);D=encodeURIComponent(D);if(B.path){D+="; path="+B.path}if(B.duration){var A=new Date();A.setTime(A.getTime()+B.duration*24*60*60*1000);D+="; expires="+A.toGMTString()}document.cookie=C+"="+D},get:function(A){var B=document.cookie.match("(?:^|;)\\s*"+A+"=([^;]*)");return B?decodeURIComponent(B[1]):false},remove:function(B,A){A=$H(A).merge({duration:-1});this.set(B,"",A)}};var JTemplate=Class.create();Object.extend(JTemplate,{fetch:function(B,A){return new String(B).replace(/{\$([a-z0-9]+)}/gi,function(D,C){if(typeof A[C]=="string"||A[C] instanceof String||typeof A[C]=="number"){return A[C]}return null})}});var AutoSuggest=Class.create();Object.extend(Object.extend(AutoSuggest.prototype,Autocompleter.Base.prototype),AppFramework.prototype);Object.extend(AutoSuggest.prototype,{previousText:"",appid:"Calendar",initialize:function(B,C,A){if(!$(B)){return }this.baseInitialize(B,C,A);this.appid=A.appid},getUpdatedChoices:function(){var A=this.getToken();if(this.previousText==A){return }this.previousText=A;this.sendRequest(this.options.action,{prefix:A},function(B){if(B.html){this.updateChoices(B.html)}}.bind(this))}});var Core=Class.create();Object.extend(Core.prototype,AppFramework.prototype);Object.extend(Core.prototype,{initialize:function(){this.debug(window.ggdebug)},om:function(A){t="";for(i=A.length-1;i>=0;i--){if(A.charAt(i)=="*"){t+="@"}else{t+=A.charAt(i)}}document.location="mailto:"+t},gf:function(A){document.location=A.childNodes[0].href;return false},sendMailConfirmationAgain:function(){this.wait=new Wait("email-unconfirmed");this.wait.show();this.appid="Profile";this.sendRequest("sendMailConfirmationAgain",{},function(A){this.appid="Core";this.wait.hide();if(A.result==this.RESPONSE_RESULT_OK){$("email-unconfirmed_content").innerHTML='<div class="notice">'+A.html+"</div>"+this.getWinCloseButton("email-unconfirmed")}else{$("email-unconfirmed_content").innerHTML='<div class="alert">'+A.html+"</div>"+this.getWinCloseButton("email-unconfirmed")}}.bind(this),function(A){this.appid="Core";this.wait.hide()}.bind(this));return false},saveOnlyEmail:function(){this.wait=new Wait("email-unconfirmed");this.wait.show();this.appid="Profile";this.sendRequest("saveOnlyEmail",{email:$("changed-email").value},function(A){this.appid="Core";this.wait.hide();if(A.result==this.RESPONSE_RESULT_FAILED){$("errorEmail").innerHTML=A.errorEmail}else{$("email-unconfirmed_content").innerHTML='<div class="notice">'+A.html+"</div>"+this.getWinCloseButton("email-unconfirmed")}}.bind(this),function(){this.wait.hide();this.appid="Core"}.bind(this));return false},addBookmark:function(B,A){if(window.sidebar){window.sidebar.addPanel(B,A,"")}else{if(window.external){window.external.addFavorite(A,B)}else{if(window.opera&&window.print){$("add-as-homepage").style.display="none"}}}}});Event.onDOMReady(function(){core=new Core()});var Login=Class.create();Object.extend(Login.prototype,AppFramework.prototype);Object.extend(Login.prototype,{appid:"Login",wait:null,initialize:function(){},loginStart:function(A){$("busyIndicator").show();this.wait=new Wait("login-content");this.wait.show();A.submit();setTimeout(function(){try{Form.disable(A)}catch(B){}},10);return true},loginFinished:function(C,B){if(typeof B=="undefined"){B=false}var A=this.getIFramePage(C);if(A){if(A.loginOk!=true){this.wait.hide();$(B?"loginErrorLightbox":"loginError").show();$(B?"passwordIdLightbox":"passwordId").value="";$(B?"loginIdLightbox":"loginId").addClassName("error");$(B?"passwordIdLightbox":"passwordId").addClassName("error");if(A.countIncorrect>=3){this.handleCountIncorrect(B?"countErrorLightbox":"countError")}Form.enable(B?"loginFormLightbox":"loginForm")}else{$(B?"loginErrorLightbox":"loginError").hide();$(B?"countErrorLightbox":"countError").hide();if(B&&!A.requestProfileUpdate){window.location.reload(true)}else{window.location.replace(A.redirect)}}}$("busyIndicator").hide()},doLogout:function(){this.sendRequest("doLogout",{},function(A){window.location=window.location}.bind(this))},handleCountIncorrect:function(A){return true},showLoginLightbox:function(){this.showLightBox("loginLightbox","viewLoginLightbox",{},{width:300,height:225},function(){$("loginIdLightbox").focus()});return false},hideLoginLightbox:function(){AppFramework.hideLightBox("loginLightbox")}});Event.onDOMReady(function(){login=new Login()});Wait=function(A){this.initialize(A)};Object.extend(Wait.prototype,{container:null,waitNode:null,textNode:null,visible:true,initialize:function(A){this.container=$(A);this.overflow=this.container.style.overflow;var B=document.createElement("DIV");this.textNode=document.createElement("P");Element.addClassName(B,"wait");this.waitNode=document.body.appendChild(B);B.appendChild(this.textNode);$(this.textNode).hide();Event.observe(this.waitNode,"click",function(C){Event.stop(C)});this.hide()},show:function(){if(this.visible){return }this.visible=true;this.container.style.overflow="hidden";this._updateDimentions();$(this.waitNode).show();$(this.textNode).hide();this._updateDimentions();var A=document.getElementsByClassName("gen20-lightbox_close")[0];if(A){A.onclick=null}},update:function(A){$(this.textNode).update(A.toString());if(A==""){$(this.textNode).hide()}else{$(this.textNode).show()}},hide:function(){if(!this.visible){return }this.visible=false;this.update("");this.container.style.overflow=this.overflow;Element.hide(this.waitNode)},visible:function(){return this.visible},_updateDimentions:function(){var B=Element.getDimensions(this.container);var A=Position.cumulativeOffset(this.container);if(document.all){Position.clone(this.container,this.waitNode)}else{Element.setStyle(this.waitNode,{height:B.height+"px",width:B.width+"px",left:A[0]+"px",top:A[1]+"px"})}}});var Help=Class.create();Object.extend(Help.prototype,AppFramework.prototype);Object.extend(Help.prototype,{appid:"Help",helpPressed:false,help4helpMsg:null,msgs:new Array(),viewHelpForApp:function(A){if(this.helpPressed){this.showLightBoxStatic("Help4Help_lightbox",this.help4help+this.getWinCloseButton("Help4Help_lightbox"),{height:200});return }this.sendRequest("getHelpBoxes",{"appId":A},function(C){this.helpPressed=true;if(C.result==true){for(var H=0;H<C.boxes.length;H++){if(C.boxes[H].lightbox==true){var D="onclick"}else{var D="onmouseover"}if(typeof ($(C.boxes[H].id))=="undefined"){continue}if($(C.boxes[H].id)==null){continue}var B=(C.boxes[H].mini)?C.minihelp:C.bighelp;var E='<div class="autohelp" id="'+C.boxes[H].msg+'_hlp"><a href="#" onmouseout="help.hideHelp(); return false;" '+D+'="help.showHelpId(';var G='); return false;"><img src="'+B+'" alt="pomoc" /></a></div>';var F=E+"'"+C.boxes[H].msg+"', '"+C.boxes[H].lightbox+"'"+G;switch(C.boxes[H].placement){case"placed":Element.update($(C.boxes[H].id),F);$(C.boxes[H].id).style.display="inline";break;case"after":new Insertion.After($(C.boxes[H].id),F);break;case"before":new Insertion.Before($(C.boxes[H].id),F);break;case"top":new Insertion.Top($(C.boxes[H].id),F);break;case"bottom":new Insertion.Bottom($(C.boxes[H].id),F);break}}this.help4help=C.help4help;this.showLightBoxStatic("Help4Help_lightbox",C.help4help+this.getWinCloseButton("Help4Help_lightbox"),{height:200,width:350})}else{alert("Wyswietlanie HELPa niepowiod??o sie")}}.bind(this))},showHelpId:function(C,B){var A=$(C+"_hlp");if(B=="true"){this.lightBoxShown=true;this.showLightBox("HelpBox","getHelpMsgForBox",{"msgId":C},{height:300});return }if(typeof (this.msgs[C])!="undefined"){this.showTooltip(A,this.msgs[C]);return }this.sendRequest("getHelpMsg",{"msgId":C},function(D){if(D.result==true){this.showTooltip(A,D.helpMsg);this.msgs[C]=D.helpMsg}else{alert("Wy??wietlenie pomocy nie uda??o si??")}}.bind(this))},hideBox:function(){AppFramework.hideLightBox("HelpBox")},showTooltip:function(A,D){var C=$("tooltip");var B=Position.cumulativeOffset(A);C.style.display="none";Element.update($("msgForTooltip"),D);C.style.left=B[0]+40+"px";C.style.top=B[1]+"px";C.style.display="block";return false},hideHelp:function(){if(typeof ($("tooltip"))=="undefined"){return }$("tooltip").style.display="none"}});Event.onDOMReady(function(){help=new Help()});var AdvSelectBox=Class.create();Object.extend(AdvSelectBox.prototype,{bindedCloseSelectbox:null,initialize:function(){},init:function(){this.hide_options();this.registerGlobalEvents();this.registerObserveOption()},hide_options:function(){var A=document.getElementsByClassName("adv-select");for(var B=0;B<A.length;B++){_temp=A[B];Element.addClassName(_temp,"hidden_selectbox");var C=_temp.getElementsByTagName("DIV")[0];C.style.display="none"}},open:function(C){var A=C.parentNode;var B=A.getElementsByTagName("DIV")[0];if(Element.hasClassName(A,"hidden_selectbox")){A.removeClassName("hidden_selectbox");B.style.display="block";if(!this.bindedCloseSelectbox){this.bindedCloseSelectbox=this.closeSelectBox.bindAsEventListener(this)}Event.observe(document,"click",this.bindedCloseSelectbox)}else{A.addClassName("hidden_selectbox");B.style.display="none";Event.stopObserving(document,"click",this.bindedCloseSelectbox)}return false},selectOption:function(C){var G=C.getAttribute("value");var H=C.firstChild.nodeValue;var F=C.parentNode.parentNode;var A=F.getElementsByTagName("input");var E=$("szukaj-button-submit");var B=A[0];var D=F.getElementsByTagName("a")[1];if(E){E.update(H)}if(B){B.value=G}},submit:function(){$("search-form").submit()},observeOption:function(C){var B=Event.element(C);var A=Event.findElement(C,"DIV");this.selectOption(B);A.style.display="none";Element.addClassName(A.parentNode,"hidden_selectbox");Event.stop(C);Event.stopObserving(document,"click",this.bindedCloseSelectbox)},optionMouseOn:function(B){var A=Event.element(B);Element.addClassName(A,"hover")},optionMouseOut:function(B){var A=Event.element(B);Element.removeClassName(A,"hover")},closeSelectBox:function(E){var D=$(Event.element(E));if(D.tagName=="A"&&D.hasClassName("adv-opener")){return false}var F=document.getElementsByClassName("adv-select");for(var C=0;C<F.length;C++){var A=F[C];A.addClassName("hidden_selectbox");var B=A.getElementsByTagName("DIV")[0];B.hide();Event.stopObserving(document,"click",this.bindedCloseSelectbox)}},registerObserveOption:function(){var F=document.getElementsByClassName("adv-dropdown");for(var D=0;D<F.length;D++){var B=F[D];var A=B.getElementsByTagName("A");for(var C=0;C<A.length;C++){var E=A[C];Event.observe(E,"click",(this.observeOption.bind(this)));Event.observe(E,"mouseover",(this.optionMouseOn.bind(this)));Event.observe(E,"mouseout",(this.optionMouseOut.bind(this)))}}},registerGlobalEvents:function(){}});Event.onDOMReady(function(){advselectbox=new AdvSelectBox();advselectbox.init()});var IE=document.all&&!window.opera;var OPERA=window.opera;var FF3=(navigator.oscpu&&navigator.userAgent.match("rv:1.9"))?true:false;Editor=Class.create();Editor.INIT_VALUE='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"><style type="text/css">body { margin: 10px; cursor: text; font-family: Verdana; font-size: 9pt; background-color: #ffffff } p { margin: 0 } br { clear: both } </style></head><body></body></html>';if(!FF3){Editor.INIT_VALUE=Editor.INIT_VALUE.replace("<body></body>",'<body contenteditable="true"></body>')}Editor.TOOLBAR={"default":["bold","italic","underline",null,"justifyLeft","justifyCenter","justifyRight","insertOrderedList","insertUnorderedList",null,"color","emoticon","image","video"],"comment":["bold","italic","underline",null,"justifyLeft","justifyCenter","justifyRight","insertOrderedList","insertUnorderedList",null,"color","emoticon"],"contestComment":["bold","italic","underline",null,"justifyLeft","justifyCenter","justifyRight","insertOrderedList","insertUnorderedList",null,"color","emoticon","image"],"g20":["bold","italic","underline",null,"justifyLeft","justifyCenter","justifyRight","insertOrderedList","insertUnorderedList",null,"color","emoticon","video"]};Editor.EMOTICONS=Lang.emoticonList;Editor._plugins=new Array;Editor._instances={};Editor.activeEditor=null;Editor.setActive=function(A){Editor.activeEditor=A};Editor.getActive=function(){return Editor.activeEditor};Editor.populate=function(A,B){if(typeof Editor._instances[A]=="undefined"){return false}Editor._instances[A].submit();if(B){Editor._instances[A].destroy();delete Editor._instances[A]}};Editor.disable=function(B,A){if(typeof Editor._instances[B]=="undefined"){return false}Editor._instances[B].enableToolbar(!A)};Editor.cancel=function(){if(null!==$("editorEmoticonPanel")){$("editorEmoticonPanel").style.display="none"}if(null!==$("editorColorPanel")){$("editorColorPanel").style.display="none"}if(null!==$("editorImagePanel")){$("editorImagePanel").style.display="none"}if(null!==$("editorVideoPanel")){$("editorVideoPanel").style.display="none"}};Object.extend(Editor.prototype,{targetTextarea:null,topContainer:null,iframe:null,button:{},doRepaint:false,initialize:function(L,C){var D=L;C=C||"default";if(typeof Editor.TOOLBAR[C]=="undefined"){C="default"}Editor._instances[L]=this;this.targetTextarea=$(L);if(!this.targetTextarea||!this.targetTextarea.form){return false}this.topContainer=document.createElement("div");Element.addClassName(this.topContainer,"Editor_container");var B=document.createElement("div");Element.addClassName(B,"Editor_toolbar");var M=function(O){var N=Event.element(O);this.triggerEvent(N.name,O)}.bindAsEventListener(this);for(var H=0,E=Editor.TOOLBAR[C];H<E.length;H++){if(E[H]===null){continue}var I=document.createElement("button");I.name=E[H];Element.addClassName(I,E[H]);this.button[E[H]]=I;Event.observe(I,"click",M);B.appendChild(I)}this.topContainer.appendChild(B);B=document.createElement("div");Element.addClassName(B,"Editor_content");var G=document.createElement("iframe");G.frameBorder="0";G.setAttribute("usecss","0");G.setAttribute("strict_output","1");G.setAttribute("content_type","text/html");B.appendChild(G);this.topContainer.appendChild(B);Element.hide(this.targetTextarea);this.targetTextarea.parentNode.insertBefore(this.topContainer,this.targetTextarea);this.iframe=G;var A=G.contentWindow.document;A.open();A.write(Editor.INIT_VALUE);A.close();if(this.targetTextarea.value!=""){if(!IE){A.body.innerHTML=this.targetTextarea.value}else{setTimeout(function(){A.body.innerHTML=this.targetTextarea.value}.bind(this),0)}}try{if(typeof G.contentDocument!="undefined"){G.contentDocument.designMode="On"}if(typeof G.contentWindow!="undefined"){G.contentWindow.document.designMode="On"}}catch(K){}try{A.execCommand("useCSS",false,true);A.execCommand("styleWithCSS",false,false)}catch(K){}if(!IE){Event.observe(A.body,"mouseup",function(){this.repaint(true)}.bind(this));Event.observe(A,"keyup",function(N){this.repaint(true)}.bind(this))}else{setTimeout(function(){A.body.onclick=function(){this.repaint(true)}.bind(this);A.onkeyup=function(N){this.repaint(true)}.bind(this)}.bind(this),0)}if(!OPERA){Event.observe(A,"keydown",this.handleKey.bindAsEventListener(this))}else{A.onkeypress=function(N){this.handleKey(N)}.bind(this)}Event.observe(this.targetTextarea.form,"submit",this.submit.bindAsEventListener(this));if(OPERA){var J=function(){this.focus();Event.stopObserving(A,"click",J)}.bind(this);Event.observe(A,"click",J)}this.createGraphicPanels();setTimeout(function(){this.repaint()}.bind(this),0);if(Editor._plugins.length){for(var H=0;H<Editor._plugins.length;H++){var F=new Function("textareaId","toolbarScheme","this.initialize"+Editor._plugins[H]+"(textareaId, toolbarScheme)").bind(this);F(L,C)}}},createGraphicPanels:function(){var G='<div class="line"></div>';if($("editorColorPanel")===null){var M=document.createElement("div");M.innerHTML=G;M.id="editorColorPanel";M.style.display="none";document.body.appendChild(M);var T=document.createElement("table");T.className="content";M.appendChild(T);T.appendChild(document.createElement("thead"));var B=document.createElement("tbody");T.appendChild(B);var C=document.createElement("tr");var H=85;for(var N=0;N<=255;N+=H){if(N>1){B.appendChild(C);var C=document.createElement("tr")}for(g=0;g<=255;g+=H){for(b=0;b<=255;b+=H){var P=((N==0)?"00":N.toString(16))+((g==0)?"00":g.toString(16))+((b==0)?"00":b.toString(16));var J=document.createElement("td");J.bgColor="#"+P;J.onmousedown=function(){Editor.getActive().triggerEvent("color_click",null,this.bgColor)};C.appendChild(J)}}}B.appendChild(C)}if($("editorEmoticonPanel")===null){var M=document.createElement("div");M.innerHTML=G;M.id="editorEmoticonPanel";M.style.display="none";document.body.appendChild(M);var T=document.createElement("table");T.className="content";M.appendChild(T);T.appendChild(document.createElement("thead"));var B=document.createElement("tbody");T.appendChild(B);var U=document.createElement("tr");for(var K=0;K<7;K++){var E=document.createElement("td");if(K==6){var F=document.createElement("button");F.className="close";Event.observe(F,"click",function(W){$("editorEmoticonPanel").style.display="none"});E.appendChild(F)}U.appendChild(E)}B.appendChild(U);var C=document.createElement("tr");var S=1;var O="/img/"+Lang.id+"/emoticons/";for(var Q in Editor.EMOTICONS){var J=document.createElement("td");var V=document.createElement("img");V.src=O+Q+".gif";if(Editor.EMOTICONS[Q] instanceof Array){V.title=Editor.EMOTICONS[Q][0];V.name=J.name=Editor.EMOTICONS[Q][1]}else{V.title=Editor.EMOTICONS[Q];J.name=V.name="&lt;"+Editor.EMOTICONS[Q]+"&gt;"}Event.observe(J,"mouseover",function(W){Element.addClassName(Event.findElement(W,"TD"),"on")});Event.observe(J,"mouseout",function(W){Element.removeClassName(Event.findElement(W,"TD"),"on")});Event.observe(J,"click",function(W){Editor.getActive().triggerEvent("emoticon_click",null,this.name)}.bind(V));J.appendChild(V);C.appendChild(J);if(S++==7){B.appendChild(C);C=document.createElement("tr");S=1}}B.appendChild(C)}if($("editorImagePanel")===null){var M=document.createElement("div");M.innerHTML=G;M.id="editorImagePanel";M.style.display="none";var D=document.createElement("div");D.className="content";M.appendChild(D);this.createImagePanel(D);document.body.appendChild(M)}if($("editorVideoPanel")===null){var M=document.createElement("div");M.innerHTML=G;M.id="editorVideoPanel";M.style.display="none";var D=document.createElement("div");D.className="content";M.appendChild(D);var T=document.createElement("table");T.className="toolbar";D.appendChild(T);T.appendChild(document.createElement("thead"));var B=document.createElement("tbody");T.appendChild(B);var C=document.createElement("tr");var J=document.createElement("td");var F=document.createElement("button");F.className="close";Event.observe(F,"click",function(W){$("editorVideoPanel").style.display="none"});J.appendChild(F);C.appendChild(J);B.appendChild(C);var I=document.createElement("h3");I.innerHTML=Lang.insertVideo;D.appendChild(I);var R=document.createElement("span");R.innerHTML=Lang.insertVideoDesc;D.appendChild(R);var L=document.createElement("input");L.id="editorVideoPanelInput";D.appendChild(L);var A=document.createElement("button");A.innerHTML=Lang.Ok;Event.observe(A,"click",function(W){Editor.getActive().triggerEvent("video_click",null,this.value)}.bind(L));D.appendChild(A);document.body.appendChild(M)}},createImagePanel:function(E){var B=document.createElement("h3");B.innerHTML=Lang.insertImage;E.appendChild(B);var D=document.createElement("span");D.innerHTML=Lang.insertImageDesc;E.appendChild(D);var A=document.createElement("input");A.id="editorImagePanelInput";E.appendChild(A);var C=document.createElement("button");C.innerHTML=Lang.Ok;Event.observe(C,"click",function(F){Editor.getActive().triggerEvent("image_click",null,this.value)}.bind(A));E.appendChild(C)},hidePanels:function(){$("editorColorPanel").style.display="none";$("editorEmoticonPanel").style.display="none";$("editorImagePanel").style.display="none";$("editorVideoPanel").style.display="none"},handleKey:function(A){this.doRepaint=false;if(!A.ctrlKey){return }switch(A.keyCode){case 98:case 66:this.triggerEvent("bold",A);Event.stop(A);break;case 117:case 85:this.triggerEvent("underline",A);Event.stop(A);break;case 105:case 73:this.triggerEvent("italic",A);Event.stop(A);break}},_selection:null,triggerEvent:function(B,G,I){Editor.setActive(this);var A=this.iframe.contentWindow.document;switch(B){case"bold":A.execCommand("bold",false,null);this.toggle(B);break;case"underline":A.execCommand("underline",false,null);this.toggle(B);break;case"italic":A.execCommand("italic",false,null);this.toggle(B);break;case"justifyLeft":case"justifyCenter":case"justifyRight":case"insertOrderedList":case"insertUnorderedList":A.body.focus();A.execCommand(B,false,null);this.toggle(B);break;case"cite":var D=null;if(window.getSelection){D=window.getSelection()}else{if(document.getSelection){D=document.getSelection()}else{if(document.selection){D=document.selection.createRange().text}}}D=new String(D);if(D.length==0){break}D=D.split("\n");var F=[];for(var C=0;C<D.length;C++){F.push("&gt; "+D[C]+"<br />")}F="<br />"+F.join("");if(IE){A.selection.createRange().pasteHTML(F)}else{A.execCommand("insertHTML",false,F)}break;case"image":case"video":case"color":case"emoticon":var H;switch(B){case"color":H=$("editorColorPanel");break;case"emoticon":H=$("editorEmoticonPanel");break;case"image":H=$("editorImagePanel");$("editorImagePanelInput").value="";break;case"video":H=$("editorVideoPanel");$("editorVideoPanelInput").value="";break}if(document.selection){this._selection=A.selection.createRange()}if(H.style.display=="block"){H.style.display="none";break}this.hidePanels();this.button[B].blur();var E=this.getPosition(this.button[B]);H.style.left=E[0]+"px";H.style.top=(E[1]+26)+"px";H.style.display="block";break;case"color_click":setTimeout(function(){this.iframe.contentWindow.focus();if(this._selection!==null){this._selection.select()}A.execCommand("forecolor",false,I);$("editorColorPanel").style.display="none";this.toggle("color")}.bind(this),0);return ;case"emoticon_click":if(IE){A.selection.createRange().pasteHTML(I)}else{A.execCommand("insertHTML",false,I)}$("editorEmoticonPanel").style.display="none";break;case"image_click":if(I!=""){if(IE&&this._selection!==null){this._selection.select()}A.execCommand("insertimage",false,I)}$("editorImagePanel").style.display="none";break;case"video_click":if(I!=""){this.triggerEvent("insert_html",null,"<br>["+I+"]<br>")}else{this.triggerEvent("insert_html",null,"")}$("editorVideoPanel").style.display="none";break;case"insert_html":if(I!=""){if(IE){try{this.iframe.contentWindow.focus();this.iframe.contentWindow.ownerDocument.defaultView.focus()}catch(G){}if(this._selection!==null){this._selection.select()}A.selection.createRange().pasteHTML(I)}else{A.execCommand("insertHTML",false,I)}}break}setTimeout(function(){this.focus()}.bind(this),0);this.repaint();(G!==null)&&Event.stop(G)},getPosition:function(C){var A=Position.cumulativeOffset(C);C=C.parentNode;while(C){try{if(C.style.overflow=="auto"||C.style.overflowY=="auto"){A[1]-=C.scrollTop;A[0]-=C.scrollLeft}C=C.parentNode}catch(B){break}}return A},focus:function(){document.body.focus();var A=this.iframe;if(window.opera){A.focus();return }try{A.contentWindow.focus();A.contentWindow.ownerDocument.defaultView.focus()}catch(B){}this.resize()},onOff:function(A,B){if(typeof B=="undefined"){B=!Element.hasClassName(this.button[A],"down")}if(B){Element.addClassName(this.button[A],"down")}else{Element.removeClassName(this.button[A],"down")}},toggle:function(A){this.onOff(A)},enableToolbar:function(A){A=A?"":"disabled";for(var B in this.button){this.button[B].disabled=A}},resized:false,resize:function(){if(!this.resized&&(this.iframe.contentWindow.scrollMaxY>0||this.iframe.contentWindow.document.body.scrollHeight>this.iframe.clientHeight)){this.resized=true;this.iframe.style.height=(this.iframe.clientHeight*2)+"px"}},repaint:function(D){if(!this.doRepaint&&typeof D=="undefined"){return }this.resize();this.doRepaint=false;if(IE||OPERA){var C=this.iframe.contentWindow.document.selection;var B=C.type=="Control"?C.createRange().item(0):C.createRange().parentElement()}else{try{var C=this.iframe.contentWindow.getSelection();var F=C.getRangeAt(0)}catch(E){return }var G=F.commonAncestorContainer;var B=G;while(B){if(F.intersectsNode(B)){if(B.nodeType==Node.TEXT_NODE){B=B.parentNode}break}B=B.nextSibling}}for(var A in this.button){this.onOff(A,false)}while(B){if(B.tagName=="BODY"){break}switch(B.tagName){case"B":case"STRONG":this.onOff("bold",true);break;case"U":this.onOff("underline",true);break;case"I":case"EM":this.onOff("italic",true);break;case"FONT":this.onOff("color");break;case"OL":this.onOff("insertOrderedList",true);break;case"UL":this.onOff("insertUnorderedList",true);break;case"LI":if(B.parentNode.tagName=="OL"){this.onOff("insertOrderedList",true)}else{this.onOff("insertUnorderedList",true)}break}if(typeof B.align!="undefined"){switch(B.align){case"left":this.onOff("justifyLeft");break;case"right":this.onOff("justifyRight");break;case"center":this.onOff("justifyCenter");break}}B=B.parentNode}return },submit:function(){try{this.targetTextarea.value=this.iframe.contentWindow.document.body.innerHTML}catch(A){}},destroy:function(){Element.remove(this.iframe);Element.remove(this.topContainer);try{delete this}catch(A){}},insertContent:function(B){var A=this.iframe.contentWindow.document;A.execCommand("insertHTML",false,B)}});Windows.addObserver({"onDestroy":function(){Editor.cancel()}});var Lso={cookieName:"gemius_stat_id",containerName:"lsoContainer",pageContainerName:"container-page",functionName:"Lso.writeCookie",banMessageCookie:"lso_message_ban",flashBlockedMessage:"lso_message_flash",paramName:"funName",intervalId:null,intervalTime:5000,checkCookie:function(){if(Cookie.get(Lso.cookieName)===false){Lso.runFlash()}if(Lso.intervalId==null){Lso.startProbing()}if(Cookie.get(Lso.banMessageCookie)){Lso.runBanMessage()}if(Cookie.get(Lso.flashBlockedMessage)){Lso.runFlashBlockedMessage()}},runBanMessage:function(){var A=new AppFramework();A.showLightBoxStatic(15,'<div class="lsoMessage">'+Lang.yourBanned+"</div>");Cookie.remove(Lso.banMessageCookie)},runFlashBlockedMessage:function(){var A=new AppFramework();A.showLightBoxStatic(15,'<div class="lsoMessage">'+Lang.blockedFlash+"</div>");Cookie.remove(Lso.flashBlockedMessage)},runFlash:function(){lsoObject=new SWFObject("/img/lsocookie.swf","lsomovie","1","1","9","#ffffff");lsoObject.addVariable(Lso.paramName,Lso.functionName);var A=document.createElement("div");A.id=Lso.containerName;A.style.width="1px";A.style.height="1px";A.style.position="absolute";var B=document.body;B.appendChild(A);lsoObject.write(Lso.containerName)},writeCookie:function(B){Cookie.set(Lso.cookieName,B,{duration:30});var A=document.getElementById(Lso.containerName);var C=document.body;C.removeChild(A)},startProbing:function(){Lso.intervalId=window.setInterval(Lso.checkCookie,Lso.intervalTime)},stopProbing:function(){window.clearInterval(Lso.intervalId)}};Event.onDOMReady(function(){Lso.checkCookie()});Event.observe(window,"unload",function(){Lso.stopProbing()});if(typeof deconcept=="undefined"){var deconcept=new Object()}if(typeof deconcept.util=="undefined"){deconcept.util=new Object()}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object()}deconcept.SWFObject=function(K,B,L,D,H,I,F,E,C,J){if(!document.getElementById){return }this.DETECT_KEY=J?J:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(K){this.setAttribute("swf",K)}if(B){this.setAttribute("id",B)}if(L){this.setAttribute("width",L)}if(D){this.setAttribute("height",D)}if(H){this.setAttribute("version",new deconcept.PlayerVersion(H.toString().split(".")))}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true}if(I){this.addParam("bgcolor",I)}var A=F?F:"high";this.addParam("quality",A);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var G=(E)?E:window.location;this.setAttribute("xiRedirectUrl",G);this.setAttribute("redirectUrl","");if(C){this.setAttribute("redirectUrl",C)}};deconcept.SWFObject.prototype={useExpressInstall:function(A){this.xiSWFPath=!A?"expressinstall.swf":A;this.setAttribute("useExpressInstall",true)},setAttribute:function(A,B){this.attributes[A]=B},getAttribute:function(A){return this.attributes[A]},addParam:function(B,A){this.params[B]=A},getParams:function(){return this.params},addVariable:function(B,A){this.variables[B]=A},getVariable:function(A){return this.variables[A]},getVariables:function(){return this.variables},getVariablePairs:function(){var C=new Array();var B;var A=this.getVariables();for(B in A){C[C.length]=B+"="+A[B]}return C},getSWFHTML:function(){var B="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath)}B='<embed type="application/x-shockwave-flash" src="'+this.getAttribute("swf")+'" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+this.getAttribute("style")+'"';B+=' id="'+this.getAttribute("id")+'" name="'+this.getAttribute("id")+'" ';var F=this.getParams();for(var E in F){B+=[E]+'="'+F[E]+'" '}var D=this.getVariablePairs().join("&");if(D.length>0){B+='flashvars="'+D+'"'}B+="/>"}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath)}B='<object id="'+this.getAttribute("id")+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+this.getAttribute("style")+'">';B+='<param name="movie" value="'+this.getAttribute("swf")+'" />';var C=this.getParams();for(var E in C){B+='<param name="'+E+'" value="'+C[E]+'" />'}var A=this.getVariablePairs().join("&");if(A.length>0){B+='<param name="flashvars" value="'+A+'" />'}B+="</object>"}return B},write:function(B){if(this.getAttribute("useExpressInstall")){var A=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(A)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title)}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var C=(typeof B=="string")?document.getElementById(B):B;C.innerHTML=this.getSWFHTML();return true}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"))}}return false}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var E=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var A=navigator.plugins["Shockwave Flash"];if(A&&A.description){E=new deconcept.PlayerVersion(A.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."))}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var B=1;var C=3;while(B){try{C++;B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+C);E=new deconcept.PlayerVersion([C,0,0])}catch(D){B=null}}}else{try{var B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(D){try{var B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");E=new deconcept.PlayerVersion([6,0,21]);B.AllowScriptAccess="always"}catch(D){if(E.major==6){return E}}try{B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(D){}}if(B!=null){E=new deconcept.PlayerVersion(B.GetVariable("$version").split(" ")[1].split(","))}}}return E};deconcept.PlayerVersion=function(A){this.major=A[0]!=null?parseInt(A[0]):0;this.minor=A[1]!=null?parseInt(A[1]):0;this.rev=A[2]!=null?parseInt(A[2]):0};deconcept.PlayerVersion.prototype.versionIsValid=function(A){if(this.major<A.major){return false}if(this.major>A.major){return true}if(this.minor<A.minor){return false}if(this.minor>A.minor){return true}if(this.rev<A.rev){return false}return true};deconcept.util={getRequestParameter:function(C){var D=document.location.search||document.location.hash;if(C==null){return D}if(D){var B=D.substring(1).split("&");for(var A=0;A<B.length;A++){if(B[A].substring(0,B[A].indexOf("="))==C){return B[A].substring((B[A].indexOf("=")+1))}}}return""}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var B=document.getElementsByTagName("OBJECT");for(var C=B.length-1;C>=0;C--){B[C].style.display="none";for(var A in B[C]){if(typeof B[C][A]=="function"){B[C][A]=function(){}}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs)};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true}}if(!document.getElementById&&document.all){document.getElementById=function(A){return document.all[A]}}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;var EventSystem=Class.create();Object.extend(EventSystem.prototype,AppFramework.prototype);EventSystem.WINDOW_STATE_IDLE=0;EventSystem.WINDOW_STATE_BLURED=1;EventSystem.WINDOW_STATE_FOCUSED=2;EventSystem.TIMEOUT_PAGE_LOAD=7000;EventSystem.TIMEOUT_LOOP=30000;EventSystem.EVENTS_PER_PAGE=4;EventSystem.STATUS_OK=1;EventSystem.ED_STATUS_ERROR=0;EventSystem.TEXT_LEN=55;EventSystem.TEXT_CONTINUATION="&hellip;";EventSystem.NOTIFY_SHOW=1;EventSystem.NOTIFY_TIMEOUT=4500;EventSystem.NOTIFY_MAX_COUNT=5;EventSystem.TPL_CONTAINER='<div id="eventsystem-list"><div id="event-notifiers"></div><div class="panel-bottom"><div class="panel"><div id="icons-menu"><a href="#" class="close-option" onclick="return eventsystem.listClose();"></a><a href="#" id="maximize-option" {$maximalizeVisibility} class="maximize-option" onclick="return eventsystem.switchVisibility();"></a><a href="#" id="minimize-option" {$minimalizeVisibility} class="minimize-option" onclick="return eventsystem.switchVisibility();"></a><a href="{$urlPanel}" class="settings-option"></a></div><div id="panel-header"><h1> <strong> '+Lang.eventlistHeader+' </strong> ({$counter}) </h1></div><div id="event-list-showhide-container" {$visibilityStatus}><div id="event-list">{$events}</div><div id="event-list-paginator">{$pagination}</div><div id="delete-all-events-wrapper" onclick="return eventsystem.deleteAllEvents();"><div class="tl"><div class="tr"><div id="delete-all-events">'+Lang.eventlistDeleteAll+"</div></div></div></div></div></div></div></div>";EventSystem.TPL_EVENT_ENTITY='<div class="event-entity e{$type}" id="ee{$id}"><div class="avatar"><div onclick="window.location=\'{$senderLink}\'; return true;" class="avatar-img" style="background-image : url(\'{$senderImg}\');"></div></div><div class="nick">{$senderName} :</div><div class="date">{$date}</div><div class="description" onclick="window.location=\'{$eventUrl}\'; return true;">{$description} <a class="more" href="{$eventUrl}">&raquo;&raquo;</a></div><div class="stopfloating"></div><div class="bottom-container"><a class="chat" href="gg:{$senderId}"></a><div class="entity-panel"><div class="tl"><div class="tr"><a title="'+Lang.eventlistBlockTypeTooltip+'" href="#" class="block-type" onclick="return eventsystem.blockType(\'{$type}\');">'+Lang.eventlistBlockType+'</a><a title="'+Lang.eventlistBlockUserTooltip+'" href="#" onclick="return eventsystem.blockUser(\'{$senderId}\', \'{$senderType}\');" class="block-user">'+Lang.eventlistBlockUser+'</a><a title="'+Lang.eventDelete+'" class="delete-event" href="#" onclick="return eventsystem.deleteEvent(\'{$id}\');"></a></div></div></div><div class="stopfloating"></div></div></div>';EventSystem.TPL_PAGINATOR='<div class="paginator">{$pages}</div>';EventSystem.TPL_PAGE_ENTITY='<a  href="#" onclick="{$onclick}" class="{$class}">{$content}</a>';EventSystem.TPL_PAGE_SHOW_PAGE="return eventsystem.showPage({$pageNo});";EventSystem.TPL_PAGE_BLANK="&nbsp;&nbsp;";EventSystem.TPL_PAGE_SEPARATOR=" | ";EventSystem.TPL_PAGE_CURRENT='<span class="currentPage">{$pageNo}</span>';EventSystem.TPL_PAGE_C_FIRST="first-page";EventSystem.TPL_PAGE_C_FIRST_NA="first-page-na";EventSystem.TPL_PAGE_C_LAST="last-page";EventSystem.TPL_PAGE_C_LAST_NA="last-page-na";EventSystem.TPL_PAGE_C_PREV="prev-page";EventSystem.TPL_PAGE_C_PREV_NA="prev-page-na";EventSystem.TPL_PAGE_C_NEXT="next-page";EventSystem.TPL_PAGE_C_NEXT_NA="next-page-na";EventSystem.TPL_PAGE_C_CURRENT="pag-page-link";EventSystem.DIV_ID="eventList-innercontainer";EventSystem.DIV_CONTAINER_ID="eventList";EventSystem.URL="/get_events";EventSystem.URL_BAN_USER="/get";EventSystem.URL_DELETE_EVENT="/delete_events";EventSystem.URL_BAN_TYPE="/get";EventSystem.URL_DELETE_ALL="/get";EventSystem.EVENT_TYPE_MESSAGING=22;EventSystem.EVENT_TYPE_MESSAGING_FLIRT=23;EventSystem.EVENT_TYPE_CHAT_INVITATION_ACCEPT=24;EventSystem.EVENT_TYPE_CHAT_INVITATION_REJECT=25;EventSystem.EVENT_TYPE_CHAT_BLOCK_USER=26;EventSystem.EVENT_TYPE_MESSAGING_FLIRT_FRESH=27;EventSystem.EVENT_TYPE_GIFT=30;EventSystem.FILTERED=[EventSystem.EVENT_TYPE_MESSAGING,EventSystem.EVENT_TYPE_MESSAGING_FLIRT,EventSystem.EVENT_TYPE_CHAT_INVITATION_ACCEPT,EventSystem.EVENT_TYPE_CHAT_INVITATION_REJECT,EventSystem.EVENT_TYPE_CHAT_BLOCK_USER,EventSystem.EVENT_TYPE_MESSAGING_FLIRT_FRESH,EventSystem.EVENT_TYPE_GIFT];EventSystem.tplEngine=JTemplate;EventSystem.lastResponse=false;EventSystem.lastEventId=null;Object.extend(EventSystem.prototype,{appid:"EventSystem",windowState:EventSystem.WINDOW_STATE_IDLE,startWindowState:EventSystem.WINDOW_STATE_FOCUSED,timerHandle:null,timerRunnedOnce:false,popupObject:null,popupObjectContainer:null,listenStart:null,listenRenaming:null,getCount:60,scrollTimerHandle:null,items:Array(),notifyItems:Array(),usedPage:0,eventsCounter:0,paginate:false,wait:null,gettingEvents:false,isFirst:true,COOKIE_VISIBILITY:"isFullEventboxVisible",VISIBILITY_DURATION:7,initialize:function(){if(this.isMaximized()){Cookie.set(this.COOKIE_VISIBILITY,"",{duration:this.VISIBILITY_DURATION,path:"/"})}var B=document.createElement("div");B.id=EventSystem.DIV_ID;var A=document.createElement("div");A.id=EventSystem.DIV_CONTAINER_ID;document.body.appendChild(A);A.appendChild(B);this.popupObject=$(B.id);this.popupObjectContainer=$(A.id);Event.observe(window,"focus",this.windowOnFocus.bindAsEventListener(this));Event.observe(window,"blur",this.windowOnBlur.bindAsEventListener(this));window.setTimeout(this.initializeTimers.bind(this),EventSystem.TIMEOUT_PAGE_LOAD);if(Prototype.Browser.IE){Event.observe(window,"scroll",function(){window.clearTimeout(this.scrollTimerHandle);this.scrollTimerHandle=window.setTimeout(function(){this.updateEventListBox()}.bind(this),20)}.bind(this));this.updateEventListBox()}},initializeTimers:function(){this.windowState=this.startWindowState;if(EventSystem.WINDOW_STATE_FOCUSED==this.windowState){this.listenRenaming=0;this.setTimer(true)}},updateEventListBox:function(){if(!(Prototype.Browser.IE&&navigator.userAgent.indexOf("MSIE 6")>-1)){return }this.popupObjectContainer.setStyle({"top":-this.popupObjectContainer.getHeight()-parseInt(this.popupObjectContainer.getStyle("padding-top"))+(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight)+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)-5+"px","left":-this.popupObjectContainer.getWidth()-parseInt(this.popupObjectContainer.getStyle("padding-left"))+(document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth)+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft)-5+"px"});if(this.wait!=null){this.wait.waitNode.style.top=parseInt(this.popupObjectContainer.getStyle("top"))+"px";this.wait.waitNode.style.left=((document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth)+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft)-5-parseInt(this.wait.waitNode.style.width))+"px"}},switchVisibility:function(){$(EventSystem.DIV_ID).toggle();$("event-list-showhide-container","minimize-option","maximize-option").invoke("toggle");if(this.isMaximized()){Cookie.set(this.COOKIE_VISIBILITY,"mini",{duration:this.VISIBILITY_DURATION,path:"/"})}else{Cookie.set(this.COOKIE_VISIBILITY,"",{duration:this.VISIBILITY_DURATION,path:"/"})}this.updateEventListBox();$(EventSystem.DIV_ID).toggle();return false},isMaximized:function(){return !(Cookie.get(this.COOKIE_VISIBILITY)=="mini")},listClose:function(){new Effect.Fade("eventsystem-list",{"duration":0.3});Cookie.set(this.COOKIE_VISIBILITY,"mini",{duration:this.VISIBILITY_DURATION,path:"/"});window.clearInterval(this.timerHandle);return false},showPage:function(B){pageCounter=Math.ceil(this.eventsCounter/EventSystem.EVENTS_PER_PAGE);if(pageCounter==0){return }if(B>=0||B<pageCounter){this.usedPage=B}var A="";if(this.paginate&&pageCounter>1){dOnClick=this.usedPage!=0?EventSystem.tplEngine.fetch(EventSystem.TPL_PAGE_SHOW_PAGE,{"pageNo":0}):"return false;";dClass=(this.usedPage!=0?EventSystem.TPL_PAGE_C_FIRST:EventSystem.TPL_PAGE_C_FIRST_NA);dict={"class":dClass,"onclick":dOnClick,"content":EventSystem.TPL_PAGE_BLANK};A+=EventSystem.tplEngine.fetch(EventSystem.TPL_PAGE_ENTITY,dict);dOnClick=this.usedPage!=0?EventSystem.tplEngine.fetch(EventSystem.TPL_PAGE_SHOW_PAGE,{"pageNo":(this.usedPage-1)}):"return false;";dClass=(this.usedPage!=0?EventSystem.TPL_PAGE_C_PREV:EventSystem.TPL_PAGE_C_PREV_NA);dict={"class":dClass,"onclick":dOnClick,"content":EventSystem.TPL_PAGE_BLANK};A+=EventSystem.tplEngine.fetch(EventSystem.TPL_PAGE_ENTITY,dict);for(B=1;B<pageCounter+1;B++){A+=(B!=1)?EventSystem.TPL_PAGE_SEPARATOR:"";if(B==this.usedPage+1){A+=EventSystem.tplEngine.fetch(EventSystem.TPL_PAGE_CURRENT,{"pageNo":B});continue}dOnClick=EventSystem.tplEngine.fetch(EventSystem.TPL_PAGE_SHOW_PAGE,{"pageNo":(B-1)});dict={"class":EventSystem.TPL_PAGE_C_CURRENT,"onclick":dOnClick,"content":B};A+=EventSystem.tplEngine.fetch(EventSystem.TPL_PAGE_ENTITY,dict)}dOnClick=(this.usedPage<pageCounter-1)?EventSystem.tplEngine.fetch(EventSystem.TPL_PAGE_SHOW_PAGE,{"pageNo":(this.usedPage+1)}):"return false;";dClass=((this.usedPage<pageCounter-1)?"next-page":"next-page-na");dict={"class":dClass,"onclick":dOnClick,"content":EventSystem.TPL_PAGE_BLANK};A+=EventSystem.tplEngine.fetch(EventSystem.TPL_PAGE_ENTITY,dict);dOnClick=(this.usedPage!=pageCounter-1)?EventSystem.tplEngine.fetch(EventSystem.TPL_PAGE_SHOW_PAGE,{"pageNo":(pageCounter-1)}):"return false;";dClass=((this.usedPage!=pageCounter-1)?EventSystem.TPL_PAGE_C_LAST:EventSystem.TPL_PAGE_C_LAST_NA);dict={"class":dClass,"onclick":dOnClick,"content":EventSystem.TPL_PAGE_BLANK};A+=EventSystem.tplEngine.fetch(EventSystem.TPL_PAGE_ENTITY,dict);A=EventSystem.tplEngine.fetch(EventSystem.TPL_PAGINATOR,{"pages":A})}var C=!this.isMaximized()?'style="display: none"':"";dict={"events":(this.eventsCounter>0)?this.items[this.usedPage]:"","pagination":A,"counter":this.eventsCounter,"visibilityStatus":C,"maximalizeVisibility":!C?'style="display: none"':"","minimalizeVisibility":!C?"":'style="display: none"',"urlPanel":"/"+visitorUIN+Lang.eventlistPanelUrl};this.popupObject.innerHTML=EventSystem.tplEngine.fetch(EventSystem.TPL_CONTAINER,dict);this.updateEventListBox();return false},showNotifiers:function(){if(this.notifyItems.length==0){return false}var B="";for(var A=0;A<this.notifyItems.length;A++){B+='<div class="panel-bottom"><div class="panel">'+this.notifyItems[A]+"</div></div>"}$("event-notifiers").innerHTML=B;$("event-notifiers").style.display="block";if(Prototype.Browser.IE){this.updateEventListBox()}var C=this;window.setTimeout(function(){new Effect.DropOut($("event-notifiers"),{"afterFinish":function(){if(Prototype.Browser.IE){C.updateEventListBox()}}})},EventSystem.NOTIFY_TIMEOUT)},getEvents:function(){if(--this.getCount<0){return }var A=this;if(this.ajaxHandler!=null){this.ajaxHandler.abort()}this.ajaxHandler=advAJAX.post({"url":EventSystem.URL+(null===EventSystem.lastEventId?"":"/"+EventSystem.lastEventId),"parameters":{"sessionId":AppFramework.sessionId},"onSuccess":function(F){var C=!A.isMaximized();A.notifyItems=Array();events=F.responseJSON;if(typeof events=="undefined"||events==null||events.length==0){A.lastResponse=F.responseText;if(EventSystem.lastEventId==null){A.eventsCounter=0;A.clearContent();if(A.isProperDomain()){mail.handleReceivings();gift.showReceivedGifts()}}A.hideWaitContainer();return }if(F.responseText==A.lastResponse){A.hideWaitContainer();return }A.lastResponse=F.responseText;var E=EventSystem.lastEventId;if(A.isProperDomain()){mail.clearFlirtStorage()}var D=0;if(events.length>0){EventSystem.lastEventId=events[0][0]}for(var H=0;H<events.length;H++){desc=new String(events[H][3]);if(desc.length>EventSystem.TEXT_LEN){desc=desc.substr(0,EventSystem.TEXT_LEN)+EventSystem.TEXT_CONTINUATION}events[H]={"id":events[H][0],"senderId":events[H][1],"eventUrl":events[H][2],"senderName":events[H][5],"senderImg":events[H][6],"description":desc,"date":events[H][4],"type":events[H][7],"senderLink":events[H][8],"senderType":events[H][9]};if(A.isSpecialEvent(events[H])){A.handleSpecialEvent(events[H]);events.splice(H,1);H--;D++}}if(D>0||E==null){if(A.isProperDomain()){mail.handleReceivings();gift.showReceivedGifts()}}A.eventsCounter=events.length;var B=Math.ceil(A.eventsCounter/EventSystem.EVENTS_PER_PAGE);if(A.eventsCounter!=0){var G=0;for(H=0;H<B;H++){A.items[H]="";for(i=0;i<EventSystem.EVENTS_PER_PAGE;i++){if(typeof events[i+H*EventSystem.EVENTS_PER_PAGE]=="undefined"){break}dict=events[i+H*EventSystem.EVENTS_PER_PAGE];A.items[H]+=EventSystem.tplEngine.fetch(EventSystem.TPL_EVENT_ENTITY,dict);if(C&&EventSystem.lastEventId!=null&&dict.id>EventSystem.lastEventId&&EventSystem.NOTIFY_SHOW==1){if(A.notifyItems.length<EventSystem.NOTIFY_MAX_COUNT){A.notifyItems[A.notifyItems.length]=EventSystem.tplEngine.fetch(EventSystem.TPL_EVENT_ENTITY,dict)}}}}if(A.eventsCounter>EventSystem.EVENTS_PER_PAGE){A.paginate=true}}else{A.clearContent();A.hideWaitContainer();return }A.popupObject.hide();if(A.usedPage<B){A.showPage(A.usedPage)}else{if(B>0){A.showPage(B-1)}else{A.showPage(0)}}if(A.isFirst){new Effect.Appear(EventSystem.DIV_ID,{"duration":0.3});A.isFirst=false}else{A.popupObject.show()}A.hideWaitContainer();A.showNotifiers();A.updateEventListBox()},"onInitialization":function(B){A.gettingEvents=true},"onFinalization":function(B){A.gettingEvents=false;if(EventSystem.WINDOW_STATE_BLURED==A.windowState){A.listenRenaming=EventSystem.TIMEOUT_LOOP;return }A.listenStart=new Date().getTime();A.setTimer()}})},setTimer:function(A){A=A||false;if(null!=this.timerHandle){window.clearInterval(this.timerHandle)}this.listenStart=new Date().getTime();if(!A){this.timerHandle=window.setTimeout(this.getEvents.bind(this),EventSystem.TIMEOUT_LOOP)}else{this.timerHandle=window.setTimeout(this.getEvents.bind(this),this.listenRenaming)}},resetTimer:function(){this.setTimer(true)},setWaitStyle:function(){if(this.wait!=null){var A=15;if($(EventSystem.DIV_ID)){A+=parseInt($(EventSystem.DIV_ID).clientWidth)}if($("mail-specialbox")){A+=parseInt($("mail-specialbox").clientWidth)}this.wait.waitNode.style.width=A+"px";if(!(Prototype.Browser.IE&&navigator.userAgent.indexOf("MSIE 6")>-1)){this.wait.waitNode.style.left=null;this.wait.waitNode.style.top=null;this.wait.waitNode.style.right="5px";this.wait.waitNode.style.bottom="5px";this.wait.waitNode.style.position="fixed"}else{this.updateEventListBox()}}},hideWaitContainer:function(){if(this.wait!=null){this.wait.hide();this.wait=null}return false},clearContent:function(){this.popupObject.hide();this.items=Array();this.popupObject.innerHTML="";this.usedPage=0;return false},blockUser:function(A,B){this.wait=new Wait("eventList");this.wait.show();this.setWaitStyle();var C=this;advAJAX.post({"url":EventSystem.URL_BAN_USER,"user_uid":A,"action":"addToNotWantedUsers","appid":"EventSystem","ownerUIN":ownerUIN,"sessionId":AppFramework.sessionId,"type":B,"onSuccess":function(D){resp=D.responseJSON;if(resp.EventSystem.status==EventSystem.STATUS_OK){C.getCount++;EventSystem.lastEventId=null;C.getEvents()}else{C.hideWaitContainer();C.showLightBoxStatic("eventListError",Lang.eventlistBlockError)}},"onError":function(D){C.hideWaitContainer();C.showLightBoxStatic("eventListError",Lang.eventlistBlockError)}});return false},blockType:function(A){this.wait=new Wait("eventList");this.wait.show();this.setWaitStyle();var B=this;advAJAX.post({"url":EventSystem.URL_BAN_TYPE,"packet_type":A,"action":"addToNotWantedEventsTypes","appid":"EventSystem","single_block":true,"ownerUIN":ownerUIN,"sessionId":AppFramework.sessionId,"onSuccess":function(C){resp=C.responseJSON;if(typeof resp!="undefined"&&resp.EventSystem.status==EventSystem.STATUS_OK){B.getCount++;EventSystem.lastEventId=null;B.getEvents()}else{B.hideWaitContainer();B.showLightBoxStatic("eventListError",Lang.eventlistBlockError)}},"onError":function(C){B.hideWaitContainer();B.showLightBoxStatic("eventListError",Lang.eventlistBlockError)}});return false},deleteEvent:function(B){this.wait=new Wait("eventList");this.wait.show();this.setWaitStyle();var A=this;advAJAX.post({"url":EventSystem.URL_DELETE_EVENT,"ids":B,"ownerUIN":ownerUIN,"sessionId":AppFramework.sessionId,"onSuccess":function(C){resp=C.responseJSON;if(typeof resp!="undefined"&&resp.status!=EventSystem.ED_STATUS_ERROR){A.getCount++;if(A.isProperDomain()){mail.clearFlirtStorage()}EventSystem.lastEventId=null;A.getEvents()}else{A.hideWaitContainer();A.showLightBoxStatic("eventListError",Lang.eventlistDeleteError)}},"onError":function(C){A.hideWaitContainer();A.showLightBoxStatic("eventListError",Lang.eventlistDeleteError)}});return false},deleteAllEvents:function(B){this.wait=new Wait("eventList");this.wait.show();this.setWaitStyle();var A=this;advAJAX.post({"url":EventSystem.URL_DELETE_ALL,"action":"deleteAllEvents","appid":"EventSystem","ownerUIN":ownerUIN,"sessionId":AppFramework.sessionId,"onSuccess":function(C){resp=C.responseJSON;if(resp.EventSystem.status==EventSystem.STATUS_OK){A.getCount++;EventSystem.lastEventId=null;if(A.isProperDomain()){mail.clearFlirtStorage()}A.getEvents()}else{A.hideWaitContainer();A.showLightBoxStatic("eventListError",Lang.eventlistDeleteError)}},"onError":function(C){A.hideWaitContainer();A.showLightBoxStatic("eventListError",Lang.eventlistDeleteError)}});return false},windowOnFocus:function(){this.startWindowState=EventSystem.WINDOW_STATE_FOCUSED;if(EventSystem.WINDOW_STATE_FOCUSED==this.windowState||EventSystem.WINDOW_STATE_IDLE==this.windowState){return }this.setTimer(true);this.windowState=EventSystem.WINDOW_STATE_FOCUSED},windowOnBlur:function(){this.startWindowState=EventSystem.WINDOW_STATE_BLURED;if(EventSystem.WINDOW_STATE_BLURED==this.windowState||EventSystem.WINDOW_STATE_IDLE==this.windowState){return }if((this.listenRenaming=EventSystem.TIMEOUT_LOOP-(new Date().getTime()-this.listenStart))<0){this.listenRenaming=0}window.clearTimeout(this.timerHandle);this.windowState=EventSystem.WINDOW_STATE_BLURED},isSpecialEvent:function(A){if(!this.isProperDomain()){return false}return -1!=(EventSystem.FILTERED.indexOf(A.type))},isProperDomain:function(){return null!==document.domain.match(/\.pl$/)},handleSpecialEvent:function(A){switch(A.type){case EventSystem.EVENT_TYPE_MESSAGING:mail.queueMessage(A.id,A.senderName,A.description,A.date,A.senderImg,A.senderLink,A.eventUrl);break;case EventSystem.EVENT_TYPE_MESSAGING_FLIRT:mail.queueFlirt(A.id,A.senderName,A.description,A.date,A.senderImg,A.senderLink,A.eventUrl);break;case EventSystem.EVENT_TYPE_CHAT_INVITATION_ACCEPT:mail.queueChatInvitation(A.id,A.senderId,A.description,A.senderName,A.date,A.senderImg,A.senderLink);break;case EventSystem.EVENT_TYPE_CHAT_INVITATION_REJECT:mail.handleRejectedChatInvitation(A.senderId);break;case EventSystem.EVENT_TYPE_CHAT_INVITATION_BLOCK:break;case EventSystem.EVENT_TYPE_MESSAGING_FLIRT_FRESH:mail.setSpecialFlirt(A.description);break;case EventSystem.EVENT_TYPE_GIFT:gift.queueReceivedGift(A.id,A.description,A.senderImg);break}return false}});var Cenzor=Class.create();Object.extend(Cenzor.prototype,AppFramework.prototype);Object.extend(Cenzor.prototype,{appid:"Cenzor",showModerationDialog:function(B,A){A=typeof A!="undefined"?A:"";this.showLightBox("moderationDialogId","showModerationDialog",{"type":B,"objectId":A},{"height":230,"width":450});return false},moderation:function(A,C){var B=$F($("moderationDescriptionId"));if(B.strip().length==0){$("moderationDescMissingId").show();$("moderationDescriptionId").addClassName("error");return }this.sendRequest("newEntry",{"type":A,"desc":B,"objectId":C},function(D){if($("BUTTON_"+A+"_"+C)){Element.remove($("BUTTON_"+A+"_"+C))}AppFramework.hideLightBox("moderationDialogId")}.bind(this))}});cenzor=new Cenzor();var AudioPlayerManager=Class.create();AudioPlayerManager.players=new Array();AudioPlayerManager.registerPlayer=function(A){for(i=0;i<AudioPlayerManager.players.length;i++){if(AudioPlayerManager.players[i]==A){return false}}AudioPlayerManager.players.push(A);return true};AudioPlayerManager.globalStop=function(){for(i=0;i<AudioPlayerManager.players.length;i++){if(typeof AudioPlayerManager.players[i].mediaPlayer!="undefined"&&AudioPlayerManager.players[i].mediaPlayer!=null&&typeof AudioPlayerManager.players[i].playerStop=="function"&&typeof AudioPlayerManager.players[i].mediaPlayer.sendEvent=="function"){AudioPlayerManager.players[i].playerStop()}}return true};var Chat=Class.create();Object.extend(Chat.prototype,AppFramework.prototype);Object.extend(Chat.prototype,{appid:"Chat"});Event.onDOMReady(function(){chat=new Chat()});var ChatUser=Class.create();Object.extend(ChatUser.prototype,AppFramework.prototype);Object.extend(ChatUser.prototype,{my_message:1,user_message:0,dialogLenght:0,texts:new Array(),uid:"0:-1",uin:0,nick:"",avatar:"",block:false,inittialize:function(){},remove:function(A){},insert:function(A){},setUID:function(A){this.uid=A},getUid:function(){return this.uid},addMessage:function(A,C,B){this.dialogLenght=this.texts.push(new Array(C,A,B))}});Object.extend(Chat.prototype,{users:new Array(),current_dialog:0,owner:0,WindowObjectReference:null,WindowObjectName:"Chat_DialogBox",WindowObjectParams:"titlebar=no ,menubar=no, scrollbars=no, status=no, toolbar=no, location=no, directories=no, width=460, height=460",DialogBoxHtml:'<div class="chat-dialog"></div>',waitingTime:3000,getTimer:null,URL_main:"/get_chat",URL_PREFIX:"/czat/",URL_INVITE:"/zapros",URL_ACCEPT:"/przyjmij",URL_BLOCK:"/blokuj",TIME_TO_EXIT:1000,STATUS_INVITE:1,STATUS_ACCEPT:0,STATUS_BLOCK:2,OFFLINE:0,ONLINE:1,WAITING:2,USER_LIST_ELEM:"user-list-elem",WINDOW_NAME_TALK:"chat-talk-elem",WINDOW_NAME_INPUT:"chat-talk-input",WINDOW_NAME_EMOT_LIST:"emot-list",ELEM_LIST_STATUS:"chat-elem-list-status-",EMOT_LIST:{"cieszysie":[":)",":)",":\\)"],"smutas":[";(",";(",";\\("],"usmiech":"usmiech","jezor":"jezor","zeby":[":D",":D",":D"],"macha":"macha","kwiatuszek":"kwiatuszek","calus":"calus","wykrzykniki":"wykrzykniki","pytajniki":"pytajniki"},EMOT_PATH:null,STATUS_LEFT_SEPARATOR:"[",STATUS_RIGHT_SEPARATOR:"]",SEND_PACKET_TIMEOUT:5000,LAST_TIME_MESSAGE:0,MESSAGES_PENDING:[],MESSAGE_LENGTH_LIMIT:1500,init:function(E,B,A){this.EMOT_PATH=emoticonsUrl;this.setOwner(E);this.addDialog(B);this.switchDialog(B);if(A==this.STATUS_INVITE){this.changeStatus(B,this.WAITING)}var D;for(D in this.EMOT_LIST){var C=document.createElement("img");C.src=this.EMOT_PATH+D+".gif";C.rel=D;if(this.EMOT_LIST[D] instanceof Array){C.title=this.EMOT_LIST[D][0];C.name=this.EMOT_LIST[D][1]}else{C.title=this.EMOT_LIST[D];C.name="<"+this.EMOT_LIST[D]+">"}Event.observe(C,"click",function(F){$(chat.WINDOW_NAME_INPUT).value+=this.name;$(chat.WINDOW_NAME_EMOT_LIST).hide();$(chat.WINDOW_NAME_INPUT).focus()}.bind(C));window.onbeforeunload=chat.unload;$(this.WINDOW_NAME_EMOT_LIST).appendChild(C)}if(window.opener&&window.opener.mail){window.opener.mail.clearAcceptationNotify()}},unload:function(){chat.closeDialogBox();chat.closeChat();alert(Lang.chat_session_end)},replaceEmoticons:function(C){var A,B;for(A in this.EMOT_LIST){if(this.EMOT_LIST[A] instanceof Array){B=new RegExp(this.EMOT_LIST[A][2],"g");C=C.replace(B,'<img src="'+this.EMOT_PATH+A+'.gif" />')}B=new RegExp("&lt;"+A+"&gt;","g");C=C.replace(B,"<img src='"+this.EMOT_PATH+A+".gif' />")}return C},keyHandler:function(A,B){$(this.WINDOW_NAME_INPUT).value=$(this.WINDOW_NAME_INPUT).value.substring(0,this.MESSAGE_LENGTH_LIMIT);if(A&&(A.keyCode==13||A.witch==13)){this.addMessage(ChatUser.my_message)}},clearInput:function(A){if(A&&(A.keyCode==13||A.witch==13)){$(this.WINDOW_NAME_INPUT).value=""}},setOwner:function(A){this.onwer=A},getMessages:function(){if(this.MESSAGES_PENDING.length>0){var A=this.MESSAGES_PENDING.toJSON();var B={"sessionId":AppFramework.sessionId,text:A};this.MESSAGES_PENDING=[]}else{var B={"sessionId":AppFramework.sessionId}}advAJAX.post({url:this.URL_main,parameters:B,onSuccess:function(D){if(!D||typeof D.responseJSON=="undefined"||typeof D.responseJSON.result=="undefined"){return }if(D.responseJSON.result==1){var E=D.responseJSON.users;var C=D.responseJSON.status;this.checkStatus(C);if(E==0){return }this.checkMessages(E)}else{this.handleError(D.responseJSON)}}.bind(this),onError:function(C){}.bind(this)})},handleError:function(D){var C=D.message;var B=D.errorCode;var A=D.uid;switch(B){case 1:if(A!=null){this.changeStatus(A,this.OFFLINE)}break;case 2:if(A!=null){this.changeStatus(A,this.OFFLINE)}break;case 3:if(A!=null){this.changeStatus(A,this.WAITING)}break;case 5:alert(Lang.chat_session_end);this.closeDialogBox();this.closeChat();default:}},checkStatus:function(A){var B;for(B in A){if(typeof this.users[B]=="object"){switch(A[B]){case 0:this.changeStatus(B,this.OFFLINE);break;case 1:this.changeStatus(B,this.ONLINE);break}}}},closeChat:function(){this.stopWatching();var B=new Date();do{var A=new Date()}while(A-B<this.TIME_TO_EXIT);window.close()},disableInput:function(A){},changeStatus:function(B,A){switch(A){case this.ONLINE:this.switchBlock(B,false);$(this.ELEM_LIST_STATUS+B).innerHTML=this.STATUS_LEFT_SEPARATOR+Lang.chatonline+this.STATUS_RIGHT_SEPARATOR;className="user-status-online";break;case this.OFFLINE:this.switchBlock(B,true);$(this.ELEM_LIST_STATUS+B).innerHTML=this.STATUS_LEFT_SEPARATOR+Lang.chatoffline+this.STATUS_RIGHT_SEPARATOR;className="user-status-offline";break;case this.WAITING:this.switchBlock(B,true);$(this.ELEM_LIST_STATUS+B).innerHTML=this.STATUS_LEFT_SEPARATOR+Lang.chatwaiting+this.STATUS_RIGHT_SEPARATOR;className="user-status-waiting";break;default:return true}$(this.ELEM_LIST_STATUS+B).className="chat-elem-list-status "+className},switchBlock:function(A,B){this.users[A].block=B;if(this.current_dialog==A){if(B){$(this.WINDOW_NAME_INPUT).disabled=true;$("button-emoticons-bg").className="button-emoticons-bg-off";$("button-send-bg").className="button-send-bg-off"}else{$(this.WINDOW_NAME_INPUT).disabled=false;$("button-emoticons-bg").className="button-emoticons-bg";$("button-send-bg").className="button-send-bg"}}},blockUser:function(A){this.sendRequest("blockUser",{"uid":A},function(B){if(B.result==1){}})},rejectInvitation:function(A,C,B){this.sendRequest("rejectInvitation",{"uid":A},function(D){if(D.result==1){if("function"==typeof C){C()}}else{if("function"==typeof B){B()}}})},checkMessages:function(E){var B,A;for(B in E){if(typeof this.users[B]=="undefined"){continue}for(A in E[B]){var D=E[B][A].text;var C=E[B][A].time;if(typeof D=="undefined"){continue}this.changeStatus(B,this.ONLINE);this.writeMessage(D,this.owner,B,C,this.users[B].nick)}}},showDialogBox:function(C,A){var B;switch(A){case this.STATUS_INVITE:B=this.URL_PREFIX+C+this.URL_INVITE;break;case this.STATUS_ACCEPT:B=this.URL_PREFIX+C+this.URL_ACCEPT;break;default:return false}this.WindowObjectReference=window.open("",this.WindowObjectName,this.WindowObjectParams);if(!this.isOpen()||typeof this.WindowObjectReference.chat!="object"){if(this.WindowObjectReference.closed||(!this.WindowObjectReference.document.URL)||(this.WindowObjectReference.document.URL.indexOf("czat")==-1)){this.WindowObjectReference.location=B;this.WindowObjectReference.creator=self;this.WindowObjectReference.focus()}this.addUser(C);return false}if(typeof this.WindowObjectReference.chat=="object"&&typeof this.WindowObjectReference.chat.users[C]=="object"){this.WindowObjectReference.chat.switchDialog(C);this.WindowObjectReference.focus();return false}this.WindowObjectReference.chat.addDialog(C);this.WindowObjectReference.chat.switchDialog(C);if(A==this.STATUS_INVITE){this.WindowObjectReference.chat.changeStatus(C,this.WAITING)}this.WindowObjectReference.chat.getUser(C,A);this.WindowObjectReference.focus();return false},addUser:function(B){var A=new ChatUser();A.setUID(B);this.users[B]=A},addDialog:function(D){if(typeof this.users[D]=="object"){window.focus();return }this.addUser(D);var A=document.createElement("div");A.id=this.WINDOW_NAME_TALK+D;A.className="elem";var C=document.createElement("dl");C.id=this.WINDOW_NAME_TALK+D;var F=document.createElement("div");F.className=this.USER_LIST_ELEM;F.id=this.USER_LIST_ELEM+D;var B=document.createElement("a");B.id="chat-list-elem-"+D;B.rel=D;B.href="#";Event.observe(B,"click",function(G){chat.switchDialog(this.rel)}.bind(B));B.innerHTML=D;var E=document.createElement("div");E.id=this.ELEM_LIST_STATUS+D;E.className="chat-elem-list-status";E.innerHTML=Lang.chatonline;A.appendChild(C);$("chat-talk-elem").appendChild(A);F.appendChild(B);F.appendChild(E);$("chat-user-list").appendChild(F);this.changeStatus(D,this.ONLINE)},showEmotBox:function(){if(this.users[this.current_dialog].block==false){$(this.WINDOW_NAME_EMOT_LIST).toggle()}},getUserIcon:function(C,A,H){A=A==""?C:A;var B=document.createElement("div");B.id="avatar-"+C;B.className="avatar";var D=document.createElement("div");D.className="avatar-pack";var F=document.createElement("a");F.setAttribute("href","#");F.onclick=function(){window.opener.location=(Lang.chatProfileLinkPrefix+C)};var G=document.createElement("img");G.src=H;var E=document.createElement("a");E.setAttribute("href","#");E.onclick=function(){window.opener.location=(Lang.chatProfileLinkPrefix+C)};var I=document.createElement("span");I.innerHTML=A;I.className="avatar-nick";$("chat-list-elem-"+C).innerHTML=A;E.appendChild(I);F.appendChild(G);D.appendChild(F);B.appendChild(D);B.appendChild(E);$("chat-header").appendChild(B);if(typeof this.users[C]=="object"){this.users[C].nick=A;this.users[C].avatar=H}},getSoundCfg:function(){var A=Cookie.get("fanta_chat_sound");if(A==1){$("soundOnOff").value=1;$("soundOnOff_link").addClassName("checked")}},soundOnOff:function(){var A=$("soundOnOff").value;if(A==0){Cookie.set("fanta_chat_sound",1,{duration:30});$("soundOnOff").value=1;$("soundOnOff_link").addClassName("checked")}else{Cookie.set("fanta_chat_sound",0,{duration:30});$("soundOnOff").value=0;$("soundOnOff_link").removeClassName("checked")}},getUser:function(B,A){if(this.owner==B){return }this.sendRequest("getUser",{"uid":B,"invite":A},function(C){if(C.result==1){chat.getUserIcon(B,C.nick,C.avatar)}else{chat.getUserIcon(B,B,null);chat.changeStatus(B,chat.OFFLINE)}})},addMessage:function(){var B=Number(new Date());var C=this.htmlfilter($(this.WINDOW_NAME_INPUT).value.substring(0,this.MESSAGE_LENGTH_LIMIT));var A=this.current_dialog;if(C==""){return }else{$(this.WINDOW_NAME_INPUT).value="";this.writeMessage(this.replaceEmoticons(C),this.owner,this.current_dialog,B,Lang.chatme);this.users[A].addMessage(C,ChatUser.my_message,B);this.MESSAGES_PENDING.push({uid:A,time:B,text:C});this.LAST_TIME_MESSAGE=B;return true}},clearDialogBox:function(){var A;for(A in this.users){if(typeof this.users[A]!="object"){continue}this.clearDialog(A)}},clearCurrentDialog:function(){this.clearDialog(this.current_dialog)},clearDialog:function(A){this.users[A].texts=new Array();this.users[A].dialoglenght=0;$(this.WINDOW_NAME_TALK+A).innerHTML=""},getCurrentList:function(){return this.users},closeDialogBox:function(){var A;for(A in this.users){if(typeof this.users[A]!="object"){continue}this.closeDialog(A)}this.users=new Array()},closeWithError:function(){var E=window.opener.chat;var A=Object.clone(AppFramework.defaultDialogParams);A.className="flirt-lightbox";A.width=600;A.height=220;var D=document.createElement("div");var C=document.createElement("div");C.className="title";var B=document.createElement("div");B.className="body";B.innerHTML=Lang.chat_error_status;D.appendChild(C);D.appendChild(B);E._showLightbox("error_chat",A,D.innerHTML);this.closeChat()},closeDialog:function(A){this.users[A]=false;if($("avatar-"+A)){$("avatar-"+A).remove()}$(this.WINDOW_NAME_TALK+A).remove();$(this.USER_LIST_ELEM+A).remove();var B={"sessionId":AppFramework.sessionId,uid:A,type:"close"};advAJAX.post({url:this.URL_main,parameters:B,onSuccess:function(C){}.bind(this),onError:function(C){}.bind(this)})},closeCurrentDialog:function(){var A=this.current_dialog;if(A==0){return false}var B,C=0;for(B in this.users){if(typeof this.users[B]!="object"||B==A){continue}if(B>0){C=B}}if(C>0){this.switchDialog(C);this.closeDialog(A);return true}this.closeDialog(A);return this.closeChat()},switchDialog:function(A){if(this.current_dialog>0){this.hideDialog(this.current_dialog);$(this.USER_LIST_ELEM+this.current_dialog).removeClassName("active")}if(this.users[A].block==true){$(this.WINDOW_NAME_INPUT).disabled=true}else{$(this.WINDOW_NAME_INPUT).disabled=false}this.current_dialog=A;$(this.USER_LIST_ELEM+this.current_dialog).addClassName("active");this.showDialog(A);return false},hideDialog:function(A){if($("avatar-"+A)){$("avatar-"+A).hide()}$(this.WINDOW_NAME_TALK+A).hide()},showDialog:function(A){if($("avatar-"+A)){$("avatar-"+A).show()}$(this.WINDOW_NAME_TALK+A).show()},writeMessage:function(E,B,F,D,A){if(A!=Lang.chatme&&$("soundOnOff").value==0){$("newmsgsound").sendEvent("next")}A=this.htmlfilter(A);var C=document.createElement("dt");C.innerHTML=A+" -> "+E+" ";$(this.WINDOW_NAME_TALK+F).appendChild(C);$(this.WINDOW_NAME_TALK+F).scrollTop=$(this.WINDOW_NAME_TALK+F).scrollHeight;$(this.WINDOW_NAME_INPUT).focus()},htmlfilter:function(A){if(typeof (A)=="string"){A=A.replace(/&/g,"&amp;");A=A.replace(/"/g,"&quot;");A=A.replace(/'/g,"&#039;");A=A.replace(/</g,"&lt;");A=A.replace(/>/g,"&gt;")}return A},isOpen:function(){if(typeof this.WindowObjectReference=="undefined"||this.WindowObjectReference==null||this.WindowObjectReference.closed){return false}return true},startWatching:function(){this.getTimer=setInterval("chat.getMessages();",this.waitingTime)},stopWatching:function(){this.getTimer=window.clearInterval(this.getTimer)},injectChildWindow:function(A){this.myWindowObjectReference=window.open("",this.WindowObjectName,this.WindowObjectParams);if(this.myWindowObjectReference){this.myWindowObjectReference.opener=A;if(this.myWindowObjectReference.chat!=null){mail.clearAcceptationNotify()}}this.myWindowObjectReference=null;return false}});var Mail=Class.create();Mail.TPL_CONTAINER='<div id="mail-specialbox-list"></div>';Mail.TPL_ITEM='<div class="message-entity" id="messages-window"><div class="entity"><a class="close" href="#" onclick="return mail.closeMailBox(\'messages\');"></a><div style="clear : both;"></div><div class="summary">'+Lang.mailHas+' <span id="messages-counter">{$count}</span> '+Lang.mailNewMail+'</div><div style="clear : both;"></div><div class="entity-data" id="messages-entity-data">{$content}</div><div style="clear : both;"></div><div class="slider" id="messages-slider"><a href="#" class="slideup" onclick="return mail.slideUp(\'messages\');"></a><div id="messages-counter-holder" class="counter-holder">{$holder}</div><a href="#" class="slidedown" onclick="return mail.slideDown(\'messages\');"></a></div></div></div>';Mail.TPL_C_ITEM='<a class="delete" href="#" onclick="return mail.removeFlirtEvent(\'{$id}\');"><div class="avatar"><a href="{$url}"><img align="absmiddle" src="{$avatarSrc}" height="40" width="40" /></a></div><div class="content-wrap"><a class="author" href="{$url}">{$author}</a><div class="date">{$date}</div><a href="{$contentUrl}" class="content">{$content}</a></div>';Mail.TPL_CHAT_ITEM='<div class="chat-entity" id="chats-window"><div class="entity"><a class="close" href="#" onclick="return mail.closeMailBox(\'chats\');"></a><div style="clear : both;"></div><div class="summary">'+Lang.mailHas+' <span id="chats-counter">{$count}</span> '+Lang.mailNewChat+'</div><div style="clear : both;"></div><div class="entity-data" id="chats-entity-data">{$content}</div><div style="clear : both;"></div><div class="slider" id="chats-slider"><a href="#" class="slideup" onclick="return mail.slideUp(\'chats\');"></a><div id="chats-counter-holder" class="counter-holder">{$holder}</div><a href="#" class="slidedown" onclick="return mail.slideDown(\'chats\');"></a></div></div></div>';Mail.TPL_C_CHAT_ITEM='<div class="avatar"><a href="{$url}"><img align="absmiddle" src="{$avatarSrc}" height="40" width="40" /></a></div><div class="content-wrap"><a class="author" href="{$url}">{$author}</a><div class="content"><div>'+Lang.mailWantToTalk+'</div><div style="clear : both;"></div><a href="#" class="button-accept" onclick="return mail.chatAcceptation(\'{$id}\');"></a><a href="#" class="button-reject" onclick="return mail.chatRejection(\'{$id}\');"></a></div></div>';Mail.TPL_FLIRT_ITEM='<div class="flirt-entity" id="flirts-window"><div class="entity"><a class="close" href="#" onclick="return mail.closeMailBox(\'flirts\');"></a><div style="clear : both;"></div><div class="summary">'+Lang.mailHas+' <span id="flirts-counter">{$count}</span> '+Lang.mailNewFlirt+'</div><div style="clear : both;"></div><div class="entity-data" id="flirts-entity-data">{$content}</div><div style="clear : both;"></div><div class="slider" id="flirts-slider"><a href="#" class="slideup" onclick="return mail.slideUp(\'flirts\');"></a><div id="flirts-counter-holder" class="counter-holder">{$holder}</div><a href="#" class="slidedown" onclick="return mail.slideDown(\'flirts\');"></a></div></div></div>';Mail.TPL_C_FLIRT_ITEM='<a class="delete" href="#" onclick="return mail.removeFlirtEvent(\'{$id}\');"></a><div class="avatar"><a href="{$url}"><img align="absmiddle" src="{$avatarSrc}" height="40" width="40" /></a></div><div class="content-wrap"><a class="author" href="{$url}">{$author}</a><div class="date">{$date}</div><a href="{$contentUrl}" class="content">{$content}</a></div>';Mail.DIV_CONTAINER_ID="eventList";Mail.DIV_ID="mail-specialbox";Mail.tplEngine=JTemplate;Mail.TYPE_MESSAGE=1;Mail.TYPE_FLIRT_MESSAGE=2;Mail.TYPE_CHAT_INVITATION=3;Mail.TYPE_CHAT_REJECTION=4;Mail.MAX_LENGTH_CONTENT=4196;Object.extend(Mail.prototype,AppFramework.prototype);Object.extend(Mail.prototype,{appid:"Mail",flirtQueue:[],visible:false,popupObject:null,specialId:null,sections:["chats","flirts","messages"],sectionTpls:{"messages":Mail.TPL_ITEM,"flirts":Mail.TPL_FLIRT_ITEM,"chats":Mail.TPL_CHAT_ITEM},sectionCTpls:{"messages":Mail.TPL_C_ITEM,"flirts":Mail.TPL_C_FLIRT_ITEM,"chats":Mail.TPL_C_CHAT_ITEM},sectionTypes:{"messages":Mail.TYPE_MESSAGE,"flirts":Mail.TYPE_FLIRT_MESSAGE,"chats":Mail.TYPE_CHAT_INVITATION},sectionArrays:{"messages":null,"flirts":null,"chats":null},sectionIndexes:{"messages":0,"flirts":0,"chats":0},imageDomain:null,initialize:function(){var B=document.createElement("div");B.id=Mail.DIV_ID;var A=document.getElementById(Mail.DIV_CONTAINER_ID);if(A){A.appendChild(B)}this.popupObject=$(B.id)},displayFlirtMessage:function(A,B){this.showLightBoxStatic("FlirtMsgLight","<b>"+A+"</b><br />"+B+"<br /><br /><a href=\"#\" onclick=\"return AppFramework.hideLightBox('FlirtMsgLight', function() { setTimeout('mail.flirtIteration()', 1000) })\">ZAMKNIJ</a>");this.visible=true;return false},queueFlirt:function(F,D,E,C,G,B,A){this.flirtQueue.push({"id":F,"author":D,"content":E,"type":Mail.TYPE_FLIRT_MESSAGE,"date":C,"avatarSrc":G,"url":B,"contentUrl":A})},queueMessage:function(F,D,E,C,G,B,A){this.flirtQueue.push({"id":F,"author":D,"content":E,"type":Mail.TYPE_MESSAGE,"date":C,"avatarSrc":G,"url":B,"contentUrl":A})},queueChatInvitation:function(G,E,F,D,C,H,B,A){this.flirtQueue.push({"id":G,"author":D,"content":F,"type":Mail.TYPE_CHAT_INVITATION,"id":E,"date":C,"avatarSrc":H,"url":B,"contentUrl":A})},chatRejection:function(A){eventsystem.wait=new Wait("eventList");eventsystem.wait.show();eventsystem.setWaitStyle();chat.rejectInvitation(A,function(){EventSystem.lastEventId=null;this.clearFlirtStorage();eventsystem.getEvents()}.bind(this),function(){this.showLightBoxStatic("alert",'<div class="alert">'+Lang.ajaxError+"</div>"+this.getWinCloseButton("alert"),{width:250,height:120});eventsystem.wait.hide()}.bind(this));return false},chatAcceptation:function(A){chat.injectChildWindow(window);eventsystem.wait=new Wait("eventList");eventsystem.wait.show();eventsystem.setWaitStyle();chat.showDialogBox(A,0);return false},clearAcceptationNotify:function(){this.clearFlirtStorage();EventSystem.lastEventId=null;eventsystem.getEvents();return false},handleReceivings:function(){this.sections.each(function(A){this.sectionArrays[A]=this.getTypeMessages(this.sectionTypes[A])}.bind(this));this.showFantaBox()},removeFlirtEvent:function(A){eventsystem.deleteEvent(A);return false},closeMailBox:function(A){if($(A+"-window")){new Effect.Fade(A+"-window",{"duration":0.3})}return false},removeChatInvitation:function(B){for(var A=0;A<this.flirtQueue;A++){if(this.flirtQueue[A].id==B){}}},openFlirtViewWindow:function(B,C,A){this.sendRequest("viewFlirtMessage",{"flirtId":B,"canChat":C,"status":A},function(F){if(F.status!=this.RESPONSE_RESULT_OK){this.showLightBoxStatic("alert",'<div class="alert">'+Lang.ajaxError+"</div>"+this.getWinCloseButton("alert"),{width:250,height:120})}else{var E=Object.clone(AppFramework.defaultDialogParams);Object.extend(E,{});E.className="flirt-lightbox";E.width=590;E.height=468;this._showLightbox("viewMessageLightBox",E,F.html);this.imageDomain=F.imageDomain;var D=new SWFObject(F.flashFile,"fantaflashcard","550","330","9.0.115","#FFFFFF");D.addParam("quality","high");D.addParam("wmode","transparent");D.addParam("menu","false");D.addParam("play","true");D.addParam("loop","false");D.addVariable("javascriptid","fantaflashcard");D.addVariable("enablejs","true");D.addVariable("crossDomainUrl",this.getCrossDomainFile());if(F.imageUrl!=""){D.addVariable("imageUrl",this.switchUrlDomain(F.imageUrl,F.imageDomain))}D.addVariable("messageText",F.messageContent);D.addParam("allowscriptaccess","always");D.write("flashFantaCard")}}.bind(this),function(D){this.showLightBoxStatic("alert",'<div class="alert">'+Lang.ajaxError+"</div>"+this.getWinCloseButton("alert"),{width:250,height:120})}.bind(this));return false},showFantaBox:function(){var A="";this.sections.each(function(B){if("undefined"!=typeof this.sectionArrays[B]&&this.sectionArrays[B].length>0){v=this.sectionArrays[B][this.sectionIndexes[B]];A+=this.getSectionHTML(v,B,this.sectionArrays[B].length,this.getSliderStatus(1,this.sectionArrays[B].length))}}.bind(this));if(this.specialId!=null){this.openFlirtViewWindow(this.specialId);this.specialId=null}this.popupObject.innerHTML=A},canBeSlidedUp:function(A){return"undefined"!=typeof this.sectionArrays[A][this.sectionIndexes[A]-1]},canBeSlidedDown:function(A){return"undefined"!=typeof this.sectionArrays[A][this.sectionIndexes[A]+1]},getSectionHTML:function(C,D,A,B){return Mail.tplEngine.fetch(this.sectionTpls[D],{"content":this.getMessageHTMLContent(C,D),"count":A,"holder":B})},getMessageHTMLContent:function(A,B){return Mail.tplEngine.fetch(this.sectionCTpls[B],A)},slideUp:function(B){if(this.canBeSlidedUp(B)){var A=this.sectionArrays[B][--this.sectionIndexes[B]];$(B+"-entity-data").innerHTML=this.getMessageHTMLContent(A,B);this.updateSlider(B,this.sectionIndexes[B]+1,this.sectionArrays[B].length)}return false},slideDown:function(B){if(this.canBeSlidedDown(B)){var A=this.sectionArrays[B][++this.sectionIndexes[B]];$(B+"-entity-data").innerHTML=this.getMessageHTMLContent(A,B);this.updateSlider(B,this.sectionIndexes[B]+1,this.sectionArrays[B].length)}return false},updateSlider:function(C,A,B){$(C+"-counter-holder").innerHTML=this.getSliderStatus(A,B);if(!this.canBeSlidedDown(C)){}else{}if(!this.canBeSlidedUp(C)){}else{}},getSliderStatus:function(A,B){return A+" / "+B},getTypeMessages:function(B){retArr=[];for(i=0;i<this.flirtQueue.length;i++){var A=this.flirtQueue[i];if(A.type==B){retArr.push(A)}}return retArr},clearFlirtStorage:function(){this.flirtQueue=[];this.sectionIndexes={"messages":0,"flirts":0,"chats":0}},selectMessagePhoto:function(){if(this.widget){$("widget-holder").innerHTML="";$("widget-holder").show()}this.widget=new MyAlbumsWidget("widget-holder",true);$("widget-holder").style.display="block";this.widget.onSelectPhoto=function(A){$("messagePhoto").value=A.id;$("widget-holder").hide();var B=this.getMovieObject("flashFantaAvatar");B.changeImage(this.switchUrlDomain(A.url,this.imageDomain))}.bind(this)},closeChatBox:function(){$("mail-entity-chat").remove();eventsystem.getCount++;EventSystem.lastEventId=null;eventsystem.getEvents()},setSpecialFlirt:function(A){this.specialId=A.toString()},getMovieObject:function(A){return document[A]},avatarSelectionClicked:function(B){$("fantaAvatar"+$("avatar-selected-id").value).className="";$("avatar-selected-id").value=B;var A=this.getMovieObject("flashFantaAvatar");A.changeAvatar(B);$("fantaAvatar"+$("avatar-selected-id").value).className="checked";return false},selectMessageScheme:function(A){$("msgScheme"+$("message-template-id").value).className="";$("message-template-id").value=A;$("msgScheme"+$("message-template-id").value).className="checked";if(A==0){$("ownMessageInput").disabled="";$("ownMessageInput").className=""}else{$("ownMessageInput").disabled="disabled";$("ownMessageInput").className="inactive"}},replyWithChat:function(B,A){AppFramework.hideLightBox(B);chat.showDialogBox(A,1);return false},openTopicWindow:function(A){this.sendRequest("newTopic",{recipient:A},function(C){if(C.status!=this.RESPONSE_RESULT_OK){this.showLightBoxStatic("alert",'<div class="alert">'+Lang.ajaxError+"</div>"+this.getWinCloseButton("alert"),{width:250,height:120})}else{var B=Object.clone(AppFramework.defaultDialogParams);Object.extend(B,{});B.className="flirt-lightbox";B.width=590;B.height=370;this._showLightbox("newTopicLightBox",B,C.html)}}.bind(this),function(B){this.showLightBoxStatic("alert",'<div class="alert">'+Lang.ajaxError+"</div>"+this.getWinCloseButton("alert"),{width:250,height:120})}.bind(this));return false},newTopic:function(){var A=Form.serialize("newtopic-lightbox",true);A.content=A.content.substring(0,Mail.MAX_LENGTH_CONTENT);this.sendRequest("createTopic",A,function(B){AppFramework.hideLightBox("newTopicLightBox");if(B.status!=this.RESPONSE_RESULT_OK){this.showLightBoxStatic("alert",'<div class="alert">'+Lang.ajaxError+"</div>"+this.getWinCloseButton("alert"),{width:250,height:120})}}.bind(this));return false},switchUrlDomain:function(A,C){var B=A.match("(?:http://|https://)[a-z0-9_.-]+")[0];return A.replace(B,C)},getCrossDomainFile:function(){return this.imageDomain+"/crossdomain.xml"},replyFlirtBack:function(A){var B=Form.serialize("replyflirt-form",true);this.sendRequest("replyFlirtBack",B,function(C){if(C.html){}})},startChat:function(B,A,C){if(C){AppFramework.hideLightBox(C)}this.sendRequest("startChat",{topicId:B},function(D){if(D.status!=this.RESPONSE_RESULT_OK){this.showLightBoxStatic("alert",'<div class="alert">'+Lang.ajaxError+"</div>"+this.getWinCloseButton("alert"),{width:250,height:120})}else{chat.showDialogBox(A,chat.STATUS_INVITE)}}.bind(this));return false}});var Gift=Class.create();Object.extend(Gift.prototype,AppFramework.prototype);Object.extend(Gift.prototype,{appid:"Gift",receivedQueue:[],receivedVisible:false,currentPage:0,GIFTS_PER_PAGE:6,HALLOWEEN_URL:"http://www.mojageneracja.pl/2080/blog/71885565490ad6a7e84e4",CLEAR_URL:"http://direct.afilo.pl/z/10859/CD609/",queueReceivedGift:function(D,B,A){var C=false;var E={"eId":D,"gId":B,"thumb":A};for(i=0;i<this.receivedQueue.length;i++){if(this.receivedQueue[i].gId.toString()==B.toString()){C=true;break}}if(!C){this.receivedQueue.push(E)}},getGift:function(C,B,A){return this.sendRequest("viewReceivedInstance",{"giftId":C.toString(),"eventId":B},A)},showReceivedGift:function(B,A){this.receivedVisible=true;this.getGift(B,A,function(C){if(C.status==this.RESPONSE_RESULT_OK){if(C.html){if(!AppFramework.dialogs["receivedGiftBox"]){this.showLightBoxStatic("receivedGiftBox",C.html,{"width":500,"height":500,"closable":false})}else{AppFramework.hideLightBox("receivedGiftBox");this.showLightBoxStatic("receivedGiftBox",C.html,{"width":500,"height":500,"closable":false})}gift.placeSwf(C.url);this.receivedVisible=true}else{this.receivedVisible=false}}}.bind(this));return false},closeInstanceInfo:function(){AppFramework.hideLightBox("receivedGiftBox");return false},closeReceivedInstance:function(){this.receivedVisible=false;AppFramework.hideLightBox("receivedGiftBox");this.showReceivedGifts();return false},showInstanceInfo:function(A){this.sendRequest("viewInstanceInfo",{"giftId":A},function(B){$("gifts-container").hide();$("gift-preview-container").innerHTML=B.html;$("gift-preview-container").show()}.bind(this));return false},cancelInstanceInfo:function(){$("gifts-container").show();$("gift-preview-container").hide();return false},viewGiftInstance:function(A){this.sendRequest("viewGiftInstance",{"giftId":A},function(B){if(B.status==this.RESPONSE_RESULT_OK){if(B.html){this.showLightBoxStatic("receivedGiftBox",B.html,{"width":500,"height":500});gift.placeSwf(B.url)}}}.bind(this));return false},placeSwf:function(B){var A=new SWFObject(B,"","480","420","9","#FFFFFF");A.addParam("quality","high");A.addParam("wmode","transparent");A.addParam("menu","false");A.addParam("play","true");A.addParam("loop","false");A.addVariable("clickTag",this.CLEAR_URL);A.write("giftPrev");return false},notifyMsg:function(A){$("notifyBox").innerHTML=A;return false},showReceivedGifts:function(){if(this.receivedQueue.length==0||this.receivedVisible){return false}var A=this.receivedQueue.pop();return this.showReceivedGift(A.gId,A.eId)}});var gift=new Gift();var SuperFriends=Class.create();Object.extend(SuperFriends.prototype,AppFramework.prototype);Object.extend(SuperFriends.prototype,{appid:"SuperFriends",inviteSuperFriend:function(){this.sendRequest("inviteSuperFriend",{},function(A){if(typeof A.error!="undefined"){this.showLightBoxStatic("super-friend-invited",'<div class="sf-notice">'+A.error+"</div>"+this.getWinCloseButton("super-friend-invited"),{width:300,height:150})}else{if(typeof A.msg!="undefined"){this.showLightBoxStatic("super-friend-invited",'<div class="sf-notice">'+A.msg+"</div>"+this.getWinCloseButton("super-friend-invited"),{width:300,height:150})}}return false}.bind(this));return false},showInvitationBox:function(){this.showLightBox("sf-invitation-box","viewUserInvitations",{},{width:420,height:380},function(A){});return false},acceptInvitation:function(){var A=Form.serialize("sf-invitations",true);if($("sf_accept_uid").value==0){Element.update("sf-invitation-error",Lang.sfChooseInviter)}else{this.sendRequest("acceptInvitation",A,function(B){if(typeof B.error!="undefined"){Element.update("sf-invitation-error",B.error)}else{window.location=B.redirectLink}return false}.bind(this))}return false},rejectAllInvitations:function(){this.sendRequest("rejectAllInvitations",{},function(A){if(typeof A.error!="undefined"){Element.update("sf-invitation-error",A.error)}else{AppFramework.hideLightBox("sf-invitation-box")}}.bind(this))},getLatelyConnectedPage:function(A){this.sendRequest("getLatelyConnectedPacket",{page:A},function(B){if(typeof B.error=="undefined"){Element.update("sf-lately-connected-content",B.html)}return false}.bind(this));return false},setSharedContent:function(){var A=Form.serialize("sf-accept-shared-content",true);this.sendRequest("acceptSharedContent",A,function(B){if(typeof B.error!="undefined"){Element.update("sf-accept-shared-content-error",B.error)}else{window.location=B.redirectLink}}.bind(this));return false},boostSuperFriend:function(){this.sendRequest("boostSuperFriend",{},function(A){if(typeof A.error!="undefined"){this.showLightBoxStatic("super-friend-boosted",'<div class="sf-notice">'+A.error+"</div>"+this.getWinCloseButton("super-friend-boosted"),{width:300,height:180})}else{Effect.Fade($("sf-mega-plus-link"),{afterFinish:function(){superfriends.showLightBoxStatic("super-friend-boosted",'<div class="sf-notice">'+A.html+"</div>"+superfriends.getWinCloseButton("super-friend-boosted"),{width:300,height:180})}})}}.bind(this));return false}});var superfriends=new SuperFriends();var SimpleSection=Class.create();Object.extend(SimpleSection.prototype,AppFramework.prototype);Object.extend(SimpleSection.prototype,{appid:"SimpleSection",selectedUinsCount:0,selectedUinsMax:10,prevHash:"",fantaGetWaitingPage:function(A){this.sendRequest("fantaGetWaintingForPresentPacket",{"page":A},function(B){if(B.status==1){$("left-container").update(B.html)}}.bind(this));return false},fantaGetRecentPage:function(A){this.sendRequest("fantaGetRecentPresentsPacket",{"page":A},function(B){if(B.status==1){$("recent-contaioner").update(B.html)}}.bind(this));return false},showOrangeUserbarLB:function(A){this.showLightBox("orange-userbar-lb","showOrangeUserbarLB",{"showOnly":A},{width:550,height:450});return false},showOrangeHappyDay:function(){this.showLightBox("orange-happyday-lb","showOrangeHappyDay",{},{width:550,height:400});return false},setUserbar:function(A){$("userbarId").value=A;$("userbar-choosed-name").update($("userbar-id-"+A).innerHTML);AppFramework.hideLightBox("orange-userbar-lb");return false},processUserbarRequest:function(){var A=Form.serialize("userbar-request",true);this.sendRequest("setUserbar",A,function(B){this.showLightBoxStatic("orange-form-validation-msg","<span>"+B.errorMsg+"</span>",{width:350,height:40})}.bind(this));return false},setInfoLabel:function(A){$("info-label").update($("info-label").innerHTML+"<p>"+A+"</p>")},showFullMsg:function(A){if(A==null){return false}Element.hide($(A+"-short"));Element.show($(A+"-full"));return false},hideFullMsg:function(A){if(A==null){return false}Element.show($(A+"-short"));Element.hide($(A+"-full"));return false},showOrangeRules:function(){this.showLightBox("orange-rules-lb","showOrangeRulesBox",{},{width:550,height:300});return false},getFriendsList:function(){this.showLightBox("orange-friendsList-lb","showOrangeFriendsListBox",{},{width:500,height:400});return false},selectUins:function(){var B=0;var A=Form.getInputs($("friendsList-uins"),"checkbox");A.each(function(C){if(C.checked){$("friendsuin_"+B).value=C.value;B++}});this.selectedUinsCount=0;AppFramework.hideLightBox("orange-friendsList-lb")},setUinAsSelected:function(A){if($(A).checked){if(this.selectedUinsCount<this.selectedUinsMax){this.selectedUinsCount++;Element.setStyle($("uins-"+A),{"backgroundColor":"#FF6501"});$("currentSelectedUins").update(this.selectedUinsCount.toString())}else{$(A).checked=false}}else{if(this.selectedUinsCount>0){this.selectedUinsCount--;Element.setStyle($("uins-"+A),{"backgroundColor":"#EFEFEF"});$("currentSelectedUins").update(this.selectedUinsCount.toString())}else{$(A).checked=true}}},maestroFutrzakiSetLightbox:function(){this.showLightBox("maestroFutrzaki-setLightbox","maestroFutrzakiSetElementLightbox",{},{width:600,height:520,closable:false});return false},maestroFutrzakiSetElement:function(A){this.sendRequest("maestroFutrzakiSetElement",{"elementId":A},function(C){if(C.status==1){if(C.currElement==null){$("maestroFutrzaki-element").removeClassName("futrzak__owner");$("maestroFutrzaki-element").addClassName("futrzak_"+A+"_owner");Effect.Fade("maestroFutrzaki-aboveAvatarsBox",{duration:1.5,"afterFinish":function(){Effect.Appear("maestroFutrzaki-avatarsBox",{duration:1.5})}})}else{$("maestroFutrzaki-element").removeClassName("futrzak_"+C.currElement+"_owner");$("maestroFutrzaki-element").addClassName("futrzak_"+A+"_owner")}AppFramework.hideLightBox("maestroFutrzaki-setLightbox");var B='<a href="http://gg.hit.gemius.pl/hitredir/id=.AiVfXRzLb24cSFl0vi2bacUfUpglGNijqoscpAqL3f.z7/stparam=qmjidxmpnq/url=http://www.maestrocard.pl/" target="_blank" class="maestroLink"></a><a href="#" onclick="AppFramework.hideLightBox(\'maestroFutrzaki-elementSetLightbox\');" class="closeButton"></a><img src="http://ad.hit.gemius.pl/redot.gif?l=8/tstamp=1234567890/id=..swQrSQZyp4UtmlBp4ndbdMPziYbK9hNBSx0sdwXd7.97/stparam=zimfiijiyx/fastid=1224979098645117476" style="position:absolute;" /><img src="http://gg.hit.gemius.pl/_1234567890/redot.gif?id=.AiVfXRzLb24cSFl0vi2bacUfUpglGNijqoscpAqL3f.z7/stparam=tlcspjdldv" style="position:absolute;" /><img src="http://gg.hit.gemius.pl/_1234567890/redot.gif?id=.AiVfXRzLb24cSFl0vi2bacUfUpglGNijqoscpAqL3f.z7/stparam=pigicvliul" style="position:absolute;" />';this.showLightBoxStatic("maestroFutrzaki-elementSetLightbox",B,{width:450,height:200,closable:false})}}.bind(this));return false},maestroFutrzakiGetPage:function(A){this.sendRequest("maestroFutrzakiLatestBoxPacket",{page:A},function(B){if(B.status==1){$("maestroFutrzaki-latestBox-buttons").update(B.html)}}.bind(this));return false},FC_checkHash:function(){if(location.hash!=this.prevHash){if(location.hash=="#login"){login.showLoginLightbox();location.hash=""}this.prevHash=location.hash}}});var simplesection=new SimpleSection()
