Form.showErrors=function(a,b){a=$(a);$H(b).each(function(c){$H(c.value).each(function(d){var e=$(c.key+"_"+d.key);if(e){e.up("dl").addClassName("error");e.up("dl").down("span.info").update(d.value)}})})};Form.clearErrors=function(a,b){a=$(a);if(typeof b!="undefined"){b=b instanceof Array?b:[b];$A(b).each(function(c){$(c).up("dl").removeClassName("error")})}else $A(a.getElementsByTagName("dl")).each(function(c){$(c).removeClassName("error")})};Form.Element.DefaultValue=Class.create();
Form.Element.DefaultValue.prototype={initialize:function(a,b,c){this.value=b.replace(/&#180;/g,"'");this.input=$(a);this.translatorId=c;Event.observe(this.input,"focus",this.onFocus.bind(this));Event.observe(this.input,"blur",this.onBlur.bind(this));if(typeof this.input.form.onsubmit=="function"){this.formOnSubmit=this.input.form.onsubmit;this.input.form.onsubmit=function(){this.onFocus();return this.formOnSubmit.apply(this.input.form,arguments)}.bind(this)}else this.input.form.onsubmit=this.onFocus.bind(this);
Event.observe(this.input.form,"submit",this.onFocus.bind(this));this.onBlur()},onUpdate:function(){},onFocus:function(){if(typeof Translator!="undefined"&&Translator.editMode)Translator.edit(this.translatorId,this.input);else if(Element.hasClassName(this.input,"descrgrey")){Element.removeClassName(this.input,"descrgrey");this.input.value=""}},onBlur:function(){if(this.input.value==""||this.input.value==this.value){Element.addClassName(this.input,"descrgrey");this.input.value=this.value}}};
Form.Element.MaxLength=Class.create();
Form.Element.MaxLength.prototype={initialize:function(a,b,c){this.input=$(a);this.maxLength=b;this.styleColor=typeof c=="undefined"?"#333333":c;new Form.Element.Observer(this.input,2,this.onUpdate.bind(this));this.onUpdate()},onUpdate:function(){var a=Element.hasClassName(this.input,"descrgrey")?0:this.input.value.replace(/\n/g,"<br/>").length;$(this.input.id+"_length").update(a);if(a>this.maxLength)$(this.input.id+"_length").parentNode.style.color="#ff0000";else $(this.input.id+"_length").parentNode.style.color=
this.styleColor}};var NiceInputs={initialize:function(){this.rebuild()},rebuild:function(a){a=typeof a!="undefined"?$(a):document;$A(a.getElementsByTagName("input")).findAll(function(b){return["radio","checkbox"].detect(function(c){return b.type==c})&&typeof b.fake=="undefined"&&b.style.display!="none"&&b.style.visibility!="hidden"}).each(function(b){if(navigator.userAgent.indexOf("KHTML")!=-1)b.check=function(c){b.checked=c}.bind(b);else new NiceInput(b)})}},NiceInput=Class.create();
NiceInput.prototype={initialize:function(a){a.fake=this;this.staticUrl=_STATIC_URL;this.onChange=this.onChange.bindAsEventListener(this);if(navigator.userAgent.indexOf("KHTML")==-1){this.input=$(a);a=this.input.id?$(this.input.form).down("label[for="+this.input.id+"]"):false;this.input.check=function(c){this.input.checked=c;this.setBackgroundPosition()}.bind(this);this.fakeInput=$(document.createElement(a?"span":"label"));this.fakeInput.className="fakeInput";this.fakeInput.style.background="url("+
_STATIC_URL+"/img/explore/radio-map.gif) no-repeat center";this.fakeInput.style.display="inline";Element.setStyle(this.fakeInput,{zoom:"1"});var b={};["float","position","top","left","right","bottom"].each(function(c){b[c]=Element.getStyle(this.input,c)}.bind(this));this.fakeInput.setStyle(b);this.input.setStyle({"float":"none",position:"static"});if(!this.input.id)this.input.id=Math.random()*Math.pow(10,20);a||this.fakeInput.setAttribute("for",this.input.id);Element.setOpacity(this.input,0);this.input.parentNode.insertBefore(this.fakeInput,
this.input).appendChild(this.input);this.setBackgroundPosition();if(navigator.userAgent.indexOf("MSIE")!=-1){Event.observe(this.input,"click",this.onChange);Event.observe(this.input,"keydown",this.onChange);$A(this.input.form.getElementsByTagName("label")).findAll(function(c){return c["for"]==this.input.id}.bind(this)).each(function(c){Event.observe(c,"click",this.onChange)}.bind(this))}else Event.observe(this.input,"change",this.onChange)}},getBackgroundUrl:function(){return _STATIC_URL+"/img/explore/input"+
this.input.type.toUpperCase()+(this.input.checked?"checked":"")+(Element.hasClassName(this.input,"error")?"R":"")+".gif"},getBackgroundPosition:function(){var a=this.fakeInput.offsetWidth||this.getStdDimensioins()[0],b=this.fakeInput.offsetHeight||this.getStdDimensioins()[1],c=this.input.type=="checkbox"?0:-40;c+=this.input.checked?-20:0;c-=(20-a)/2;a=-((20-b)/2);if(navigator.appVersion.match(/MSIE 8/))c-=1;return Math.round(c)+"px "+Math.round(a)+"px"},setBackgroundPosition:function(){Element.setStyle(this.fakeInput,
{backgroundPosition:this.getBackgroundPosition()})},getStdDimensioins:function(){if(typeof this.stdDimensions=="undefined"){var a=$(document.body.appendChild(Builder.node("label",Builder.node("input",{type:"checkbox"}))));this.stdDimensions=[a.offsetWidth,a.offsetHeight];a.remove()}return this.stdDimensions},onChange:function(){this.input.check(this.input.checked);try{this.input.blur()}catch(a){}this.input.checked&&this.input.type=="radio"&&Form.getInputs(this.input.form,"radio",this.input.name).each(function(b){this.input.parentNode.hasClassName("fakeInput")&&
this.input!=b&&b.check(false)}.bind(this))}};Event.onDOMReady(function(){setTimeout(NiceInputs.initialize.bind(NiceInputs),1)});
var Inbox={page:0,initialize:function(a){this.type=a},loadList:function(a,b,c){$("foldersList").immediateDescendants().each(function(d){d[d==c?"addClassName":"removeClassName"]("active")});this.type=a;this.page=b;new Ajax.Updater("messagesList","/ajax/userMessages/fetch/"+a+"/"+b,{onSuccess:function(){NiceInputs.rebuild("messagesList")}});$("messagesList").show();$("newMessage").hide()},toogleMailContent:function(a,b){var c=$(a).up();a=c.next();$("messagesTbody").immediateDescendants().each(function(d,
e){if(!(e%2)&&d!=c){d.next().hide();d.removeClassName("expanded")}});a.toggle();c[c.hasClassName(c,"expanded")?"removeClassName":"addClassName"]("expanded");c.hasClassName("notReaded")&&this.markReaded(b,c)},markReaded:function(a,b){new Ajax.Request("/ajax/userMessages/markReaded/"+a);$(b).removeClassName("notReaded");a=$("unreadedCount");b=parseInt(a.innerHTML)-1;a.update(b);b||a.up("li").removeClassName("unreaded")},selectAll:function(){var a=$("checkAll").checked;$A($("messagesList").getElementsByTagName("input")).each(function(b){if(b.checked!=
(b.checked=a)&&b.fake)try{b.check(a)}catch(c){}}.bind(this))},addRecipient:function(a,b){$("user_messages_recipient").down("input[value="+b+"]")||$("user_messages_recipient").appendChild(Builder.node("li",[Builder.node("a",{},[Builder.node("input",{type:"hidden",name:"recipients[]",value:b}),Builder.node("span",{className:"remove",onclick:function(){$(this).up("li").remove()}}),a])]))},makeReply:function(a){new Ajax.Updater("newMessage","/ajax/userMessages/reply/"+a);$("messagesList").hide();$("newMessage").show()},
send:function(){new Ajax.Request("/ajax/userMessages/send",{parameters:Form.serialize("messageForm"),form:$("messageForm"),onSuccess:function(a,b){$("outgoingCount").innerHTML=parseInt($("outgoingCount").innerHTML)+b.sendedMessagesCount;this.loadList("outgoing",0);this.reset()}.bind(this)})},reset:function(){$("user_message_subject").value="";$("user_message_text").value="";$("contactSearch").value="";$("user_messages_recipient").value=""},remove:function(){var a=$("messagesForm").serialize();a&&
new Ajax.Updater("messagesList","/ajax/userMessages/remove/"+this.type+"/"+this.page,{parameters:a,onSuccess:function(b,c){NiceInputs.rebuild("messagesList");$H(c.count).each(function(d){$(d[0]+"Count").update(d[1])})}})},autocompleterSelector:function(a){for(var b=[],c=[],d=a.getToken(),e=false,h=0;h<a.options.array.length&&b.length<a.options.choices;h++){for(var f=a.options.array[h][1],g=a.options.ignoreCase?f.toLowerCase().indexOf(d.toLowerCase()):f.indexOf(d);g!=-1;){if(g==0&&f.length!=d.length){b.push('<li id="friend_'+
a.options.array[h][0]+'"><u>'+f.substr(0,d.length)+"</u>"+f.substr(d.length)+"</li>");break}else if(d.length>=a.options.partialChars&&a.options.partialSearch&&g!=-1)if(a.options.fullSearch||/\s/.test(f.substr(g-1,1))){c.push('<li id="friend_'+a.options.array[h][0]+'">'+f.substr(0,g)+"<u>"+f.substr(g,d.length)+"</u>"+f.substr(g+d.length)+"</li>");break}g=a.options.ignoreCase?f.toLowerCase().indexOf(d.toLowerCase(),g+1):f.indexOf(d,g+1)}if(!e&&(e=a.options.array[h][1]==d))$("user_messages_recipient").value=
a.options.array[h][0]}if(!e)$("user_messages_recipient").value="";if(c.length)b=b.concat(c.slice(0,a.options.choices-b.length));return"<ul>"+b.join("")+"</ul>"},abuseReport:function(a){new Ajax.Request("/ajax/userMessages/abuseReport/"+a,{})}},Autocompleter={};Autocompleter.Base=function(){};
Autocompleter.Base.prototype={baseInitialize:function(a,b,c){this.element=$(a);this.update=$(b);this.active=this.changed=this.hasFocus=false;this.entryCount=this.index=0;if(this.setOptions)this.setOptions(c);else this.options=c||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(d,e){if(!e.style.position||
e.style.position=="absolute"){e.style.position="absolute";Position.clone(d,e,{setHeight:false,offsetTop:d.offsetHeight})}Effect.Appear(e,{duration:0.15})};this.options.onHide=this.options.onHide||function(d,e){new Effect.Fade(e,{duration:0.15})};if(typeof this.options.tokens=="string")this.options.tokens=new Array(this.options.tokens);this.observer=null;this.element.setAttribute("autocomplete","off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));
Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this))},show:function(){Element.getStyle(this.update,"display")=="none"&&this.options.onShow(this.element,this.update);if(!this.iefix&&navigator.appVersion.indexOf("MSIE")>0&&navigator.userAgent.indexOf("Opera")<0&&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")}this.iefix&&setTimeout(this.fixIEOverlapping.bind(this),50)},fixIEOverlapping:function(){Position.clone(this.update,this.iefix);this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();Element.getStyle(this.update,"display")!="none"&&this.options.onHide(this.element,this.update);this.iefix&&Element.hide(this.iefix)},startIndicator:function(){this.options.indicator&&Element.show(this.options.indicator)},
stopIndicator:function(){this.options.indicator&&Element.hide(this.options.indicator)},onKeyPress:function(a){if(this.active)switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(a);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(a);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();navigator.appVersion.indexOf("AppleWebKit")>0&&Event.stop(a);return;case Event.KEY_DOWN:this.markNext();this.render();
navigator.appVersion.indexOf("AppleWebKit")>0&&Event.stop(a);return}else if(a.keyCode==Event.KEY_TAB||a.keyCode==Event.KEY_RETURN||navigator.appVersion.indexOf("AppleWebKit")>0&&a.keyCode==0)return;this.hasFocus=this.changed=true;this.observer&&clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1E3)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(a){var b=Event.findElement(a,"LI");if(this.index!=
b.autocompleteIndex){this.index=b.autocompleteIndex;this.render()}Event.stop(a)},onClick:function(a){this.index=Event.findElement(a,"LI").autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(){setTimeout(this.hide.bind(this),250);this.active=this.hasFocus=false},render:function(){if(this.entryCount>0){for(var a=0;a<this.entryCount;a++)this.index==a?Element.addClassName(this.getEntry(a),"selected"):Element.removeClassName(this.getEntry(a),"selected");if(this.hasFocus){this.show();this.active=
true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0)this.index--;else this.index=this.entryCount-1},markNext:function(){if(this.index<this.entryCount-1)this.index++;else this.index=0},getEntry:function(a){return this.update.firstChild.childNodes[a]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(a){if(this.options.updateElement)this.options.updateElement(a);
else{var b="";if(this.options.select){var c=document.getElementsByClassName(this.options.select,a)||[];if(c.length>0)b=Element.collectTextNodes(c[0],this.options.select)}else b=Element.collectTextNodesIgnoreClass(a,"informal");var d=this.findLastToken();if(d!=-1){c=this.element.value.substr(0,d+1);if(d=this.element.value.substr(d+1).match(/^\s+/))c+=d[0];this.element.value=c+b}else this.element.value=b;this.element.focus();this.options.afterUpdateElement&&this.options.afterUpdateElement(this.element,
a)}},updateChoices:function(a){if(!this.changed&&this.hasFocus){this.update.innerHTML=a;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.firstChild);if(this.update.firstChild&&this.update.firstChild.childNodes){this.entryCount=this.update.firstChild.childNodes.length;for(a=0;a<this.entryCount;a++){var b=this.getEntry(a);b.autocompleteIndex=a;this.addObservers(b)}}else this.entryCount=0;this.stopIndicator();this.index=0;this.render()}},addObservers:function(a){Event.observe(a,
"mouseover",this.onHover.bindAsEventListener(this));Event.observe(a,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;if(this.getToken().length>=this.options.minChars){this.startIndicator();this.getUpdatedChoices()}else{this.active=false;this.hide()}},getToken:function(){var a=this.findLastToken();a=a!=-1?this.element.value.substr(a+1).replace(/^\s+/,"").replace(/\s+$/,""):this.element.value;return/\n/.test(a)?"":a},findLastToken:function(){for(var a=-1,
b=0;b<this.options.tokens.length;b++){var c=this.element.value.lastIndexOf(this.options.tokens[b]);if(c>a)a=c}return a}};Ajax.Autocompleter=Class.create();
Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(a,b,c,d){this.baseInitialize(a,b,d);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=c},getUpdatedChoices:function(){var a=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,a):a;if(this.options.defaultParams)this.options.parameters+=
"&"+this.options.defaultParams;new Ajax.Request(this.url,this.options)},onComplete:function(a){this.updateChoices(a.responseText)}});Autocompleter.Local=Class.create();
Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base,{initialize:function(a,b,c,d){this.baseInitialize(a,b,d);this.options.array=c},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(a){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(b){for(var c=[],d=[],e=b.getToken(),h=0;h<b.options.array.length&&c.length<b.options.choices;h++)for(var f=b.options.array[h],g=b.options.ignoreCase?
f.toLowerCase().indexOf(e.toLowerCase()):f.indexOf(e);g!=-1;){if(g==0&&f.length!=e.length){c.push("<li><strong>"+f.substr(0,e.length)+"</strong>"+f.substr(e.length)+"</li>");break}else if(e.length>=b.options.partialChars&&b.options.partialSearch&&g!=-1)if(b.options.fullSearch||/\s/.test(f.substr(g-1,1))){d.push("<li>"+f.substr(0,g)+"<strong>"+f.substr(g,e.length)+"</strong>"+f.substr(g+e.length)+"</li>");break}g=b.options.ignoreCase?f.toLowerCase().indexOf(e.toLowerCase(),g+1):f.indexOf(e,g+1)}if(d.length)c=
c.concat(d.slice(0,b.options.choices-c.length));return"<ul>"+c.join("")+"</ul>"}},a||{})}});Field.scrollFreeActivate=function(a){setTimeout(function(){Field.activate(a)},1)};Ajax.InPlaceEditor=Class.create();Ajax.InPlaceEditor.defaultHighlightColor="#FFFF99";
Ajax.InPlaceEditor.prototype={initialize:function(a,b,c){this.url=b;this.element=$(a);this.options=Object.extend({okButton:true,okText:"ok",cancelLink:true,cancelText:"cancel",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(d,e){new Effect.Highlight(e,{startcolor:this.options.highlightcolor})},onFailure:function(d){alert("Error communicating with the server: "+d.responseText.stripTags())},callback:function(d){return Form.serialize(d)},handleLineBreaks:true,
loadingText:"Loading...",savingClassName:"inplaceeditor-saving",loadingClassName:"inplaceeditor-loading",formClassName:"inplaceeditor-form",highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,submitOnBlur:false,ajaxOptions:{},evalScripts:false},c||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId))this.options.formId=null}if(this.options.externalControl)this.options.externalControl=
$(this.options.externalControl);this.originalBackground=Element.getStyle(this.element,"background-color");if(!this.originalBackground)this.originalBackground="transparent";this.element.title=this.options.clickToEditText;this.onclickListener=this.enterEditMode.bindAsEventListener(this);this.mouseoverListener=this.enterHover.bindAsEventListener(this);this.mouseoutListener=this.leaveHover.bindAsEventListener(this);Event.observe(this.element,"click",this.onclickListener);Event.observe(this.element,"mouseover",
this.mouseoverListener);Event.observe(this.element,"mouseout",this.mouseoutListener);if(this.options.externalControl){Event.observe(this.options.externalControl,"click",this.onclickListener);Event.observe(this.options.externalControl,"mouseover",this.mouseoverListener);Event.observe(this.options.externalControl,"mouseout",this.mouseoutListener)}},enterEditMode:function(a){if(!this.saving)if(!this.editing){this.editing=true;this.onEnterEditMode();this.options.externalControl&&Element.hide(this.options.externalControl);
Element.hide(this.element);this.createForm();this.element.parentNode.insertBefore(this.form,this.element);Field.scrollFreeActivate(this.editField);a&&Event.stop(a);return false}},createForm:function(){this.form=document.createElement("form");this.form.id=this.options.formId;Element.addClassName(this.form,this.options.formClassName);this.form.onsubmit=this.onSubmit.bind(this);this.createEditField();this.options.textarea&&this.form.appendChild(document.createElement("br"));if(this.options.okButton){okButton=
document.createElement("input");okButton.type="submit";okButton.value=this.options.okText;okButton.className="editor_ok_button";this.form.appendChild(okButton)}if(this.options.cancelLink){cancelLink=document.createElement("a");cancelLink.href="#";cancelLink.appendChild(document.createTextNode(this.options.cancelText));cancelLink.onclick=this.onclickCancel.bind(this);cancelLink.className="editor_cancel";this.form.appendChild(cancelLink)}},hasHTMLLineBreaks:function(a){if(!this.options.handleLineBreaks)return false;
return a.match(/<br/i)||a.match(/<p>/i)},convertHTMLLineBreaks:function(a){return a.replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<p>/gi,"")},createEditField:function(){var a;a=this.options.loadTextURL?this.options.loadingText:this.getText();if(this.options.rows==1&&!this.hasHTMLLineBreaks(a)){this.options.textarea=false;var b=document.createElement("input");b.obj=this;b.type="text";b.name="value";b.value=a;b.style.backgroundColor=this.options.highlightcolor;b.className=
"editor_field";a=this.options.size||this.options.cols||0;if(a!=0)b.size=a;if(this.options.submitOnBlur)b.onblur=this.onSubmit.bind(this);this.editField=b}else{this.options.textarea=true;b=document.createElement("textarea");b.obj=this;b.name="value";b.value=this.convertHTMLLineBreaks(a);b.rows=this.options.rows;b.cols=this.options.cols||40;b.className="editor_field";if(this.options.submitOnBlur)b.onblur=this.onSubmit.bind(this);this.editField=b}this.options.loadTextURL&&this.loadExternalText();this.form.appendChild(this.editField)},
getText:function(){return this.element.innerHTML},loadExternalText:function(){Element.addClassName(this.form,this.options.loadingClassName);this.editField.disabled=true;new Ajax.Request(this.options.loadTextURL,Object.extend({asynchronous:true,onComplete:this.onLoadedExternalText.bind(this)},this.options.ajaxOptions))},onLoadedExternalText:function(a){Element.removeClassName(this.form,this.options.loadingClassName);this.editField.disabled=false;this.editField.value=a.responseText.stripTags()},onclickCancel:function(){this.onComplete();
this.leaveEditMode();return false},onFailure:function(a){this.options.onFailure(a);if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;this.oldInnerHTML=null}return false},onSubmit:function(){var a=this.form,b=this.editField.value;this.onLoading();if(this.options.evalScripts)new Ajax.Request(this.url,Object.extend({parameters:this.options.callback(a,b),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this),asynchronous:true,evalScripts:true},this.options.ajaxOptions));
else new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(a,b),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this)},this.options.ajaxOptions));arguments.length>1&&Event.stop(arguments[0]);return false},onLoading:function(){this.saving=true;this.removeForm();this.leaveHover();this.showSaving()},showSaving:function(){this.oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;Element.addClassName(this.element,
this.options.savingClassName);this.element.style.backgroundColor=this.originalBackground;Element.show(this.element)},removeForm:function(){if(this.form){this.form.parentNode&&Element.remove(this.form);this.form=null}},enterHover:function(){if(!this.saving){this.element.style.backgroundColor=this.options.highlightcolor;this.effect&&this.effect.cancel();Element.addClassName(this.element,this.options.hoverClassName)}},leaveHover:function(){if(this.options.backgroundColor)this.element.style.backgroundColor=
this.oldBackground;Element.removeClassName(this.element,this.options.hoverClassName);if(!this.saving)this.effect=new Effect.Highlight(this.element,{startcolor:this.options.highlightcolor,endcolor:this.options.highlightendcolor,restorecolor:this.originalBackground})},leaveEditMode:function(){Element.removeClassName(this.element,this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this.originalBackground;Element.show(this.element);this.options.externalControl&&
Element.show(this.options.externalControl);this.saving=this.editing=false;this.oldInnerHTML=null;this.onLeaveEditMode()},onComplete:function(a){this.leaveEditMode();this.options.onComplete.bind(this)(a,this.element)},onEnterEditMode:function(){},onLeaveEditMode:function(){},dispose:function(){if(this.oldInnerHTML)this.element.innerHTML=this.oldInnerHTML;this.leaveEditMode();Event.stopObserving(this.element,"click",this.onclickListener);Event.stopObserving(this.element,"mouseover",this.mouseoverListener);
Event.stopObserving(this.element,"mouseout",this.mouseoutListener);if(this.options.externalControl){Event.stopObserving(this.options.externalControl,"click",this.onclickListener);Event.stopObserving(this.options.externalControl,"mouseover",this.mouseoverListener);Event.stopObserving(this.options.externalControl,"mouseout",this.mouseoutListener)}}};Ajax.InPlaceCollectionEditor=Class.create();Object.extend(Ajax.InPlaceCollectionEditor.prototype,Ajax.InPlaceEditor.prototype);
Object.extend(Ajax.InPlaceCollectionEditor.prototype,{createEditField:function(){if(!this.cached_selectTag){var a=document.createElement("select"),b;(this.options.collection||[]).each(function(c){b=document.createElement("option");b.value=c instanceof Array?c[0]:c;if(this.options.value==b.value)b.selected=true;b.appendChild(document.createTextNode(c instanceof Array?c[1]:c));a.appendChild(b)}.bind(this));this.cached_selectTag=a}this.editField=this.cached_selectTag;this.options.loadTextURL&&this.loadExternalText();
this.form.appendChild(this.editField);this.options.callback=function(c,d){return"value="+encodeURIComponent(d)}}});Form.Element.DelayedObserver=Class.create();
Form.Element.DelayedObserver.prototype={initialize:function(a,b,c){this.delay=b||0.5;this.element=$(a);this.callback=c;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(){if(this.lastValue!=$F(this.element)){this.timer&&clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1E3);this.lastValue=$F(this.element)}},onTimerEvent:function(){this.timer=null;this.callback(this.element,
$F(this.element))}};var Rotations=Class.create();Rotations.prototype={rotations:[],initialize:function(){this.rotations=$A(arguments).map(function(a,b){return new Rotation(a,this,Rotation.intervalTime+1E3*b)}.bind(this))},run:function(){this.rotations.each(function(a,b){a.run(5E3+1E3*b)})},stop:function(){this.rotations.each(function(a){a.stop()})}};var Rotation=Class.create();Rotation.intervalTime=5E3;
Rotation.prototype={timeoutId:null,currentIndex:0,initialize:function(a,b,c){this.parent=$(a);this.list=this.parent.immediateDescendants();if(this.list.length>1){Event.observe(this.parent,"mouseover",b?b.stop.bind(b):this.stop.bind(this));Event.observe(this.parent,"mouseout",b?b.run.bind(b):this.run.bind(this));this.run(c)}},stop:function(){clearTimeout(this.timeoutId)},run:function(a){a=typeof a=="number"?a:Rotation.intervalTime;this.timeoutId=setTimeout(this.rotate.bind(this),a)},rotate:function(){new Effect.Fade(this.current());
new Effect.Appear(this.next());this.currentIndex=(this.currentIndex+1)%this.list.length;this.run()},current:function(){return this.list[this.currentIndex]},next:function(){return this.list[(this.currentIndex+1)%this.list.length]}};if(typeof deconcept=="undefined")var deconcept={};if(typeof deconcept.util=="undefined")deconcept.util={};if(typeof deconcept.SWFObjectUtil=="undefined")deconcept.SWFObjectUtil={};
deconcept.SWFObject=function(a,b,c,d,e,h,f,g,j,k,l){if(document.getElementById){this.DETECT_KEY=l?l:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params={};this.variables={};this.attributes=[];a&&this.setAttribute("swf",a);b&&this.setAttribute("id",b);c&&this.setAttribute("width",c);d&&this.setAttribute("height",d);e&&this.setAttribute("version",new deconcept.PlayerVersion(e.toString().split(".")));this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
h&&this.addParam("bgcolor",h);this.addParam("quality",g?g:"high");this.setAttribute("useExpressInstall",f);this.setAttribute("doExpressInstall",false);this.setAttribute("xiRedirectUrl",j?j:window.location);this.setAttribute("redirectUrl","");k&&this.setAttribute("redirectUrl",k)}};
deconcept.SWFObject.prototype={setAttribute:function(a,b){this.attributes[a]=b},getAttribute:function(a){return this.attributes[a]},addParam:function(a,b){this.params[a]=b},getParams:function(){return this.params},addVariable:function(a,b){this.variables[a]=b},getVariable:function(a){return this.variables[a]},getVariables:function(){return this.variables},getVariablePairs:function(){var a=[],b,c=this.getVariables();for(b in c)a.push(b+"="+c[b]);return a},getSWFHTML:function(){var a="";if(navigator.plugins&&
navigator.mimeTypes&&navigator.mimeTypes.length){this.getAttribute("doExpressInstall")&&this.addVariable("MMplayerType","PlugIn");a='<embed type="application/x-shockwave-flash" src="'+this.getAttribute("swf")+'" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'"';a+=' id="'+this.getAttribute("id")+'" name="'+this.getAttribute("id")+'" ';var b=this.getParams();for(var c in b)a+=[c]+'="'+b[c]+'" ';b=this.getVariablePairs().join("&amp;");if(b.length>0)a+='flashvars="'+b+
'"';a+="/>"}else{this.getAttribute("doExpressInstall")&&this.addVariable("MMplayerType","ActiveX");a='<object id="'+this.getAttribute("id")+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'">';a+='<param name="movie" value="'+this.getAttribute("swf")+'" />';b=this.getParams();for(c in b)a+='<param name="'+c+'" value="'+b[c]+'" />';b=this.getVariablePairs().join("&amp;");if(b.length>0)a+='<param name="flashvars" value="'+
b+'" />';a+="</object>"}return a},write:function(a){if(this.getAttribute("useExpressInstall"))if(this.installedVer.versionIsValid(new deconcept.PlayerVersion([6,0,65]))&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title)}if(this.skipDetect||this.getAttribute("doExpressInstall")||
this.installedVer.versionIsValid(this.getAttribute("version"))){(typeof a=="string"?document.getElementById(a):a).innerHTML=this.getSWFHTML();return true}else this.getAttribute("redirectUrl")!=""&&window.location.replace(this.getAttribute("redirectUrl"));return false}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){var a=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var b=navigator.plugins["Shockwave Flash"];if(b&&b.description)a=new deconcept.PlayerVersion(b.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."))}else{try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(c){try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");a=new deconcept.PlayerVersion([6,0,21]);b.AllowScriptAccess=
"always"}catch(d){if(a.major==6)return a}try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){}}if(b!=null)a=new deconcept.PlayerVersion(b.GetVariable("$version").split(" ")[1].split(","))}return a};deconcept.PlayerVersion=function(a){this.major=a[0]!=null?parseInt(a[0]):0;this.minor=a[1]!=null?parseInt(a[1]):0;this.rev=a[2]!=null?parseInt(a[2]):0};
deconcept.PlayerVersion.prototype.versionIsValid=function(a){if(this.major<a.major)return false;if(this.major>a.major)return true;if(this.minor<a.minor)return false;if(this.minor>a.minor)return true;if(this.rev<a.rev)return false;return true};deconcept.util={getRequestParameter:function(a){var b=window.location.search||window.location.hash;if(b){b=b.substring(1).split("&");for(var c=0;c<b.length;c++)if(b[c].substring(0,b[c].indexOf("="))==a)return b[c].substring(b[c].indexOf("=")+1)}return""}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){if(!(window.opera||!document.all))for(var a=document.getElementsByTagName("OBJECT"),b=0;b<a.length;b++){a[b].style.display="none";for(var c in a[b])if(typeof a[b][c]=="function")a[b][c]=function(){}}};deconcept.SWFObjectUtil.prepUnload=function(){if(typeof window.onunload=="function"){var a=window.onunload;window.onunload=function(){deconcept.SWFObjectUtil.cleanupSWFs();a()}}else window.onunload=deconcept.SWFObjectUtil.cleanupSWFs};
if(typeof window.onbeforeunload=="function"){var oldBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){deconcept.SWFObjectUtil.prepUnload();oldBeforeUnload()}}else window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;if(Array.prototype.push==null)Array.prototype.push=function(a){this[this.length]=a;return this.length};
var getQueryParamValue=deconcept.util.getRequestParameter,FlashObject=deconcept.SWFObject,SWFObject=deconcept.SWFObject,SuggestionsUpdater={requestNumber:0,initialize:function(a){this.siteType=a;$("site_uri")._lastValue=$F("site_uri");$("site_uri")._suggested=false;a=["site_display_name"];if(this.siteType=="tribute")a=a.concat(["tribute_date_of_birth_Month","tribute_date_of_birth_Day","tribute_date_of_birth_Year","tribute_date_of_death_Month","tribute_date_of_death_Day","tribute_date_of_death_Year"]);
if(this.siteType=="pet")a=a.concat(["pet_date_of_birth_Month","pet_date_of_birth_Day","pet_date_of_birth_Year","pet_date_of_death_Month","pet_date_of_death_Day","pet_date_of_death_Year"]);if(this.siteType=="lifestory")a=a.concat(["lifestory_date_of_birth_Month","lifestory_date_of_birth_Day","lifestory_date_of_birth_Year"]);if(this.siteType=="wedding")a=["wedding_wife_name","wedding_husband_name","wedding_date_of_wedding_Month","wedding_date_of_wedding_Day","wedding_date_of_wedding_Year"];if(this.siteType==
"baby")a=a.concat(["baby_date_of_birth_Month","baby_date_of_birth_Day","baby_date_of_birth_Year"]);a.each(function(b,c){Event.observe(b,"change",this.updateSuggestion.bind(this,c>3?2:c?1:c))}.bind(this));this.updateSuggestion(0)},updateSuggestion:function(a){if(this.siteType!="wedding"){if(!$F("site_display_name").strip()||$F("site_uri").strip().length&&!$("site_uri")._suggested)return}else if(!$F("wedding_wife_name").strip()||!$F("wedding_husband_name").strip()||$F("site_uri").strip().length&&!$("site_uri")._suggested)return;
if(this.siteType!="wedding"){if(a==1&&!($F(this.siteType+"_date_of_birth_Month")&&$F(this.siteType+"_date_of_birth_Day")&&$F(this.siteType+"_date_of_birth_Year")))return;if(a==2&&!($F(this.siteType+"_date_of_death_Month")&&$F(this.siteType+"_date_of_death_Day")&&$F(this.siteType+"_date_of_death_Year")))return}else if(a==1&&!($F(this.siteType+"_date_of_wedding_Month")&&$F(this.siteType+"_date_of_wedding_Day")&&$F(this.siteType+"_date_of_wedding_Year")))return;$("uriSuggesting").setStyle({display:"inline"});
this.check()},check:function(){Form.clearErrors(this.siteType,"site_uri");$("uriFree").hide();if($("site_uri")._suggested){$("site_uri").disabled=true;var a=Form.serialize(this.siteType);$("site_uri").disabled=false}else a=Form.serialize(this.siteType);new Ajax.Request("/ajax/"+this.siteType+"/"+($F("site_encoded_id")?"update":"create"),{requestNumber:++this.requestNumber,parameters:a,onSuccess:function(b,c,d){if(typeof c.encoded_id!="undefined")$("site_encoded_id").value=c.encoded_id;if(d.options.requestNumber==
this.requestNumber){$("site_uri")._lastValue=$("site_uri").value=c.uri;$("site_uri")._suggested=c.suggested;$("uriFree").setStyle({display:"inline"});this.markAvailable()}}.bind(this),onFailure:function(b,c){c&&typeof c.validation!="undefined"&&Form.showErrors(this.siteType,c.validation)},onComplete:function(){$("uriChecking").hide();$("uriSuggesting").hide()}});new Ajax.Request("/ajax/site/similar",{parameters:a,onSuccess:function(b,c){field_name="site_display_name";if(this.siteType=="wedding")field_name=
"wedding_wife_name";$("claimSuggest")&&document.body.removeChild($("claimSuggest"));if(c.sites.length>0){ull=Builder.node("ul");cs=Builder.node("div",{id:"claimSuggest"},[Builder.node("div",{},[Builder.node("strong",{},c.before),Builder.node("p",{},c.message),ull]),Builder.node("a",{"class":"submit",href:"javascript:void(0);",id:"suggestClose"},[Builder.node("span",{},[Builder.node("cite",{},[c.close])])])]);for(sindex in c.sites)ull.appendChild(Builder.node("li",{},[Builder.node("a",{href:c.sites[sindex].url,
target:"_blank"},[c.sites[sindex].display_name])]));document.body.appendChild(cs);Element.setStyle(cs,{position:"absolute",top:(Position.cumulativeOffset($(field_name))[1]-cs.offsetHeight-10).toString()+"px",left:(Position.cumulativeOffset($(field_name))[0]+$(field_name).offsetWidth-cs.offsetWidth).toString()+"px"});cs.hide();Event.observe($("suggestClose"),"click",function(){document.body.removeChild($("claimSuggest"))});new Effect.Appear(cs)}}.bind(this)})},onChange:function(){if($("site_uri")._lastValue!=
$F("site_uri")){$("site_uri")._suggested=false;$("site_uri")._lastValue=$F("site_uri");$("uriChecking").setStyle({display:"inline"});this.check()}},markAvailable:function(){Element.addClassName($("site_uri").up("dl"),"available")}},LocationSetUp={initialize:function(a){if(!this.siteType)this.siteType=a;if($(this.siteType+"_country")){this.siteType=a;Event.observe(this.siteType+"_country","change",this.setUp.bind(this));this.setUp()}},setUp:function(){var a=$F(this.siteType+"_country");if(a!="US"&&
a!="CA"&&a!="AU"&&a!="NL"){this.disableAU();this.disableCA();this.disableNL();this.disableUS()}else if(a=="CA"){this.disableAU();this.enableCA();this.disableNL();this.disableUS()}else if(a=="US"){this.disableAU();this.disableCA();this.disableNL();this.enableUS()}else if(a=="AU"){this.enableAU();this.disableCA();this.disableNL();this.disableUS()}else if(a=="NL"){this.disableAU();this.disableCA();this.enableNL();this.disableUS()}},enableUS:function(){Element.show("state");$(this.siteType+"_state").disabled=
false;$(this.siteType+"_state").focus()},disableUS:function(){Element.hide("state");$(this.siteType+"_state").disabled=true},enableAU:function(){Element.show("state_australia");$(this.siteType+"_state_australia").disabled=false;$(this.siteType+"_state_australia").focus()},disableAU:function(){Element.hide("state_australia");$(this.siteType+"_state_australia").disabled=true},enableCA:function(){Element.show("province");$(this.siteType+"_province").disabled=false;$(this.siteType+"_province").focus()},
disableCA:function(){Element.hide("province");$(this.siteType+"_province").disabled=true},enableNL:function(){if($("dutch_provinces")){Element.show($("dutch_provinces"));$(this.siteType+"_dutch_provinces").disabled=false;$(this.siteType+"_dutch_provinces").focus()}},disableNL:function(){if($("dutch_provinces")){$(this.siteType+"_dutch_provinces").disabled=true;$("dutch_provinces")&&Element.hide($("dutch_provinces"))}}},ColorChooser={start:function(a,b){this.colors=$(a);this.banners=$(b);$A(this.colors.getElementsByTagName("li")).each(function(c){Event.observe($(c).down("a"),
"click",function(d){eventLi=Event.findElement(d,"a").up("li");Element.down(eventLi,"input.radio").checked=true;$A(this.colors.getElementsByTagName("li")).each(function(e){Element.removeClassName(e,"selected")});Element.addClassName(eventLi,"selected");Element.setStyle("templatePreview",{zoom:"1",position:"relative"});this.loadImage($("templatePreview").src.replace(/[^\/]+$/,"")+eventLi.down("a").className+".jpg",$("templatePreview"));if(this.banners){document.getElementsByClassName("bannerli",this.banners).each(function(e){$(e).hide()});
activeBanner=$(this.banners.id+Element.down(eventLi,"input.radio").value);activeBanner.show();if(!activeBanner.down("li.selected")){Element.addClassName(activeBanner.down("li"),"selected");activeBanner.down("li").down("input.radio").checked=true}this.loadImage(activeBanner.down("li.selected").down("a").getStyle("backgroundImage").replace(/\'|\"/g,"").replace("url(","").replace("icon.jpg)",".jpg"),$("templatePreviewBanner"))}}.bind(this))}.bind(this));this.banners&&$A(this.banners.getElementsByTagName("li")).each(function(c){$(c).hasClassName("bannerli")||
Event.observe(c.down("a"),"click",function(d){bannerLi=Event.findElement(d,"a").up("li");$A(bannerLi.up("li.bannerli").getElementsByTagName("li")).each(function(e){Element.removeClassName(e,"selected")}.bind(this));Element.addClassName(bannerLi,"selected");Element.down(bannerLi,"input.radio").checked=true;this.loadImage($(bannerLi).down("a").getStyle("backgroundImage").replace(/\'|\"/g,"").replace("url(","").replace("icon.jpg)",".jpg"),$("templatePreviewBanner"))}.bind(this))}.bind(this))},loadImage:function(a,
b){b=$(b);var c=new Image;c.src=a;c.onload=function(){b.src=this.src};b.src=a}},Messages={recipients:[],addEmailFromForm:function(){var a=$F("share_email").strip();if(a.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/))if(this.addEmail(a)){$("share_email").value="";Form.clearErrors("messageForm",["share_recipients","share_email"])}else Form.showErrors("messageForm",{share:{email:"This email address is already on the list"}});else Form.showErrors("messageForm",{share:{email:"Invalid email address"}})},
addEmail:function(a,b){if(!(a instanceof Array))return this.addRecipient("emails",a.toLowerCase().strip(),b);a.each(function(c){this.addRecipient("emails",c.toLowerCase().strip(),b)}.bind(this))},addUser:function(a,b){b=b instanceof Array?b:[b];b.each(function(c){this.addRecipient(a,c.id,c.name)}.bind(this))},addRecipient:function(a,b,c){if(this.recipients.detect(function(d){return d.id==b&&d.type==a}))return false;else this.recipients.push(new Messages.Recipient(a,b,c));this.recipients.sortBy(function(d){return(typeof d.display==
"undefined"?d.id:d.display).toLowerCase()}).each(function(d){$("recipients").appendChild(d.element)});return true},clear:function(){$("messageForm").reset();this.recipients.each(function(a){a.remove()});this.recipients=[];if(navigator.appVersion.match(/MSIE/))window.location.href=$("share_referer").value},removeSelectedRecipients:function(){this.recipients=this.recipients.reject(function(a){if(a.selected){a.remove();return true}})},send:function(){var a={};this.recipients.pluck("type").uniq().each(function(c){a["share[recipients]["+
c+"][]"]=this.recipients.findAll(function(d){return d.type==c}).map(function(d){return d.id+(["emails","respectance"].indexOf(d.type)!=-1?"":"|"+d.display)})}.bind(this));if(typeof a["myspace[]"]!="undefined")a=Object.extend(a,Form.serialize("mySpaceLoginForm",true));var b=$("messageForm");a=Object.extend(b.serialize(1),a);b=b.down("textarea");a[b.name]=b.value+b.next().innerHTML;new Ajax.Request("/ajax"+$("messageForm").action.replace(/^http:\/\/[^\/]*/,""),{parameters:a,form:"messageForm",action:"sending",
autoMessages:true,onSuccess:function(){this.clear()}.bind(this),onFailure:function(c,d){if(typeof d.validation!="undefined"){this.recipients=this.recipients.reject(function(e){if(typeof d.validation[e.type]!="undefined"&&d.validation[e.type].indexOf(e.id)!=-1)return false;else{e.remove();return true}});typeof d.validation.security!="undefined"&&typeof d.validation.security.captcha!="undefined"&&Captcha.refresh(d.validation.security.captcha)}}.bind(this)})}};Messages.Recipient=Class.create();
Messages.Recipient.prototype={selected:false,initialize:function(a,b,c){this.type=a;this.id=b;this.display=c;this.build()},build:function(){this.element=$("recipients").appendChild(Builder.node("li",{},[Builder.node("span"),Builder.node("input",{type:"hidden",name:"share[recipients]["+this.type+"][]",value:this.id})]));Event.observe(this.element,"click",this.toogleSelected.bindAsEventListener(this));if(this.type=="emails"){Element.addClassName(this.element,typeof this.display=="undefined"?"mail":
this.display);Element.update(this.element.firstChild,this.id)}else{Element.addClassName(this.element,this.type);Element.update(this.element.firstChild,this.display)}},toogleSelected:function(a){if(a.ctrlKey)this[this.selected?"unselect":"select"]();else{Messages.recipients.each(function(b){b.unselect()});this.select()}},remove:function(){Element.remove(this.element)},select:function(){Element.addClassName(this.element,"selected");this.selected=true},unselect:function(){Element.removeClassName(this.element,
"selected");this.selected=false}};
var PopupBase={images:[],position:function(){var a=Position.getViewportDimensions(),b=Position.page(this.wrapper),c=Element.getDimensions(this.wrapper);a=[(a[0]-c.width)/2,(a[1]-c.height)/2];b=[parseInt(this.wrapper.style.left||0)+a[0]-b[0],parseInt(this.wrapper.style.top||0)+a[1]-b[1]];this.wrapper.style.left=b[0]+"px";this.wrapper.style.top=b[1]+"px"},showMask:function(){$("mask")||this.rebuildImages(this.wrapper);this.wrapper.style.zIndex="1000";$("globalMask").show()},hideMask:function(){$("globalMask").hide()},
rebuildImages:function(a){if(a.nodeName.toUpperCase()=="IMG"){var b=new Image;b.src=a.src;this.images.push(b)}b=Element.getStyle(a,"background-image");if(b!="none"){var c=b.match(/url[^(]*\(['"]?([^)'"]*)['"]?\)/i);if(c){b=new Image;b.src=c[1];this.images.push(b)}}$(a).immediateDescendants().each(function(d){this.rebuildImages(d)}.bind(this))}},AddressBrowser=Object.extend({initialized:false,initialize:function(a,b){if(!this.initialized){this.build();this.initialized=true}this.callback=b;this.changeSource(a);
this.show()},build:function(){this.wrapper=$("addressBrowserWrapper");document.body.appendChild(this.wrapper);navigator.userAgent.indexOf("KHTML")==-1&&new NiceInput("addressBrowserCheckAll");this.wrapper.down("div.bg").setOpacity(0.7);Event.observe("addressBrowserCheckAll","change",this.checkAll.bind(this));Event.observe("addressBrowserClose","click",this.hide.bind(this));Event.observe("addressBrowserAdd","click",this.add.bind(this));Event.observe("addressBrowserNext","click",this.imprt.bind(this));
Event.observe("addressBrowserForm","submit",function(a){Event.stop(a);this.imprt()}.bindAsEventListener(this))},changeSource:function(a){if(this.source!=a){this.clear();Element.show("addressBrowserNext");Element.hide("addressBrowserLoader");Element.hide("addressBrowserAdd");Element.setStyle("addressBrowserAdd",{width:"0px",height:"0px",overflow:"hidden",visibility:"hidden"});if(a=="hotmail"){Element.show("hotmailLoginForm");Element.hide("addressBrowserForm");Element.hide("yahooLoginForm")}else if(a==
"yahoo"){Element.show("yahooLoginForm");Element.hide("addressBrowserForm");Element.hide("hotmailLoginForm")}else{Element.hide("hotmailLoginForm");Element.hide("yahooLoginForm");Element.show("addressBrowserForm")}}this.source=a;$("addressBrowserBranding").className="logo "+this.source;Element.update("addressBrowserDomain",this.source+".com");Element.update("addressBrowserSource",this.source.capitalize()+" ");Element.update("addressBrowserClientName",{gmail:"Gmail",hotmail:"Hotmail",yahoo:"Yahoo mail"}[this.source]+
" ");a=$("addressBrowserForm").immediateDescendants();a[0][this.source=="hotmail"?"hide":"show"]();a[1][this.source=="hotmail"?"show":"hide"]()},checkAll:function(){var a=$("addressBrowserCheckAll").checked;$A($("addressBrowserContainer").getElementsByTagName("input")).each(function(b){b.checked!=a&&b.click()}.bind(this))},add:function(){typeof this.table!="undefined"&&this.callback($A(this.table.rows).select(function(a){return a.getElementsByTagName("input")[0].checked}).collect(function(a){return a.lastChild.innerHTML}),
this.source);this.hide()},hide:function(){Element.hide(this.wrapper);Notifications.clear("addressBrowser");this.hideMask()},show:function(){this.showMask();typeof this.styleForm!="undefined"&&this.styleForm.reset();Element.show(this.wrapper);this.position()},clear:function(){if(typeof this.table!="undefined"&&this.table){Element.remove(this.table);this.table=null;$("addressBrowserCheckAll").checked&&$("addressBrowserCheckAll").click()}Element.hide("addressBrowserContainer");Element.setStyle("addressBrowserContainer",
{width:"0px",height:"0px",visibility:"hidden"});Form.reset("addressBrowserForm")},imprt:function(){Element.hide("addressBrowserContainer");Element.setStyle("addressBrowserContainer",{width:"0px",height:"0px",visibility:"hidden"});Element.hide("addressBrowsererror");Element.hide("addressBrowserconfirmation");Element.hide("addressBrowsernotice");Element.hide("addressBrowserForm");Element.show("addressBrowserLoader");Element.hide("addressBrowserNext");Element.hide("hotmailLoginForm");Element.hide("yahooLoginForm");
new Ajax.Request("/ajax/addressBook/"+this.source,{parameters:Form.serialize("addressBrowserForm"),autoMessages:"addressBrowser",onSuccess:function(a,b){Element.hide("addressBrowserLoader");this.clear();this.table=Element.down("addressBrowserContainer","div").appendChild(Builder.node("table",Builder.node("tbody")));this.table.style.width="540px";b.contacts.each(function(c,d){var e=Builder.node("input",{type:"checkbox"});c=this.table.tBodies[0].appendChild(Builder.node("tr",[Builder.node("td",{style:{width:"25px"}},
e),Builder.node("td",{style:{width:"250px"}},c.name),Builder.node("td",{style:{width:"265px"}},c.address)]));navigator.userAgent.indexOf("KHTML")==-1&&new NiceInput(e);d%2&&Element.setStyle(c,{backgroundColor:"#FFFFFF"})}.bind(this));Element.hide("addressBrowsererror");Element.hide("addressBrowserconfirmation");Element.hide("addressBrowsernotice");Element.show("addressBrowserContainer");Element.setStyle("addressBrowserContainer",{width:"",height:"",visibility:"visible"});Element.show("addressBrowserAdd");
Element.setStyle("addressBrowserAdd",{width:"",height:"",overflow:"visible",visibility:"visible"})}.bind(this),onFailure:function(){Element.show("addressBrowserNext");Element.show("addressBrowserForm");Element.hide("addressBrowserLoader")}.bind(this)})}},PopupBase),FacebookMessenger=Object.extend({friends:[],selectedFriends:[],token:false,session:false,initialized:false,initialize:function(a){if(!this.initialized){this.build();this.initialized=true}this.show();this.callback=a},build:function(){this.wrapper=
$("facebookWrapper");this.wrapper.down("div.bg").setOpacity(0.7);document.body.appendChild(this.wrapper);Event.observe("facebookAdd","click",this.add.bind(this));Event.observe("facebookNext","click",this.getFriends.bind(this));Event.observe("facebookClose","click",this.hide.bind(this));Ajax.Responders.register({onCreate:function(a){if(this.session)for(i in this.session)a.options.parameters["session["+i+"]"]=this.session[i];else a.options.parameters.token=this.token}.bind(this),onComplete:function(a){if((a=
a.evalJSON())&&typeof a.fb_session!="undefined")this.session=a.fb_session;if(a&&typeof a.fb_token!="undefined")this.token=a.fb_token}.bind(this)});this.getToken()},getToken:function(){Element.show("facebookLoader");Element.hide("facebookLoginWrapper");Element.hide("facebookNext");new Ajax.Request("/ajax/facebook/getToken",{autoMessages:"facebook",onSuccess:function(a,b){this.setLoginHref(b.loginUrl);Element.hide("facebookLoader");Element.show("facebookLoginWrapper");Element.show("facebookNext")}.bind(this)})},
setLoginHref:function(a){$("facebookLoginA").href=a;$("facebookLoginA").onclick=new Function("var w = window.open('"+a+"', 'respectanceFacebookAuth'); w.focus(); return false;")},getFriends:function(){Element.hide("facebookLoginWrapper");Element.hide("facebookNext");Element.hide("facebookerror");Element.show("facebookLoader");new Ajax.Request("/ajax/facebook/getFriends",{autoMessages:"facebook",onSuccess:function(a,b){Element.hide("facebookLoader");Element.show("facebookAdd");b.friends.each(function(c){this.friends.push(new this.Friend(c.uid,
c.name,c.pic_square))}.bind(this));Element.show("facebookFriends")}.bind(this),onFailure:function(a,b){Element.hide("facebookLoader");Element.show("facebookLoginWrapper");Element.show("facebookNext");this.setLoginHref(b.loginUrl)}.bind(this)})},add:function(){this.callback(this.friends.findAll(function(a){return a.selected}));this.hide()},show:function(){this.showMask();Element.show(this.wrapper);this.position()},hide:function(){Element.hide(this.wrapper);Notifications.clear("facebook");this.hideMask()}},
PopupBase);FacebookMessenger.Friend=Class.create();
FacebookMessenger.Friend.prototype={selected:false,initialize:function(a,b,c){this.name=b;this.id=a;this.img=c;this.buildElement()},toogleSelected:function(){this.selected=!this.selected;Element[this.selected?"addClassName":"removeClassName"](this.element,"selected")},buildElement:function(){var a=Builder.node("img",{src:this.img,onerror:function(){this.src=_STATIC_URL+"/img/icons/blinders/no_site_s.png"}});this.element=$("facebookFriendsList").appendChild(Builder.node("li",{},[Builder.node("span",
{className:"img"},[a]),Builder.node("span",{},[this.name])]));($("facebookFriendsList").getElementsByTagName("li").length-1)%5||Element.addClassName(this.element,"cleaner");Event.observe(this.element,"click",this.toogleSelected.bind(this))}};
var MySpaceMessenger=Object.extend({pagesAtOneRequest:1,numberOfFriends:0,friendsPerPage:40,friends:[],initialized:false,initialize:function(a){if(!this.initialized){this.build();this.initialized=true}this.show();this.callback=a},build:function(){Event.observe("mySpaceAdd","click",this.add.bind(this));Event.observe("mySpaceClose","click",this.hide.bind(this));Event.observe("mySpaceNext","click",function(){$("mySpaceLoginError")&&Element.hide("mySpaceLoginError");this.getFriends(0)}.bind(this));Event.observe("mySpaceLoginA",
"click",function(a){Event.stop(a);Element.show("mySpaceLoading");new Ajax.Request("/ajax/myspace/fetchoauthurl",{onSuccess:function(b,c){Element.hide("mySpaceLoading");window.open(c.url,"_blank")}})}.bindAsEventListener(this));Event.observe("mySpaceNextFriends","click",this.displayNext.bind(this));Event.observe("mySpacePreviousFriends","click",this.displayPrevious.bind(this));this.wrapper=$("mySpaceBrowserWrapper");Element.setOpacity(this.wrapper.down("div"),0.7);document.body.appendChild(this.wrapper)},
add:function(){this.callback(this.friends.findAll(function(a){return a.selected}));this.hide()},show:function(){this.showMask();Element.show(this.wrapper);this.position()},hide:function(){Element.hide(this.wrapper);Notifications.clear("mySpace");this.hideMask()},getFriends:function(a){a=a||0;Element.hide("mySpaceerror");Element.hide("mySpaceconfirmation");Element.hide("mySpacenotice");Element.hide("mySpaceLoginForm");Element.show("mySpaceLoading");Element.hide("mySpaceFriends");new Ajax.Request("/ajax/myspace/getfriends",
{_start:a,autoMessages:"mySpace",onSuccess:function(b,c,d){Element.hide("mySpaceLoading");var e=d.options._start*this.friendsPerPage;c.friends.each(function(h){if(typeof this.friends[e]=="undefined")this.friends[e]=new this.Friend(h.userId,h.name,h.image);e++}.bind(this));if(!d.options._start)this.numberOfFriends=c.total;this.displayFriends(d.options._start*this.friendsPerPage);$("mySpaceAdd").show();Element.hide("mySpaceerror");Element.hide("mySpaceconfirmation");Element.hide("mySpacenotice");Element.show("mySpaceFriends")}.bind(this),
onFailure:function(){Element.hide("mySpaceLoading");Element.show("mySpaceLoginForm");Element.show("mySpaceNext")}})},displayFriends:function(a){if(typeof this.friends[a]=="undefined")this.getFriends(a/this.friendsPerPage);else{this.currentOffset=a;var b=this.currentOffset+this.pagesAtOneRequest*this.friendsPerPage;this.friends.each(function(c,d){if(c)d>=this.currentOffset&&d<b?c.show():c.hide()}.bind(this));this.currentOffset&&Element.show($("mySpacePreviousFriends"));b<this.numberOfFriends&&Element.show($("mySpaceNextFriends"))}},
displayNext:function(){this.currentOffset+this.pagesAtOneRequest*this.friendsPerPage&&this.displayFriends(this.currentOffset+this.pagesAtOneRequest*this.friendsPerPage)},displayPrevious:function(){this.currentOffset&&this.displayFriends(this.currentOffset-this.pagesAtOneRequest*this.friendsPerPage)}},PopupBase);MySpaceMessenger.Friend=Class.create();
MySpaceMessenger.Friend.prototype={selected:false,initialize:function(a,b,c){this.name=b;this.id=a;this.img=c},hasElement:function(){return typeof this.element!="undefined"},show:function(){this.hasElement()||this.buildElement();Element.show(this.element)},hide:function(){this.hasElement()&&Element.hide(this.element)},toogleSelected:function(){this.selected=!this.selected;Element[this.selected?"addClassName":"removeClassName"](this.element,"selected")},buildElement:function(){this.element=$("mySpaceFriendsList").appendChild(Builder.node("li",
{},[Builder.node("span",{className:"img"},[Builder.node("img",{src:this.img,onerror:"this.src="+_STATIC_URL+"/img/icons/blinders/connections_nav_t.png"})]),Builder.node("span",{},[this.name])]));($("mySpaceFriendsList").getElementsByTagName("li").length-1)%5||Element.addClassName(this.element,"cleaner");Event.observe(this.element,"click",this.toogleSelected.bind(this))}};
var PicalilyMessenger=Object.extend({friends:[],selectedFriends:[],initialized:false,initialize:function(a){if(!this.initialized){this.build();this.initialized=true}this.show();this.callback=a},selectAll:function(a){this.friends.each(function(b){b.selected!=a&&b.toogleSelected()})},build:function(){this.wrapper=$("picalilyWrapper");this.wrapper.down("div.bg").setOpacity(0.7);document.body.appendChild(this.wrapper);Event.observe("picalilyClose","click",this.hide.bind(this));Event.observe("picalilyAdd",
"click",this.add.bind(this));this.getFriends()},getFriends:function(){this.mediaAddress="";$A(document.getElementsByTagName("script")).each(function(a){if(a.getAttribute("src")&&a.getAttribute("src").match(/static/)&&a.getAttribute("src").match(/respectance/))this.mediaAddress=a.getAttribute("src").replace(/\/js.*/,"").replace(/static/,"m1")}.bind(this));Element.hide("picalilyFriends");Element.show("picalilyLoader");new Ajax.Request("/ajax/user/getFriends",{autoMessages:"picalilyFriends",onSuccess:function(a,
b){Element.hide("picalilyLoader");b.friends.each(function(c){this.friends.push(new this.Friend(c.id,c.name,c.img))}.bind(this));Element.show("picalilyFriends")}.bind(this),onFailure:function(){Element.hide("picalilyLoader")}})},add:function(){this.callback(this.friends.findAll(function(a){return a.selected}));this.hide()},show:function(){this.showMask();Element.show(this.wrapper);this.position()},hide:function(){Element.hide(this.wrapper);this.hideMask()}},PopupBase);PicalilyMessenger.Friend=Class.create();
PicalilyMessenger.Friend.prototype={selected:false,initialize:function(a,b,c){this.name=b;this.id=a;this.img=c;this.buildElement()},toogleSelected:function(){this.selected=!this.selected;Element[this.selected?"addClassName":"removeClassName"](this.element,"selected")},buildElement:function(){this.element=Builder.node("li",{},[Builder.node("span",{className:"img"},[Builder.node("img",{src:this.img,onerror:"this.src="+_STATIC_URL+"/img/icons/blinders/connections_nav_t.png"})]),Builder.node("span")]);
this.element.lastChild.innerHTML=this.name;$("picalilyFriendsList").appendChild(this.element);($("picalilyFriendsList").getElementsByTagName("li").length-1)%5||Element.addClassName(this.element,"cleaner");Event.observe(this.element,"click",this.toogleSelected.bind(this))}};
Event.onDOMReady(function(){$A($("tourMenu").getElementsByTagName("a")).each(function(a){Event.observe(a,"click",function(b){a=Event.findElement(b,"a");$A($("tour").getElementsByTagName("div")).each(function(c){Element.hide(c)});Element.show($("tour").down("div."+a.up("li").id));$A($("tourMenu").getElementsByTagName("li")).each(function(c){Element.removeClassName(c,"active");Element.removeClassName(c,"first-active")});a.up("li.first")?Element.addClassName(a.up("li"),"first-active"):Element.addClassName(a.up("li"),
"active")})})});LightboxOptions=Object.extend({fileLoadingImage:_STATIC_URL+"/img/explore/lightbox/loading.gif",fileBottomNavCloseImage:_STATIC_URL+"/img/explore/lightbox/close.gif",overlayOpacity:0.8,animate:true,resizeSpeed:7,borderSize:10,labelImage:"",labelOf:"/"},window.LightboxOptions||{});var Lightbox=Class.create();
Lightbox.prototype={imageArray:[],activeImage:undefined,initialize:function(){this.updateImageList();this.keyboardAction=this.keyboardAction.bindAsEventListener(this);if(LightboxOptions.resizeSpeed>10)LightboxOptions.resizeSpeed=10;if(LightboxOptions.resizeSpeed<1)LightboxOptions.resizeSpeed=1;this.resizeDuration=LightboxOptions.animate?(11-LightboxOptions.resizeSpeed)*0.15:0;this.overlayDuration=LightboxOptions.animate?0.2:0;var a=(LightboxOptions.animate?250:1)+"px";$$("body")[0].appendChild(Builder.node("div",
{id:"lightbox"},[Builder.node("div",{id:"outerImageContainer"},[Builder.node("div",{id:"imageContainer"},[Builder.node("img",{id:"lightboxImage"}),Builder.node("div",{id:"hoverNav"},[Builder.node("a",{id:"prevLink",href:"#"}),Builder.node("a",{id:"nextLink",href:"#"})]),Builder.node("div",{id:"loading"},Builder.node("a",{id:"loadingLink",href:"#"},Builder.node("img",{src:LightboxOptions.fileLoadingImage})))]),Builder.node("a",{id:"bottomNavClose",href:"#",style:"display: none"},Builder.node("img",
{src:LightboxOptions.fileBottomNavCloseImage}))]),Builder.node("div",{id:"imageDataContainer"},Builder.node("div",{id:"imageData"},[Builder.node("div",{id:"imageDetails"},[Builder.node("span",{id:"caption"}),Builder.node("span",{id:"numberDisplay"})]),Builder.node("div",{id:"bottomNav"})]))]));$("globalMask").originalbg=$("globalMask").getStyle("background-color");Event.observe($("globalMask").hide(),"click",function(){this.end()}.bind(this));Event.observe($("lightbox").hide(),"click",function(){this.end()}.bind(this));
$("outerImageContainer").setStyle({width:a,height:a});Event.observe($("prevLink"),"click",function(b){Event.stop(b);this.changeImage(this.activeImage-1)}.bindAsEventListener(this));Event.observe($("nextLink"),"click",function(b){Event.stop(b);this.changeImage(this.activeImage+1)}.bindAsEventListener(this));Event.observe($("loadingLink"),"click",function(b){Event.stop(b);this.end()}.bind(this));Event.observe($("bottomNavClose"),"click",function(b){Event.stop(b);this.end()}.bind(this));Event.observe($("outerImageContainer"),
"mouseover",function(){$("bottomNavClose").show()});Event.observe($("outerImageContainer"),"mouseout",function(){$("bottomNavClose").hide()});Event.observe($("imageDataContainer"),"mouseover",function(){$("bottomNavClose").show()});Event.observe($("imageDataContainer"),"mouseout",function(){$("bottomNavClose").hide()});$w("globalMask lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose").each(function(b){this[b]=
$(b)}.bind(this))},updateImageList:function(){this.updateImageList=Prototype.emptyFunction;$$("a[rel^=lightbox]").each(function(a){a&&Event.observe(a,"click",function(b){Event.stop(b);this.start(Event.findElement(b,"a"))}.bind(this))}.bind(this));$$("area[rel^=lightbox]").each(function(a){a&&Event.observe(a,"click",function(b){Event.stop(b);this.start(Event.findElement(b,"a"))}.bind(this))}.bind(this))},start:function(a){$("globalMask").setStyle({backgroundColor:"#000000"});$$("select","object","embed").each(function(c){c.style.visibility=
"hidden"});var b=this.getPageSize();$("globalMask").setStyle({width:b[0]+"px",height:b[1]+"px"});$("globalMask").show();this.imageArray=[];b=0;if(a.rel=="lightbox")this.imageArray.push([a.href,a.title]);else for(this.imageArray=$$(a.tagName+'[href][rel="'+a.rel+'"]').collect(function(c){return[c.href,c.title]}).uniq();this.imageArray[b][0]!=a.href;)b++;a=Position.getDocumentScroll();this.lightbox.setStyle({top:a[1]+Position.getViewportDimensions()[1]/10+"px",left:a[0]+"px"}).show();this.changeImage(b)},
changeImage:function(a){this.activeImage=a;LightboxOptions.animate&&this.loading.show();this.lightboxImage.hide();this.hoverNav.hide();this.prevLink.hide();this.nextLink.hide();this.imageDataContainer.setStyle({opacity:1.0E-4});this.numberDisplay.hide();var b=new Image;b.onload=function(){this.lightboxImage.src=this.imageArray[this.activeImage][0];this.resizeImageContainer(b.width,b.height)}.bind(this);b.src=this.imageArray[this.activeImage][0]},resizeImageContainer:function(a,b){var c=this.outerImageContainer.getWidth(),
d=this.outerImageContainer.getHeight(),e=a+LightboxOptions.borderSize*2,h=b+LightboxOptions.borderSize*2;a=e/c*100;var f=h/d*100;c=c-e;d=d-h;d!=0&&new Effect.Scale(this.outerImageContainer,f,{scaleX:false,duration:this.resizeDuration,queue:"front"});c!=0&&new Effect.Scale(this.outerImageContainer,a,{scaleY:false,duration:this.resizeDuration,delay:this.resizeDuration});a=0;if(d==0&&c==0){a=100;if(navigator.appVersion.match(/MSIE/))a=250}setTimeout(function(){this.prevLink.setStyle({height:b+"px"});
this.nextLink.setStyle({height:b+"px"});this.imageDataContainer.setStyle({width:e+"px"});this.showImage()}.bind(this),a/1E3)},showImage:function(){this.loading.hide();new Effect.Appear(this.lightboxImage,{duration:this.resizeDuration,queue:"end",afterFinish:function(){this.updateDetails()}.bind(this)});this.preloadNeighborImages()},updateDetails:function(){this.imageArray[this.activeImage][1]!=""&&this.caption.update(this.imageArray[this.activeImage][1]).show();this.imageArray.length>1&&this.numberDisplay.update(LightboxOptions.labelImage+
" "+(this.activeImage+1)+" "+LightboxOptions.labelOf+"  "+this.imageArray.length).show();new Effect.Parallel([new Effect.SlideDown(this.imageDataContainer,{sync:true,duration:this.resizeDuration,from:0,to:1}),new Effect.Appear(this.imageDataContainer,{sync:true,duration:this.resizeDuration})],{duration:this.resizeDuration,afterFinish:function(){var a=this.getPageSize();$("globalMask").setStyle({height:a[1]+"px"});this.updateNav()}.bind(this)})},updateNav:function(){this.hoverNav.show();this.activeImage>
0&&this.prevLink.show();this.activeImage<this.imageArray.length-1&&this.nextLink.show();this.enableKeyboardNav()},enableKeyboardNav:function(){Event.observe(window,"keydown",this.keyboardAction)},disableKeyboardNav:function(){Event.stopObserving(window,"keydown",this.keyboardAction)},keyboardAction:function(a){var b=a.keyCode;a=a.DOM_VK_ESCAPE?a.DOM_VK_ESCAPE:27;var c=String.fromCharCode(b).toLowerCase();if(c.match(/x|o|c/)||b==a)this.end();else if(c=="p"||b==37){if(this.activeImage!=0){this.disableKeyboardNav();
this.changeImage(this.activeImage-1)}}else if(c=="n"||b==39)if(this.activeImage!=this.imageArray.length-1){this.disableKeyboardNav();this.changeImage(this.activeImage+1)}},preloadNeighborImages:function(){var a;if(this.imageArray.length>this.activeImage+1){a=new Image;a.src=this.imageArray[this.activeImage+1][0]}if(this.activeImage>0){a=new Image;a.src=this.imageArray[this.activeImage-1][0]}},end:function(){this.disableKeyboardNav();this.lightbox.hide();$("globalMask").hide();$("globalMask").setStyle({backgroundColor:$("globalMask").originalbg});
$$("select","object","embed").each(function(a){a.style.visibility="visible"})},getPageSize:function(){var a,b;if(window.innerHeight&&window.scrollMaxY){a=window.innerWidth+window.scrollMaxX;b=window.innerHeight+window.scrollMaxY}else if(document.body.scrollHeight>document.body.offsetHeight){a=document.body.scrollWidth;b=document.body.scrollHeight}else{a=document.body.offsetWidth;b=document.body.offsetHeight}var c,d;if(self.innerHeight){c=document.documentElement.clientWidth?document.documentElement.clientWidth:
self.innerWidth;d=self.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){c=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else if(document.body){c=document.body.clientWidth;d=document.body.clientHeight}pageHeight=b<d?d:b;pageWidth=a<c?a:c;return[pageWidth,pageHeight]}};Event.onDOMReady(function(){new Lightbox});

