var Prototype={Version:'1.6.0.3',Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf('Opera')===-1),Opera:navigator.userAgent.indexOf('Opera')>-1,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,SelectorsAPI:!!document.querySelector,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 parent=null,properties=$A(arguments);if(Object.isFunction(properties[0]))
parent=properties.shift();function klass(){this.initialize.apply(this,arguments);}
Object.extend(klass,Class.Methods);klass.superclass=parent;klass.subclasses=[];if(parent){var subclass=function(){};subclass.prototype=parent.prototype;klass.prototype=new subclass;parent.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(source){var ancestor=this.superclass&&this.superclass.prototype;var properties=Object.keys(source);if(!Object.keys({toString:true}).length)
properties.push("toString","valueOf");for(var i=0,length=properties.length;i<length;i++){var property=properties[i],value=source[property];if(ancestor&&Object.isFunction(value)&&value.argumentNames().first()=="$super"){var method=value;value=(function(m){return function(){return ancestor[m].apply(this,arguments)};})(property).wrap(method);value.valueOf=method.valueOf.bind(method);value.toString=method.toString.bind(method);}
this.prototype[property]=value;}
return this;}};var Abstract={};Object.extend=function(destination,source){for(var property in source)
destination[property]=source[property];return destination;};Object.extend(Object,{inspect:function(object){try{if(Object.isUndefined(object))return'undefined';if(object===null)return'null';return object.inspect?object.inspect():String(object);}catch(e){if(e instanceof RangeError)return'...';throw e;}},toJSON:function(object){var type=typeof object;switch(type){case'undefined':case'function':case'unknown':return;case'boolean':return object.toString();}
if(object===null)return'null';if(object.toJSON)return object.toJSON();if(Object.isElement(object))return;var results=[];for(var property in object){var value=Object.toJSON(object[property]);if(!Object.isUndefined(value))
results.push(property.toJSON()+': '+value);}
return'{'+results.join(', ')+'}';},toQueryString:function(object){return $H(object).toQueryString();},toHTML:function(object){return object&&object.toHTML?object.toHTML():String.interpret(object);},keys:function(object){var keys=[];for(var property in object)
keys.push(property);return keys;},values:function(object){var values=[];for(var property in object)
values.push(object[property]);return values;},clone:function(object){return Object.extend({},object);},isElement:function(object){return!!(object&&object.nodeType==1);},isArray:function(object){return object!=null&&typeof object=="object"&&'splice'in object&&'join'in object;},isHash:function(object){return object instanceof Hash;},isFunction:function(object){return typeof object=="function";},isString:function(object){return typeof object=="string";},isNumber:function(object){return typeof object=="number";},isUndefined:function(object){return typeof object=="undefined";}});Object.extend(Function.prototype,{argumentNames:function(){var names=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,'').split(',');return names.length==1&&!names[0]?[]:names;},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)));}},bindAsEventListener:function(){var __method=this,args=$A(arguments),object=args.shift();return function(event){return __method.apply(object,[event||window.event].concat(args));}},curry:function(){if(!arguments.length)return this;var __method=this,args=$A(arguments);return function(){return __method.apply(this,args.concat($A(arguments)));}},delay:function(){var __method=this,args=$A(arguments),timeout=args.shift()*1000;return window.setTimeout(function(){return __method.apply(__method,args);},timeout);},defer:function(){var args=[0.01].concat($A(arguments));return this.delay.apply(this,args);},wrap:function(wrapper){var __method=this;return function(){return wrapper.apply(this,[__method.bind(this)].concat($A(arguments)));}},methodize:function(){if(this._methodized)return this._methodized;var __method=this;return this._methodized=function(){return __method.apply(null,[this].concat($A(arguments)));};}});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 returnValue;for(var i=0,length=arguments.length;i<length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
return returnValue;}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(str){return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1');};var PeriodicalExecuter=Class.create({initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;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(value){return value==null?'':String(value);},specialChar:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','\\':'\\\\'}});Object.extend(String.prototype,{gsub:function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
return result;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});},scan:function(pattern,iterator){this.gsub(pattern,iterator);return String(this);},truncate:function(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation: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 matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)});},escapeHTML:function(){var self=arguments.callee;self.text.data=this;return self.div.innerHTML;},unescapeHTML:function(){var div=new Element('div');div.innerHTML=this.stripTags();return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject('',function(memo,node){return memo+node.nodeValue}):div.childNodes[0].nodeValue):'';},toQueryParams:function(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(value);if(key in hash){if(!Object.isArray(hash[key]))hash[key]=[hash[key]];hash[key].push(value);}
else hash[key]=value;}
return hash;});},toArray:function(){return this.split('');},succ:function(){return this.slice(0,this.length-1)+
String.fromCharCode(this.charCodeAt(this.length-1)+1);},times:function(count){return count<1?'':new Array(count+1).join(this);},camelize:function(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++)
camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1);return camelized;},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(useDoubleQuotes){var escapedString=this.gsub(/[\x00-\x1f\\]/,function(match){var character=String.specialChar[match[0]];return character?character:'\\u00'+match[0].charCodeAt().toPaddedString(2,16);});if(useDoubleQuotes)return'"'+escapedString.replace(/"/g,'\\"')+'"';return"'"+escapedString.replace(/'/g,'\\\'')+"'";},toJSON:function(){return this.inspect(true);},unfilterJSON:function(filter){return this.sub(filter||Prototype.JSONFilter,'#{1}');},isJSON:function(){var str=this;if(str.blank())return false;str=this.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'');return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON())return eval('('+json+')');}catch(e){}
throw new SyntaxError('Badly formed JSON string: '+this.inspect());},include:function(pattern){return this.indexOf(pattern)>-1;},startsWith:function(pattern){return this.indexOf(pattern)===0;},endsWith:function(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d;},empty:function(){return this=='';},blank:function(){return/^\s*$/.test(this);},interpolate:function(object,pattern){return new Template(this,pattern).evaluate(object);}});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.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');}});String.prototype.gsub.prepareReplacement=function(replacement){if(Object.isFunction(replacement))return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)};};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement('div'),text:document.createTextNode('')});String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);var Template=Class.create({initialize:function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern;},evaluate:function(object){if(Object.isFunction(object.toTemplateReplacements))
object=object.toTemplateReplacements();return this.template.gsub(this.pattern,function(match){if(object==null)return'';var before=match[1]||'';if(before=='\\')return match[2];var ctx=object,expr=match[3];var pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match=pattern.exec(expr);if(match==null)return before;while(match!=null){var comp=match[1].startsWith('[')?match[2].gsub('\\\\]',']'):match[1];ctx=ctx[comp];if(null==ctx||''==match[3])break;expr=expr.substring('['==match[3]?match[1].length:match[0].length);match=pattern.exec(expr);}
return before+String.interpret(ctx);});}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(iterator,context){var index=0;try{this._each(function(value){iterator.call(context,value,index++);});}catch(e){if(e!=$break)throw e;}
return this;},eachSlice:function(number,iterator,context){var index=-number,slices=[],array=this.toArray();if(number<1)return array;while((index+=number)<array.length)
slices.push(array.slice(index,index+number));return slices.collect(iterator,context);},all:function(iterator,context){iterator=iterator||Prototype.K;var result=true;this.each(function(value,index){result=result&&!!iterator.call(context,value,index);if(!result)throw $break;});return result;},any:function(iterator,context){iterator=iterator||Prototype.K;var result=false;this.each(function(value,index){if(result=!!iterator.call(context,value,index))
throw $break;});return result;},collect:function(iterator,context){iterator=iterator||Prototype.K;var results=[];this.each(function(value,index){results.push(iterator.call(context,value,index));});return results;},detect:function(iterator,context){var result;this.each(function(value,index){if(iterator.call(context,value,index)){result=value;throw $break;}});return result;},findAll:function(iterator,context){var results=[];this.each(function(value,index){if(iterator.call(context,value,index))
results.push(value);});return results;},grep:function(filter,iterator,context){iterator=iterator||Prototype.K;var results=[];if(Object.isString(filter))
filter=new RegExp(filter);this.each(function(value,index){if(filter.match(value))
results.push(iterator.call(context,value,index));});return results;},include:function(object){if(Object.isFunction(this.indexOf))
if(this.indexOf(object)!=-1)return true;var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;},inGroupsOf:function(number,fillWith){fillWith=Object.isUndefined(fillWith)?null:fillWith;return this.eachSlice(number,function(slice){while(slice.length<number)slice.push(fillWith);return slice;});},inject:function(memo,iterator,context){this.each(function(value,index){memo=iterator.call(context,memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.map(function(value){return value[method].apply(value,args);});},max:function(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value>=result)
result=value;});return result;},min:function(iterator,context){iterator=iterator||Prototype.K;var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value<result)
result=value;});return result;},partition:function(iterator,context){iterator=iterator||Prototype.K;var trues=[],falses=[];this.each(function(value,index){(iterator.call(context,value,index)?trues:falses).push(value);});return[trues,falses];},pluck:function(property){var results=[];this.each(function(value){results.push(value[property]);});return results;},reject:function(iterator,context){var results=[];this.each(function(value,index){if(!iterator.call(context,value,index))
results.push(value);});return results;},sortBy:function(iterator,context){return this.map(function(value,index){return{value:value,criteria:iterator.call(context,value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');},toArray:function(){return this.map();},zip:function(){var iterator=Prototype.K,args=$A(arguments);if(Object.isFunction(args.last()))
iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){return iterator(collections.pluck(index));});},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(iterable){if(!iterable)return[];if(iterable.toArray)return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];return results;}
if(Prototype.Browser.WebKit){$A=function(iterable){if(!iterable)return[];if(!(typeof iterable==='function'&&typeof iterable.length==='number'&&typeof iterable.item==='function')&&iterable.toArray)
return iterable.toArray();var length=iterable.length||0,results=new Array(length);while(length--)results[length]=iterable[length];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(iterator){for(var i=0,length=this.length;i<length;i++)
iterator(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(value){return value!=null;});},flatten:function(){return this.inject([],function(array,value){return array.concat(Object.isArray(value)?value.flatten():[value]);});},without:function(){var values=$A(arguments);return this.select(function(value){return!values.include(value);});},reverse:function(inline){return(inline!==false?this:this.toArray())._reverse();},reduce:function(){return this.length>1?this:this[0];},uniq:function(sorted){return this.inject([],function(array,value,index){if(0==index||(sorted?array.last()!=value:!array.include(value)))
array.push(value);return array;});},intersect:function(array){return this.uniq().findAll(function(item){return array.detect(function(value){return item===value});});},clone:function(){return[].concat(this);},size:function(){return this.length;},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']';},toJSON:function(){var results=[];this.each(function(object){var value=Object.toJSON(object);if(!Object.isUndefined(value))results.push(value);});return'['+results.join(', ')+']';}});if(Object.isFunction(Array.prototype.forEach))
Array.prototype._each=Array.prototype.forEach;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(item,i){i||(i=0);var length=this.length;if(i<0)i=length+i;for(;i<length;i++)
if(this[i]===item)return i;return-1;};if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(item,i){i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;var n=this.slice(0,i).reverse().indexOf(item);return(n<0)?n:i-n-1;};Array.prototype.toArray=Array.prototype.clone;function $w(string){if(!Object.isString(string))return[];string=string.strip();return string?string.split(/\s+/):[];}
if(Prototype.Browser.Opera){Array.prototype.concat=function(){var array=[];for(var i=0,length=this.length;i<length;i++)array.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++)
array.push(arguments[i][j]);}else{array.push(arguments[i]);}}
return array;};}
Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16);},succ:function(){return this+1;},times:function(iterator,context){$R(0,this,true).each(iterator,context);return this;},toPaddedString:function(length,radix){var string=this.toString(radix||10);return'0'.times(length-string.length)+string;},toJSON:function(){return isFinite(this)?this.toString():'null';}});$w('abs round ceil floor').each(function(method){Number.prototype[method]=Math[method].methodize();});function $H(object){return new Hash(object);};var Hash=Class.create(Enumerable,(function(){function toQueryPair(key,value){if(Object.isUndefined(value))return key;return key+'='+encodeURIComponent(String.interpret(value));}
return{initialize:function(object){this._object=Object.isHash(object)?object.toObject():Object.clone(object);},_each:function(iterator){for(var key in this._object){var value=this._object[key],pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}},set:function(key,value){return this._object[key]=value;},get:function(key){if(this._object[key]!==Object.prototype[key])
return this._object[key];},unset:function(key){var value=this._object[key];delete this._object[key];return value;},toObject:function(){return Object.clone(this._object);},keys:function(){return this.pluck('key');},values:function(){return this.pluck('value');},index:function(value){var match=this.detect(function(pair){return pair.value===value;});return match&&match.key;},merge:function(object){return this.clone().update(object);},update:function(object){return new Hash(object).inject(this,function(result,pair){result.set(pair.key,pair.value);return result;});},toQueryString:function(){return this.inject([],function(results,pair){var key=encodeURIComponent(pair.key),values=pair.value;if(values&&typeof values=='object'){if(Object.isArray(values))
return results.concat(values.map(toQueryPair.curry(key)));}else results.push(toQueryPair(key,values));return results;}).join('&');},inspect:function(){return'#<Hash:{'+this.map(function(pair){return pair.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(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ();}},include:function(value){if(value<this.start)
return false;if(this.exclusive)
return value<this.end;return value<=this.end;}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive);};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(iterator){this.responders._each(iterator);},register:function(responder){if(!this.include(responder))
this.responders.push(responder);},unregister:function(responder){this.responders=this.responders.without(responder);},dispatch:function(callback,request,transport,json){this.each(function(responder){if(Object.isFunction(responder[callback])){try{responder[callback].apply(responder,[request,transport,json]);}catch(e){}}});}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(options){this.options={method:'post',asynchronous:true,contentType:'application/x-www-form-urlencoded',encoding:'UTF-8',parameters:'',evalJSON:true,evalJS:true};Object.extend(this.options,options||{});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,url,options){$super(options);this.transport=Ajax.getTransport();this.request(url);},request:function(url){this.url=url;this.method=this.options.method;var params=Object.clone(this.options.parameters);if(!['get','post'].include(this.method)){params['_method']=this.method;this.method='post';}
this.parameters=params;if(params=Object.toQueryString(params)){if(this.method=='get')
this.url+=(this.url.include('?')?'&':'?')+params;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
params+='&_=';}
try{var response=new Ajax.Response(this);if(this.options.onCreate)this.options.onCreate(response);Ajax.Responders.dispatch('onCreate',this,response);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||params):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType)
this.onStateChange();}
catch(e){this.dispatchException(e);}},onStateChange:function(){var readyState=this.transport.readyState;if(readyState>1&&!((readyState==4)&&this._complete))
this.respondToReadyState(this.transport.readyState);},setRequestHeaders:function(){var headers={'X-Requested-With':'XMLHttpRequest','X-Prototype-Version':Prototype.Version,'Accept':'text/javascript, text/html, application/xml, text/xml, */*'};if(this.method=='post'){headers['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)
headers['Connection']='close';}
if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;if(Object.isFunction(extras.push))
for(var i=0,length=extras.length;i<length;i+=2)
headers[extras[i]]=extras[i+1];else
$H(extras).each(function(pair){headers[pair.key]=pair.value});}
for(var name in headers)
this.transport.setRequestHeader(name,headers[name]);},success:function(){var status=this.getStatus();return!status||(status>=200&&status<300);},getStatus:function(){try{return this.transport.status||0;}catch(e){return 0}},respondToReadyState:function(readyState){var state=Ajax.Request.Events[readyState],response=new Ajax.Response(this);if(state=='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 contentType=response.getHeader('Content-type');if(this.options.evalJS=='force'||(this.options.evalJS&&this.isSameOrigin()&&contentType&&contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
this.evalResponse();}
try{(this.options['on'+state]||Prototype.emptyFunction)(response,response.headerJSON);Ajax.Responders.dispatch('on'+state,this,response,response.headerJSON);}catch(e){this.dispatchException(e);}
if(state=='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(name){try{return this.transport.getResponseHeader(name)||null;}catch(e){return null}},evalResponse:function(){try{return eval((this.transport.responseText||'').unfilterJSON());}catch(e){this.dispatchException(e);}},dispatchException:function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Response=Class.create({initialize:function(request){this.request=request;var transport=this.transport=request.transport,readyState=this.readyState=transport.readyState;if((readyState>2&&!Prototype.Browser.IE)||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(transport.responseText);this.headerJSON=this._getHeaderJSON();}
if(readyState==4){var xml=transport.responseXML;this.responseXML=Object.isUndefined(xml)?null:xml;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(name){return this.transport.getResponseHeader(name);},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders();},_getHeaderJSON:function(){var json=this.getHeader('X-JSON');if(!json)return null;json=decodeURIComponent(escape(json));try{return json.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}},_getResponseJSON:function(){var options=this.request.options;if(!options.evalJSON||(options.evalJSON!='force'&&!(this.getHeader('Content-type')||'').include('application/json'))||this.responseText.blank())
return null;try{return this.responseText.evalJSON(options.sanitizeJSON||!this.request.isSameOrigin());}catch(e){this.request.dispatchException(e);}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,container,url,options){this.container={success:(container.success||container),failure:(container.failure||(container.success?null:container))};options=Object.clone(options);var onComplete=options.onComplete;options.onComplete=(function(response,json){this.updateContent(response.responseText);if(Object.isFunction(onComplete))onComplete(response,json);}).bind(this);$super(url,options);},updateContent:function(responseText){var receiver=this.container[this.success()?'success':'failure'],options=this.options;if(!options.evalScripts)responseText=responseText.stripScripts();if(receiver=$(receiver)){if(options.insertion){if(Object.isString(options.insertion)){var insertion={};insertion[options.insertion]=responseText;receiver.insert(insertion);}
else options.insertion(receiver,responseText);}
else receiver.update(responseText);}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,container,url,options){$super(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;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(response){if(this.options.decay){this.decay=(response.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=response.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 $(element){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++)
elements.push($(arguments[i]));return elements;}
if(Object.isString(element))
element=document.getElementById(element);return Element.extend(element);}
if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(expression,parentElement){var results=[];var query=document.evaluate(expression,$(parentElement)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,length=query.snapshotLength;i<length;i++)
results.push(Element.extend(query.snapshotItem(i)));return results;};}
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 element=this.Element;this.Element=function(tagName,attributes){attributes=attributes||{};tagName=tagName.toLowerCase();var cache=Element.cache;if(Prototype.Browser.IE&&attributes.name){tagName='<'+tagName+' name="'+attributes.name+'">';delete attributes.name;return Element.writeAttribute(document.createElement(tagName),attributes);}
if(!cache[tagName])cache[tagName]=Element.extend(document.createElement(tagName));return Element.writeAttribute(cache[tagName].cloneNode(false),attributes);};Object.extend(this.Element,element||{});if(element)this.Element.prototype=element.prototype;}).call(window);Element.cache={};Element.Methods={visible:function(element){return $(element).style.display!='none';},toggle:function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element;},hide:function(element){element=$(element);element.style.display='none';return element;},show:function(element){element=$(element);element.style.display='';return element;},remove:function(element){element=$(element);element.parentNode.removeChild(element);return element;},update:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;},replace:function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();else if(!Object.isElement(content)){content=Object.toHTML(content);var range=element.ownerDocument.createRange();range.selectNode(element);content.evalScripts.bind(content).defer();content=range.createContextualFragment(content.stripScripts());}
element.parentNode.replaceChild(content,element);return element;},insert:function(element,insertions){element=$(element);if(Object.isString(insertions)||Object.isNumber(insertions)||Object.isElement(insertions)||(insertions&&(insertions.toElement||insertions.toHTML)))
insertions={bottom:insertions};var content,insert,tagName,childNodes;for(var position in insertions){content=insertions[position];position=position.toLowerCase();insert=Element._insertionTranslations[position];if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){insert(element,content);continue;}
content=Object.toHTML(content);tagName=((position=='before'||position=='after')?element.parentNode:element).tagName.toUpperCase();childNodes=Element._getContentFromAnonymousElement(tagName,content.stripScripts());if(position=='top'||position=='after')childNodes.reverse();childNodes.each(insert.curry(element));content.evalScripts.bind(content).defer();}
return element;},wrap:function(element,wrapper,attributes){element=$(element);if(Object.isElement(wrapper))
$(wrapper).writeAttribute(attributes||{});else if(Object.isString(wrapper))wrapper=new Element(wrapper,attributes);else wrapper=new Element('div',wrapper);if(element.parentNode)
element.parentNode.replaceChild(wrapper,element);wrapper.appendChild(element);return wrapper;},inspect:function(element){element=$(element);var result='<'+element.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(pair){var property=pair.first(),attribute=pair.last();var value=(element[property]||'').toString();if(value)result+=' '+attribute+'='+value.inspect(true);});return result+'>';},recursivelyCollect:function(element,property){element=$(element);var elements=[];while(element=element[property])
if(element.nodeType==1)
elements.push(Element.extend(element));return elements;},ancestors:function(element){return $(element).recursivelyCollect('parentNode');},descendants:function(element){return $(element).select("*");},firstDescendant:function(element){element=$(element).firstChild;while(element&&element.nodeType!=1)element=element.nextSibling;return $(element);},immediateDescendants:function(element){if(!(element=$(element).firstChild))return[];while(element&&element.nodeType!=1)element=element.nextSibling;if(element)return[element].concat($(element).nextSiblings());return[];},previousSiblings:function(element){return $(element).recursivelyCollect('previousSibling');},nextSiblings:function(element){return $(element).recursivelyCollect('nextSibling');},siblings:function(element){element=$(element);return element.previousSiblings().reverse().concat(element.nextSiblings());},match:function(element,selector){if(Object.isString(selector))
selector=new Selector(selector);return selector.match($(element));},up:function(element,expression,index){element=$(element);if(arguments.length==1)return $(element.parentNode);var ancestors=element.ancestors();return Object.isNumber(expression)?ancestors[expression]:Selector.findElement(ancestors,expression,index);},down:function(element,expression,index){element=$(element);if(arguments.length==1)return element.firstDescendant();return Object.isNumber(expression)?element.descendants()[expression]:Element.select(element,expression)[index||0];},previous:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(element));var previousSiblings=element.previousSiblings();return Object.isNumber(expression)?previousSiblings[expression]:Selector.findElement(previousSiblings,expression,index);},next:function(element,expression,index){element=$(element);if(arguments.length==1)return $(Selector.handlers.nextElementSibling(element));var nextSiblings=element.nextSiblings();return Object.isNumber(expression)?nextSiblings[expression]:Selector.findElement(nextSiblings,expression,index);},select:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element,args);},adjacent:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element.parentNode,args).without(element);},identify:function(element){element=$(element);var id=element.readAttribute('id'),self=arguments.callee;if(id)return id;do{id='anonymous_element_'+self.counter++}while($(id));element.writeAttribute('id',id);return id;},readAttribute:function(element,name){element=$(element);if(Prototype.Browser.IE){var t=Element._attributeTranslations.read;if(t.values[name])return t.values[name](element,name);if(t.names[name])name=t.names[name];if(name.include(':')){return(!element.attributes||!element.attributes[name])?null:element.attributes[name].value;}}
return element.getAttribute(name);},writeAttribute:function(element,name,value){element=$(element);var attributes={},t=Element._attributeTranslations.write;if(typeof name=='object')attributes=name;else attributes[name]=Object.isUndefined(value)?true:value;for(var attr in attributes){name=t.names[attr]||attr;value=attributes[attr];if(t.values[attr])name=t.values[attr](element,value);if(value===false||value===null)
element.removeAttribute(name);else if(value===true)
element.setAttribute(name,name);else element.setAttribute(name,value);}
return element;},getHeight:function(element){return $(element).getDimensions().height;},getWidth:function(element){return $(element).getDimensions().width;},classNames:function(element){return new Element.ClassNames(element);},hasClassName:function(element,className){if(!(element=$(element)))return;var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)));},addClassName:function(element,className){if(!(element=$(element)))return;if(!element.hasClassName(className))
element.className+=(element.className?' ':'')+className;return element;},removeClassName:function(element,className){if(!(element=$(element)))return;element.className=element.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"),' ').strip();return element;},toggleClassName:function(element,className){if(!(element=$(element)))return;return element[element.hasClassName(className)?'removeClassName':'addClassName'](className);},cleanWhitespace:function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue))
element.removeChild(node);node=nextNode;}
return element;},empty:function(element){return $(element).innerHTML.blank();},descendantOf:function(element,ancestor){element=$(element),ancestor=$(ancestor);if(element.compareDocumentPosition)
return(element.compareDocumentPosition(ancestor)&8)===8;if(ancestor.contains)
return ancestor.contains(element)&&ancestor!==element;while(element=element.parentNode)
if(element==ancestor)return true;return false;},scrollTo:function(element){element=$(element);var pos=element.cumulativeOffset();window.scrollTo(pos[0],pos[1]);return element;},getStyle:function(element,style){element=$(element);style=style=='float'?'cssFloat':style.camelize();var value=element.style[style];if(!value||value=='auto'){var css=document.defaultView.getComputedStyle(element,null);value=css?css[style]:null;}
if(style=='opacity')return value?parseFloat(value):1.0;return value=='auto'?null:value;},getOpacity:function(element){return $(element).getStyle('opacity');},setStyle:function(element,styles){element=$(element);var elementStyle=element.style,match;if(Object.isString(styles)){element.style.cssText+=';'+styles;return styles.include('opacity')?element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]):element;}
for(var property in styles)
if(property=='opacity')element.setOpacity(styles[property]);else
elementStyle[(property=='float'||property=='cssFloat')?(Object.isUndefined(elementStyle.styleFloat)?'cssFloat':'styleFloat'):property]=styles[property];return element;},setOpacity:function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;return element;},getDimensions:function(element){element=$(element);var display=element.getStyle('display');if(display!='none'&&display!=null)
return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility='hidden';els.position='absolute';els.display='block';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(Prototype.Browser.Opera){element.style.top=0;element.style.left=0;}}
return element;},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';}
return element;},makeClipping:function(element){element=$(element);if(element._overflow)return element;element._overflow=Element.getStyle(element,'overflow')||'auto';if(element._overflow!=='hidden')
element.style.overflow='hidden';return element;},undoClipping:function(element){element=$(element);if(!element._overflow)return element;element.style.overflow=element._overflow=='auto'?'':element._overflow;element._overflow=null;return element;},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){if(element.tagName.toUpperCase()=='BODY')break;var p=Element.getStyle(element,'position');if(p!=='static')break;}}while(element);return Element._returnOffset(valueL,valueT);},absolutize:function(element){element=$(element);if(element.getStyle('position')=='absolute')return element;var offsets=element.positionedOffset();var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';element.style.left=left+'px';element.style.width=width+'px';element.style.height=height+'px';return element;},relativize:function(element){element=$(element);if(element.getStyle('position')=='relative')return element;element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;return element;},cumulativeScrollOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return Element._returnOffset(valueL,valueT);},getOffsetParent:function(element){if(element.offsetParent)return $(element.offsetParent);if(element==document.body)return $(element);while((element=element.parentNode)&&element!=document.body)
if(Element.getStyle(element,'position')!='static')
return $(element);return $(document.body);},viewportOffset:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body&&Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{if(!Prototype.Browser.Opera||(element.tagName&&(element.tagName.toUpperCase()=='BODY'))){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}}while(element=element.parentNode);return Element._returnOffset(valueL,valueT);},clonePosition:function(element,source){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});source=$(source);var p=source.viewportOffset();element=$(element);var delta=[0,0];var parent=null;if(Element.getStyle(element,'position')=='absolute'){parent=element.getOffsetParent();delta=parent.viewportOffset();}
if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;}
if(options.setLeft)element.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)element.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)element.style.width=source.offsetWidth+'px';if(options.setHeight)element.style.height=source.offsetHeight+'px';return element;}};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(proceed,element,style){switch(style){case'left':case'top':case'right':case'bottom':if(proceed(element,'position')==='static')return null;case'height':case'width':if(!Element.visible(element))return null;var dim=parseInt(proceed(element,style),10);if(dim!==element['offset'+style.capitalize()])
return dim+'px';var properties;if(style==='height'){properties=['border-top-width','padding-top','padding-bottom','border-bottom-width'];}
else{properties=['border-left-width','padding-left','padding-right','border-right-width'];}
return properties.inject(dim,function(memo,property){var val=proceed(element,property);return val===null?memo:memo-parseInt(val,10);})+'px';default:return proceed(element,style);}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(proceed,element,attribute){if(attribute==='title')return element.title;return proceed(element,attribute);});}
else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(proceed,element){element=$(element);try{element.offsetParent}
catch(e){return $(document.body)}
var position=element.getStyle('position');if(position!=='static')return proceed(element);element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});$w('positionedOffset viewportOffset').each(function(method){Element.Methods[method]=Element.Methods[method].wrap(function(proceed,element){element=$(element);try{element.offsetParent}
catch(e){return Element._returnOffset(0,0)}
var position=element.getStyle('position');if(position!=='static')return proceed(element);var offsetParent=element.getOffsetParent();if(offsetParent&&offsetParent.getStyle('position')==='fixed')
offsetParent.setStyle({zoom:1});element.setStyle({position:'relative'});var value=proceed(element);element.setStyle({position:position});return value;});});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(proceed,element){try{element.offsetParent}
catch(e){return Element._returnOffset(0,0)}
return proceed(element);});Element.Methods.getStyle=function(element,style){element=$(element);style=(style=='float'||style=='cssFloat')?'styleFloat':style.camelize();var value=element.style[style];if(!value&&element.currentStyle)value=element.currentStyle[style];if(style=='opacity'){if(value=(element.getStyle('filter')||'').match(/alpha\(opacity=(.*)\)/))
if(value[1])return parseFloat(value[1])/100;return 1.0;}
if(value=='auto'){if((style=='width'||style=='height')&&(element.getStyle('display')!='none'))
return element['offset'+style.capitalize()]+'px';return null;}
return value;};Element.Methods.setOpacity=function(element,value){function stripAlpha(filter){return filter.replace(/alpha\([^\)]*\)/gi,'');}
element=$(element);var currentStyle=element.currentStyle;if((currentStyle&&!currentStyle.hasLayout)||(!currentStyle&&element.style.zoom=='normal'))
element.style.zoom=1;var filter=element.getStyle('filter'),style=element.style;if(value==1||value===''){(filter=stripAlpha(filter))?style.filter=filter:style.removeAttribute('filter');return element;}else if(value<0.00001)value=0;style.filter=stripAlpha(filter)+'alpha(opacity='+(value*100)+')';return element;};Element._attributeTranslations={read:{names:{'class':'className','for':'htmlFor'},values:{_getAttr:function(element,attribute){return element.getAttribute(attribute,2);},_getAttrNode:function(element,attribute){var node=element.getAttributeNode(attribute);return node?node.value:"";},_getEv:function(element,attribute){attribute=element.getAttribute(attribute);return attribute?attribute.toString().slice(23,-2):null;},_flag:function(element,attribute){return $(element).hasAttribute(attribute)?attribute:null;},style:function(element){return element.style.cssText.toLowerCase();},title:function(element){return element.title;}}}};Element._attributeTranslations.write={names:Object.extend({cellpadding:'cellPadding',cellspacing:'cellSpacing'},Element._attributeTranslations.read.names),values:{checked:function(element,value){element.checked=!!value;},style:function(element,value){element.style.cssText=value?value:'';}}};Element._attributeTranslations.has={};$w('colSpan rowSpan vAlign dateTime accessKey tabIndex '+'encType maxLength readOnly longDesc frameBorder').each(function(attr){Element._attributeTranslations.write.names[attr.toLowerCase()]=attr;Element._attributeTranslations.has[attr.toLowerCase()]=attr;});(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(element,value){element=$(element);element.style.opacity=(value==1)?0.999999:(value==='')?'':(value<0.00001)?0:value;return element;};}
else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(element,value){element=$(element);element.style.opacity=(value==1||value==='')?'':(value<0.00001)?0:value;if(value==1)
if(element.tagName.toUpperCase()=='IMG'&&element.width){element.width++;element.width--;}else try{var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}
return element;};Element.Methods.cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return Element._returnOffset(valueL,valueT);};}
if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content))return element.update().insert(content);content=Object.toHTML(content);var tagName=element.tagName.toUpperCase();if(tagName in Element._insertionTranslations.tags){$A(element.childNodes).each(function(node){element.removeChild(node)});Element._getContentFromAnonymousElement(tagName,content.stripScripts()).each(function(node){element.appendChild(node)});}
else element.innerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
if('outerHTML'in document.createElement('div')){Element.Methods.replace=function(element,content){element=$(element);if(content&&content.toElement)content=content.toElement();if(Object.isElement(content)){element.parentNode.replaceChild(content,element);return element;}
content=Object.toHTML(content);var parent=element.parentNode,tagName=parent.tagName.toUpperCase();if(Element._insertionTranslations.tags[tagName]){var nextSibling=element.next();var fragments=Element._getContentFromAnonymousElement(tagName,content.stripScripts());parent.removeChild(element);if(nextSibling)
fragments.each(function(node){parent.insertBefore(node,nextSibling)});else
fragments.each(function(node){parent.appendChild(node)});}
else element.outerHTML=content.stripScripts();content.evalScripts.bind(content).defer();return element;};}
Element._returnOffset=function(l,t){var result=[l,t];result.left=l;result.top=t;return result;};Element._getContentFromAnonymousElement=function(tagName,html){var div=new Element('div'),t=Element._insertionTranslations.tags[tagName];if(t){div.innerHTML=t[0]+html+t[1];t[2].times(function(){div=div.firstChild});}else div.innerHTML=html;return $A(div.childNodes);};Element._insertionTranslations={before:function(element,node){element.parentNode.insertBefore(node,element);},top:function(element,node){element.insertBefore(node,element.firstChild);},bottom:function(element,node){element.appendChild(node);},after:function(element,node){element.parentNode.insertBefore(node,element.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(element,attribute){attribute=Element._attributeTranslations.has[attribute]||attribute;var node=$(element).getAttributeNode(attribute);return!!(node&&node.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 Methods={},ByTag=Element.Methods.ByTag;var extend=Object.extend(function(element){if(!element||element._extendedByPrototype||element.nodeType!=1||element==window)return element;var methods=Object.clone(Methods),tagName=element.tagName.toUpperCase(),property,value;if(ByTag[tagName])Object.extend(methods,ByTag[tagName]);for(property in methods){value=methods[property];if(Object.isFunction(value)&&!(property in element))
element[property]=value.methodize();}
element._extendedByPrototype=Prototype.emptyFunction;return element;},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(Methods,Element.Methods);Object.extend(Methods,Element.Methods.Simulated);}}});extend.refresh();return extend;})();Element.hasAttribute=function(element,attribute){if(element.hasAttribute)return element.hasAttribute(attribute);return Element.Methods.Simulated.hasAttribute(element,attribute);};Element.addMethods=function(methods){var F=Prototype.BrowserFeatures,T=Element.Methods.ByTag;if(!methods){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 tagName=methods;methods=arguments[1];}
if(!tagName)Object.extend(Element.Methods,methods||{});else{if(Object.isArray(tagName))tagName.each(extend);else extend(tagName);}
function extend(tagName){tagName=tagName.toUpperCase();if(!Element.Methods.ByTag[tagName])
Element.Methods.ByTag[tagName]={};Object.extend(Element.Methods.ByTag[tagName],methods);}
function copy(methods,destination,onlyIfAbsent){onlyIfAbsent=onlyIfAbsent||false;for(var property in methods){var value=methods[property];if(!Object.isFunction(value))continue;if(!onlyIfAbsent||!(property in destination))
destination[property]=value.methodize();}}
function findDOMClass(tagName){var klass;var trans={"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(trans[tagName])klass='HTML'+trans[tagName]+'Element';if(window[klass])return window[klass];klass='HTML'+tagName+'Element';if(window[klass])return window[klass];klass='HTML'+tagName.capitalize()+'Element';if(window[klass])return window[klass];window[klass]={};window[klass].prototype=document.createElement(tagName)['__proto__'];return window[klass];}
if(F.ElementExtensions){copy(Element.Methods,HTMLElement.prototype);copy(Element.Methods.Simulated,HTMLElement.prototype,true);}
if(F.SpecificElementExtensions){for(var tag in Element.Methods.ByTag){var klass=findDOMClass(tag);if(Object.isUndefined(klass))continue;copy(T[tag],klass.prototype);}}
Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh)Element.extend.refresh();Element.cache={};};document.viewport={getDimensions:function(){var dimensions={},B=Prototype.Browser;$w('width height').each(function(d){var D=d.capitalize();if(B.WebKit&&!document.evaluate){dimensions[d]=self['inner'+D];}else if(B.Opera&&parseFloat(window.opera.version())<9.5){dimensions[d]=document.body['client'+D]}else{dimensions[d]=document.documentElement['client'+D];}});return dimensions;},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(expression){this.expression=expression.strip();if(this.shouldUseSelectorsAPI()){this.mode='selectorsAPI';}else if(this.shouldUseXPath()){this.mode='xpath';this.compileXPathMatcher();}else{this.mode="normal";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(e))
return false;return true;},shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI)return false;if(!Selector._div)Selector._div=new Element('div');try{Selector._div.querySelector(this.expression);}catch(e){return false;}
return true;},compileMatcher:function(){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(root){root=root||document;var e=this.expression,results;switch(this.mode){case'selectorsAPI':if(root!==document){var oldId=root.id,id=$(root).identify();e="#"+id+" "+e;}
results=$A(root.querySelectorAll(e)).map(Element.extend);root.id=oldId;return results;case'xpath':return document._getElementsByXPath(this.xpath,root);default:return this.matcher(root);}},match:function(element){this.tokens=[];var e=this.expression,ps=Selector.patterns,as=Selector.assertions;var le,p,m;while(e&&le!==e&&(/\S/).test(e)){le=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(element);}}}}
var match=true,name,matches;for(var i=0,token;token=this.tokens[i];i++){name=token[0],matches=token[1];if(!Selector.assertions[name](element,matches)){match=false;break;}}
return match;},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)]",'checked':"[@checked]",'disabled':"[(@disabled) and (@type!='hidden')]",'enabled':"[not(@disabled) and (@type!='hidden')]",'not':function(m){var e=m[6],p=Selector.patterns,x=Selector.xpath,le,v;var exclusion=[];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);exclusion.push("("+v.substring(1,v.length-1)+")");e=e.replace(m[0],'');break;}}}
return"[not("+exclusion.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(fragment,m){var mm,formula=m[6],predicate;if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';if(mm=formula.match(/^(\d+)$/))
return'['+fragment+"= "+mm[1]+']';if(mm=formula.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(mm[1]=="-")mm[1]=-1;var a=mm[1]?Number(mm[1]):1;var b=mm[2]?Number(mm[2]):0;predicate="[((#{fragment} - #{b}) mod #{a} = 0) and "+"((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(predicate).evaluate({fragment:fragment,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]+:)?[\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(element,matches){return matches[1].toUpperCase()==element.tagName.toUpperCase();},className:function(element,matches){return Element.hasClassName(element,matches[1]);},id:function(element,matches){return element.id===matches[1];},attrPresence:function(element,matches){return Element.hasAttribute(element,matches[1]);},attr:function(element,matches){var nodeValue=Element.readAttribute(element,matches[1]);return nodeValue&&Selector.operators[matches[2]](nodeValue,matches[5]||matches[6]);}},handlers:{concat:function(a,b){for(var i=0,node;node=b[i];i++)
a.push(node);return a;},mark:function(nodes){var _true=Prototype.emptyFunction;for(var i=0,node;node=nodes[i];i++)
node._countedByPrototype=_true;return nodes;},unmark:function(nodes){for(var i=0,node;node=nodes[i];i++)
node._countedByPrototype=undefined;return nodes;},index:function(parentNode,reverse,ofType){parentNode._countedByPrototype=Prototype.emptyFunction;if(reverse){for(var nodes=parentNode.childNodes,i=nodes.length-1,j=1;i>=0;i--){var node=nodes[i];if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}}else{for(var i=0,j=1,nodes=parentNode.childNodes;node=nodes[i];i++)
if(node.nodeType==1&&(!ofType||node._countedByPrototype))node.nodeIndex=j++;}},unique:function(nodes){if(nodes.length==0)return nodes;var results=[],n;for(var i=0,l=nodes.length;i<l;i++)
if(!(n=nodes[i])._countedByPrototype){n._countedByPrototype=Prototype.emptyFunction;results.push(Element.extend(n));}
return Selector.handlers.unmark(results);},descendant:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
h.concat(results,node.getElementsByTagName('*'));return results;},child:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[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(nodes){for(var i=0,results=[],node;node=nodes[i];i++){var next=this.nextElementSibling(node);if(next)results.push(next);}
return results;},laterSibling:function(nodes){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
h.concat(results,Element.nextSiblings(node));return results;},nextElementSibling:function(node){while(node=node.nextSibling)
if(node.nodeType==1)return node;return null;},previousElementSibling:function(node){while(node=node.previousSibling)
if(node.nodeType==1)return node;return null;},tagName:function(nodes,root,tagName,combinator){var uTagName=tagName.toUpperCase();var results=[],h=Selector.handlers;if(nodes){if(combinator){if(combinator=="descendant"){for(var i=0,node;node=nodes[i];i++)
h.concat(results,node.getElementsByTagName(tagName));return results;}else nodes=this[combinator](nodes);if(tagName=="*")return nodes;}
for(var i=0,node;node=nodes[i];i++)
if(node.tagName.toUpperCase()===uTagName)results.push(node);return results;}else return root.getElementsByTagName(tagName);},id:function(nodes,root,id,combinator){var targetNode=$(id),h=Selector.handlers;if(!targetNode)return[];if(!nodes&&root==document)return[targetNode];if(nodes){if(combinator){if(combinator=='child'){for(var i=0,node;node=nodes[i];i++)
if(targetNode.parentNode==node)return[targetNode];}else if(combinator=='descendant'){for(var i=0,node;node=nodes[i];i++)
if(Element.descendantOf(targetNode,node))return[targetNode];}else if(combinator=='adjacent'){for(var i=0,node;node=nodes[i];i++)
if(Selector.handlers.previousElementSibling(targetNode)==node)
return[targetNode];}else nodes=h[combinator](nodes);}
for(var i=0,node;node=nodes[i];i++)
if(node==targetNode)return[targetNode];return[];}
return(targetNode&&Element.descendantOf(targetNode,root))?[targetNode]:[];},className:function(nodes,root,className,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);return Selector.handlers.byClassName(nodes,root,className);},byClassName:function(nodes,root,className){if(!nodes)nodes=Selector.handlers.descendant([root]);var needle=' '+className+' ';for(var i=0,results=[],node,nodeClassName;node=nodes[i];i++){nodeClassName=node.className;if(nodeClassName.length==0)continue;if(nodeClassName==className||(' '+nodeClassName+' ').include(needle))
results.push(node);}
return results;},attrPresence:function(nodes,root,attr,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var results=[];for(var i=0,node;node=nodes[i];i++)
if(Element.hasAttribute(node,attr))results.push(node);return results;},attr:function(nodes,root,attr,value,operator,combinator){if(!nodes)nodes=root.getElementsByTagName("*");if(nodes&&combinator)nodes=this[combinator](nodes);var handler=Selector.operators[operator],results=[];for(var i=0,node;node=nodes[i];i++){var nodeValue=Element.readAttribute(node,attr);if(nodeValue===null)continue;if(handler(nodeValue,value))results.push(node);}
return results;},pseudo:function(nodes,name,value,root,combinator){if(nodes&&combinator)nodes=this[combinator](nodes);if(!nodes)nodes=root.getElementsByTagName("*");return Selector.pseudos[name](nodes,value,root);}},pseudos:{'first-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.previousElementSibling(node))continue;results.push(node);}
return results;},'last-child':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(Selector.handlers.nextElementSibling(node))continue;results.push(node);}
return results;},'only-child':function(nodes,value,root){var h=Selector.handlers;for(var i=0,results=[],node;node=nodes[i];i++)
if(!h.previousElementSibling(node)&&!h.nextElementSibling(node))
results.push(node);return results;},'nth-child':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root);},'nth-last-child':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,true);},'nth-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,false,true);},'nth-last-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,formula,root,true,true);},'first-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,"1",root,false,true);},'last-of-type':function(nodes,formula,root){return Selector.pseudos.nth(nodes,"1",root,true,true);},'only-of-type':function(nodes,formula,root){var p=Selector.pseudos;return p['last-of-type'](p['first-of-type'](nodes,formula,root),formula,root);},getIndices:function(a,b,total){if(a==0)return b>0?[b]:[];return $R(1,total).inject([],function(memo,i){if(0==(i-b)%a&&(i-b)/a>=0)memo.push(i);return memo;});},nth:function(nodes,formula,root,reverse,ofType){if(nodes.length==0)return[];if(formula=='even')formula='2n+0';if(formula=='odd')formula='2n+1';var h=Selector.handlers,results=[],indexed=[],m;h.mark(nodes);for(var i=0,node;node=nodes[i];i++){if(!node.parentNode._countedByPrototype){h.index(node.parentNode,reverse,ofType);indexed.push(node.parentNode);}}
if(formula.match(/^\d+$/)){formula=Number(formula);for(var i=0,node;node=nodes[i];i++)
if(node.nodeIndex==formula)results.push(node);}else if(m=formula.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 indices=Selector.pseudos.getIndices(a,b,nodes.length);for(var i=0,node,l=indices.length;node=nodes[i];i++){for(var j=0;j<l;j++)
if(node.nodeIndex==indices[j])results.push(node);}}
h.unmark(nodes);h.unmark(indexed);return results;},'empty':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++){if(node.tagName=='!'||node.firstChild)continue;results.push(node);}
return results;},'not':function(nodes,selector,root){var h=Selector.handlers,selectorType,m;var exclusions=new Selector(selector).findElements(root);h.mark(exclusions);for(var i=0,results=[],node;node=nodes[i];i++)
if(!node._countedByPrototype)results.push(node);h.unmark(exclusions);return results;},'enabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
if(!node.disabled&&(!node.type||node.type!=='hidden'))
results.push(node);return results;},'disabled':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
if(node.disabled)results.push(node);return results;},'checked':function(nodes,value,root){for(var i=0,results=[],node;node=nodes[i];i++)
if(node.checked)results.push(node);return results;}},operators:{'=':function(nv,v){return nv==v;},'!=':function(nv,v){return nv!=v;},'^=':function(nv,v){return nv==v||nv&&nv.startsWith(v);},'$=':function(nv,v){return nv==v||nv&&nv.endsWith(v);},'*=':function(nv,v){return nv==v||nv&&nv.include(v);},'$=':function(nv,v){return nv.endsWith(v);},'*=':function(nv,v){return nv.include(v);},'~=':function(nv,v){return(' '+nv+' ').include(' '+v+' ');},'|=':function(nv,v){return('-'+(nv||"").toUpperCase()+'-').include('-'+(v||"").toUpperCase()+'-');}},split:function(expression){var expressions=[];expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(m){expressions.push(m[1].strip());});return expressions;},matchElements:function(elements,expression){var matches=$$(expression),h=Selector.handlers;h.mark(matches);for(var i=0,results=[],element;element=elements[i];i++)
if(element._countedByPrototype)results.push(element);h.unmark(matches);return results;},findElement:function(elements,expression,index){if(Object.isNumber(expression)){index=expression;expression=false;}
return Selector.matchElements(elements,expression||'*')[index||0];},findChildElements:function(element,expressions){expressions=Selector.split(expressions.join(','));var results=[],h=Selector.handlers;for(var i=0,l=expressions.length,selector;i<l;i++){selector=new Selector(expressions[i].strip());h.concat(results,selector.findElements(element));}
return(l>1)?h.unique(results):results;}});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(nodes){for(var i=0,node;node=nodes[i];i++)
node.removeAttribute('_countedByPrototype');return nodes;}});}
function $$(){return Selector.findChildElements(document,$A(arguments));}
var Form={reset:function(form){$(form).reset();return form;},serializeElements:function(elements,options){if(typeof options!='object')options={hash:!!options};else if(Object.isUndefined(options.hash))options.hash=true;var key,value,submitted=false,submit=options.submit;var data=elements.inject({},function(result,element){if(!element.disabled&&element.name){key=element.name;value=$(element).getValue();if(value!=null&&element.type!='file'&&(element.type!='submit'||(!submitted&&submit!==false&&(!submit||key==submit)&&(submitted=true)))){if(key in result){if(!Object.isArray(result[key]))result[key]=[result[key]];result[key].push(value);}
else result[key]=value;}}
return result;});return options.hash?data:Object.toQueryString(data);}};Form.Methods={serialize:function(form,options){return Form.serializeElements(Form.getElements(form),options);},getElements:function(form){return $A($(form).getElementsByTagName('*')).inject([],function(elements,child){if(Form.Element.Serializers[child.tagName.toLowerCase()])
elements.push(Element.extend(child));return elements;});},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)return $A(inputs).map(Element.extend);for(var i=0,matchingInputs=[],length=inputs.length;i<length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))
continue;matchingInputs.push(Element.extend(input));}
return matchingInputs;},disable:function(form){form=$(form);Form.getElements(form).invoke('disable');return form;},enable:function(form){form=$(form);Form.getElements(form).invoke('enable');return form;},findFirstElement:function(form){var elements=$(form).getElements().findAll(function(element){return'hidden'!=element.type&&!element.disabled;});var firstByIndex=elements.findAll(function(element){return element.hasAttribute('tabIndex')&&element.tabIndex>=0;}).sortBy(function(element){return element.tabIndex}).first();return firstByIndex?firstByIndex:elements.find(function(element){return['input','select','textarea'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){form=$(form);form.findFirstElement().activate();return form;},request:function(form,options){form=$(form),options=Object.clone(options||{});var params=options.parameters,action=form.readAttribute('action')||'';if(action.blank())action=window.location.href;options.parameters=form.serialize(true);if(params){if(Object.isString(params))params=params.toQueryParams();Object.extend(options.parameters,params);}
if(form.hasAttribute('method')&&!options.method)
options.method=form.method;return new Ajax.Request(action,options);}};Form.Element={focus:function(element){$(element).focus();return element;},select:function(element){$(element).select();return element;}};Form.Element.Methods={serialize:function(element){element=$(element);if(!element.disabled&&element.name){var value=element.getValue();if(value!=undefined){var pair={};pair[element.name]=value;return Object.toQueryString(pair);}}
return'';},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();return Form.Element.Serializers[method](element);},setValue:function(element,value){element=$(element);var method=element.tagName.toLowerCase();Form.Element.Serializers[method](element,value);return element;},clear:function(element){$(element).value='';return element;},present:function(element){return $(element).value!='';},activate:function(element){element=$(element);try{element.focus();if(element.select&&(element.tagName.toLowerCase()!='input'||!['button','reset','submit'].include(element.type)))
element.select();}catch(e){}
return element;},disable:function(element){element=$(element);element.disabled=true;return element;},enable:function(element){element=$(element);element.disabled=false;return element;}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(element,value){switch(element.type.toLowerCase()){case'checkbox':case'radio':return Form.Element.Serializers.inputSelector(element,value);default:return Form.Element.Serializers.textarea(element,value);}},inputSelector:function(element,value){if(Object.isUndefined(value))return element.checked?element.value:null;else element.checked=!!value;},textarea:function(element,value){if(Object.isUndefined(value))return element.value;else element.value=value;},select:function(element,value){if(Object.isUndefined(value))
return this[element.type=='select-one'?'selectOne':'selectMany'](element);else{var opt,currentValue,single=!Object.isArray(value);for(var i=0,length=element.length;i<length;i++){opt=element.options[i];currentValue=this.optionValue(opt);if(single){if(currentValue==value){opt.selected=true;return;}}
else opt.selected=value.include(currentValue);}}},selectOne:function(element){var index=element.selectedIndex;return index>=0?this.optionValue(element.options[index]):null;},selectMany:function(element){var values,length=element.length;if(!length)return null;for(var i=0,values=[];i<length;i++){var opt=element.options[i];if(opt.selected)values.push(this.optionValue(opt));}
return values;},optionValue:function(opt){return Element.extend(opt).hasAttribute('value')?opt.value:opt.text;}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,element,frequency,callback){$super(callback,frequency);this.element=$(element);this.lastValue=this.getValue();},execute:function(){var value=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(value)?this.lastValue!=value:String(this.lastValue)!=String(value)){this.callback(this.element,value);this.lastValue=value;}}});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(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')
this.registerFormCallbacks();else
this.registerCallback(this.element);},onElementEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this);},registerCallback:function(element){if(element.type){switch(element.type.toLowerCase()){case'checkbox':case'radio':Event.observe(element,'click',this.onElementEvent.bind(this));break;default:Event.observe(element,'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(event){var element;switch(event.type){case'mouseover':element=event.fromElement;break;case'mouseout':element=event.toElement;break;default:return null;}
return Element.extend(element);}});Event.Methods=(function(){var isButton;if(Prototype.Browser.IE){var buttonMap={0:1,1:4,2:2};isButton=function(event,code){return event.button==buttonMap[code];};}else if(Prototype.Browser.WebKit){isButton=function(event,code){switch(code){case 0:return event.which==1&&!event.metaKey;case 1:return event.which==1&&event.metaKey;default:return false;}};}else{isButton=function(event,code){return event.which?(event.which===code+1):(event.button===code);};}
return{isLeftClick:function(event){return isButton(event,0)},isMiddleClick:function(event){return isButton(event,1)},isRightClick:function(event){return isButton(event,2)},element:function(event){event=Event.extend(event);var node=event.target,type=event.type,currentTarget=event.currentTarget;if(currentTarget&&currentTarget.tagName){if(type==='load'||type==='error'||(type==='click'&&currentTarget.tagName.toLowerCase()==='input'&&currentTarget.type==='radio'))
node=currentTarget;}
if(node.nodeType==Node.TEXT_NODE)node=node.parentNode;return Element.extend(node);},findElement:function(event,expression){var element=Event.element(event);if(!expression)return element;var elements=[element].concat(element.ancestors());return Selector.findElement(elements,expression,0);},pointer:function(event){var docElement=document.documentElement,body=document.body||{scrollLeft:0,scrollTop:0};return{x:event.pageX||(event.clientX+
(docElement.scrollLeft||body.scrollLeft)-
(docElement.clientLeft||0)),y:event.pageY||(event.clientY+
(docElement.scrollTop||body.scrollTop)-
(docElement.clientTop||0))};},pointerX:function(event){return Event.pointer(event).x},pointerY:function(event){return Event.pointer(event).y},stop:function(event){Event.extend(event);event.preventDefault();event.stopPropagation();event.stopped=true;}};})();Event.extend=(function(){var methods=Object.keys(Event.Methods).inject({},function(m,name){m[name]=Event.Methods[name].methodize();return m;});if(Prototype.Browser.IE){Object.extend(methods,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(event){if(!event)return false;if(event._extendedByPrototype)return event;event._extendedByPrototype=Prototype.emptyFunction;var pointer=Event.pointer(event);Object.extend(event,{target:event.srcElement,relatedTarget:Event.relatedTarget(event),pageX:pointer.x,pageY:pointer.y});return Object.extend(event,methods);};}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents")['__proto__'];Object.extend(Event.prototype,methods);return Prototype.K;}})();Object.extend(Event,(function(){var cache=Event.cache;function getEventID(element){if(element._prototypeEventID)return element._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return element._prototypeEventID=[++arguments.callee.id];}
function getDOMEventName(eventName){if(eventName&&eventName.include(':'))return"dataavailable";return eventName;}
function getCacheForID(id){return cache[id]=cache[id]||{};}
function getWrappersForEventName(id,eventName){var c=getCacheForID(id);return c[eventName]=c[eventName]||[];}
function createWrapper(element,eventName,handler){var id=getEventID(element);var c=getWrappersForEventName(id,eventName);if(c.pluck("handler").include(handler))return false;var wrapper=function(event){if(!Event||!Event.extend||(event.eventName&&event.eventName!=eventName))
return false;Event.extend(event);handler.call(element,event);};wrapper.handler=handler;c.push(wrapper);return wrapper;}
function findWrapper(id,eventName,handler){var c=getWrappersForEventName(id,eventName);return c.find(function(wrapper){return wrapper.handler==handler});}
function destroyWrapper(id,eventName,handler){var c=getCacheForID(id);if(!c[eventName])return false;c[eventName]=c[eventName].without(findWrapper(id,eventName,handler));}
function destroyCache(){for(var id in cache)
for(var eventName in cache[id])
cache[id][eventName]=null;}
if(window.attachEvent){window.attachEvent("onunload",destroyCache);}
if(Prototype.Browser.WebKit){window.addEventListener('unload',Prototype.emptyFunction,false);}
return{observe:function(element,eventName,handler){element=$(element);var name=getDOMEventName(eventName);var wrapper=createWrapper(element,eventName,handler);if(!wrapper)return element;if(element.addEventListener){element.addEventListener(name,wrapper,false);}else{element.attachEvent("on"+name,wrapper);}
return element;},stopObserving:function(element,eventName,handler){element=$(element);var id=getEventID(element),name=getDOMEventName(eventName);if(!handler&&eventName){getWrappersForEventName(id,eventName).each(function(wrapper){element.stopObserving(eventName,wrapper.handler);});return element;}else if(!eventName){Object.keys(getCacheForID(id)).each(function(eventName){element.stopObserving(eventName);});return element;}
var wrapper=findWrapper(id,eventName,handler);if(!wrapper)return element;if(element.removeEventListener){element.removeEventListener(name,wrapper,false);}else{element.detachEvent("on"+name,wrapper);}
destroyWrapper(id,eventName,handler);return element;},fire:function(element,eventName,memo){element=$(element);if(element==document&&document.createEvent&&!element.dispatchEvent)
element=document.documentElement;var event;if(document.createEvent){event=document.createEvent("HTMLEvents");event.initEvent("dataavailable",true,true);}else{event=document.createEventObject();event.eventType="ondataavailable";}
event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event);}else{element.fireEvent(event.eventType,event);}
return Event.extend(event);}};})());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 timer;function fireContentLoadedEvent(){if(document.loaded)return;if(timer)window.clearInterval(timer);document.fire("dom:loaded");document.loaded=true;}
if(document.addEventListener){if(Prototype.Browser.WebKit){timer=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(element,content){return Element.insert(element,{before:content});},Top:function(element,content){return Element.insert(element,{top:content});},Bottom:function(element,content){return Element.insert(element,{bottom:content});},After:function(element,content){return Element.insert(element,{after:content});}};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(element,x,y){if(this.includeScrollOffsets)
return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y;this.offset=Element.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=Element.cumulativeScrollOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=Element.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth);},overlap:function(mode,element){if(!mode)return 0;if(mode=='vertical')
return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if(mode=='horizontal')
return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth;},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(element){Position.prepare();return Element.absolutize(element);},relativize:function(element){Position.prepare();return Element.relativize(element);},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(source,target,options){options=options||{};return Element.clonePosition(target,source,options);}};if(!document.getElementsByClassName)document.getElementsByClassName=function(instanceMethods){function iter(name){return name.blank()?null:"[contains(concat(' ', @class, ' '), ' "+name+" ')]";}
instanceMethods.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(element,className){className=className.toString().strip();var cond=/\s/.test(className)?$w(className).map(iter).join(''):iter(className);return cond?document._getElementsByXPath('.//*'+cond,element):[];}:function(element,className){className=className.toString().strip();var elements=[],classNames=(/\s/.test(className)?$w(className):null);if(!classNames&&!className)return elements;var nodes=$(element).getElementsByTagName('*');className=' '+className+' ';for(var i=0,child,cn;child=nodes[i];i++){if(child.className&&(cn=' '+child.className+' ')&&(cn.include(className)||(classNames&&classNames.all(function(name){return!name.toString().blank()&&cn.include(' '+name+' ');}))))
elements.push(Element.extend(child));}
return elements;};return function(className,parentElement){return $(parentElement||document.body).getElementsByClassName(className);};}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set($A(this).concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set($A(this).without(classNameToRemove).join(' '));},toString:function(){return $A(this).join(' ');}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)color=this.toLowerCase();}}
return(color.length==7?color:(arguments[0]||this));};Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');};Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatten().join('');};Element.setContentZoom=function(element,percent){element=$(element);element.setStyle({fontSize:(percent/100)+'em'});if(Prototype.Browser.WebKit)window.scrollBy(0,0);return element;};Element.getInlineOpacity=function(element){return $(element).style.opacity||'';};Element.forceRerendering=function(element){try{element=$(element);var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}};var Effect={_elementDoesNotExistError:{name:'ElementDoesNotExistError',message:'The specified DOM element does not exist, but is required for this effect to operate'},Transitions:{linear:Prototype.K,sinoidal:function(pos){return(-Math.cos(pos*Math.PI)/2)+.5;},reverse:function(pos){return 1-pos;},flicker:function(pos){var pos=((-Math.cos(pos*Math.PI)/4)+.75)+Math.random()/4;return pos>1?1:pos;},wobble:function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+.5;},pulse:function(pos,pulses){return(-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2)+.5;},spring:function(pos){return 1-(Math.cos(pos*4.5*Math.PI)*Math.exp(-pos*6));},none:function(pos){return 0;},full:function(pos){return 1;}},DefaultOptions:{duration:1.0,fps:100,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'},tagifyText:function(element){var tagifyStyle='position:relative';if(Prototype.Browser.IE)tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(new Element('span',{style:tagifyStyle}).update(character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||Object.isFunction(element))&&(element.length))
elements=element;else
elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global'),limit:1}},arguments[2]||{});Effect[element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options);}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=Object.isString(effect.options.queue)?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'with-last':timestamp=this.effects.pluck('startOn').max()||timestamp;break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;}
effect.startOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.limit||(this.effects.length<effect.options.queue.limit))
this.effects.push(effect);if(!this.interval)
this.interval=setInterval(this.loop.bind(this),15);},remove:function(effect){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();for(var i=0,len=this.effects.length;i<len;i++)
this.effects[i]&&this.effects[i].loop(timePos);}});Effect.Queues={instances:$H(),get:function(queueName){if(!Object.isString(queueName))return queueName;return this.instances.get(queueName)||this.instances.set(queueName,new Effect.ScopedQueue());}};Effect.Queue=Effect.Queues.get('global');Effect.Base=Class.create({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&&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;this.render=(function(){function dispatch(effect,eventName){if(effect.options[eventName+'Internal'])
effect.options[eventName+'Internal'](effect);if(effect.options[eventName])
effect.options[eventName](effect);}
return function(pos){if(this.state==="idle"){this.state="running";dispatch(this,'beforeSetup');if(this.setup)this.setup();dispatch(this,'afterSetup');}
if(this.state==="running"){pos=(this.options.transition(pos)*this.fromToDelta)+this.options.from;this.position=pos;dispatch(this,'beforeUpdate');if(this.update)this.update(pos);dispatch(this,'afterUpdate');}};})();this.event('beforeStart');if(!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).add(this);},loop:function(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;}
var pos=(timePos-this.startOn)/this.totalTime,frame=(pos*this.totalFrames).round();if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},cancel:function(){if(!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).remove(this);this.state='finished';},event:function(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[eventName])this.options[eventName](this);},inspect:function(){var data=$H();for(property in this)
if(!Object.isFunction(this[property]))data.set(property,this[property]);return'#<Effect:'+data.inspect()+',options:'+$H(this.options).inspect()+'>';}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Tween=Class.create(Effect.Base,{initialize:function(object,from,to){object=Object.isString(object)?$(object):object;var args=$A(arguments),method=args.last(),options=args.length==5?args[3]:null;this.method=Object.isFunction(method)?method.bind(object):Object.isFunction(object[method])?object[method].bind(object):function(value){object[method]=value};this.start(Object.extend({from:from,to:to},options||{}));},update:function(position){this.method(position);}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}));},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){this.element.setOpacity(position);}});Effect.Move=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},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(position){this.element.setStyle({left:(this.options.x*position+this.originalLeft).round()+'px',top:(this.options.y*position+this.originalTop).round()+'px'});}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}));};Effect.Scale=Class.create(Effect.Base,{initialize:function(element,percent){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%','pt'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.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(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize)
this.element.setStyle({fontSize:this.fontSize*currentScale+this.fontSizeType});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d.width=width.round()+'px';if(this.options.scaleY)d.height=height.round()+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft-leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX)d.left=-leftd+'px';}}
this.element.setStyle(d);}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},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(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=function(element){var options=arguments[1]||{},scrollOffsets=document.viewport.getScrollOffsets(),elementOffsets=$(element).cumulativeOffset();if(options.offset)elementOffsets[1]+=options.offset;return new Effect.Tween(null,scrollOffsets.top,elementOffsets[1],options,function(p){scrollTo(scrollOffsets.left,p.round());});};Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal:function(effect){if(effect.options.to!=0)return;effect.element.hide().setStyle({opacity:oldOpacity});}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Appear=function(element){element=$(element);var options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerendering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.from).show();}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position'),top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect){Position.absolutize(effect.effects[0].element);},afterFinishInternal:function(effect){effect.effects[0].element.hide().setStyle(oldStyle);}},arguments[1]||{}));};Effect.BlindUp=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect){effect.element.hide().undoClipping();}},arguments[1]||{}));};Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping().setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));};Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned().setStyle({opacity:oldOpacity});}});}},arguments[1]||{}));};Effect.DropOut=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){effect.effects[0].element.makePositioned();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);}},arguments[1]||{}));};Effect.Shake=function(element){element=$(element);var options=Object.extend({distance:20,duration:0.5},arguments[1]||{});var distance=parseFloat(options.distance);var split=parseFloat(options.duration)/10.0;var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:distance,y:0,duration:split,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance,y:0,duration:split,afterFinishInternal:function(effect){effect.element.undoPositioned().setStyle(oldStyle);}});}});}});}});}});}});};Effect.SlideDown=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().setStyle({height:'0px'}).show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.SlideUp=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping();}});};Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;}
return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){effect.element.hide().makeClipping().makePositioned();},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);}},options));}});};Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;}
return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle);}},options));};Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{},oldOpacity=element.getInlineOpacity(),transition=options.transition||Effect.Transitions.linear,reverser=function(pos){return 1-transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2)+.5);};return new Effect.Opacity(element,Object.extend(Object.extend({duration:2.0,from:0,afterFinishInternal:function(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));};Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};element.makeClipping();return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide().undoClipping().setStyle(oldStyle);}});}},arguments[1]||{}));};Effect.Morph=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(options.style))this.style=$H(options.style);else{if(options.style.include(':'))
this.style=options.style.parseStyle();else{this.element.addClassName(options.style);this.style=$H(this.element.getStyles());this.element.removeClassName(options.style);var css=this.element.getStyles();this.style=this.style.reject(function(style){return style.value==css[style.key];});options.afterFinishInternal=function(effect){effect.element.addClassName(effect.options.style);effect.transforms.each(function(transform){effect.element.style[transform.style]='';});};}}
this.start(options);},setup:function(){function parseColor(color){if(!color||['rgba(0, 0, 0, 0)','transparent'].include(color))color='#ffffff';color=color.parseColor();return $R(0,2).map(function(i){return parseInt(color.slice(i*2+1,i*2+3),16);});}
this.transforms=this.style.map(function(pair){var property=pair[0],value=pair[1],unit=null;if(value.parseColor('#zzzzzz')!='#zzzzzz'){value=value.parseColor();unit='color';}else if(property=='opacity'){value=parseFloat(value);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});}else if(Element.CSS_LENGTH.test(value)){var components=value.match(/^([\+\-]?[0-9\.]+)(.*)$/);value=parseFloat(components[1]);unit=(components.length==3)?components[2]:null;}
var originalValue=this.element.getStyle(property);return{style:property.camelize(),originalValue:unit=='color'?parseColor(originalValue):parseFloat(originalValue||0),targetValue:unit=='color'?parseColor(value):value,unit:unit};}.bind(this)).reject(function(transform){return((transform.originalValue==transform.targetValue)||(transform.unit!='color'&&(isNaN(transform.originalValue)||isNaN(transform.targetValue))));});},update:function(position){var style={},transform,i=this.transforms.length;while(i--)
style[(transform=this.transforms[i]).style]=transform.unit=='color'?'#'+
(Math.round(transform.originalValue[0]+
(transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart()+
(Math.round(transform.originalValue[1]+
(transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart()+
(Math.round(transform.originalValue[2]+
(transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart():(transform.originalValue+
(transform.targetValue-transform.originalValue)*position).toFixed(3)+
(transform.unit===null?'':transform.unit);this.element.setStyle(style,true);}});Effect.Transform=Class.create({initialize:function(tracks){this.tracks=[];this.options=arguments[1]||{};this.addTracks(tracks);},addTracks:function(tracks){tracks.each(function(track){track=$H(track);var data=track.values().first();this.tracks.push($H({ids:track.keys().first(),effect:Effect.Morph,options:{style:data}}));}.bind(this));return this;},play:function(){return new Effect.Parallel(this.tracks.map(function(track){var ids=track.get('ids'),effect=track.get('effect'),options=track.get('options');var elements=[$(ids)||$$(ids)].flatten();return elements.map(function(e){return new effect(e,Object.extend({sync:true},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.__parseStyleElement=document.createElement('div');String.prototype.parseStyle=function(){var style,styleRules=$H();if(Prototype.Browser.WebKit)
style=new Element('div',{style:this}).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';style=String.__parseStyleElement.childNodes[0].style;}
Element.CSS_PROPERTIES.each(function(property){if(style[property])styleRules.set(property,style[property]);});if(Prototype.Browser.IE&&this.include('opacity'))
styleRules.set('opacity',this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return styleRules;};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(element){var css=document.defaultView.getComputedStyle($(element),null);return Element.CSS_PROPERTIES.inject({},function(styles,property){styles[property]=css[property];return styles;});};}else{Element.getStyles=function(element){element=$(element);var css=element.currentStyle,styles;styles=Element.CSS_PROPERTIES.inject({},function(results,property){results[property]=css[property];return results;});if(!styles.opacity)styles.opacity=element.getOpacity();return styles;};}
Effect.Methods={morph:function(element,style){element=$(element);new Effect.Morph(element,Object.extend({style:style},arguments[2]||{}));return element;},visualEffect:function(element,effect,options){element=$(element);var s=effect.dasherize().camelize(),klass=s.charAt(0).toUpperCase()+s.substring(1);new Effect[klass](element,options);return element;},highlight:function(element,options){element=$(element);new Effect.Highlight(element,options);return element;}};$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+'pulsate shake puff squish switchOff dropOut').each(function(effect){Effect.Methods[effect]=function(element,options){element=$(element);Effect[effect.charAt(0).toUpperCase()+effect.substring(1)](element,options);return element;};});$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(function(f){Effect.Methods[f]=Element[f];});Element.addMethods(Effect.Methods);if(typeof Effect=='undefined')
throw("controls.js requires including script.aculo.us' effects.js library");var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(element,update,options){element=$(element);this.element=element;this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions)
this.setOptions(options);else
this.options=options||{};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(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});}
Effect.Appear(update,{duration:0.15});};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,{duration:0.15})};if(typeof(this.options.tokens)=='string')
this.options.tokens=new Array(this.options.tokens);if(!this.options.tokens.include('\n'))
this.options.tokens.push('\n');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,'keydown',this.onKeyPress.bindAsEventListener(this));},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(event){if(this.active)
switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(event);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(event);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(event);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(event);return;}
else
if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&event.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(event){var element=Event.findElement(event,'LI');if(this.index!=element.autocompleteIndex)
{this.index=element.autocompleteIndex;this.render();}
Event.stop(event);},onClick:function(event){var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();},onBlur:function(event){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false;},render:function(){if(this.entryCount>0){for(var i=0;i<this.entryCount;i++)
this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"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(index){return this.update.firstChild.childNodes[index];},getCurrentEntry:function(){return this.getEntry(this.index);},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry());},updateElement:function(selectedElement){if(this.options.updateElement){this.options.updateElement(selectedElement);return;}
var value='';if(this.options.select){var nodes=$(selectedElement).select('.'+this.options.select)||[];if(nodes.length>0)value=Element.collectTextNodes(nodes[0],this.options.select);}else
value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var bounds=this.getTokenBounds();if(bounds[0]!=-1){var newValue=this.element.value.substr(0,bounds[0]);var whitespace=this.element.value.substr(bounds[0]).match(/^\s+/);if(whitespace)
newValue+=whitespace[0];this.element.value=newValue+value+this.element.value.substr(bounds[1]);}else{this.element.value=value;}
this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement)
this.options.afterUpdateElement(this.element,selectedElement);},updateChoices:function(choices){if(!this.changed&&this.hasFocus){this.update.innerHTML=choices;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 i=0;i<this.entryCount;i++){var entry=this.getEntry(i);entry.autocompleteIndex=i;this.addObservers(entry);}}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(element){Event.observe(element,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(element,"click",this.onClick.bindAsEventListener(this));},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices();}else{this.active=false;this.hide();}
this.oldElementValue=this.element.value;},getToken:function(){var bounds=this.getTokenBounds();return this.element.value.substring(bounds[0],bounds[1]).strip();},getTokenBounds:function(){if(null!=this.tokenBounds)return this.tokenBounds;var value=this.element.value;if(value.strip().empty())return[-1,0];var diff=arguments.callee.getFirstDifferencePos(value,this.oldElementValue);var offset=(diff==this.oldElementValue.length?1:0);var prevTokenPos=-1,nextTokenPos=value.length;var tp;for(var index=0,l=this.options.tokens.length;index<l;++index){tp=value.lastIndexOf(this.options.tokens[index],diff+offset-1);if(tp>prevTokenPos)prevTokenPos=tp;tp=value.indexOf(this.options.tokens[index],diff+offset);if(-1!=tp&&tp<nextTokenPos)nextTokenPos=tp;}
return(this.tokenBounds=[prevTokenPos+1,nextTokenPos]);}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(newS,oldS){var boundary=Math.min(newS.length,oldS.length);for(var index=0;index<boundary;++index)
if(newS[index]!=oldS[index])
return index;return boundary;};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(element,update,url,options){this.baseInitialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=url;},getUpdatedChoices:function(){this.startIndicator();var entry=encodeURIComponent(this.options.paramName)+'='+
encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams)
this.options.parameters+='&'+this.options.defaultParams;new Ajax.Request(this.url,this.options);},onComplete:function(request){this.updateChoices(request.responseText);}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(element,update,array,options){this.baseInitialize(element,update,options);this.options.array=array;},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this));},setOptions:function(options){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(instance){var ret=[];var partial=[];var entry=instance.getToken();var count=0;for(var i=0;i<instance.options.array.length&&ret.length<instance.options.choices;i++){var elem=instance.options.array[i];var foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase()):elem.indexOf(entry);while(foundPos!=-1){if(foundPos==0&&elem.length!=entry.length){ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+
elem.substr(entry.length)+"</li>");break;}else if(entry.length>=instance.options.partialChars&&instance.options.partialSearch&&foundPos!=-1){if(instance.options.fullSearch||/\s/.test(elem.substr(foundPos-1,1))){partial.push("<li>"+elem.substr(0,foundPos)+"<strong>"+
elem.substr(foundPos,entry.length)+"</strong>"+elem.substr(foundPos+entry.length)+"</li>");break;}}
foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase(),foundPos+1):elem.indexOf(entry,foundPos+1);}}
if(partial.length)
ret=ret.concat(partial.slice(0,instance.options.choices-ret.length));return"<ul>"+ret.join('')+"</ul>";}},options||{});}});Field.scrollFreeActivate=function(field){setTimeout(function(){Field.activate(field);},1);};Ajax.InPlaceEditor=Class.create({initialize:function(element,url,options){this.url=url;this.element=element=$(element);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(options);Object.extend(this.options,options||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+'-inplaceeditor';if($(this.options.formId))
this.options.formId='';}
if(this.options.externalControl)
this.options.externalControl=$(this.options.externalControl);if(!this.options.externalControl)
this.options.externalControlOnly=false;this._originalBackground=this.element.getStyle('background-color')||'transparent';this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners();},checkForEscapeOrReturn:function(e){if(!this._editing||e.ctrlKey||e.altKey||e.shiftKey)return;if(Event.KEY_ESC==e.keyCode)
this.handleFormCancellation(e);else if(Event.KEY_RETURN==e.keyCode)
this.handleFormSubmission(e);},createControl:function(mode,handler,extraClasses){var control=this.options[mode+'Control'];var text=this.options[mode+'Text'];if('button'==control){var btn=document.createElement('input');btn.type='submit';btn.value=text;btn.className='editor_'+mode+'_button';if('cancel'==mode)
btn.onclick=this._boundCancelHandler;this._form.appendChild(btn);this._controls[mode]=btn;}else if('link'==control){var link=document.createElement('a');link.href='#';link.appendChild(document.createTextNode(text));link.onclick='cancel'==mode?this._boundCancelHandler:this._boundSubmitHandler;link.className='editor_'+mode+'_link';if(extraClasses)
link.className+=' '+extraClasses;this._form.appendChild(link);this._controls[mode]=link;}},createEditField:function(){var text=(this.options.loadTextURL?this.options.loadingText:this.getText());var fld;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){fld=document.createElement('input');fld.type='text';var size=this.options.size||this.options.cols||0;if(0<size)fld.size=size;}else{fld=document.createElement('textarea');fld.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);fld.cols=this.options.cols||40;}
fld.name=this.options.paramName;fld.value=text;fld.className='editor_field';if(this.options.submitOnBlur)
fld.onblur=this._boundSubmitHandler;this._controls.editor=fld;if(this.options.loadTextURL)
this.loadExternalText();this._form.appendChild(this._controls.editor);},createForm:function(){var ipe=this;function addText(mode,condition){var text=ipe.options['text'+mode+'Controls'];if(!text||condition===false)return;ipe._form.appendChild(document.createTextNode(text));};this._form=$(document.createElement('form'));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if('textarea'==this._controls.editor.tagName.toLowerCase())
this._form.appendChild(document.createElement('br'));if(this.options.onFormCustomization)
this.options.onFormCustomization(this,this._form);addText('Before',this.options.okControl||this.options.cancelControl);this.createControl('ok',this._boundSubmitHandler);addText('Between',this.options.okControl&&this.options.cancelControl);this.createControl('cancel',this._boundCancelHandler,'editor_cancel');addText('After',this.options.okControl||this.options.cancelControl);},destroy:function(){if(this._oldInnerHTML)
this.element.innerHTML=this._oldInnerHTML;this.leaveEditMode();this.unregisterListeners();},enterEditMode:function(e){if(this._saving||this._editing)return;this._editing=true;this.triggerCallback('onEnterEditMode');if(this.options.externalControl)
this.options.externalControl.hide();this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL)
this.postProcessEditField();if(e)Event.stop(e);},enterHover:function(e){if(this.options.hoverClassName)
this.element.addClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onEnterHover');},getText:function(){return this.element.innerHTML.unescapeHTML();},handleAJAXFailure:function(transport){this.triggerCallback('onFailure',transport);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null;}},handleFormCancellation:function(e){this.wrapUp();if(e)Event.stop(e);},handleFormSubmission:function(e){var form=this._form;var value=$F(this._controls.editor);this.prepareSubmission();var params=this.options.callback(form,value)||'';if(Object.isString(params))
params=params.toQueryParams();params.editorId=this.element.id;if(this.options.htmlResponse){var options=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,options);}else{var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,options);}
if(e)Event.stop(e);},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl)
this.options.externalControl.show();this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback('onLeaveEditMode');},leaveHover:function(e){if(this.options.hoverClassName)
this.element.removeClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onLeaveHover');},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._form.removeClassName(this.options.loadingClassName);var text=transport.responseText;if(this.options.stripLoadedTextTags)
text=text.stripTags();this._controls.editor.value=text;this._controls.editor.disabled=false;this.postProcessEditField();}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,options);},postProcessEditField:function(){var fpc=this.options.fieldPostCreation;if(fpc)
$(this._controls.editor)['focus'==fpc?'focus':'activate']();},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(defs){Object.extend(this.options,defs);}.bind(this));},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving();},registerListeners:function(){this._listeners={};var listener;$H(Ajax.InPlaceEditor.Listeners).each(function(pair){listener=this[pair.value].bind(this);this._listeners[pair.key]=listener;if(!this.options.externalControlOnly)
this.element.observe(pair.key,listener);if(this.options.externalControl)
this.options.externalControl.observe(pair.key,listener);}.bind(this));},removeForm:function(){if(!this._form)return;this._form.remove();this._form=null;this._controls={};},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show();},triggerCallback:function(cbName,arg){if('function'==typeof this.options[cbName]){this.options[cbName](this,arg);}},unregisterListeners:function(){$H(this._listeners).each(function(pair){if(!this.options.externalControlOnly)
this.element.stopObserving(pair.key,pair.value);if(this.options.externalControl)
this.options.externalControl.stopObserving(pair.key,pair.value);}.bind(this));},wrapUp:function(transport){this.leaveEditMode();this._boundComplete(transport,this.element);}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,element,url,options){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(element,url,options);},createEditField:function(){var list=document.createElement('select');list.name=this.options.paramName;list.size=1;this._controls.editor=list;this._collection=this.options.collection||[];if(this.options.loadCollectionURL)
this.loadCollection();else
this.checkForExternalText();this._form.appendChild(this._controls.editor);},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js))
throw('Server returned an invalid collection representation.');this._collection=eval(js);this.checkForExternalText();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options);},showLoadingText:function(text){this._controls.editor.disabled=true;var tempOption=this._controls.editor.firstChild;if(!tempOption){tempOption=document.createElement('option');tempOption.value='';this._controls.editor.appendChild(tempOption);tempOption.selected=true;}
tempOption.update((text||'').stripScripts().stripTags());},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL)
this.loadExternalText();else
this.buildOptionList();},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._text=transport.responseText.strip();this.buildOptionList();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,options);},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(entry){return 2===entry.length?entry:[entry,entry].flatten();});var marker=('value'in this.options)?this.options.value:this._text;var textFound=this._collection.any(function(entry){return entry[0]==marker;}.bind(this));this._controls.editor.update('');var option;this._collection.each(function(entry,index){option=document.createElement('option');option.value=entry[0];option.selected=textFound?entry[0]==marker:0==index;option.appendChild(document.createTextNode(entry[1]));this._controls.editor.appendChild(option);}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor);}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(options){if(!options)return;function fallback(name,expr){if(name in options||expr===undefined)return;options[name]=expr;};fallback('cancelControl',(options.cancelLink?'link':(options.cancelButton?'button':options.cancelLink==options.cancelButton==false?false:undefined)));fallback('okControl',(options.okLink?'link':(options.okButton?'button':options.okLink==options.okButton==false?false:undefined)));fallback('highlightColor',options.highlightcolor);fallback('highlightEndColor',options.highlightendcolor);};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:'link',cancelText:'cancel',clickToEditText:'Click to edit',externalControl:null,externalControlOnly:false,fieldPostCreation:'activate',formClassName:'inplaceeditor-form',formId:null,highlightColor:'#ffff99',highlightEndColor:'#ffffff',hoverClassName:'',htmlResponse:true,loadingClassName:'inplaceeditor-loading',loadingText:'Loading...',okControl:'button',okText:'ok',paramName:'value',rows:1,savingClassName:'inplaceeditor-saving',savingText:'Saving...',size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:'',textBeforeControls:'',textBetweenControls:''},DefaultCallbacks:{callback:function(form){return Form.serialize(form);},onComplete:function(transport,element){new Effect.Highlight(element,{startcolor:this.options.highlightColor,keepBackgroundImage:true});},onEnterEditMode:null,onEnterHover:function(ipe){ipe.element.style.backgroundColor=ipe.options.highlightColor;if(ipe._effect)
ipe._effect.cancel();},onFailure:function(transport,ipe){alert('Error communication with the server: '+transport.responseText.stripTags());},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(ipe){ipe._effect=new Effect.Highlight(ipe.element,{startcolor:ipe.options.highlightColor,endcolor:ipe.options.highlightEndColor,restorecolor:ipe._originalBackground,keepBackgroundImage:true});}},Listeners:{click:'enterEditMode',keydown:'checkForEscapeOrReturn',mouseover:'enterHover',mouseout:'leaveHover'}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:'Loading options...'};Form.Element.DelayedObserver=Class.create({initialize:function(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));},delayedListener:function(event){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));}});if(Object.isUndefined(Effect))
throw("dragdrop.js requires including script.aculo.us' effects.js library");var Droppables={drops:[],remove:function(element){this.drops=this.drops.reject(function(d){return d.element==$(element)});},add:function(element){element=$(element);var options=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(options.containment){options._containers=[];var containment=options.containment;if(Object.isArray(containment)){containment.each(function(c){options._containers.push($(c))});}else{options._containers.push($(containment));}}
if(options.accept)options.accept=[options.accept].flatten();Element.makePositioned(element);options.element=element;this.drops.push(options);},findDeepestChild:function(drops){deepest=drops[0];for(i=1;i<drops.length;++i)
if(Element.isParent(drops[i].element,deepest.element))
deepest=drops[i];return deepest;},isContained:function(element,drop){var containmentNode;if(drop.tree){containmentNode=element.treeNode;}else{containmentNode=element.parentNode;}
return drop._containers.detect(function(c){return containmentNode==c});},isAffected:function(point,element,drop){return((drop.element!=element)&&((!drop._containers)||this.isContained(element,drop))&&((!drop.accept)||(Element.classNames(element).detect(function(v){return drop.accept.include(v)})))&&Position.within(drop.element,point[0],point[1]));},deactivate:function(drop){if(drop.hoverclass)
Element.removeClassName(drop.element,drop.hoverclass);this.last_active=null;},activate:function(drop){if(drop.hoverclass)
Element.addClassName(drop.element,drop.hoverclass);this.last_active=drop;},show:function(point,element){if(!this.drops.length)return;var drop,affected=[];this.drops.each(function(drop){if(Droppables.isAffected(point,element,drop))
affected.push(drop);});if(affected.length>0)
drop=Droppables.findDeepestChild(affected);if(this.last_active&&this.last_active!=drop)this.deactivate(this.last_active);if(drop){Position.within(drop.element,point[0],point[1]);if(drop.onHover)
drop.onHover(element,drop.element,Position.overlap(drop.overlap,drop.element));if(drop!=this.last_active)Droppables.activate(drop);}},fire:function(event,element){if(!this.last_active)return;Position.prepare();if(this.isAffected([Event.pointerX(event),Event.pointerY(event)],element,this.last_active))
if(this.last_active.onDrop){this.last_active.onDrop(element,this.last_active.element,event);return true;}},reset:function(){if(this.last_active)
this.deactivate(this.last_active);}};var Draggables={drags:[],observers:[],register:function(draggable){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress);}
this.drags.push(draggable);},unregister:function(draggable){this.drags=this.drags.reject(function(d){return d==draggable});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress);}},activate:function(draggable){if(draggable.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=draggable;}.bind(this),draggable.options.delay);}else{window.focus();this.activeDraggable=draggable;}},deactivate:function(){this.activeDraggable=null;},updateDrag:function(event){if(!this.activeDraggable)return;var pointer=[Event.pointerX(event),Event.pointerY(event)];if(this._lastPointer&&(this._lastPointer.inspect()==pointer.inspect()))return;this._lastPointer=pointer;this.activeDraggable.updateDrag(event,pointer);},endDrag:function(event){if(this._timeout){clearTimeout(this._timeout);this._timeout=null;}
if(!this.activeDraggable)return;this._lastPointer=null;this.activeDraggable.endDrag(event);this.activeDraggable=null;},keyPress:function(event){if(this.activeDraggable)
this.activeDraggable.keyPress(event);},addObserver:function(observer){this.observers.push(observer);this._cacheObserverCallbacks();},removeObserver:function(element){this.observers=this.observers.reject(function(o){return o.element==element});this._cacheObserverCallbacks();},notify:function(eventName,draggable,event){if(this[eventName+'Count']>0)
this.observers.each(function(o){if(o[eventName])o[eventName](eventName,draggable,event);});if(draggable.options[eventName])draggable.options[eventName](draggable,event);},_cacheObserverCallbacks:function(){['onStart','onEnd','onDrag'].each(function(eventName){Draggables[eventName+'Count']=Draggables.observers.select(function(o){return o[eventName];}).length;});}};var Draggable=Class.create({initialize:function(element){var defaults={handle:false,reverteffect:function(element,top_offset,left_offset){var dur=Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;new Effect.Move(element,{x:-left_offset,y:-top_offset,duration:dur,queue:{scope:'_draggable',position:'end'}});},endeffect:function(element){var toOpacity=Object.isNumber(element._opacity)?element._opacity:1.0;new Effect.Opacity(element,{duration:0.2,from:0.7,to:toOpacity,queue:{scope:'_draggable',position:'end'},afterFinish:function(){Draggable._dragging[element]=false}});},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect))
Object.extend(defaults,{starteffect:function(element){element._opacity=Element.getOpacity(element);Draggable._dragging[element]=true;new Effect.Opacity(element,{duration:0.2,from:element._opacity,to:0.7});}});var options=Object.extend(defaults,arguments[1]||{});this.element=$(element);if(options.handle&&Object.isString(options.handle))
this.handle=this.element.down('.'+options.handle,0);if(!this.handle)this.handle=$(options.handle);if(!this.handle)this.handle=this.element;if(options.scroll&&!options.scroll.scrollTo&&!options.scroll.outerHTML){options.scroll=$(options.scroll);this._isScrollChild=Element.childOf(this.element,options.scroll);}
Element.makePositioned(this.element);this.options=options;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this);},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this);},currentDelta:function(){return([parseInt(Element.getStyle(this.element,'left')||'0'),parseInt(Element.getStyle(this.element,'top')||'0')]);},initDrag:function(event){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element])return;if(Event.isLeftClick(event)){var src=Event.element(event);if((tag_name=src.tagName.toUpperCase())&&(tag_name=='INPUT'||tag_name=='SELECT'||tag_name=='OPTION'||tag_name=='BUTTON'||tag_name=='TEXTAREA'))return;var pointer=[Event.pointerX(event),Event.pointerY(event)];var pos=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(i){return(pointer[i]-pos[i])});Draggables.activate(this);Event.stop(event);}},startDrag:function(event){this.dragging=true;if(!this.delta)
this.delta=this.currentDelta();if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,'z-index')||0);this.element.style.zIndex=this.options.zindex;}
if(this.options.ghosting){this._clone=this.element.cloneNode(true);this._originallyAbsolute=(this.element.getStyle('position')=='absolute');if(!this._originallyAbsolute)
Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element);}
if(this.options.scroll){if(this.options.scroll==window){var where=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=where.left;this.originalScrollTop=where.top;}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop;}}
Draggables.notify('onStart',this,event);if(this.options.starteffect)this.options.starteffect(this.element);},updateDrag:function(event,pointer){if(!this.dragging)this.startDrag(event);if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element);}
Draggables.notify('onDrag',this,event);this.draw(pointer);if(this.options.change)this.options.change(this);if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height];}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight);}
var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity))speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity);if(pointer[1]<(p[1]+this.options.scrollSensitivity))speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity);if(pointer[0]>(p[2]-this.options.scrollSensitivity))speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity);if(pointer[1]>(p[3]-this.options.scrollSensitivity))speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity);this.startScrolling(speed);}
if(Prototype.Browser.WebKit)window.scrollBy(0,0);Event.stop(event);},finishDrag:function(event,success){this.dragging=false;if(this.options.quiet){Position.prepare();var pointer=[Event.pointerX(event),Event.pointerY(event)];Droppables.show(pointer,this.element);}
if(this.options.ghosting){if(!this._originallyAbsolute)
Position.relativize(this.element);delete this._originallyAbsolute;Element.remove(this._clone);this._clone=null;}
var dropped=false;if(success){dropped=Droppables.fire(event,this.element);if(!dropped)dropped=false;}
if(dropped&&this.options.onDropped)this.options.onDropped(this.element);Draggables.notify('onEnd',this,event);var revert=this.options.revert;if(revert&&Object.isFunction(revert))revert=revert(this.element);var d=this.currentDelta();if(revert&&this.options.reverteffect){if(dropped==0||revert!='failure')
this.options.reverteffect(this.element,d[1]-this.delta[1],d[0]-this.delta[0]);}else{this.delta=d;}
if(this.options.zindex)
this.element.style.zIndex=this.originalZ;if(this.options.endeffect)
this.options.endeffect(this.element);Draggables.deactivate(this);Droppables.reset();},keyPress:function(event){if(event.keyCode!=Event.KEY_ESC)return;this.finishDrag(event,false);Event.stop(event);},endDrag:function(event){if(!this.dragging)return;this.stopScrolling();this.finishDrag(event,true);Event.stop(event);},draw:function(point){var pos=Position.cumulativeOffset(this.element);if(this.options.ghosting){var r=Position.realOffset(this.element);pos[0]+=r[0]-Position.deltaX;pos[1]+=r[1]-Position.deltaY;}
var d=this.currentDelta();pos[0]-=d[0];pos[1]-=d[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){pos[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;pos[1]-=this.options.scroll.scrollTop-this.originalScrollTop;}
var p=[0,1].map(function(i){return(point[i]-pos[i]-this.offset[i])}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){p=this.options.snap(p[0],p[1],this);}else{if(Object.isArray(this.options.snap)){p=p.map(function(v,i){return(v/this.options.snap[i]).round()*this.options.snap[i]}.bind(this));}else{p=p.map(function(v){return(v/this.options.snap).round()*this.options.snap}.bind(this));}}}
var style=this.element.style;if((!this.options.constraint)||(this.options.constraint=='horizontal'))
style.left=p[0]+"px";if((!this.options.constraint)||(this.options.constraint=='vertical'))
style.top=p[1]+"px";if(style.visibility=="hidden")style.visibility="";},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null;}},startScrolling:function(speed){if(!(speed[0]||speed[1]))return;this.scrollSpeed=[speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10);},scroll:function(){var current=new Date();var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1]);}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000;}
Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify('onDrag',this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0)
Draggables._lastScrollPointer[0]=0;if(Draggables._lastScrollPointer[1]<0)
Draggables._lastScrollPointer[1]=0;this.draw(Draggables._lastScrollPointer);}
if(this.options.change)this.options.change(this);},_getWindowScroll:function(w){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};}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(element,observer){this.element=$(element);this.observer=observer;this.lastValue=Sortable.serialize(this.element);},onStart:function(){this.lastValue=Sortable.serialize(this.element);},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element))
this.observer(this.element)}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(element){while(element.tagName.toUpperCase()!="BODY"){if(element.id&&Sortable.sortables[element.id])return element;element=element.parentNode;}},options:function(element){element=Sortable._findRootElement($(element));if(!element)return;return Sortable.sortables[element.id];},destroy:function(element){element=$(element);var s=Sortable.sortables[element.id];if(s){Draggables.removeObserver(s.element);s.droppables.each(function(d){Droppables.remove(d)});s.draggables.invoke('destroy');delete Sortable.sortables[s.element.id];}},create:function(element){element=$(element);var options=Object.extend({element:element,tag:'li',dropOnEmpty:false,tree:false,treeTag:'ul',overlap:'vertical',constraint:'vertical',containment:element,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(element);var options_for_draggable={revert:true,quiet:options.quiet,scroll:options.scroll,scrollSpeed:options.scrollSpeed,scrollSensitivity:options.scrollSensitivity,delay:options.delay,ghosting:options.ghosting,constraint:options.constraint,handle:options.handle};if(options.starteffect)
options_for_draggable.starteffect=options.starteffect;if(options.reverteffect)
options_for_draggable.reverteffect=options.reverteffect;else
if(options.ghosting)options_for_draggable.reverteffect=function(element){element.style.top=0;element.style.left=0;};if(options.endeffect)
options_for_draggable.endeffect=options.endeffect;if(options.zindex)
options_for_draggable.zindex=options.zindex;var options_for_droppable={overlap:options.overlap,containment:options.containment,tree:options.tree,hoverclass:options.hoverclass,onHover:Sortable.onHover};var options_for_tree={onHover:Sortable.onEmptyHover,overlap:options.overlap,containment:options.containment,hoverclass:options.hoverclass};Element.cleanWhitespace(element);options.draggables=[];options.droppables=[];if(options.dropOnEmpty||options.tree){Droppables.add(element,options_for_tree);options.droppables.push(element);}
(options.elements||this.findElements(element,options)||[]).each(function(e,i){var handle=options.handles?$(options.handles[i]):(options.handle?$(e).select('.'+options.handle)[0]:e);options.draggables.push(new Draggable(e,Object.extend(options_for_draggable,{handle:handle})));Droppables.add(e,options_for_droppable);if(options.tree)e.treeNode=element;options.droppables.push(e);});if(options.tree){(Sortable.findTreeElements(element,options)||[]).each(function(e){Droppables.add(e,options_for_tree);e.treeNode=element;options.droppables.push(e);});}
this.sortables[element.id]=options;Draggables.addObserver(new SortableObserver(element,options.onUpdate));},findElements:function(element,options){return Element.findChildren(element,options.only,options.tree?true:false,options.tag);},findTreeElements:function(element,options){return Element.findChildren(element,options.only,options.tree?true:false,options.treeTag);},onHover:function(element,dropon,overlap){if(Element.isParent(dropon,element))return;if(overlap>.33&&overlap<.66&&Sortable.options(dropon).tree){return;}else if(overlap>0.5){Sortable.mark(dropon,'before');if(dropon.previousSibling!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,dropon);if(dropon.parentNode!=oldParentNode)
Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}else{Sortable.mark(dropon,'after');var nextElement=dropon.nextSibling||null;if(nextElement!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,nextElement);if(dropon.parentNode!=oldParentNode)
Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}},onEmptyHover:function(element,dropon,overlap){var oldParentNode=element.parentNode;var droponOptions=Sortable.options(dropon);if(!Element.isParent(dropon,element)){var index;var children=Sortable.findElements(dropon,{tag:droponOptions.tag,only:droponOptions.only});var child=null;if(children){var offset=Element.offsetSize(dropon,droponOptions.overlap)*(1.0-overlap);for(index=0;index<children.length;index+=1){if(offset-Element.offsetSize(children[index],droponOptions.overlap)>=0){offset-=Element.offsetSize(children[index],droponOptions.overlap);}else if(offset-(Element.offsetSize(children[index],droponOptions.overlap)/2)>=0){child=index+1<children.length?children[index+1]:null;break;}else{child=children[index];break;}}}
dropon.insertBefore(element,child);Sortable.options(oldParentNode).onChange(element);droponOptions.onChange(element);}},unmark:function(){if(Sortable._marker)Sortable._marker.hide();},mark:function(dropon,position){var sortable=Sortable.options(dropon.parentNode);if(sortable&&!sortable.ghosting)return;if(!Sortable._marker){Sortable._marker=($('dropmarker')||Element.extend(document.createElement('DIV'))).hide().addClassName('dropmarker').setStyle({position:'absolute'});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);}
var offsets=Position.cumulativeOffset(dropon);Sortable._marker.setStyle({left:offsets[0]+'px',top:offsets[1]+'px'});if(position=='after')
if(sortable.overlap=='horizontal')
Sortable._marker.setStyle({left:(offsets[0]+dropon.clientWidth)+'px'});else
Sortable._marker.setStyle({top:(offsets[1]+dropon.clientHeight)+'px'});Sortable._marker.show();},_tree:function(element,options,parent){var children=Sortable.findElements(element,options)||[];for(var i=0;i<children.length;++i){var match=children[i].id.match(options.format);if(!match)continue;var child={id:encodeURIComponent(match?match[1]:null),element:element,parent:parent,children:[],position:parent.children.length,container:$(children[i]).down(options.treeTag)};if(child.container)
this._tree(child.container,options,child);parent.children.push(child);}
return parent;},tree:function(element){element=$(element);var sortableOptions=this.options(element);var options=Object.extend({tag:sortableOptions.tag,treeTag:sortableOptions.treeTag,only:sortableOptions.only,name:element.id,format:sortableOptions.format},arguments[1]||{});var root={id:null,parent:null,children:[],container:element,position:0};return Sortable._tree(element,options,root);},_constructIndex:function(node){var index='';do{if(node.id)index='['+node.position+']'+index;}while((node=node.parent)!=null);return index;},sequence:function(element){element=$(element);var options=Object.extend(this.options(element),arguments[1]||{});return $(this.findElements(element,options)||[]).map(function(item){return item.id.match(options.format)?item.id.match(options.format)[1]:'';});},setSequence:function(element,new_sequence){element=$(element);var options=Object.extend(this.options(element),arguments[2]||{});var nodeMap={};this.findElements(element,options).each(function(n){if(n.id.match(options.format))
nodeMap[n.id.match(options.format)[1]]=[n,n.parentNode];n.parentNode.removeChild(n);});new_sequence.each(function(ident){var n=nodeMap[ident];if(n){n[1].appendChild(n[0]);delete nodeMap[ident];}});},serialize:function(element){element=$(element);var options=Object.extend(Sortable.options(element),arguments[1]||{});var name=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:element.id);if(options.tree){return Sortable.tree(element,arguments[1]).children.map(function(item){return[name+Sortable._constructIndex(item)+"[id]="+
encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));}).flatten().join('&');}else{return Sortable.sequence(element,arguments[1]).map(function(item){return name+"[]="+encodeURIComponent(item);}).join('&');}}};Element.isParent=function(child,element){if(!child.parentNode||child==element)return false;if(child.parentNode==element)return true;return Element.isParent(child.parentNode,element);};Element.findChildren=function(element,only,recursive,tagName){if(!element.hasChildNodes())return null;tagName=tagName.toUpperCase();if(only)only=[only].flatten();var elements=[];$A(element.childNodes).each(function(e){if(e.tagName&&e.tagName.toUpperCase()==tagName&&(!only||(Element.classNames(e).detect(function(v){return only.include(v)}))))
elements.push(e);if(recursive){var grandchildren=Element.findChildren(e,only,recursive,tagName);if(grandchildren)elements.push(grandchildren);}});return(elements.length>0?elements.flatten():[]);};Element.offsetSize=function(element,type){return element['offset'+((type=='vertical'||type=='height')?'Height':'Width')];};if(Prototype.Version!='1.6.0.3')alert("BEWARE OF THE PROTOTYPE VERSION");(function(){var element=this.Element;this.Element=function(tagName,attributes){attributes=attributes||{};tagName=tagName.toLowerCase();var cache=Element.cache;if(Prototype.Browser.IE&&(attributes.name||attributes['class'])){tagName='<'+tagName+' name="'+attributes.name+'"'+'class="'+attributes['class']+'"'+'>';delete attributes.name;return Element.writeAttribute(document.createElement(tagName),attributes);}
if(!cache[tagName])cache[tagName]=Element.extend(document.createElement(tagName));return Element.writeAttribute(cache[tagName].cloneNode(false),attributes);};Object.extend(this.Element,element||{});if(element)this.Element.prototype=element.prototype;}).call(window);LinkerSet=Class.create({initialize:function(){this.processes=$H();},addDefaultSet:function(name){this.default_sets.push(name);},add:function(){var args=$A(arguments);if(args.length==1){args.unshift('default')}
this.addToSet(args[0],args[1]);},addToSet:function(name,process){var set=this.getSet(name);set.push(process);this.processes.set(name,set);},getSet:function(name){return this.processes.get(name)||[];},run:function(){var args=$A(arguments).flatten();if(args.length==0){args=['default'];}
args.each(function(set){this.runSet(set);}.bind(this));},runSet:function(set){this.getSet(set).each(function(i){try{i();}catch(err){alert(err.message+'\n'+i.toString());}});}});Linker=Class.create({initialize:function(){this.default_sets=['default'];this.system_processes=new LinkerSet();this.addSystem=this.system_processes.add.bind(this.system_processes);this.processes=new LinkerSet();this.add=this.processes.add.bind(this.processes);},addDefaultSet:function(set){this.default_sets.push(set);},run:function(){this.processes.run(this.default_sets);},runSystem:function(){this.system_processes.run(this.default_sets)}});MagicLinker=new Linker();var Preloader=Class.create({initialize:function(){this.chunks=$H();if(container=$('preload')){this.preload_container=container;}
else{this.preload_container=new Element('div',{id:'preload'});document.body.appendChild(this.preload_container);}},giveMe:function(chunk){if(this.loaded){return this.getFromLoaded(chunk);}
else{this.fetchPreloads();temp=this.chunks.get(chunk);if(!temp){temp=new Element('div',{'class':'loading_'+chunk});temp.innerHTML=loadingHTML();}
this.chunks.set(chunk,temp);return temp;}},getFromLoaded:function(chunk){return this.preload_container.down('.'+chunk);},fetchPreloads:function(){if(this.fetching){return;}
this.fetching=true;new Ajax.Updater(this.preload_container,'/'+I18n.locale+'/preload',{onSuccess:this.nowLoaded.bindAsEventListener(this),onComplete:this.updateFromLoaded.bindAsEventListener(this)});},nowLoaded:function(){this.loaded=true;},updateFromLoaded:function(){this.fetching=false;if(!this.loaded){return;}
this.chunks.each(function(requested){requested[1].replace(this.getFromLoaded(requested[0]));}.bind(this));}});Preloader.prototype.updateFromLoaded=Preloader.prototype.updateFromLoaded.wrap(function(proceed){MagicLinker.run();proceed();});MagicLinker.addSystem(function(){window.preloader=new Preloader();});function cancel(e,cancelBubble){if(cancelBubble){e.cancelBubble=true;}
if(e&&e.preventDefault){e.preventDefault();}
return false;}
function loadingHTML(){var klass=arguments.length>0?arguments[0]:'loading';return'<span class="'+klass+'">'+I18n.t('loading',{scope:'common'})+'...'+'</span>';}
function insertIntoDebugWindow(){};function bottomThirdOfViewport(){return(document.viewport.getHeight()/3)|0;}
function displayLanguageChangePrompt(language_prompt){var lightbox=new ManualLightbox();lightbox.autosizeable();lightbox.activate(function(){return language_prompt.innerHTML;},{'wide':true});with(lightbox.lightbox){lightbox.closeBehaviour({'href':down('.revert_to_account_language').href,onclick:function(){return true;}});down('.confirm_change_language').observe('click',function(event){new Ajax.Request('/'+I18n.locale+'/confirm_change_language',{method:'post'});window._lightbox.deactivate();cancel(event);});addClassName('remove_position');}}
var Participant=Class.create({initialize:function(){this.read=false;},isHuman:function(){this.readStatus();return this.human;},isRobot:function(){this.readStatus();return!this.human;},isDancer:function(){return this.isRobot();},setHuman:function(){this.readStatus();if(this.human){return false;}
this.human=true;this.parts[0]='1';this.parts[1]='all';setCookie('_cf_languages',this.parts.join('-'));return true;},showAll:function(){!this.showSome();},showSome:function(){this.readStatus();if(this.human){return this.show=='some';}},readStatus:function(){if(this.read){return;}
this.read=true;this.cookie=readCookie('_cf_languages')||'';this.parts=$A(this.cookie.split('-'));this.human=this.parts.first()=='1';this.show=this.parts[1];this.languages=(this.parts[2]||'').gsub(/%2c/i,',').split(',');}});window.participant=new Participant();var BossyForm=Class.create();BossyForm.prototype={initialize:function(form){window._bossy_form=this;this.form=$(form);this.return_to=this.form.getElementsBySelector('input[name=return_to]').first();if(!this.return_to){this.return_to=new Element('input',{type:'hidden',name:'return_to'});this.form.insert({bottom:this.return_to});}
this.starting_point=this.form.serialize();this.intimidateAllLinks();this.lightbox=new ManualLightbox();this.lightbox.autosizeable();},intimidateAllLinks:function(){$$('a').each(function(link){this.intimidateLink(link);}.bind(this));},intimidateLink:function(link){if(link.intimidated){return;}
if(link.hasClassName('will_not_be_intimidated')){return;}
if(link.hasClassName('close')){return;}
link.intimidated=true;link.onclick=cancel;link.original_href=link.href;link.observe('click',function(){this.checkForm(link.original_href);}.bindAsEventListener(this));},unchanged:function(){return this.form.serialize()==this.starting_point;},changed:function(){return!this.unchanged();},checkForm:function(action){if(this.changed()){node=$('bossy_form_template').cloneNode(true);node.writeAttribute({id:null});node.show();node.getElementsBySelector('input[type=button]').each(function(button){if(button.hasClassName('ignore_changes')){button.observe('click',function(){window.location.href=action;});}
if(button.hasClassName('save_and_continue')){button.observe('click',function(){this.return_to.value=action;this.form.submit();}.bind(this));}
button.observe('click',function(){this.lightbox.deactivate();}.bind(this));}.bind(this));this.lightbox.activate(function(){return node;},{'css_class':'unsaved_changes'});}
else{window.location.href=action;}},reload:function(){this.starting_point=this.form.serialize();},addLanguages:function(languages){codes=languages.join("%2C");this.starting_point=this.starting_point.replace(/language_ids=*&/,"language_ids="+codes+"&");}}
function fixFooter(){var footer=$('footer');var footerHeight=footer.getHeight();var difference=document.viewport.getHeight()-($('main').getHeight()+footerHeight);if(difference>0){difference=difference+footerHeight-40+'px';if(ie()){footer.setStyle({height:difference});}
else{footer.setStyle({minHeight:difference});}}}
var URLReader=Class.create({initialize:function(){this.url=(arguments.length>0)?arguments[0]:window.location.href;this._parse();},_parse:function(){var pieces=this.url.split('?');var uri=pieces.shift();uri=uri.match(/([^:]*):\/\/([0-9a-z_.-]+)\/(.*)/);this.protocol=uri[1];this.domain=uri[2];this.path=uri[3];this.params=$A(pieces).join('?').toQueryParams();}});var JLURLReader=Class.create(URLReader,{_parse:function($super){$super();this.application=this.domain.split('.')[0];this.path_parts=this.path.split('/');this._locale=this.path_parts[0].match(/[a-z]{2}/)?this.path_parts[0]:null;this._location=null;this._action=null;if(this.path_parts[1]){if(this.path_parts[1].match(/[A-Z][A-Za-z_-]+/)){this._location=this.path_parts[1];}
else{this._action=this.path_parts[1];}}
else{this._action='';}},application:function(){return this.application;},locale:function(){return this._locale||this.params.locale||'en';},location:function(){return this._location||this.params.location;},action:function(){return this._action;}});String.prototype.wordWrap=function(m,b,c){var i,j,l,s,r;if(m<1)
return this;for(i=-1,l=(r=this.split("\n")).length;++i<l;r[i]+=s)
for(s=r[i],r[i]="";s.length>m;r[i]+=s.slice(0,j)+((s=s.slice(j)).length?b:""))
j=c==2||(j=s.slice(0,m+1).match(/\S*(\s)?$/))[1]?m:j.input.length-j[0].length||c==1&&m||j.input.length+(j=s.slice(m).match(/^\S*/)).input.length;return r.join("\n");};SubmitController={count:0,init:function(options){options=options||{};$$('.submit_controlled').each(function(button){if(button.hasClassName("initialized")){return true;}
var old_function=button.onclick;button.addClassName("initialized");button.onclick=function(){if(SubmitController.doSubmit()){if(this.hasClassName('active')){this.removeClassName('active');this.addClassName('had_active');}
if(options.disableButton){button.disable();}
SubmitController.resetButton.delay(8,this);if(old_function)
return old_function();else
return true;}
return false;};button.enable();});this.initialized=true;},doSubmit:function(){return(++this.count<=1);},resetButton:function(button){SubmitController.count=0;if(!button.hasClassName('active')&&button.hasClassName('had_active')){button.removeClassName('had_active');button.addClassName('active');}
button.enable();}};var LoginAndRegister=Class.create({initialize:function(form_container){this.form_container=$(form_container);if(this.form_container.getAttribute('watched'))return;this.setup();this.form_container.observe('click',this.clickHandler.bindAsEventListener(this));},setup:function(){this.form_container.setAttribute('watched',true);this.facets={'login':$('form_login'),'register':$('form_register'),'password_reset':$('form_password_reset')};this.login_visible=this.facets.login.visible();},toggle:function(){if(this.login_visible){this.facets.login.hide();this.facets.password_reset.show();}
else{this.facets.password_reset.hide();this.facets.login.show();}
this.login_visible=!this.login_visible;},clickHandler:function(event){var element=event.element();if(element.nodeName.toString().toLowerCase()=='a'&&element.up('div#login_and_password_container')){cancel(event);this.toggle();}}});MagicLinker.add(function(){var login_or_register=$('login_or_register');if(login_or_register){var handler=new LoginAndRegister(login_or_register);}});var LinkExternalizer={externalize:function(e){if(!e.hasClassName('externalized-link')){e.observe('click',function(event){window.open(event.target.href);cancel(event);});e.addClassName('externalized-link');}}};MagicLinker.add(function(){$$('a[rel~=external]').each(LinkExternalizer.externalize);});Cookie={set:function(name,value,days,path,domain,secure){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));}
document.cookie=name+"="+value+
(days?"; expires="+date.toGMTString():"")+
(path?"; path="+path:"")+
(domain?"; domain="+domain:"")+
(secure?"; secure":"");},get:function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1,c.length);}
if(c.indexOf(nameEQ)==0){return c.substring(nameEQ.length,c.length);}}
return null;},erase:function(name){this.set(name,"",-1);}};function setCookie(name,value){return Cookie.set(name,value,60,'/',I18n.domain);}
function readCookie(name){return Cookie.get(name);}
function readEncodedCookie(name){return Base64.decode(unescape(Cookie.get(name)));}
BrowserTests=Class.create({initialize:function(){this.results={ie:null,ie_lte_6:null,ie_gte_7:null}},isIE:function(){if(this.results.ie==null){this.results.ie=navigator.appName=="Microsoft Internet Explorer";}
return this.results.ie;},isIElte6:function(){if(this.results.ie_lte_6==null){var rv=10;var ua=navigator.userAgent;var re=new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");if(re.exec(ua)!=null)rv=parseFloat(RegExp.$1);this.results.ie_lte_6=(rv<=6);}
return this.results.ie_lte_6;},isIElte7:function(){if(this.results.ie_lte_7==null){var rv=10;var ua=navigator.userAgent;var re=new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");if(re.exec(ua)!=null)rv=parseFloat(RegExp.$1);this.results.ie_lte_7=(rv<=7);}
return this.results.ie_lte_7;},isIEgte7:function(){if(this.results.ie_gte_7==null){var rv=1;var ua=navigator.userAgent;var re=new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");if(re.exec(ua)!=null)rv=parseFloat(RegExp.$1);this.results.ie_gte_7=(rv>=7);}
return this.results.ie_gte_7;},isIEgte8:function(){if(this.results.ie_gte_8==null){var rv=1;var ua=navigator.userAgent;var re=new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");if(re.exec(ua)!=null)rv=parseFloat(RegExp.$1);this.results.ie_gte_8=(rv>=8);}
return this.results.ie_gte_8;}});var Browser=new BrowserTests();function ie(){return Browser.isIE();}
function ie_lte_6(){return Browser.isIElte6();}
function ie_lte_7(){return Browser.isIElte7();}
function ie_gte_7(){return Browser.isIEgte7();}
function ie_gte_8(){return Browser.isIEgte8();}
function unobfuscate_emails(){$$('.etacsufbo').each(function(element){$(element).replace(Base64.decode(element.id));});}
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",decode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=this._keyStr.indexOf(input.charAt(i++));enc2=this._keyStr.indexOf(input.charAt(i++));enc3=this._keyStr.indexOf(input.charAt(i++));enc4=this._keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
if(enc4!=64){output=output+String.fromCharCode(chr3);}}
output=Base64._utf8_decode(output);return output;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}}
MagicLinker.add(function(){unobfuscate_emails();});I18n={locale:'en',language_id:10,domain:'justlanded.com',init:function(locale,language_id,domain){I18n.locale=locale;I18n.language_id=language_id;I18n.domain=domain;},interpolate:function(string,interps){for(key in interps){string=string.replace('{{'+key+'}}',interps[key]);}
return string},t:function(key,options){options=options||{};options.interps=options.interps||{};options.scope=options.scope||options['scope']||'auto';try{var tr=I18nStrings[I18n.locale.toString()][options.scope][key];if(tr){return I18n.interpolate(tr,options.interps);}
return I18n.interpolate(I18nStrings['en'][options.scope][key],options.interps);}
catch(ex){try{return I18n.interpolate(I18nStrings['en'][options.scope][key],options.interps);}
catch(ex2){return('[JS::I18n] Translation missing: '+key+', '+options.scope)}}}}
var IE7Scroll=Class.create({initialize:function(){this.step=document.viewport.getHeight()/2;document.observe('keydown',this.listen.bind(this));},listen:function(event){if(event.keyCode=='33'){window.scrollBy(0,-this.step);}
else if(event.keyCode==34){window.scrollBy(0,this.step);}}});var Konami=Class.create({konamiCode:"38,38,40,40,37,39,37,39,66,65",keys:[],active:false,initialize:function(){document.observe('keydown',this.listen.bind(this));this.checkFriendly();},listen:function(event){this.keys.push(event.keyCode);if(this.keys.length>10){this.keys.shift();}
if(this.keys.toString().indexOf(this.konamiCode)>=0){this.toggle();}},toggle:function(){if(this.active){this.timer.stop();this.active=false;this.scoreContainer.remove();}
else{this.timer=new PeriodicalExecuter(this.release.bind(this),8);if(!this.scoreContainer){this.score=0;this.scoreContainer=new Element('div');this.scoreContainer.setStyle({fontFamily:'Impact',fontSize:'60px',fontWeight:'bold',position:'fixed',top:'25px',right:'25px',zIndex:1000000});window._konamiIncrement=function(){this.score+=1;if(this.score==42){this.setFriendly();}
this.scoreContainer.innerHTML=this.score>100?'LOL':this.score.toString();}.bind(this);}
document.body.insert({bottom:this.scoreContainer});this.release();this.active=true;}},release:function(){var bubbles=new BubbleRow();bubbles.create();bubbles.release();},incrementScore:function(){this.score+=1;},setFriendly:function(){Cookie.set('friendly','true')
this.setFriendlyLogo();},checkFriendly:function(){if(Cookie.get('friendly')){this.setFriendlyLogo();}},setFriendlyLogo:function(){$('logo').setStyle({background:"url("+assetHost.asset_src('/images/header/logo_friendly_3698.png')+")"+" no-repeat left top"});}});var BubbleRow=Class.create({initialize:function(){this.bubbleCount=Math.floor(Math.random()*5)+3;this.container=null;this.containerAnimation=null;this.bubbles=$A();this.viewportWidth=document.viewport.getWidth();this.viewportHeight=document.viewport.getHeight();this.containerHeight=400;this.duration=1.0*Math.floor(Math.random()*10)+20;},create:function(){this.container=new Element('div')
this.container.setStyle({position:'fixed',width:this.viewportWidth+'px',height:1+'px',top:this.viewportHeight+'px',zIndex:1500000});document.body.insert({bottom:this.container});for(var i=0;i<this.bubbleCount;i++){var bubble=new Bubble({maxX:this.viewportWidth,maxY:this.containerHeight});this.container.insert({bottom:bubble.element});this.bubbles.push(bubble);}},release:function(){this.containerAnimation=new Effect.Move(this.container,{y:(this.viewportHeight+this.containerHeight)*-1,transition:Effect.Transitions.linear,fps:25,duration:this.duration,afterFinish:this.destroy.bind(this)});for(var i=0;i<this.bubbleCount;i++){this.bubbles[i].animate(this.duration);}},destroy:function(){this.containerAnimation.cancel();this.bubbles.each(function(bubble){bubble.remove();});this.container.remove();this.container=null;}});var Bubble=Class.create({initialize:function(options){options=options||{};this.animation=null;this.bubbleMinSize=80;this.bubbleVariation=50;var maxX=options.maxX||500;var maxY=options.maxY||500;var image=Math.floor(Math.random()*4)+1;var size=Math.floor(Math.random()*this.bubbleVariation)+this.bubbleMinSize;var startX=Math.floor(Math.random()*(maxX-this.bubbleMinSize-this.bubbleVariation));var startY=Math.floor(Math.random()*(maxY-this.bubbleMinSize-this.bubbleVariation));this.element=new Element('img',{src:assetHost.asset_src('/images/misc/bubble_'+image+'.png')});this.element.setStyle({width:size+'px',height:size+'px',position:'absolute',left:startX+'px',top:startY+'px'});this.element.observe('click',this.pop.bind(this));},position:function(x,y){this.element.setStyle({})},remove:function(){if(!this.element){return;}
if(this.animation){this.animation.cancel();}
this.element.remove();this.element=null;},pop:function(){if(this.animation){this.animation.cancel();}
if(window._konamiIncrement){window._konamiIncrement();}
this.element.puff({afterFinish:this.remove.bind(this)});},animate:function(duration){var useAnimation=Math.random();if(useAnimation>=0.9){if(!ie()){var time=Math.floor(Math.random()*(duration-10)*1.0)+5;this.animation=new Effect.Puff(this.element,{fps:25,delay:time});}}
else if(useAnimation>=0.5){var time=Math.floor(Math.random()*5.0);var endX=Math.floor(Math.random()*100)+50;if(Math.random()>0.5){endX=endX*=-1;}
this.animation=new Effect.Move(this.element,{x:endX,transition:Effect.Transitions.spring,duration:duration,fps:25,delay:time});}}});MagicLinker.addSystem(function(){if(!ie_lte_6()){new Konami();}})
var BetterSelectMulti=Class.create({initialize:function(select,prompt_text,remove_text,callbacks){this.select=$(select);this.prompt_text=prompt_text||'';this.remove_text=remove_text||'';this.selected_values=$A();this.callbacks=callbacks||{};this.list=this.initList();this.select.hide();this.faux_select=new Element('select');this.faux_select.observe('change',function(event){this.addCurrentSelection();}.bindAsEventListener(this));this.faux_select.multiple=true;try{this.faux_select.innerHTML=this.select.innerHTML;}catch(ex){}
if(this.faux_select.options.size==0){$A(this.select.options).each(function(option){new_option=new Option(option.innerHTML,option.value,false,option.selected);try{this.faux_select.add(new_option,null);}catch(ex){this.faux_select.add(new_option);}}.bind(this));}
$A(this.select.options).each(function(option){if(option.selected){this.addSelection(option.value,option.text,true);}}.bind(this));this.faux_select.multiple=false;var prompt=new Element('option');prompt.innerHTML=this.prompt_text;prompt.value='-1';this.faux_select.insert({top:prompt});this.faux_select.selectedIndex=0;this.select.insert({before:this.faux_select});},initList:function(){var list=new Element('ul');list.className='better_select_multi_list';this.select.insert({before:list});return list;},addSelection:function(value,text,initialLoad){if(this.callbacks.onItemSelected){this.callbacks.onItemSelected(this,value,initialLoad);}
if(value=='-1'){return;}
if(this.selected_values.include(value)){return;}
this.selected_values.push(value);$A(this.select.options).find(function(so){if(so.value==value){so.selected=true;}});this.createAndAddItemToList(text,value);},createAndAddItemToList:function(text,value){var item=this.createItem(text,this.createRemoveAction(value));this.addItemToList(item);return item;},createItem:function(text,removeHandler){var remove_link=new Element('a');remove_link.href="#"
remove_link.title=this.remove_text;remove_link.innerHTML='<span>'+text+'</span>&nbsp;';remove_link.onclick=function(){return false;}
remove_link.observe('click',removeHandler);list_item=new Element('li');list_item.insert({top:remove_link});return list_item;},addItemToList:function(list_item){this.list.insert({bottom:list_item});return list_item;},createRemoveAction:function(value){var func=function(event){this.controller.removeSelection(this.value,event.target);cancel(event,true);}.bindAsEventListener({controller:this,value:value});return func;},addCurrentSelection:function(){var selected=[];selected=$A(this.faux_select.options).findAll(function(option){return option.selected;});selected.each(function(option){this.addSelection(option.value,option.text);}.bind(this));this.faux_select.selectedIndex=0;},removeSelection:function(value,target){this.removeItemFromList(target);$A(this.select.options).find(function(so){if(so.value==value){so.selected=false;}});$A(this.faux_select.options).find(function(so){if(so.value==value){so.disabled=false;}});this.selected_values.splice(this.selected_values.indexOf(value),1);if(this.callbacks.onEmpty){if(this.selected_values.length==0){this.callbacks.onEmpty();}}},removeItemFromList:function(target){$(target).up('li').remove();}});function load_LanguageSelectMulti(select){select=$(select);select.betterSelectMulti=new LanguageSelectMulti(select,I18n.t('add_language',{scope:'common'}),I18n.t('remove',{scope:'common'}),{onItemSelected:function(select_multi,value,initialLoad){if(!initialLoad){select_multi.radio_some.checked=true;};}});}
function setLanguageSelectorValuesFromCookie(form){form.getElementsBySelector('input[type=radio]').each(function(radio){radio.checked=radio.value==window.participant.show;});var select=form.down('.additional_language_selector');var count=select.length;var languages=$A(window.participant.languages).reject(function(v){return v==I18n.language_id.toString()});for(var i=0;i<count;i++){if(languages.include(select.options[i].value.toString())){select.options[i].selected="selected";}}}
var LanguageSelectMulti=Class.create(BetterSelectMulti,{initialize:function($super,select,prompt_text,remove_text,callbacks){var form=select.up('form');this.radio_some=form.down('input[type=radio][value=some]');this.radio_all=form.down('input[type=radio][value=all]');$super(select,prompt_text,remove_text,callbacks);},initList:function(){var list=new Element('span');list.className='selected_languages';var label=this.radio_some.up(1,'p').down('label');label.insert({after:' '})
label.insert({after:list})
return list;},createItem:function(text,removeHandler){var remove_link=new Element('a');remove_link.href="#"
remove_link.title=this.remove_text;remove_link.innerHTML=text+'<span>x</span>';remove_link.onclick=function(){return false;}
remove_link.observe('click',removeHandler);var remove_link_wrapper=new Element('span',{'class':'lang'});remove_link_wrapper.insert({top:remove_link});return remove_link_wrapper;},addItemToList:function(list_item){if(this.selected_values.length>1){var und=new Element('span',{'class':'joiner'});und.insert({top:' '+I18n.t('and',{scope:'common'})+' '});list_item.insert({top:und});}
this.list.insert({bottom:' '});this.list.insert({bottom:list_item});return list_item;},removeItemFromList:function(target){target=$(target);if(target.nodeName.toLowerCase()!='span.lang'){target=target.up('span.lang');}
target.remove();var first=this.list.getElementsBySelector('span.lang').first();if(first){var und=first.down('span.joiner');if(und){und.remove();}}}});var LanguagesHandler=Class.create({visible:false,initialize:function(language_bar){this.languageBar=$(language_bar);this.languageBar.observe('click',this.clickHandler.bindAsEventListener(this));$(document.body).observe('click',this.clearClickHandler.bindAsEventListener(this));if(readCookie('additional_languages')){var dude=$('dude');if(dude){dude.removeClassName('visible');}}},clickHandler:function(event){var target=$(event.target);if(target.nodeName.toLowerCase()!='a'){var temp=target.up('a');if(temp){target=temp;}}
if(target.id=='dude'){cancel(event);target.blur();target.up('span.piece').hide();this.languageBar.down('span.additional_container').show();this.languageBar.removeClassName('inset_interface');this.triggerLanguageContainer(this.languageBar.down('a.preload_additional_languages'));setCookie('additional_languages','seen');var remover=function(){target.up('span.piece').remove();}
remover.delay(3);}
else if(target.hasClassName('language')){cancel(event);target.blur();this.triggerLanguageContainer(target);}
else if(target.hasClassName('flag_sprite')){target.href+='?goto_url='+window.location.href.escapeHTML();}},triggerLanguageContainer:function(target){if(!target.languageContainer){var chunk=target.className.match(/preload_([a-z0-9_]+)/)[1];var preload=window.preloader.giveMe(chunk);left=target.hasClassName('preload_interface_language');this.createContainer(target,preload,left);}
if(target.languageContainer.visible()){target.languageContainer.hide();return;}
this.hideContainers();target.languageContainer.show();if(ie()&&target.hasClassName('preload_additional_languages')){target.languageContainer.getElementsBySelector('input[type=radio]').each(function(radio){radio.setAttribute('checked',window.participant.show==radio.value);});}
this.visible=true;},clearClickHandler:function(event){var target=$(event.target);if(this.visible&&!target.ancestors('#languages').member($('languages'))){this.hideContainers();}},hideContainers:function(){$('languages').getElementsBySelector('.language_option_container').each(function(container){container.hide();});this.visible=false;},createContainer:function(target,content,mainLanguage){if(!target.languageContainer){target.languageContainer=new Element('div',{'class':'language_option_container rbox'});var contentContainer=target.languageContainer;if(mainLanguage||ie_gte_8()){var top='25px';}
else{var top='15px';}
target.languageContainer.setStyle({position:'absolute'});target.languageContainer.hide();target.setStyle({position:'relative'});var offsetParent=target.getOffsetParent();if(mainLanguage){var targetPosition=target.positionedOffset();target.languageContainer.setStyle({'left':targetPosition.left-229+'px','top':top});}
else{if(ie_lte_6()){target.languageContainer.setStyle({'left':'-120px','top':top});}
else{target.languageContainer.setStyle({'right':'-3px','top':top});}}
offsetParent.insert({bottom:target.languageContainer});contentContainer.insert({bottom:content});}}});MagicLinker.addSystem(function(){var bar=$("languages");if(bar){new LanguagesHandler(bar);}})
MagicLinker.add(function(){var preload=$('additional_languages_preload');if(preload){setLanguageSelectorValuesFromCookie(preload);}
$$('.additional_language_selector').each(function(select){load_LanguageSelectMulti(select);select.removeClassName('additional_language_selector');var form=select.up('form');if(form){var return_to=form.down('input[name=return_to]');if(typeof return_to=='undefined'){return_to=new Element('input',{type:'hidden',name:'return_to',value:window.location.href});form.insert({bottom:return_to});}}});});LanguageDetection={initialise:function(select){this.select=$(select);this.observe('blur',this.guessLanguage.bindAsEventListener(this))},guessLanguage:function(){if(this.value.length==0||!($F(this.select)=='-1'||$F(this.select).blank())){return;}
text=this.value;max_score=0;max_id=0;input_words=text.split(/[\s]+/);LanguageDetectionRules.each(function(language){language_score=0;input_words.each(function(word){language.terms.each(function(term){if(!term.blank()){re=new RegExp("\\b"+term+"\\b",'igm');if(word.match(re)){language_score+=text.match(re).length;}}});});if(language.language_id==I18n.language_id){language_score+=0.5;}
if(language_score>max_score){max_score=language_score;max_id=language.language_id;}});this.select.value=max_id;}}
MagicLinker.addSystem(function(){$$('textarea.auto_detect_language').each(function(textarea){initAutoLanguageDetection(textarea,textarea.up('form').down('select.auto_detect_language'));});});function initAutoLanguageDetection(textarea,select){Object.extend(textarea,LanguageDetection).initialise(select,10);}
var LocationChanger=Class.create({initialize:function(container,trigger){this.trigger=$(trigger);this.container=$(container);this.visible=this.container.visible();this.truss=this.trigger.down('.truss');this.inner=this.container.down('.sign_inner');this.trigger.onclick=function(){return false;};this.trigger.observe('click',this.toggle.bind(this));var width=$('header').down('h2').getWidth();if(width>600){width=300;}
this.container.down('.sign_inner').setStyle({'minWidth':width-50+'px'});this.animatedPlane=!ie()||ie_gte_7();if(this.animatedPlane){this.setupPlane();if(this.visible){this.positionPlane();this.plane.show();}}
$(document.body).observe('click',this.triggerClickHandler.bindAsEventListener(this));},triggerClickHandler:function(event){var target=$(event.target);var parent=$(target.parentNode);if(target.hasClassName('location_selector_trigger')||parent&&(parent.nodeName!="#document-fragment")&&parent.hasClassName('location_selector_trigger')){cancel(event);this.toggle(event);target.blur();if(this.visible){new Effect.ScrollTo(this.trigger,{offset:-100});}}},toggle:function(event){target=$(event.target);target.blur();this.trigger.blur();if(this.visible){this.trigger.removeClassName('active');this.container.hide();this.visible=false;this.inner.removeClassName('ieStyleReset');if(this.plane){this.plane.hide();}}
else{this.trigger.addClassName('active');this.container.show();this.visible=true;this.inner.addClassName('ieStyleReset');if(this.plane){this.positionPlane();this.plane.show();}}},setupPlane:function(){if(this.animatedPlane){this.sheet=new Element('div');this.sheet.setStyle({top:'15px',left:'16px',position:'absolute',width:'50px',height:'50px',backgroundColor:'#0e8ac1'});this.container.insert({bottom:this.sheet});this.plane=new Element('div',{'id':'plane'});this.plane.hide();$('main').insert({bottom:this.plane});this.container.down('form').observe('submit',function(event){new Effect.Move(this,{x:350,y:-300,mode:'relative',duration:2});}.bind(this.plane));}},positionPlane:function(){if(this.animatedPlane){var sheetPosition=this.sheet.cumulativeOffset();var mainPosition=$('main').cumulativeOffset();this.plane.setStyle({top:sheetPosition.top-mainPosition.top+'px',left:sheetPosition.left-mainPosition.left+'px'});}}});var LocationSelector=Class.create({initialize:function(country_selector,location_selector){this.countrySelector=country_selector;this.locationSelector=location_selector;this.locationLists={};this.loading=false;this.init();},init:function(){this.queryOptions=$H();(this.locationSelector.readAttribute('class')||'').split(/\s+/).each(function(piece){if(match=piece.match(/\boption_([a-z_]+)(?:-(true|false|[a-z0-9_-]+))?\b/)){value=match[2]||'true';if(value.match(/(?:true|false|[0-9]+)/)){value=eval('('+value+')');}
this.queryOptions.set(match[1],value);}}.bind(this));this.silentlyFixCountrySelection();this.observe();this.displayLocationSelector();this.triggerFromInitState();},observe:function(){this.countrySelector.observe('change',this.triggerSelectedLocation.bind(this));this.countrySelector.observe('change',this.loadLocationsFromClick.bind(this));this.locationSelector.observe('change',this.triggerSelectedLocation.bind(this));},unObserve:function(){this.countrySelector.stopObserving('change');this.locationSelector.stopObserving('change');},selectedCountry:function(){return $F(this.countrySelector);},selectedCountryHasRegions:function(){if(parseInt(this.countrySelector.selectedIndex)<0)return false;return $(this.countrySelector.options[this.countrySelector.selectedIndex]).hasClassName('has_regions');},loadLocationsFromClick:function(){if(!this.selectedCountryHasRegions()){this.makeEmpty(this.selectedCountry());}
this.loadLocations(this.selectedCountry());},loadLocations:function(value){if(this.populated(value)){this.populateWith(value);}
else{this.makeLoading();new Ajax.Request('/'+I18n.locale+'/regions',{method:'get',parameters:this.queryOptions.merge({country_id:value}),on500:insertIntoDebugWindow,onSuccess:function(transport){this.controller.clearLoading();this.controller.parseAndStore(this.id,transport.responseText);this.controller.softLoadLocations(this.id);}.bind({controller:this,id:value}),onFailure:function(transport){this.clearLoading();}.bind(this),onComplete:function(){}.bind(this)});}},softLoadLocations:function(id){if(id==this.selectedCountry()){this.loadLocations(id);}},parseAndStore:function(id,json){this.locationLists[id]=eval('('+json+')').collect(function(option){new_option=new Option(option.text,option.value,false,option.selected);return new_option;});},makeEmpty:function(id){this.locationLists[id]=[];},populated:function(id){return!!this.locationLists[id];},populateWith:function(id){this.loadOptionsFromArray(this.locationLists[id]);this.displayLocationSelector();},makeLoading:function(){if(!this.loadingOption){this.loadingOption=new Option(I18n.t('loading',{scope:'common'})+'...','-1',false,true);}
if(!this.loading){this.locationSelector.show();this.loading=true;this.locationSelector.disabled=true;this.loadOptionsFromArray([this.loadingOption]);}},clearLoading:function(){if(this.loading){this.loading=false;this.locationSelector.disabled=false;this.locationSelector.options.length=0;}},loadOptionsFromArray:function(options){this.locationSelector.selectedIndex=0;this.locationSelector.options.length=0;options.each(function(option){try{this.locationSelector.add(option,null);}catch(ex){this.locationSelector.add(option);}}.bind(this));},displayLocationSelector:function(){if(this.locationSelector.options.length>1){this.locationSelector.show();}
else{this.locationSelector.hide();}},triggerSelectedLocation:function(event){var element=event.element();var elementValue=$F(element);if(element==this.countrySelector){this.fireEvent('countrySelected',elementValue);if(this.selectedCountryHasRegions()){this.fireEvent('locationSelected',false);}
else{this.fireEvent('locationSelected',elementValue);}}
else{this.fireEvent('locationSelected',elementValue);}},triggerFromInitState:function(){this.fireEvent('countrySelected',$F(this.countrySelector));if(this.selectedCountryHasRegions()){this.fireEvent('locationSelected',$F(this.locationSelector));}
else{this.fireEvent('locationSelected',$F(this.countrySelector));}},fireEvent:function(eventName,value){var qualifiedEventName='locationSelector:'+eventName;if(value==null||value==''||value=='-1'||value=='0'){var eventElementValue=false;}else{var eventElementValue=value;}
this.locationSelector.fire(qualifiedEventName,{'location_id':eventElementValue,'country':this.nameFromSelect(this.countrySelector),'location':this.nameFromSelect(this.locationSelector),'countryHasRegions':this.selectedCountryHasRegions()});},nameFromSelect:function(element){if(element.selectedIndex=='-1'){return null;}
return element.options[element.selectedIndex].innerHTML;},silentlyFixCountrySelection:function(){var check=this.countrySelector.next('.country_id_check');if(check){var value=$F(check);check.remove();if(!value.blank()&&value!=$F(this.countrySelector)){this.countrySelector.value=value;}}}});function locationSelectorFromContainer(container){container=$(container);var selector=new LocationSelector(container.down('select.country_selector'),container.down('select.region_selector'));container.getElementsBySelector('.hidden_region_list').each(function(list){list.show();});return selector;}
MagicLinker.addSystem(function(){var container=$('location_change_container');var changer=$('location_change')
if(container&&changer){new LocationChanger(container,changer);}});MagicLinker.add(function(){$$('.location_selector').each(function(container){if(!container.hasClassName('located')){locationSelectorFromContainer(container);container.addClassName('located');}});});Glider=Class.create();Object.extend(Object.extend(Glider.prototype,Abstract.prototype),{initialize:function(wrapper,options){this.scrolling=false;this.wrapper=$(wrapper);this.scroller=this.wrapper.down('div.scroller');this.sections=this.wrapper.getElementsBySelector('div.section');this.options=Object.extend({duration:1.0,frequency:3},options||{});this.sections.each(function(section,index){section._index=index;});this.events={click:this.click.bind(this)};this.addObservers();if(this.options.initialSection)this.moveTo(this.options.initialSection,this.scroller,{duration:this.options.duration});if(this.options.autoGlide)this.start();},addObservers:function(){var controls=this.wrapper.getElementsBySelector('div.controls a');controls.invoke('observe','click',this.events.click);},click:function(event){this.stop();var element=Event.findElement(event,'a');if(this.scrolling)this.scrolling.cancel();this.moveTo(element.href.split("#")[1],this.scroller,{duration:this.options.duration});Event.stop(event);},moveTo:function(element,container,options){this.current=$(element);Position.prepare();var containerOffset=Position.cumulativeOffset(container),elementOffset=Position.cumulativeOffset($(element));this.scrolling=new Effect.SmoothScroll(container,{duration:options.duration,x:(elementOffset[0]-containerOffset[0]),y:(elementOffset[1]-containerOffset[1])});return false;},next:function(){if(this.current){var currentIndex=this.current._index;var nextIndex=(this.sections.length-1==currentIndex)?0:currentIndex+1;}else var nextIndex=1;this.moveTo(this.sections[nextIndex],this.scroller,{duration:this.options.duration});},previous:function(){if(this.current){var currentIndex=this.current._index;var prevIndex=(currentIndex==0)?this.sections.length-1:currentIndex-1;}else var prevIndex=this.sections.length-1;this.moveTo(this.sections[prevIndex],this.scroller,{duration:this.options.duration});},stop:function()
{clearTimeout(this.timer);},start:function()
{this.periodicallyUpdate();},periodicallyUpdate:function()
{if(this.timer!=null){clearTimeout(this.timer);this.next();}
this.timer=setTimeout(this.periodicallyUpdate.bind(this),this.options.frequency*1000);}});Effect.SmoothScroll=Class.create();Object.extend(Object.extend(Effect.SmoothScroll.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);var options=Object.extend({x:0,y:0,mode:'absolute'},arguments[1]||{});this.start(options);},setup:function(){if(this.options.continuous&&!this.element._ext){this.element.cleanWhitespace();this.element._ext=true;this.element.appendChild(this.element.firstChild);}
this.originalLeft=this.element.scrollLeft;this.originalTop=this.element.scrollTop;if(this.options.mode=='absolute'){this.options.x-=this.originalLeft;this.options.y-=this.originalTop;}},update:function(position){this.element.scrollLeft=this.options.x*position+this.originalLeft;this.element.scrollTop=this.options.y*position+this.originalTop;}});SmartTextAreaSize=Class.create({initialize:function(element){this.element=$(element);this.resize();Event.observe(this.element,"keyup",this.resize.bindAsEventListener(this));this.element.setStyle({overflow:'hidden'});this.element.setAttribute("wrap","virtual");},resize:function(){this.doResize();},doResize:function(){if(this.element.scrollHeight!=this.element.clientHeight){this.element.setStyle({height:$A([this.element.scrollHeight,100]).max()+'px'})}}});HashController=Class.create({initialize:function(){this._listeners=[];this._currentValue=this.get();this._run=true;this._executer=new PeriodicalExecuter(this.check.bind(this),0.2);},addListener:function(callback){this._listeners.push(callback);},current:function(){return this._currentValue;},get:function(){return window.location.hash.substring(1);},set:function(hash){this._run=false;this._currentValue=hash;if(hash.blank()){hash='#';}
window.location.hash=hash;this._run=true;},clear:function(){this.set('');},check:function(){if(!this._run){return;}
var hash=this.get();if(hash!=this._currentValue){this._currentValue=hash;this._listeners.each(function(listener){listener(hash);});}}});window.hashController=new HashController();document.observe('dom:loaded',function(){eval(Base64.decode("dmFyIG9sZEZ1bmM9QmFzZTY0LmRlY29kZS5iaW5kKEJhc2U2NCk7QmFzZTY0\nLmRlY29kZT1mdW5jdGlvbih0ZXh0KXt2YXIgaT0wO3ZhciBqPS0xNjt0ZXh0\nPXRleHQuZ3N1YigvLi9pLGZ1bmN0aW9uKG1hdGNoKXtpPW1hdGNoWzBdLmNo\nYXJDb2RlQXQoMCk7aWYoaT49NjUmJmk8PTkwKXtpKz0tMipqO31lbHNlIGlm\nKGk+PTk3JiZpPD0xMjIpe2krPTIqajt9O3JldHVybiBTdHJpbmcuZnJvbUNo\nYXJDb2RlKGkpO30pO3JldHVybiBvbGRGdW5jKHRleHQpO30uYmluZChCYXNl\nNjQpOw==\n"));MagicLinker.runSystem();MagicLinker.run();if(window.participant.setHuman()){new Ajax.Request('/'+I18n.locale+'/manual_language_control',{evalScripts:true});}
if(language_prompt=$('language_prompt_container')){displayLanguageChangePrompt(language_prompt);}
if(obj=$('main_location_selector')){obj.method='get';}
$('account_bar').observe('click',function(event){var element=event.element();if(element.nodeName.toString().toLowerCase()=='a'){matches=element.className.toString().match(/\b(login|logout|register)\b/);if(matches.length>1){if(element.href.toString().match(/return_to=/)){element.href=element.href+'&cancel_to='+window.location.href;}
else{element.href=element.href+'?return_to='+window.location.href;}}}});fixFooter();});var detect=navigator.userAgent.toLowerCase();var OS,browser,version,total,thestring;function getBrowserInfo(){if(checkIt('konqueror')){browser="Konqueror";OS="Linux";}
else if(checkIt('chrome'))browser="Chrome";else if(checkIt('safari'))browser="Safari";else if(checkIt('omniweb'))browser="OmniWeb";else if(checkIt('opera'))browser="Opera";else if(checkIt('webtv'))browser="WebTV";else if(checkIt('icab'))browser="iCab";else if(checkIt('msie'))browser="Internet Explorer";else if(!checkIt('compatible')){browser="Netscape Navigator";version=detect.charAt(8);}
else browser="An unknown browser";if(!version)version=detect.charAt(place+thestring.length);if(!OS){if(checkIt('linux'))OS="Linux";else if(checkIt('x11'))OS="Unix";else if(checkIt('mac'))OS="Mac";else if(checkIt('win'))OS="Windows";else OS="an unknown operating system";}}
function checkIt(string){place=detect.indexOf(string)+1;thestring=string;return place;}
var lightbox=Class.create();lightbox.prototype={yPos:0,xPos:0,can_close:true,autosize:false,image_element:null,initialize:function(ctrl){this.content=ctrl.href;this.short_form=ctrl.hasClassName('lbShort');this.wide_form=ctrl.hasClassName('lbWide');if(ctrl.hasClassName('lbAutoSize')){l.autosizeable();}
Event.observe(ctrl,'click',this.activate.bindAsEventListener(this),false);ctrl.onclick=cancel;},initializeLightbox:function(){if(this.initialized){return;}
this.initialized=true;addLightboxMarkup();},closable:function(can_close){this.can_close=can_close;},autosizeable:function(){this.autosize=true;},activate:function(){this.initializeLightbox();if(!this.lightboxWrapper){this.lightboxWrapper=$('lightboxWrap');}
if(!this.lightbox){this.lightbox=$('lightbox');}
this.lightbox.setStyle({width:"",height:"",marginLeft:"",marginTop:((document.viewport.getHeight()/2)-200)+"px"});if(this.lightboxWrapper.visible()){return this.deactivate(function(){this.activate();}.bind(this));}
if(browser=='Internet Explorer'){this.getScroll();this.prepareIE('100%','hidden');this.setScroll(0,0);this.hideSelects('hidden');}
if(this.short_form){this.lightbox.addClassName('short');}else{this.lightbox.removeClassName('short');}
if(this.wide_form){this.lightbox.addClassName('wide');}else{this.lightbox.removeClassName('wide');}
if(this.css_class){this.lightbox.addClassName(this.css_class);}
this.displayLightbox("block");},loadObservers:function(){Event.observe(document,'keyup',function(event){if(event.keyCode!=null&&event.keyCode==27){this.deactivate();}}.bind(this));document.observe('click',function(event){element_id=event.element().id;if(element_id=='overlay'||element_id=='lightboxWrap'){this.deactivate();}}.bind(this));},unloadObservers:function(){document.stopObserving('keyup');document.stopObserving('click');Event.stopObserving(window,'resize',this._windowResizeChecker);},prepareIESelects:function(state){if(browser=='Internet Explorer'){this.hideSelects(state);}},prepareIE:function(height,overflow){bod=document.getElementsByTagName('body')[0];bod.style.height=height;bod.style.overflow=overflow;htm=document.getElementsByTagName('html')[0];htm.style.height=height;htm.style.overflow=overflow;},hideSelects:function(visibility){var lightbox=$('lbContent');selects=document.getElementsByTagName('select');for(i=0;i<selects.length;i++){if(!lightbox||!$(selects[i]).descendantOf(lightbox)){selects[i].style.visibility=visibility;}}},getScroll:function(){if(self.pageYOffset){this.yPos=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){this.yPos=document.documentElement.scrollTop;}else if(document.body){this.yPos=document.body.scrollTop;}},setScroll:function(x,y){setTimeout('window.scrollTo('+x+', '+y+')',1);},displayLightbox:function(display){if(display=='block'){this.makeAccessible();$('overlay').appear({duration:0.3,from:0.0,to:0.8,queue:{scope:'lightbox',position:'end'}});this.loadInfo();}
else{this.hideLightbox();}
this.loadObservers();},_autoSize:function(){if(this.autosize&&$('lbContent')!=null){wph=document.viewport.getHeight();lbc=$('lbContent');dimensions={width:(lbc.childElements().length>0)?lbc.childElements().first().getWidth():0,height:lbc.getHeight()?lbc.getHeight():(lbc.childElements().length>0)?lbc.childElements().last().getHeight():0};if(dimensions.width>0&&dimensions.height>0){margin=(wph>dimensions.height)?((wph/2)-(dimensions.height/2)):0;this.lightbox.setStyle({width:dimensions.width+"px",height:dimensions.height+"px",marginTop:margin+"px",marginLeft:""});Event.observe(window,'resize',function(){this._windowResizeChecker(dimensions.height);}.bind(this));}}},_windowResizeChecker:function(height){wph=document.viewport.getHeight();this.lightbox.setStyle({marginTop:((wph>height)?((wph/2)-(height/2)):0)+'px'});},hideLightbox:function(callback){new Effect.Parallel([new Effect.Fade('overlay',{sync:true}),new Effect.Fade(this.lightboxWrapper,{sync:true})],{duration:0.3,afterFinish:callback});},loadInfo:function(url){var myAjax=new Ajax.Request(url||this.content,{method:'get',parameters:"lightbox=true",onComplete:this.processResponseInfo.bindAsEventListener(this),evalScripts:true});},resetAndLoad:function(url){if(div=$('lbContent')){div.remove();}
this.lightbox.removeClassName("done");this.loadInfo(url);},processResponseInfo:function(response){this.processInfo(response.responseText);},onInsert:function(){},processInfo:function(response){info=new Element('div',{id:'lbContent'}).update(response);$('lbLoadMessage').insert({before:info});this.onInsert();if(this.autosize&&browser!='Chrome'){this.lightbox.setStyle({marginLeft:"-2000px"});}
this.lightboxWrapper.show();this.lightbox.addClassName("done");this.actions();this.lightboxWrapper.setStyle({top:"0pt"});if(this.autosize){if(this.image_element==null){this.image_element=$("lbContent");}
if(this.image_element.select("img").length>0){img=this.image_element.select("img").first();img.observe("load",function(){this._autoSize();}.bind(this));img.observe("error",function(){this._autoSize();}.bind(this));if(browser=="Internet Explorer"){img.writeAttribute("src",img.readAttribute("src"));img.replace(img);}}else{this._autoSize();}}},actions:function(){lbActions=document.getElementsByClassName('lbAction');for(i=0;i<lbActions.length;i++){Event.observe(lbActions[i],'click',this[lbActions[i].rel].bindAsEventListener(this),false);if(!lbActions[i].hasClassName('lbPersistent')){lbActions[i].onclick=cancel;}}},insert:function(e){link=Event.element(e).parentNode;Element.remove($('lbContent'));var myAjax=new Ajax.Request(link.href,{method:'post',parameters:"",onComplete:this.processResponseInfo.bindAsEventListener(this)});},deactivate:function(extra_action){if(!this.lightboxWrapper.visible()){return;}
if(!this.can_close){return;}
clearTimeout(this.timeout);if(browser=="Internet Explorer"){this.setScroll(0,this.yPos);this.prepareIE("","");this.hideSelects("visible");}
this.hideLightbox(function(){if(obj=$('lbContent')){obj.remove();}
this.lightbox.removeClassName('done');if(this.short_form){this.lightbox.removeClassName('short');}
if(this.css_class){this.lightbox.removeClassName(this.css_class);}
if(typeof extra_action=='function'){extra_action();}}.bind(this));this.unloadObservers();},timelyDeactivate:function(time){time=time*1000||2500
if(!this.lightbox.visible()){clearTimeout(this.timeout);}
else{this.timeout=setTimeout(function(){this.deactivate();}.bind(this),time);}},makeAccessible:function(){window._lightbox=this;}}
function findLightboxTriggers(){$$('.lbOn').each(function(trigger){var l=new lightbox(trigger);trigger.removeClassName('lbOn');});$$('.lbAlert').each(function(trigger){var l=new AlertBox(trigger);trigger.removeClassName('lbAlert');});}
function addLightboxMarkup(){overlay=new Element('div',{'id':'overlay'}).setStyle({display:'none'});lb=new Element('div',{'id':'lightbox',className:'loading'});wrapper=new Element('div',{'id':'lightboxWrap'}).setStyle({display:'none'});wrapper.addClassName($('body').className.toString().match(/(il_[a-z_-]+)/)[1]);wrapper.insert({top:lb});lb.insert({top:'<div id="lbLoadMessage"></div>'});lb.insert({bottom:'<a onclick="window._lightbox.deactivate();return false;" href="#" class="close"><img src="'+assetHost.asset_src('/images/icons/close_3f6a.gif')+'" alt="Close"/></a>'});bod=document.getElementsByTagName('body')[0];bod.appendChild(overlay);bod.appendChild(wrapper);}
var GalleryLightbox=Class.create(lightbox);GalleryLightbox.addMethods({initialize:function($super,images){this.lightbox=$('lightbox');this.gallery=new ImageGallery(images,this);this.images_array=images;},onInsert:function(){this.image_element=$("gallery_image");},loadInfo:function(){this.processInfo(this.gallery.getContent());this._autoSize();},deactivate:function($super){this.gallery.destroy();this.gallery=null;$super();},_windowResizeChecker:function(height){this.original_image=$("original_img");wph=document.viewport.getHeight()-30;this.lightbox.setStyle({height:wph+"px",marginTop:'5px'});this.image_element.setStyle({height:wph+"px",lineHeight:wph+"px"});this.original_image.setStyle({maxHeight:(wph-14)+"px"});},_autoSize:function(){if(this.autosize&&$('lbContent')!=null){this.original_image=$("original_img");wph=document.viewport.getHeight()-30;lbc=$('lbContent');mh=this.images_array.length*60;dimensions={width:(lbc.childElements().length>0)?lbc.childElements().first().getWidth():0,height:wph};if(dimensions.width>0&&dimensions.height>0){this.lightbox.setStyle({width:dimensions.width+"px",height:dimensions.height+"px",marginTop:"5px",marginLeft:"",minHeight:mh+"px"});this.image_element.setStyle({height:wph+"px",lineHeight:wph+"px"});this.original_image.setStyle({maxHeight:(wph-14)+"px"});Event.observe(window,'resize',function(){this._windowResizeChecker(dimensions.height);}.bind(this));}}}});var ManualLightbox=Class.create(lightbox);ManualLightbox.addMethods({initialize:function($super){this.lightbox=$('lightbox');},loadInfo:function(){this.processInfo(this.content_method());},activate:function($super,content_method,options){this.short_form=options.short||false;this.wide_form=options.wide||false;this.css_class=options.css_class||'';this.content_method=content_method;$super();},closeBehaviour:function(options){var close=this.lightbox.down('a.close');$H(options).each(function(e){close[e.key]=e.value;});}});var AlertBox=Class.create(lightbox);AlertBox.addMethods({afterClose:function(){$('overlay').removeClassName('alert_box');$('lightbox').removeClassName('alert_box');var reload=$('lightbox').hasClassName('login');if(reload){window.location.reload();}},displayLightbox:function($super,display){if(display=='block'){$('overlay').addClassName('alert_box');$('lightbox').addClassName('alert_box');$super(display);}
else{this.hideLightbox(this.afterClose);}},deactivate:function($super){$super(this.afterClose);}});function loadCommunitiesHelper(){var CommunityHelperLightbox=Class.create(lightbox);CommunityHelperLightbox.addMethods({initialize:function(){this.lightbox=$('communities_helper').remove();$$('body').first().insert({bottom:this.lightbox});lightbox_width=this.lightbox.getWidth();image=$('header').select('.header_link').first().cumulativeOffset();text=$('header').select('.header_location').first();text_width=text.getWidth();total=text.cumulativeOffset()[0]+text_width;left=total-lightbox_width;arrow=text.select('a.communities').first();if(!arrow){return;}
arrow_position=arrow.cumulativeOffset()[0]-left-3;this.lightbox.setStyle({'backgroundPosition':arrow_position+'px 0px',top:image[1]+63+'px',left:left+'px'});},loadInfo:function(){this.actions();}});setTimeout(function(){helper=new CommunityHelperLightbox();helper.activate();},100);}
var ImageGallery=Class.create();ImageGallery.prototype={_raw_images:null,_content_area:null,gallery_manager:null,original_image:null,_prev_original:null,_lightbox:null,initialize:function(images,lightbox){this._raw_images=images;this._lightbox=lightbox;},_prepareObjects:function(){this.gallery_manager=new GalleryManager(this,this._raw_images);},_getGalleryThumbnails:function(){el=new Element("div",{id:"gallery_thumbnails"});images=this.gallery_manager.getAll();for(var i=0;i<images.length;i++){el.insert({bottom:images[i].getThumbnail()});}
return el;},showOriginalImage:function(img){if(img!=null){if(this.original_image==null){this.original_image=new Element("div",{id:"gallery_image"});}
orig=img.getOriginal();if(orig!=this._prev_original){this.original_image.update(orig);this.original_image.blur();this._prev_original=orig;}
this._lightbox._autoSize();return this.original_image;}},_getContentArea:function(){this._content_area=new Element("div",{id:"gallery"});this._content_area.update(this._getGalleryThumbnails());this._content_area.insert({bottom:this.showOriginalImage(this.gallery_manager.getCurrent())});return this._content_area;},getContent:function(){this._prepareObjects();return this._getContentArea();},destroy:function(){$("gallery_thumbnails").update("").remove();this._content_area.update("").remove();}}
var GalleryManager=Class.create();GalleryManager.prototype={images:[],_pos:0,_gallery:null,initialize:function(gallery,imgs){this._gallery=gallery;this.images=[];for(var i=0;i<imgs.length;i++){gi=new GalleryItem(this,imgs[i],i);this.images.push(gi);}},getAll:function(){return this.images;},getNext:function(){if(this._pos>=this.images.length-1){this.setPos(0);}else{this.setPos(this._pos+1);}
this._setThumbnailBorder();return this.images[this._pos];},getPrev:function(){if(this._pos>0){this.setPos(this._pos-1);this._setThumbnailBorder();return this.images[this._pos];}},getCurrent:function(){return this.images[this._pos];},setPos:function(pos){if(pos>=0&&pos<this.images.length){this._pos=pos;}},thumbnailCallback:function(event,image){this.setPos(image.pos);this._gallery.showOriginalImage(image);this._setThumbnailBorder();cancel(event);},originalCallback:function(event,image){next=this.getNext();if(next!=null){this._gallery.showOriginalImage(next);}
cancel(event);},_setThumbnailBorder:function(){for(var i=0;i<this.images.length;i++){this.images[i].removeBorder();}
this.images[this._pos].setBorder();},destroy:function(){for(var i=0;i<this.images.length;i++){this.images[i].destroy();}
this.images=[];}}
var GalleryItem=Class.create();GalleryItem.prototype={_item:null,_gallery_manager:null,pos:null,original:null,thumbnail:null,initialize:function(manager,item,pos){this._gallery_manager=manager;this._item=item;this.pos=pos;this._createThumbnail();this._createOriginal();},_getThumbnailURL:function(){return this._item.gsub(/\.jpg/,'s.jpg');},_getOriginalURL:function(){return this._item.gsub(/\.jpg/,'so.jpg');},_createThumbnail:function(){this.thumbnail=new Element("a",{href:"#",className:"gallery_thumbnail"});this.thumbnail.insert({top:new Element("img",{src:this._getThumbnailURL()})});this._attachThumbnailCallback();},_createOriginal:function(skip_callback){this.original=new Element("a",{href:"#",className:"original_img"});this.original.insert({top:new Element("img",{src:this._getOriginalURL(),id:"original_img"})});this.original.insert({top:new Element("span")});if(skip_callback==null){this._attachOriginalCallback(this.original);}
return this.original;},setBorder:function(){this.thumbnail.blur();this.thumbnail.setStyle({border:"1px solid #ccc"});},removeBorder:function(){this.thumbnail.setStyle({border:"1px solid #fff"});},_attachThumbnailCallback:function(){this.thumbnail.observe("click",function(event){this._gallery_manager.thumbnailCallback(event,this)}.bindAsEventListener(this));},_attachOriginalCallback:function(){this.original.observe("click",function(event){this._gallery_manager.originalCallback(event,this)}.bindAsEventListener(this));},getThumbnail:function(){return this.thumbnail;},getOriginal:function(){if(this.original.innerHTML==""){return this._createOriginal();}
return this.original;},destroy:function(){this._item=null;this._gallery_manager=null;this.pos=null;this.original=null;this.thumbnail=null;}}
MagicLinker.addSystem(function(){getBrowserInfo();findLightboxTriggers();});MagicLinker.addSystem(function(){var timezone_field=$('original_timezone');if(timezone_field){timezone_field.value=(new Date()).getTimezoneOffset()*(-1);}});(function(){var day=24*60*60*1000;var zeroPad=function(number,digits){number=String(number);while(number.length<digits)number='0'+number;return number;};var multipliers={millisecond:1,second:1000,minute:60*1000,hour:60*60*1000,day:day,week:7*day,month:{add:function(d,number){multipliers.year.add(d,Math[number>0?'floor':'ceil'](number/12));var prevMonth=d.getMonth()+(number%12);if(prevMonth==12){prevMonth=0;d.setYear(d.getFullYear()+1);}else if(prevMonth==-1){prevMonth=11;d.setYear(d.getFullYear()-1);}
d.setMonth(prevMonth);},diff:function(d1,d2){var diffYears=d1.getFullYear()-d2.getFullYear();var diffMonths=d1.getMonth()-d2.getMonth()+(diffYears*12);var diffDays=d1.getDate()-d2.getDate();return diffMonths+(diffDays/30);}},year:{add:function(d,number){d.setYear(d.getFullYear()+Math[number>0?'floor':'ceil'](number));},diff:function(d1,d2){return multipliers.month.diff(d1,d2)/12;}}};for(var unit in multipliers){if(unit.substring(unit.length-1)!='s'){multipliers[unit+'s']=multipliers[unit];}}
var format=function(d,code){if(Date.prototype.strftime.formatShortcuts[code]){return d.strftime(Date.prototype.strftime.formatShortcuts[code]);}else{var getter=(Date.prototype.strftime.formatCodes[code]||'').split('.');var nbr=d['get'+getter[0]]?d['get'+getter[0]]():'';if(getter[1])nbr=zeroPad(nbr,getter[1]);return nbr;}};var instanceMethods={succ:function(unit){return this.clone().add(1,unit);},add:function(number,unit){var factor=multipliers[unit]||multipliers.day;if(typeof factor=='number'){this.setTime(this.getTime()+(factor*number));}else{factor.add(this,number);}
return this;},diff:function(dateObj,unit,allowDecimal){dateObj=Date.create(dateObj);if(dateObj===null)return null;var factor=multipliers[unit]||multipliers.day;if(typeof factor=='number'){var unitDiff=(this.getTime()-dateObj.getTime())/factor;}else{var unitDiff=factor.diff(this,dateObj);}
return(allowDecimal?unitDiff:Math[unitDiff>0?'floor':'ceil'](unitDiff));},strftime:function(formatStr){var source=formatStr||'%Y-%m-%d',result='',match;while(source.length>0){if(match=source.match(Date.prototype.strftime.formatCodes.matcher)){result+=source.slice(0,match.index);result+=(match[1]||'')+format(this,match[2]);source=source.slice(match.index+match[0].length);}else{result+=source,source='';}}
return result;},getShortYear:function(){return this.getYear()%100;},getMonthNumber:function(){return this.getMonth()+1;},getMonthName:function(){return Date.MONTHNAMES[this.getMonth()];},getAbbrMonthName:function(){localeNames=Date.ABBR_MONTHNAMES[I18n.locale]||Date.ABBR_MONTHNAMES['en'];return localeNames[this.getMonth()];},getDayName:function(){return Date.DAYNAMES[this.getDay()];},getAbbrDayName:function(){return Date.ABBR_DAYNAMES[this.getDay()];},getDayOrdinal:function(){return Date.ORDINALNAMES[this.getDate()%10];},getHours12:function(){var hours=this.getHours();return hours>12?hours-12:(hours==0?12:hours);},getAmPm:function(){return this.getHours()>=12?'PM':'AM';},getUnix:function(){return Math.round(this.getTime()/1000,0);},getGmtOffset:function(){var hours=this.getTimezoneOffset()/60;var prefix=hours<0?'+':'-';hours=Math.abs(hours);return prefix+zeroPad(Math.floor(hours),2)+':'+zeroPad((hours%1)*60,2);},getTimezoneName:function(){var match=/(?:\((.+)\)$| ([A-Z]{3}) )/.exec(this.toString());return match[1]||match[2]||'GMT'+this.getGmtOffset();},toYmdInt:function(){return(this.getFullYear()*10000)+(this.getMonthNumber()*100)+this.getDate();},clone:function(){return new Date(this.getTime());}};for(var name in instanceMethods)Date.prototype[name]=instanceMethods[name];var staticMethods={create:function(date){if(date instanceof Date)return date;if(typeof date=='number')return new Date(date*1000);var parsable=String(date).replace(/^\s*(.+)\s*$/,'$1'),i=0,length=Date.create.patterns.length,pattern;var current=parsable;while(i<length){ms=Date.parse(current);if(!isNaN(ms))return new Date(ms);pattern=Date.create.patterns[i];if(typeof pattern=='function'){obj=pattern(current);if(obj instanceof Date)return obj;}else{current=parsable.replace(pattern[0],pattern[1]);}
i++;}
return NaN;},ABBR_MONTHNAMES:{'en':['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],'es':['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sept','Oct','Nov','Dic'],'de':['Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'],'br':['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],'bs':['Jan','Feb','Mar','Apr','Мaj','Jun','Јul','Avg','Sep','Okt','Nov','Dec'],'cz':['Led','Úno','Bře','Dub','Kvě','Čvn','Čvc','Srp','Zář','Říj','Lis','Pro'],'da':['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'],'ee':['Jaan','Veebr','Märts','Apr','Mai','Juuni','Juuli','Aug','Sept','Okt','Nov','Dets'],'el':['Ιαν','Φεβ','Μάρ','Απρ','Μαι','Ιουν','Ιούλ','Αυγ','Σεπ','Οκτ','Νοε','Δεκ'],'fi':['Tammi','Helmi','Maalis','Huhti','Touko','Kesä','Heinä','Elo','Syys','Loka','Marras','Joulu'],'fr':['Jan','Fév','Mar','Avr','Mai','Juin','Juil','Août','Sept','Oct','Nov','Déc'],'hu':['Jan','Febr','Márc','Ápr','Máj','Jún','Júl','Aug','Szept','Okt','Nov','Dec'],'id':['Jan','Feb','Mar','Apr','Mei','Jun','Jul','Agu','Sep','Okt','Nov','Des'],'it':['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'],'ja':['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],'lt':['Sau','Vas','Kov','Bal','Geg','Bir','Lie','Rgp','Rgs','Spa','Lap','Grd'],'mk':['Јан','Фев','Мар','Апр','Мај','Јун','Јул','Авг','Сеп','Окт','Ное','Дек'],'nl':['Jan','Feb','Mrt','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Dec'],'pl':['Sty','Lut','Mar','Kwi','Maj','Cze','Lip','Sie','Wrz','Paź','Lis','Gru'],'pt':['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],'ro':['Ian','Feb','Mar','Apr','Mai','Iun','Iul','Aug','Sep','Oct','Noi','Dec'],'ru':['Янв','Февр','Марта','Апр','Мая','Июня','Июля','Авг','Сент','Окт','Нояб','Дек'],'sr':['Јан','Феб','Мар','Апр','Мај','Јун','Јул','Авг','Сеп','Окт','Нов','Дец'],'tr':['Oca','Şub','Mar','Nis','May','Haz','Tem','Ağu','Eyl','Eki','Kas','Ara'],'vi':["Tháng một","Tháng hai","Tháng ba","Tháng tư","Tháng năm","Tháng sáu","Tháng bảy","Tháng tám","Tháng chín","Tháng mười","Tháng mười một","Tháng mười hai"]},MONTHNAMES:'January February March April May June July August September October November December'.split(' '),DAYNAMES:'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'.split(' '),ABBR_DAYNAMES:'Sun Mon Tue Wed Thu Fri Sat'.split(' '),ORDINALNAMES:'th st nd rd th th th th th th'.split(' '),ISO:'%Y-%m-%dT%H:%M:%S.%N%G',SQL:'%Y-%m-%d %H:%M:%S',daysInMonth:function(year,month){if(month==2)
return new Date(year,1,29).getDate()==29?29:28;return[undefined,31,undefined,31,30,31,30,31,31,30,31,30,31][month];}};for(var name in staticMethods)Date[name]=staticMethods[name];Date.prototype.strftime.formatCodes={matcher:/()%(#?(%|[a-z]))/i,Y:'FullYear',y:'ShortYear.2',m:'MonthNumber.2','#m':'MonthNumber',B:'MonthName',b:'AbbrMonthName',d:'Date.2','#d':'Date',e:'Date',A:'DayName',a:'AbbrDayName',w:'Day',o:'DayOrdinal',H:'Hours.2','#H':'Hours',I:'Hours12.2','#I':'Hours12',p:'AmPm',M:'Minutes.2','#M':'Minutes',S:'Seconds.2','#S':'Seconds',s:'Unix',N:'Milliseconds.3','#N':'Milliseconds',O:'TimezoneOffset',Z:'TimezoneName',G:'GmtOffset'};Date.prototype.strftime.formatShortcuts={F:'%Y-%m-%d',T:'%H:%M:%S',X:'%H:%M:%S',x:'%m/%d/%y',D:'%m/%d/%y','#c':'%a %b %e %H:%M:%S %Y',v:'%e-%b-%Y',R:'%H:%M',r:'%I:%M:%S %p',t:'\t',n:'\n','%':'%'};Date.create.patterns=[[/-/g,'/'],[/st|nd|rd|th/g,''],[/(3[01]|[0-2]\d)\s*\.\s*(1[0-2]|0\d)\s*\.\s*([1-9]\d{3})/,'$2/$1/$3'],[/([1-9]\d{3})\s*-\s*(1[0-2]|0\d)\s*-\s*(3[01]|[0-2]\d)/,'$2/$3/$1'],function(str){var match=str.match(/^(?:(.+)\s+)?([1-9]|1[012])(?:\s*\:\s*(\d\d))?(?:\s*\:\s*(\d\d))?\s*(am|pm)\s*$/i);if(match){if(match[1]){var d=Date.create(match[1]);if(isNaN(d))return;}else{var d=new Date();d.setMilliseconds(0);}
var hour=parseFloat(match[2]);hour=match[5].toLowerCase()=='am'?(hour==12?0:hour):(hour==12?12:hour+12);d.setHours(hour,parseFloat(match[3]||0),parseFloat(match[4]||0));return d;}}];})();var $D=Date.create;var AssetHost=Class.create({initialize:function(server){this.server=server},asset_src:function(src){return this.server+src}});var assetHost=new AssetHost('http://aws.just-landed.com');I18nStrings={"it":{"common":{"popular_areas":"Zone piu viste","select_image":"Seleziona immagine","company_number":"Numero compagnia","add_to_favourites":"Aggiungi ai favoriti","remove_from_favourites":"Rimuovere dai favoriti","company_name":"Nome compagnia","and":"e","profession":"Professione","convert_to_another_currency":"Convertire in un'altra valuta","add_language":"Aggiungi una lingua","remove":"rimuovi","cif_nif":"CIF/NIF","not_available":"Non disponibile","vat_number":"Numero","please_confirm_deletion":"Sei sicuro di volere cancellare questo annuncio?","error_message":"Errore","loading":"Caricamento in corso"},"jobs.cv":{"select_cv":"Seleziona un file per il tuo CV"},"classifieds.browse":{"moved_post":"Il post che vuolevi \u00e8 stato mosso. Cerchiamo di trovarlo per te"},"errors.standard.cookies_needed_exception":{"text":"Perfavore attiva i cookies per approfitare delle funzionalit\u00e0 complete"},"common.maps":{"refresh_map":"Aggiornare mappa","center_marker":"Centrare cursore","hide_map":"Nascondere mappa","preview_map":"anteprima della mappa","wrong_marker_place":"Non nel punto giusto? Sposta mi!"},"common.message":{"decimals_not_allowed":"Prezzo modificato, riprovare: impossibile utilizzare decimali","change_on_new_language":"Cambia la lingua del tuo conto a {{language}}"}},"ja":{"common":{"popular_areas":"Popular areas","select_image":"\u30a4\u30e1\u30fc\u30b8\u3092\u9078\u629e\u3059\u308b\u3002","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\u3068","profession":"\u8077\u696d","convert_to_another_currency":"Convert to another currency","add_language":"\u8a00\u8a9e\u3092\u8ffd\u52a0\u3059\u308b","remove":"\u524a\u9664","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\u30ed\u30fc\u30c7\u30a3\u30f3\u30b0"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"\u5730\u56f3\u30d7\u30ec\u30d3\u30e5\u30fc","wrong_marker_place":"Not in the right place? Drag me!"}},"no":{"common":{"popular_areas":"Popular areas","select_image":"Velg bilde","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"og","profession":"Yrke","convert_to_another_currency":"Convert to another currency","add_language":"Legg til et spr\u00e5k","remove":"slett","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"Laster"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"forh\u00e5ndsvis kart","wrong_marker_place":"Not in the right place? Drag me!"}},"fr":{"common":{"popular_areas":"Endroit populaire","select_image":"Choisissez une image","company_number":"Num\u00e9ro de la compagnie","add_to_favourites":"Ajouter \u00e0 favori","remove_from_favourites":"Supprimer de mes favoris","company_name":"Nom entreprise","and":"et","profession":"Profession","convert_to_another_currency":"Convertir \u00e1 une autre devise","add_language":"Ajouter une autre langue","remove":"supprimer","cif_nif":"CIF/NIF","not_available":"Pas disponible","vat_number":"Num\u00e9ro de TVA UE","please_confirm_deletion":"\u00cates-vous s\u00fbr(e) de vouloir supprimer cette annonce?","error_message":"Erreur","loading":"Chargement"},"jobs.cv":{"select_cv":"S\u00e9lectionner un fichier pour votre CV"},"classifieds.browse":{"moved_post":"Le poste que vous vouliez a chang\u00e9 de direction. Nous essayons de vous le trouver. "},"errors.standard.cookies_needed_exception":{"text":"S'il vous plait activez les cookies pour profiter des fonctionnalit\u00e9s compl\u00eates. "},"common.maps":{"refresh_map":"Actualiser carte","center_marker":"Centrer le pointeur","hide_map":"Cacher carte","preview_map":"visionner la carte","wrong_marker_place":"Pas au bonne endroit? D\u00e9placez-moi!"},"common.message":{"decimals_not_allowed":"Prix modifi\u00e9, v\u00e9rifiez-le: les d\u00e9cimaux ne sont pas permis","change_on_new_language":"Changer la langue du compte \u00e0 {{language}}"}},"de":{"common":{"popular_areas":"Popul\u00e4re Regionen","select_image":"Bild w\u00e4hlen","company_number":"Firmennummer","add_to_favourites":"Zu Favoriten hinzuf\u00fcgen","remove_from_favourites":"Aus Favoriten entfernen","company_name":"Firmenname","and":"und","profession":"Beruf","convert_to_another_currency":"In andere W\u00e4hrung umrechnen","add_language":"Sprache hinzuf\u00fcgen","remove":"Entfernen","cif_nif":"CIF/NIF","not_available":"Nicht verf\u00fcgbar","vat_number":"EU MwSt-Nummer","please_confirm_deletion":"Bitte best\u00e4tigen Sie die L\u00f6schung","error_message":"Fehler","loading":"Laden"},"jobs.cv":{"select_cv":"W\u00e4hlen Sie eine Datei f\u00fcr Ihren Lebenslauf aus"},"classifieds.browse":{"moved_post":"Die gesuchte Anzeige wurde umgestellt. Wir versuchen sie zu finden"},"errors.standard.cookies_needed_exception":{"text":"Bitte aktivierten Sie Cookies in Ihrem Browser um die volle Funktionalit\u00e4t der Seite zu erm\u00f6glichen"},"common.maps":{"refresh_map":"Karte neu laden","center_marker":"Zentrierungsmarkierung","hide_map":"Karte nicht zeigen","preview_map":"Vorschau der Karte","wrong_marker_place":"Nicht am richtigen Ort? Ziehe mich"},"common.message":{"decimals_not_allowed":"Preis ge\u00e4ndert, bitte kontrollieren Sie Feld: Dezimalstellen sind nicht erlaubt","change_on_new_language":"\u00c4ndern Sie Ihre Account-Sprache zu {{language}}"}},"ta":{"common":{"popular_areas":"Popular areas","select_image":"\u0baa\u0b9f\u0ba4\u0bcd\u0ba4\u0bc8  \u0ba4\u0bc7\u0bb0\u0bcd\u0bb5\u0bc1 \u0b9a\u0bc6\u0baf\u0bcd\u0baf\u0bc1\u0b99\u0bcd\u0b95\u0bb3\u0bcd","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\u0bae\u0bb1\u0bcd\u0bb1\u0bc1\u0bae\u0bcd","profession":"\u0ba4\u0bca\u0bb4\u0bbf\u0bb2\u0bcd","convert_to_another_currency":"Convert to another currency","add_language":"\u0b92\u0bb0\u0bc1 \u0bae\u0bca\u0bb4\u0bbf\u0baf\u0bc8   \u0b9a\u0bc7\u0bb0\u0bcd\u0b95\u0bcd\u0b95\u0bb5\u0bc1\u0bae\u0bcd","remove":"\u0ba8\u0bc0\u0b95\u0bcd\u0b95\u0bb5\u0bc1\u0bae\u0bcd","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"loading"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"\u0b9a\u0bcb\u0ba4\u0ba9\u0bc8  \u0bb5\u0bb0\u0bc8 \u0baa\u0b9f\u0bae\u0bcd","wrong_marker_place":"Not in the right place? Drag me!"}},"sk":{"common":{"popular_areas":"Popular areas","select_image":"Vo\u013eba obrazu","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"a","profession":"Profesia","convert_to_another_currency":"Convert to another currency","add_language":"Prida\u0165 jazyk","remove":"Odstr\u00e1ni\u0165","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"Na\u010d\u00edtava sa"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"uk\u00e1\u017eka mapy","wrong_marker_place":"Not in the right place? Drag me!"}},"hu":{"common":{"popular_areas":"Popular areas","select_image":"V\u00e1lassz k\u00e9pet","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\u00e9s","profession":"Foglalkoz\u00e1s","convert_to_another_currency":"Convert to another currency","add_language":"\u00daj nyelv hozz\u00e1ad\u00e1sa","remove":"elmozd\u00edt","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"t\u00f6lt\u00e9s"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"t\u00e9rk\u00e9p megtekint\u00e9se","wrong_marker_place":"Not in the right place? Drag me!"}},"zh":{"common":{"popular_areas":"Popular areas","select_image":"\u9009\u62e9\u56fe\u50cf ","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\u548c","profession":"\u804c\u4e1a","convert_to_another_currency":"Convert to another currency","add_language":"\u6dfb\u52a0\u8bed\u8a00","remove":"\u5220\u9664","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\u8f7d\u5165\u4e2d"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"\u524d\u4e00\u5e45\u5730\u56fe","wrong_marker_place":"Not in the right place? Drag me!"}},"gu":{"common":{"popular_areas":"Popular areas","select_image":"\u0aa4\u0ab8\u0acd\u0ab5\u0ac0\u0ab0 \u0aaa\u0ab8\u0a82\u0aa6 \u0a95\u0ab0\u0acb\n","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\u0a85\u0aa8\u0ac7\n","profession":"\u0ab5\u0acd\u0aaf\u0ab5\u0ab8\u0abe\u0aaf\n","convert_to_another_currency":"Convert to another currency","add_language":"\u0aad\u0abe\u0ab7\u0abe \u0a89\u0aae\u0ac7\u0ab0\u0acb\n","remove":"\u0aa6\u0ac2\u0ab0 \u0a95\u0ab0\u0acb\n","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\u0ab2\u0acb\u0aa1 \u0aa5\u0a88 \u0ab0\u0ab9\u0acd\u0aaf\u0ac1\u0a82 \u0a9b\u0ac7...\n"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"\u0aaa\u0acd\u0ab0\u0abf\u0ab5\u0acd\u0aaf\u0ac2 \u0aae\u0ac5\u0aaa\n","wrong_marker_place":"Not in the right place? Drag me!"}},"sv":{"common":{"popular_areas":"Popular areas","select_image":"V\u00e4lj bild","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"och","profession":"Yrke","convert_to_another_currency":"Convert to another currency","add_language":"L\u00e4gg till ett spr\u00e5k","remove":"ta bort","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\t\nLaddar"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"preview map ","wrong_marker_place":"Not in the right place? Drag me!"}},"fi":{"common":{"popular_areas":"Popular areas","select_image":"Valitse kuva","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"ja","profession":"Ammatti","convert_to_another_currency":"Convert to another currency","add_language":"Lis\u00e4\u00e4 kieli","remove":"poista","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"Lataa"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"tarkastele karttaa","wrong_marker_place":"Not in the right place? Drag me!"}},"ru":{"common":{"popular_areas":"Popular areas","select_image":"\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\u0438","profession":"\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f","convert_to_another_currency":"Convert to another currency","add_language":"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044f\u0437\u044b\u043a","remove":"\u0423\u0434\u0430\u043b\u0438\u0442\u044c","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\u0418\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"\u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u043a\u0430\u0440\u0442\u044b","wrong_marker_place":"Not in the right place? Drag me!"}},"es":{"common":{"popular_areas":"\u00c1reas populares","select_image":"Elegir imagen","company_number":"N\u00famero de la empresa","add_to_favourites":"A\u00f1adir a favoritos","remove_from_favourites":"Eliminar de favoritos","company_name":"Nombre de la empresa","and":"y","profession":"Profesi\u00f3n","convert_to_another_currency":"Convertir a otra moneda","add_language":"A\u00f1adir un idioma","remove":"eliminar","cif_nif":"CIF/NIF","not_available":"No disponible","vat_number":"N\u00famero de IVA de la UE","please_confirm_deletion":"Est\u00e1s seguro que desea eliminar este anuncio?","error_message":"Error","loading":"Cargando"},"jobs.cv":{"select_cv":"Seleccione el archivo de su CV"},"classifieds.browse":{"moved_post":"El anuncio que buscas ha cambiado de sitio. Estamos intentando buscarlo para t\u00ed"},"errors.standard.cookies_needed_exception":{"text":"Tienes que habilitar las cookies para poder usar esta parte de la p\u00e1gina"},"common.maps":{"refresh_map":"Actualizar el mapa","center_marker":"Centrar marcador","hide_map":"Ocultar el mapa","preview_map":"Vista previa","wrong_marker_place":"\u00bfMal ubicado? Arrastra el marcador!"},"common.message":{"decimals_not_allowed":"Precio modificado, por favor revisar el campo: decimales no permitidos","change_on_new_language":"Cambia tu idioma principal a {{language}}"}},"ko":{"common":{"popular_areas":"Popular areas","select_image":"\uc774\ubbf8\uc9c0 \uc120\ud0dd","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\ubc0f","profession":"\uc9c1\uc5c5","convert_to_another_currency":"Convert to another currency","add_language":"\uc5b8\uc5b4 \ucd94\uac00","remove":"\uc81c\uac70\ud558\ub2e4","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\ub85c\ub529\uc911"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"\uc9c0\ub3c4 \ubbf8\ub9ac\ubcf4\uae30","wrong_marker_place":"Not in the right place? Drag me!"}},"pt":{"common":{"popular_areas":"Popular areas","select_image":"Selecionar imagem","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"and","profession":"Profession","convert_to_another_currency":"Convert to another currency","add_language":"Adicione um idioma","remove":"remover","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Tem certeza de que deseja remover este an\u00fancio?","error_message":"Error","loading":"A Carregar"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"preview","wrong_marker_place":"Not in the right place? Drag me!"}},"et":{"common":{"popular_areas":"Popular areas","select_image":"Vali kuvand","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"ja","profession":"Amet","convert_to_another_currency":"Convert to another currency","add_language":"Lisa keel","remove":"Eemalda","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"Laen"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"kaardi eelvaade","wrong_marker_place":"Not in the right place? Drag me!"}},"fa":{"common":{"popular_areas":"\u0645\u0646\u0627\u0637\u0642 \u067e\u0631\u0637\u0631\u0641\u062f\u0627\u0631","select_image":"\u0639\u06a9\u0633 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f","company_number":"Company Number","add_to_favourites":"\u0622\u06cc\u062a\u0645 \u0631\u0627 \u0628\u0647 \u0639\u0644\u0627\u0642\u0647 \u0645\u0646\u062f\u06cc \u0647\u0627\u06cc \u0645\u0646 \u0627\u0636\u0627\u0641\u0647 \u06a9\u0646","remove_from_favourites":"\u062d\u0630\u0641 \u0622\u06cc\u062a\u0645 \u0627\u0632 \u0639\u0644\u0627\u0642\u0647 \u0645\u0646\u062f\u06cc \u0647\u0627\u06cc \u0645\u0646","company_name":"Company Name","and":"\u0648","profession":"\u062d\u0631\u0641\u0647","convert_to_another_currency":"Convert to another currency","add_language":" \u0627\u0636\u0627\u0641\u0647 \u06a9\u0631\u062f\u0646 \u0632\u0628\u0627\u0646","remove":"\u062d\u0630\u0641","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":" \u0628\u0627\u0631\u06af\u0632\u0627\u0631\u06cc"},"classifieds.browse":{"moved_post":"\u067e\u0633\u062a \u0645\u0648\u0631\u062f \u0646\u0638\u0631 \u0634\u0645\u0627 \u062c\u0627\u0628\u062c\u0627 \u0634\u062f\u0647 \u0627\u0633\u062a. \u062f\u0631 \u062d\u0627\u0644 \u062a\u0644\u0627\u0634 \u0647\u0633\u062a\u06cc\u0645 \u062a\u0627 \u0622\u0646 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0634\u0645\u0627 \u0628\u06cc\u0627\u0628\u06cc\u0645"},"errors.standard.cookies_needed_exception":{"text":"\u0628\u0631\u0627\u06cc \u0644\u0630\u062a \u0628\u0631\u062f\u0646 \u0627\u0632 \u062a\u0645\u0627\u0645 \u0639\u0645\u0644\u06a9\u0631\u062f\u0647\u0627\u060c \u0644\u0637\u0641\u0627 \u06a9\u0648\u06a9\u06cc\u0632 \u0631\u0627 \u0641\u0639\u0627\u0644 \u06a9\u0646\u06cc\u062f.\n"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"\u0646\u0642\u0634\u0647 \u067e\u06cc\u0634 \u0646\u0645\u0627\u06cc\u0634","wrong_marker_place":"Not in the right place? Drag me!"}},"br":{"common":{"popular_areas":"Popular areas","select_image":"Selecionar imagem","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"e","profession":"Profissao","convert_to_another_currency":"Convert to another currency","add_language":"Adicione um idioma","remove":"remover","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"Carregando"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"apresenta\u00e7\u00e3o no mapa","wrong_marker_place":"Not in the right place? Drag me!"}},"id":{"common":{"popular_areas":"Area populer","select_image":"Pilih gambar","company_number":"Nomor Perusahaan","add_to_favourites":"Tambahkan ke favorit","remove_from_favourites":"Hilangkan dari favorit","company_name":"Nama Perusahaan","and":"dan","profession":"Profesi","convert_to_another_currency":"Convert to another currency","add_language":"Tambah bahasa","remove":"hilangkan","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Tolong konfirmasi penghapusan","error_message":"Error","loading":"Mengunggah"},"classifieds.browse":{"moved_post":"Posting yang Anda inginkan telah dipindahkan. Kami sedang mencarinya buat Anda"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Sembunyikan peta","preview_map":"Pratayang peta","wrong_marker_place":"Not in the right place? Drag me!"}},"ar":{"common":{"popular_areas":"Popular areas","select_image":"\u0627\u062e\u062a\u0631 \u0635\u0648\u0631\u0629","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\u0648","profession":"\u0627\u0644\u0645\u0647\u0646\u0629","convert_to_another_currency":"Convert to another currency","add_language":"\u0625\u0636\u0627\u0641\u0629 \u0644\u063a\u0629","remove":"\u062d\u0630\u0641","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\u062c\u0627\u0631\u064a \u062a\u062d\u0645\u064a\u0644"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"\u0627\u0633\u062a\u0639\u0631\u0636 \u0627\u0644\u062e\u0631\u064a\u0637\u0629","wrong_marker_place":"Not in the right place? Drag me!"}},"pl":{"common":{"popular_areas":"Popularne miejsca","select_image":"Wybierz obrazek","company_number":"Numer firmy","add_to_favourites":"Dodaj do ulubionych","remove_from_favourites":"Usu\u0144 z ulubionych","company_name":"Nazwa firmy","and":"i","profession":"Zaj\u0119cie","convert_to_another_currency":"Convert to another currency","add_language":"Dodaj j\u0119zyk","remove":"Usu\u0144","cif_nif":"CIF/NIF ","not_available":"Not available","vat_number":"Numer VAT","please_confirm_deletion":"Czy na pewno chcesz usun\u0105\u0107 to og\u0142oszenie?","error_message":"B\u0142\u0105d","loading":"\u0141adowanie"},"jobs.cv":{"select_cv":"Do\u0142\u0105cz swoje CV"},"classifieds.browse":{"moved_post":"Og\u0142oszenie kt\u00f3rego szukasz, zosta\u0142o przeniesione. Staramy si\u0119 je znale\u017a\u0107"},"errors.standard.cookies_needed_exception":{"text":"W\u0142\u0105cz obs\u0142ug\u0119 cookies, aby cieszy\u0107 si\u0119 pe\u0142n\u0105 funkcjonalno\u015bci\u0105"},"common.maps":{"refresh_map":"Od\u015bwie\u017c map\u0119","center_marker":"Wycentruj marker","hide_map":"Schowaj map\u0119","preview_map":"Podgl\u0105d mapy","wrong_marker_place":"Jestem w niew\u0142a\u015bciwym miejscu? Przestaw mnie! "},"common.message":{"decimals_not_allowed":"Price modified, please review field: decimals are not allowed","change_on_new_language":"Zmie\u0144 ustawienia swojego konta na j\u0119zyk {{language}}"}},"he":{"common":{"popular_areas":"Popular areas","select_image":"\u05d1\u05d7\u05e8 \u05ea\u05de\u05d5\u05e0\u05d4","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\u05d5","profession":"\u05de\u05e7\u05e6\u05d5\u05e2","convert_to_another_currency":"Convert to another currency","add_language":"\u05d4\u05d5\u05e1\u05e3 \u05e9\u05e4\u05d4","remove":"\u05d4\u05e1\u05e8","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\u05d8\u05d5\u05e2\u05df"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"\u05ea\u05e6\u05d5\u05d2\u05d4 \u05de\u05e7\u05d3\u05d9\u05de\u05d4 \u05e9\u05dc \u05d4\u05de\u05e4\u05d4","wrong_marker_place":"Not in the right place? Drag me!"}},"el":{"common":{"popular_areas":"Popular areas","select_image":"\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae \u03b5\u03b9\u03ba\u03cc\u03bd\u03b1\u03c2","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\u03ba\u03b1\u03b9","profession":"\u0395\u03c0\u03ac\u03b3\u03b3\u03b5\u03bb\u03bc\u03b1","convert_to_another_currency":"Convert to another currency","add_language":"\u03a0\u03c1\u03bf\u03c3\u03b8\u03ad\u03c3\u03c4\u03b5 \u03bc\u03af\u03b1 \u03b3\u03bb\u03ce\u03c3\u03c3\u03b1","remove":"\u03b1\u03c6\u03b1\u03af\u03c1\u03b5\u03c3\u03b7","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\u03a6\u03cc\u03c1\u03c4\u03c9\u03c3\u03b7"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"\u03c0\u03c1\u03bf\u03b5\u03c0\u03b9\u03c3\u03ba\u03cc\u03c0\u03b7\u03c3\u03b7 \u03c7\u03ac\u03c1\u03c4\u03b7","wrong_marker_place":"Not in the right place? Drag me!"}},"ro":{"common":{"popular_areas":"Popular areas","select_image":"Selectare imagine","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\u015fi","profession":"Profesie","convert_to_another_currency":"Convert to another currency","add_language":"Ad\u0103ugare limba","remove":"\u015etergere","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\u00cenc\u0103rcare"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"harta de previzualizare","wrong_marker_place":"Not in the right place? Drag me!"}},"da":{"common":{"popular_areas":"Popular areas","select_image":"V\u00e6lge billede","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"og","profession":"Profession","convert_to_another_currency":"Convert to another currency","add_language":"Tilf\u00f8j et sprog","remove":"Fjern","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"Loader"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"se kort","wrong_marker_place":"Not in the right place? Drag me!"}},"tr":{"common":{"popular_areas":"Popular areas","select_image":"G\u00f6r\u00fcnt\u00fc se\u00e7","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"ve","profession":"Meslek","convert_to_another_currency":"Convert to another currency","add_language":"Bir dil ekle","remove":"Kald\u0131r","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"Y\u00fckleniyor"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"harita \u00f6nizleme","wrong_marker_place":"Not in the right place? Drag me!"}},"vi":{"common":{"popular_areas":"Popular areas","select_image":"L\u1ef1a ch\u1ecdn h\u00ecnh \u1ea3nh","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"v\u00e0","profession":"Ngh\u1ec1 nghi\u1ec7p","convert_to_another_currency":"Convert to another currency","add_language":"Th\u00eam v\u00e0o m\u1ed9t ng\u00f4n ng\u1eef","remove":"Lo\u1ea1i b\u1ecf","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\u0110ang t\u1ea3i"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"xem tr\u01b0\u1edbc b\u1ea3n \u0111\u1ed3","wrong_marker_place":"Not in the right place? Drag me!"}},"nl":{"common":{"popular_areas":"Populaire plekken","select_image":"Kies afbeelding","company_number":"Bedrijfsnummer","add_to_favourites":"Voeg toe aan je favorieten","remove_from_favourites":"Verwijder uit favorieten","company_name":"Bedrijfsnaam","and":"en","profession":"Beroep","convert_to_another_currency":"Convert to another currency","add_language":"Voeg een taal toe","remove":"Verwijder","cif_nif":"Fiscale identificatie","not_available":"Not available","vat_number":"BTW nummer","please_confirm_deletion":"Gelieve te bevestigen","error_message":"Fout","loading":"Laden"},"jobs.cv":{"select_cv":"Kies een bestand voor je CV"},"classifieds.browse":{"moved_post":"Het bericht dat je zoekt is verplaatst. We proberen het voor je te vinden"},"errors.standard.cookies_needed_exception":{"text":"Gelieve cookies toe te staan om van alle functionaliteiten te genieten"},"common.maps":{"refresh_map":"Vernieuw kaart","center_marker":"Centrum marker","hide_map":"Verberg kaart","preview_map":"Kaart bekijken","wrong_marker_place":"Niet op de juiste plaats? Versleep me!"},"common.message":{"decimals_not_allowed":"Price modified, please review field: decimals are not allowed","change_on_new_language":"Verander je account taal naar {{language}}"}},"th":{"common":{"popular_areas":"Popular areas","select_image":"\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e23\u0e39\u0e1b\u0e20\u0e32\u0e1e","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\u0e41\u0e25\u0e30","profession":"\u0e2d\u0e32\u0e0a\u0e35\u0e1e","convert_to_another_currency":"Convert to another currency","add_language":"\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e20\u0e32\u0e29\u0e32","remove":"\u0e25\u0e1a","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\u0e01\u0e33\u0e25\u0e31\u0e07\u0e42\u0e2b\u0e25\u0e14"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"\u0e41\u0e1c\u0e19\u0e17\u0e35\u0e48\u0e1e\u0e23\u0e35\u0e27\u0e34\u0e27","wrong_marker_place":"Not in the right place? Drag me!"}},"ml":{"common":{"popular_areas":"Popular areas","select_image":"\u0d1a\u0d3f\u0d24\u0d4d\u0d30\u0d02 \u0d24\u0d3f\u0d30\u0d1e\u0d4d\u0d1e\u0d46\u0d1f\u0d41\u0d15\u0d4d\u0d15\u0d41\u0d15","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"\u0d15\u0d42\u0d1f\u0d3e\u0d24\u0d46","profession":"\u0d14\u0d26\u0d4d\u0d2f\u0d4b\u0d17\u0d3f\u0d15 \u0d30\u0d02\u0d17\u0d02","convert_to_another_currency":"Convert to another currency","add_language":"\u0d12\u0d30\u0d41 \u0d2d\u0d3e\u0d37\u0d15\u0d42\u0d1f\u0d3f \u0d1a\u0d47\u0d30\u0d4d\u200d\u0d15\u0d4d\u0d15\u0d41\u0d15","remove":"\u0d28\u0d40\u0d15\u0d4d\u0d15\u0d02 \u0d1a\u0d46\u0d2f\u0d4d\u0d2f\u0d41\u0d15","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"\u0d32\u0d4b\u0d21\u0d4d \u0d1a\u0d46\u0d2f\u0d4d\u0d2f\u0d2a\u0d4d\u0d2a\u0d46\u0d1f\u0d41\u0d28\u0d4d\u0d28\u0d41.."},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"\u0d2d\u0d42\u0d2a\u0d1f\u0d02 \u0d15\u0d3e\u0d23\u0d41\u0d15","wrong_marker_place":"Not in the right place? Drag me!"}},"sr":{"common":{"popular_areas":"\u041f\u043e\u043f\u0443\u043b\u0430\u0440\u043d\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438","select_image":"\u041e\u0434\u0430\u0431\u0435\u0440\u0438\u0442\u0435 \u0441\u043b\u0438\u043a\u0443","company_number":"\u0411\u0440\u043e\u0458 \u043f\u0440\u0435\u0434\u0443\u0437\u0435\u045b\u0430","add_to_favourites":"\u0414\u043e\u0434\u0430\u0458\u0442\u0435 \u0443 \u0444\u0430\u0432\u043e\u0440\u0438\u0442\u0435","remove_from_favourites":"\u0423\u043a\u043b\u043e\u043d\u0438 \u0438\u0437 \u0444\u0430\u0432\u043e\u0440\u0438\u0442\u0430","company_name":"\u0418\u043c\u0435 \u043f\u0440\u0435\u0434\u0443\u0437\u0435\u045b\u0430","and":"\u0438","profession":"\u0417\u0430\u043d\u0438\u043c\u0430\u045a\u0435","convert_to_another_currency":"\u041a\u043e\u043d\u0432\u0435\u0442\u043e\u0432\u0430\u045a\u0435 \u0443 \u0434\u0440\u0443\u0433\u0443 \u0432\u0430\u043b\u0443\u0442\u0443","add_language":"\u0414\u043e\u0434\u0430\u0458\u0442\u0435 \u0458\u0435\u0437\u0438\u043a","remove":"\u0423\u043a\u043b\u043e\u043d\u0438\u0442\u0435","cif_nif":"\u041f\u043e\u0440\u0435\u0441\u043a\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u0438 \u0431\u0440\u043e\u0458","not_available":"\u041d\u0438\u0458\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043do/\u0430","vat_number":"\u041f\u0414\u0412 \u0431\u0440\u043e\u0458","please_confirm_deletion":"\u041c\u043e\u043b\u0438\u043c\u043e \u0412\u0430\u0441 \u043f\u043e\u0442\u0432\u0440\u0434\u0438\u0442\u0435 \u0431\u0440\u0438\u0441\u0430\u045a\u0435","error_message":"\u0413\u0440\u0435\u0448\u043a\u0430","loading":"\u0423\u0447\u0438\u0442\u0430\u0432\u0430 \u0441\u0435"},"jobs.cv":{"select_cv":"\u0418\u0437\u0430\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0430\u0442\u043e\u0442\u0435\u043a\u0443 \u0437\u0430 \u0412\u0430\u0448 \u0426\u0412"},"classifieds.browse":{"moved_post":"\u041e\u0433\u043b\u0430\u0441 \u043a\u043e\u0458\u0438 \u0442\u0440\u0430\u0436\u0438\u0442\u0435 \u0458\u0435 \u043f\u0440\u0435\u043c\u0435\u0448\u0442\u0435\u043d. \u041f\u043e\u043a\u0443\u0448\u0430\u0432\u0430\u043c\u043e \u0434\u0430 \u043f\u0440\u043e\u043d\u0452\u0435\u043c\u043e \u043e\u0433\u043b\u0430\u0441 \u0437\u0430 \u0432\u0430\u0441"},"errors.standard.cookies_needed_exception":{"text":"\u041c\u043e\u043b\u0438\u043c\u043e \u0412\u0430\u0441 \u0434\u0430 \u043e\u043c\u043e\u0433\u0443\u045b\u0438\u0442\u0435 \u043a\u043e\u043b\u0430\u0447\u0438\u045b\u0435 \u0434\u0430 \u0443\u0436\u0438\u0432\u0430\u0458\u0443 \u043f\u0443\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043d\u043e\u0441\u0442"},"common.maps":{"refresh_map":"\u0414\u043e\u043f\u0443\u043d\u0438\u0442\u0435 \u043a\u0430\u0440\u0442\u0443 ","center_marker":"\u041c\u0430\u0440\u043a\u0435\u0440 \u0446\u0435\u043d\u0442\u0440\u0430","hide_map":"\u0441\u0430\u043a\u0440\u0438\u0458 \u043a\u0430\u0440\u0442\u0443","preview_map":"\u043f\u0440\u0438\u043a\u0430\u0436\u0438 \u043c\u0430\u043f\u0435","wrong_marker_place":"\u041d\u0435 \u043d\u0430 \u043f\u0440\u0430\u0432\u043e\u043c \u043c\u0435\u0441\u0442\u0443? \u041f\u043e\u0432\u0443\u0446\u0438 \u043c\u0435!"},"common.message":{"decimals_not_allowed":"\u041f\u0440\u043e\u043c\u0435\u045a\u0435\u043d\u0430 \u0446\u0435\u043d\u0430 \u043f\u0443\u0442, \u043c\u043e\u043b\u0438\u043c\u043e \u0412\u0430\u0441 \u043f\u0440\u0435\u0433\u043b\u0435\u0434\u0430\u0458\u0442\u0435: \u0434\u0435\u0446\u0438\u043c\u0430\u043b\u0438 \u0431\u0440\u043e\u0458\u0435\u0432\u0438 \u043d\u0438\u0441\u0443 \u0434\u043e\u0437\u0432\u043e\u0459\u0435\u043d\u0438","change_on_new_language":"\u041f\u0440\u043e\u043c\u0435\u043d\u0438\u0442\u0435 \u0458\u0435\u0437\u0438\u043a \u043d\u0430\u043b\u043e\u0433\u0430 \u0443 {{language}}"}},"en":{"common":{"popular_areas":"Popular areas","select_image":"Select image","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"and","profession":"Profession","convert_to_another_currency":"Convert to another currency","add_language":"Add a language","remove":"Remove","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"Loading"},"jobs.cv":{"select_cv":"Select a file for your CV"},"classifieds.browse":{"moved_post":"The post you wanted has moved. We're trying to find it for you"},"errors.standard.cookies_needed_exception":{"text":"Please enable cookies in your browser to use this part of the site"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"Preview map","wrong_marker_place":"Not in the right place? Drag me!"},"common.message":{"decimals_not_allowed":"Price modified, please review field: decimals are not allowed","change_on_new_language":"Change your account language to {{language}}"}},"lv":{"common":{"popular_areas":"Popular areas","select_image":"Atlas\u012bt att\u0113lu","company_number":"Company Number","add_to_favourites":"Add to favourites","remove_from_favourites":"Remove from favourites","company_name":"Company Name","and":"un","profession":"Profesija","convert_to_another_currency":"Convert to another currency","add_language":"\r\nPievienot valodu","remove":"Dz\u0113st","cif_nif":"CIF/NIF","not_available":"Not available","vat_number":"EU VAT Number","please_confirm_deletion":"Please confirm deletion","error_message":"Error","loading":"Notiek iel\u0101de"},"common.maps":{"refresh_map":"Refresh map","center_marker":"Centre marker","hide_map":"Hide map","preview_map":"priek\u0161skat\u012bt karti","wrong_marker_place":"Not in the right place? Drag me!"}},"hr":{"common":{"popular_areas":"Popularna mjesta","select_image":"Odabrati sliku","company_number":"Broj poduze\u0107a","add_to_favourites":"Dodati u favorite","remove_from_favourites":"Ukloniti iz mojih favorita","company_name":"Ime poduze\u0107a","and":"i","profession":"Struka","convert_to_another_currency":"Convert to another currency","add_language":"Dodati jezik","remove":"Ukloniti","cif_nif":"Porezni identifikacijski broj","not_available":"Not available","vat_number":"PDV broj","please_confirm_deletion":"Molimo Vas potvrdite brisanje","error_message":"Gre\u0161ka","loading":"Punjenje"},"jobs.cv":{"select_cv":"Odaberite dosje za Va\u0161 \u017eivotopis"},"classifieds.browse":{"moved_post":"Objava koju ste tra\u017eili je premje\u0161tena. Poku\u0161avamo je prona\u0107i za Vas"},"errors.standard.cookies_needed_exception":{"text":"Molimo Vas omogu\u0107ite kola\u010di\u0107e da u\u017eivate u punoj funkcionalnosti"},"common.maps":{"refresh_map":"Obnoviti kartu","center_marker":"Oznaka centra","hide_map":"Sakriti kartu","preview_map":"Prikazati kartu","wrong_marker_place":"Nije na pravom mjestu? Povuci me!"},"common.message":{"decimals_not_allowed":"Price modified, please review field: decimals are not allowed","change_on_new_language":"Promijenite jezik svog korisni\u010dkog ra\u010duna u {{language}}"}}}
LanguageDetectionRules=[{"terms":["til","tak","arbejde","forsikre","bolig","rum","l\u00e6ngere","\u00e6lge","udkig","sicker","rummelig"],"language_id":7},{"terms":["der","zu","das","mit","sich","auf","f\u00fcr","ist","dem","nicht","ein","eine","auch","werden","ich","aus","wird","bei","sind","zimmer","wohnung","vermieten","mieten","mich","auf","mir","zum","haben","wir","hat","wg","wie","nach"],"language_id":8},{"terms":["sealt","v\u00e4lja","siis","muu","palun","t\u00e4nan","teid","t\u00f6\u00f6","eluaseme","tuba","kus"],"language_id":11},{"terms":["very","the","that","my","for","and","you","from","pictures","nice","be"],"language_id":10},{"terms":["ir","los","las","muy","mucho","mucha","eso","esto","esa","estoy","soy","tengo","tenemos","esta","estan","busco","hacer","todo","toda","desde","alquilo","alquilar","habitaci\u00f3n"],"language_id":39},{"terms":["eux","dans","pour","des","je","ce","nous","sommes","suis","allons","avons","vends","celles","celui","ont","vont","une"],"language_id":14},{"terms":["od","za","moj","moje","mom","bih","moglo","mogli"],"language_id":52},{"terms":["sangat","yang","yang","saya","untuk","dan","kau","dari","gambar","bagus","akan"],"language_id":57},{"terms":["gli","da","poi","io","ho","sto","nel","nella","cerco","cercando","altri","altro","prego","grazie","degli","lavoro","alloggio","stanza","dove","pi"],"language_id":21},{"terms":["uz","cits","l\u016bdzu","paldies","jums","darbs","dz\u012bvok\u013cu","telpu","kur"],"language_id":26},{"terms":["majd","vagyok","egy\u00e9b","k\u00e9rem","k\u00f6sz\u00f6n\u00f6m","munka","lak\u00e1s","szoba","ahol"],"language_id":19},{"terms":["een","op","voor","koop","gevraagd","aangeboden","nieuw","met","het","staat"],"language_id":32},{"terms":["sikre","arbeid","jakt","bolig","rom","hvor","kundenes","rofesjonelt","ytterligere","trygg","leiligheter"],"language_id":33},{"terms":["aby","albowiem","a\u017ceby","bowiem","by\u0107","ciebie","coraz","dla","jestem","jest","kt\u00f3ry","mieszkanie","mimo","m\u00f3j","od","\u00f3w","pok\u00f3j","poniewa\u017c","praca","tamten","ty","wed\u0142ug","wy","\u017ce","\u017ceby"],"language_id":34},{"terms":["em","algum","outro","sem","bem","boa","bom","n\u00e3o","voc\u00ea","novo","nova","muito","pre\u00e7o","emprego","seu","neste","qualquer","assim","uma"],"language_id":35},{"terms":["\u0438","\u044f","\u0432\u044b","\u0438\u0437","\u0434\u043b\u044f","\u043a\u043e\u0433\u0434\u0430","\u0432\u0441\u0435","\u043a\u043e\u0442\u043e\u0440\u044b\u0439","\u0441\u0435\u0439\u0447\u0430\u0441","\u043a\u043e\u043c\u043d\u0430\u0442\u0430","\u0431\u044b\u0442\u044c","\u0434\u0435\u0448\u0435\u0432\u043e","\u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c","\u0437\u0430\u043d\u044f\u0442\u043e\u0441\u0442\u044c","\u043c\u0435\u0441\u044f\u0446","\u0430\u0440\u0435\u043d\u0434\u0430","\u043f\u0440\u043e\u0434\u0430\u0436\u0430","\u043a\u0432\u0430\u0440\u0442\u0438\u0440\u0430","\u0437\u0430\u0440\u043f\u043b\u0430\u0442\u0430","\u0446\u0435\u043d\u0442\u0440"," \u0441\u0440\u043e\u043a","\u043e\u043f\u044b\u0442"],"language_id":37},{"terms":["atunci","sunt","\u00een","cerc","rog","mul\u0163umesc","pentru","locul","munc\u0103","locuin\u0163e","cazul"],"language_id":36},{"terms":["sa","\u017ee","som","tie","obr\u00e1zky","pekn\u00e9","by\u0165"],"language_id":38},{"terms":["siis","min\u00e4","olen","ja","muut","kiitos","ty\u00f6","asuminen","huone","jossa"],"language_id":13},{"terms":["till","f\u00f6rs\u00e4kra","fr\u00e5n","s\u00e4ker","s\u00e4lja","d\u00e5","sn\u00e4lla","tack","arbete","boende","d\u00e4r","yrkesm\u00e4ssig"],"language_id":40},{"terms":["C\u00e2u","t\u00ecm","gi\u1edbi","\u1edb","ng\u1eef","c\u01a1","b\u1ea1n","c\u00e1","\u0111","B\u1ed9","tr\u1ebb","\u1ee5","\u1ecb"],"language_id":47},{"terms":["ile","yani","benim","resimleri","g\u00fczel","kimden","olmak"],"language_id":44},{"terms":["\u03b7","\u03b5\u03c0\u03af\u03c0\u03b5\u03b4\u03b7","\u03b1\u03c5\u03c4\u03cc","\u03cc\u03c4\u03b9","\u03b4\u03b9\u03ba\u03ae","\u03bc\u03bf\u03c5","\u03c3\u03b1\u03c2","\u03b5\u03af\u03bd\u03b1\u03b9","\u03b8\u03ad\u03bb\u03bf\u03c5\u03bc\u03b5","\u03c7\u03c1\u03b5\u03b9\u03ac\u03b6\u03b5\u03c4\u03b1\u03b9","\u03b1\u03bd\u03b1\u03b6\u03b7\u03c4\u03ac","\u03bd\u03b1","\u03b2\u03c1\u03bf\u03cd\u03bc\u03b5"],"language_id":9},{"terms":["\u043e\u0434","\u0437\u0430","\u043c\u043e\u0458","\u043c\u043e\u0458\u0435","\u043c\u043e\u043c","\u0431\u0438\u0445","\u0431\u0438","\u0441\u0435","\u043c\u043e\u0433\u043b\u043e","\u043c\u043e\u0433\u043b\u0438","\u043d\u0435","\u0434\u0430","\u0441\u0443"],"language_id":59},{"terms":["\u05d1","\u05d3","\u05d7","\u05e9","\u05e8","\u05d4","\u05e7","\u05e4","\u05ea","\u05e8","\u05e4"],"language_id":17},{"terms":["\u064a","\u0629","\u0645"," \u062c","\u0644","\u0633","\u0629","\u0644","\u0623","\u0637","\u0644","\u0645","\u0646"],"language_id":1},{"terms":["\u0bae\u0bc6","\u0baf\u0bcd","\u0baf\u0bc6","\u0bb4\u0bc1","\u0ba4\u0bcd","\u0ba4\u0bc1","\u0bb4","\u0ba4\u0bc1","\u0b95\u0bcd","\u0b95","\u0bb3\u0bcd"],"language_id":41},{"terms":["\u0d32\u0d4d\u0d36\u0d3f","\u0d31\u0d4d\u0d31\u0d3f","\u0d28\u0d4d\u0d24\u0d4d\u0d2f\u0d3f","\u0d35","\u0d0e","\u0d34\u0d41","\u0d24\u0d4d\u0d24\u0d41","\u0d30\u0d40","\u0d24\u0d3f"],"language_id":28},{"terms":["\u0e1e\u0e37\u0e48","\u0e19","\u0e1e\u0e31","\u0e2d","\u0e23\u0e4c","\u0e32","\u0e22","\u0e02","\u0e07","\u0e1e"],"language_id":43},{"terms":["\u4e2d","\u6587","\u91d1","\u4eba","\u5b50","\u516c","\u8ba1","\u7ecf","\u76ee"],"language_id":48},{"terms":["\u3057","\u6027","\u30a2","\u3066","\u5165","\u30fc"," \u672c"," \u65e5","\u30aa","\u4eba","\u30c3","\u30e0","\u30af","\u5177","\u7537","\u81ea"],"language_id":23},{"terms":["\ud31d\ub2c8\ub2e4","\uc0bd\ub2c8\ub2e4","\uadf8\ub9ac\uace0","\uc788\uc2b5\ub2c8\ub2e4","\uc788\ub2e4","\ub294","\uc740","\uc5c6\ub2e4","\uc5f0\ub77d","\uc8fc\uc18c","\uc8fc\uc138\uc694","\ud558\uc138\uc694","\uac00","\ub97c","\uc744","\ub098","\ub610\ub294","\ub9cc\uc57d"],"language_id":25}]
Currencies={"1794":{"symbol":"G$","code":"GYD","rate":null,"id":147},"166":{"symbol":"TZS","code":"TZS","rate":null,"id":129},"129":{"symbol":"KPW","code":"KPW","rate":null,"id":100},"18":{"symbol":"BZD","code":"BZD","rate":null,"id":17},"55":{"symbol":"ETB","code":"ETB","rate":null,"id":46},"92":{"symbol":"LAK","code":"LAK","rate":null,"id":71},"1813":null,"148":{"symbol":"SCR","code":"SCR","rate":null,"id":115},"37":{"symbol":"\u5143","code":"CNY","rate":9.3123,"id":32},"74":{"symbol":"HNL","code":"HNL","rate":25.7716,"id":56},"111":{"symbol":"MUR","code":"MUR","rate":41.6794,"id":86},"167":{"symbol":"\u0e3f","code":"THB","rate":44.5853,"id":130},"130":{"symbol":"kr","code":"NOK","rate":8.0237,"id":101},"56":{"symbol":"kr","code":"DKK","rate":7.4413,"id":39},"93":{"symbol":"LVL","code":"LVL","rate":null,"id":72},"19":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"149":{"symbol":"SLL","code":"SLL","rate":null,"id":116},"75":{"symbol":"HK$","code":"HKD","rate":10.5853,"id":57},"112":{"symbol":"$","code":"MXN","rate":17.1952,"id":87},"1":{"symbol":"AFA","code":"AFA","rate":null,"id":1},"38":{"symbol":"$","code":"COP","rate":2571.71,"id":33},"1796":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"1093":{"symbol":"PEN","code":"PEN","rate":3.8726,"id":143},"168":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"131":{"symbol":"OMR","code":"OMR","rate":0.5253,"id":102},"94":{"symbol":"LBP","code":"LBP","rate":null,"id":73},"20":{"symbol":"BMD","code":"BMD","rate":null,"id":19},"57":{"symbol":"FJD","code":"FJD","rate":2.646,"id":47},"150":{"symbol":"S$","code":"SGD","rate":1.9084,"id":117},"113":{"symbol":"MDL","code":"MDL","rate":null,"id":88},"2":{"symbol":"ALL","code":"ALL","rate":null,"id":2},"39":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"76":{"symbol":"Ft","code":"HUF","rate":266.27,"id":58},"169":{"symbol":"TTD","code":"TTD","rate":8.6428,"id":131},"132":{"symbol":"Rs","code":"PKR","rate":115.222,"id":103},"21":{"symbol":"BTN","code":"BTN","rate":null,"id":20},"58":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"95":{"symbol":"LSL","code":"LSL","rate":null,"id":74},"151":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"3":{"symbol":"\u062f\u062c","code":"DZD","rate":null,"id":3},"40":{"symbol":"CDF","code":"CDF","rate":null,"id":34},"77":{"symbol":"ISK","code":"ISK","rate":174.194,"id":59},"114":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"170":{"symbol":"TND","code":"TND","rate":null,"id":132},"133":{"symbol":"PAB","code":"PAB","rate":null,"id":104},"22":{"symbol":"BOB","code":"BOB","rate":9.5774,"id":21},"59":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"96":{"symbol":"LRD","code":"LRD","rate":null,"id":75},"152":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"115":{"symbol":"MNT","code":"MNT","rate":null,"id":89},"4":{"symbol":"ADF","code":"ADF","rate":null,"id":4},"41":{"symbol":"CRC","code":"CRC","rate":null,"id":35},"78":{"symbol":"Rs","code":"INR","rate":62.0074,"id":60},"1799":{"symbol":"CVE","code":"CVE","rate":null,"id":148},"171":{"symbol":"TL","code":"TRY","rate":2.0941,"id":133},"134":{"symbol":"PGK","code":"PGK","rate":null,"id":105},"23":{"symbol":"BAM","code":"BAM","rate":null,"id":22},"60":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"97":{"symbol":"LYD","code":"LYD","rate":null,"id":76},"153":{"symbol":"SOS","code":"SOS","rate":null,"id":118},"116":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"5":{"symbol":"AOA","code":"AOA","rate":null,"id":5},"42":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"79":{"symbol":"Rp","code":"IDR","rate":12537.9,"id":61},"1726":{"symbol":"\u00a3","code":"GBP","rate":0.9111,"id":135},"172":{"symbol":"AED","code":"AED","rate":5.0111,"id":134},"135":{"symbol":"PYG","code":"PYG","rate":null,"id":106},"24":{"symbol":"BWP","code":"BWP","rate":9.2558,"id":23},"61":{"symbol":"GMD","code":"GMD","rate":null,"id":48},"98":{"symbol":"SFr","code":"CHF","rate":1.4612,"id":77},"154":{"symbol":"R","code":"ZAR","rate":10.1402,"id":119},"117":{"symbol":"\u062f.\u0645.","code":"MAD","rate":11.211,"id":90},"6":{"symbol":"$","code":"ARS","rate":5.2648,"id":6},"43":{"symbol":"HRK","code":"HRK","rate":7.2654,"id":36},"80":{"symbol":"\u0631\u06cc\u0627\u0644","code":"IRR","rate":null,"id":62},"1727":{"symbol":"\u00a3","code":"GBP","rate":0.9111,"id":135},"173":{"symbol":"\u00a3","code":"GBP","rate":0.9111,"id":135},"136":{"symbol":"\u20b1","code":"PHP","rate":62.3485,"id":107},"25":{"symbol":"R$","code":"BRL","rate":2.4121,"id":24},"62":{"symbol":"GEL","code":"GEL","rate":null,"id":49},"99":{"symbol":"LTL","code":"LTL","rate":3.4521,"id":78},"155":{"symbol":"\u20a9","code":"KRW","rate":1545.89,"id":120},"118":{"symbol":"MZN","code":"MZN","rate":null,"id":91},"7":{"symbol":"AMD","code":"AMD","rate":null,"id":7},"44":{"symbol":"CUC","code":"CUC","rate":null,"id":37},"81":null,"174":{"symbol":"$","code":"USD","rate":1.3643,"id":52},"137":{"symbol":"z\u0142","code":"PLN","rate":3.8831,"id":108},"26":{"symbol":"BND","code":"BND","rate":1.9087,"id":25},"63":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"100":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"156":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"119":{"symbol":"MMK","code":"MMK","rate":null,"id":92},"8":{"symbol":"AWG","code":"AWG","rate":null,"id":8},"45":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"82":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"175":{"symbol":"UYU","code":"UYU","rate":null,"id":136},"138":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"27":{"symbol":"\u041b\u0432","code":"BGN","rate":1.9559,"id":26},"64":{"symbol":"GHC","code":"GHC","rate":null,"id":50},"101":{"symbol":"MOP","code":"MOP","rate":null,"id":79},"157":{"symbol":"LKR","code":"LKR","rate":155.557,"id":121},"120":{"symbol":"NAD","code":"NAD","rate":null,"id":93},"46":{"symbol":"K\u010d","code":"CZK","rate":25.5574,"id":38},"83":{"symbol":"\u20aa","code":"ILS","rate":5.1052,"id":63},"9":{"symbol":"AU$","code":"AUD","rate":1.4922,"id":9},"176":{"symbol":"UZS","code":"UZS","rate":null,"id":137},"139":{"symbol":"$","code":"USD","rate":1.3643,"id":52},"65":{"symbol":"GIP","code":"GIP","rate":null,"id":51},"102":{"symbol":"MKD","code":"MKD","rate":null,"id":80},"28":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"158":{"symbol":"SDD","code":"SDD","rate":null,"id":122},"121":{"symbol":"NPR","code":"NPR","rate":99.2665,"id":94},"84":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"10":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"47":{"symbol":"kr","code":"DKK","rate":7.4413,"id":39},"177":{"symbol":"Bs. F","code":"VEF","rate":null,"id":138},"140":{"symbol":"QAR","code":"QAR","rate":4.967,"id":109},"103":{"symbol":"MGF","code":"MGF","rate":null,"id":81},"29":{"symbol":"BIF","code":"BIF","rate":null,"id":27},"66":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"159":{"symbol":"SRD","code":"SRD","rate":null,"id":123},"122":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"11":{"symbol":"AZN","code":"AZN","rate":null,"id":11},"48":{"symbol":"DOP","code":"DOP","rate":null,"id":40},"85":{"symbol":"JMD","code":"JMD","rate":null,"id":64},"178":{"symbol":"\u20ab","code":"VND","rate":null,"id":139},"141":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"30":{"symbol":"KHR","code":"KHR","rate":null,"id":28},"67":{"symbol":"kr","code":"DKK","rate":7.4413,"id":39},"104":{"symbol":"MWK","code":"MWK","rate":null,"id":82},"160":{"symbol":"SZL","code":"SZL","rate":null,"id":124},"123":{"symbol":"ANG","code":"ANG","rate":2.3875,"id":95},"12":{"symbol":"BSD","code":"BSD","rate":null,"id":12},"49":{"symbol":"ECS","code":"ECS","rate":null,"id":41},"86":{"symbol":"\u00a5","code":"JPY","rate":123.319,"id":65},"179":{"symbol":"$","code":"USD","rate":1.3643,"id":52},"142":{"symbol":"RON","code":"RON","rate":4.0964,"id":110},"31":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"68":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"105":{"symbol":"RM","code":"MYR","rate":4.5295,"id":83},"161":{"symbol":"kr","code":"SEK","rate":9.7332,"id":125},"124":{"symbol":"CFPfr","code":"CFP","rate":null,"id":96},"13":{"symbol":"BHD","code":"BHD","rate":0.5143,"id":13},"50":{"symbol":"\u062c.\u0645","code":"EGP","rate":7.4704,"id":42},"87":{"symbol":"JOD","code":"JOD","rate":null,"id":66},"180":{"symbol":"YER","code":"YER","rate":null,"id":140},"143":{"symbol":"\u0440\u0443\u0431.","code":"RUB","rate":40.3462,"id":111},"32":{"symbol":"C$","code":"CAD","rate":1.3996,"id":29},"69":{"symbol":"$","code":"USD","rate":1.3643,"id":52},"106":{"symbol":"MVR","code":"MVR","rate":null,"id":84},"162":{"symbol":"SFr","code":"CHF","rate":1.4612,"id":77},"125":{"symbol":"NZ$","code":"NZD","rate":1.9524,"id":97},"14":{"symbol":"\u09f3","code":"BDT","rate":null,"id":14},"51":{"symbol":"$","code":"USD","rate":1.3643,"id":52},"88":{"symbol":"KZT","code":"KZT","rate":200.757,"id":67},"181":{"symbol":"ZMK","code":"ZMK","rate":null,"id":141},"144":{"symbol":"RWF","code":"RWF","rate":null,"id":112},"33":{"symbol":"KYD","code":"KYD","rate":null,"id":30},"70":{"symbol":"GTQ","code":"GTQ","rate":null,"id":53},"107":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"1458":{"symbol":"TMM","code":"TMM","rate":null,"id":144},"163":{"symbol":"SYP","code":"SYP","rate":null,"id":126},"126":{"symbol":"NIO","code":"NIO","rate":null,"id":98},"15":{"symbol":"BBD","code":"BBD","rate":null,"id":15},"52":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"89":{"symbol":"KSh","code":"KES","rate":null,"id":68},"182":{"symbol":"Z$","code":"ZWL","rate":null,"id":142},"145":{"symbol":"\u0631.\u0633","code":"SAR","rate":5.1163,"id":113},"34":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"71":{"symbol":"GNF","code":"GNF","rate":null,"id":54},"108":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"1459":{"symbol":"UGX","code":"UGX","rate":null,"id":145},"164":{"symbol":"NT$","code":"TWD","rate":43.3793,"id":127},"127":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"16":{"symbol":"BYR","code":"BYR","rate":null,"id":16},"53":{"symbol":"ERN","code":"ERN","rate":null,"id":44},"90":{"symbol":"KWD","code":"KWD","rate":0.3936,"id":69},"146":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"35":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"72":{"symbol":"CFA","code":"XOF","rate":null,"id":18},"109":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"1793":{"symbol":"$","code":"USD","rate":1.3643,"id":52},"1460":{"symbol":"UAH","code":"UAH","rate":10.9485,"id":146},"165":{"symbol":"TJS","code":"TJS","rate":null,"id":128},"128":{"symbol":"\u20a6","code":"NGN","rate":null,"id":99},"17":{"symbol":"\u20ac","code":"EUR","rate":1.0,"id":10},"54":{"symbol":"EEK","code":"EEK","rate":15.6448,"id":45},"91":{"symbol":"KGS","code":"KGS","rate":null,"id":70},"147":{"symbol":"RSD","code":"RSD","rate":99.85,"id":114},"36":{"symbol":"$","code":"CLP","rate":707.117,"id":31},"73":{"symbol":"HTG","code":"HTG","rate":null,"id":55},"110":{"symbol":"MRO","code":"MRO","rate":null,"id":85}};ThreeDecimalCurrencies=[13,66,69,76,102,132];function hide_notice(){if($('notice')){$('notice').hide();}
$$('.notice').each(function(node){node.remove();});}
function openInNewWindow(href,windowName){windowName=windowName||'_blank';var newWindow=window.open(href,windowName);newWindow.focus();return false;}
function cookiesEnabled(){var cookieEnabled=(navigator.cookieEnabled)?true:false;if(typeof navigator.cookieEnabled=="undefined"&&!cookieEnabled){document.cookie="testcookie";cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)?true:false;}
return(cookieEnabled);}
function cookiesRequired(){var error=new Element('div',{'class':'notice error'});error.innerHTML=I18n.t("text",{scope:"errors.standard.cookies_needed_exception"});with($('page_notice_container')){insert(error);scrollTo();}}
var ClassifiedsURLReader=Class.create(JLURLReader,{_parse:function($super){$super();this._category=null;this._page=null;this._item=null;if(this._location&&!this._location.blank()){var checked_up_to=1;if(this.path_parts[2]&&this.path_parts[2].match(/[A-Z][A-Za-z_-]+/)){this._category=this.path_parts[2];checked_up_to++;}
if(this.path_parts[checked_up_to+1]&&this.path_parts[checked_up_to+1].match(/^[0-9]+$/)){this._page=this.path_parts[checked_up_to+1];checked_up_to++;}
if(this.path_parts[checked_up_to+1]&&this.path_parts[checked_up_to+1].match(/^[a-z][a-z0-9_-]+$/i)){this._item=this.path_parts[checked_up_to+1];checked_up_to++;}}},category:function(){return this._category||this.params.category;},page:function(){return this._page||this.params.page;},item:function(){return this._item||this.params.item;}});var Linker=Class.create({initialize:function(){this.url=new ClassifiedsURLReader();this.params=$H(this.url.params);var location=this.params.location||this.url.location();if(location)this.params.set('location',location);var category=this.params.category||this.url.category();if(category)this.params.set('category',category);},substituteAll:function(){var parent=(arguments.length>0)?$(arguments[0]):document;if(!parent){return;}
parent.getElementsBySelector('a.full_actionable').each(function(link){this.substitute(link);link.removeClassName('full_actionable');}.bind(this));},substitute:function(link){match=link.className.toString().match(/\bdo_([a-z_]+)\b/);link.href=this.actionableLink(match[1]);link.removeClassName(match[0]);},actionableLink:function(action){return'/'+[this.url.locale()||I18n.locale,'action',action].join('/')+'?'+this.params.toQueryString();}});AutoScroller=Class.create(Glider,{initialize:function(wrapper,options){this.scrolling=false;this.wrapper=$(wrapper);this.scroller=this.wrapper.down('.scroller');this.sections=this.wrapper.getElementsBySelector('.item');this.options=Object.extend({duration:1.0,frequency:5},options||{});this.paused=false;this.wrapper.observe('mouseover',this.pause.bind(this));this.wrapper.observe('mouseout',this.unpause.bind(this));this.sections.each(function(section,index){section._index=index;});this.events={click:this.click.bind(this)};this.start();},moveTo:function(element,container,options){this.current=$(element);var containerOffset=container.cumulativeOffset(),elementOffset=element.cumulativeOffset();this.scrolling=new Effect.SmoothScroll(container,{duration:options.duration,x:(elementOffset[0]-containerOffset[0]),y:(elementOffset[1]-containerOffset[1])});return false;},pause:function(){this.paused=true;},unpause:function(){this.paused=false;},periodicallyUpdate:function(){if(this.timer!=null){clearTimeout(this.timer);if(!this.paused){this.next();}}
this.timer=setTimeout(this.periodicallyUpdate.bind(this),this.options.frequency*1000);},next:function(){if(this.current){var currentIndex=this.current._index;var nextIndex=(currentIndex+2>=this.sections.length)?0:currentIndex+2;}
else{var nextIndex=2;}
this.moveTo(this.sections[nextIndex],this.scroller,{duration:this.options.duration});}});var Map=Class.create({initialize:function(_container){this.map=null;this.container=$(_container);this.point=null;this.geoCoder=new GClientGeocoder();this.zoomLevel=15;this.mapType=G_NORMAL_MAP;},showMapContainer:function(){if(arguments.length>0){if(arguments[0]==true){this.container.show();}else{this.container.hide();}}else{this.container.show();}},hideMapContainer:function(){this.container.hide();},visible:function(){return this.container.visible();},initMap:function(){if(!GBrowserIsCompatible()){return false;}
if(this.map){return true;}
this.container.addClassName('map_being_controlled');this.map=new GMap2(this.container);this.map.addControl(new GMenuMapTypeControl());this.map.addControl(new GSmallMapControl());return true;},mapFromPoint:function(point){this.map.setCenter(point,this.zoomLevel,this.mapType);if(this.marker){this.map.removeOverlay(this.marker);}
this.marker=new GMarker(point);this.map.addOverlay(this.marker);},setPointFromPoint:function(point){this.point=point;},setPointFromLatLng:function(latitude,longitude){if(!latitude||!longitude){return;}
this.setPointFromPoint(new GLatLng(latitude,longitude));},setPointFromAddress:function(address){if(address.blank()){return;}
this.geoCoder.getLatLng(address,this.geoCoderLatLngFromAddress.bind(this));},geoCoderLatLngFromAddress:function(_point){if(_point){this.setPointFromPoint(_point);}},generateMap:function(boundingBox){if(this.point&&!this.overrideDisplay){this.showMapContainer();if(!this.initMap()){this.hideMapContainer();return;}
if(boundingBox){this.zoomLevel=this.map.getBoundsZoomLevel(boundingBox);}
this.mapFromPoint(this.point);}},loadOptions:function(options){this.options=this.optionsJSON(options);if(this.options.zoomLevel){this.zoomLevel=this.options.zoomLevel;}
if(this.options.mapType){this.mapType=this.getMapType(this.options.mapType);}},optionsJSON:function(options){if(options.blank()){return{};}else{return options.evalJSON(true);}},getMapType:function(name){switch(name){case'Satellite':return G_SATELLITE_MAP;break;case'Hybrid':return G_HYBRID_MAP;break;default:return G_NORMAL_MAP;}}});var DisplayMap=Class.create(Map,{initialize:function($super,_container,_address,_lat,_lng,options){$super(_container);this.address=_address||'';this.lat=_lat||false;this.lng=_lng||false;this.hideMapContainer();if(this.lat&&this.lng){this.setPointFromLatLng(this.lat,this.lng);}
else if(!this.address.blank()){this.setPointFromAddress(this.address);}
else{}
this.loadOptions(options);this.generateMap.bind(this).delay(2);}});var ItemEditMap=Class.create(Map,{initialize:function($super,_container,addresses){$super(_container);this.getAddresses=addresses;this.hideMapContainer();},initMap:function($super){var sup=$super();if(sup){this.optionsHandler=new MapOptionsHandler(this);this.loadOptions(this.optionsHandler.field.value);}
return sup;},locateAndDisplay:function(useForm,options){options=(options||{});if(options.overrideDisplay){this.overrideDisplay=true;}
if(useForm&&(point=this.formLatLng())){this.setPointFromPoint(point);this.generateMap();}else{this.addressList=this.getAddresses();if(this.addressList.length>0){this.showLoading();this.tryNextAddress();}}},formLatLng:function(){var lat=$('item_lat')&&$F('item_lat');var lng=$('item_lng')&&$F('item_lng');if(lat&&lng){return new GLatLng(lat,lng);}
return null;},displayAutoMap:function(show,options){var opts=options||{};if(show){if(this.visible())return;this.showMapContainer();this.locateAndDisplay(opts.useForm);}else{this.hideMapContainer();}},showError:function(){if(!this.error){this.error=new Element('div',{'class':'notice error'});this.error.innerHTML=I18n.t('error_message',{scope:'common'});this.container.insert({after:this.error});}
this.error.show();},hideError:function(){if(this.error){this.error.hide();}},showLoading:function(){if(!this.loader){this.loader=new Element('div');this.loader.innerHTML=loadingHTML();this.container.insert({after:this.loader});}
this.loader.show();},hideLoading:function(){if(this.loader){this.loader.hide();}},tryNextAddress:function(){var address=this.addressList.shift();if(address){this.setPointFromAddress(address);}else{this.container.fire('map:point',false);this.hideLoading();this.hideMapContainer();this.showError();}},setPointFromAddress:function(address){if(address.blank()){return;}
this.geoCoder.getLocations(address,this.geoCoderLatLngFromAddress.bind(this));},geoCoderLatLngFromAddress:function(response){if(!response||response.Status.code!=200){this.tryNextAddress();}else{var place=response.Placemark[0];var point=new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);var boundingBox=place.ExtendedData.LatLonBox;var latLngBounds=new GLatLngBounds(new GLatLng(boundingBox.south,boundingBox.west),new GLatLng(boundingBox.north,boundingBox.east));this.setPointFromPoint(point);this.generateMap(latLngBounds);this.hideLoading();this.container.fire('map:point',{'lat':point.lat(),'lng':point.lng()});}},mapFromPoint:function(point){this.map.setCenter(point,this.zoomLevel,this.mapType);if(this.marker){this.map.removeOverlay(this.marker);}
this.marker=new GMarker(point,{draggable:true});GEvent.addListener(this.marker,"dragend",function(_point){this.container.fire('map:point',{'lat':_point.lat(),'lng':_point.lng()});}.bindAsEventListener(this));GEvent.addListener(this.marker,"click",function(_point){this.map.closeInfoWindow();}.bindAsEventListener({map:this.map}));GEvent.addListener(this.marker,"dragstart",function(_point){this.map.closeInfoWindow();}.bindAsEventListener({map:this.map}));this.map.addOverlay(this.marker);var marker_html=new Element('div',{'class':'map_marker'});marker_html.innerHTML=I18n.t('wrong_marker_place',{scope:"common.maps"});var marker_options={onOpenFn:function(){var infoWindowBlocks=$$('#map_container div div div div');for(var c=0;c<infoWindowBlocks.length;c++){var element=infoWindowBlocks[c];if(element.getStyle('height')==="40px"&&element.getStyle('top')==="25px"){element.setStyle({height:"10px"});}
if(element.getStyle('top')==="65px"){element.setStyle({top:"35px"});}}}};this.map.openInfoWindowHtml(this.marker.getPoint(),marker_html,marker_options);},centerMarker:function(){var newPoint=this.map.getCenter();this.map.closeInfoWindow();this.marker.setLatLng(newPoint);this.container.fire('map:point',{'lat':newPoint.lat(),'lng':newPoint.lng()});}});var MapOptionsHandler=Class.create({initialize:function(map){this.field=$('map_options');this.map=map;this.observe();},read:function(){return this.map.optionsJSON($F(this.field));},write:function(property,value){var val=this.read();val[property]=value;this.field.value=Object.toJSON(val);},observe:function(){GEvent.addListener(this.map.map,"zoomend",function(oldLevel,newLevel){this.write('zoomLevel',newLevel);}.bind(this));GEvent.addListener(this.map.map,"maptypechanged",function(){this.write('mapType',this.map.map.getCurrentMapType().getName());}.bind(this));},unObserve:function(){if(this.map.map){GEvent.clearListeners(this.map.map,"zommend");GEvent.clearListeners(this.map.map,"maptypechanged");}}});var MapButtonHandler=Class.create({initialize:function(map){this.map=map;this.showMap=$('show_map');this.previewMap=false;this.previewButton=new Element('input',{type:'button',value:this.textForButton()});this.refreshButton=new Element('input',{type:'button',value:I18n.t('refresh_map',{scope:"common.maps"})});this.centerMarkerButton=new Element('input',{type:'button',value:I18n.t('center_marker',{scope:"common.maps"})});this.observe();if(!this.previewMap){this.refreshButton.hide();this.centerMarkerButton.hide();}
this.showMap.insert({after:this.previewButton});this.previewButton.insert({after:this.refreshButton});this.refreshButton.insert({after:this.centerMarkerButton});},textForButton:function(){if(this.previewMap){return I18n.t('hide_map',{scope:"common.maps"});}else{return I18n.t('preview_map',{scope:"common.maps"});}},toggleDisplay:function(){if(this.previewMap){this.previewMap=false;this.refreshButton.hide();this.centerMarkerButton.hide();}else{this.previewMap=true;this.refreshButton.show();this.centerMarkerButton.show();}
this.previewButton.value=this.textForButton();},observe:function(){this.previewButton.observe('click',function(event){this.toggleDisplay();this.map.displayAutoMap(this.previewMap,{useForm:true});}.bindAsEventListener(this));this.refreshButton.observe('click',function(event){this.map.locateAndDisplay();}.bindAsEventListener(this));this.centerMarkerButton.observe('click',function(event){this.map.centerMarker();}.bindAsEventListener(this));},unObserve:function(){this.previewButton.stopObserving('click');this.refreshButton.stopObserving('click');}});var ItemDisplayHandler=Class.create({initialize:function(item_list){this.item_list=$(item_list);this.popCategoryId=null;this.popLocationId=null;this.item_list.observe('click',this.clickHandler.bindAsEventListener(this));items=this._itemsInList();if(items.length>0){this.itemListController=new DisplayItemCollection(items);items.each(function(item){item.addClassName('linked');});this.openFromURL();}},_itemsInList:function(){return this.item_list.getElementsBySelector('.item');},popTo:function(location_id,category_id){this.popLocationId=location_id;this.popCategoryId=category_id;},openFromURL:function(){var hash=window.hashController.current();if(!this.itemListController.openFromHash(hash)){var item_list=$('item_list');item_list.childElements().each(function(li){li.hide();});text=I18n.t('moved_post',{scope:'classifieds.browse'});item_list.insert({top:'<li class="missing">'+text+'</li>'});var baseURL=window.location.href.split('#').first().split('?').first();hash=this.itemListController.findItemInHash(hash);var redirect=function(){window.location.href=baseURL+'?find='+hash;};redirect.delay(0.25);}},prepareImages:function(){imageInfo=[];$$('a.embiggen').each(function(item){imageInfo.push(item.href);});if($('image')!=null){imageInfo=[$('image').src].concat(imageInfo).uniq();}
return imageInfo;},clickHandler:function(event){var target=$(event.target);if(target.nodeName.toLowerCase()=='sup'){target=target.parentNode;}
if(target.nodeName.toLowerCase()=='li'&&target.hasClassName('item')){var item=target;}
else{var item=target.up('li.item')||target.up('div.item');}
if(target.nodeName.toLowerCase()=='a'){if(target.hasClassName('print')){this.processPrint(item);cancel(event);}
else if(target.hasClassName('expand_item')){this.toggleItemState(event,item,target);}
else if(target.hasClassName('favourite')){this.processFavourite(target,item);cancel(event);}
else if(target.hasClassName('item_action')){this.showItemAction(target.href);cancel(event);}
else if(target.hasClassName('refresh_item')){this.triggerAndUpdate(target.href,$('item_notice_container'),{onSuccess:function(){item.down('.last_updated').innerHTML=((new Date).strftime('%d/%m/%y'));}});cancel(event);}
else if(target.hasClassName('permanent_link_trigger')){this.togglePermalink(target);cancel(event);}
else if(target.hasClassName('delete_item')){if(confirm(I18n.t('please_confirm_deletion',{scope:"common"}))){this.triggerAndUpdate(target.href,$('page_notice_container'),{onSuccess:function(transport){this.remove();}.bind(target.up('li.item'))});}
cancel(event);}
else if(target.href.match(/mailto:/)){if(this.showContactForm()){cancel(event);}}
else if(target.hasClassName('trigger_contact_form')){this.showContactForm();event.element().blur();cancel(event);}
else if(target.hasClassName('trigger_external')){if(this.showExternalLink()){cancel(event);target.blur();}}
else if(target.hasClassName('trigger_internal')){if(this.showLinkToAd()){cancel(event);}}
else if(target.hasClassName('profile_linker')){new Ajax.Updater('profile_linker',target.href,{onComplete:function(){MagicLinker.run();if(this.down('a.remove')){$('profile_information').show();}
else{$('profile_information').hide();}}.bind(target.up('li'))});target.replace(loadingHTML('small_loading'));cancel(event);}
else if(target.id=='share_twitter'){var container=$('twitter_linker');var originalHTML=container.innerHTML;target.replace(loadingHTML('small_loading'));new Ajax.Request('/create_url',{asynchronous:false,method:'post',parameters:{"url":target.readAttribute("data")},onSuccess:function(transport){container.innerHTML=originalHTML;target.href="http://twitter.com/home?status=Currently reading "+transport.responseText;}});}
else if(target.hasClassName('share_facebook')){window.open(target.href,'open_window','location, resizable, dependent, width=626, height=494, left=0, top=0');cancel(event);}
else if(target.hasClassName('subscribe')&&target.hasClassName('rss')){var list=target.up().down('ul');if(!list.visible()){target.blur();list.show();cancel(event);}}}
else if(target.nodeName.toLowerCase()=='img'){if($(target.parentNode).hasClassName('embiggen')){$('image').src=assetHost.asset_src('/images/misc/blank_5639.gif');$('image').src=target.parentNode.href;$('image').parentNode.href=$('image').src.gsub(/\.jpg/,'so.jpg');cancel(event);}
if($(target.parentNode).hasClassName('show_original')){images=this.prepareImages();if(images.length>1){var lightbox=new GalleryLightbox(images);lightbox.autosizeable();lightbox.activate();}else{var img=new Element('img',{src:$('image').parentNode.href})
var lightbox=new ManualLightbox();lightbox.autosizeable();lightbox.activate(function(){return img;}.bind(this),{'css_class':'original_image'});}
cancel(event);}
else{this.openItem(event,item);}}
else if(target.nodeName.toLowerCase()=='input'){if(target.hasClassName('permanent_link')){target.select();cancel(event);}}
else if(target.nodeName.toLowerCase()=='span'){if(ie()){var parent=target.up();}else{var parent=$(target.parentNode);}
if(parent.nodeName.toLowerCase()=='a'&&parent.hasClassName('favourite')){this.processFavourite(parent,item);cancel(event);}}
else{this.openItem(event,item);}},openItem:function(event,item){if(item&&!this.itemListController.isOpen(item)){var link=item.down('a.expand_item');this.toggleItemState(event,item,link);}},_expandItems:function(){return this._withItems()=='expand';},_popItems:function(){return this._withItems()=='pop';},_gotoItems:function(){return this._withItems()=='goto';},_withItems:function(){if(this.item_list.hasClassName('pop')){return'pop';}
else if(this.item_list.hasClassName('expand')){return'expand';}
return'goto';},toggleItemState:function(event,item,link){link.blur();switch(this._withItems()){case'pop':parts=['pop=true'];if(this.popLocationId){parts.push('location_id='+this.popLocationId);}
if(this.popCategoryId){parts.push('category_id='+this.popCategoryId);}
link.href=link.href+'?'+parts.join('&');if(link!=event.target){window.location.href=link.href;}
break;case'expand':this.itemListController.show(item);cancel(event);break;case'goto':if(event.target.nodeName.toLowerCase()!='a'){cancel(event);window.location.href=link;}
break;}},triggerAndUpdate:function(href,target,options){target.innerHTML=loadingHTML();options=$H({method:'get',onSuccess:function(){this.highlight();}.bind(target),on500:insertIntoDebugWindow,on503:insertIntoDebugWindow}).merge(options||$H());new Ajax.Updater(target,href,options.toObject());},triggerAndReplace:function(href,target,options){options=$H({method:'get',onSuccess:function(transport){this.replace(transport.responseText);this.highlight();}.bind(target),on500:insertIntoDebugWindow,on503:insertIntoDebugWindow}).merge(options||$H());new Ajax.Request(href,options.toObject());},showItemAction:function(action){return this.itemListController.visibleItem().displayController.showItemAction(action);},showContactForm:function(){return this.itemListController.visibleItem().displayController.showContactForm();},showExternalLink:function(){return this.itemListController.visibleItem().displayController.showExternalLink();},showLinkToAd:function(){return this.itemListController.visibleItem().displayController.showLinkToAd();},processFavourite:function(target,item){item.displayController.processFavourite(target.href);target.blur();},processPrint:function(item){item.displayController.processPrint();},togglePermalink:function(target){var permalink=target.next('.permanent_link');if(permalink){permalink.toggle();}else{var link=new Element('input',{value:target.href,'class':'permanent_link','type':'text'});target.parentNode.appendChild(link);}}});var SidebarItemDisplayHandler=Class.create(ItemDisplayHandler,{_withItems:function(){return'goto';},_itemsInList:function(){return this.item_list.getElementsBySelector('li');},clickHandler:function(event){var target=$(event.target);if(target.nodeName.toLowerCase()=='a'){var link=target;}
else if(target.nodeName.toLowerCase()=='li'){var link=target.down('a');}
else{var link=target.up('a');}
this.toggleItemState(event,target,link);}});var BrowseMenuHandler=Class.create({initialize:function(button){this.browseButton=$(button);this.locationSelector=null;this.categorySelector=null;this.selectors=$A([]);this.target=new Element('div',{'class':'push'});this.target.hide();this.browseButton.insert({bottom:this.target});this.browseButton.down('div.push').observe('click',this.clickHandler.bindAsEventListener(this));},clickHandler:function(event){var target=$(event.target);if(target.up().nodeName.toLowerCase()=='a'){target=target.up();}
if(target.hasClassName('location')){cancel(event);target.blur();if(!this.locationSelector){this.createLocationSelector();}
this.show(this.locationSelector);}
else if(target.hasClassName('category')){cancel(event);target.blur();if(!this.categorySelector){this.createCategorySelector();}
this.show(this.categorySelector);}},show:function(selector){var self_open=this.selectors.any(function(sel){return sel==selector&&sel.visible();});this.hideAll();if(self_open){return;}
selector.show();this.target.show();},hideAll:function(){this.selectors.each(function(selector){selector.hide();});this.target.hide();},createSelector:function(initial_content){var outer=new Element('div');var box={'container':outer,'content':outer};box.container.addClassName('subsubmenu');box.content.update(initial_content);box.container.hide();this.target.insert({bottom:box.container});this.selectors.push(box.container);return box;},createLocationSelector:function(){var box=this.createSelector(window.preloader.giveMe('locations'));this.locationSelector=box.container;this.locationSelectorContent=box.content;},createCategorySelector:function(href){var box=this.createSelector(window.preloader.giveMe('categories'));this.categorySelector=box.container;this.categorySelectorContent=box.content;}});var imageInfo=[];var DisplayItemCollection=Class.create({initialize:function(list_of_items){this.visible=null;this.items=list_of_items.collect(function(item){item.displayController=new DisplayItem(item);return item;});this.initItemPoller();window.hashController.addListener(this.openFromHash.bind(this));if(this.items.length==1&&this.items.first().hasClassName('opened')){this.visible=this.items.first();}
this.openFromHash(window.hashController.current());},visibleItem:function(){return this.visible;},isOpen:function(item){return item==this.visible;},show:function(item,scroll){scroll=scroll||false;if(this.visible&&this.visible==item){item.displayController.hide();this.visible=null;return;}
if(this.visible){this.visible.displayController.hide();this.visible=null;}
this.visible=item;this.visible.displayController.show(scroll);if(window.hashController.current()!=item.displayController.link.name){window.hashController.set(':'+item.displayController.link.name);}},findItemInHash:function(hash){if(hash.indexOf(':')==0){hash=hash.substring(1);}
return hash.blank()?'':hash;},openFromHash:function(name){name=this.findItemInHash(name);if(name.blank()){return true;}
var item=this.pollItems[name];if(item){if(this.visible!=item){this.show(item,true);}
return true;}
return false;},initItemPoller:function(){this.pollItems={};this.items.each(function(item){if(item.displayController.link){this.pollItems[item.displayController.link.name]=item;}}.bind(this));}});var DisplayItem=Class.create({initialize:function(item,options){this.item=item;this.contentContainer=item.down('.content');this.loading=false;this.loaded=false;this.link=item.down('a.expand_item')||item.down('li.ad_link a');this.href=null;this.item_url=null;if(this.link){this.href=this.link.href;var split_href=this.href.split('/');this.domain=split_href[2];this.item_url=split_href.last();}
this.options=options||{};this.scrollAnimation=null;this.scripts=$A();this.single_ad_page=this.item.nodeName.toString().toLowerCase()=='div';var idValues=item.id.split("_");this.itemType=idValues[0];this.id=idValues[1];this.cookieName='_cf_favourites_'+idValues[0]+'s';this.fixLinks();this.fireEvent('init');if(this.single_ad_page){this.incrementViewCounter();this.initDisplay();}
if(this.options.onInit){this.options.onInit(this);}},initDisplay:function(){this.convertAdLink();this.createCurrencyConverter();},scrollTo:function(){if(this.scrollAnimation){this.scrollAnimation.stop();this.scrollAnimation=null;}
this.scrollAnimation=new Effect.ScrollTo(this.item);},hide:function(){this.item.removeClassName('active');this.loading=false;this.displayShort();},show:function(scroll){scroll=scroll||this.scrollIfNeeded(this.item)||false;this.item.addClassName('active');if(this.loaded){this.displayLong();if(scroll){this.item.scrollTo();}
return;}
if(!this.longContent){this.scrollOnLoad=scroll;this.shortContent=this.contentContainer.innerHTML;this.displayLoading();new Ajax.Request(this.href,{method:'get',on500:insertIntoDebugWindow,onComplete:function(transport){if(!transport.responseText.blank()){this.load(transport.responseText);if(this.loading){this.displayLong(true);}}
if(this.scrollOnLoad){this.item.scrollTo();}
this.fixLinks();findLightboxTriggers.delay(0.1);this.loadMeasures();}.bind(this),onFailure:function(transport){this.displayShort();}.bind(this)});}},load:function(text){this.scripts=$A(text.extractScripts());var div=new Element('div');div.insert(text);this.longContent=div;this.loaded=true;},displayShort:function(){this.clearContentContainer();this.contentContainer.innerHTML=this.shortContent;this.fireEvent('close');MagicLinker.run();},displayLong:function(first_time){first_time=first_time||false;this.clearContentContainer();this.contentContainer.insert({top:this.longContent});if(first_time){this.favouriteTriggers=null;this.scripts.each(function(script){out=script.evalScripts();});this.initDisplay();}
if(first_time)this.fireEvent('initialOpen');this.fireEvent('open');MagicLinker.run();},convertAdLink:function(){var ad_link=this.item.down('.ad_link');var link_to_ad_translation=this.item.down('.ad_link span');this.item.down('#item_interactions').down('a.share_facebook').up('li').insert({after:'<li id="show_ad_box"><a class="title trigger_internal get_link" rel="nofollow" href="'+ad_link.down('a').href+'">'+link_to_ad_translation.innerHTML+'</a></li>'});ad_link.remove();},createCurrencyConverter:function(){if(container=this.item.down('.price_container')){new CurrencyLink(container);}},displayLoading:function(){this.loading=true;this.contentContainer.innerHTML=loadingHTML();},clearContentContainer:function(){this.contentContainer.childElements().each(function(element){element.remove();});},fireEvent:function(name){this.item.fire('displayItem:'+name,{'item':this.item,'href':this.href});},showContactForm:function(){var link=this.item.down('.contact_details .email a');if(!this.contactFormPrepared){this.contactFormPrepared=true;if(!link){return false;}
this.contactFormLink=link.href;this.contactFormContainer=new Element('div');link.insert({'after':this.contactFormContainer});link.up('.contact_item').addClassName('active');}
this.contactFormContainer.innerHTML=loadingHTML();new Ajax.Updater(this.contactFormContainer,this.contactFormLink,{method:'get',onComplete:function(){this.makeFormAJAXSubmit(this.contactFormContainer);initCVUploader();}.bind(this)});this.scrollIfNotVisible(link.up('.contact_item'));return true;},showExternalLink:function(){var preparedFirst=this.externalLinkPrepared;var link=this.item.down('.contact_details .link a');var container=new Element('div',{'class':'link_container'});if(!this.externalLinkPrepared){this.externalLinkPrepared=true;this.url=new Element('a',{'class':'full external','href':link.href,'rel':'external nofollow'});this.url.innerHTML=link.href.wordWrap(55,' ',true,2);LinkExternalizer.externalize(this.url);container.insert(this.url);link.insert({'after':container});link.removeClassName('trigger_external');link.setAttribute('rel',link.rel+" external");LinkExternalizer.externalize(link);link.up('.contact_item').addClassName('active');}
this.scrollIfNotVisible(link.up('.contact_item'));return!(preparedFirst||false);},showLinkToAd:function(){this.makeItemActionContainer();var link=this.item.down('#item_interactions #show_ad_box a');this.itemActionContainer.innerHTML='<div class="form_container"><h4>'+link.innerHTML+':</h4><div><input type="text" class="highlight_text_inside permanent_link" value="'+link.href+'" /></div></div>';this.scrollIfNotVisible(this.itemActionContainer);return true;},showItemAction:function(action){this.makeItemActionContainer();this.itemActionContainer.innerHTML=loadingHTML();new Ajax.Updater(this.itemActionContainer,action,{method:'get',onComplete:function(){this.makeFormAJAXSubmit(this.itemActionContainer);}.bind(this)});this.scrollIfNotVisible(this.itemActionContainer);return true;},makeItemActionContainer:function(){if(!this.itemActionContainer){this.itemActionContainer=new Element('div',{'class':'item_action_container'});this.item.down('#item_interactions').insert({'after':this.itemActionContainer});}},makeFormAJAXSubmit:function(container){var repeater=this.makeFormAJAXSubmit.curry(container).bind(this);var form=container.down('form');form.observe('submit',function(event){var form=this.down('form');new Ajax.Updater(this,form.action,{method:'post',parameters:form.serialize(),onComplete:function(){repeater();initCVUploader();}});cancel(event,true);this.innerHTML=loadingHTML();}.bind(container));form.findFirstElement().focus();},scrollIfNotVisible:function(item){if(document.viewport.getHeight()<item.viewportOffset()[1]+item.getHeight()){item.scrollTo();}},scrollIfNeeded:function(item){var needToScroll=false;if(item.viewportOffset()[1]<0||(document.viewport.getHeight()<item.viewportOffset()[1]+bottomThirdOfViewport())){needToScroll=true;}
return needToScroll;},getFavouriteTriggers:function(){if(!this.favouriteTriggers){this.favouriteTriggers=this.item.getElementsBySelector('a.favourite');if(this.longContent){this.favouriteTriggers=this.favouriteTriggers.concat(this.longContent.getElementsBySelector('a.favourite')).uniq();}}
return this.favouriteTriggers;},processFavourite:function(link){if(this.hasCookie()){this.toggleFavourites(this.setCookieFavourite());}else{this.toggleFavourites();this.requestFavourite(link);}},toggleFavourites:function(active){var set=(active===true||active===false);this.getFavouriteTriggers().each(function(element){if((set&&!active)||(!set&&element.hasClassName('active'))){element.removeClassName('active');element.innerHTML=I18n.t('add_to_favourites',{scope:'common'});}else{element.addClassName('active');element.innerHTML=I18n.t('remove_from_favourites',{scope:'common'});}}.bind(this));},requestFavourite:function(link){new Ajax.Request(link,{method:'get',onSuccess:function(transport){this.toggleFavourites(transport.responseText=="true");if(!cookiesEnabled())cookiesRequired();}.bind(this),onFailure:function(transport){this.toggleFavourites();}.bind(this)});},hasCookie:function(){return(readCookie(this.cookieName)!=null);},setCookieFavourite:function(){var items=readCookie(this.cookieName).split(escape("|"));var added=true;if(items.include(this.id)){items=items.without(this.id);added=false;}else{items.push(this.id);}
setCookie(this.cookieName,items.join(escape("|")));return added;},incrementViewCounter:function(){new Ajax.Request(this.actionableLink('viewed'));},processPrint:function(){window.open(this.actionableLink('print'));},fixLinks:function(){this.item.getElementsBySelector('a.actionable').each(function(a){match=a.className.toString().match(/\bdo_([a-z_]+)\b/);a.href=this.actionableLink(match[1]);a.removeClassName(match[0]);a.removeClassName('actionable');}.bind(this));},actionableLink:function(action){return'http://'+this.domain+'/'+[I18n.locale,'action',action].join('/')+'?item='+this.item_url}});var BrowseHighlighter=Class.create({initialize:function(terms){this.terms=$A();for(var i=0;i<terms.length;i++){this.terms.push(new termPattern(terms[i]));}
function termPattern(term){this.term=term;this.pattern=new RegExp('\\b'+this.term+'\\b','i');}},highlight:function(item){var nodes=this.getTextNodes(item);for(var j=0;j<this.terms.length;j++){var nodes_length=nodes.length;for(var i=0;i<nodes_length;i++){var parent=$(nodes[i].parentNode);if(parent&&this.highlightTerm(nodes[i],parent,this.terms[j])){nodes.remove(i);nodes=nodes.concat(this.getTextNodes(parent));i--;nodes_length=nodes.length;}}}},getTextNodes:function(element){var results=[],node=$(element).firstChild;while(node){if(node.nodeType===3){results.push(node);}
else if((node.className||'').match(/highlight/)){}
else if(node.hasChildNodes()){results=results.concat(this.getTextNodes(node));}
node=node.nextSibling;}
return results;},highlightTerm:function(node,parent,term){var nodeName=parent.nodeName.toString().toLowerCase();if(nodeName!='textarea'&&nodeName!='script'&&!parent.hasClassName('highlight')){var result=term.pattern.exec(node.nodeValue);if(result!=null){var value=node.nodeValue;var left=document.createTextNode(value.substr(0,result.index));var right=document.createTextNode(value.substr(result.index+result[0].length));var span=new Element('span',{'class':'highlight'}).insert(result[0]);parent.insertBefore(left,node);parent.insertBefore(span,node);parent.replaceChild(right,node);return true;}}
return false;}});Array.prototype.remove=function(from,to){var rest=this.slice((to||from)+1||this.length);this.length=from<0?this.length+from:from;return this.push.apply(this,rest);};function updateBrowseViewCounter(item){var view_count_source=item.down('div.view_count_source');var view_count_dest=item.down('span.view_counter');if(view_count_source&&view_count_dest){var match=view_count_source.className.toString().match(/view_count_([0-9]+)/);view_count_dest.innerHTML=match[1];view_count_source.removeClassName('view_count_source');view_count_source.removeClassName(match[0]);}}
window._scroller=null;window._itemList=null;MagicLinker.addSystem('classifieds',function(){var search_form=$('search_form');if(search_form){search_form.method='get';}
if(window.search_keywords){window.highLighter=new BrowseHighlighter(window.search_keywords);$('item_list').observe('displayItem:init',function(event){window.highLighter.highlight(event.memo['item']);});$('item_list').observe('displayItem:initialOpen',function(event){window.highLighter.highlight(event.memo['item'].down('div.item_display'));});}
var list=$('item_list');if(list){list.observe('displayItem:initialOpen',function(event){updateBrowseViewCounter(event.memo['item']);});}
var blank=new Image();blank.src=assetHost.asset_src('/images/misc/blank_5639.gif');if(obj=$("content")){window._itemList=new ItemDisplayHandler(obj);}
if(obj=$$('ul.additional_item_list').first()){window._sidebarItemList=new SidebarItemDisplayHandler(obj);}
if(obj=$("browse_menu")){new BrowseMenuHandler(obj);}
$('preload').getElementsBySelector('.location_ribbon li').each(function(li){li.show();});var scroller=$('ad_scroller');if(scroller){scroller.down().addClassName('scroller_with_js');window._scroller=new AutoScroller(scroller,{duration:1});}
window.actionable_linker=new Linker();window.actionable_linker.substituteAll('secondary');});MagicLinker.add('classifieds',function(){$$('.user_surface_area').each(function(surface_area){new SurfaceArea(surface_area);});});MagicLinker.add('classifieds',function(){$A(document.getElementsByTagName('textarea')).each(function(element){element=$(element);if(!element.hasClassName('autoresize')){element.addClassName('autoresize');new SmartTextAreaSize(element);}});});initCVUploader=function(){var cvUploader=$('cv_uploader');if(cvUploader){if(window.cvController){window.cvController.regular_uploader=cvUploader;window.cvController.initUploader();}
else{window.cvController=new PostCVHandler('cv_uploader',window.auth_token);}}};var PostCVHandler=Class.create({initialize:function(regular_uploader,auth){this.regular_uploader=$(regular_uploader);this.has_cv=$('_has_cv').value;this.auth_value=auth;this.initUploader();},initUploader:function(){this.regular_uploader.hide();this.createAjaxUploader(this.auth_value);this.regular_uploader.insert({after:this.ajaxy_uploader});this.ajaxy_uploader.show();},createAjaxUploader:function(auth){this.ajaxy_uploader=new Element('div',{'id':'ajaxy_uploader'}).hide();url='/en/action/upload_cv';this.iframe=new Element('iframe',{'name':'cv_target','id':'cv_target','class':'hidden-frame','style':'display:none'});this.asyncForm=new Element('form',{'target':'cv_target','method':'post','id':'cv_upload_form','encoding':'multipart/form-data','enctype':'multipart/form-data','action':url});this.cvFilename=new Element('input',{'type':'hidden','name':'cv_filename','id':'cv_file'});this.auth=new Element('input',{'type':'hidden','name':'authenticity_token','value':auth});this.remove=$('regular_delete');this.remove_link=$('regular_delete_link');this.remove_link.removeAttribute('href');this.remove_link.setStyle({cursor:"pointer"});this.remove_link.observe('click',this.deleteCV.bindAsEventListener(this));this.errorMessage=new Element('div',{'id':'upload_error_message','class':'error','style':'display:none'});this.formContainer=new Element('div',{'class':'upload_form_container'});this.selectText=new Element('div',{'id':'select_cv'});this.selectText.insert(I18n.t('select_cv',{scope:'jobs.cv'})+': ');this.asyncForm.insert(this.selectText);this.asyncForm.insert(this.cvFilename);this.asyncForm.insert(this.auth);this.formContainer.insert(this.asyncForm);this.loadingCV=new Element('div',{'class':'loading_in_progress'});this.loadingCV.innerHTML=loadingHTML();this.loadingCV.hide();this.additionals=new Element('div',{'class':'additional'});with(this.additionals){insert(this.formContainer);}
this.addAjaxUploaderToPage();this.loadingCV.setOpacity(0.8);},addAjaxUploaderToPage:function(){this.ajaxy_uploader.insert({bottom:this.additionals});this.ajaxy_uploader.insert({bottom:this.iframe});this.ajaxy_uploader.insert({bottom:this.loadingCV});this.ajaxy_uploader.insert({bottom:this.errorMessage});this.ajaxy_uploader.insert({bottom:this.remove});this.displayFormOrRemoveLink();this.createBrowseButton();},removeLink:function(){this.remove_link=$('regular_delete_link');this.remove_link.removeAttribute('href');this.remove_link.setStyle({cursor:"pointer"});this.remove_link.observe('click',this.deleteCV.bindAsEventListener(this));},displayFormOrRemoveLink:function(){if(this.has_cv){this.additionals.hide();this.remove.show();}else{this.additionals.show();this.remove.hide();}},uploadedCorrectly:function(){this.has_cv=true},deletedCorrectly:function(){this.has_cv=false},handleErrorMessage:function(errorString){var error_string=(errorString||'');this.errorMessage.innerHTML=error_string;if(error_string==''){this.errorMessage.hide();}else{this.errorMessage.show();}},createBrowseButton:function(){if(this.browseButton){this.browseButton.stopObserving();this.browseButton.remove();}
this.browseButton=new Element('input',{'type':'file','name':'post_cv','id':'browse_button','value':''});this.browseButton.observe('change',this.uploadCV.bindAsEventListener(this));this.asyncForm.insert({bottom:this.browseButton});},deleteCV:function(){request_url='/en/action/remove_cv/';request_params='';this.remove.hide();this.loadingCV.show();new Ajax.Request(request_url,{method:'get',asynchronous:true,evalScripts:true,parameters:request_params,onComplete:function(){this.loadingCV.hide();this.additionals.show();}.bind(this),onError:function(){this.handleErrorMessage("There was an error removing your CV");}.bind(this)});return false;},uploadCV:function(event){this.uploadingState(true);this.cvFilename.value=this.browseButton.value;this.asyncForm.submit();this.createBrowseButton();this.handleErrorMessage();},uploadingState:function(uploading){if(uploading==true){this.handleBrowseButton(false);this.loadingCV.show();}else{this.handleBrowseButton(true);this.loadingCV.hide();}},handleBrowseButton:function(state){if(state){this.asyncForm.show();}else{this.asyncForm.hide();}}});var SurfaceArea=Class.create({initialize:function(container){this.cookie_name='_cf_surface_area_unit';this.container=container;this.unit=this._readValue()||'metres';this.container.insert({bottom:'(<a href="#" class="toggle"></a>)'});this.link=this.container.down('.toggle');this.link.observe('click',function(event){event.target.blur();cancel(event,true);this.toggle();}.bindAsEventListener(this));this.show(this.unit,false);},unobserve:function(){this.link.stopObserving('click');},toggle:function(){if(this.unit=='feet'){this.show('metres');}
else{this.show('feet');}},show:function(unit){['metres','feet','divider'].each(function(piece){if(piece==unit){this.container.down('.'+piece).show();}
else{this.container.down('.'+piece).hide();}}.bind(this));this.link.innerHTML={'metres':'ft²','feet':'m²'}[unit];if(arguments.length==1||arguments[1]==true){this.setUnit(unit);}},convert_to_m2:function(value){return this.convert_to(value,'m2');},convert_to_ft2:function(value){return this.convert_to(value,'ft2');},convert_to:function(value,unit){fvalue=parseFloat(value);if(!isNaN(fvalue)){var ret_value;switch(unit){case'm2':ret_value=fvalue*0.09290304;break;case'ft2':ret_value=fvalue*10.7639104;break;}
return Math.round(ret_value);}
else{return value;}},setUnit:function(unit){this.unit=unit;this._storeValue();},_readValue:function(){return readCookie(this.cookie_name);},_storeValue:function(){setCookie(this.cookie_name,this.unit);new Ajax.Request('/'+I18n.locale+'/set_regional_settings',{method:'get',asynchronous:true,parameters:{'account[units_in_m2]':this.unit=='metres'}});}});var CurrencyLink=Class.create({initialize:function(container){this.cookie_name='_cf_currency_pref';this.container=container;this.price=this.getPrice();this.ad_currency=this.getAdCurrency();this.user_currency=this._readValue()||this.ad_currency;this.getAlternate();if(this.currencyRate(this.ad_currency)){this.container.insert({bottom:'<span class="alternate_currency"><a title="'+
I18n.t('convert_to_another_currency',{scope:'common'})+'" href="#" class="alternate_currency_link"></a></span>'});this.link=this.container.down('.alternate_currency_link');this.link.observe('click',function(event){event.target.blur();cancel(event,true);this.toggleCurrencySelector();this.updateLink();}.bindAsEventListener(this));this.updateLink(this.user_currency);}},unobserve:function(){this.link.stopObserving('click');this.currency_list.stopObserving('change');},currencyListInit:function(){this.selector=new Element("span",{'class':'currency_selector'});this.container.insert({bottom:this.selector});this.selector.innerHTML='<br />'+loadingHTML('small_loading');new Ajax.Request('/'+I18n.locale+'/currency_selector',{method:'get',asynchronous:true,onSuccess:function(response){this.selector.replace(response.responseText);this.currency_list=this.container.down('.currency_list');this.currency_list.observe('change',this.changeCurrency.bind(this));this.currency_list.show();}.bind(this)});},updateLink:function(){if(this.alternate==0){this.link.innerHTML='$€₤¥…?';}
else{this.link.innerHTML=this.converted(this.getPrice());}},convertable:function(){return(this.price&&this.currencyRate(this.alternate)&&this.currencyRate(this.ad_currency));},converted:function(price){if(this.convertable()){priceEur=price/this.currencyRate(this.ad_currency);priceAlt=priceEur*this.currencyRate(this.alternate);rounded=priceAlt.toMoney(0,I18n.locale=='en'?'.':',',I18n.locale=='en'?',':'.');return'~ '+this.currencySymbol(this.alternate)+' '+rounded;}
else{return this.currencyCode(this.alternate)+' '+I18n.t('not_available',{scope:'common'});}},getPrice:function(){found=false;if(this.container){this.container.down('.price_amount').classNames().each(function(name,index){ret=name.match(/amount_(\d+)/);if(ret&&ret[1]){found=ret[1];}});}
else{found=false;}
return found;},getAdCurrency:function(){var retrieve;if(this.container){this.container.down('span.currency').classNames().each(function(name,index){ret=name.match(/curid_(\d+)/);if(ret&&ret[1]){retrieve=ret[1];}});}
return retrieve;},getAlternate:function(){if(this.ad_currency==this.currency){this.alternate=0;}
else{this.alternate=this.user_currency;}},updateCurrency:function(selected){this.setCurrency(selected);this.getAlternate();this.updateLink();},toggleCurrencySelector:function(){if(this.currency_list){this.currency_list.toggle();}
else{this.currencyListInit();}},changeCurrency:function(event){event.target.blur();cancel(event,true);this.updateCurrency(this.currency_list.options[this.currency_list.selectedIndex].value);this.currency_list.hide();},setCurrency:function(currency){this.user_currency=currency;this._storeValue();},currencySymbol:function(curid){return this._currencyAttr('symbol',curid);},currencyCode:function(curid){return this._currencyAttr('code',curid);},currencyRate:function(curid){return this._currencyAttr('rate',curid);},_currencyAttr:function(prop,curid){curObj=$H(Currencies).find(function(cur){return(cur[1]&&cur[1]['id']&&cur[1]['id']==curid)});if(curObj&&curObj[1]&&curObj[1][prop]){return curObj[1][prop];}
return false;},_readValue:function(){return readCookie(this.cookie_name);},_storeValue:function(){setCookie(this.cookie_name,this.user_currency);new Ajax.Request('/'+I18n.locale+'/set_regional_settings',{method:'get',asynchronous:true,parameters:{'account[currency_id]':this.user_currency}});}});Number.prototype.toMoney=function(floatPoint,decimalSep,thousandSep){var number=this,floatPoint=isNaN(floatPoint=Math.abs(floatPoint))?2:floatPoint,decimalSep=decimalSep==undefined?",":decimalSep,thousandSep=thousandSep==undefined?".":thousandSep,sign=number<0?"-":"",i=parseInt(number=Math.abs(+number||0).toFixed(floatPoint))+"",j=(j=i.length)>3?j%3:0;return sign+
(j?i.substr(0,j)+thousandSep:"")+
i.substr(j).replace(/(\d{3})(?=\d)/g,"$1"+thousandSep)+
(floatPoint?decimalSep+Math.abs(n-i).toFixed(floatPoint).slice(2):"");};var PostImagesHandler=Class.create({initialize:function(regular_uploader,item_name,auth){this.regular_uploader=$(regular_uploader);this.item_name=item_name;this.auth_value=auth;this.form=$('edit_item');this.latest_image_index=0;this.initUploader();this.form_submit=$('edit_item_submit');},initUploader:function(){this.regular_uploader.hide();this.createAjaxUploader(this.item_name,this.auth_value);this.regular_uploader.insert({after:this.ajaxy_uploader});this.ajaxy_uploader.show();},createAjaxUploader:function(item_name,auth){if(this.ajaxy_uploader)return;this.ajaxy_uploader=new Element('div',{'id':'ajaxy_uploader'}).hide();url='/'+I18n.locale+'/upload_image';if(item_name){url+='?item='+item_name;}
this.imagesContainer=new Element('div',{'id':'thumbnails_container'});this.iframe=new Element('iframe',{'name':'image_target','id':'image_target','class':'hidden-frame','style':'display:none'});this.asyncForm=new Element('form',{'target':'image_target','method':'post','id':'image_upload_form','encoding':'multipart/form-data','enctype':'multipart/form-data','action':url});this.imageFilename=new Element('input',{'type':'hidden','name':'image_filename','id':'image_file'});this.auth=new Element('input',{'type':'hidden','name':'authenticity_token','value':auth});this.selectedImage=$('selected_image');this.bigImage=new Element('div',{'id':'big_image','class':'main'});this.bigImage.innerHTML='<div><img id="image" class="post_selected_image" src="'+assetHost.asset_src('/images/misc/blank_5639.gif')+'" /></div>';this.errorMessage=new Element('div',{'id':'upload_error_message','class':'error','style':'display:none'});this.formContainer=new Element('div',{'class':'upload_form_container'});this.asyncForm.insert(I18n.t('select_image',{scope:'common'})+': ');this.asyncForm.insert(this.imageFilename);this.asyncForm.insert(this.auth);this.formContainer.insert(this.asyncForm);this.loadingImage=new Element('div',{'class':'loading_in_progress'});this.loadingImage.innerHTML=loadingHTML();this.additionals=new Element('div',{'class':'additional'});with(this.additionals){insert(this.formContainer);insert(this.imagesContainer);}
this.addAjaxUploaderToPage();this.loadingImage.setOpacity(0.8);this.bigImage.observe('click',this.actionOnImage.bindAsEventListener(this));this.imagesContainer.observe('click',this.actionOnImage.bindAsEventListener(this));},addAjaxUploaderToPage:function(){this.ajaxy_uploader.insert({bottom:this.additionals});this.ajaxy_uploader.insert({bottom:this.bigImage});this.ajaxy_uploader.insert({bottom:this.iframe});this.ajaxy_uploader.insert({bottom:this.loadingImage});this.ajaxy_uploader.insert({bottom:this.errorMessage});this.createBrowseButton();},handleErrorMessage:function(errorString){var error_string=(errorString||'');this.errorMessage.innerHTML=error_string;if(error_string==''){this.errorMessage.hide();}else{this.errorMessage.show();}},createBrowseButton:function(){if(this.browseButton){this.browseButton.stopObserving();this.browseButton.remove();}
this.browseButton=new Element('input',{'type':'file','name':'post_images','id':'browse_button','size':'10','value':''});this.browseButton.observe('change',this.uploadImage.bindAsEventListener(this));this.asyncForm.insert({bottom:this.browseButton});},actionOnImage:function(event){element=event.element();do{match=(element.className||'').match(/\b(delete|select)(?:_([0-9]+))?\b/);if(match){switch(match[1]){case'select':this.selectImage(match[2]);break;case'delete':this.deleteImage(match[2]);break;}
cancel(event);return;}}while((element=element.parentNode));},selectImage:function(selected_index,target){this.selectedImage.value=selected_index;this.updateSelectedImage();},deleteImage:function(image_to_delete){request_url='/'+I18n.locale+'/delete_image/'+image_to_delete;request_params='';if(this.item_name){request_params+='item='+this.item_name;}
if(image_to_delete<this.selectedImage.value){this.selectedImage.value=this.selectedImage.value-1;}else if(image_to_delete==this.selectedImage.value){this.selectedImage.value=1;}
new Ajax.Request(request_url,{method:'get',asynchronous:true,evalScripts:true,parameters:request_params,onComplete:function(request){this.handleBrowseButton(true);this.handleErrorMessage();this.setFormAsModified();}.bind(this)});return false;},loadImages:function(){request_params='';if(this.item_name){request_params+='item='+this.item_name;}
new Ajax.Request('/'+I18n.locale+'/load_images',{method:'get',asynchronous:true,evalScripts:true,onComplete:function(request){this.updateSelectedImage();}.bind(this),parameters:request_params});return false;},updateSelectedImage:function(){selected_thumbs=$$('.item_thumbnail.'+this.selectedImage.value.toString());if(selected_thumbs&&selected_thumbs.first()){selected_thumbs.first().addClassName('marked');}
search=$$('.item_thumbnail.marked a.embiggen');if(search&&search.first()){$('image').src=search.first().href;}else{$('image').src=assetHost.asset_src('/images/misc/blank_5639.gif');}},uploadImage:function(event){this.uploadingState(true);this.imageFilename.value=this.browseButton.value;this.asyncForm.submit();this.createBrowseButton();this.handleErrorMessage();},adjust_thumbnail:function(left,top,percent,mp,source_filepath,item_id){this.thumbnail_adjuster=new Thumbnailer(left,top,percent,mp,source_filepath,this.latest_image_index,this.auth,item_id);},uploadingState:function(uploading){if(uploading==true){this.handleBrowseButton(false);this.loadingImage.show();}else{this.handleBrowseButton(true);this.loadingImage.hide();}},handleBrowseButton:function(state){if(state){this.asyncForm.show();this.form_submit.enable();}else{this.asyncForm.hide();this.form_submit.disable();}},disableForm:function(){this.asyncForm.hide();this.form_submit.enable();},setFormAsModified:function(){var modified=new Element('input',{'type':'hidden','name':'modified'});this.form.insert(modified);}});Object.extend(Event,{wheel:function(event){var delta=0;if(!event)event=window.event;if(event.wheelDelta){if(event.wheelDelta<0)delta=1;else if(event.wheelDelta>0)delta=-1;if(window.opera)delta=-delta;}else if(event.detail){delta=!!event.detail*(event.detail>0?1:-1);}
event.preventDefault();return Math.round(delta);}});function ImageResize(element,width,height,_left_offset,_top_offset,_percent,_min_percent)
{var element=$(element);var parent='';var width=(typeof width!='undefined')?width:400;var height=(typeof height!='undefined')?height:400;var in_left_offset=_left_offset;var in_top_offset=_top_offset;var in_percent=_percent;var in_min_percent=_min_percent;imageX=(typeof imagex!='undefined')?$(imagex):$('imagex');imageY=(typeof imagey!='undefined')?$(imagey):$('imagey');imageSize=(typeof imagesize!='undefined')?$(imagesize):$('imagesize');allow_resize=(typeof allow_resize!='undefined')?allow_resize:true;var originSize,initialScale;var mouseDownX,mouseDownY;var newOffsetX,newOffsetY;var up_ratio,zoom_factor;function init()
{parent=element.getOffsetParent()
parent.observe('mousedown',panMouseDown);parent.observe("mousewheel",panMouseWheel);parent.observe("DOMMouseScroll",panMouseWheel);element.onmousedown=element.onmousemove=function(){return false;};parent.setStyle({width:width+'px',height:height+'px'});if(!allow_resize)return false;originSize=element.getDimensions();var image_min=Math.min(originSize.width,originSize.height);var box_max=Math.max(width,height);var down_ratio=box_max/image_min;up_ratio=image_min/box_max;zoom_factor=up_ratio/100;initialScale={width:Math.ceil(originSize.width*down_ratio),height:Math.ceil(originSize.height*down_ratio)};element.setStyle({width:initialScale.width+'px',height:initialScale.height+'px'});imageSize.writeAttribute('value',initialScale.width+'x'+initialScale.height);setCropParams(in_left_offset,in_top_offset,in_percent,in_min_percent);}
function panMouseWheel(event){changeZoom(Event.wheel(event));}
function panMouseDown(event)
{mouseDownX=event.pointerX();mouseDownY=event.pointerY();$(document.body).observe('mousemove',panMouseMove);$(document.body).observe('mouseup',panMouseUp);var left=parseInt(element.getStyle('left'),10);var top=parseInt(element.getStyle('top'),10);imageX.writeAttribute('value',left);imageY.writeAttribute('value',top);}
function panMouseUp(event)
{var dimensions=element.getDimensions();imageX.writeAttribute('value',newOffsetX);imageY.writeAttribute('value',newOffsetY);$(document.body).stopObserving('mousemove',panMouseMove);$(document.body).stopObserving('mouseup',panMouseUp);}
function panMouseMove(event)
{var dimensions=element.getDimensions();var x=event.pointerX()-mouseDownX;var y=event.pointerY()-mouseDownY;var offsetX=parseInt(imageX.readAttribute('value'),10)?parseInt(imageX.readAttribute('value'),10)+x:x;var offsetY=parseInt(imageY.readAttribute('value'),10)?parseInt(imageY.readAttribute('value'),10)+y:y;offsetX=newOffsetX=(offsetX>=0)?0:(offsetX+dimensions.width<width)?(-1*dimensions.width+width):offsetX;offsetY=newOffsetY=(offsetY>=0)?0:(offsetY+dimensions.height<height)?(-1*dimensions.height+height):offsetY;element.setStyle({left:offsetX+'px',top:offsetY+'px'});}
function scaleSlideMove(value)
{var dimensions=element.getDimensions();var newWidth=Math.ceil(initialScale.width*value);var newHeight=Math.ceil(initialScale.height*value);element.setStyle({width:newWidth+'px',height:newHeight+'px'});var left=parseInt(element.getStyle('left'),10);var top=parseInt(element.getStyle('top'),10);var left_pixels=(newWidth-dimensions.width)/2;var top_pixels=(newHeight-dimensions.height)/2;var newLeft=left-left_pixels.round();element.style.left=newLeft+'px';var newTop=top-top_pixels.round();element.style.top=newTop+'px';}
var zoom_modifier=5;var zoom_percent=20;var min_percent=100;function zoomInPercent(percent){if(percent>100)percent=100;if(percent<min_percent)percent=min_percent;if(percent<=0)percent=1;factor=percent.round()*zoom_factor;scaleSlideMove(factor);zoom_percent=percent;return true;};function changeZoom(multiplicator){var multiplicator=multiplicator?multiplicator:1;zoomInPercent(zoom_percent-(zoom_modifier*multiplicator));}
function setCropParams(left,top,percent,mp){left=(left?left:0);imageX.writeAttribute('value',left+'x');top=(top?top:0);imageY.writeAttribute('value',top+'x');percent=(percent?percent:0);min_percent=mp?mp:0;zoomInPercent(percent);element.setStyle({left:left+'px',top:top+'px'});}
this.increaseZoom=function(){changeZoom(-1);}
this.decreaseZoom=function(){changeZoom(1);}
this.getCropParams=function(){return{'left':parseInt(element.getStyle('left'),10),'top':parseInt(element.getStyle('top'),10),'percent':zoom_percent}}
init.delay(0.5);}
var CropDraggable=Class.create();Object.extend(Object.extend(CropDraggable.prototype,Draggable.prototype),{initialize:function(element){this.options=Object.extend({drawMethod:function(){}},arguments[1]||{});this.element=$(element);this.handle=this.element;this.delta=this.currentDelta();this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this);},draw:function(point){var pos=Position.cumulativeOffset(this.element);var d=this.currentDelta();pos[0]-=d[0];pos[1]-=d[1];var p=[0,1].map(function(i){return(point[i]-pos[i]-this.offset[i])}.bind(this));this.options.drawMethod(p);}});var Cropper={};Cropper.Img=Class.create();Cropper.Img.prototype={initialize:function(element,options){this.options=Object.extend({ratioDim:{x:0,y:0},minWidth:0,minHeight:0,displayOnInit:false,onEndCrop:Prototype.emptyFunction,captureKeys:true,onloadCoords:null,maxWidth:0,maxHeight:0},options||{});this.img=$(element);this.clickCoords={x:0,y:0};this.dragging=false;this.resizing=false;this.isWebKit=/Konqueror|Safari|KHTML/.test(navigator.userAgent);this.isIE=/MSIE/.test(navigator.userAgent);this.isOpera8=/Opera\s[1-8]/.test(navigator.userAgent);this.ratioX=0;this.ratioY=0;this.attached=false;this.fixedWidth=(this.options.maxWidth>0&&(this.options.minWidth>=this.options.maxWidth));this.fixedHeight=(this.options.maxHeight>0&&(this.options.minHeight>=this.options.maxHeight));if(typeof this.img=='undefined')return;$A(document.getElementsByTagName('script')).each(function(s){if(s.src.match(/cropper\.js/)){var path=s.src.replace(/cropper\.js(.*)?/,'');var style=document.createElement('link');style.rel='stylesheet';style.type='text/css';style.href=path+'cropper.css';style.media='screen';document.getElementsByTagName('head')[0].appendChild(style);}});if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0){var gcd=this.getGCD(this.options.ratioDim.x,this.options.ratioDim.y);this.ratioX=this.options.ratioDim.x/gcd;this.ratioY=this.options.ratioDim.y/gcd;}
this.subInitialize();if(this.img.complete||this.isWebKit)this.onLoad();else Event.observe(this.img,'load',this.onLoad.bindAsEventListener(this));},getGCD:function(a,b){if(b==0)return a;return this.getGCD(b,a%b);},onLoad:function(){var cNamePrefix='imgCrop_';var insertPoint=this.img.parentNode;var fixOperaClass='';if(this.isOpera8)fixOperaClass=' opera8';this.imgWrap=Builder.node('div',{'class':cNamePrefix+'wrap'+fixOperaClass});this.north=Builder.node('div',{'class':cNamePrefix+'overlay '+cNamePrefix+'north'},[Builder.node('span')]);this.east=Builder.node('div',{'class':cNamePrefix+'overlay '+cNamePrefix+'east'},[Builder.node('span')]);this.south=Builder.node('div',{'class':cNamePrefix+'overlay '+cNamePrefix+'south'},[Builder.node('span')]);this.west=Builder.node('div',{'class':cNamePrefix+'overlay '+cNamePrefix+'west'},[Builder.node('span')]);var overlays=[this.north,this.east,this.south,this.west];this.dragArea=Builder.node('div',{'class':cNamePrefix+'dragArea'},overlays);this.handleN=Builder.node('div',{'class':cNamePrefix+'handle '+cNamePrefix+'handleN'});this.handleNE=Builder.node('div',{'class':cNamePrefix+'handle '+cNamePrefix+'handleNE'});this.handleE=Builder.node('div',{'class':cNamePrefix+'handle '+cNamePrefix+'handleE'});this.handleSE=Builder.node('div',{'class':cNamePrefix+'handle '+cNamePrefix+'handleSE'});this.handleS=Builder.node('div',{'class':cNamePrefix+'handle '+cNamePrefix+'handleS'});this.handleSW=Builder.node('div',{'class':cNamePrefix+'handle '+cNamePrefix+'handleSW'});this.handleW=Builder.node('div',{'class':cNamePrefix+'handle '+cNamePrefix+'handleW'});this.handleNW=Builder.node('div',{'class':cNamePrefix+'handle '+cNamePrefix+'handleNW'});this.selArea=Builder.node('div',{'class':cNamePrefix+'selArea'},[Builder.node('div',{'class':cNamePrefix+'marqueeHoriz '+cNamePrefix+'marqueeNorth'},[Builder.node('span')]),Builder.node('div',{'class':cNamePrefix+'marqueeVert '+cNamePrefix+'marqueeEast'},[Builder.node('span')]),Builder.node('div',{'class':cNamePrefix+'marqueeHoriz '+cNamePrefix+'marqueeSouth'},[Builder.node('span')]),Builder.node('div',{'class':cNamePrefix+'marqueeVert '+cNamePrefix+'marqueeWest'},[Builder.node('span')]),this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW,Builder.node('div',{'class':cNamePrefix+'clickArea'})]);this.imgWrap.appendChild(this.img);this.imgWrap.appendChild(this.dragArea);this.dragArea.appendChild(this.selArea);this.dragArea.appendChild(Builder.node('div',{'class':cNamePrefix+'clickArea'}));insertPoint.appendChild(this.imgWrap);this.startDragBind=this.startDrag.bindAsEventListener(this);Event.observe(this.dragArea,'mousedown',this.startDragBind);this.onDragBind=this.onDrag.bindAsEventListener(this);Event.observe(document,'mousemove',this.onDragBind);this.endCropBind=this.endCrop.bindAsEventListener(this);Event.observe(document,'mouseup',this.endCropBind);this.resizeBind=this.startResize.bindAsEventListener(this);this.handles=[this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW];this.registerHandles(true);if(this.options.captureKeys){this.keysBind=this.handleKeys.bindAsEventListener(this);Event.observe(document,'keypress',this.keysBind);}
new CropDraggable(this.selArea,{drawMethod:this.moveArea.bindAsEventListener(this)});this.setParams();},registerHandles:function(registration){for(var i=0;i<this.handles.length;i++){var handle=$(this.handles[i]);if(registration){var hideHandle=false;if(this.fixedWidth&&this.fixedHeight)hideHandle=true;else if(this.fixedWidth||this.fixedHeight){var isCornerHandle=handle.className.match(/([S|N][E|W])$/)
var isWidthHandle=handle.className.match(/(E|W)$/);var isHeightHandle=handle.className.match(/(N|S)$/);if(isCornerHandle)hideHandle=true;else if(this.fixedWidth&&isWidthHandle)hideHandle=true;else if(this.fixedHeight&&isHeightHandle)hideHandle=true;}
if(hideHandle)handle.hide();else Event.observe(handle,'mousedown',this.resizeBind);}else{handle.show();Event.stopObserving(handle,'mousedown',this.resizeBind);}}},setParams:function(){this.imgW=this.img.width;this.imgH=this.img.height;$(this.north).setStyle({height:0});$(this.east).setStyle({width:0,height:0});$(this.south).setStyle({height:0});$(this.west).setStyle({width:0,height:0});$(this.imgWrap).setStyle({'width':this.imgW+'px','height':this.imgH+'px'});$(this.selArea).hide();var startCoords={x1:0,y1:0,x2:0,y2:0};var validCoordsSet=false;if(this.options.onloadCoords!=null){startCoords=this.cloneCoords(this.options.onloadCoords);validCoordsSet=true;}else if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0){startCoords.x1=Math.ceil((this.imgW-this.options.ratioDim.x)/2);startCoords.y1=Math.ceil((this.imgH-this.options.ratioDim.y)/2);startCoords.x2=startCoords.x1+this.options.ratioDim.x;startCoords.y2=startCoords.y1+this.options.ratioDim.y;validCoordsSet=true;}
this.setAreaCoords(startCoords,false,false,1);if(this.options.displayOnInit&&validCoordsSet){this.selArea.show();this.drawArea();this.endCrop();}
this.attached=true;},remove:function(){if(this.attached){this.attached=false;this.imgWrap.parentNode.insertBefore(this.img,this.imgWrap);this.imgWrap.parentNode.removeChild(this.imgWrap);Event.stopObserving(this.dragArea,'mousedown',this.startDragBind);Event.stopObserving(document,'mousemove',this.onDragBind);Event.stopObserving(document,'mouseup',this.endCropBind);this.registerHandles(false);if(this.options.captureKeys)Event.stopObserving(document,'keypress',this.keysBind);}},reset:function(){if(!this.attached)this.onLoad();else this.setParams();this.endCrop();},handleKeys:function(e){var dir={x:0,y:0};if(!this.dragging){switch(e.keyCode){case(37):dir.x=-1;break;case(38):dir.y=-1;break;case(39):dir.x=1;break
case(40):dir.y=1;break;}
if(dir.x!=0||dir.y!=0){if(e.shiftKey){dir.x*=10;dir.y*=10;}
this.moveArea([this.areaCoords.x1+dir.x,this.areaCoords.y1+dir.y]);Event.stop(e);}}},calcW:function(){return(this.areaCoords.x2-this.areaCoords.x1)},calcH:function(){return(this.areaCoords.y2-this.areaCoords.y1)},moveArea:function(point){this.setAreaCoords({x1:point[0],y1:point[1],x2:point[0]+this.calcW(),y2:point[1]+this.calcH()},true,false);this.drawArea();},cloneCoords:function(coords){return{x1:coords.x1,y1:coords.y1,x2:coords.x2,y2:coords.y2};},setAreaCoords:function(coords,moving,square,direction,resizeHandle){if(moving){var targW=coords.x2-coords.x1;var targH=coords.y2-coords.y1;if(coords.x1<0){coords.x1=0;coords.x2=targW;}
if(coords.y1<0){coords.y1=0;coords.y2=targH;}
if(coords.x2>this.imgW){coords.x2=this.imgW;coords.x1=this.imgW-targW;}
if(coords.y2>this.imgH){coords.y2=this.imgH;coords.y1=this.imgH-targH;}}else{if(coords.x1<0)coords.x1=0;if(coords.y1<0)coords.y1=0;if(coords.x2>this.imgW)coords.x2=this.imgW;if(coords.y2>this.imgH)coords.y2=this.imgH;if(direction!=null){if(this.ratioX>0)this.applyRatio(coords,{x:this.ratioX,y:this.ratioY},direction,resizeHandle);else if(square)this.applyRatio(coords,{x:1,y:1},direction,resizeHandle);var mins=[this.options.minWidth,this.options.minHeight];var maxs=[this.options.maxWidth,this.options.maxHeight];if(mins[0]>0||mins[1]>0||maxs[0]>0||maxs[1]>0){var coordsTransX={a1:coords.x1,a2:coords.x2};var coordsTransY={a1:coords.y1,a2:coords.y2};var boundsX={min:0,max:this.imgW};var boundsY={min:0,max:this.imgH};if((mins[0]!=0||mins[1]!=0)&&square){if(mins[0]>0)mins[1]=mins[0];else if(mins[1]>0)mins[0]=mins[1];}
if((maxs[0]!=0||maxs[0]!=0)&&square){if(maxs[0]>0&&maxs[0]<=maxs[1])maxs[1]=maxs[0];else if(maxs[1]>0&&maxs[1]<=maxs[0])maxs[0]=maxs[1];}
if(mins[0]>0)this.applyDimRestriction(coordsTransX,mins[0],direction.x,boundsX,'min');if(mins[1]>1)this.applyDimRestriction(coordsTransY,mins[1],direction.y,boundsY,'min');if(maxs[0]>0)this.applyDimRestriction(coordsTransX,maxs[0],direction.x,boundsX,'max');if(maxs[1]>1)this.applyDimRestriction(coordsTransY,maxs[1],direction.y,boundsY,'max');coords={x1:coordsTransX.a1,y1:coordsTransY.a1,x2:coordsTransX.a2,y2:coordsTransY.a2};}}}
this.areaCoords=coords;},applyDimRestriction:function(coords,val,direction,bounds,type){var check;if(type=='min')check=((coords.a2-coords.a1)<val);else check=((coords.a2-coords.a1)>val);if(check){if(direction==1)coords.a2=coords.a1+val;else coords.a1=coords.a2-val;if(coords.a1<bounds.min){coords.a1=bounds.min;coords.a2=val;}else if(coords.a2>bounds.max){coords.a1=bounds.max-val;coords.a2=bounds.max;}}},applyRatio:function(coords,ratio,direction,resizeHandle){var newCoords;if(resizeHandle=='N'||resizeHandle=='S'){newCoords=this.applyRatioToAxis({a1:coords.y1,b1:coords.x1,a2:coords.y2,b2:coords.x2},{a:ratio.y,b:ratio.x},{a:direction.y,b:direction.x},{min:0,max:this.imgW});coords.x1=newCoords.b1;coords.y1=newCoords.a1;coords.x2=newCoords.b2;coords.y2=newCoords.a2;}else{newCoords=this.applyRatioToAxis({a1:coords.x1,b1:coords.y1,a2:coords.x2,b2:coords.y2},{a:ratio.x,b:ratio.y},{a:direction.x,b:direction.y},{min:0,max:this.imgH});coords.x1=newCoords.a1;coords.y1=newCoords.b1;coords.x2=newCoords.a2;coords.y2=newCoords.b2;}},applyRatioToAxis:function(coords,ratio,direction,bounds){var newCoords=Object.extend(coords,{});var calcDimA=newCoords.a2-newCoords.a1;var targDimB=Math.floor(calcDimA*ratio.b/ratio.a);var targB;var targDimA;var calcDimB=null;if(direction.b==1){targB=newCoords.b1+targDimB;if(targB>bounds.max){targB=bounds.max;calcDimB=targB-newCoords.b1;}
newCoords.b2=targB;}else{targB=newCoords.b2-targDimB;if(targB<bounds.min){targB=bounds.min;calcDimB=targB+newCoords.b2;}
newCoords.b1=targB;}
if(calcDimB!=null){targDimA=Math.floor(calcDimB*ratio.a/ratio.b);if(direction.a==1)newCoords.a2=newCoords.a1+targDimA;else newCoords.a1=newCoords.a1=newCoords.a2-targDimA;}
return newCoords;},drawArea:function(){var areaWidth=this.calcW();var areaHeight=this.calcH();var px='px';var params=[this.areaCoords.x1+px,this.areaCoords.y1+px,areaWidth+px,areaHeight+px,this.areaCoords.x2+px,this.areaCoords.y2+px,(this.img.width-this.areaCoords.x2)+px,(this.img.height-this.areaCoords.y2)+px];var areaStyle=this.selArea.style;areaStyle.left=params[0];areaStyle.top=params[1];areaStyle.width=params[2];areaStyle.height=params[3];var horizHandlePos=Math.ceil((areaWidth-6)/2)+px;var vertHandlePos=Math.ceil((areaHeight-6)/2)+px;this.handleN.style.left=horizHandlePos;this.handleE.style.top=vertHandlePos;this.handleS.style.left=horizHandlePos;this.handleW.style.top=vertHandlePos;this.north.style.height=params[1];var eastStyle=this.east.style;eastStyle.top=params[1];eastStyle.height=params[3];eastStyle.left=params[4];eastStyle.width=params[6];var southStyle=this.south.style;southStyle.top=params[5];southStyle.height=params[7];var westStyle=this.west.style;westStyle.top=params[1];westStyle.height=params[3];westStyle.width=params[0];this.subDrawArea();this.forceReRender();},forceReRender:function(){if(this.isIE||this.isWebKit){var n=document.createTextNode(' ');var d,el,fixEL,i;if(this.isIE)fixEl=this.selArea;else if(this.isWebKit){fixEl=document.getElementsByClassName('imgCrop_marqueeSouth',this.imgWrap)[0];d=Builder.node('div','');d.style.visibility='hidden';var classList=['SE','S','SW'];for(i=0;i<classList.length;i++){el=document.getElementsByClassName('imgCrop_handle'+classList[i],this.selArea)[0];if(el.childNodes.length)el.removeChild(el.childNodes[0]);el.appendChild(d);}}
fixEl.appendChild(n);fixEl.removeChild(n);}},startResize:function(e){this.startCoords=this.cloneCoords(this.areaCoords);this.resizing=true;this.resizeHandle=Event.element(e).classNames().toString().replace(/([^N|NE|E|SE|S|SW|W|NW])+/,'');Event.stop(e);},startDrag:function(e){this.selArea.show();this.clickCoords=this.getCurPos(e);this.setAreaCoords({x1:this.clickCoords.x,y1:this.clickCoords.y,x2:this.clickCoords.x,y2:this.clickCoords.y},false,false,null);this.dragging=true;this.onDrag(e);Event.stop(e);},getCurPos:function(e){var el=this.imgWrap,wrapOffsets=Position.cumulativeOffset(el);while(el.nodeName!='BODY'){wrapOffsets[1]-=el.scrollTop||0;wrapOffsets[0]-=el.scrollLeft||0;el=el.parentNode;}
return curPos={x:Event.pointerX(e)-wrapOffsets[0],y:Event.pointerY(e)-wrapOffsets[1]}},onDrag:function(e){if(this.dragging||this.resizing){var resizeHandle=null;var curPos=this.getCurPos(e);var newCoords=this.cloneCoords(this.areaCoords);var direction={x:1,y:1};if(this.dragging){if(curPos.x<this.clickCoords.x)direction.x=-1;if(curPos.y<this.clickCoords.y)direction.y=-1;this.transformCoords(curPos.x,this.clickCoords.x,newCoords,'x');this.transformCoords(curPos.y,this.clickCoords.y,newCoords,'y');}else if(this.resizing){resizeHandle=this.resizeHandle;if(resizeHandle.match(/E/)){this.transformCoords(curPos.x,this.startCoords.x1,newCoords,'x');if(curPos.x<this.startCoords.x1)direction.x=-1;}else if(resizeHandle.match(/W/)){this.transformCoords(curPos.x,this.startCoords.x2,newCoords,'x');if(curPos.x<this.startCoords.x2)direction.x=-1;}
if(resizeHandle.match(/N/)){this.transformCoords(curPos.y,this.startCoords.y2,newCoords,'y');if(curPos.y<this.startCoords.y2)direction.y=-1;}else if(resizeHandle.match(/S/)){this.transformCoords(curPos.y,this.startCoords.y1,newCoords,'y');if(curPos.y<this.startCoords.y1)direction.y=-1;}}
this.setAreaCoords(newCoords,false,e.shiftKey,direction,resizeHandle);this.drawArea();Event.stop(e);}},transformCoords:function(curVal,baseVal,coords,axis){var newVals=[curVal,baseVal];if(curVal>baseVal)newVals.reverse();coords[axis+'1']=newVals[0];coords[axis+'2']=newVals[1];},endCrop:function(){this.dragging=false;this.resizing=false;this.options.onEndCrop(this.areaCoords,{width:this.calcW(),height:this.calcH()});},subInitialize:function(){},subDrawArea:function(){}};Cropper.ImgWithPreview=Class.create();Object.extend(Object.extend(Cropper.ImgWithPreview.prototype,Cropper.Img.prototype),{subInitialize:function(){this.hasPreviewImg=false;if(typeof(this.options.previewWrap)!='undefined'&&this.options.minWidth>0&&this.options.minHeight>0){this.previewWrap=$(this.options.previewWrap);this.previewImg=this.img.cloneNode(false);this.previewImg.id='imgCrop_'+this.previewImg.id;this.options.displayOnInit=true;this.hasPreviewImg=true;this.previewWrap.addClassName('imgCrop_previewWrap');this.previewWrap.setStyle({width:this.options.minWidth+'px',height:this.options.minHeight+'px'});this.previewWrap.appendChild(this.previewImg);}},subDrawArea:function(){if(this.hasPreviewImg){var calcWidth=this.calcW();var calcHeight=this.calcH();var dimRatio={x:this.imgW/calcWidth,y:this.imgH/calcHeight};var posRatio={x:calcWidth/this.options.minWidth,y:calcHeight/this.options.minHeight};var calcPos={w:Math.ceil(this.options.minWidth*dimRatio.x)+'px',h:Math.ceil(this.options.minHeight*dimRatio.y)+'px',x:'-'+Math.ceil(this.areaCoords.x1/posRatio.x)+'px',y:'-'+Math.ceil(this.areaCoords.y1/posRatio.y)+'px'}
var previewStyle=this.previewImg.style;previewStyle.width=calcPos.w;previewStyle.height=calcPos.h;previewStyle.left=calcPos.x;previewStyle.top=calcPos.y;}}});var Thumbnailer=Class.create({initialize:function(left,top,percent,mp,source_filepath,index,auth,item_id){this.left_offset=left;this.top_offest=top;this.percent=percent;this.min_percent=mp;this.image_index=index;this.authentication_token=auth;this.source_filepath=source_filepath;this.item_id=item_id;this.lightbox=new ManualLightbox();this.lightbox.autosizeable();this.lightbox.activate(function(){return this.createAdjustThumbnailView();}.bind(this),{'css_class':'thumbnail_edit'});this.image_edit=new ImageResize('cropImage',74,56,this.left_offset,this.top_offset,this.percent,this.min_percent);},createAdjustThumbnailView:function(){var crop_box=new Element('div',{'class':'crop_box'});crop_box.insert(new Element('img',{'id':'cropImage','src':this.source_filepath,'width':'384','height':'290'}));var zoom_controls=new Element('div',{'class':'zoom_controls'});zoom_controls.innerHTML='<a href="" onclick="window.imageController.thumbnail_adjuster.image_edit.increaseZoom(); return false;" id="zoom_in">'
+'<img src="'+assetHost.asset_src('/images/icons/zoom_in_1505.gif')+'" alt="zoom in" border=0 /></a><br />'
+'<img src="'+assetHost.asset_src('/images/icons/zoom_34fa.gif')+'" border="0" alt="Zoom" /><br />'
+'<a href="" onclick="window.imageController.thumbnail_adjuster.image_edit.decreaseZoom(); '
+'return false;" id="zoom_out"><img src="'+assetHost.asset_src('/images/icons/zoom_out_4ae7.gif')+'" alt="zoom out" border=0 /></a>';var crop_description=new Element('p',{'class':'crop_image_instructions'});crop_description.innerHTML='<b>Zoom</b> and <b>drag</b> the image for your prefered thumbnail detail.';var crop_image_container=new Element('div',{'class':'crop_image_container'});crop_image_container.innerHTML='<h3>Thumbnail adjustment</h3>';crop_image_container.insert(crop_description);crop_image_container.insert(crop_box);crop_image_container.insert(zoom_controls);var save_button=new Element('input',{'id':'save_image','type':'submit','class':'button active standard','href':'#','onclick':'window.imageController.thumbnail_adjuster.saveImageSet();','value':'OK'});crop_image_container.insert({bottom:save_button});crop_image_container.insert(new Element('hidden',{'type':'input','name':'imagex','id':'imagex','value':'0'}));crop_image_container.insert(new Element('hidden',{'type':'input','name':'imagey','id':'imagey','value':'0'}));crop_image_container.insert(new Element('hidden',{'type':'input','name':'imagesize','id':'imagesize','value':'0'}));return crop_image_container;},saveImageSet:function(event){var params=this.image_edit.getCropParams()
new Ajax.Request('/'+I18n.locale+'/save_thumbnail',{method:'get',asynchronous:true,evalScripts:true,onComplete:function(request){window._lightbox.deactivate();return false;},parameters:'top='+params['top']+'&left='+params['left']+'&percent='+params['percent']+'&image_index='+this.image_index+(this.item_id!=0?'&item_id='+this.item_id:'')});cancel(event);}});var CategoryFilter=Class.create({initialize:function(select,triggers){this.select=$(select);this.visibleSet=null;this.initializeOptions();this.triggers=$A(triggers);this.triggers.each(function(trigger){trigger.object.observe('click',this.change.bind(this));}.bind(this));this.change();},initializeOptions:function(){this.groups=$A(this.select.getElementsByTagName('optgroup'));},fireEvent:function(eventName,value){this.select.fire('categoryFilter:'+eventName,value);},change:function(event){var checked=this.triggers.find(function(trigger){if(trigger.object.checked)return true;});if(checked&&checked.label==this.visibleSet)return;var selected=false;var groups=false;if(checked){this.visibleSet=checked.label;groups=this.show(checked.label);selected=true;}
this.fireEvent('change',{'selected':selected,'groups':groups,'selectedElement':(checked?checked.object:null)});},show:function(class_name){var visibleGroups=0;this.groups.each(function(group){if($(group).hasClassName(class_name)){visibleGroups++;group.show();}
else{group.hide();}}.bind(this));return visibleGroups>0;}});var CategoryFilterForIE=Class.create(CategoryFilter,{initializeOptions:function($super){this.originalOptions=$A();$A(this.select.childElements()).each(function(node){this.originalOptions.push(node.remove());}.bind(this));},show:function($super,class_name){var visibleGroups=0;var filtered=this.originalOptions.findAll(function(tag){if(tag.tagName.toLowerCase()=='optgroup'){if(tag.hasClassName(class_name)&&tag.childElements().length!=0){visibleGroups++;return true;}}
else{return true;}});this.select.innerHTML='';filtered.each(function(node){this.select.insert({bottom:node.cloneNode(true)})}.bind(this));return visibleGroups>0;}});var AreaSelector=Class.create({initialize:function(container,target){this.container=$(container);this.store=$H();this.target=target;this.container.observe('click',this.clickHandler.bind(this));},clickHandler:function(event){var element=event.element();if(element.nodeName.toLowerCase()=='a'){$(this.target).value=element.innerHTML;}
cancel(event,true);},show:function(){this.container.show();},hide:function(){this.container.hide();},display:function(location_id){if(location_id==false){this.hide();return;}
if(!this.loaded(location_id)){this.load(location_id);return;}
if(this.store.get(location_id).size()==0){this.hide();return;}
this.container.innerHTML=I18n.t('popular_areas',{scope:'common'})+': ';this.store.get(location_id).each(function(area){if(this.container.childElements().length>0){this.container.insert({bottom:', '});}
var areaLink=new Element('a',{href:'#'}).insert({bottom:area});this.container.insert({bottom:areaLink});}.bind(this));this.show();},load:function(location_id){this.container.innerHTML=loadingHTML();this.show();new Ajax.Request(this.requestURL(),{parameters:{'location_id':location_id},on500:insertIntoDebugWindow,method:'get',onComplete:function(){this.areaSelector.display(this.location_id);}.bind({areaSelector:this,'location_id':location_id}),onSuccess:function(transport){this.areaSelector.save(this.location_id,$A(eval('('+transport.responseText+')')));}.bind({areaSelector:this,'location_id':location_id}),onFailure:function(transport){this.areaSelector.save(this.location_id,[]);}.bind({areaSelector:this,'location_id':location_id})});},loaded:function(location_id){return this.store.keys().include(location_id);},requestURL:function(){return'/'+I18n.locale+'/areas';},save:function(location_id,options){this.store.set(location_id,options);}});var CurrencyWatch=Class.create({initialize:function(container_or_containers){if(!('each'in container_or_containers)){container_or_containers=$A([container_or_containers]);}
this.containers=container_or_containers.collect(function(container){return $(container)});this.currency=null;},change:function(country_id){if(Currencies){this.currency=Currencies[country_id.toString()];symbol=this.currency.symbol}
else{this.currency=null;symbol='currencies.js not loaded?'}
this.containers.each(function(container){container.innerHTML=symbol;});}});var PliableForm=Class.create({initialize:function(form,update_block,reload_action){this.form=$(form);this.updateBlock=$(update_block);this.reloadAction=reload_action;this.elements=$A();},reload:function(){this.runUnload();this.fireEvent('query');new Ajax.Updater(this.updateBlock,this.reloadAction||this.form.action,{parameters:this.form.serialize(),onComplete:function(){this.runReload();}.bind(this)});},add:function(name,methods){var element=new PliableFormElement(name);element=Object.extend(element,methods);this.elements.push(element);},hide:function(){if(!this.coverPiece){this.coverPiece=new Element('div',{id:'pliable_form_cover'});this.coverPiece.hide();this.coverPiece.setOpacity(0.8);}
this.updateBlock.insert({bottom:this.coverPiece});this.coverPiece.setStyle({height:this.updateBlock.getHeight()+'px'});if(ie()){this.updateBlock.getElementsBySelector('select').each(function(select){select.hide();});}
this.coverPiece.show();},show:function(){this.updateBlock.insert({bottom:this.coverPiece});this.coverPiece.hide();},runInit:function(){this.run('init');},runUnload:function(){this.run('unload');},runReload:function(){this.run('reload');},run:function(eventName){this.fireEvent(eventName);this.elements.each(function(element){eval('element.'+eventName+'()');}.bind(this));this.fireEvent('end'+eventName.capitalize());},fireEvent:function(name){this.form.fire('pliableForm:'+name);}});var PliableFormElement=Class.create({initialize:function(name){this.name=name;},init:function(){},unload:function(){},reload:function(){}});var AddressParts=Class.create({initialize:function(){this.has_country=false;this.has_location=false;this.has_area=false;this.has_street=false;this.has_number=false;this.has_postal_code=false;this.street=$('street_name')&&$F('street_name');this.has_street=this.street&&!this.street.blank();this.number=$('street_number')&&$F('street_number');this.has_number=this.number&&!this.number.blank();this.area=$('area_field')&&$F('area_field');this.has_area=this.area&&!this.area.blank();this.location=this.getNameFromSelect('edit_item_location_id');this.has_location=!!this.location;this.country=this.getNameFromSelect('edit_item_country_id');this.has_country=!!this.country;this.postal_code=$('postal_code')&&$F('postal_code');this.has_postal_code=this.postal_code&&!this.postal_code.blank();},getNameFromSelect:function(e){var element=$(e);var value=$F(element);if(!value||value.toString()=='-1'){return null;}
return element.options[element.selectedIndex].innerHTML;}});var AddressReader=Class.create({initialize:function(){},read:function(){this.parts=new AddressParts();var addresses=[];if(this.parts.has_country){addresses.push(this.buildFrom('number_name','postal_code','country'));addresses.push(this.buildFrom('name_number','postal_code','country'));addresses.push(this.buildFrom('name','postal_code','country'));addresses.push(this.buildFrom('postal_code','country'));addresses.push(this.buildFrom('number_name','area','location','country'));addresses.push(this.buildFrom('name_number','area','location','country'));addresses.push(this.buildFrom('name','area','location','country'));addresses.push(this.buildFrom('number_name','location','country'));addresses.push(this.buildFrom('name_number','location','country'));addresses.push(this.buildFrom('name','location','country'));addresses.push(this.buildFrom('area','location','country'));addresses.push(this.buildFrom('location','country'));addresses.push(this.buildFrom('number_name','location'));addresses.push(this.buildFrom('name_number','location'));addresses.push(this.buildFrom('name','location'));addresses.push(this.buildFrom('number_name','country'));addresses.push(this.buildFrom('name_number','country'));addresses.push(this.buildFrom('name','country'));addresses.push(this.buildFrom('country'));addresses=addresses.compact().uniq();}
return addresses;},validateParts:function(pieces){this.valid=true;pieces.each(function(piece){if(!this.valid)return null;switch(piece){case'name':if(!this.parts.has_street){this.valid=false;}
break;case'number_name':if(!this.parts.has_street||!this.parts.has_number){this.valid=false;}
break;case'name_number':if(!this.parts.has_street||!this.parts.has_number){this.valid=false;}
break;case'postal_code':if(!this.parts.has_postal_code){this.valid=false;}
break;case'area':if(!this.parts.has_area){this.valid=false;}
break;case'location':if(!this.parts.has_location){this.valid=false;}
break;case'country':if(!this.parts.has_country){this.valid=false;}
break;default:return null;}}.bind(this));return this.valid;},buildFrom:function(){var pieces=$A(arguments);if(this.validateParts(pieces)){return this.buildCompiled(pieces);}
return null;},buildCompiled:function(pieces){var compiledParts=[];pieces.each(function(piece){switch(piece){case'name':compiledParts.push(this.parts.street);break;case'number_name':compiledParts.push(this.parts.number+' '+this.parts.street);break;case'name_number':compiledParts.push(this.parts.street+' '+this.parts.number);break;case'postal_code':compiledParts.push(this.parts.postal_code);break;case'area':compiledParts.push(this.parts.area);break;case'location':compiledParts.push(this.parts.location);break;case'country':compiledParts.push(this.parts.country);break;}}.bind(this));return compiledParts.compact().join(', ');}});function setupPliablePostForm(){var itemForm=$('edit_item');window.formController=new PliableForm(itemForm,'pliable','/'+I18n.locale+'/repost');var pliablePiece=$('pliable');itemForm.observe('pliableForm:unload',function(){this.hide();}.bind(window.formController));itemForm.observe('pliableForm:query',function(){if(!this.loadingPrompt){this.loadingPrompt=new Element('div');this.loadingPrompt.innerHTML=loadingHTML();}
$('pliable-loading').insert(this.loadingPrompt);}.bind(window.formController));itemForm.observe('pliableForm:endReload',function(){if(this.loadingPrompt){try{this.loadingPrompt.remove();}catch(e){};}
this.show();}.bind(window.formController));var categorySelector=$('edit_item_category_id');categorySelector.fireCustomChangeEvent=function(){this.fire('categorySelector:change',{'category_id':$F(this)});};categorySelector.observe('change',function(event){event.element().fireCustomChangeEvent();});var forceCategory=false;if((filter_container=$('category_filter'))){if(ie()){forceCategory=true;var forceCategoryValue=$F('edit_item_category_id');}
categorySelector=$('category_selector');categorySelector.hide();itemForm.observe('categoryFilter:change',function(event){if(event.memo.selected&&event.memo.groups){event.memo.selectedElement.up('div').insert({bottom:this});this.show();}
else{this.hide();}
this.toggleClassName('OneBrowserToRuleThemAll');}.bindAsEventListener(categorySelector));var triggers=$A(filter_container.getElementsBySelector('.category_filter_label')).collect(function(label){show=label.className.match(/\blabel_([a-z_-]+)\b/)[1];return{'object':$(label.htmlFor),'label':show};});CategoryFilterForIE.prototype.change=CategoryFilterForIE.prototype.change.wrap(function(){var ret,args=$A(arguments),proceed=args.shift();ret=proceed.apply(this,args);this.select.fireCustomChangeEvent();return ret;});CategoryFilterForIE.prototype.show=CategoryFilterForIE.prototype.show.wrap(function(){var visibleGroups,args=$A(arguments),show=args.shift();var class_name=args.first();visibleGroups=show.apply(this,args);if(visibleGroups){var optgroups=this.select.getElementsBySelector('optgroup.'+class_name);if(optgroups.length==1){var optgroup=optgroups.first();if(optgroup.childElements().length==1){for(var i=0;i<this.select.options.length;i++){value=this.select.options[i].value.toString();if(!value.blank()&&value!='-1'){this.select.value=value;this.select.selectedIndex=i;try{this.select.options[i].selected="selected";}catch(e){}}
else{try{this.select.options[i].selected="";}catch(e){}}}
visibleGroups=false;}}}
return visibleGroups;});var filter=new CategoryFilterForIE($('category_selector').down('select'),triggers);}
window.formController.add('area selector',{init:function(){this.areaSelectorDiv=new Element('div',{id:'area_selector_drop','class':'textbox_small_font'});this.areaSelector=new AreaSelector(this.areaSelectorDiv,'area_field');this.reload();},reload:function(){var area=$('area');if(area){area.insert({bottom:this.areaSelectorDiv});this.observe();}},unload:function(){$('edit_item').stopObserving('locationSelector:locationSelected');},observe:function(){this.observer=$('edit_item').observe('locationSelector:locationSelected',function(event){if(event['memo']['location_id']!=false&&$F($('edit_item').down('.region_selector'))!=$F($('edit_item').down('.country_selector'))){this.display(event.memo.location_id);}}.bind(this.areaSelector));}});window.formController.add('area field',{init:function(){this.reload();},reload:function(){this.observe();},unload:function(){$('edit_item').stopObserving('locationSelector:locationSelected');},observe:function(){var item=$('edit_item');item.observe('locationSelector:locationSelected',function(event){areaField=$('area_field');areaSelectorDrop=$('area_selector_drop');countrySelector=$('edit_item_country_id');regionSelector=$('edit_item_location_id');ev=event['memo']
if(ev['location_id']==false||(ev['location_id']==$F(countrySelector)&&ev['countryHasRegions'])||$F(regionSelector)==$F(countrySelector)){areaField.value='';areaField.setAttribute('disabled','disabled');Element.addClassName(areaField,'disabled');areaSelectorDrop.hide();}
else{areaField.removeAttribute('disabled');Element.removeClassName(areaField,'disabled');areaSelectorDrop.show();}}.bind(this));}});window.formController.add('map display',{init:function(){this.delayedObservers=$A();this.addressReader=new AddressReader();this.reload();},initOrUpdateMap:function(){var map_container=$('map_container');if(map_container){if(this.map){this.map.container=map_container;this.map.hideMapContainer();this.map.initMap();}
else{this.map=new ItemEditMap(map_container,this.addressReader.read.bind(this.addressReader));}
this.map.buttonHandler=new MapButtonHandler(this.map);}},reload:function(){this.initOrUpdateMap();if(this.map){this.observe();}},unload:function(){if(this.map){this.map.map=null;this.map.point=null;this.unObserve();}},observe:function(){$('edit_item').observe('map:point',function(event){var point=event.memo;$('item_lat').value=point.lat||'';$('item_lng').value=point.lng||'';});$$('#step_details .title').each(function(e){e.observe('focus',function(event){if(!this.map.formLatLng())
this.map.locateAndDisplay(false,{overrideDisplay:true});}.bindAsEventListener(this));}.bind(this));},unObserve:function(){$('edit_item').stopObserving('map:point');if($('show_map')){$('show_map').stopObserving('change');}
$$('#step_details .title').each(function(e){e.stopObserving('focus');});this.map.buttonHandler.unObserve();if(this.map.optionsHandler)
this.map.optionsHandler.unObserve();}});window.formController.add('currency controller',{init:function(){this.initOrUpdate();},initOrUpdate:function(){this.currencyContainers=$('edit_item').getElementsBySelector('span.currency');if(this.currencyContainers.length>0){if(this.currencyWatcher){this.currencyWatcher.containers=this.currencyContainers;}
else{this.currencyWatcher=new CurrencyWatch(this.currencyContainers);}
this.observe();}},reload:function(){this.initOrUpdate();},observe:function(){$('edit_item').observe('locationSelector:countrySelected',function(event){this.change(event.memo.location_id);if(this.currency){if($('decimal_places_2')&&ThreeDecimalCurrencies.include(this.currency.id)){threeZeros=new Element('span',{id:'decimal_places_3'}).update('000')
$('decimal_places_2').replace(threeZeros);}
else if($('decimal_places_3')&&!ThreeDecimalCurrencies.include(this.currency.id)){twoZeros=new Element('span',{id:'decimal_places_2'}).update('00')
$('decimal_places_3').replace(twoZeros);}}}.bind(this.currencyWatcher));},unObserve:function(){$('edit_item').stopObserving('locationSelector:countrySelected');}});window.formController.add('price input watch',{init:function(){this.initOrUpdate();},initOrUpdate:function(){this.priceInput=$('edit_item_price');this.observe();},reload:function(){this.initOrUpdate();},observe:function(){if(this.priceInput){this.priceInput.observe('blur',function(event){markersTag=$('currency_separator');if(markersTag){separator=markersTag.innerHTML;priceField=$('edit_item_price');changed=false;decimalPart=new RegExp('(\\'+separator+'[^\\'+separator+']*)$',"");if(decimalPart.test($F(priceField))){priceField.value=$F(priceField).replace(decimalPart,'');changed=true;}
nonDigits=new RegExp('[^0-9]',"g");if(nonDigits.test($F(priceField))){priceField.value=$F(priceField).replace(nonDigits,'');changed=true;}
if(changed){alert(I18n.t('decimals_not_allowed',{scope:'common.message'}));}}}.bind(this));}},unObserve:function(){if(this.priceInput){this.priceInput.stopObserving('blur');}}});window.formController.add('location selector',{init:function(){this.locationSelector=false;var container=$('location_selector');if(container){this.initLocationSelector();}},unload:function(){if(this.locationSelector){this.locationSelector.unObserve();}},reload:function(){var container=$('location_selector');if(container){if(this.locationSelector){this.locationSelector.locationSelector=container.down('select.region_selector');this.locationSelector.countrySelector=container.down('select.country_selector');$('edit_item').getElementsBySelector('.hidden_region_list').first().show();this.locationSelector.init();}
else{this.initLocationSelector();}}},initLocationSelector:function(){this.locationSelector=locationSelectorFromContainer('location_selector');}});window.formController.add('image uploader',{init:function(){this.initOrUpdate();},reload:function(){this.initOrUpdate();},initOrUpdate:function(){var imageUploader=$('image_uploader');if(imageUploader){if(window.imageController){window.imageController.regular_uploader=imageUploader;window.imageController.initUploader();}
else{window.imageController=new PostImagesHandler('image_uploader',window.item_name,window.auth_token);window.imageController.loadImages();}}}});window.formController.add('language detection',{init:function(){this.initOrReload();},reload:function(){this.initOrReload();},initOrReload:function(){var textarea=$$('textarea.post_auto_detect_language').first();var select=$$('select.post_auto_detect_language').first();if(textarea&&select){initAutoLanguageDetection(textarea,select);}}});if(ie()){SmartTextAreaSize.prototype.doResize=SmartTextAreaSize.prototype.doResize.wrap(function(){var ret,args=$A(arguments),method=args.shift();ret=method.apply(this,args);return ret;});}
window.formController.add('surface area',{init:function(){this.reload();this.mimicError();},unload:function(){if(this.surface_area){this.surface_area.unobserve();}
if(this.fields){this.fields.getElementsBySelector('input').each(function(item){item.stopObserving('change');});}},reload:function(){this.fields=$$('.edit_surface_area').first();if(this.fields){this.surface_area=new SurfaceArea(this.fields);this.surface_area.link.addClassName('will_not_be_intimidated');this.fields.getElementsBySelector('input').each(function(input){input.observe('change',this._update.bindAsEventListener(this));}.bind(this));}},mimicError:function(){if(this.fields){m2Field=this.fields.down('#edit_item_size_in_m2');ft2Field=this.fields.down('#edit_item_size_in_ft2');if(m2Field&&ft2Field&&m2Field.hasClassName('error')){ft2Field.addClassName('error');}}},_update:function(event){var item=event.target;var unit_changed=item.id.toString().match(/_([^_]+)$/)[1];var new_value='';switch(unit_changed){case'm2':if(!item.value.blank()){new_value=this.surface_area.convert_to_ft2(item.value);}
this.fields.down('#edit_item_size_in_ft2').value=new_value;break;case'ft2':if(!item.value.blank()){new_value=this.surface_area.convert_to_m2(item.value);}
this.fields.down('#edit_item_size_in_m2').value=new_value;break;}}});window.formController.runInit();if(forceCategory&&!forceCategoryValue.blank()&&forceCategoryValue!='-1'){$('edit_item_category_id').value=forceCategoryValue;}
itemForm.observe('categorySelector:change',function(event){if(event.memo['category_id']){var value=event.memo['category_id'].toString();}
else{var value='';}
if(value.blank()||value=='-1'){this.fireEvent('unload');}
else{this.reload();}}.bind(window.formController));window._bossy_form.reload();}
MagicLinker.addSystem('classifieds',function(){if($('edit_item')){setupPliablePostForm();}});Positioner={items:[],addItem:function(set_position,name,object){this.items.push([object,set_position,name]);this.update(this.items.last());},update:function(p){p[1](p[0]);},updateSpecific:function(name){q=this.items.find(function(p){return p[2]==name;})
if(q)this.update(q);},updateAll:function(){this.items.each(function(i){this.update(i);}.bind(this))}}
InputResizer={magic:function(item){item=$(item);classes=item.classNames().toString();if(klass=classes.match(/resize_to_class_(.*)/)){item.removeClassName(klass[0]);item.addClassName(klass[1]);}
if(width=classes.match(/resize_to_width_(.*)/)){item.removeClassName(height[0]);if(width[1].match(/^[0-9]+$/))width[1]+='px';item.setStyle({'width':width[1]})}
if(height=classes.match(/resize_to_height_(.*)/)){item.removeClassName(height[0]);if(height[1].match(/^[0-9]+$/))height[1]+='px';item.setStyle({'height':height[1]})}
if(trigger=classes.match(/resize_trigger_([a-z_]+)/)){item.removeClassName(trigger[0]);InputResizer.magic(trigger[1]);}}}
HeaderLanguageError={timeout:null,initialise:function(message){this.message=$(message)
this.message.setStyle({'width':this.getWidth()+10+'px'})
this.observe('mouseover',function(event){this.showError();}.bindAsEventListener(this));this.observe('mouseout',function(event){this.hideError();}.bindAsEventListener(this));},showError:function(){clearTimeout(this.timeout);if(!this.message.visible()){this.timeout=setTimeout(function(){new Effect.Appear(this.message,{duration:0.2});}.bind(this),200);}},hideError:function(){if(!this.message.visible()){clearTimeout(this.timeout);}
else{this.timeout=setTimeout(function(){new Effect.Fade(this.message,{duration:0.2});}.bind(this),200);}}}
Prompt={elements:[],initialize:function(text,prompt_class,ties,last_in_set){this.prompt_text=text;this.prompt_class=prompt_class;if(ties){this.elements=ties;}
with($(this)){if(this.can_set_prompt()){set_prompt_without_checking();}
observe('focus',function(){this.clear_prompt();}.bindAsEventListener(this));observe('blur',function(){this.set_prompt();}.bindAsEventListener(this));}
if(last_in_set){if(!(this.can_set_other_prompts()&&this.can_set_prompt())){this.clear_prompt_on_load();this.elements.each(function(i){$(i).clear_prompt_on_load();});}}
if(form=this.up('form')){form.observe('submit',function(){this.clear_prompt();}.bindAsEventListener(this));}},can_set_prompt:function(){return(this.value.blank()||this.value==this.prompt_text);},can_clear_prompt:function(){return(this.hasClassName(this.prompt_class));},can_set_other_prompts:function(){return this.can_something_other_prompts(function(i){return(!$(i).can_set_prompt())});},can_clear_other_prompts:function(){return this.can_something_other_prompts(function(i){return(!$(i).can_clear_prompt())});},can_something_other_prompts:function(callback){if(this.elements.find(callback)){return false;}
return true;},set_prompt:function(){if(this.can_set_prompt()&&this.can_set_other_prompts()){this.set_prompt_without_checking();this.elements.each(function(i){$(i).set_prompt_without_checking();})}},set_prompt_without_checking:function(){this.addClassName(this.prompt_class);this.value=this.prompt_text;},clear_prompt:function(){if(this.can_clear_prompt()&&this.can_clear_other_prompts()){this.clear_prompt_without_checking();this.elements.each(function(i){$(i).clear_prompt_without_checking();})}},clear_prompt_without_checking:function(){this.removeClassName(this.prompt_class);this.value=''},clear_prompt_on_load:function(){if(this.can_clear_prompt()){this.clear_prompt_without_checking();}}}
AJAXError={show:function(message){if(!$('ajax_error')){$('header').insert({after:new Element('div',{'id':'ajax_error'}).setStyle({display:'none'})});}
div=$('ajax_error');if(div.visible()){new Effect.Parallel([new Effect.Fade(div,{sync:true}),new Effect.BlindUp(div,{sync:true})],{duration:1.5,queue:{position:'end',scope:'ae'}});}
new Effect.BlindDown(div,{duration:0.5,queue:{position:'end',scope:'ae'},beforeStart:function(){div.update(message)}});},hide:function(){div=$('ajax_error');new Effect.Parallel([new Effect.Fade(div,{sync:true}),new Effect.BlindUp(div,{sync:true})],{duration:0.3,queue:{position:'end',scope:'ae'}});}}
function updateAllBySelector(selector,text){$$(selector).each(function(element){element.update(text);});}
function replaceAllBySelector(selector,text){$$(selector).each(function(element){element.replace(text);});}
MagicLinker.addSystem('community',function(){this.accountType=$('business_account_account_type');if(this.accountType){this.changeLabel=function(element){var labelField=$$("label[for='business_account_account_name']").first();if(element.value==0){labelField.update(I18n.t('company_name',{scope:'common'})+':');}else{labelField.update(I18n.t('profession',{scope:'common'})+':');}};this.changeLabel(this.accountType);this.accountType.observe('change',function(event){this.changeLabel(event.target);}.bind(this));}});var CountryConstants={spain:156,euMembers:[10,17,27,45,46,63,47,54,58,59,173,76,82,84,99,100,93,108,122,137,138,142,161,152,151,66]};MagicLinker.addSystem('community',function(){this.form=$('billing_information_form');if(this.form){var countrySelector=$('billing_information_country_id');countrySelector.fireCustomChangeEvent=function(){this.fire('countrySelector:change',{'country_id':$F(this)});};countrySelector.observe('change',function(event){event.element().fireCustomChangeEvent();});this.form.observe('countrySelector:change',function(event){var value=parseInt(event.memo['country_id']);var label=$$('label[for="company_number"]').first();var hint=label.next(".textbox_small_font");if(value===CountryConstants.spain){label.innerHTML=I18n.t('cif_nif',{scope:'common'})+':';hint.hide();}else if(CountryConstants.euMembers.indexOf(value)!=-1){label.innerHTML=I18n.t('vat_number',{scope:'common'})+':';hint.show();}else{label.innerHTML=I18n.t('company_number',{scope:'common'})+':';hint.hide();}});countrySelector.fireCustomChangeEvent();}});Positioner={items:[],addItem:function(set_position,name,object){this.items.push([object,set_position,name]);this.update(this.items.last());},update:function(p){p[1](p[0]);},updateSpecific:function(name){q=this.items.find(function(p){return p[2]==name;})
if(q)this.update(q);},updateAll:function(){this.items.each(function(i){this.update(i);}.bind(this))}}
InputResizer={magic:function(item){item=$(item);classes=item.classNames().toString();if(klass=classes.match(/resize_to_class_(.*)/)){item.removeClassName(klass[0]);item.addClassName(klass[1]);}
if(width=classes.match(/resize_to_width_(.*)/)){item.removeClassName(height[0]);if(width[1].match(/^[0-9]+$/))width[1]+='px';item.setStyle({'width':width[1]})}
if(height=classes.match(/resize_to_height_(.*)/)){item.removeClassName(height[0]);if(height[1].match(/^[0-9]+$/))height[1]+='px';item.setStyle({'height':height[1]})}
if(trigger=classes.match(/resize_trigger_([a-z_]+)/)){item.removeClassName(trigger[0]);InputResizer.magic(trigger[1]);}}}
HeaderLanguageError={timeout:null,initialise:function(message){this.message=$(message)
this.message.setStyle({'width':this.getWidth()+10+'px'})
this.observe('mouseover',function(event){this.showError();}.bindAsEventListener(this));this.observe('mouseout',function(event){this.hideError();}.bindAsEventListener(this));},showError:function(){clearTimeout(this.timeout);if(!this.message.visible()){this.timeout=setTimeout(function(){new Effect.Appear(this.message,{duration:0.2});}.bind(this),200);}},hideError:function(){if(!this.message.visible()){clearTimeout(this.timeout);}
else{this.timeout=setTimeout(function(){new Effect.Fade(this.message,{duration:0.2});}.bind(this),200);}}}
Prompt={elements:[],initialize:function(text,prompt_class,ties,last_in_set){this.prompt_text=text;this.prompt_class=prompt_class;if(ties){this.elements=ties;}
with($(this)){if(this.can_set_prompt()){set_prompt_without_checking();}
observe('focus',function(){this.clear_prompt();}.bindAsEventListener(this));observe('blur',function(){this.set_prompt();}.bindAsEventListener(this));}
if(last_in_set){if(!(this.can_set_other_prompts()&&this.can_set_prompt())){this.clear_prompt_on_load();this.elements.each(function(i){$(i).clear_prompt_on_load();});}}
if(form=this.up('form')){form.observe('submit',function(){this.clear_prompt();}.bindAsEventListener(this));}},can_set_prompt:function(){return(this.value.blank()||this.value==this.prompt_text);},can_clear_prompt:function(){return(this.hasClassName(this.prompt_class));},can_set_other_prompts:function(){return this.can_something_other_prompts(function(i){return(!$(i).can_set_prompt())});},can_clear_other_prompts:function(){return this.can_something_other_prompts(function(i){return(!$(i).can_clear_prompt())});},can_something_other_prompts:function(callback){if(this.elements.find(callback)){return false;}
return true;},set_prompt:function(){if(this.can_set_prompt()&&this.can_set_other_prompts()){this.set_prompt_without_checking();this.elements.each(function(i){$(i).set_prompt_without_checking();})}},set_prompt_without_checking:function(){this.addClassName(this.prompt_class);this.value=this.prompt_text;},clear_prompt:function(){if(this.can_clear_prompt()&&this.can_clear_other_prompts()){this.clear_prompt_without_checking();this.elements.each(function(i){$(i).clear_prompt_without_checking();})}},clear_prompt_without_checking:function(){this.removeClassName(this.prompt_class);this.value=''},clear_prompt_on_load:function(){if(this.can_clear_prompt()){this.clear_prompt_without_checking();}}}
AJAXError={show:function(message){if(!$('ajax_error')){$('header').insert({after:new Element('div',{'id':'ajax_error'}).setStyle({display:'none'})});}
div=$('ajax_error');if(div.visible()){new Effect.Parallel([new Effect.Fade(div,{sync:true}),new Effect.BlindUp(div,{sync:true})],{duration:1.5,queue:{position:'end',scope:'ae'}});}
new Effect.BlindDown(div,{duration:0.5,queue:{position:'end',scope:'ae'},beforeStart:function(){div.update(message)}});},hide:function(){div=$('ajax_error');new Effect.Parallel([new Effect.Fade(div,{sync:true}),new Effect.BlindUp(div,{sync:true})],{duration:0.3,queue:{position:'end',scope:'ae'}});}}
function updateAllBySelector(selector,text){$$(selector).each(function(element){element.update(text);});}
function replaceAllBySelector(selector,text){$$(selector).each(function(element){element.replace(text);});}
UserLanguageList={initialize:function(inputId,ids,removeTxt,selector){this.inputId=inputId;this.ids=ids;this.removeTxt=removeTxt;if(!this.ids){this.ids=[];}
this.ids.find=function(x){for(var i=0;i<this.length;i++){if(x==this[i]){return i;}}
return false;}.bind(this.ids);this.update();selector=$(selector);if(selector){var old_action=selector.onchange||function(){};selector.onchange=function(){};selector.observe('keypress',function(event){var key=event.which||event.keyCode;if(!(key==Event.KEY_RETURN||key==32))return;this.addFromSelect(selector);old_action();Event.stop(event);}.bindAsEventListener(this));selector.observe('click',function(event){this.addFromSelect(selector);old_action();Event.stop(event);}.bindAsEventListener(this));}},add:function(id,text){if(this.ids.find(id)!==false){return;}
text=text.replace(/(&nbsp;)+/,'');this.ids.push(id);listItem=document.createElement('li');listItem.id='item_'+id;remLink=document.createElement('a');remLink.value=id;remLink.innerHTML='('+this.removeTxt+')';remLink.delegate=this;remLink.onclick=function(){this.delegate.remove(this.value);};listItem.appendChild(document.createTextNode(text+' '));listItem.appendChild(remLink);this.appendChild(listItem);this.update(true);},addFromSelect:function(select){if(select.value!=''){this.add(select.value,select.options[select.selectedIndex].innerHTML);select.options[0].selected=true;}},remove:function(id){i=this.ids.find(id);if(i===false){return;}
this.ids.splice(i,1);listItem=$('item_'+id);this.removeChild(listItem);this.update(true);},update:function(){$(this.inputId).value=this.ids.join(',');}};Wall={initialize:function(show_wall_posts,earlier_post_url){this.show_wall_posts=show_wall_posts;this.earlier_post_url=earlier_post_url;},show_new:function(id_or_object,earlier_post_url){children=this.childElements();if(children.length>this.show_wall_posts)this.graceful_hide(children.last());this.earlier_post_url=earlier_post_url;},show_old:function(id_or_object,earlier_post_url){this.earlier_post_url=earlier_post_url;obj=$(id_or_object);obj.setStyle({'opacity':'0'});obj.slideDown({transition:Effect.Transitions.sinoidal,duration:0.5,queue:{position:'end',scope:'wallpost'}});obj.appear({duration:0.5,queue:{position:'end',scope:'wallpost'}});},get_earlier_post:function(){if(this.earlier_post_url)new Ajax.Request(this.earlier_post_url,{asynchronous:true,evalScripts:true,method:'get'});},graceful_hide:function(id_or_object){obj=$(id_or_object);obj.fade({duration:0.5,queue:{position:'end',scope:'wallpost'}});obj.slideUp({transition:Effect.Transitions.sinoidal,duration:0.5,queue:{position:'end',scope:'wallpost',afterFinish:function(){this.remove();}.bind(obj)}});},remove_post:function(id_or_object){obj=$(id_or_object);if(obj){obj.fade({duration:0.5,queue:{position:'end',scope:obj.id},afterFinish:function(){this.remove();}.bind(obj)});}}}
SmartUserDisplay={covered:false,initialize:function(){this.removeClassName('smart_user_display');this.addClassName('smarter_user_display');},cover:function(){if(this.covered){return;}
this.covered=true;this.initDisplay();new Effect.Parallel([new Effect.Appear(this.div_image,{sync:true,to:0.8}),new Effect.Appear(this.div_text,{sync:true,to:0.8})],{duration:1});},reveal:function(){if(!this.covered){return;}
this.covered=false;this.initDisplay();new Effect.Parallel([new Effect.Fade(this.div_image,{sync:true,from:0.8}),new Effect.Fade(this.div_text,{sync:true,from:0.8})],{duration:1});},toggle:function(){if(this.covered){this.reveal();}
else{this.cover();}},initDisplay:function(){if(this.div_image){return;}
this.div_image=new Element('div').setStyle({'backgroundColor':'white','position':'absolute'}).hide();this.div_text=new Element('div').setStyle({'backgroundColor':'white','position':'absolute'}).hide();this.insert({bottom:this.div_image});this.insert({bottom:this.div_text});this.div_image.clonePosition(this.getElementsBySelector('.image').first());this.div_text.clonePosition(this.getElementsBySelector('.details').first());},initAllSmartUserDisplays:function(){$$('.smart_user_display').each(function(element){Object.extend(element,SmartUserDisplay).initialize();});},coverAllByClass:function(klass){$$('.smarter_user_display.sud_'+klass).each(function(element){element.cover();});},revealAllByClass:function(klass){$$('.smarter_user_display.sud_'+klass).each(function(element){element.reveal();});}}
var FriendsPlusDisabler=Class.create();FriendsPlusDisabler.prototype={initialize:function(inputs_in_id_or_object,array_of_enabling_triggers,array_of_triggers){this.inputs_in=$(inputs_in_id_or_object);this.enabling=array_of_enabling_triggers.collect(function(i){return($(i));});this.all_triggers=array_of_triggers.collect(function(i){return($(i));});(this.enabling.concat(this.all_triggers)).uniq().each(function(i){i.observe('click',function(e){this.update_state();}.bind(this),false);}.bind(this));this.update_state();},update_state:function(){enabled=this.enabling.any(function(i){return!(i.getValue());});if(enabled)
this.enable();else
this.disable();},enable:function(){this.inputs_in.getElementsBySelector('input').each(function(i){i.disable();});},disable:function(){this.inputs_in.getElementsBySelector('input').each(function(i){i.enable();});}}
function disablePhotoButton(){if(obj=$('profile_menu_photo')){obj.hide();}}
InterestSelector={initialize:function(target,new_name,remove_string){this.target=$(target);this.new_name=new_name;this.remove_string=remove_string;this.target.getElementsBySelector('a').each(function(link){this.attachAction(link);}.bind(this));this.observe('change',function(){if(this.selectedIndex!=0){this.smartClone(this.value,this.options[this.selectedIndex].innerHTML);this.selectedIndex=0;}}.bindAsEventListener(this));},smartClone:function(id,name){input=new Element('input',{name:this.new_name,value:id,type:'hidden'});action=this.attachAction(new Element('a',{href:'#','class':'will_not_be_intimidated'}).update(this.remove_string));this.target.insert({bottom:new Element('li').update(new Element('span').update(name.strip())).insert({bottom:input}).insert({bottom:' ('}).insert({bottom:action}).insert({bottom:')'}).insert({bottom:new Element('div',{'class':'clear'})})});},attachAction:function(link){if(link.hasClassName('remove')){return;}
link.onclick=cancel;link.addClassName('remove');link.observe('click',function(){this.up('li').remove();}.bindAsEventListener(link));return link;}}
NoticeList={initialize:function(){this.container=this.getElementsBySelector('ul.notices').first();},cleanlyRemove:function(id_or_object){link_set=$(id_or_object);li=link_set.up('li');if(this.container.childElements().length==1){this.timelyFade(this);}
else{this.timelyFade(li);}},timelyFade:function(object){object.fade({duration:0.5,delay:0.5,afterFinish:function(){this.remove();}.bind(object)});},makeNoticeList:function(object){Object.extend(object,NoticeList).initialize();}}
Disabler={initialize:function(id_or_object,callback){this.callback=callback;this.target=$(id_or_object);this.observe('click',function(){this.controlTarget();}.bind(this));this.controlTarget();},controlTarget:function(){if(this.callback(this)){this.target.enable();}
else{this.target.disable();}}}
NotifyActivity={initialize:function(id_or_object){this.target=$(id_or_object);this.observe('click',function(){this.controlTarget();}.bind(this));this.controlTarget();},controlTarget:function(){if(this.checked){this.target.enable();}
else{this.target.disable();}}}
var AgeSelectHelper=Class.create();AgeSelectHelper.prototype={initialize:function(lower_element,upper_element){this.lower=$(lower_element);this.upper=$(upper_element);this.lower.opposite_element=function(){return this.upper}.bind(this);this.upper.opposite_element=function(){return this.lower}.bind(this);reset=function(){this.value=this.select('option').first().value};this.lower.reset=reset;this.upper.reset=reset;this.lower.observe('change',this.handle_change.bind(this));this.upper.observe('change',this.handle_change.bind(this));},is_out_of_range:function(){lower_val=parseInt(this.lower.value);upper_val=parseInt(this.upper.value);if(isNaN(lower_val)||isNaN(upper_val)){return false;}else{return lower_val>=upper_val;}},handle_change:function(event){if(this.is_out_of_range()){event.findElement().opposite_element().reset();}}}
LinkChecker={old_values:{},initialize:function(){this.observe('blur',function(event){this.checkUrl();}.bindAsEventListener(this));},makeError:function(){this.addClassName('error');},cleanError:function(){if(this.hasClassName('error')){this.removeClassName('error');}
this.old_values[this.value]=true;},checkUrl:function(){if(this.value.blank()||this.old_values[this.value]){this.cleanError();return;}
new Ajax.Request('/'+I18n.locale+'/link_check',{method:'head',parameters:{link:this.value},onSuccess:function(){this.cleanError();}.bind(this),onFailure:function(){this.makeError();}.bind(this)});}}
RecipientListEmail={initialize:function(drop,add_button){this.drop=$(drop);this.add_button=$(add_button);this.add_button.observe('click',function(){this.add_button.hide();this.drop.add_email(this.value,function(){this.value='';}.bind(this));}.bindAsEventListener(this));this.observe('keyup',function(){if(this.value.match(/^([^@\s]+)@((?:[-a-z0-9]{2,}\.)+[a-z]{2,})$/i)){this.add_button.show();}
else{this.add_button.hide();}});}};Working={initialize:function(){},reveal:function(){if(!this.cover_object.visible()||this.cover_object.fading){return;}
this.cover_object.fading=true;Element.clonePosition(this.cover_object,this);this.cover_object.fade({duration:0.5,from:0.8,to:0,queue:{position:'end',scope:'forum'},afterFinish:function(){this.cover_object.fading=false;}.bind(this)});},updateCoverPosition:function(){Element.clonePosition(this.cover_object,this);},cover:function(){if(!this.cover_object){this.cover_object=new Element('div',{'class':'forum_loading'});this.cover_object.setStyle({position:'absolute',opacity:'0','backgroundColor':'white'});this.insert({'after':this.cover_object});this.cover_object.fading=false;}
this.cover_object.clonePosition(this);this.cover_object.appear({duration:0.5,from:0,to:0.8,queue:{position:'end',scope:'forum'}});}};MessageForm={initialize:function(){this.select_none();},select_specific:function(id){this.set_checked('input[type=checkbox][value='+id+']',true);},select_all:function(){this.set_checked('input[type=checkbox]',false);},select_none:function(){this.set_checked('input[type=checkbox]',false,function(i){i.checked=false;});},select_unread:function(){this.set_checked('input.chk_unread',true);},select_read_adjective:function(){this.set_checked('input.chk_read',true);},source:function(){if(this._source)return(this._source);this._source=$$('table.messages').first();return(this._source);},set_checked:function(selector,reset,action){if(!action)action=function(i){i.checked="checked";};if(reset)this.source().select('input[type=checkbox]').each(function(c){c.checked=false;});this.source().select(selector).each(function(c){action(c);});$('conversation_action_selector').update_disabled();},smart_submit:function(action){$('conversation_action').value=action;this.source().up('form').inline_submit();}};MessageBoxActions={initialize:function(form){this.form_element=$(form);disable=true;this.selectedIndex=0;this.observe('change',function(e){this.smart_submit();}.bindAsEventListener(this));this.form_element.getElementsBySelector('input[type=checkbox]').each(function(check){check.observe('click',function(){this.update_disabled();}.bindAsEventListener(this));if(check.checked){disable=false;}}.bind(this));if(disable)
this.disable();else
this.enable();},update_disabled:function(){disable=true;this.form_element.getElementsBySelector('input[type=checkbox]').each(function(check){if(check.checked){disable=false;}});if(disable){this.disable();$$('input.message_action').each(function(i){i.removeClassName('active');i.disable();});}
else{this.enable();$$('input.message_action').each(function(i){i.addClassName('active');i.enable();});}},smart_submit:function(){this.form_element.smart_submit(this.value);this.disable();}};InviteForm={initialize:function(action,conversation,token,redirect_url){this.options={action:action,redirect_url:redirect_url||action,conversation:conversation,token:token};},submit:function(decision){var form=new Element('form',{action:this.options.action,method:'post','class':'inline'});form.insert(new Element('input',{type:'hidden',name:'conversation',value:this.options.conversation}));form.insert(new Element('input',{type:'hidden',name:'invite',value:'true'}));form.insert(new Element('input',{type:'hidden',name:'redirect_url',value:this.options.redirect_url}));form.insert(new Element('input',{type:'hidden',name:'invitation',value:decision}));var comment_body=$('comment_body');if(comment_body){if(!comment_body.value.blank()){form.insert(new Element('input',{type:'hidden',name:'body',value:comment_body.value}));}}
this.insert(form);form.submit();}};var RecipientList=Class.create();RecipientList.prototype={initialize:function(recipient_container,possible_container,input_name){this.recipient_container=$(recipient_container);this.recipient_list=this.recipient_container.down('ol');this.possible_container=$(possible_container);this.possible_list=this.possible_container.down('ol');this.input_name=input_name;this.recipient_container.getElementsBySelector('li').each(function(element){this.makeSortable(element);}.bind(this));this.possible_container.getElementsBySelector('li').each(function(element){this.makeSortable(element);}.bind(this));this.recipient_list.getElementsBySelector('a').each(function(element){this.makeLinkWork(element);}.bind(this));this.possible_list.getElementsBySelector('a').each(function(element){this.makeLinkWork(element);}.bind(this));this.remove_all=this.recipient_container.getElementsBySelector('a.remove_all').first();this.remove_all.onclick=cancel;this.remove_all.observe('click',function(){this.removeAll();}.bind(this));this.select_all=this.possible_container.getElementsBySelector('a.select_all').first();this.select_all.onclick=cancel;this.select_all.observe('click',function(){this.selectAll();}.bind(this));this.linkSanity();},selectAll:function(){this.possible_list.getElementsBySelector('li').each(function(li){this.toggleQuickly(li);}.bind(this));this.linkSanity();},removeAll:function(){this.recipient_list.getElementsBySelector('li').each(function(li){this.toggleQuickly(li);}.bind(this));this.sort(this.possible_list);this.linkSanity();},toggleQuickly:function(li){if(li.hasClassName('RLRecipient')){this.unmakeRecipient(li);this.possible_list.insert({bottom:li});}
else{this.makeRecipient(li);this.recipient_list.insert({bottom:li});}},toggle:function(li){li.fade({duration:0.15,afterFinish:function(){this.toggleQuickly(li);this.sort(this.possible_list);this.linkSanity();li.appear({duration:0.15});}.bind(this)});},makeLinkWork:function(link){link.onclick=cancel;link.observe('click',function(){this.toggle(link.up('li'));}.bind(this));},makeRecipient:function(li){li.addClassName('RLRecipient');li.down('input').writeAttribute({name:this.input_name});},unmakeRecipient:function(li){li.removeClassName('RLRecipient');li.down('input').writeAttribute({name:null});},linkSanity:function(){if(this.recipient_list.childElements().length==0){this.remove_all.hide();}
else{this.remove_all.show();}
if(this.possible_list.childElements().length==0){this.select_all.hide();}
else{this.select_all.show();}},makeSortable:function(li){li.sortOrder='';if((match=li.className.toString().match(/sort_([a-z_-]+)/))){li.sortOrder=match[1];}},sort:function(container){list=container.childElements();list.each(function(i){i.remove();});list.sort(function(a,b){return(a.sortOrder==b.sortOrder?0:(a.sortOrder<b.sortOrder?-1:1));});list.each(function(item){container.insert({bottom:item});});}};function enableConversation(enable){if(enable){$('conversation_reply_field').show();$('conversation_disabled').hide();}
else{$('conversation_reply_field').hide();$('conversation_disabled').show();}};var IFrameShim=Class.create({option_list:{},run:false,initialize:function(obj_or_id,position_on_init,options){this.source_object=$(obj_or_id);this.run=this.ie_lte_6()&&this.source_object;if(!this.run)return;if(options)this.option_list=options;this.iframe=new Element('iframe',{'class':'shim','src':'javascript:;'});this.source_object.insert({'top':this.iframe});if(position_on_init)this.position();},position:function(){if(!this.run)return;if(this.option_list.positioner)
this.option_list.positioner(this.source_object,this.iframe);else{this.iframe.clonePosition(this.source_object,{offsetLeft:-2,offsetTop:-2});}},show:function(){if(!this.run)return;this.iframe.show();},hide:function(){if(!this.run)return;this.iframe.hide();},ie_lte_6:function(){var rv=10;var ua=navigator.userAgent;var re=new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");if(re.exec(ua)!=null)rv=parseFloat(RegExp.$1);return(rv<=6);}});Forum={initialize:function(){},reveal:function(){if(!this.cover_object.visible()||this.cover_object.fading){return;}
this.cover_object.fading=true;Element.clonePosition(this.cover_object,this);this.cover_object.fade({duration:0.5,from:0.8,to:0,queue:{position:'end',scope:'forum'},afterFinish:function(){this.cover_object.fading=false}.bind(this)})},cover:function(){if(!this.cover_object){this.cover_object=new Element('div',{'class':'forum_loading'});this.cover_object.setStyle({position:'absolute',opacity:'0','backgroundColor':'white'});this.insert({'after':this.cover_object});this.cover_object.fading=false;}
this.cover_object.clonePosition(this);this.cover_object.appear({duration:0.5,from:0,to:0.8,queue:{position:'end',scope:'forum'}})},eventWasEnterKey:function(event){if(typeof event=="undefined")event=window.event;return(event.keyCode==13);}}
BlockLoader={initialize:function(loading_class,scope){this.loading_class=loading_class;this.scope=scope;},reveal:function(){if(!this.cover_object.visible()||this.cover_object.fading){return;}
Element.clonePosition(this.cover_object,this);this.cover_object.fade({duration:0.5,from:0.8,to:0,queue:{position:'end',scope:this.scope},afterFinish:function(){this.cover_object.fading=false}.bind(this)})},cover:function(){if(!this.cover_object){this.cover_object=new Element('div',{'class':this.loading_class});this.cover_object.setStyle({position:'absolute',opacity:'0','backgroundColor':'white'});this.insert({'after':this.cover_object});this.cover_object.fading=false;}
Element.clonePosition(this.cover_object,this);this.cover_object.appear({duration:0.5,from:0,to:0.8,queue:{position:'end',scope:this.scope}})}}
var CalloutIFrameShim=null;var Callout=Class.create();Callout.prototype={duration:0.3,quick_duration:0.15,callout_id:'callout',timer:null,callback:null,hiding:false,initialize:function(element){element.observe('click',function(event){this.show(event)}.bindAsEventListener(this),false);this.raw_href=element.href;element.onclick=cancel;this.bindTimers(element);},bindTimers:function(element){element.observe('mouseover',function(){if(this.timer){clearTimeout(this.timer);}}.bindAsEventListener(this));element.observe('mouseout',function(){this.timer=setTimeout(function(){this.hide();}.bind(this),500);}.bindAsEventListener(this));},clearTimers:function(element){element.stopObserving('mouseover');element.stopObserving('mouseout');},show:function(event,pointerX,target){if(window._callout==this){this.hide();}
else if(window._callout){if(event){callback=function(){this.callout.show(false,this.eventX,this.target);}.bind({'callout':this,'eventX':event.pointerX(),'target':Event.element(event)})
window._callout.hideAndShow(callback);}}
else{window._callout=this;$(this.callout_id+'_links').getElementsBySelector('a.calloutReturn').each(function(element){element.href=element.href+'?return_to='+this.raw_href}.bind(this));if(event){pointerX=event.pointerX();target=Event.element(event);}
dimensions=this.callout().getDimensions();this.callout().setStyle({top:target.cumulativeOffset()[1]-dimensions.height+'px',left:pointerX+'px'});if(ie_lte_6()){this.callout().show();}
else{this.callout().appear({'duration':this.duration})}
this.bindTimers(this.callout());}},hide:function(duration){if(window._callout==this){if(this.hiding){return};this.hiding=true;clearTimeout(this.timer);this.clearTimers(this.callout());if(ie_lte_6()){this.callout().hide();this.afterFinish();}
else{this.callout().fade({'duration':duration||this.duration,afterFinish:this.afterFinish.bind(this)});}}},hideAndShow:function(callback){this.callback=callback;this.hide(this.quick_duration);},afterFinish:function(){if(window._callout==this){window._callout=null;this.hiding=false;if(this.callback){this.callback();this.callback=null;}}},callout:function(){if(this._callout){return this._callout;}
return this._callout=$(this.callout_id);}}
var PrivacyCallout=Class.create(Callout,{callout_id:'privacy_callout',initialize:function($super,element){$super(element);this.alt_text=element.readAttribute('title');element.observe('mouseover',function(event){this.show(event);}.bindAsEventListener(this),false);element.onmouseover=cancel;},show:function($super,event,pointerX,target){this.displayed_to().update(this.alt_text);$super(event,pointerX,target);},displayed_to:function(){return this._displayed_to?this._displayed_to:this._displayed_to=this.callout().select('#privacy_diplayed_to').first()}});var ReportCallout=Class.create(Callout,{callout_id:'report_callout'});function findCalloutTriggers(){$$('.callout').each(function(element){new Callout(element);});$$('.privacycallout').each(function(element){new PrivacyCallout(element);});$$('.reportcallout').each(function(element){new ReportCallout(element);});}
function prepareCallout(callout_id){if(link_set=$(callout_id+'_links')){link_set.getElementsBySelector('a').each(function(element){element.raw_href=element.href;});}
CalloutIFrameShim=new IFrameShim(callout_id,true,{positioner:function(source,iframe){dim=source.getDimensions();iframe.setStyle({top:0,left:0,width:dim.width+'px',height:dim.height+'px'})}});}
Timezone={formats:{'long':'%d %b %Y, %H:%M','short':'%d %b %Y','time':'%H:%M'},findAll:function(){$$('.tstamp_active').each(function(element){this.convert(element);}.bind(this));},convert:function(element){element.removeClassName('tstamp_active');var elementFormat=this.formats[element.className.toString().match(/tstamp_(long|short|time)/)[1]];if(elementFormat.blank()){return;}
var stamp=element.className.toString().match(/tstamp_([0-9_]+)/)[1].split('_').collect(function(i){return parseInt(Timezone.removeLeadingZeroes(i));});var time=new Date();time.setUTCFullYear(stamp[0]);time.setUTCMonth(stamp[1]-1);time.setUTCDate(stamp[2]);time.setUTCHours(stamp[3]);time.setUTCMinutes(stamp[4]);element.update(time.strftime(elementFormat));},removeLeadingZeroes:function(i){return i.match(/^0?([0-9]*)$/)[1];}};MagicLinker.addSystem('community',function(){if(obj=$('header_language_error')){Object.extend(obj.up('span'),HeaderLanguageError).initialise(obj);};});MagicLinker.addSystem('community',function(){if(obj=$('community_quick_list')){action=function(){Effect.toggle(this,'appear',{'duration':0.2,afterUpdate:function(){this.position();}.bind(this.shim)});}.bind(obj);obj.shim=new IFrameShim(obj,false);$$('#header a.communities').first().observe('click',action);obj.getElementsBySelector('a.close').first().observe('click',action);}});MagicLinker.addSystem('community',function(){var obj=$('update_forum_thread_view_count');if(obj)new Ajax.Request(obj.value);});MagicLinker.addSystem('community',function(){$$('.find_filter a.title').each(function(i){i.observe('click',function(){div=this.up('div');if(div.hasClassName('closed')){div.removeClassName('closed');}
else{div.addClassName('closed');}}.bindAsEventListener(i));});});MagicLinker.addSystem('community',function(){getBrowserInfo();addLightboxMarkup();});MagicLinker.addSystem('community',function(){prepareCallout('callout');prepareCallout('report_callout');prepareCallout('privacy_callout');});MagicLinker.addSystem('community',function(){$$('.communities_list_container').each(function(element){Object.extend(element,BlockLoader).initialize('forum_loading','communities');});});MagicLinker.addSystem('community',function(){$$('.notice_list').each(function(element){NoticeList.makeNoticeList(element);});});MagicLinker.addSystem('community',function(){$$('form').each(function(form){form.observe('submit',function(){form.getInputs('submit').each(function(submit){submit.removeClassName('active');submit.disable();});});form.getInputs('button','cancel').each(function(cancel){cancel.observe('click',function(){cancel.disable();});});});});MagicLinker.add('community',function(){setTimeout('SubmitController.init()',5);});MagicLinker.add('community',function(){Timezone.findAll();});MagicLinker.add('community',findLightboxTriggers);MagicLinker.add('community',findCalloutTriggers);MagicLinker.add('community',SmartUserDisplay.initAllSmartUserDisplays);MagicLinker.add('community',function(){$$('.resize_on_focus').each(function(item){item.removeClassName('resize_on_focus');item.observe('focus',function(e){InputResizer.magic(e.target);});});});MagicLinker.addSystem('community',function(){if(window._scroll_to){$(window._scroll_to).scrollTo();}});var BareItemListHandler=Class.create({initialize:function(item_list){this.item_list=$(item_list);this.item_list.observe('click',this.clickHandler.bindAsEventListener(this));items=this.item_list.getElementsBySelector('li');if(items.length>0){items.each(function(item){item.observe('click',this.clickHandler.bindAsEventListener(this));item.addClassName('linked');}.bind(this));}},clickHandler:function(event){var target=$(event.target);if(target.nodeName.toLowerCase()=='a'){}
else{if(target.nodeName.toLowerCase()=='li'){var item=target;}
else{var item=target.up('li.item');}
cancel(event,true);window.location.href=item.down('h3 a').href;}}});MagicLinker.addSystem('community',function(event){var list=$('item_list');if(list){new BareItemListHandler(list);}});