
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);MagicLinker={processes:[],systemProcesses:[],add:function(callback){this.processes.push(callback);},run:function(){this.processes.each(function(i){try{i();}catch(err){alert(err.message+'\n'+i.toString());}});},addSystem:function(callback){this.systemProcesses.push(callback);},runSystem:function(){this.systemProcesses.each(function(i){i();});}}
function cancel(e,cancelBubble){if(cancelBubble){e.cancelBubble=true;}
if(e&&e.preventDefault){e.preventDefault();}
return false;}
function loadingHTML(){return'<span class="loading">'+'</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();document.observe('dom:loaded',function(){this.intimidateAllLinks();this.lightbox=new ManualLightbox();this.lightbox.autosizeable();}.bind(this));},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");};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.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});}}});document.observe('dom:loaded',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){target.languageContainer=$("language_options");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':'-9px','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;}}
document.observe('dom:loaded',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"));if(language_prompt=$('language_prompt_container')){displayLanguageChangePrompt(language_prompt);}
MagicLinker.runSystem();MagicLinker.run();if(obj=$('main_location_selector')){obj.method='get';}
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.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;}}
document.observe('dom:loaded',function(){getBrowserInfo();findLightboxTriggers();});document.observe('dom:loaded',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://assets.just-landed.com');