
jQuery.fn.rotate=function(angle,whence){var p=this.get(0);if(!whence){p.angle=((p.angle==undefined?0:p.angle)+angle)%360;}else{p.angle=angle;}
if(p.angle>=0){var rotation=Math.PI*p.angle/180;}else{var rotation=Math.PI*(360+p.angle)/180;}
var costheta=Math.cos(rotation);var sintheta=Math.sin(rotation);if(document.all&&!window.opera){var canvas=document.createElement('img');canvas.src=p.src;canvas.height=p.height;canvas.width=p.width;canvas.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+costheta+",M12="+(-sintheta)+",M21="+sintheta+",M22="+costheta+",SizingMethod='auto expand')";}else{var canvas=document.createElement('canvas');if(!p.oImage){canvas.oImage=new Image();canvas.oImage.src=p.src;}else{canvas.oImage=p.oImage;}
canvas.style.width=canvas.width=Math.abs(costheta*canvas.oImage.width)+Math.abs(sintheta*canvas.oImage.height);canvas.style.height=canvas.height=Math.abs(costheta*canvas.oImage.height)+Math.abs(sintheta*canvas.oImage.width);var context=canvas.getContext('2d');context.save();if(rotation<=Math.PI/2){context.translate(sintheta*canvas.oImage.height,0);}else if(rotation<=Math.PI){context.translate(canvas.width,-costheta*canvas.oImage.height);}else if(rotation<=1.5*Math.PI){context.translate(-costheta*canvas.oImage.width,canvas.height);}else{context.translate(0,-sintheta*canvas.oImage.width);}
context.rotate(rotation);context.drawImage(canvas.oImage,0,0,canvas.oImage.width,canvas.oImage.height);context.restore();}
canvas.id=p.id;canvas.angle=p.angle;p.parentNode.replaceChild(canvas,p);}
jQuery.fn.rotateRight=function(angle){this.rotate(angle==undefined?90:angle);}
jQuery.fn.rotateLeft=function(angle){this.rotate(angle==undefined?-90:-angle);}
var ResizableTextbox=Class.create({options:$H({min:5,max:500,step:7}),initialize:function(element,options){var that=this;this.options.update(options);this.el=$(element);this.width=this.el.offsetWidth;this.el.observe('keyup',function(){var newsize=that.options.get('step')*$F(this).length;if(newsize<=that.options.get('min'))newsize=that.width;if(!($F(this).length==this.retrieveData('rt-value')||newsize<=that.options.min||newsize>=that.options.max))
if(newsize==0){newsize=14;}}).observe('keydown',function(){this.cacheData('rt-value',$F(this).length);});}});var TextboxList=Class.create({options:$H({resizable:{},className:'bit',separator:'###',extrainputs:true,startinput:true,hideempty:true,fetchFile:undefined,results:10,wordMatch:false}),initialize:function(element,options){this.options.update(options);this.element=$(element).hide();this.bits=new Hash();this.events=new Hash();this.count=0;this.current=false;this.maininput=this.createInput({'class':'maininput'});this.holder=new Element('ul',{'class':'holder'}).insert(this.maininput);this.element.insert({'before':this.holder});this.holder.observe('click',function(event){event.stop();if(this.maininput!=this.current)this.focus(this.maininput);}.bind(this));this.makeResizable(this.maininput);this.setEvents();},setEvents:function(){document.observe(Prototype.Browser.IE?'keydown':'keypress',function(e){if(!this.current)return;if(this.current.retrieveData('type')=='box'&&e.keyCode==Event.KEY_BACKSPACE)e.stop();}.bind(this));document.observe('keyup',function(e){e.stop();if(!this.current)return;switch(e.keyCode){case Event.KEY_LEFT:return this.move('left');case Event.KEY_RIGHT:return this.move('right');case Event.KEY_DELETE:case Event.KEY_BACKSPACE:return this.moveDispose();}}.bind(this)).observe('click',function(){document.fire('blur');}.bindAsEventListener(this));},update:function(){this.element.value=this.bits.values().join(this.options.get('separator'));return this;},add:function(text,html){var id=this.options.get('className')+'-'+this.count++;var el=this.createBox($pick(html,text),{'id':id});(this.current||this.maininput).insert({'before':el});el.observe('click',function(e){e.stop();this.focus(el);}.bind(this));this.bits.set(id,text.value);if(this.options.get('extrainputs')&&(this.options.get('startinput')||el.previous()))this.addSmallInput(el,'before');return el;},addSmallInput:function(el,where){var input=this.createInput({'class':'smallinput'});el.insert({}[where]=input);input.cacheData('small',true);this.makeResizable(input);if(this.options.get('hideempty'))input.hide();return input;},dispose:function(el){this.bits.unset(el.id);if(el.previous()&&el.previous().retrieveData('small'))el.previous().remove();if(this.current==el)this.focus(el.next());if(el.retrieveData('type')=='box')el.onBoxDispose(this);el.remove();return this;},focus:function(el,nofocus){if(!this.current)el.fire('focus');else if(this.current==el)return this;this.blur();el.addClassName(this.options.get('className')+'-'+el.retrieveData('type')+'-focus');if(el.retrieveData('small'))el.setStyle({'display':'block'});if(el.retrieveData('type')=='input'){el.onInputFocus(this);if(!nofocus)this.callEvent(el.retrieveData('input'),'focus');}
else el.fire('onBoxFocus');this.current=el;return this;},blur:function(noblur){if(!this.current)return this;if(this.current.retrieveData('type')=='input'){var input=this.current.retrieveData('input');if(!noblur)this.callEvent(input,'blur');input.onInputBlur(this);}
else this.current.fire('onBoxBlur');if(this.current.retrieveData('small')&&!input.get('value')&&this.options.get('hideempty'))
this.current.hide();this.current.removeClassName(this.options.get('className')+'-'+this.current.retrieveData('type')+'-focus');this.current=false;return this;},createBox:function(text,options){return new Element('li',options).addClassName(this.options.get('className')+'-box').update(text.caption).cacheData('type','box');},createInput:function(options){var li=new Element('li',{'class':this.options.get('className')+'-input'});var el=new Element('input',Object.extend(options,{'type':'text'}));el.observe('click',function(e){e.stop();}).observe('focus',function(e){if(!this.isSelfEvent('focus'))this.focus(li,true);}.bind(this)).observe('blur',function(){if(!this.isSelfEvent('blur'))this.blur(true);}.bind(this)).observe('keydown',function(e){this.cacheData('lastvalue',this.value).cacheData('lastcaret',this.getCaretPosition());});var tmp=li.cacheData('type','input').cacheData('input',el).insert(el);return tmp;},callEvent:function(el,type){this.events.set(type,el);el[type]();},isSelfEvent:function(type){return(this.events.get(type))?!!this.events.unset(type):false;},makeResizable:function(li){var el=li.retrieveData('input');el.cacheData('resizable',new ResizableTextbox(el,Object.extend(this.options.get('resizable'),{min:el.offsetWidth,max:(this.element.getWidth()?this.element.getWidth():0)})));return this;},checkInput:function(){var input=this.current.retrieveData('input');return(!input.retrieveData('lastvalue')||(input.getCaretPosition()===0&&input.retrieveData('lastcaret')===0));},move:function(direction){var el=this.current[(direction=='left'?'previous':'next')]();if(el&&(!this.current.retrieveData('input')||((this.checkInput()||direction=='right'))))this.focus(el);return this;},moveDispose:function(){if(this.current.retrieveData('type')=='box')return this.dispose(this.current);if(this.checkInput()&&this.bits.keys().length&&this.current.previous())return this.focus(this.current.previous());}});Element.addMethods({getCaretPosition:function(){if(this.createTextRange){var r=document.selection.createRange().duplicate();r.moveEnd('character',this.value.length);if(r.text==='')return this.value.length;return this.value.lastIndexOf(r.text);}else return this.selectionStart;},cacheData:function(element,key,value){if(Object.isUndefined(this[$(element).identify()])||!Object.isHash(this[$(element).identify()]))
this[$(element).identify()]=$H();this[$(element).identify()].set(key,value);return element;},retrieveData:function(element,key){return this[$(element).identify()].get(key);}});function $pick(){for(var B=0,A=arguments.length;B<A;B++){if(!Object.isUndefined(arguments[B])){return arguments[B];}}return null;}
var ProtoList=Class.create(TextboxList,{loptions:$H({autocomplete:{'opacity':0.9,'maxresults':10,'minchars':1}}),initialize:function($super,element,autoholder,options,func){$super(element,options);this.data=[];this.autoholder=$(autoholder).setOpacity(this.loptions.get('autocomplete').opacity);this.autoholder.observe('mouseover',function(){this.curOn=true;}.bind(this)).observe('mouseout',function(){this.curOn=false;}.bind(this));this.autoresults=this.autoholder.select('ul').first();var children=this.autoresults.select('li');children.each(function(el){this.add({value:el.readAttribute('value'),caption:el.innerHTML});},this);},autoShow:function(search){this.autoholder.setStyle({'display':'block'});this.autoholder.descendants().each(function(e){e.hide()});if(!search||!search.strip()||(!search.length||search.length<this.loptions.get('autocomplete').minchars))
{this.autoholder.select('.default').first().setStyle({'display':'block'});this.resultsshown=false;}else{this.resultsshown=true;this.autoresults.setStyle({'display':'block'}).update('');if(this.options.get('wordMatch'))
var regexp=new RegExp("(^|\\s)"+search,'i')
else
var regexp=new RegExp(search,'i')
var count=0;this.data.filter(function(str){return str?regexp.test(str.evalJSON(true).caption):false;}).each(function(result,ti){count++;if(ti>=this.loptions.get('autocomplete').maxresults)return;var that=this;var el=new Element('li');el.observe('click',function(e){e.stop();that.autoAdd(this);}).observe('mouseover',function(){that.autoFocus(this);}).update(this.autoHighlight(result.evalJSON(true).caption,search));this.autoresults.insert(el);el.cacheData('result',result.evalJSON(true));if(ti==0)this.autoFocus(el);},this);}
if(count>this.options.get('results'))
this.autoresults.setStyle({'height':(this.options.get('results')*24)+'px'});else
this.autoresults.setStyle({'height':(count?(count*24):0)+'px'});return this;},autoHighlight:function(html,highlight){return html.gsub(new RegExp(highlight,'i'),function(match){return'<em>'+match[0]+'</em>';});},autoHide:function(){this.resultsshown=false;this.autoholder.hide();return this;},autoFocus:function(el){if(!el)return;if(this.autocurrent)this.autocurrent.removeClassName('auto-focus');this.autocurrent=el.addClassName('auto-focus');return this;},autoMove:function(direction){if(!this.resultsshown)return;this.autoFocus(this.autocurrent[(direction=='up'?'previous':'next')]());this.autoresults.scrollTop=this.autocurrent.positionedOffset()[1]-this.autocurrent.getHeight();return this;},autoFeed:function(text){if(this.data.indexOf(Object.toJSON(text))==-1)
this.data.push(Object.toJSON(text));return this;},autoAdd:function(el){if(!el||!el.retrieveData('result'))return;this.add(el.retrieveData('result'));delete this.data[this.data.indexOf(Object.toJSON(el.retrieveData('result')))];this.autoHide();var input=this.lastinput||this.current.retrieveData('input');input.clear().focus();return this;},createInput:function($super,options){var li=$super(options);var input=li.retrieveData('input');input.observe('keydown',function(e){this.dosearch=false;switch(e.keyCode){case Event.KEY_UP:e.stop();return this.autoMove('up');case Event.KEY_DOWN:e.stop();return this.autoMove('down');case Event.KEY_RETURN:e.stop();if(!this.autocurrent)break;this.autoAdd(this.autocurrent);this.autocurrent=false;this.autoenter=true;break;case Event.KEY_ESC:this.autoHide();if(this.current&&this.current.retrieveData('input'))
this.current.retrieveData('input').clear();break;default:this.dosearch=true;}}.bind(this));input.observe('keyup',function(e){switch(e.keyCode){case Event.KEY_UP:case Event.KEY_DOWN:case Event.KEY_RETURN:case Event.KEY_ESC:break;default:if(!Object.isUndefined(this.options.get('fetchFile'))){new Ajax.Request(this.options.get('fetchFile'),{parameters:{keyword:input.value},onSuccess:function(transport){transport.responseText.evalJSON(true).each(function(t){this.autoFeed(t)}.bind(this));this.autoShow(input.value);}.bind(this)});}
else
if(this.dosearch)this.autoShow(input.value);}}.bind(this));input.observe(Prototype.Browser.IE?'keydown':'keypress',function(e){if(this.autoenter)e.stop();this.autoenter=false;}.bind(this));return li;},createBox:function($super,text,options){var li=$super(text,options);li.observe('mouseover',function(){this.addClassName('bit-hover');}).observe('mouseout',function(){this.removeClassName('bit-hover')});var a=new Element('a',{'href':'#','class':'closebutton'});a.observe('click',function(e){e.stop();if(!this.current)this.focus(this.maininput);this.dispose(li);}.bind(this));li.insert(a).cacheData('text',Object.toJSON(text));return li;}});Element.addMethods({onBoxDispose:function(item,obj){obj.autoFeed(item.retrieveData('text').evalJSON(true));},onInputFocus:function(el,obj){obj.autoShow();},onInputBlur:function(el,obj){obj.lastinput=el;if(!obj.curOn){obj.blurhide=obj.autoHide.bind(obj).delay(0.1);}},filter:function(D,E){var C=[];for(var B=0,A=this.length;B<A;B++){if(D.call(E,this[B],B,this)){C.push(this[B]);}}return C;}});var Prototip={Version:'2.0.1.3'};var Tips={options:{images:'http://static.us.expono.com/expono-0.9.6-4585/js/third_party/prototip/images/prototip/',zIndex:10000}};Prototip.Styles={'default':{border:0,borderColor:'#c7c7c7',className:'default',closeButton:false,hideAfter:false,hideOn:'mouseleave',hook:false,radius:0,showOn:'mousemove',stem:{height:12,width:15}},'protoblue':{className:'protoblue',border:6,borderColor:'#116497',radius:6,stem:{height:12,width:15}},'darkgrey':{className:'darkgrey',border:6,borderColor:'#363636',radius:6,stem:{height:12,width:15}},'creamy':{className:'creamy',border:6,borderColor:'#ebe4b4',radius:6,stem:{height:12,width:15}},'protogrey':{className:'protogrey',border:6,borderColor:'#606060',radius:6,stem:{height:12,width:15}}};eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('O.10(V,{5I:"1.6.0.2",3N:c(){3.3C("1O");b(h.8.W.2R("://")){h.W=h.8.W}13{e A=/1T(?:-[\\w\\d.]+)?\\.4E(.*)/;h.W=(($$("4D 4y[2l]").3v(c(B){P B.2l.2m(A)})||{}).2l||"").3p(A,"")+h.8.W}b(1O.2e.2N&&!1h.3Z.v){1h.3Z.3a("v","5H:5B-5u-5p:5i");1h.1i("56:4Y",c(){1h.4Q().4K("v\\\\:*","4G: 35(#34#4C);")})}h.2t();r.1i(31,"30",3.30)},3C:c(A){b((4w 31[A]=="4s")||(3.2Y(31[A].4p)<3.2Y(3["3u"+A]))){4i("V 6p "+A+" >= "+3["3u"+A]);}},2Y:c(A){e B=A.3p(/4c.*|\\./g,"");B=6e(B+"0".6b(4-B.2u));P A.5Y("4c")>-1?B-1:B},5X:c(A){b(1O.2e.2N){P A}A=A.2j(c(E,D){e C=O.2i(3)?3:(D.i().3d(3.i)||D.i()==3.i)?3.i:3.n,B=D.3P;3O{b(B.5A==9){P}}3G(F){P}b(B!=C&&!B.3d(C)){}E(D)});P A},3E:$w("40 5h"),20:c(A){b(1O.2e.2N){P A}A=A.2j(c(G,F){e E=O.2i(3)?3:3.i,B=F.3P;3O{e D=E.2O,C=B.2O}3G(H){P}b(V.3E.2v(E.2O.23())){b(B!=E&&!B.3d(E)){G(F)}}13{b(B!=E&&!$A(E.2P("*")).2v(B)){G(F)}}});P A},36:c(A){P(A>0)?(-1*A):(A).4N()},30:c(){h.4j()}});O.10(h,{1u:[],1e:[],2t:c(){3.2y=3.1q},1n:(c(A){P{1m:(A?"1V":"1m"),18:(A?"1N":"18"),1V:(A?"1V":"1m"),1N:(A?"1N":"18")}})(1O.2e.2N),3B:{1m:"1m",18:"18",1V:"1m",1N:"18"},2h:{m:"32",32:"m",j:"1s",1s:"j",1U:"1U",1c:"1g",1g:"1c"},3w:{q:"1c",p:"1g"},2X:c(A){P!!26[1]?3.2h[A]:A},1l:(c(B){e A=s 4o("4l ([\\\\d.]+)").6s(B);P A?(4g(A[1])<7):11})(6k.6i),3r:(1O.2e.6g&&!1h.6d),3a:c(A){3.1u.2s(A)},1C:c(A){e B=3.1u.3v(c(C){P C.i==$(A)});b(B){B.4a();b(B.1b){B.n.1C();b(h.1l){B.1v.1C()}}3.1u=3.1u.47(B)}A.1T=2c},4j:c(){3.1u.3j(c(A){3.1C(A.i)}.1f(3))},2L:c(B){b(B.3i){P}b(3.1e.2u==0){3.2y=3.8.1q;2z(e A=0;A<3.1u.2u;A++){3.1u[A].n.f({1q:3.8.1q})}}B.n.f({1q:3.2y++});b(B.U){B.U.f({1q:3.2y})}2z(e A=0;A<3.1u.2u;A++){3.1u[A].3i=11}B.3i=1o},3Y:c(A){3.3f(A);3.1e.2s(A)},3f:c(A){3.1e=3.1e.47(A)},Y:c(B,F){B=$(B),F=$(F);e K=O.10({1d:{x:0,y:0},Q:11},26[2]||{});e D=K.1y||F.2C();D.m+=K.1d.x;D.j+=K.1d.y;e C=K.1y?[0,0]:F.3T(),A=1h.1F.2H(),G=K.1y?"22":"19";D.m+=(-1*(C[0]-A[0]));D.j+=(-1*(C[1]-A[1]));b(K.1y){e E=[0,0];E.q=0;E.p=0}e I={i:B.1Z()},J={i:O.2g(D)};I[G]=K.1y?E:F.1Z();J[G]=O.2g(D);2z(e H 3I J){3J(K[H]){T"5s":T"5q":J[H].m+=I[H].q;15;T"5o":J[H].m+=(I[H].q/2);15;T"5l":J[H].m+=I[H].q;J[H].j+=(I[H].p/2);15;T"5j":T"5g":J[H].j+=I[H].p;15;T"5f":T"5e":J[H].m+=I[H].q;J[H].j+=I[H].p;15;T"5c":J[H].m+=(I[H].q/2);J[H].j+=I[H].p;15;T"5b":J[H].j+=(I[H].p/2);15}}D.m+=-1*(J.i.m-J[G].m);D.j+=-1*(J.i.j-J[G].j);b(K.Q){B.f({m:D.m+"k",j:D.j+"k"})}P D}});h.2t();e 58=57.46({2t:c(C,E){3.i=$(C);b(!3.i){4i("V: r 53 52, 4Z 46 a 1b.");P}h.1C(3.i);e A=(O.2A(E)||O.2i(E)),B=A?26[2]||[]:E;3.1w=A?E:2c;b(B.2a){B=O.10(O.2g(V.3q[B.2a]),B)}3.8=O.10(O.10({1k:11,1j:0,3t:"#4J",1p:0,N:h.8.N,1a:h.8.4F,1x:!(B.17&&B.17=="1W")?0.14:11,1D:11,1J:"1N",Y:B.Y,1d:B.Y?{x:0,y:0}:{x:16,y:16},1K:(B.Y&&!B.Y.1y)?1o:11,17:"2w",o:11,2a:"34",19:3.i,12:11,1F:(B.Y&&!B.Y.1y)?11:1o,q:11},V.3q["34"]),B);3.19=$(3.8.19);3.1p=3.8.1p;3.1j=(3.1p>3.8.1j)?3.1p:3.8.1j;b(3.8.W){3.W=3.8.W.2R("://")?3.8.W:h.W+3.8.W}13{3.W=h.W+"4B/"+(3.8.2a||"")+"/"}b(!3.W.4A("/")){3.W+="/"}b(O.2A(3.8.o)){3.8.o={Q:3.8.o}}b(3.8.o.Q){3.8.o=O.10(O.2g(V.3q[3.8.2a].o)||{},3.8.o);3.8.o.Q=[3.8.o.Q.2m(/[a-z]+/)[0].23(),3.8.o.Q.2m(/[A-Z][a-z]+/)[0].23()];3.8.o.1E=["m","32"].2v(3.8.o.Q[0])?"1c":"1g";3.1r={1c:11,1g:11}}b(3.8.1k){3.8.1k.8=O.10({33:1O.4z},3.8.1k.8||{})}3.1n=$w("4x 40").2v(3.i.2O.23())?h.3B:h.1n;b(3.8.Y.1y){e D=3.8.Y.1t.2m(/[a-z]+/)[0].23();3.22=h.2h[D]+h.2h[3.8.Y.1t.2m(/[A-Z][a-z]+/)[0].23()].2G()}3.3A=(h.3r&&3.1p);3.3z();h.3a(3);3.3y();V.10(3)},3z:c(){3.n=s r("S",{N:"1T"}).f({1q:h.8.1q});b(3.3A){3.n.X=c(){3.f("m:-3x;j:-3x;1P:2r;");P 3};3.n.R=c(){3.f("1P:1e");P 3};3.n.1e=c(){P(3.2Z("1P")=="1e"&&4g(3.2Z("j").3p("k",""))>-4v)}}3.n.X();b(h.1l){3.1v=s r("4u",{N:"1v",2l:"4t:11;",4r:0}).f({2q:"2b",1q:h.8.1q-1,4q:0})}b(3.8.1k){3.24=3.24.2j(3.2W)}3.1t=s r("S",{N:"1w"});3.12=s r("S",{N:"12"}).X();b(3.8.1a||(3.8.1J.i&&3.8.1J.i=="1a")){3.1a=s r("S",{N:"2p"}).25(3.W+"2p.2o")}},2Q:c(){$(1h.2V).u(3.n);b(h.1l){$(1h.2V).u(3.1v)}b(3.8.1k){$(1h.2V).u(3.U=s r("S",{N:"4n"}).25(3.W+"U.4m").X())}e G="n";b(3.8.o.Q){3.o=s r("S",{N:"4k"}).f({p:3.8.o[3.8.o.1E=="1g"?"p":"q"]+"k"});e B=3.8.o.1E=="1c";3[G].u(3.3m=s r("S",{N:"6r 2S"}).u(3.4h=s r("S",{N:"6q 2S"})));3.o.u(3.1S=s r("S",{N:"6m"}).f({p:3.8.o[B?"q":"p"]+"k",q:3.8.o[B?"p":"q"]+"k"}));b(h.1l&&!3.8.o.Q[1].4e().2R("6l")){3.1S.f({2q:"6j"})}G="4h"}b(3.1j){e D=3.1j,F;3[G].u(3.27=s r("6h",{N:"27"}).u(3.28=s r("2T",{N:"28 3k"}).f("p: "+D+"k").u(s r("S",{N:"2n 6f"}).u(s r("S",{N:"29"}))).u(F=s r("S",{N:"6c"}).f({p:D+"k"}).u(s r("S",{N:"4b"}).f({1A:"0 "+D+"k",p:D+"k"}))).u(s r("S",{N:"2n 68"}).u(s r("S",{N:"29"})))).u(3.3o=s r("2T",{N:"3o 3k"}).u(3.3n=s r("S",{N:"3n"}).f("2x: 0 "+D+"k"))).u(3.48=s r("2T",{N:"48 3k"}).f("p: "+D+"k").u(s r("S",{N:"2n 65"}).u(s r("S",{N:"29"}))).u(F.64(1o)).u(s r("S",{N:"2n 63"}).u(s r("S",{N:"29"})))));G="3n";e C=3.27.2P(".29");$w("62 61 60 5Z").3j(c(I,H){b(3.1p>0){V.45(C[H],I,{1R:3.8.3t,1j:D,1p:3.8.1p})}13{C[H].2M("44")}C[H].f({q:D+"k",p:D+"k"}).2M("29"+I.2G())}.1f(3));3.27.2P(".4b",".3o",".44").1Y("f",{1R:3.8.3t})}3[G].u(3.1b=s r("S",{N:"1b "+3.8.N}).u(3.1X=s r("S",{N:"1X"}).u(3.12)));b(3.8.q){e E=3.8.q;b(O.5W(E)){E+="k"}3.1b.f("q:"+E)}b(3.o){e A={};A[3.8.o.1E=="1c"?"j":"1s"]=3.o;3.n.u(A);3.2k()}3.1b.u(3.1t);b(!3.8.1k){3.3h({12:3.8.12,1w:3.1w})}},3h:c(E){e A=3.n.2Z("1P");3.n.f("p:1L;q:1L;1P:2r").R();b(3.1j){3.28.f("p:0");3.28.f("p:0")}b(E.12){3.12.R().43(E.12);3.1X.R()}13{b(!3.1a){3.12.X();3.1X.X()}}b(O.2i(E.1w)){E.1w.R()}b(O.2A(E.1w)||O.2i(E.1w)){3.1t.43(E.1w)}3.1b.f({q:3.1b.42()+"k"});3.n.f("1P:1e").R();3.1b.R();e C=3.1b.1Z(),B={q:C.q+"k"},D=[3.n];b(h.1l){D.2s(3.1v)}b(3.1a){3.12.R().u({j:3.1a});3.1X.R()}b(E.12||3.1a){3.1X.f("q: 3g%")}B.p=2c;3.n.f({1P:A});3.1t.2M("2S");b(E.12||3.1a){3.12.2M("2S")}b(3.1j){3.28.f("p:"+3.1j+"k");3.28.f("p:"+3.1j+"k");B="q: "+(C.q+2*3.1j)+"k";D.2s(3.27)}D.1Y("f",B);b(3.o){3.2k();b(3.8.o.1E=="1c"){3.n.f({q:3.n.42()+3.8.o.p+"k"})}}3.n.X()},3y:c(){3.37=3.24.1z(3);3.41=3.X.1z(3);b(3.8.1K&&3.8.17=="2w"){3.8.17="1m"}b(3.8.17==3.8.1J){3.1M=3.3X.1z(3);3.i.1i(3.8.17,3.1M)}b(3.1a){3.1a.1i("1m",c(E){E.25(3.W+"5V.2o")}.1f(3,3.1a)).1i("18",c(E){E.25(3.W+"2p.2o")}.1f(3,3.1a))}e C={i:3.1M?[]:[3.i],19:3.1M?[]:[3.19],1t:3.1M?[]:[3.n],1a:[],2b:[]};e A=3.8.1J.i;3.39=A||(!3.8.1J?"2b":"i");3.1Q=C[3.39];b(!3.1Q&&A&&O.2A(A)){3.1Q=3.1t.2P(A)}e D={1V:"1m",1N:"18"};$w("R X").3j(c(H){e G=H.2G(),F=(3.8[H+"3W"].38||3.8[H+"3W"]);3[H+"3V"]=F;b(["1V","1N","1m","18"].2R(F)){3[H+"3V"]=(3.1n[F]||F);3["38"+G]=V.20(3["38"+G])}}.1f(3));b(!3.1M){3.i.1i(3.8.17,3.37)}b(3.1Q){3.1Q.1Y("1i",3.5T,3.41)}b(!3.8.1K&&3.8.17=="1W"){3.2K=3.Q.1z(3);3.i.1i("2w",3.2K)}3.3U=3.X.2j(c(G,F){e E=F.5L(".2p");b(E){E.5K();F.5J();G(F)}}).1z(3);b(3.1a){3.n.1i("1W",3.3U)}b(3.8.17!="1W"&&(3.39!="i")){3.2J=V.20(c(){3.1H("R")}).1z(3);3.i.1i(3.1n.18,3.2J)}e B=[3.i,3.n];3.3c=V.20(c(){h.2L(3);3.2D()}).1z(3);3.3b=V.20(3.1D).1z(3);B.1Y("1i",3.1n.1m,3.3c).1Y("1i",3.1n.18,3.3b);b(3.8.1k&&3.8.17!="1W"){3.2B=V.20(3.3S).1z(3);3.i.1i(3.1n.18,3.2B)}},4a:c(){b(3.8.17==3.8.1J){3.i.1B(3.8.17,3.1M)}13{3.i.1B(3.8.17,3.37);b(3.1Q){3.1Q.1Y("1B")}}b(3.2K){3.i.1B("2w",3.2K)}b(3.2J){3.i.1B("18",3.2J)}3.n.1B();3.i.1B(3.1n.1m,3.3c).1B(3.1n.18,3.3b);b(3.2B){3.i.1B(3.1n.18,3.2B)}},2W:c(C,B){b(!3.1b){3.2Q()}3.Q(B);b(3.2I){P}13{b(3.3R){C(B);P}}3.2I=1o;e D={2f:{1I:21.1I(B),1G:21.1G(B)}};e A=O.2g(3.8.1k.8);A.33=A.33.2j(c(F,E){3.3h({12:3.8.12,1w:E.5G});3.Q(D);(c(){F(E);e G=(3.U&&3.U.1e());b(3.U){3.1H("U");3.U.1C();3.U=2c}b(G){3.R()}3.3R=1o;3.2I=2c}.1f(3)).1x(0.6)}.1f(3));3.5E=r.R.1x(3.8.1x,3.U);3.n.X();3.2I=1o;3.U.R();3.5D=(c(){s 5C.5z(3.8.1k.35,A)}.1f(3)).1x(3.8.1x);P 11},3S:c(){3.1H("U")},24:c(A){b(!3.1b){3.2Q()}3.Q(A);b(3.n.1e()){P}3.1H("R");3.5y=3.R.1f(3).1x(3.8.1x)},1H:c(A){b(3[A+"3L"]){5x(3[A+"3L"])}},R:c(){b(3.n.1e()){P}b(h.1l){3.1v.R()}h.3Y(3.n);3.1b.R();3.n.R();b(3.o){3.o.R()}3.i.3H("1T:5w")},1D:c(A){b(3.8.1k){b(3.U&&3.8.17!="1W"){3.U.X()}}b(!3.8.1D){P}3.2D();3.5v=3.X.1f(3).1x(3.8.1D)},2D:c(){b(3.8.1D){3.1H("1D")}},X:c(){3.1H("R");3.1H("U");b(!3.n.1e()){P}3.3K()},3K:c(){b(h.1l){3.1v.X()}b(3.U){3.U.X()}3.n.X();(3.27||3.1b).R();h.3f(3.n);3.i.3H("1T:2r")},3X:c(A){b(3.n&&3.n.1e()){3.X(A)}13{3.24(A)}},2k:c(){e C=3.8.o,B=26[0]||3.1r,D=h.2X(C.Q[0],B[C.1E]),F=h.2X(C.Q[1],B[h.2h[C.1E]]),A=3.1p||0;3.1S.25(3.W+D+F+".2o");b(C.1E=="1c"){e E=(D=="m")?C.p:0;3.3m.f("m: "+E+"k;");3.1S.f({"2E":D});3.o.f({m:0,j:(F=="1s"?"3g%":F=="1U"?"50%":0),5t:(F=="1s"?-1*C.q:F=="1U"?-0.5*C.q:0)+(F=="1s"?-1*A:F=="j"?A:0)+"k"})}13{3.3m.f(D=="j"?"1A: 0; 2x: "+C.p+"k 0 0 0;":"2x: 0; 1A: 0 0 "+C.p+"k 0;");3.o.f(D=="j"?"j: 0; 1s: 1L;":"j: 1L; 1s: 0;");3.1S.f({1A:0,"2E":F!="1U"?F:"2b"});b(F=="1U"){3.1S.f("1A: 0 1L;")}13{3.1S.f("1A-"+F+": "+A+"k;")}b(h.3r){b(D=="1s"){3.o.f({Q:"3M",5r:"5F",j:"1L",1s:"1L","2E":"m",q:"3g%",1A:(-1*C.p)+"k 0 0 0"});3.o.2a.2q="3Q"}13{3.o.f({Q:"3F","2E":"2b",1A:0})}}}3.1r=B},Q:c(B){b(!3.1b){3.2Q()}h.2L(3);b(h.1l){e A=3.n.1Z();b(!3.2F||3.2F.p!=A.p||3.2F.q!=A.q){3.1v.f({q:A.q+"k",p:A.p+"k"})}3.2F=A}b(3.8.Y){e J,H;b(3.22){e K=1h.1F.2H(),C=B.2f||{};e G,I=2;3J(3.22.4e()){T"5n":T"5m":G={x:0-I,y:0-I};15;T"5k":G={x:0,y:0-I};15;T"5M":T"5N":G={x:I,y:0-I};15;T"5O":G={x:I,y:0};15;T"5P":T"5Q":G={x:I,y:I};15;T"5R":G={x:0,y:I};15;T"5S":T"5d":G={x:0-I,y:I};15;T"5U":G={x:0-I,y:0};15}G.x+=3.8.1d.x;G.y+=3.8.1d.y;J=O.10({1d:G},{i:3.8.Y.1t,22:3.22,1y:{j:C.1G||21.1G(B)-K.j,m:C.1I||21.1I(B)-K.m}});H=h.Y(3.n,3.19,J);b(3.8.1F){e M=3.3e(H),L=M.1r;H=M.Q;H.m+=L.1g?2*V.36(G.x-3.8.1d.x):0;H.j+=L.1g?2*V.36(G.y-3.8.1d.y):0;b(3.o&&(3.1r.1c!=L.1c||3.1r.1g!=L.1g)){3.2k(L)}}H={m:H.m+"k",j:H.j+"k"};3.n.f(H)}13{J=O.10({1d:3.8.1d},{i:3.8.Y.1t,19:3.8.Y.19});H=h.Y(3.n,3.19,O.10({Q:1o},J))}b(3.U){e E=h.Y(3.U,3.19,O.10({Q:1o},J))}b(h.1l){3.1v.f("m:"+H.m+"k;j:"+H.j+"k")}}13{e F=3.19.2C(),C=B.2f||{},H={m:((3.8.1K)?F[0]:C.1I||21.1I(B))+3.8.1d.x,j:((3.8.1K)?F[1]:C.1G||21.1G(B))+3.8.1d.y};b(!3.8.1K&&3.i!==3.19){e D=3.i.2C();H.m+=-1*(D[0]-F[0]);H.j+=-1*(D[1]-F[1])}b(!3.8.1K&&3.8.1F){e M=3.3e(H),L=M.1r;H=M.Q;b(3.o&&(3.1r.1c!=L.1c||3.1r.1g!=L.1g)){3.2k(L)}}H={m:H.m+"k",j:H.j+"k"};3.n.f(H);b(3.U){3.U.f(H)}b(h.1l){3.1v.f(H)}}},3e:c(C){e E={1c:11,1g:11},D=3.n.1Z(),B=1h.1F.2H(),A=1h.1F.1Z(),G={m:"q",j:"p"};2z(e F 3I G){b((C[F]+D[G[F]]-B[F])>A[G[F]]){C[F]=C[F]-(D[G[F]]+(2*3.8.1d[F=="m"?"x":"y"]));b(3.o){E[h.3w[G[F]]]=1o}}}P{Q:C,1r:E}}});O.10(V,{45:c(G,H){e F=26[2]||3.8,B=F.1p,E=F.1j,D=s r("5a",{N:"59"+H.2G(),q:E+"k",p:E+"k"}),A={j:(H.3D(0)=="t"),m:(H.3D(1)=="l")};b(D&&D.3l&&D.3l("2d")){G.u(D);e C=D.3l("2d");C.55=F.1R;C.54((A.m?B:E-B),(A.j?B:E-B),B,0,66.67*2,1o);C.51();C.49((A.m?B:0),0,E-B,E);C.49(0,(A.j?B:0),E,E-B)}13{G.u(s r("S").f({q:E+"k",p:E+"k",1A:0,2x:0,2q:"3Q",Q:"3M",69:"2r"}).u(s r("v:6a",{4X:F.1R,4W:"4V",4U:F.1R,4T:(B/E*0.5).4S(2)}).f({q:2*E-1+"k",p:2*E-1+"k",Q:"3F",m:(A.m?0:(-1*E))+"k",j:(A.j?0:(-1*E))+"k"})))}}});r.4R({25:c(C,B){C=$(C);e A=O.10({4d:"j m",3s:"4P-3s",2U:"4O",1R:""},26[2]||{});C.f(h.1l?{4M:"6n:4L.6o.4I(2l=\'"+B+"\'\', 2U=\'"+A.2U+"\')"}:{4H:A.1R+" 35("+B+") "+A.4d+" "+A.3s});P C}});V.4f={R:c(){h.2L(3);3.2D();e D={};b(3.8.Y){D.2f={1I:0,1G:0}}13{e A=3.19.2C(),C=3.19.3T(),B=1h.1F.2H();A.m+=(-1*(C[0]-B[0]));A.j+=(-1*(C[1]-B[1]));D.2f={1I:A.m,1G:A.j}}b(3.8.1k){3.2W(D)}13{3.24(D)}3.1D()}};V.10=c(A){A.i.1T={};O.10(A.i.1T,{R:V.4f.R.1f(A),X:A.X.1f(A),1C:h.1C.1f(h,A.i)})};V.3N();',62,401,'|||this|||||options|||if|function||var|setStyle||Tips|element|top|px||left|wrapper|stem|height|width|Element|new||insert|||||||||||||||||||className|Object|return|position|show|div|case|loader|Prototip|images|hide|hook||extend|false|title|else||break||showOn|mouseout|target|closeButton|tooltip|horizontal|offset|visible|bind|vertical|document|observe|border|ajax|fixIE|mouseover|useEvent|true|radius|zIndex|stemInverse|bottom|tip|tips|iframeShim|content|delay|mouse|bindAsEventListener|margin|stopObserving|remove|hideAfter|orientation|viewport|pointerY|clearTimer|pointerX|hideOn|fixed|auto|eventToggle|mouseleave|Prototype|visibility|hideTargets|backgroundColor|stemImage|prototip|middle|mouseenter|click|toolbar|invoke|getDimensions|capture|Event|mouseHook|toLowerCase|showDelayed|setPngBackground|arguments|borderFrame|borderTop|prototip_Corner|style|none|null||Browser|fakePointer|clone|_inverse|isElement|wrap|positionStem|src|match|prototip_CornerWrapper|png|close|display|hidden|push|initialize|length|member|mousemove|padding|zIndexTop|for|isString|ajaxHideEvent|cumulativeOffset|cancelHideAfter|float|iframeShimDimensions|capitalize|getScrollOffsets|ajaxContentLoading|eventCheckDelay|eventPosition|raise|addClassName|IE|tagName|select|build|include|clearfix|li|sizingMethod|body|ajaxShow|inverseStem|convertVersionString|getStyle|unload|window|right|onComplete|default|url|toggleInt|eventShow|event|hideElement|add|activityLeave|activityEnter|descendantOf|getPositionWithinViewport|removeVisible|100|_update|highest|each|borderRow|getContext|stemWrapper|borderCenter|borderMiddle|replace|Styles|WebKit419|repeat|borderColor|REQUIRED_|find|_stemTranslation|9500px|activate|setup|fixSafari2|specialEvent|require|charAt|_captureTroubleElements|absolute|catch|fire|in|switch|afterHide|Timer|relative|start|try|relatedTarget|block|ajaxContentLoaded|ajaxHide|cumulativeScrollOffset|buttonEvent|Action|On|toggle|addVisibile|namespaces|input|eventHide|getWidth|update|prototip_Fill|createCorner|create|without|borderBottom|fillRect|deactivate|prototip_Between|_|align|toUpperCase|Methods|parseFloat|stemBox|throw|removeAll|prototip_Stem|MSIE|gif|prototipLoader|RegExp|Version|opacity|frameBorder|undefined|javascript|iframe|9500|typeof|area|script|emptyFunction|endsWith|styles|VML|head|js|closeButtons|behavior|background|AlphaImageLoader|000000|addRule|DXImageTransform|filter|abs|scale|no|createStyleSheet|addMethods|toFixed|arcSize|strokeColor|1px|strokeWeight|fillcolor|loaded|cannot||fill|available|not|arc|fillStyle|dom|Class|Tip|cornerCanvas|canvas|leftMiddle|bottomMiddle|LEFTBOTTOM|rightBottom|bottomRight|leftBottom|textarea|vml|bottomLeft|TOPMIDDLE|rightMiddle|TOPLEFT|LEFTTOP|topMiddle|com|rightTop|clear|topRight|marginTop|microsoft|hideAfterTimer|shown|clearTimeout|showTimer|Request|nodeType|schemas|Ajax|ajaxTimer|loaderTimer|both|responseText|urn|REQUIRED_Prototype|stop|blur|findElement|TOPRIGHT|RIGHTTOP|RIGHTMIDDLE|RIGHTBOTTOM|BOTTOMRIGHT|BOTTOMMIDDLE|BOTTOMLEFT|hideAction|LEFTMIDDLE|close_hover|isNumber|captureSafe|indexOf|br|bl|tr|tl|prototip_CornerWrapperBottomRight|cloneNode|prototip_CornerWrapperBottomLeft|Math|PI|prototip_CornerWrapperTopRight|overflow|roundrect|times|prototip_BetweenCorners|evaluate|parseInt|prototip_CornerWrapperTopLeft|WebKit|ul|userAgent|inline|navigator|MIDDLE|prototip_StemImage|progid|Microsoft|requires|prototip_StemBox|prototip_StemWrapper|exec'.split('|'),0,{}));var Lightview={Version:'2.3.2',options:{backgroundColor:'#111',border:12,buttons:{opacity:{disabled:0.4,normal:0.7,hover:1},side:{display:true},innerPreviousNext:{display:true},slideshow:{display:true}},cyclic:false,images:'http://static.us.expono.com/expono-0.9.6-4585/js/third_party/lightview/images/lightview/',imgNumberTemplate:'Image #{position} of #{total}',keyboard:{enabled:true},overlay:{background:'#000',close:true,opacity:0.85,display:true},preloadHover:true,radius:12,removeTitles:true,resizeDuration:0,slideshowDelay:4,titleSplit:'::',transition:function(pos){return((pos/=0.5)<1?0.5*Math.pow(pos,4):-0.5*((pos-=2)*Math.pow(pos,3)-2));},viewport:true,zIndex:5000,closeDimensions:{large:{width:77,height:22},small:{width:25,height:22},topclose:{width:22,height:18}},defaultOptions:{ajax:{width:400,height:300},iframe:{width:400,height:300,scrolling:true},inline:{width:400,height:300},flash:{width:400,height:300},quicktime:{width:480,height:220,autoplay:true,controls:true}},sideDimensions:{width:16,height:22}},classids:{quicktime:'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',flash:'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'},codebases:{quicktime:'http://www.apple.com/qtactivex/qtplugin.cab#version=7,3,0,0',flash:'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0'},errors:{requiresPlugin:"<div class='message'>The content your are attempting to view requires the <span class='type'>#{type}</span> plugin.</div><div class='pluginspage'><p>Please download and install the required plugin from:</p><a href='#{pluginspage}' target='_blank'>#{pluginspage}</a></div>"},mimetypes:{quicktime:'video/quicktime',flash:'application/x-shockwave-flash'},pluginspages:{quicktime:'http://www.apple.com/quicktime/download',flash:'http://www.adobe.com/go/getflashplayer'},typeExtensions:{flash:'swf',image:'bmp gif jpeg jpg png',iframe:'asp aspx cgi cfm htm html jsp php pl php3 php4 php5 phtml rb rhtml shtml txt',quicktime:'avi mov mpg mpeg movie'}};eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('1b.4a=(h(B){q A=k 4b("76 ([\\\\d.]+)").77(B);z A?5i(A[1]):-1})(2B.4c);Z.1f(X.12,{2t:X.12.2u&&(1b.4a>=6&&1b.4a<7),2v:(X.12.3r&&!1g.4d)});Z.1f(1b,{78:"1.6.0.2",79:"1.8.1",W:{1l:"4e",3s:"10"},5j:!!2B.4c.3t(/5k/i),4f:!!2B.4c.3t(/5k/i)&&(X.12.3r||X.12.2l),4g:h(A){f((7a 2a[A]=="7b")||(9.4h(2a[A].7c)<9.4h(9["5l"+A]))){7d("1b 7e "+A+" >= "+9["5l"+A]);}},4h:h(A){q B=A.2w(/5m.*|\\./g,"");B=3u(B+"0".7f(4-B.21));z A.23("5m")>-1?B-1:B},5n:h(){9.4g("X");f(!!2a.11&&!2a.5o){9.4g("5o")}f(/^(7g?:\\/\\/|\\/)/.4i(9.m.1h)){9.1h=9.m.1h}13{q A=/10(?:-[\\w\\d.]+)?\\.7h(.*)/;9.1h=(($$("7i 7j[1v]").5p(h(B){z B.1v.3t(A)})||{}).1v||"").2w(A,"")+9.m.1h}f(X.12.2u&&!1g.5q.v){1g.5q.5r("v","7k:7l-7m-7n:7o");1g.1i("4j:3v",h(){1g.7p().7q("v\\\\:*","7r: 30(#5s#7s);")})}},4k:h(){9.2C=9.m.2C;9.1c=(9.2C>9.m.1c)?9.2C:9.m.1c;9.1B=9.m.1B;9.1C=9.m.1C;9.5t();9.5u();9.5v();9.1R()}});Z.1f(1b,{5w:14,1R:h(){q A=4l.7t;A.4m++;f(A.4m==9.5w){$(1g.31).4n("10:3v")}}});1b.1R.4m=0;Z.1f(1b,{5t:h(){9.10=k y("Y",{2D:"10"});q B,I,D=9.1S(9.1C);f(X.12.2v){9.10.17=h(){9.r("1o:-3w;1j:-3w;1t:32;");z 9};9.10.1a=h(){9.r("1t:2x");z 9};9.10.2x=h(){z(9.1w("1t")=="2x"&&5i(9.1w("1j").2w("u",""))>-7u)}}$(1g.31).S(9.1T=k y("Y",{2D:"5x"}).r({3x:9.m.3x-1,1l:(!(X.12.2l||X.12.2t))?"4o":"3y",2E:9.4f?"30("+9.1h+"1T.1J) 1j 1o 2F":9.m.1T.2E}).1x((X.12.2l)?1:9.m.1T.1D).17()).S(9.10.r({3x:9.m.3x,1j:"-3w",1o:"-3w"}).1x(0).S(9.5y=k y("Y",{V:"7v"}).S(9.3z=k y("33",{V:"7w"}).S(9.5z=k y("1M",{V:"7x"}).r(I=Z.1f({1E:-1*9.1C.o+"u"},D)).S(9.3A=k y("Y",{V:"4p"}).r(Z.1f({1E:9.1C.o+"u"},D)).S(k y("Y",{V:"1U"})))).S(9.5A=k y("1M",{V:"7y"}).r(Z.1f({5B:-1*9.1C.o+"u"},D)).S(9.3B=k y("Y",{V:"4p"}).r(I).S(k y("Y",{V:"1U"}))))).S(9.5C=k y("Y",{V:"5D"}).S(9.3C=k y("Y",{V:"4p 7z"}).S(9.7A=k y("Y",{V:"1U"})))).S(k y("33",{V:"7B"}).S(k y("1M",{V:"5E 7C"}).S(B=k y("Y",{V:"7D"}).r({n:9.1c+"u"}).S(k y("33",{V:"5F 7E"}).S(k y("1M",{V:"5G"}).S(k y("Y",{V:"3D"})).S(k y("Y",{V:"34"}).r({1o:9.1c+"u"})))).S(k y("Y",{V:"5H"})).S(k y("33",{V:"5F 7F"}).S(k y("1M",{V:"5G"}).r("35-1j: "+(-1*9.1c)+"u").S(k y("Y",{V:"3D"})).S(k y("Y",{V:"34"}).r("1o: "+(-1*9.1c)+"u")))))).S(9.3E=k y("1M",{V:"7G"}).r("n: "+(7H-9.1c)+"u").S(k y("Y",{V:"7I"}).S(k y("Y",{V:"5I"}).r("35-1j: "+9.1c+"u").S(9.2G=k y("Y",{V:"7J"}).1x(0).r("3F: 0 "+9.1c+"u").S(9.2b=k y("Y",{V:"7K 34"})).S(9.1V=k y("Y",{V:"7L"}).S(9.36=k y("Y",{V:"1U 5J"}).r(9.1S(9.m.1B.3G)).r({2E:9.m.19}).1x(9.m.1K.1D.2y)).S(9.3H=k y("33",{V:"7M"}).S(9.4q=k y("1M",{V:"7N"}).S(9.1y=k y("Y",{V:"7O"})).S(9.1W=k y("Y",{V:"7P"}))).S(9.3I=k y("1M",{V:"7Q"}).S(k y("Y"))).S(9.4r=k y("1M",{V:"7R"}).S(9.7S=k y("Y",{V:"1U"}).1x(9.m.1K.1D.2y).r({19:9.m.19}).2c(9.1h+"7T.1J",{19:9.m.19})).S(9.7U=k y("Y",{V:"1U"}).1x(9.m.1K.1D.2y).r({19:9.m.19}).2c(9.1h+"7V.1J",{19:9.m.19}))).S(9.2m=k y("1M",{V:"7W"}).S(9.2z=k y("Y",{V:"1U"}).1x(9.m.1K.1D.2y).r({19:9.m.19}).2c(9.1h+"5K.1J",{19:9.m.19}))))).S(9.1N=k y("Y",{V:"7X"}))))).S(9.2H=k y("Y",{V:"5L"}).S(9.7Y=k y("Y",{V:"1U"}).r("2E: 30("+9.1h+"2H.4s) 1j 1o 3J-2F")))).S(k y("1M",{V:"5E 7Z"}).S(B.80(1O))).S(9.1L=k y("1M",{V:"81"}).17().r("35-1j: "+9.1c+"u; 2E: 30("+9.1h+"82.4s) 1j 1o 2F"))))).S(k y("Y",{2D:"38"}).17());q H=k 2n();H.1u=h(){H.1u=X.2e;9.1C={o:H.o,n:H.n};q K=9.1S(9.1C),C;9.3z.r({1P:0-(H.n/2).2o()+"u",n:H.n+"u"});9.5z.r(C=Z.1f({1E:-1*9.1C.o+"u"},K));9.3A.r(Z.1f({1E:K.o},K));9.5A.r(Z.1f({5B:-1*9.1C.o+"u"},K));9.3B.r(C);9.1R()}.U(9);H.1v=9.1h+"2f.1J";$w("2G 1y 1W 3I").1d(h(C){9[C].r({19:9.m.19})}.U(9));q G=9.5y.3a(".3D");$w("83 84 85 5M").1d(h(K,C){f(9.2C>0){9.5N(G[C],K)}13{G[C].S(k y("Y",{V:"34"}))}G[C].r({o:9.1c+"u",n:9.1c+"u"}).86("3D"+K.24());9.1R()}.U(9));9.10.3a(".5H",".34",".5I").3K("r",{19:9.m.19});q E={};$w("2f 1k 2g").1d(h(K){9[K+"2I"].3b=K;q C=9.1h+K+".1J";f(K=="2g"){E[K]=k 2n();E[K].1u=h(){E[K].1u=X.2e;9.1B[K]={o:E[K].o,n:E[K].n};q L=9.5j?"1o":"87",M=Z.1f({"88":L,1P:9.1B[K].n+"u"},9.1S(9.1B[K]));M["3F"+L.24()]=9.1c+"u";9[K+"2I"].r(M);9.5C.r({n:E[K].n+"u",1j:-1*9.1B[K].n+"u"});9[K+"2I"].5O().2c(C).r(9.1S(9.1B[K]));9.1R()}.U(9);E[K].1v=9.1h+K+".1J"}13{9[K+"2I"].2c(C)}}.U(9));q A={};$w("3G 3L").1d(h(C){A[C]=k 2n();A[C].1u=h(){A[C].1u=X.2e;9.1B[C]={o:A[C].o,n:A[C].n};9.1R()}.U(9);A[C].1v=9.1h+"5P"+C+".1J"}.U(9));q J=k 2n();J.1u=h(){J.1u=X.2e;9.2H.r({o:J.o+"u",n:J.n+"u",1P:-0.5*J.n+0.5*9.1c+"u",1E:-0.5*J.o+"u"});9.1R()}.U(9);J.1v=9.1h+"2H.4s";q F=k 2n();F.1u=h(C){F.1u=X.2e;q K={o:F.o+"u",n:F.n+"u"};9.2m.r(K);9.2z.r(K);9.1R()}.U(9);F.1v=9.1h+"5Q.1J";$w("2f 1k").1d(h(L){q K=L.24(),C=k 2n();C.1u=h(){C.1u=X.2e;9["2J"+K+"2K"].r({o:C.o+"u",n:C.n+"u"});9.1R()}.U(9);C.1v=9.1h+"89"+L+".1J";9["2J"+K+"2K"].1L=L}.U(9));9.1R()},5R:h(){11.2L.2M("10").1d(h(A){A.5S()});9.1z=1q;f(3u(9.3C.1w("1P"))<9.1B.2g.n){9.4t(2h)}9.4u();9.1m=1q},4u:h(){f(!9.3c||!9.3d){z}9.3d.S({8a:9.3c.r({1Q:9.3c.5T})});9.3d.26();9.3d=1q},1a:h(B){9.1r=1q;f(Z.5U(B)||Z.5V(B)){9.1r=$(B);f(!9.1r){z}9.1r.8b();9.j=9.1r.1X}13{f(B.1e){9.1r=$(1g.31);9.j=k 1b.4v(B)}13{f(Z.5W(B)){9.1r=9.4w(9.j.1p).4x[B];9.j=9.1r.1X}}}f(!9.j.1e){z}9.5R();9.4y();9.5X();9.5Y();9.3e();9.5Z();f(9.j.1e!="#38"&&Z.60(1b.4z).61(" ").23(9.j.18)>=0){f(!1b.4z[9.j.18]){$("38").1F(k 62(9.8c.8d).4d({18:9.j.18.24(),4A:9.4B[9.j.18]}));q C=$("38").2N();9.1a({1e:"#38",1y:9.j.18.24()+" 8e 8f",m:C});z 2h}}f(9.j.1G()){9.1m=9.j.1G()?9.4C(9.j.1p):[9.j]}q A=Z.1f({1V:1O,2g:2h,4D:"8g",4E:9.j.1G()&&9.m.1K.4E.1Q,63:9.m.1T.8h,2m:9.j.1G()&&9.m.1K.2m.1Q},9.m.8i[9.j.18]||{});9.j.m=Z.1f(A,9.j.m);f(!(9.j.1y||9.j.1W||(9.1m&&9.1m.21>1))&&9.j.m.2g){9.j.m.1V=2h}f(9.j.2O()){f(9.j.1G()){9.1l=9.1m.23(9.j);9.64()}9.1H=9.j.3M;f(9.1H){9.3N()}13{9.4F();q D=k 2n();D.1u=h(){D.1u=X.2e;9.3O();9.1H={o:D.o,n:D.n};9.3N()}.U(9);D.1v=9.j.1e}}13{9.1H=9.j.m.4G?1g.2P.2N():{o:9.j.m.o,n:9.j.m.n};9.3N()}},4H:h(){q D=9.65(9.j.1e),A=9.1z||9.1H;f(9.j.2O()){q B=9.1S(A);9.2b.r(B).1F(k y("66",{2D:"2i",1v:9.j.1e,8j:"",8k:"3J"}).r(B))}13{f(9.j.3P()){f(9.1z&&9.j.m.4G){A.n-=9.3f.n}3Q(9.j.18){2p"3g":q F=Z.3R(9.j.m.3g)||{};q E=h(){9.3O();f(9.j.m.4I){9.1N.r({o:"3S",n:"3S"});9.1H=9.3T(9.1N)}k 11.1n({W:9.W,1s:9.3U.U(9)})}.U(9);f(F.3V){F.3V=F.3V.1Y(h(N,M){E();N(M)})}13{F.3V=E}9.4F();k 8l.8m(9.1N,9.j.1e,F);2j;2p"27":9.1N.1F(9.27=k y("27",{8n:0,8o:0,1v:9.j.1e,2D:"2i",1Z:"8p"+(67.8q()*8r).2o(),68:(9.j.m&&9.j.m.68)?"3S":"3J"}).r(Z.1f({1c:0,35:0,3F:0},9.1S(A))));2j;2p"3W":q C=9.j.1e,H=$(C.69(C.23("#")+1));f(!H||!H.4J){z}q L=k y(9.j.m.8s||"Y"),G=H.1w("1t"),J=H.1w("1Q");H.1Y(L);H.r({1t:"32"}).1a();q I=9.3T(L);H.r({1t:G,1Q:J});L.S({6a:H}).26();H.S({6a:9.3d=k y(H.4J)});H.5T=H.1w("1Q");9.3c=H.1a();9.1N.1F(9.3c);9.1N.3a("3a, 3h, 6b").1d(h(M){9.3X.1d(h(N){f(N.1r==M){M.r({1t:N.1t})}})}.U(9));f(9.j.m.4I){9.1H=I;k 11.1n({W:9.W,1s:9.3U.U(9)})}2j}}13{q K={1I:"3h",2D:"2i",o:A.o,n:A.n};3Q(9.j.18){2p"2Q":Z.1f(K,{4A:9.4B[9.j.18],2R:[{1I:"28",1Z:"6c",2k:9.j.m.6c},{1I:"28",1Z:"6d",2k:"8t"},{1I:"28",1Z:"4K",2k:9.j.m.4L},{1I:"28",1Z:"8u",2k:1O},{1I:"28",1Z:"1v",2k:9.j.1e},{1I:"28",1Z:"6e",2k:9.j.m.6e||2h}]});Z.1f(K,X.12.2u?{8v:9.8w[9.j.18],8x:9.8y[9.j.18]}:{3H:9.j.1e,18:9.6f[9.j.18]});2j;2p"3i":Z.1f(K,{3H:9.j.1e,18:9.6f[9.j.18],8z:"8A",4D:9.j.m.4D,4A:9.4B[9.j.18],2R:[{1I:"28",1Z:"8B",2k:9.j.1e},{1I:"28",1Z:"8C",2k:"1O"}]});f(9.j.m.6g){K.2R.3j({1I:"28",1Z:"8D",2k:9.j.m.6g})}2j}9.2b.r(9.1S(A)).1a();9.2b.1F(9.4M(K));f(9.j.4N()&&$("2i")){(h(){3Y{f("6h"6i $("2i")){$("2i").6h(9.j.m.4L)}}3Z(M){}}.U(9)).2S(0.4)}}}},3T:h(B){B=$(B);q A=B.8E(),C=[],E=[];A.3j(B);A.1d(h(F){f(F!=B&&F.2x()){z}C.3j(F);E.3j({1Q:F.1w("1Q"),1l:F.1w("1l"),1t:F.1w("1t")});F.r({1Q:"6j",1l:"3y",1t:"2x"})});q D={o:B.8F,n:B.8G};C.1d(h(G,F){G.r(E[F])});z D},4O:h(){q A=$("2i");f(A){3Q(A.4J.4P()){2p"3h":f(X.12.3r&&9.j.4N()){3Y{A.6k()}3Z(B){}A.8H=""}f(A.8I){A.26()}13{A=X.2e}2j;2p"27":A.26();f(X.12.2l){4Q 2a.8J.2i}2j;5s:A.26();2j}}},6l:h(){q A=9.1z||9.1H;f(9.j.m.4L){3Q(9.j.18){2p"2Q":A.n+=16;2j}}9[(9.1z?"6m":"i")+"6n"]=A},3N:h(){k 11.1n({W:9.W,1s:h(){9.40()}.U(9)})},40:h(){9.3k();f(!9.j.6o()){9.3O()}f(!((9.j.m.4I&&9.j.8K())||9.j.6o())){9.3U()}f(!9.j.41()){k 11.1n({W:9.W,1s:9.4H.U(9)})}f(9.j.m.2g){k 11.1n({W:9.W,1s:9.4t.U(9,1O)})}},6p:h(){k 11.1n({W:9.W,1s:9.6q.U(9)});f(9.j.41()){k 11.1n({2S:0.2,W:9.W,1s:9.4H.U(9)})}f(9.2T){k 11.1n({W:9.W,1s:9.6r.U(9)})}},2q:h(){9.1a(9.2r().2q)},1k:h(){9.1a(9.2r().1k)},3U:h(){9.6l();q B=9.4R(),D=9.6s();f(9.m.2P&&(B.o>D.o||B.n>D.n)){f(!9.j.m.4G){q E=Z.3R(9.6t()),A=D,C=Z.3R(E);f(C.o>A.o){C.n*=A.o/C.o;C.o=A.o;f(C.n>A.n){C.o*=A.n/C.n;C.n=A.n}}13{f(C.n>A.n){C.o*=A.n/C.n;C.n=A.n;f(C.o>A.o){C.n*=A.o/C.o;C.o=A.o}}}q F=(C.o%1>0?C.n/E.n:C.n%1>0?C.o/E.o:1);9.1z={o:(9.1H.o*F).2o(),n:(9.1H.n*F).2o()};9.3k();B={o:9.1z.o,n:9.1z.n+9.3f.n}}13{9.1z=D;9.3k();B=D}}13{9.3k();9.1z=1q}9.42(B)},42:h(B){q F=9.10.2N(),I=2*9.1c,D=B.o+I,M=B.n+I;9.4S();q L=h(){9.3e();9.4T=1q;9.6p()};f(F.o==D&&F.n==M){L.U(9)();z}q C={o:D+"u",n:M+"u"};f(!X.12.2t){Z.1f(C,{1E:0-D/2+"u",1P:0-M/2+"u"})}q G=D-F.o,K=M-F.n,J=3u(9.10.1w("1E").2w("u","")),E=3u(9.10.1w("1P").2w("u",""));f(!X.12.2t){q A=(0-D/2)-J,H=(0-M/2)-E}9.4T=k 11.8L(9.10,0,1,{29:9.m.8M,W:9.W,6u:9.m.6u,1s:L.U(9)},h(Q){q N=(F.o+Q*G).3l(0),P=(F.n+Q*K).3l(0);f(X.12.2t){9.10.r({o:(F.o+Q*G).3l(0)+"u",n:(F.n+Q*K).3l(0)+"u"});9.3E.r({n:P-1*9.1c+"u"})}13{f(X.12.2u){9.10.r({1l:"4o",o:N+"u",n:P+"u",1E:((0-N)/2).2o()+"u",1P:((0-P)/2).2o()+"u"});9.3E.r({n:P-1*9.1c+"u"})}13{q O=9.43(),R=1g.2P.6v();9.10.r({1l:"3y",1E:0,1P:0,o:N+"u",n:P+"u",1o:(R[0]+(O.o/2)-(N/2)).3m()+"u",1j:(R[1]+(O.n/2)-(P/2)).3m()+"u"});9.3E.r({n:P-1*9.1c+"u"})}}}.U(9))},6q:h(){k 11.1n({W:9.W,1s:y.1a.U(9,9[9.j.44()?"2b":"1N"])});k 11.1n({W:9.W,1s:9.4S.U(9)});k 11.6w([k 11.45(9.2G,{46:1O,2U:0,2V:1}),k 11.4U(9.3z,{46:1O})],{W:9.W,29:0.25,1s:h(){f(9.1r){9.1r.4n("10:8N")}}.U(9)});f(9.j.1G()){k 11.1n({W:9.W,1s:9.6x.U(9)})}},5Y:h(){f(!9.10.2x()){z}k 11.6w([k 11.45(9.3z,{46:1O,2U:1,2V:0}),k 11.45(9.2G,{46:1O,2U:1,2V:0})],{W:9.W,29:0.2});k 11.1n({W:9.W,1s:h(){9.4O();9.2b.1F("").17();9.1N.1F("").17();9.3C.r({1P:9.1B.2g.n+"u"})}.U(9)})},6y:h(){9.4q.17();9.1y.17();9.1W.17();9.3I.17();9.4r.17();9.2m.17()},3k:h(){9.6y();f(!9.j.m.1V){9.3f={o:0,n:0};9.4V=0;9.1V.17();z 2h}13{9.1V.1a()}9.1V[(9.j.3P()?"5r":"26")+"8O"]("8P");f(9.j.1y||9.j.1W){9.4q.1a()}f(9.j.1y){9.1y.1F(9.j.1y).1a()}f(9.j.1W){9.1W.1F(9.j.1W).1a()}f(9.1m&&9.1m.21>1){9.3I.1a().5O().1F(k 62(9.m.8Q).4d({1l:9.1l+1,8R:9.1m.21}));f(9.j.m.2m){9.2z.1a();9.2m.1a()}}f(9.j.m.4E&&9.1m.21>1){q A={2f:(9.m.2s||9.1l!=0),1k:(9.m.2s||(9.j.1G()&&9.2r().1k!=0))};$w("2f 1k").1d(h(B){9["2J"+B.24()+"2K"].r({8S:(A[B]?"8T":"3S")}).1x(A[B]?9.m.1K.1D.2y:9.m.1K.1D.8U)}.U(9));9.4r.1a()}9.6z();9.6A()},6z:h(){q E=9.1B.3L.o,D=9.1B.3G.o,A=9.1z?9.1z.o:9.1H.o,F=8V,C=0,B=9.m.8W;f(9.j.m.2g){B=1q}13{f(!9.j.44()){B="3L";C=E}13{f(A>=F+E&&A<F+D){B="3L";C=E}13{f(A>=F+D){B="3G";C=D}}}}f(C>0){9.36.r({o:C+"u"}).1a()}13{9.36.17()}f(B){9.36.2c(9.1h+"5P"+B+".1J",{19:9.m.19})}9.4V=C},4F:h(){9.4W=k 11.4U(9.2H,{29:0.16,2U:0,2V:1,W:9.W})},3O:h(){f(9.4W){11.2L.2M("10").26(9.4W)}k 11.6B(9.2H,{29:0.22,W:9.W})},6C:h(){f(!9.j.2O()){z}q D=(9.m.2s||9.1l!=0),B=(9.m.2s||(9.j.1G()&&9.2r().1k!=0));9.3A[D?"1a":"17"]();9.3B[B?"1a":"17"]();q C=9.1z||9.1H;9.1L.r({n:C.n+"u"});q A=((C.o/2-1)+9.1c).3m();f(D){9.1L.S(9.2W=k y("Y",{V:"1U 8X"}).r({o:A+"u"}));9.2W.3b="2f"}f(B){9.1L.S(9.2X=k y("Y",{V:"1U 8Y"}).r({o:A+"u"}));9.2X.3b="1k"}f(D||B){9.1L.1a()}},6x:h(){f(!9.m.1K.3b.1Q||!9.j.2O()){z}9.6C();9.1L.1a()},4S:h(){9.1L.1F("").17();9.3A.17().r({1E:9.1C.o+"u"});9.3B.17().r({1E:-1*9.1C.o+"u"})},5Z:h(){f(9.10.1w("1D")!=0){z}q A=h(){f(!X.12.2v){9.10.1a()}9.10.1x(1)}.U(9);f(9.m.1T.1Q){k 11.4U(9.1T,{29:0.2,2U:0,2V:9.4f?1:9.m.1T.1D,W:9.W,8Z:9.4X.U(9),1s:A})}13{A()}},17:h(){f(X.12.2u&&9.27&&9.j.41()){9.27.26()}f(X.12.2v&&9.j.4N()){q A=$$("3h#2i")[0];f(A){3Y{A.6k()}3Z(B){}}}f(9.10.1w("1D")==0){z}9.2A();9.1L.17();f(!X.12.2u||!9.j.41()){9.2G.17()}f(11.2L.2M("4Y").90.21>0){z}11.2L.2M("10").1d(h(C){C.5S()});k 11.1n({W:9.W,1s:9.4u.U(9)});k 11.45(9.10,{29:0.1,2U:1,2V:0,W:{1l:"4e",3s:"4Y"}});k 11.6B(9.1T,{29:0.16,W:{1l:"4e",3s:"4Y"},1s:9.6D.U(9)})},6D:h(){9.10.17();9.2G.1x(0).1a();9.1L.1F("").17();9.4O();9.2b.1F("").17();9.1N.1F("").17();9.4y();9.6E();f(9.1r){9.1r.4n("10:32")}9.1r=1q;9.1m=1q;9.j=1q;9.1z=1q},6A:h(){q B={},A=9[(9.1z?"6m":"i")+"6n"].o;9.1V.r({o:A+"u"});9.3H.r({o:A-9.4V-1+"u"});B=9.3T(9.1V);9.1V.r({o:"91%"});9.3f=9.j.m.1V?B:{o:B.o,n:0}},3e:h(){q B=9.10.2N();f(X.12.2t){9.10.r({1j:"50%",1o:"50%"})}13{f(X.12.2v||X.12.2l){q A=9.43(),C=1g.2P.6v();9.10.r({1E:0,1P:0,1o:(C[0]+(A.o/2)-(B.o/2)).3m()+"u",1j:(C[1]+(A.n/2)-(B.n/2)).3m()+"u"})}13{9.10.r({1l:"4o",1o:"50%",1j:"50%",1E:(0-B.o/2).2o()+"u",1P:(0-B.n/2).2o()+"u"})}}},6F:h(){9.2A();9.2T=1O;9.1k.U(9).2S(0.25);9.2z.2c(9.1h+"5Q.1J",{19:9.m.19}).17()},2A:h(){f(9.2T){9.2T=2h}f(9.4Z){92(9.4Z)}9.2z.2c(9.1h+"5K.1J",{19:9.m.19})},6G:h(){9[(9.2T?"51":"4k")+"93"]()},6r:h(){f(9.2T){9.4Z=9.1k.U(9).2S(9.m.94)}},5u:h(){9.52=[];q A=$$("a[95~=10]");A.1d(h(B){B.6H();k 1b.4v(B);B.1i("2Y",9.1a.53(B).1Y(h(E,D){D.51();E(D)}).1A(9));f(B.1X.2O()){f(9.m.96){B.1i("2Z",9.6I.U(9,B.1X))}q C=A.97(h(D){z D.1p==B.1p});f(C[0].21){9.52.3j({1p:B.1X.1p,4x:C[0]});A=C[1]}}}.U(9))},4w:h(A){z 9.52.5p(h(B){z B.1p==A})},4C:h(A){z 9.4w(A).4x.6J("1X")},5v:h(){$(1g.31).1i("2Y",9.6K.1A(9));$w("2Z 3n").1d(h(C){9.1L.1i(C,h(D){q E=D.54("Y");f(!E){z}f(9.2W&&9.2W==E||9.2X&&9.2X==E){9.47(D)}}.1A(9))}.U(9));9.1L.1i("2Y",h(D){q E=D.54("Y");f(!E){z}q C=(9.2W&&9.2W==E)?"2q":(9.2X&&9.2X==E)?"1k":1q;f(C){9[C].1Y(h(G,F){9.2A();G(F)}).U(9)()}}.1A(9));$w("2f 1k").1d(h(F){q E=F.24(),C=h(H,G){9.2A();H(G)},D=h(I,H){q G=H.1r().1L;f((G=="2f"&&(9.m.2s||9.1l!=0))||(G=="1k"&&(9.m.2s||(9.j.1G()&&9.2r().1k!=0)))){I(H)}};9[F+"2I"].1i("2Z",9.47.1A(9)).1i("3n",9.47.1A(9)).1i("2Y",9[F=="1k"?F:"2q"].1Y(C).1A(9));9["2J"+E+"2K"].1i("2Y",9[F=="1k"?F:"2q"].1Y(D).1A(9)).1i("2Z",y.1x.53(9["2J"+E+"2K"],9.m.1K.1D.6L).1Y(D).1A(9)).1i("3n",y.1x.53(9["2J"+E+"2K"],9.m.1K.1D.2y).1Y(D).1A(9))}.U(9));q B=[9.36,9.2z];f(!X.12.2v){B.1d(h(C){C.1i("2Z",y.1x.U(9,C,9.m.1K.1D.6L)).1i("3n",y.1x.U(9,C,9.m.1K.1D.2y))}.U(9))}13{B.3K("1x",1)}9.2z.1i("2Y",9.6G.1A(9));f(X.12.2v||X.12.2l){q A=h(D,C){f(9.10.1w("1j").55(0)=="-"){z}D(C)};1n.1i(2a,"48",9.3e.1Y(A).1A(9));1n.1i(2a,"42",9.3e.1Y(A).1A(9))}f(X.12.2l){1n.1i(2a,"42",9.4X.1A(9))}},4t:h(A){f(9.6M){11.2L.2M("98").26(9.99)}q B={1P:(A?0:9.1B.2g.n)+"u"};9.6M=k 11.6N(9.3C,{6O:B,29:0.16,W:9.W,2S:A?0.15:0})},6P:h(){q A={};$w("o n").1d(h(E){q C=E.24();q B=1g.9a;A[E]=X.12.2u?[B["9b"+C],B["48"+C]].9c():X.12.3r?1g.31["48"+C]:B["48"+C]});z A},4X:h(){f(!X.12.2l){z}9.1T.r(9.1S(1g.2P.2N()));9.1T.r(9.1S(9.6P()))},6K:(h(){q A=".5J, .5D .1U, .5L, .9d";z h(B){f(9.j&&9.j.m&&B.54(A+(9.j.m.63?", #5x":""))){9.17()}}})(),47:h(E){q C=E.9e,B=C.3b,A=9.1C.o,F=(E.18=="2Z")?0:B=="2f"?A:-1*A,D={1E:F+"u"};f(!9.3o){9.3o={}}f(9.3o[B]){11.2L.2M("6Q"+B).26(9.3o[B])}9.3o[B]=k 11.6N(9[B+"2I"],{6O:D,29:0.2,W:{3s:"6Q"+B,9f:1},2S:(E.18=="3n"?0.1:0)})},2r:h(){f(!9.1m){z}q D=9.1l,C=9.1m.21;q B=(D<=0)?C-1:D-1,A=(D>=C-1)?0:D+1;z{2q:B,1k:A}},5N:h(G,H){q F=4l[2]||9.m,B=F.2C,E=F.1c,D=k y("9g",{V:"9h"+H.24(),o:E+"u",n:E+"u"}),A={1j:(H.55(0)=="t"),1o:(H.55(1)=="l")};f(D&&D.56&&D.56("2d")){G.S(D);q C=D.56("2d");C.9i=F.19;C.9j((A.1o?B:E-B),(A.1j?B:E-B),B,0,67.9k*2,1O);C.9l();C.6R((A.1o?B:0),0,E-B,E);C.6R(0,(A.1j?B:0),E,E-B)}13{G.S(k y("Y").r({o:E+"u",n:E+"u",35:0,3F:0,1Q:"6j",1l:"9m",9n:"32"}).S(k y("v:9o",{9p:F.19,9q:"9r",9s:F.19,9t:(B/E*0.5).3l(2)}).r({o:2*E-1+"u",n:2*E-1+"u",1l:"3y",1o:(A.1o?0:(-1*E))+"u",1j:(A.1j?0:(-1*E))+"u"})))}},5X:h(){f(9.57){z}q A=$$("3a","6b","3h");9.3X=A.9u(h(B){z{1r:B,1t:B.1w("1t")}});A.3K("r","1t:32");9.57=1O},6E:h(){9.3X.1d(h(B,A){B.1r.r("1t: "+B.1t)});4Q 9.3X;9.57=2h},1S:h(A){q B={};Z.60(A).1d(h(C){B[C]=A[C]+"u"});z B},4R:h(){z{o:9.1H.o,n:9.1H.n+9.3f.n}},6t:h(){q B=9.4R(),A=2*9.1c;z{o:B.o+A,n:B.n+A}},6s:h(){q C=20,A=2*9.1C.n+C,B=9.43();z{o:B.o-A,n:B.n-A}},43:h(){q A=1g.2P.2N();f(9.4K&&9.4K.2x()){A.n-=9.9v}z A}});Z.1f(1b,{6S:h(){f(!9.m.6T.6U){z}9.49=9.6V.1A(9);1g.1i("6W",9.49)},4y:h(){f(!9.m.6T.6U){z}f(9.49){1g.6H("6W",9.49)}},6V:h(C){q B=9w.9x(C.6X).4P(),E=C.6X,F=9.j.1G()&&!9.4T,A=9.j.m.2m,D;f(9.j.44()){C.51();D=(E==1n.6Y||["x","c"].58(B))?"17":(E==37&&F&&(9.m.2s||9.1l!=0))?"2q":(E==39&&F&&(9.m.2s||9.2r().1k!=0))?"1k":(B=="p"&&A&&9.j.1G())?"6F":(B=="s"&&A&&9.j.1G())?"2A":1q;f(B!="s"){9.2A()}}13{D=(E==1n.6Y)?"17":1q}f(D){9[D]()}f(F){f(E==1n.9y&&9.1m.6Z()!=9.j){9.1a(9.1m.6Z())}f(E==1n.9z&&9.1m.70()!=9.j){9.1a(9.1m.70())}}}});1b.40=1b.40.1Y(h(B,A){9.6S();B(A)});Z.1f(1b,{64:h(){f(9.1m.21==0){z}q A=9.2r();9.59([A.1k,A.2q])},59:h(C){q A=(9.1m&&9.1m.58(C)||Z.9A(C))?9.1m:C.1p?9.4C(C.1p):1q;f(!A){z}q B=$A(Z.5W(C)?[C]:C.18?[A.23(C)]:C).9B();B.1d(h(F){q D=A[F],E=D.1e;f(D.3M||D.5a||!E){z}q G=k 2n();G.1u=h(){G.1u=X.2e;D.5a=1q;9.71(D,G)}.U(9);G.1v=E}.U(9))},71:h(A,B){A.3M={o:B.o,n:B.n}},6I:h(A){f(A.3M||A.5a){z}9.59(A)}});y.9C({2c:h(C,B){C=$(C);q A=Z.1f({72:"1j 1o",2F:"3J-2F",5b:"6d",19:""},4l[2]||{});C.r(X.12.2t?{9D:"9E:9F.9G.9H(1v=\'"+B+"\'\', 5b=\'"+A.5b+"\')"}:{2E:A.19+" 30("+B+") "+A.72+" "+A.2F});z C}});Z.1f(1b,{73:h(A){q B;$w("3i 3p 27 2Q").1d(h(C){f(k 4b("\\\\.("+9.9I[C].2w(/\\s+/g,"|")+")(\\\\?.*)?","i").4i(A)){B=C}}.U(9));f(B){z B}f(A.5c("#")){z"3W"}f(1g.74&&1g.74!=(A).2w(/(^.*\\/\\/)|(:.*)|(\\/.*)/g,"")){z"27"}z"3p"},65:h(A){q B=A.9J(/\\?.*/,"").3t(/\\.([^.]{3,4})$/);z B?B[1]:1q},4M:h(B){q C="<"+B.1I;9K(q A 6i B){f(!["2R","5d","1I"].58(A)){C+=" "+A+\'="\'+B[A]+\'"\'}}f(k 4b("^(?:9L|9M|9N|5M|9O|9P|9Q|66|9R|9S|9T|9U|28|9V|9W|9X)$","i").4i(B.1I)){C+="/>"}13{C+=">";f(B.2R){B.2R.1d(h(D){C+=9.4M(D)}.U(9))}f(B.5d){C+=B.5d}C+="</"+B.1I+">"}z C}});(h(){1g.1i("4j:3v",h(){q B=(2B.5e&&2B.5e.21),A=h(D){q C=2h;f(B){C=($A(2B.5e).6J("1Z").61(",").23(D)>=0)}13{3Y{C=k 9Y(D)}3Z(E){}}z!!C};2a.1b.4z=(B)?{3i:A("9Z a0"),2Q:A("5f")}:{3i:A("75.75"),2Q:A("5f.5f")}})})();1b.4v=a1.a2({a3:h(b){q c=Z.5U(b);f(c&&!b.1X){b.1X=9;f(b.1y){b.1X.5g=b.1y;f(1b.m.a4){b.1y=""}}}9.1e=c?b.a5("1e"):b.1e;f(9.1e.23("#")>=0){9.1e=9.1e.69(9.1e.23("#"))}f(b.1p&&b.1p.5c("3q")){9.18="3q";9.1p=b.1p}13{f(b.1p){9.18=b.1p;9.1p=b.1p}13{9.18=1b.73(9.1e);9.1p=9.18}}$w("3g 3i 3q 27 3p 3W 2Q 1N 2b").1d(h(a){q T=a.24(),t=a.4P();f("3p 3q 2b 1N".23(a)<0){9["a6"+T]=h(){z 9.18==t}.U(9)}}.U(9));f(c&&b.1X.5g){q d=b.1X.5g.a7(1b.m.a8).3K("a9");f(d[0]){9.1y=d[0]}f(d[1]){9.1W=d[1]}q e=d[2];9.m=(e&&Z.5V(e))?aa("({"+e+"})"):{}}13{9.1y=b.1y;9.1W=b.1W;9.m=b.m||{}}f(9.m.5h){9.m.3g=Z.3R(9.m.5h);4Q 9.m.5h}},1G:h(){z 9.18.5c("3q")},2O:h(){z(9.1G()||9.18=="3p")},3P:h(){z"27 3W 3g".23(9.18)>=0},44:h(){z!9.3P()}});1b.5n();1g.1i("4j:3v",1b.4k.U(1b));',62,631,'|||||||||this||||||if||function||view|new||options|height|width||var|setStyle|||px||||Element|return|||||||||||||||||||insert||bind|className|queue|Prototype|div|Object|lightview|Effect|Browser|else||||hide|type|backgroundColor|show|Lightview|border|each|href|extend|document|images|observe|top|next|position|views|Event|left|rel|null|element|afterFinish|visibility|onload|src|getStyle|setOpacity|title|scaledInnerDimensions|bindAsEventListener|closeDimensions|sideDimensions|opacity|marginLeft|update|isGallery|innerDimensions|tag|png|buttons|prevnext|li|external|true|marginTop|display|_lightviewLoadedEvent|pixelClone|overlay|lv_Button|menubar|caption|_view|wrap|name||length||indexOf|capitalize||remove|iframe|param|duration|window|media|setPngBackground||emptyFunction|prev|topclose|false|lightviewContent|break|value|Gecko|slideshow|Image|round|case|previous|getSurroundingIndexes|cyclic|IE6|IE|WebKit419|replace|visible|normal|slideshowButton|stopSlideshow|navigator|radius|id|background|repeat|center|loading|ButtonImage|inner|Button|Queues|get|getDimensions|isImage|viewport|quicktime|children|delay|sliding|from|to|prevButton|nextButton|click|mouseover|url|body|hidden|ul|lv_Fill|margin|closeButton||lightviewError||select|side|inlineContent|inlineMarker|restoreCenter|menuBarDimensions|ajax|object|flash|push|fillMenuBar|toFixed|floor|mouseout|sideEffect|image|gallery|WebKit|scope|match|parseInt|loaded|9500px|zIndex|absolute|sideButtons|prevButtonImage|nextButtonImage|topcloseButtonImage|lv_Corner|resizeCenter|padding|large|data|imgNumber|no|invoke|small|preloadedDimensions|afterEffect|stopLoading|isExternal|switch|clone|auto|getHiddenDimensions|resizeWithinViewport|onComplete|inline|overlappingRestore|try|catch|afterShow|isIframe|resize|getViewportDimensions|isMedia|Opacity|sync|toggleSideButton|scroll|keyboardEvent|IEVersion|RegExp|userAgent|evaluate|end|pngOverlay|require|convertVersionString|test|dom|start|arguments|counter|fire|fixed|lv_Wrapper|dataText|innerPrevNext|gif|toggleTopClose|restoreInlineContent|View|getSet|elements|disableKeyboardNavigation|Plugin|pluginspage|pluginspages|getViews|wmode|innerPreviousNext|startLoading|fullscreen|insertContent|autosize|tagName|controller|controls|createHTML|isQuicktime|clearContent|toLowerCase|delete|getInnerDimensions|hidePrevNext|resizing|Appear|closeButtonWidth|loadingEffect|maxOverlay|lightview_hide|slideTimer||stop|sets|curry|findElement|charAt|getContext|preventingOverlap|member|preloadFromSet|isPreloading|sizingMethod|startsWith|html|plugins|QuickTime|_title|ajaxOptions|parseFloat|isMac|mac|REQUIRED_|_|load|Scriptaculous|find|namespaces|add|default|build|updateViews|addObservers|_lightviewLoadedEvents|lv_overlay|container|prevSide|nextSide|marginRight|topButtons|lv_topButtons|lv_Frame|lv_Half|lv_CornerWrapper|lv_Filler|lv_WrapDown|lv_Close|inner_slideshow_play|lv_Loading|br|createCorner|down|close_|inner_slideshow_stop|prepare|cancel|_inlineDisplayRestore|isElement|isString|isNumber|hideOverlapping|hideContent|appear|keys|join|Template|overlayClose|preloadSurroundingImages|detectExtension|img|Math|scrolling|substr|before|embed|autoplay|scale|loop|mimetypes|flashvars|SetControllerVisible|in|block|Stop|adjustDimensionsToView|scaledI|nnerDimensions|isAjax|finishShow|showContent|nextSlide|getBounds|getOuterDimensions|transition|getScrollOffsets|Parallel|showPrevNext|hideData|setCloseButtons|setMenuBarDimensions|Fade|setPrevNext|afterHide|showOverlapping|startSlideshow|toggleSlideshow|stopObserving|preloadImageHover|pluck|delegateClose|hover|_topCloseEffect|Morph|style|getScrollDimensions|lightview_side|fillRect|enableKeyboardNavigation|keyboard|enabled|keyboardDown|keydown|keyCode|KEY_ESC|first|last|setPreloadedDimensions|align|detectType|domain|ShockwaveFlash|MSIE|exec|REQUIRED_Prototype|REQUIRED_Scriptaculous|typeof|undefined|Version|throw|requires|times|https|js|head|script|urn|schemas|microsoft|com|vml|createStyleSheet|addRule|behavior|VML|callee|9500|lv_Container|lv_Sides|lv_PrevSide|lv_NextSide|lv_topcloseButtonImage|topcloseButton|lv_Frames|lv_FrameTop|lv_Liquid|lv_HalfLeft|lv_HalfRight|lv_Center|150|lv_WrapUp|lv_WrapCenter|lv_Media|lv_MenuBar|lv_Data|lv_DataText|lv_Title|lv_Caption|lv_ImgNumber|lv_innerPrevNext|innerPrevButton|inner_prev|innerNextButton|inner_next|lv_Slideshow|lv_External|loadingButton|lv_FrameBottom|cloneNode|lv_PrevNext|blank|tl|tr|bl|addClassName|right|float|inner_|after|blur|errors|requiresPlugin|plugin|required|transparent|close|defaultOptions|alt|galleryimg|Ajax|Updater|frameBorder|hspace|lightviewContent_|random|99999|wrapperTag|tofit|enablejavascript|codebase|codebases|classid|classids|quality|high|movie|allowFullScreen|FlashVars|ancestors|clientWidth|clientHeight|innerHTML|parentNode|frames|isInline|Tween|resizeDuration|opened|ClassName|lv_MenuTop|imgNumberTemplate|total|cursor|pointer|disabled|180|borderColor|lv_PrevButton|lv_NextButton|beforeStart|effects|100|clearTimeout|Slideshow|slideshowDelay|class|preloadHover|partition|lightview_topCloseEffect|topCloseEffect|documentElement|offset|max|lv_controllerClose|target|limit|canvas|cornerCanvas|fillStyle|arc|PI|fill|relative|overflow|roundrect|fillcolor|strokeWeight|1px|strokeColor|arcSize|map|controllerOffset|String|fromCharCode|KEY_HOME|KEY_END|isArray|uniq|addMethods|filter|progid|DXImageTransform|Microsoft|AlphaImageLoader|typeExtensions|gsub|for|area|base|basefont|col|frame|hr|input|link|isindex|meta|range|spacer|wbr|ActiveXObject|Shockwave|Flash|Class|create|initialize|removeTitles|getAttribute|is|split|titleSplit|strip|eval'.split('|'),0,{}));var DatePickerFormatter=Class.create();DatePickerFormatter.prototype={initialize:function(format,separator){if(Object.isUndefined(format))
format=["yyyy","mm","dd"];if(Object.isUndefined(separator))
separator="-";this._format=format;this.separator=separator;this._format_year_index=format.indexOf("yyyy");this._format_month_index=format.indexOf("mm");this._format_day_index=format.indexOf("dd");this._year_regexp=/^\d{4}$/;this._month_regexp=/^0\d|1[012]|\d$/;this._day_regexp=/^0\d|[12]\d|3[01]|\d$/;},match:function(str){var d=str.split(this.separator);if(d.length<3)
return false;var year=d[this._format_year_index].match(this._year_regexp);if(year){year=year[0]}else{return false}
var month=d[this._format_month_index].match(this._month_regexp);if(month){month=month[0]}else{return false}
var day=d[this._format_day_index].match(this._day_regexp);if(day){day=day[0]}else{return false}
return[year,month,day];},current_date:function(){var d=new Date;return this.date_to_string(d.getFullYear(),d.getMonth()+1,d.getDate());},date_to_string:function(year,month,day,separator){if(Object.isUndefined(separator))
separator=this.separator;var a=[0,0,0];a[this._format_year_index]=year;a[this._format_month_index]=month.toPaddedString(2);a[this._format_day_index]=day.toPaddedString(2);return a.join(separator);}};var DatePicker=Class.create();DatePicker.prototype={Version:'0.9.4',_relative:null,_div:null,_zindex:1,_keepFieldEmpty:false,_daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],_dateFormat:[["dd","mm","yyyy"],"/"],_language:'fr',_language_month:$H({'fr':['Janvier','F&#233;vrier','Mars','Avril','Mai','Juin','Juillet','Aout','Septembre','Octobre','Novembre','D&#233;cembre'],'en':['January','February','March','April','May','June','July','August','September','October','November','December'],'sp':['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],'it':['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],'de':['Januar','Februar','M&#228;rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],'pt':['Janeiro','Fevereiro','Mar&#231;o','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],'hu':['Janu&#225;r','Febru&#225;r','M&#225;rcius','&#193;prilis','M&#225;jus','J&#250;nius','J&#250;lius','Augusztus','Szeptember','Okt&#243;ber','November','December'],'lt':['Sausis','Vasaris','Kovas','Balandis','Gegu&#382;&#279;','Bir&#382;elis','Liepa','Rugj&#363;tis','Rus&#279;jis','Spalis','Lapkritis','Gruodis'],'nl':['januari','februari','maart','april','mei','juni','juli','augustus','september','oktober','november','december'],'dk':['Januar','Februar','Marts','April','Maj','Juni','Juli','August','September','Oktober','November','December'],'no':['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'],'lv':['Janv&#257;ris','Febru&#257;ris','Marts','Apr&#299;lis','Maijs','J&#363;nijs','J&#363;lijs','Augusts','Septembris','Oktobris','Novembris','Decemberis'],'ja':['1&#26376;','2&#26376;','3&#26376;','4&#26376;','5&#26376;','6&#26376;','7&#26376;','8&#26376;','9&#26376;','10&#26376;','11&#26376;','12&#26376;'],'fi':['Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kes&#228;kuu','Hein&#228;kuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'],'ro':['Ianuarie','Februarie','Martie','Aprilie','Mai','Junie','Julie','August','Septembrie','Octombrie','Noiembrie','Decembrie'],'zh':['1&#32;&#26376;','2&#32;&#26376;','3&#32;&#26376;','4&#32;&#26376;','5&#32;&#26376;','6&#32;&#26376;','7&#32;&#26376;','8&#32;&#26376;','9&#32;&#26376;','10&#26376;','11&#26376;','12&#26376;'],'sv':['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December']}),_language_day:$H({'fr':['Lun','Mar','Mer','Jeu','Ven','Sam','Dim'],'en':['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],'sp':['Lun','Mar','Mie','Jue','Vie','S&#224;b','Dom'],'it':['Lun','Mar','Mer','Gio','Ven','Sab','Dom'],'de':['Mon','Die','Mit','Don','Fre','Sam','Son'],'pt':['Seg','Ter','Qua','Qui','Sex','S&#225;','Dom'],'hu':['H&#233;','Ke','Sze','Cs&#252;','P&#233;','Szo','Vas'],'lt':['Pir','Ant','Tre','Ket','Pen','&Scaron;e&scaron;','Sek'],'nl':['ma','di','wo','do','vr','za','zo'],'dk':['Man','Tir','Ons','Tor','Fre','L&#248;r','S&#248;n'],'no':['Man','Tir','Ons','Tor','Fre','L&#248;r','Sun'],'lv':['P','O','T','C','Pk','S','Sv'],'ja':['&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;','&#26085;'],'fi':['Ma','Ti','Ke','To','Pe','La','Su'],'ro':['Lun','Mar','Mie','Joi','Vin','Sam','Dum'],'zh':['&#21608;&#19968;','&#21608;&#20108;','&#21608;&#19977;','&#21608;&#22235;','&#21608;&#20116;','&#21608;&#20845;','&#21608;&#26085;'],'sv':['M&#229;n','Tis','Ons','Tor','Fre','L&#246;r','S&#246;n']}),_language_close:$H({'fr':'fermer','en':'close','sp':'cierre','it':'fine','de':'schliessen','pt':'fim','hu':'bez&#225;r','lt':'udaryti','nl':'sluiten','dk':'luk','no':'lukk','lv':'aizv&#275;rt','ja':'&#38281;&#12376;&#12427;','fi':'sulje','ro':'inchide','zh':'&#20851;&#32;&#38381','sv':'st&#228;ng'}),_todayDate:new Date(),_current_date:null,_clickCallback:Prototype.emptyFunction,_cellCallback:Prototype.emptyFunction,_id_datepicker:null,_disablePastDate:false,_disableFutureDate:true,_oneDayInMs:24*3600*1000,_topOffset:30,_leftOffset:0,_isPositionned:false,_relativePosition:true,_setPositionTop:0,_setPositionLeft:0,_bodyAppend:false,_showEffect:"appear",_showDuration:1,_enableShowEffect:true,_closeEffect:"fade",_closeEffectDuration:0.3,_enableCloseEffect:true,_closeTimer:null,_enableCloseOnBlur:false,_afterClose:Prototype.emptyFunction,getMonthLocale:function(month){return this._language_month.get(this._language)[month];},getLocaleClose:function(){return this._language_close.get(this._language);},_initCurrentDate:function(){this._df=new DatePickerFormatter(this._dateFormat[0],this._dateFormat[1]);this._current_date=$F(this._relative);if(!this._df.match(this._current_date)){this._current_date=this._df.current_date();if(!this._keepFieldEmpty)
$(this._relative).value=this._current_date;}
var a_date=this._df.match(this._current_date);this._current_year=Number(a_date[0]);this._current_mon=Number(a_date[1])-1;this._current_day=Number(a_date[2]);},initialize:function(h_p){this._relative=h_p["relative"];if(h_p["language"])
this._language=h_p["language"];this._zindex=(h_p["zindex"])?parseInt(Number(h_p["zindex"])):1;if(!Object.isUndefined(h_p["keepFieldEmpty"]))
this._keepFieldEmpty=h_p["keepFieldEmpty"];if(Object.isFunction(h_p["clickCallback"]))
this._clickCallback=h_p["clickCallback"];if(!Object.isUndefined(h_p["leftOffset"]))
this._leftOffset=parseInt(h_p["leftOffset"]);if(!Object.isUndefined(h_p["topOffset"]))
this._topOffset=parseInt(h_p["topOffset"]);if(!Object.isUndefined(h_p["relativePosition"]))
this._relativePosition=h_p["relativePosition"];if(!Object.isUndefined(h_p["showEffect"]))
this._showEffect=h_p["showEffect"];if(!Object.isUndefined(h_p["enableShowEffect"]))
this._enableShowEffect=h_p["enableShowEffect"];if(!Object.isUndefined(h_p["showDuration"]))
this._showDuration=h_p["showDuration"];if(!Object.isUndefined(h_p["closeEffect"]))
this._closeEffect=h_p["closeEffect"];if(!Object.isUndefined(h_p["enableCloseEffect"]))
this._enableCloseEffect=h_p["enableCloseEffect"];if(!Object.isUndefined(h_p["closeEffectDuration"]))
this._closeEffectDuration=h_p["closeEffectDuration"];if(Object.isFunction(h_p["afterClose"]))
this._afterClose=h_p["afterClose"];if(!Object.isUndefined(h_p["externalControl"]))
this._externalControl=h_p["externalControl"];if(!Object.isUndefined(h_p["dateFormat"]))
this._dateFormat=h_p["dateFormat"];if(Object.isFunction(h_p["cellCallback"]))
this._cellCallback=h_p["cellCallback"];this._setPositionTop=(h_p["setPositionTop"])?parseInt(Number(h_p["setPositionTop"])):0;this._setPositionLeft=(h_p["setPositionLeft"])?parseInt(Number(h_p["setPositionLeft"])):0;if(!Object.isUndefined(h_p["enableCloseOnBlur"])&&h_p["enableCloseOnBlur"])
this._enableCloseOnBlur=true;if(!Object.isUndefined(h_p["disablePastDate"])&&h_p["disablePastDate"])
this._disablePastDate=true;if(!Object.isUndefined(h_p["disableFutureDate"])&&!h_p["disableFutureDate"])
this._disableFutureDate=false;this._id_datepicker='datepicker-'+this._relative;this._id_datepicker_prev=this._id_datepicker+'-prev';this._id_datepicker_next=this._id_datepicker+'-next';this._id_datepicker_hdr=this._id_datepicker+'-header';this._id_datepicker_ftr=this._id_datepicker+'-footer';this._div=new Element('div',{id:this._id_datepicker,className:'datepicker',style:'display: none; z-index:'+this._zindex});this._div.innerHTML='<table><thead><tr><th width="10px" id="'+this._id_datepicker_prev+'" style="cursor: pointer;">&nbsp;&lt;&lt;&nbsp;</th><th id="'+this._id_datepicker_hdr+'" colspan="5"></th><th width="10px" id="'+this._id_datepicker_next+'" style="cursor: pointer;">&nbsp;&gt;&gt;&nbsp;</th></tr></thead><tbody id="'+this._id_datepicker+'-tbody"></tbody><tfoot><td colspan="7" id="'+this._id_datepicker_ftr+'"></td></tfoot></table>';Event.observe(this._relative,'click',this.click.bindAsEventListener(this),false);document.observe('dom:loaded',this.load.bindAsEventListener(this),false);if(this._enableCloseOnBlur){Event.observe(this._relative,'blur',function(e){this._closeTimer=this.close.bind(this).delay(1);}.bindAsEventListener(this));Event.observe(this._div,'click',function(e){if(this._closeTimer){window.clearTimeout(this._closeTimer);this._closeTimer=null;}});}},load:function(){if(this._externalControl){Event.observe(this._externalControl,'click',this.toggle.bindAsEventListener(this),false);if(!Element.getStyle(this._externalControl,'cursor'))
Element.setStyle(this._externalControl,{cursor:'pointer'});}
if(this._relativeAppend){if($(this._relative).parentNode){this._div.innerHTML=this._wrap_in_iframe(this._div.innerHTML);$(this._relative).parentNode.appendChild(this._div);}}else{var body=document.getElementsByTagName("body").item(0);if(body){this._div.innerHTML=this._wrap_in_iframe(this._div.innerHTML);body.appendChild(this._div);}
if(this._relativePosition){var a_pos=Element.cumulativeOffset($(this._relative));this.setPosition(a_pos[1],a_pos[0]);}else{if(this._setPositionTop||this._setPositionLeft)
this.setPosition(this._setPositionTop,this._setPositionLeft);}}
this._initCurrentDate();$(this._id_datepicker_ftr).innerHTML=this.getLocaleClose();Event.observe($(this._id_datepicker_prev),'click',this.prevMonth.bindAsEventListener(this),false);Event.observe($(this._id_datepicker_next),'click',this.nextMonth.bindAsEventListener(this),false);Event.observe($(this._id_datepicker_ftr),'click',this.close.bindAsEventListener(this),false);},_wrap_in_iframe:function(content){return(Prototype.Browser.IE)?"<div style='height:167px;width:185px;background-color:white;align:left'><iframe width='100%' height='100%' marginwidth='0' marginheight='0' frameborder='0' src='about:blank' style='filter:alpha(Opacity=50);'></iframe><div style='position:absolute;background-color:white;top:2px;left:2px;width:180px'>"+content+"</div></div>":content;},visible:function(){return $(this._id_datepicker).visible();},click:function(){if($(this._id_datepicker)==null)this.load();if(!this._isPositionned&&this._relativePosition){var a_lt=Element.positionedOffset($(this._relative));$(this._id_datepicker).setStyle({'left':Number(a_lt[0]+this._leftOffset)+'px','top':Number(a_lt[1]+this._topOffset)+'px'});this._isPositionned=true;}
if(!this.visible()){this._initCurrentDate();this._redrawCalendar();}
eval(this._clickCallback());if(this._enableShowEffect){new Effect.toggle(this._id_datepicker,this._showEffect,{duration:this._showDuration});}else{$(this._id_datepicker).show();}},toggle:function(){this.visible()?this.close():this.click();},close:function(){if(this._enableCloseEffect){switch(this._closeEffect){case'puff':new Effect.Puff(this._id_datepicker,{duration:this._closeEffectDuration});break;case'blindUp':new Effect.BlindUp(this._id_datepicker,{duration:this._closeEffectDuration});break;case'dropOut':new Effect.DropOut(this._id_datepicker,{duration:this._closeEffectDuration});break;case'switchOff':new Effect.SwitchOff(this._id_datepicker,{duration:this._closeEffectDuration});break;case'squish':new Effect.Squish(this._id_datepicker,{duration:this._closeEffectDuration});break;case'fold':new Effect.Fold(this._id_datepicker,{duration:this._closeEffectDuration});break;case'shrink':new Effect.Shrink(this._id_datepicker,{duration:this._closeEffectDuration});break;default:new Effect.Fade(this._id_datepicker,{duration:this._closeEffectDuration});break;};}else{$(this._id_datepicker).hide();}
eval(this._afterClose());},setDateFormat:function(format,separator){if(Object.isUndefined(format))
format=this._dateFormat[0];if(Object.isUndefined(separator))
separator=this._dateFormat[1];this._dateFormat=[format,separator];},setPosition:function(t,l){var h_pos={'top':'0px','left':'0px'};if(!Object.isUndefined(t))
h_pos['top']=Number(t)+this._topOffset+'px';if(!Object.isUndefined(l))
h_pos['left']=Number(l)+this._leftOffset+'px';$(this._id_datepicker).setStyle(h_pos);this._isPositionned=true;},_getMonthDays:function(year,month){if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&(month==1))
return 29;return this._daysInMonth[month];},_buildCalendar:function(){var _self=this;var tbody=$(this._id_datepicker+'-tbody');try{while(tbody.hasChildNodes())
tbody.removeChild(tbody.childNodes[0]);}catch(e){};var trDay=new Element('tr');this._language_day.get(this._language).each(function(item){var td=new Element('td');td.innerHTML=item;td.className='wday';trDay.appendChild(td);});tbody.appendChild(trDay);var a_d=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];var d=new Date(this._current_year,this._current_mon,1,12);var startIndex=(!d.getDay())?6:d.getDay()-1;var nbDaysInMonth=this._getMonthDays(this._current_year,this._current_mon);var daysIndex=1;for(var j=startIndex;j<7;j++){a_d[0][j]={d:daysIndex,m:this._current_mon,y:this._current_year};daysIndex++;}
var a_prevMY=this._prevMonthYear();var nbDaysInMonthPrev=this._getMonthDays(a_prevMY[1],a_prevMY[0]);for(var j=0;j<startIndex;j++){a_d[0][j]={d:Number(nbDaysInMonthPrev-startIndex+j+1),m:Number(a_prevMY[0]),y:a_prevMY[1],c:'outbound'};}
var switchNextMonth=false;var currentMonth=this._current_mon;var currentYear=this._current_year;for(var i=1;i<6;i++){for(var j=0;j<7;j++){a_d[i][j]={d:daysIndex,m:currentMonth,y:currentYear,c:(switchNextMonth)?'outbound':(((daysIndex==this._todayDate.getDate())&&(this._current_mon==this._todayDate.getMonth())&&(this._current_year==this._todayDate.getFullYear()))?'today':null)};daysIndex++;if(daysIndex>nbDaysInMonth){daysIndex=1;switchNextMonth=true;if(this._current_mon+1>11){currentMonth=0;currentYear+=1;}else{currentMonth+=1;}}}}
for(var i=0;i<6;i++){var tr=new Element('tr');for(var j=0;j<7;j++){var h_ij=a_d[i][j];var td=new Element('td');var id=$A([this._relative,this._df.date_to_string(h_ij["y"],h_ij["m"]+1,h_ij["d"],'-')]).join('-');td.setAttribute('id',id);if(h_ij["c"])
td.className=h_ij["c"];var _curDate=new Date();_curDate.setFullYear(h_ij["y"],h_ij["m"],h_ij["d"]);if(this._disablePastDate||this._disableFutureDate){if(this._disablePastDate){var _res=(_curDate>=this._todayDate)?true:false;this._bindCellOnClick(td,true,_res,h_ij["c"]);}
if(this._disableFutureDate){var _res=(this._todayDate.getTime()+this._oneDayInMs>_curDate.getTime())?true:false;this._bindCellOnClick(td,true,_res,h_ij["c"]);}}else{this._bindCellOnClick(td,false);}
td.innerHTML=h_ij["d"];tr.appendChild(td);}
tbody.appendChild(tr);}
return tbody;},_bindCellOnClick:function(td,wcompare,compareresult,h_ij_c){var doBind=false;if(wcompare){if(compareresult){doBind=true;}else{td.className=(h_ij_c)?'nclick_outbound':'nclick';}}else{doBind=true;}
if(doBind){var _self=this;td.onclick=function(){$(_self._relative).value=String($(this).readAttribute('id')).replace(_self._relative+'-','').replace(/-/g,_self._df.separator);if(_self._cellCallback)
_self._cellCallback(this);_self.close();};}},_nextMonthYear:function(){var c_mon=this._current_mon;var c_year=this._current_year;if(c_mon+1>11){c_mon=0;c_year+=1;}else{c_mon+=1;}
return[c_mon,c_year];},nextMonth:function(){var a_next=this._nextMonthYear();var _nextMon=a_next[0];var _nextYear=a_next[1];var _curDate=new Date();_curDate.setFullYear(_nextYear,_nextMon,1);var _res=(this._todayDate.getTime()+this._oneDayInMs>_curDate.getTime())?true:false;if(this._disableFutureDate&&!_res)
return;this._current_mon=_nextMon;this._current_year=_nextYear;this._redrawCalendar();},_prevMonthYear:function(){var c_mon=this._current_mon;var c_year=this._current_year;if(c_mon-1<0){c_mon=11;c_year-=1;}else{c_mon-=1;}
return[c_mon,c_year];},prevMonth:function(){var a_prev=this._prevMonthYear();var _prevMon=a_prev[0];var _prevYear=a_prev[1];var _curDate=new Date();_curDate.setFullYear(_prevYear,_prevMon,1);var _res=(_curDate>=this._todayDate)?true:false;if(this._disablePastDate&&!_res)
return;this._current_mon=_prevMon;this._current_year=_prevYear;this._redrawCalendar();},_redrawCalendar:function(){this._setLocaleHdr();this._buildCalendar();},_setLocaleHdr:function(){var a_next=this._nextMonthYear();$(this._id_datepicker_next).setAttribute('title',this.getMonthLocale(a_next[0])+' '+a_next[1]);var a_prev=this._prevMonthYear();$(this._id_datepicker_prev).setAttribute('title',this.getMonthLocale(a_prev[0])+' '+a_prev[1]);$(this._id_datepicker_hdr).update('&nbsp;&nbsp;&nbsp;'+this.getMonthLocale(this._current_mon)+'&nbsp;'+this._current_year+'&nbsp;&nbsp;&nbsp;');}};var pixlr=function(){function windowSize(){var w=0,h=0;if(!(document.documentElement.clientWidth==0)){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight;}
else{w=document.body.clientWidth;h=document.body.clientHeight;}
return{width:w,height:h};}
function extend(settings,options){var mashup={};for(var attribute in settings){mashup[attribute]=settings[attribute];}
for(var attribute in options){mashup[attribute]=options[attribute];}
return mashup;}
function buildUrl(opt){var url='';for(var attribute in opt){if(attribute!='service')url+=((url!='')?"&":"?")+attribute+"="+escape(opt[attribute]);}
return'http://pixlr.com/'+opt.service+'/'+url;}
var bo={ie:window.ActiveXObject,ie6:window.ActiveXObject&&(document.implementation!=null)&&(document.implementation.hasFeature!=null)&&(window.XMLHttpRequest==null),quirks:document.compatMode==='BackCompat'}
return{settings:{'service':'editor'},overlay:{show:function(options){var opt=extend(pixlr.settings,options||{});var iframe=document.createElement('iframe'),div=pixlr.overlay.div=document.createElement('div'),idiv=pixlr.overlay.idiv=document.createElement('div');div.style.background='#696969';div.style.opacity=0.8;div.style.filter='alpha(opacity=80)';if((bo.ie&&bo.quirks)||bo.ie6){var size=windowSize();div.style.position='absolute';div.style.width=size.width+'px';div.style.height=size.height+'px';div.style.setExpression('top',"(t=document.documentElement.scrollTop||document.body.scrollTop)+'px'");div.style.setExpression('left',"(l=document.documentElement.scrollLeft||document.body.scrollLeft)+'px'");}
else{div.style.width='100%';div.style.height='100%';div.style.top='0';div.style.left='0';div.style.position='fixed';}
div.style.zIndex=99998;idiv.style.border='1px solid #2c2c2c';if((bo.ie&&bo.quirks)||bo.ie6){idiv.style.position='absolute';idiv.style.setExpression('top',"25+((t=document.documentElement.scrollTop||document.body.scrollTop))+'px'");idiv.style.setExpression('left',"35+((l=document.documentElement.scrollLeft||document.body.scrollLeft))+'px'");}
else{idiv.style.position='fixed';idiv.style.top='25px';idiv.style.left='35px';}
idiv.style.zIndex=99999;document.body.appendChild(div);document.body.appendChild(idiv);iframe.style.width=(div.offsetWidth-70)+'px';iframe.style.height=(div.offsetHeight-50)+'px';iframe.style.border='1px solid #b1b1b1';iframe.style.backgroundColor='#606060';iframe.style.display='block';iframe.frameBorder=0;iframe.src=buildUrl(opt);idiv.appendChild(iframe);},hide:function(callback){if(pixlr.overlay.idiv&&pixlr.overlay.div){document.body.removeChild(pixlr.overlay.idiv);document.body.removeChild(pixlr.overlay.div);}
if(callback){eval(callback);}}},window:function(options){var opt=extend(pixlr.settings,options||{});if(!window.open(buildUrl(opt),"pixlr","location=0,status=0,scrollbars=0")){alert("The editor window was blocked by your browser, please add pixlr.com to your pop-up blocker.");}},open:function(options){var opt=extend(pixlr.settings,options||{});location.href=buildUrl(opt);}}}();function FloatingWindow(params){if(!params){this.params={};}else{this.params=params;}
if(typeof(this.params.dragable)=='undefined'){this.params.dragable=true;}
if(typeof(this.params.dropShadow)=='undefined'){this.params.dropShadow=true;}
if(typeof(this.params.contentId)=='undefined'){this.params.contentId='floating-frame-content';}
this.frameElem=null;this.titleElem=null;this.dragableObj=null;this.bgOverlayElem=null;var _this=this;this.keyEventCallback=function(e){_this.keyEvent(e,_this)};}
FloatingWindow.prototype.init=function(){if(this.frameElem){return};this.frameElem=new Element('div',{id:(this.params.frameId||'window-border'),className:'floating-frame'});if(this.params.width){this.frameElem.style.width=this.params.width;}
if(this.params.height){this.frameElem.style.height=this.params.height;}
this.IE6=false;if(this.params.dropShadow&&!this.IE6){this.frameElem.appendChild(new Element('div',{className:'drop-shadow'}));}
var contentPane=new Element('div',{className:'floating-frame-content'});if(this.params.title){this.titleElem=new Element('div',{'class':'floating-window-title'}).update(this.params.title);contentPane.appendChild(titleElem);}
contentPane.appendChild(new Element('div',{id:this.params.contentId}).update((this.params.initContent||'')).setStyle({padding:'10px'}));this.frameElem.appendChild(contentPane);if(!this.params.disableClose){var a=this.frameElem.appendChild(new Element('a',{id:'window-close',href:'javascript:;'}));var _this=this;a.onclick=function(){_this.hide();}}}
FloatingWindow.prototype.show=function(params){if(!this.frameElem){this.init();}
if(!params){params={};}
if(params.modal&&!$('background-overlay')){this.bgOverlayElem=new Element('div',{id:'background-overlay',className:'background-overlay'});this.bgOverlayElem.style.height=document.body.getHeight()+'px';document.body.appendChild(this.bgOverlayElem);}
if(params.url&&!$(this.frameElem.id)){this.doAjaxRequest(params);return;}
if(!$(this.frameElem.id)){document.body.appendChild(this.frameElem);}
if(params.indicator){var contentDiv=this.params.dropShadow&&!this.IE6?this.frameElem.down('div',2):this.frameElem.down('div',1);contentDiv.setStyle({padding:'0',width:'170px',height:'52px',border:'2px solid #666666'});contentDiv.insert('<div class="indicator-box-bg"><img style="float:left;" src="http://static.us.expono.com/expono-0.9.6-4585/images/indicator_medium.gif" /><span>'+_("Loading...")+'</span></div>');}else if(params.content){$(this.params.contentId).update(params.content);}
if(params.iframe){var iframe=new Element('iframe',params.iframe);if(params.iframeStyles)iframe.setStyle(params.iframeStyles);$(this.params.contentId).update(iframe);}
if(params.title){if(!this.titleElem){this.titleElem=new Element('div',{className:'floating-window-title'});$(this.params.contentId).parentNode.insertBefore(this.titleElem,$(this.params.contentId));}
this.titleElem.update(params.title);}
if(params.useFadeEffect){Effect.Appear(this.fgElem.id,{duration:1.0});}else{$(this.frameElem.id).show();}
setCenterOfViewport(this.frameElem);if(this.params.dragable&&!this.dragableObj&&!params.modal){this.dragableObj=new Draggable(this.frameElem.id,{});}
if(params.ajaxoptions&&params.ajaxoptions.evalScripts){params.content.evalScripts();}
if(!this.params.disableClose){Event.observe(document,'keydown',this.keyEventCallback);}}
FloatingWindow.prototype.showProgress=function(){if($('window-progress')){return;}
var elem=new Element('div',{id:'window-progress',className:'window-progress'});elem.appendChild(new Element('img',{src:'http://static.us.expono.com/expono-0.9.6-4585/images/indicator_medium.gif',alt:_("loading")}));document.body.appendChild(elem);setCenterOfViewport(elem);elem.show();}
FloatingWindow.prototype.hideProgress=function(){if($('window-progress')){$('window-progress').remove();}}
FloatingWindow.prototype.doAjaxRequest=function(params){this.showProgress();var url=params.url;delete params.url;if(!params.ajaxoptions){params.ajaxoptions={};}
var _this=this;params.ajaxoptions.onSuccess=function(transport){params.content=transport.responseText;_this.hideProgress();_this.show(params);};new Ajax.Request(url,params.ajaxoptions);}
FloatingWindow.prototype.hide=function(){if($('background-overlay')){document.body.removeChild(this.bgOverlayElem);}
document.body.removeChild(this.frameElem);this.frameElem.style.display='none';Event.stopObserving(document,'keydown',this.keyEventCallback);this.frameElem.fire("window:hide");}
FloatingWindow.prototype.keyEvent=function(event,obj){var keyCode=event.which;if(keyCode==Event.KEY_ESC){obj.hide();}}
FloatingWindow.prototype.getMainElement=function(){return this.frameElem;}
var Notification=Class.create({initialize:function(content,options){this.options=options;if(typeof content=='object'){this.content=content;}else{this.content=this.createContent(content);}
this.initElements();this.show();},initElements:function(){this.id="n"+new Date().getTime();this.container=new Element('div',{id:this.id,className:'notify'});if(this.options.containerStyles){this.container.setStyle(containerStyles);}else{this.container.setStyle({display:'none'});}
this.container.insert(new Element('div',{className:'nhead'}).insert(new Element('div',{className:'ncorner'})));this.body=new Element('div',{className:'nbody'});this.contentParent=new Element('div',{className:'ncontent'});if(this.options.image){this.contentParent.insert(image);}else if(this.options.imgURL){this.contentParent.insert(new Element('img',{src:this.options.imgURL}).setStyle({float:'left',width:'60px',height:'60px'}));}
this.contentParent.insert(this.content);this.contentParent.insert(new Element('div').setStyle({clear:'both'}));this.body.insert(new Element('div',{className:'ncorner'}).insert(this.contentParent));this.container.insert(this.body);this.container.insert(new Element('div',{className:'nfoot'}).insert(new Element('div',{className:'ncorner'})));},createContent:function(message){var content=new Element('div').insert(message);content.setStyle({float:'left',padding:'2px',width:this.options.imgURL||this.options.image?'137px':'100%',textAlign:'left',marginTop:'-4px'});return content;},show:function(){if(this.currentTimeout){return;}
var row=new Element('tr').insert(new Element('td').insert(this.container));$('notify-container').down('tbody').insert(row);Effect.Appear(this.id);var finishFunction=function(){$(this.id).up('tr').remove();this.currentTimeout=null;};var timeoutFunction=function(){Effect.Fade(this.id,{afterFinish:finishFunction.bind(this)});};this.currentTimeout=setTimeout(timeoutFunction.bind(this),15000);}});ICE_Autocompleter=Class.create(Autocompleter.Base,{initialize:function(element,update,arrayOrUrl,options){this.baseInitialize(element,update,options);this.options.dataSource=arrayOrUrl;if(Object.isArray(arrayOrUrl))this.options.array=arrayOrUrl;this.originalUpdateElement=this.updateElement;this.updateElement=this.beforeUpdateElement;},beforeUpdateElement:function(selectedElement){this.originalUpdateElement(selectedElement);this.lastEntry=this.element.value;},getUpdatedChoices:function(){this.startIndicator();if(this.ajaxRequestIsRunning)return;if(typeof this.options.array=='undefined'&&Object.isString(this.options.dataSource)){this.ajaxRequestIsRunning=true;this.options.array=this.fetchData(this.options.dataSource,this.options.ajaxOptions);}else{this.updateChoices(this.options.selector(this));}},fetchData:function(url,options){options=Object.extend({onComplete:this.onComplete.bind(this)},options||{});new Ajax.Request(url,options);},onComplete:function(transport){this.ajaxRequestIsRunning=false;this.options.array=transport.responseText.evalJSON(true);this.updateChoices(this.options.selector(this));},setOptions:function(options){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,onNoResultsFound:options.onNoResultsFound||Prototype.emptyFunction,selector:function(instance){var ret=[];var partial=[];var entry=instance.getToken();var count=0;for(var i=0;i<instance.options.array.length&&ret.length<instance.options.choices;i++){var elem=instance.options.array[i].text;if(Object.isArray(instance.options.excludeList)){if(instance.options.excludeList.indexOf(instance.options.array[i].id)>=0)continue;}
var foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase()):elem.indexOf(entry);while(foundPos!=-1){if(foundPos==0&&elem.length!=entry.length){if(Object.isFunction(instance.options.formatItem))
ret.push(instance.options.formatItem(instance.options.array[i],i,foundPos,entry.length));else
ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+
elem.substr(entry.length)+"</li>");break;}else if(foundPos==0&&entry.length==elem.length){if(Object.isFunction(instance.options.formatItem))
ret.push(instance.options.formatItem(instance.options.array[i],i,foundPos,entry.length));else
ret.push("<li><strong>"+elem+"</strong></li>");}else if(entry.length>=instance.options.partialChars&&instance.options.partialSearch&&foundPos!=-1){if(instance.options.fullSearch||/\s/.test(elem.substr(foundPos-1,1))){if(Object.isFunction(instance.options.formatItem))
partial.push(instance.options.formatItem(instance.options.array[i],i,foundPos,entry.length));else
partial.push("<li>"+elem.substr(0,foundPos)+"<strong>"+
elem.substr(foundPos,entry.length)+"</strong>"+elem.substr(foundPos+entry.length)+"</li>");break;}}
foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase(),foundPos+1):elem.indexOf(entry,foundPos+1);}}
if(instance.lastEntry!=entry){instance.lastEntry=entry;if(ret.length==0&&!partial.length)instance.options.onNoResultsFound();}
if(partial.length)
ret=ret.concat(partial.slice(0,instance.options.choices-ret.length))
return"<ul>"+ret.join('')+"</ul>";}},options||{});}});ICELocationHash=Class.create({initialize:function(params){params=params||{};this.autoWrite=params.autoWrite||true;},_getCurrentHash:function(){var str=window.location.hash;if(!str)return{};var params=navigator.userAgent.match(/Safari/)?decodeURI(str).split('&'):str.split('&');var hash={};if(params[0].startsWith('#'))params[0]=params[0].substring(1);for(var i=0;i<params.length;i++){var param=params[i].split('=');hash[param[0]]=param[1];}
return hash;},updateHash:function(){this.locationHash=this._getCurrentHash();},_write:function(){if(!this.locationHash)return;var str='';for(var key in this.locationHash){if(str.blank()){str+=key+'='+this.locationHash[key];}else{str+='&'+key+'='+this.locationHash[key];}}
window.location.hash=str;},get:function(key){if(!this.locationHash)this.updateHash();return this.locationHash[key];},set:function(key,value){if(!this.locationHash)this.updateHash();this.locationHash[key]=value;if(this.autoWrite)this._write();},remove:function(key){delete this.locationHash[key];if(this.autoWrite)this._write();},keys:function(){var keys=[];for(var key in this.locationHash){keys.push(key);}
return keys;}});var CrossFader=Class.create({interval:7,items:[],visibleItem:null,timeoutId:null,initialize:function(){for(var i=0;i<arguments.length;i++){var item={container:$(arguments[i]),image:$(arguments[i]).down('.image')};this.items.push(item);}},start:function(){if(this.items.length<2){return;}
var _this=this;this.timeoutId=setTimeout(function(){_this.crossfade();},1000*this.interval);},stop:function(){clearTimeout(this.timeoutId);},crossfade:function(){if(this.visibleItem==null){this.visibleItem=this.items[0];}
var idx=this.items.indexOf(this.visibleItem)+1;idx=idx>(this.items.length-1)?0:idx;this.hide(this.visibleItem);this.show(this.items[idx]);var _this=this;this.timeoutId=setTimeout(function(){_this.crossfade();},1000*this.interval);},hide:function(item){item.container.style.zIndex=1;Effect.Fade(item.container.id);},show:function(item){item.container.style.zIndex=2;var _this=this;var after=function(){_this.visibleItem=item;};Effect.Appear(item.container.id,{afterFinish:after,duration:1.5});}});var ice={};ice.lang={};ice.photo={};ice.photo.metadata={};ice.local_search={};ice.user={};ice.tagging={};ice.upload={};ice.map={};ice.privacy={};ice.lang.gt=new Gettext({domain:"messages",locale_data:json_locale_data});function _(msgid){return ice.lang.gt.dgettext("messages",msgid);}
function sprintf(s){var bits=s.split('%');var out=bits[0];var re=/^([ds])(.*)$/;for(var i=1;i<bits.length;i++){p=re.exec(bits[i]);if(!p||arguments[i]==null)continue;if(p[1]=='d'){out+=parseInt(arguments[i],10);}else if(p[1]=='s'){out+=arguments[i];}
out+=p[2];}
return out;}
function _s(){arguments[0]=_(arguments[0]);return sprintf.apply(null,arguments);}
function _sp(string,plural_string,cnt){str=ice.lang.gt.ngettext(string,plural_string,cnt);return sprintf(str,cnt);}
ice.month=[_("Jan"),_("Feb"),_("Mar"),_("Apr"),_("May"),_("Jun"),_("Jul"),_("Aug"),_("Sep"),_("Oct"),_("Nov"),_("Dec")];ice.privacyText={0:_("Only You (Private)"),50:_("Custom"),100:_("Everyone (Public)")};ice.privacyIcons={0:'http://static.us.expono.com/expono-0.9.6-4585/images/icons/lock.png',50:'http://static.us.expono.com/expono-0.9.6-4585/images/icons/group_key.png',100:'http://static.us.expono.com/expono-0.9.6-4585/images/icons/world.png'};function SystemMessage(params){var duration=params.duration||3000;var top=document.viewport.getScrollOffsets().top+((document.viewport.getHeight()-80)/2)+'px';var width=(document.viewport.getWidth()-125)+'px';if(!$('sysmsg')){var content=''+'<div class="sysmsg-wrap" id="sysmsg" style="left: 50px; width: '+width+';top: '+top+';">'+'<div class="sysmsg-background"></div>'+'<div id="sysmsg-contents" class="sysmsg-contents">'+
params.message+'</div>'+'</div>';$('content').innerHTML+=content;}else{$('sysmsg-contents').innerHTML=params.message;$('sysmsg').show();}
setTimeout(function(){Effect.Fade($('sysmsg'));},duration);}
function descriptiveFieldFocus(initValue,color,element){if(element.value==initValue){element.value='';element.style.color=color;}}
function descriptiveFieldBlur(initValue,color,element){if(element.value==''){element.value=initValue;element.style.color=color;}}
function setCenterOfViewport(element){var width=element.getWidth();var height=element.getHeight();var left=(document.viewport.getWidth()-width)/2+'px';var top=document.viewport.getScrollOffsets().top+((document.viewport.getHeight()-height))/2+'px';if(parseInt(top)<10)top='10px';element.style.left=left;element.style.top=top;}
function setCenterOfElement(element,parent){var width=element.getWidth();var height=element.getHeight();var parentOffset=parent.viewportOffset();var left=(((parent.getWidth()-width)/2)+parentOffset[0])+'px';var top=(document.viewport.getScrollOffsets().top+parentOffset[1]+((parent.getHeight()-height))/2)+'px';element.style.left=left;element.style.top=top;}
function setCenterInElement(element,parent){var width=element.getWidth();var height=element.getHeight();var left=((parent.getWidth()-width)/2)+'px';var top=((parent.getHeight()-height)/2)+'px';element.style.left=left;element.style.top=top;}
function checkNotifications(){new Ajax.Request('/go/ajax/pro/notifications',{method:'post',parameters:{action:'get'},onSuccess:function(transport){if(isNaN(transport.responseText)){eval(transport.responseText);}else{}}});setTimeout(checkNotifications,15000);}
function notify(message,imgUrl){new Notification(message,{imgURL:imgUrl});}
function highlight(element){$(element).setStyle({backgroundColor:'#99CCFF'});}
function unhighlight(element){$(element).setStyle({backgroundColor:'transparent'});}
function highlightEffect(element){new Effect.Highlight(element,{delay:.1,duration:3,startColor:'#fff',endColor:'#f00'});}
function loading(msg,image,divStyle){if(Object.isUndefined(msg)){msg='Loading...';}
if(!image){image='indicator.gif';}
var img=new Element('img',{src:'http://static.us.expono.com/expono-0.9.6-4585/images/'+image});if(msg.length>0){var elem=new Element('div').setStyle(divStyle||{padding:'10px'});img.setStyle({float:'left'})
return elem.insert(img).insert('&nbsp;'+msg);}else{return img;}}
function hoverElement(obj,event,element,options){options=options||{};var container=new Element('div',{className:'hover-container'}).setStyle({position:'absolute',zIndex:'99999'});container.insert(new Element('div',{className:'drop-shadow'}).setStyle({top:'2px',left:'2px',zIndex:'-1'}));container.insert(element);container.clonePosition(obj,{setWidth:false,setHeight:false,offsetTop:obj.getDimensions().height+5});obj.currentTimeout=setTimeout(function(){document.body.insert(container);obj.currentTimeout=false;if(options.onVisible){options.onVisible();}},200);if(obj.hoverElementMouseMove){obj.stopObserving('mousemove',obj.hoverElementMouseMove);}
obj.hoverElementMouseMove=function(event){container.setStyle({left:(event.pointerX()+10)+'px',top:(event.pointerY()+10)+'px'});};obj.observe('mousemove',obj.hoverElementMouseMove);if(obj.hoverElementMouseOut){obj.stopObserving('mouseout',obj.hoverElementMouseOut);}
obj.hoverElementMouseOut=function(obj,container){if(obj.currentTimeout){clearTimeout(obj.currentTimeout);return;}
container.remove();}.bind(this,obj,container);obj.observe('mouseout',obj.hoverElementMouseOut);}
function hoverImage(obj,event,path){var element=new Element('img',{src:path}).setStyle({border:'1px solid black'});hoverElement(obj,event,element);}
function elementCounter(elementType){var html=document.body.innerHTML;var re=new RegExp('(<'+elementType+')','ig');var matches;var startCounter=0;while((matches=re.exec(html))!=null){startCounter++;}
matches=null;var re=new RegExp('(</'+elementType+'>)','ig');var endCounter=0;while((matches=re.exec(html))!=null){endCounter++;}
var result='Found '+startCounter+' opening <'+elementType+'> and '+endCounter+' closing </'+elementType+'>';if(console&&console.log){console.log(result);}else{alert(result);}}
function submitPost(url,parameters){var id='post-form_'+new Date().getTime();params=parameters.split('&');var fields='';for(var i=0;i<params.length;i++){var keyValue=params[i].split('=');fields+='<input type="hidden" name="'+keyValue[0]+'" value="'+keyValue[1]+'" />';}
document.body.down().insert({before:'<form id="'+id+'" action="'+url+'" method="post">'+fields+'</form>'});;$(id).submit();}
function toggleTopMenu(id,event){if(!id){var elem=event?event.target:window.event.srcElement;var parent=elem.parentNode;while(parent!=document){if(parent==$('navigator')){return;}
parent=parent.parentNode;}}
if(id){Effect.toggle(id,'appear',{duration:0.1});}
$$('.nav-menu').each(function(s,index){if(s.id!=id&&s.visible()){Effect.toggle(s.id,'appear',{duration:0.5});}});return false;}
function createDatePicker(relative,externalControl,callBack){if(window.usr_lang){var short_lang=window.usr_lang.substring(0,2);if(short_lang=='nb')short_lang='no';if(short_lang=='es')short_lang='sp';}else{var short_lang='en';}
return new DatePicker({relative:relative,language:short_lang,keepFieldEmpty:true,enableShowEffect:false,enableCloseEffect:false,dateFormat:[["yyyy","mm","dd"],"-"],externalControl:externalControl,cellCallback:callBack});}
function privacyChange(img,val){var path='http://static.us.expono.com/expono-0.9.6-4585/images/icons/';if(val==0){$(img).src=path+'lock.png';}else if(val==90){$(img).src=path+'expono.png';}else if(val==100){$(img).src=path+'world.png';}else{$(img).src=path+'group_key.png';}}
function pageNavigator(callback,page,elementCount,maxDisplayed,summary,showCountIfNoPaging){var lastPage=Math.ceil((elementCount/maxDisplayed));var content=new Element('div',{id:'page-navigator'});if(elementCount>maxDisplayed){var ul=new Element('ul',{className:'page-nav-menu'});var startPage=0;if(page>=4){ul.insert(navigatorElement(page,1,callback));ul.insert(new Element('li').setStyle({width:'30px',textAlign:'center'}).update(' ... '));startPage=page-3;}
ul.insert(navigatorElement(page,startPage+1,callback));ul.insert(navigatorElement(page,startPage+2,callback));if(elementCount>(maxDisplayed*2)){ul.insert(navigatorElement(page,startPage+3,callback));}
if(elementCount>(maxDisplayed*2)&&page>1&&lastPage>3){var modifier=page==2?2:1;if(page<=(lastPage-1)||page<4){ul.insert(navigatorElement(page,page+modifier,callback));}}
if(elementCount>(maxDisplayed*2)&&page>2&&lastPage>4){if(page<=(lastPage-2)||page<4){ul.insert(navigatorElement(page,page+2,callback));}}
if(elementCount>(maxDisplayed*3)&&(page!=3||lastPage!=5)){if(page<=(lastPage-4)||page<4){ul.insert(new Element('li').setStyle({width:'30px',textAlign:'center'}).update(' ... '));}
if(page<=(lastPage-3)||page<4){ul.insert(navigatorElement(page,lastPage,callback));}}
content.insert(new Element('div',{id:'page-nav'}).setStyle({float:'right',margin:'0px 10px'}).insert(ul));content.insert(new Element('div',{className:'clear'}));if(!Object.isUndefined(summary)){var from=((page-1)*maxDisplayed)+1;var to=((maxDisplayed*page)>elementCount)?elementCount:(maxDisplayed*page);summary=summary.replace('%d',from);summary=summary.replace('%d',to);summary=summary.replace('%d',elementCount);content.insert(new Element('p',{className:'page-nav-summary'}).update(summary));}}else if(showCountIfNoPaging){var count_str=_sp("%d photo","%d photos",elementCount);content.insert(new Element('p',{className:'page-nav-count'}).update(count_str));}
return content;}
function navigatorElement(currentPage,toPage,callback){var a=new Element('a',{href:'javascript:;',className:(currentPage==toPage?'page-nav-active':'')}).update(toPage);Event.observe(a,'click',function(){callback(toPage);});return new Element('li').insert(a);}
function getLocationHash(){if(window.location.hash&&window.location.hash.length>1){return window.location.hash.substring(1).toQueryParams();}
return{};}
function showChangeLog(){if(!ice.changeLogWindow){ice.changeLogWindow=new FloatingWindow({dropShadow:true});}
ice.changeLogWindow.show({url:'/go/changelog',modal:true});}
function showWelcome(){if(!ice.welcomeWindow){ice.welcomeWindow=new FloatingWindow({dropShadow:true});}
ice.welcomeWindow.show({url:'/go/welcome',modal:true});}
function showShareCode(code,name){var content='<div style="width:550px;">'+'<div class="black-header">'+_("Personal shared url for")+' '+name+'</div><br/>'+'<div align="center">'+'<textarea style="width:530px;">'+code+'</textarea>'+'<br/><a href="javascript:;" onclick="ice.shareCodeWindow.hide();">'+_("Close")+'</a>'+'</div>'+'</div>';ice.shareCodeWindow=new FloatingWindow({initContent:content,dropShadow:true});ice.shareCodeWindow.show({modal:true});}
function showServiceSuggestion(service){if(!ice.welcomeWindow){if(!ice.serviceWindow){ice.serviceWindow=new FloatingWindow({initContent:service,dropShadow:true});}
ice.serviceWindow.show({modal:true});}}
function toggleImage(imgobj,imgsrc1,imgsrc2){if($(imgobj).readAttribute('src')==imgsrc1){$(imgobj).src=imgsrc2;}else{$(imgobj).src=imgsrc1;}}
function humanFileSize(size){if(!size){return;}
var kb=size/1000;if(kb>1000){return Math.round((kb/1000))+' Mb';}
return Math.round(kb)+' Kb';}
function humanTime(time){if(!time){return;}
var seconds=time/1000;if(seconds<60){return'< 1'+_("min");}
var minutes=seconds/60;if(minutes<60){return Math.ceil(minutes)+_("min");}
var hours=minutes/60;minutes=minutes%60;return parseInt(hours)+_("h ")+parseInt(minutes)+_("min");}
function truncString(value,maxSize,appendValue){if(!value)return;if(value.length<=maxSize){return value;}
if(appendValue){return value.substring(0,maxSize)+appendValue;}
return value.substring(0,maxSize)+'...';}
function isValidTime(strTime){var regexp=new RegExp("^(\\d{2}):(\\d{2}):(\\d{2})$");matches=regexp.exec(strTime);if(!matches){return false;}
if(matches[1]<0||matches[1]>23)return false;if(matches[2]<0||matches[2]>59)return false;if(matches[3]<0||matches[3]>59)return false;return true;}
function isValidDate(strDate){var regexp=new RegExp("^(\\d{2})/(\\d{2})/(\\d{4})$");matches=regexp.exec(strDate);if(!matches){return false;}
var testDate=new Date(matches[3],matches[1]-1,matches[2]);if(matches[2]!=testDate.getDate())return false;if((matches[1]-1)!=testDate.getMonth())return false;if(matches[3]!=testDate.getFullYear())return false;return true;}
function initToolTips(){$$('a[title]').each(function(element){new Tip(element,element.title,{stem:'topLeft',radius:3,hook:{tip:'topLeft',mouse:true}});});}
function hideMessage(id){new Effect.Fade(id,{'duration':1.5});}
function forwardSystemAnnouncement(){new Ajax.Request('/go/ajax/pro/forward_announcement',{method:'post'});}
function hideActivity(id,el){if(id!=null&&id!='undefined'){new Ajax.Request('/go/ajax/pro/hide_activity',{onCreate:function(){el.update('<img src="http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif" />');},onSuccess:function(transport){if(transport.responseText=='1'){new Effect.Fade($('act_'+id),{'duration':1.5});}else{el.update(_("Hide"));alert(_("Activity could not be hidden at this moment! Please try again soon..."));}},asynchronous:true,evalScripts:true,parameters:{'id':id}});}}
ice.showPasswordDialog=function(userId,page){if(!ice.passwordDialog){ice.passwordDialog=new FloatingWindow({dropShadow:true});}
ice.passwordDialog.show({url:'/go/password',modal:true,ajaxoptions:{method:'post',parameters:{user_id:userId,page:page}}});}
ice.switchTab=function(parent,selected,newContent){$(parent).select('li').each(function(elem){elem.down('a').removeClassName('active');});$(selected).addClassName('active');$$('.tab-content').each(function(elem){elem.hide();});$(newContent).show();}
ice.addIdentityRow=function(targetId,identityId,name,email,imgSrc,removeFunction){var newLi=new Element('li',{id:'identity_'+identityId,className:'contact-autocomplete'}).setStyle({marginBottom:'2px'});var imgElem=new Element('img',{src:imgSrc});newLi.insert(imgElem);newLi.insert(new Element('div').setStyle({padding:'0 0 0 5px',float:'left'}).insert(new Element('span',{className:'name'}).update(name)).insert(new Element('span',{className:'email'}).update(email)));var removeLink=new Element('a',{href:'javascript:;'});newLi.insert(new Element('div').setStyle({margin:'7px 0 0 5px',float:'right'}).insert(removeLink.insert(new Element('img',{src:'http://static.us.expono.com/expono-0.9.6-4585/images/icons/mini_icons/trash.gif'}).setStyle({width:'10px',height:'10px'}))));if(Object.isFunction(removeFunction)){removeLink.observe('click',function(evt){removeFunction(removeLink);});}
newLi.insert('<div class="clear"></div>');$(targetId).insert(newLi);}
ice.sendInvitation=function(){var indicator=new Element('img',{id:('sending_invitation'),src:'http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif',alt:'processing'});$('btn-send-invitation').insert({before:indicator});$('btn-send-invitation').hide();var params=Form.serialize($('form_invite'));new Ajax.Request('/go/ajax/pro/send_invitation',{method:'post',parameters:params,onSuccess:function(transport){if(transport.responseText=='1'){$('sending_invitation').remove();$('invited_friends').insert({top:$('invite_email').value+' [invitation sent]<br/>'});$('invited_friends_count').update(parseInt($('invited_friends_count').innerHTML)+1);$('invited_friends_left').update(parseInt($('invited_friends_left').innerHTML)-1);$('invite_email').value='';$('btn-send-invitation').show();$('friends_invited').highlight();}else if(transport.responseText=='2'){$('sending_invitation').remove();$('invited_friends').insert({top:$('invite_email').value+' [pending request]<br/>'});$('invite_email').value='';$('btn-send-invitation').show();alert(_("User is already on Expono. A connection request was sent on your behalf."));}else if(transport.responseText=='3'){$('sending_invitation').remove();$('btn-send-invitation').show();alert(_("The email(s) provided is not valid. Please check your spelling and try again."));}else{$('sending_invitation').remove();$('btn-send-invitation').show();alert(_("Sorry, we could not send your invitation at this time. Please, try again later."));}}});return false;}
ice.queryStringToHash=function(query){var hash={};var params=query.split('&');for(var i=0;i<params.length;i++){var param=params[i].split('=');hash[param[0]]=param[1];}
return hash;}
ice.primaryEmail=function(email){$('action').value='primary';$('primary_email').value=email;$('email_manager').submit();}
ice.confirmEmail=function(email){$('action').value='confirm';$('confirm_email').value=email;$('email_manager').submit();}
ice.deleteEmail=function(email){$('action').value='delete';$('delete_email').value=email;$('email_manager').submit();}
ice.addEmail=function(){$('action').value='add';$('email_manager').submit();}
ice.sendVerificationEmail=function(){new Ajax.Request('/go/ajax/pro/send_verification_email',{onSuccess:function(transport){if(transport.responseText=='1'){alert(_("A verification email will be sent to your email address within a few minutes. If you cannot find the email please check your Spam-filter."));}else{alert(_("Verification email could not be sent at this moment! Please try again soon..."));}},asynchronous:true,evalScripts:true});return false;}
function hideUserNotification(type,key){new Ajax.Request('/go/ajax/pro/hide_notification',{parameters:{key:key,type:type}});}
ice.mail={};ice.mail.composeMessage=function(){$('messages').hide();$('reply-message').hide();$('compose-form').show();$('message-pane-title').innerHTML='<h2>'+_("Compose")+'</h2>';$('compose_to_text').hide();$('compose_to_list').show();var hash=getLocationHash();if(hash.attachment){var attachments=$('attachments');for(var i=0;i<attachments.options.length;i++){if(attachments.options[i].value==hash.attachment){attachments.options[i].selected=true;break;}}}else if(!ice.photo.hasPhotosInStack()){$('attachment-row').hide();}
if(hash.to){$('compose_to').value=hash.to;}}
ice.mail.replyToMessage=function(message_id,inline,photo_id){$('messages').hide();$('reply_subject').innerHTML=$('message_subject_'+message_id).innerHTML;$('reply_message').innerHTML=$('message_message_'+message_id).innerHTML;$('reply_date').innerHTML=$('message_created_'+message_id).innerHTML;$('reply_to_photo').src=$('message_from_photo_'+message_id).src;$('is_reply').value=1;$('compose_to_text').innerHTML=$('message_from_'+message_id).innerHTML;$('compose_to_text').show();$('compose_to_list').hide();$('compose_to').value=$('message_from_user_id_'+message_id).value;$('compose_subject').value='RE: '+$('message_subject_'+message_id).innerHTML;$('message-text').value='';$('reply-message').show();if(photo_id>0){$('comment-row').show();$('reply_as_comment').value=photo_id;}
if(inline){inlinestr=$('reply_message').innerHTML;inlinestr=inlinestr.replace(/<br>([^\n])/gi,'\n$1');inlinestr=inlinestr.replace(/<br>/gi,'');inlinestr=inlinestr.replace(/&gt;/gi,'>');$('message-text').value='\n\n'+$('compose_to_text').innerHTML+' wrote:\n>'+inlinestr.replace(/\n/g,'\n>');}
$('compose-form').show();$('message-pane-title').innerHTML='<h2>'+_("Reply")+'</h2>';$('message-text').focus();if($('message-text').setSelectionRange){$('message-text').setSelectionRange(0,0);}}
ice.mail.cancelComposeMessage=function(){$('compose-form').hide();$('message-pane-title').innerHTML='<h2>'+_("Inbox")+'</h2>';window.location.hash='';}
ice.mail.readMessage=function(ev,message_id){if(ev){var evElem=(window['ActiveXObject'])?event.srcElement:ev.target;if(evElem.nodeName=='INPUT')return false;}
if($('message_header_'+message_id).hasClassName('messsage-header-deleted')==''){Effect.toggle('message_body_'+message_id,'slide',{duration:0.3});$('message_header_'+message_id).toggleClassName('messsage-header-read');$('message_subject_'+message_id).toggleClassName('messsage-subject-read');new Ajax.Request('/go/ajax/pro/read_message',{method:'get',parameters:{id:message_id}});hash=new ICELocationHash();hash.set('action','read');hash.set('message',message_id);}}
ice.mail.deleteMessage=function(message_id){$('message_body_'+message_id).fade({duration:1.0});$('chkbox_'+message_id).hide();$('message_header_'+message_id).toggleClassName('messsage-header-deleted');new Ajax.Request('/go/ajax/pro/delete_message',{method:'get',parameters:{id:message_id}});}
ice.mail.deleteSentMessage=function(message_id){$('message_body_'+message_id).fade({duration:1.0});$('message_header_'+message_id).toggleClassName('messsage-header-deleted');new Ajax.Request('/go/ajax/pro/delete_sent_message',{method:'get',parameters:{id:message_id}});}
ice.mail.getMessages=function(type,element,callback){element=element||$('inbox-pane').down();$('compose-form').hide();$('reply-message').hide();$('indicator-box').show();$('message-pane-title').innerHTML='<h2>'+_(type)+'</h2>';$('inbox-pane').select('li').each(function(e){e.removeClassName('inbox-folder-active');});element.addClassName('inbox-folder-active');new Ajax.Updater('messages','/go/ajax/pro/get_messages',{method:'post',onSuccess:function(transport){$('indicator-box').hide();$('messages').show();if(Object.isFunction(callback))setTimeout(callback,500);},parameters:{folder:type}});return false;}
ice.mail.checkMessages=function(){new Ajax.PeriodicalUpdater('inbox-indicator','/go/ajax/pro/check_messages',{method:'get',onCreate:function(){$('inbox-icon').src='http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif';},onFailure:function(){$('inbox-icon').src='http://static.us.expono.com/expono-0.9.6-4585/images/icons/email_delete.gif';},frequency:30,decay:2});}
ice.mail.checkAll=function(obj){if(obj.checked){$$('.checkbox_action').each(function(e){e.checked=true;$('message_header_'+e.value).toggleClassName('messsage-header-selected');});}else{$$('.checkbox_action').each(function(e){e.checked=false;$('message_header_'+e.value).toggleClassName('messsage-header-selected');});}}
ice.mail.actions={'compose':ice.mail.composeMessage,'read':function(){ice.mail.getMessages('Inbox',undefined,function(){var hash=getLocationHash();if(hash.message)ice.mail.readMessage(undefined,hash.message);});}};ice.connections={};ice.connections.loadConnectionRequest=function(connection_user_id,container,type,parent_container){if(!ice.connections.connectionRequestWindow){ice.connections.connectionRequestWindow=new FloatingWindow({dropShadow:true});}
ice.connections.connectionRequestWindow.show({url:'/go/ajax/pro/load_connection_request',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{'connection_user_id':connection_user_id,'container':container,'type':type,'parent_container':parent_container}}});}
ice.connections.createConnectionRequest=function(){var params=Form.serialize($('connection_request_form'));new Ajax.Updater($('container').value,'/go/ajax/pro/create_connection_request',{onLoading:function(){ice.connections.connectionRequestWindow.showProgress();},onComplete:function(){ice.connections.connectionRequestWindow.hideProgress();highlightEffect(container);},asynchronous:true,evalScripts:true,postBody:params});}
ice.connections.withdrawConnectionRequest=function(connection_user_id,container,type,parent_container){if(confirm(_("Do you really want to stop following this user?"))){new Ajax.Updater(container,'/go/ajax/pro/withdraw_connection_request',{onLoading:function(){},onComplete:function(){ice.connections.connectionRequestWindow.hide();highlightEffect(container);},asynchronous:true,evalScripts:true,parameters:{'connection_user_id':connection_user_id,'container':container,'type':type,'parent_container':parent_container}});}}
ice.connections.removeConnectionRequest=function(connection_user_id,container,type,parent_container){if(confirm(_("Do you really want to remove this connection?"))){new Ajax.Updater(container,'/go/ajax/pro/remove_connection_request',{onLoading:function(){},onComplete:function(){ice.connections.connectionRequestWindow.hide();highlightEffect(container);},asynchronous:true,evalScripts:true,parameters:{'connection_user_id':connection_user_id,'container':container,'type':type,'parent_container':parent_container}});}}
ice.connections.updateConnectionAction=function(connection_user_id,container,type,parent_container){new Ajax.Updater(container,'/go/ajax/pro/update_connection_action',{onLoading:function(){},onComplete:function(){highlightEffect(container);},asynchronous:true,evalScripts:true,parameters:{'connection_user_id':connection_user_id,'container':container,'type':type,'parent_container':parent_container}});}
ice.connections.updateConnectionFriendFlag=function(connection_user_id,flag){try{var flag_value=0;if(flag.checked==true){flag_value=1;}
var indicator=new Element('img',{id:('processing_'+connection_user_id),src:'http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif',alt:_("processing")});flag.insert({before:indicator});flag.hide();new Ajax.Request('/go/ajax/pro/update_connection_flags',{onLoading:function(){},onSuccess:function(transport){$('processing_'+connection_user_id).remove();flag.show();if(transport.responseText!='1'){if(flag_value==1){flag.checked=false;}else{flag.checked=true;}
alert(_("Sorry, but we could not update your connection type at this time. Please, try again later."))}},asynchronous:true,evalScripts:true,parameters:{'connection_user_id':connection_user_id,'is_friend':flag_value}});}catch(e){}}
ice.connections.updateConnectionFamilyFlag=function(connection_user_id,flag){try{var flag_value=0;if(flag.checked==true){flag_value=1;}
var indicator=new Element('img',{id:('processing_'+connection_user_id),src:'http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif',alt:_("processing")});flag.insert({before:indicator});flag.hide();new Ajax.Request('/go/ajax/pro/update_connection_flags',{onLoading:function(){},onSuccess:function(transport){$('processing_'+connection_user_id).remove();flag.show();if(transport.responseText!='1'){if(flag_value==1){flag.checked=false;}else{flag.checked=true;}
alert(_("Sorry, but we could not update your connection type at this time. Please, try again later."))}},asynchronous:true,evalScripts:true,parameters:{'connection_user_id':connection_user_id,'is_family':flag_value}});}catch(e){}}
ice.connections.updateConnectionBusinessFlag=function(connection_user_id,flag){try{var flag_value=0;if(flag.checked==true){flag_value=1;}
var indicator=new Element('img',{id:('processing_'+connection_user_id),src:'http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif',alt:_("processing")});flag.insert({before:indicator});flag.hide();new Ajax.Request('/go/ajax/pro/update_connection_flags',{onLoading:function(){},onSuccess:function(transport){$('processing_'+connection_user_id).remove();flag.show();if(transport.responseText!='1'){if(flag_value==1){flag.checked=false;}else{flag.checked=true;}
alert(_("Sorry, but we could not update your connection type at this time. Please, try again later."))}},asynchronous:true,evalScripts:true,parameters:{'connection_user_id':connection_user_id,'is_business':flag_value}});}catch(e){}}
ice.connections.updateConnectionVisibilityFlag=function(connection_user_id,flag){try{var flag_value=0;if(flag.checked==true){flag_value=1;}
var indicator=new Element('img',{id:('processing_'+connection_user_id),src:'http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif',alt:_("processing")});flag.insert({before:indicator});flag.hide();new Ajax.Request('/go/ajax/pro/update_connection_flags',{onLoading:function(){},onSuccess:function(transport){$('processing_'+connection_user_id).remove();flag.show();if(transport.responseText!='1'){if(flag_value==1){flag.checked=false;}else{flag.checked=true;}
alert(_("Sorry, but we could not update your connection visibility at this time. Please, try again later."))}},asynchronous:true,evalScripts:true,parameters:{'connection_user_id':connection_user_id,'visibility':flag_value}});}catch(e){}}
ice.connections.updateConnectionVisibility=function(connection_user_id,flag){try{new Ajax.Request('/go/ajax/pro/update_connection_flags',{onLoading:function(){},onSuccess:function(transport){if(transport.responseText!='1'){alert(_("Sorry, but we could not update your connection visibility at this time. Please, try again later."))}},asynchronous:true,evalScripts:true,parameters:{'connection_user_id':connection_user_id,'visibility':flag}});}catch(e){}}
ice.connections.excludeFoaf=function(foaf_id,elem_id){try{new Ajax.Request('/go/ajax/pro/exclude_foaf',{onLoading:function(){},onSuccess:function(transport){if(transport.responseText!='1'){alert(_("Sorry, but we could not exclude this user from the list at this time. Please, try again later."))}else{Effect.Fade(elem_id,{duration:1.5});}},asynchronous:true,evalScripts:true,parameters:{'foaf_id':foaf_id}});}catch(e){}}
ice.connections.viewMutualConnections=function(connection_id){if(!ice.connections.connectionsWindow){ice.connections.connectionsWindow=new FloatingWindow({dropShadow:true});}
ice.connections.connectionsWindow.show({url:'/go/ajax/pro/view_mutual_connections',modal:true,ajaxoptions:{method:'get',evalScripts:true,parameters:{'connection_id':connection_id}}});}
ice.connections.editConnection=function(cid){if(!ice.connections.editWindow){ice.connections.editWindow=new FloatingWindow({dropShadow:true});}
ice.connections.editWindow.show({url:'/go/ajax/pro/edit_connection',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{'cid':cid,'action':'edit'}}});}
ice.contacts={};ice.contacts.toggleExponoContacts=function(){var elements=$$('table.imported_contact');elements.invoke('toggle');var input_elements=$$('.imported_contact input.contact_checkbox');input_elements.each(function(s){s.checked=false;});}
ice.contacts.checkSelectContacts=function(){var selector='input.contact_checkbox';if($('show_expono').checked==true){selector='.expono_contact input.contact_checkbox';}
var elements=$$(selector);elements.each(function(s){s.checked=true;});}
ice.contacts.uncheckSelectContacts=function(){var selector='input.contact_checkbox';if($('show_expono').checked==true){selector='.expono_contact input.contact_checkbox';}
var elements=$$(selector);elements.each(function(s){s.checked=false;});}
ice.contacts.checkExponoContacts=function(){var selector='input.contact_checkbox';var elements=$$(selector);elements.each(function(s){s.checked=true;});}
ice.contacts.uncheckExponoContacts=function(){var selector='input.contact_checkbox';var elements=$$(selector);elements.each(function(s){s.checked=false;});}
ice.contacts.saveContacts=function(formsubmit,container,url){var contacts_count=0;var input_elements=$$('input.contact_checkbox');input_elements.each(function(s){if(s.checked==true){contacts_count=contacts_count+1;}});if(contacts_count>0){if($('submit-type').value=='submit'){$('connect_contacts_frm').submit();}else{var params=Form.serialize($('connect_contacts_frm'));if(!url)url='/go/ajax/pro/friendfinder';if(!container)container=$('friendfinder-container');new Ajax.Updater(container,url,{onLoading:function(){},onComplete:function(){highlightEffect(container);},asynchronous:true,evalScripts:true,postBody:params});}}else{alert(_("You must choose at least one contact before connecting!"));}}
ice.contacts.getFriendFinder=function(){new Ajax.Updater($('friendfinder-container'),'/go/ajax/pro/friendfinder',{onLoading:function(){},onComplete:function(){},asynchronous:true,evalScripts:true,parameters:{'dashboard':''}});}
ice.contacts.addContact=function(message,fullname,email,groups){if(!ice.contacts.addWindow){ice.contacts.addWindow=new FloatingWindow({dropShadow:true});}
ice.contacts.addWindow.show({url:'/go/ajax/pro/add_contact',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{'action':'add','message':message,'fullname':fullname,'email':email,'groups':groups}}});}
ice.contacts.editContact=function(iid){if(!ice.contacts.editWindow){ice.contacts.editWindow=new FloatingWindow({dropShadow:true});}
ice.contacts.editWindow.show({url:'/go/ajax/pro/edit_contact',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{'iid':iid,'action':'edit'}}});}
ice.contacts.deleteContact=function(iid){if(!ice.contacts.deleteWindow){ice.contacts.deleteWindow=new FloatingWindow({dropShadow:true});}
ice.contacts.deleteWindow.show({url:'/go/ajax/pro/delete_contact',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{'iid':iid,'action':'delete'}}});}
ice.contacts.realAddContact=function(){var params=Form.serialize($('add_contact_frm'));new Ajax.Request('/go/ajax/pro/add_contact',{method:'post',onSuccess:function(transport){$('addressbook_elements_container').insert({top:transport.responseText});},evalScripts:true,parameters:params});}
ice.contacts.saveContact=function(iid){var params=Form.serialize($('edit_contact_frm'));new Ajax.Updater($('parent_conn_'+iid),'/go/ajax/pro/edit_contact',{onLoading:function(){},onComplete:function(){highlightEffect($('parent_conn_'+iid));},asynchronous:true,evalScripts:true,postBody:params});}
ice.contacts.realDeleteContact=function(iid){var params=Form.serialize($('delete_contact_frm'));new Ajax.Updater($('parent_conn_'+iid),'/go/ajax/pro/delete_contact',{onLoading:function(){},onComplete:function(){},asynchronous:true,evalScripts:true,postBody:params});}
ice.contacts.realMergeContact=function(iid,mid){var params=Form.serialize($('merge_contact_frm'));new Ajax.Updater($('parent_conn_'+iid),'/go/ajax/pro/merge_contact',{onLoading:function(){},onComplete:function(){},asynchronous:true,evalScripts:true,postBody:params});}
ice.contacts.mergeContact=function(iid,mid){if(!ice.contacts.mergeWindow){ice.contacts.mergeWindow=new FloatingWindow({dropShadow:true});}
ice.contacts.mergeWindow.show({url:'/go/ajax/pro/merge_contact',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{'iid':iid,'mid':mid,'action':'merge'}}});}
ice.contacts.realDeleteGroup=function(groupId){if(!ice.contacts.realDeleteWindow){ice.contacts.realDeleteWindow=new FloatingWindow({dropShadow:true});}
ice.contacts.realDeleteWindow.show({url:'/go/ajax/pro/delete_group',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{gid:groupId,action:'real_delete'}}});}
ice.contacts.deleteGroup=function(groupId){if(!ice.contacts.deleteWindow){ice.contacts.deleteWindow=new FloatingWindow({dropShadow:true});}
ice.contacts.deleteWindow.show({url:'/go/ajax/pro/delete_group',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{gid:groupId,action:'delete'}}});}
ice.contacts.editIdentityGroups=function(identityId){if(!ice.contacts.editIdentityGroupsWindow){ice.contacts.editIdentityGroupsWindow=new FloatingWindow({dropShadow:true});}
ice.contacts.editIdentityGroupsWindow.show({url:'/go/ajax/pro/contacts',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{identity_id:identityId,action:'add_identity_to_group_html'}}});}
ice.contacts.addIdentityToGroups=function(identityId,groups,mCookie){var groupIds=[];groups.each(function(e){groupIds.push(e.group_id);});var params={action:'add_identity_to_group',identity_id:identityId,group_ids:groupIds.toJSON(),magic_cookie:mCookie};new Ajax.Request('/go/ajax/pro/contacts',{parameters:params,onSuccess:function(transport){if(transport.responseText=='1'){ice.contacts.editIdentityGroupsWindow.hide();document.body.fire('groups:update',{identity_id:identityId,groups:groups});}else{indicator.remove();$('add-group-feedback').addClassName('alert');$('add-group-feedback').update(_("Unkown error while creating group, please try again later"));}}});}
ice.contacts.renameGroup=function(element,magic_cookie){var group_name=$F('edit_'+element);var group_id=element.split('_')[1];new Ajax.Request('/go/ajax/pro/rename_group',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){$(element).innerHTML=$F('edit_'+element).escapeHTML();}else{if(transport.responseText=='-2'){ice.contacts.cancelEdit(element);alert(_("You are not allowed to edit this group name."));}else{ice.contacts.cancelEdit(element);alert(_("Could not rename group at this time."));}}},parameters:{group_id:group_id,group_name:group_name,magic_cookie:magic_cookie}});return false;}
ice.contacts.editGroupName=function(element,magic_cookie){var content;if($('form_'+element))return true;ice.contacts.unhighlight(element);content=$(element).innerHTML;$(element).innerHTML='<form id="form_'+element+'" method="post"><input type="hidden" id="orig_'+element+'" name="orig_'+element+'" value="'+content+'"><input type="text" id="edit_'+element+'" autocomplete="off" style="width:50%;" name="edit_'+element+'" value="'+content+'"><br><input type="submit" name="save_'+element+'" value="'+_("SAVE")+'" onclick="ice.contacts.renameGroup(\''+element+'\',\''+magic_cookie+'\'); return false;"> or <input type="button" name="cancel_'+element+'" value="'+_("CANCEL")+'" onclick="ice.contacts.cancelEdit(\''+element+'\'); return false;"></form>';$('edit_'+element).focus();$('edit_'+element).select();}
ice.contacts.cancelEdit=function(element){var title;title=$('orig_'+element).value;setTimeout(function(){$(element).innerHTML=title;},1);}
ice.contacts.highlight=function(element){highlight(element);}
ice.contacts.unhighlight=function(element){unhighlight(element);}
ice.contacts.showIdentityAclDetailsTip=function(elem,identityId){if(!elem||!elem.visible())return;new Tip(elem,{radius:2,hook:{mouse:true,tip:'topLeft'},stem:'topLeft',offset:{x:3,y:12},ajax:{url:'/go/ajax/pro/acl',options:{parameters:{action:'get_identity_acl_details',identity_id:identityId}}}});}
ice.album={};ice.album.albumAcl={};ice.album.defaultAlbumPrivacy=0;ice.album.deleteAlbum=function(album_id,magic_cookie,username){if(confirm(_("Are you sure you want to delete this album?\n\nNOTE: Deleting an album will NOT delete the photos. The photos will remain in your Photo Library until deleted."))){var indicator=new Element('img',{id:('processing_'+album_id),src:'http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif',alt:_("processing")});$('btn-delete_'+album_id).insert({before:indicator});$('btn-delete_'+album_id).hide();new Ajax.Request('/go/ajax/pro/album_organizer',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){window.location.href='/'+username+'/albums';}else{$('btn-delete_'+photo_id).show();$('processing_'+photo_id).remove();alert(_("Could not delete your album at this time."));}},parameters:{action:'delete',album_id:album_id,magic_cookie:magic_cookie}});}
return false;}
ice.album.highlight=function(element){if($('title-form_'+element))return true;if($('desc-form'+element))return true;highlight(element);}
ice.album.unhighlight=function(element){if($('title-form_'+element))return true;if($('desc-form'+element))return true;unhighlight(element);}
ice.album.cancelEdit=function(element,oldValue,className){if(className){$(element).addClassName(className);}
setTimeout(function(){$(element).update(oldValue);},1);}
ice.album.createEditForm=function(element,currentValue,idPrefix,valueElement,saveFunction,cancelClassName){var form=new Element('form',{id:idPrefix+'-form_'+element,method:'post'});var btnSave=new Element('input',{type:'submit',name:'save_'+element,value:_("SAVE")});var btnCancel=new Element('input',{type:'button',name:'cancel_'+element,value:_("CANCEL")});btnSave.onclick=saveFunction;btnCancel.onclick=function(){ice.album.cancelEdit(element,currentValue,cancelClassName);return false;};form.appendChild(valueElement)
form.insert('<br/>');form.appendChild(btnSave);form.insert(_(" or "));form.appendChild(btnCancel);return form;}
ice.album.editTitle=function(element,magic_cookie,callback){var content;if($('title-form_'+element))return true;var hasTitleCap=$(element).removeClassName('album-title-height')?true:false;ice.album.unhighlight(element);content=$F('full-'+element);var titleField=new Element('input',{type:'text',id:'edit_'+element,name:'edit_'+element,autocomplete:'off',value:content.replace(/<br\/?>/,'')}).setStyle({width:'95%'});saveFunction=function(){if(hasTitleCap){$(element).addClassName('album-title-height');}
$('full-'+element).value=$F('edit_'+element);return ice.album.save('edit_title',element,content,$F('edit_'+element),magic_cookie,callback);};$(element).update(ice.album.createEditForm(element,content,'title',titleField,saveFunction,'album-title-height'));$('edit_'+element).focus();$('edit_'+element).select();}
ice.album.editDescription=function(element,magic_cookie){var content;if($('desc-form_'+element))return true;ice.album.unhighlight(element);content=$(element).innerHTML;var descField=new Element('textarea',{id:'desc-edit_'+element,name:'desc-edit_'+element,rows:'5'}).setStyle({width:'95%'}).update(content);saveFunction=function(){return ice.album.save('edit_description',element,content,$F('desc-edit_'+element),magic_cookie);};$(element).update(ice.album.createEditForm(element,content,'desc',descField,saveFunction));$('desc-edit_'+element).focus();$('desc-edit_'+element).select();}
ice.album.save=function(action,element,oldValue,newValue,magic_cookie,callback){var album_id=element.split('_')[1];new Ajax.Request('/go/ajax/pro/album_organizer',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){if(callback){callback(newValue);}
$(element).update(newValue.escapeHTML());}else{ice.album.cancelEdit(element,oldValue);alert(_("Could not update at this time."));}},parameters:{album_id:album_id,value:newValue,magic_cookie:magic_cookie,action:action}});return false;}
ice.album.browseInThickBox=function(container,albumId,size,startUrl){var params={action:'get_album_photo_urls',album_id:albumId};if(size)params.size=size;new Ajax.Request('/go/ajax/pub/albums',{method:'post',parameters:params,onSuccess:function(transport){var items=eval('('+transport.responseText+')');if(typeof(items)=='object'){$(container).update('');for(var i=0;i<items.length;i++){$(container).insert(new Element('a',{href:items[i].url,title:items[i].title+(items[i].desc.blank()?'':'<br/>'+items[i].desc),className:'lightview',rel:'gallery[album]'}));}
Lightview.updateViews();var startElement=undefined;if(startUrl){startElement=$(container).select('a.lightview').find(function(e){return e.href==startUrl;});;}
if(startElement){Lightview.show(startElement);}else{Lightview.show($(container).down());}}}});}
ice.album.createVideo=function(container,albumId,size){var params={action:'get_album_photo_urls',album_id:albumId};if(size)params.size=size;params.only_urls=true;if(confirm('You will be redirect to Animoto.com to continue creation of your video. Clicking OK will grant Animoto\'s servers access to your photos in the selected album.')){new Ajax.Request('/go/ajax/pub/albums',{method:'post',parameters:params,onSuccess:function(transport){var items=eval('('+transport.responseText+')');if(typeof(items)=='object'){$(container).update('');for(var i=0;i<items.length;i++){$(container).insert(new Element('input',{type:'hidden',name:'assets[]',value:items[i].url}));}
$(container).insert(new Element('input',{type:'hidden',name:'ref',value:'a_lkznhmdv'}));$(container).submit();}}});return true;}
return false;}
ice.album.defaultStreamOnLoad=function(){var highlightQL=function(evt){try{e=evt.element().parentNode.parentNode.parentNode.adjacent('li.quick-links')[0];if(!e.visible())e.show();}catch(ex){}};var unhighlightQL=function(evt){try{evt.element().parentNode.parentNode.parentNode.adjacent('li.quick-links')[0].hide();}catch(ex){}};$('stream-list').select('.item-album').each(function(elem){var imgObj=elem.down().down().down();var liObj=elem.adjacent('li.quick-links')[0];Event.observe(imgObj,'mouseover',highlightQL);Event.observe(liObj,'mouseover',function(evt){evt.element().parentNode.show();});Event.observe(imgObj,'mouseout',unhighlightQL);Event.observe(liObj,'mouseout',function(evt){evt.element().parentNode.hide();});});}
ice.album.updateAlbumStream=function(event,albumId,view,page,maxDisplayed,viewParams,owner){var lHash=new ICELocationHash();if(!page){var hPage=parseInt(lHash.get('page'));page=isNaN(hPage)?1:hPage;}else{lHash.set('page',page);}
var indicator=$('indicator-box');var params={type:'album',album_id:albumId,max_displayed:maxDisplayed,page:page,album_owner:owner,stream_view:view,stream_params:viewParams};new Ajax.Request('/go/ajax/pub/photostreams',{method:'post',onCreate:function(){if(indicator){setCenterInElement(indicator,$('photos'));indicator.show();}},onSuccess:function(transport){var result=eval('('+transport.responseText+')');if(typeof(result)=='object'){$('stream').update(result.stream_content);$('navigator').update(pageNavigator(function(p){ice.album.updateAlbumStream(undefined,albumId,view,p,maxDisplayed,viewParams,owner);},page,result.photo_count,maxDisplayed,_("Viewing %d-%d of %d photos"),true));$('feedback').update('');}else{$('feedback').update(_("An unexpected error occurred, please try again"));new Effect.Highlight($('feedback'),{delay:.1,duration:3,startColor:'#fff',endColor:'#f00'});}
if(indicator)indicator.hide();},parameters:params});};ice.album.albumViewLoadEditors=function(titleMCookie,descMCookie){if(titleMCookie&&descMCookie){new Ajax.InPlaceEditor('album-title','/go/ajax/pro/album_organizer',{highlightcolor:'#99CCFF',onComplete:function(transport,element){if(!transport)return;elem=$('tabs-container').select('div.page-title')[0].down('a',2);elem.update((transport.responseText.length>45?transport.responseText.substring(0,45)+'...':transport.responseText));ice.album.title=transport.responseText;},callback:function(form,value){return'action=edit_title&album_id='+ice.album.id+'&magic_cookie='+titleMCookie+'&value='+encodeURIComponent(value);},okText:_("ok"),cancelText:_("cancel"),clickToEditText:_("Click to edit"),loadingText:_("Loading..."),savingText:_("Saving...")});new Ajax.InPlaceEditor('album-description','/go/ajax/pro/album_organizer',{rows:10,cols:25,highlightcolor:'#99CCFF',callback:function(form,value){return'action=edit_description&album_id='+ice.album.id+'&magic_cookie='+descMCookie+'&value='+encodeURIComponent(value);},onLeaveEditMode:function(obj){if(obj.element.innerHTML.blank())obj.element.update(_("no description"));},okText:_("ok"),cancelText:_("cancel"),clickToEditText:_("Click to edit"),loadingText:_("Loading..."),savingText:_("Saving...")});}}
ice.album.onAlbumViewLoad=function(event,titleMCookie,descMCookie){ice.album.updateAlbumStream(event,ice.album.id,ice.album.streamType,undefined,ice.album.maxDisplayed,ice.album.streamParams,ice.album.owner);if(titleMCookie&&descMCookie){ice.album.albumViewLoadEditors(titleMCookie,descMCookie);}}
ice.album.updateCommentsStream=function(event,albumId,page,maxDisplayed,owner){var lHash=new ICELocationHash();if(!page){var hPage=parseInt(lHash.get('page'));page=isNaN(hPage)?1:hPage;}else{lHash.set('page',page);}
var indicator=$('indicator-box');var params={album_id:albumId,max_displayed:maxDisplayed,page:page,album_owner:owner};new Ajax.Request('/go/ajax/pub/album_comments',{method:'post',onCreate:function(){if(indicator){setCenterInElement(indicator,$('photos'));indicator.show();}},onSuccess:function(transport){var result=eval('('+transport.responseText+')');if(typeof(result)=='object'){$('stream').update(result.comments_stream_content);$('navigator').update(pageNavigator(function(p){ice.album.updateCommentsStream(undefined,albumId,p,maxDisplayed,owner);},page,result.comment_count,maxDisplayed,_("Viewing %d-%d of %d photos with comments")));$('feedback').update('');}else{$('feedback').update(_("An unexpected error occurred, please try again"));new Effect.Highlight($('feedback'),{delay:.1,duration:3,startColor:'#fff',endColor:'#f00'});}
if(indicator)indicator.hide();},parameters:params});};ice.album.onAlbumCommentsLoad=function(event,titleMCookie,descMCookie){ice.album.updateCommentsStream(event,ice.album.id,undefined,ice.album.maxCommentPhotosDisplayed,ice.album.owner);if(titleMCookie&&descMCookie){ice.album.albumViewLoadEditors(titleMCookie,descMCookie);}}
ice.album.toggleSidebar=function(elem){if($('album-info-sidebar').visible()){$('album-info-sidebar').hide();elem.update(_("show details"));if(ice.album.streamType=='floating')$('album-stream').setStyle({marginLeft:'30px'});$('album-stream').setStyle({width:'100%'});return;}
elem.update(_("hide details"));$('album-stream').setStyle({marginLeft:'10px',width:'727px'});$('album-info-sidebar').show();}
ice.album.changeViewStream=function(source,view,maxDisplayed,streamParams){ice.album.streamType=view;ice.album.streamParams=streamParams;ice.album.maxDisplayed=maxDisplayed;$$('img.view-icon-checkbox').each(function(e){e.src='http://static.us.expono.com/expono-0.9.6-4585/images/icons/mini_icons/checkbox_unchecked.gif';});source.down().src='http://static.us.expono.com/expono-0.9.6-4585/images/icons/mini_icons/checkbox.gif';ice.album.updateAlbumStream(undefined,ice.album.id,ice.album.streamType,1,ice.album.maxDisplayed,ice.album.streamParams,ice.album.owner);}
ice.album.addToStack=function(albumId){new Ajax.Request('/go/ajax/pro/album_organizer',{parameters:{action:'photo_ids',album_id:albumId},onSuccess:function(transport){var result=transport.responseText.evalJSON(true);if(Object.isArray(result)){ice.photo.addToStack(result);}}});}
ice.album.createNewAlbum=function(mCookie,callback){var params={action:'create',title:$('album-title-field').value,description:$('album-desc-field').value,privacy:ice.album.defaultAlbumPrivacy,acl:new Hash(ice.album.albumAcl).toJSON(),magic_cookie:mCookie}
new Ajax.Request('/go/ajax/pro/album_organizer',{method:'post',parameters:params,onSuccess:function(transport){callback(transport.responseText);}});}
ice.album.editPrivacy=function(albumId){if(!ice.photo.editPrivacyWindow){ice.photo.editPrivacyWindow=new FloatingWindow({dropShadow:true});}
ice.photo.editPrivacyWindow.show({url:'/go/ajax/pro/add_privacy',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{action:'album',album_id:albumId}}});}
ice.album.editPrivacyAjax=function(){if(!ice.photo.editPrivacyWindow){ice.photo.editPrivacyWindow=new FloatingWindow({dropShadow:true});}
ice.photo.editPrivacyWindow.show({url:'/go/ajax/pro/album_organizer',modal:true,ajaxoptions:{method:'post',parameters:{action:'edit_privacy'}}});}
ice.album.savePrivacy=function(privacy,mCookie,albumId,callback,changePhotoPrivacy){if(changePhotoPrivacy){changePhotoPrivacy=confirm(_("Are you sure you want to apply this privacy to all photos in this album?\n\nNOTE: Every individual photo's privacy setting will be OVERWRITTEN with this privacy."));}
var params={action:'set_privacy',album_id:albumId,magic_cookie:mCookie,privacy:privacy,change_photo_privacy:changePhotoPrivacy};new Ajax.Request('/go/ajax/pro/album_organizer',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){$('ap-container').down('img').src=ice.privacyIcons[privacy];$('ap-container').down('span').update(ice.privacyText[privacy]);privacy==50?$('album-acl-details').show():$('album-acl-details').hide();ice.album.addAclDetailsTip();highlightEffect($('ap-container'));if(Object.isFunction(callback))callback();}else{$('privacy-feedback').update('<span class="error-background">'+_("Unkown error occured, please try again later")+'</span>');}
if(changePhotoPrivacy)ice.album.updateAlbumStream(undefined,albumId,ice.album.streamType,1,ice.album.maxDisplayed,ice.album.streamParams,ice.album.owner);},parameters:params});}
ice.album.addAclDetailsTip=function(){var elem=$('album-acl-details');if(!elem||!elem.visible())return;new Tip(elem,{title:'<div style="text-align:center;">'+_("Who can see this album?")+'</div>',radius:2,hook:{mouse:true,tip:'topLeft'},stem:'topLeft',offset:{x:3,y:12},ajax:{url:'/go/ajax/pro/acl',options:{parameters:{action:'get_album_acl_details',album_id:ice.album.id}}}});}
ice.album.loadPrivacyTooltips=function(){$$('div.privacy-icon-custom').each(function(elem){new Tip(elem,{title:'<div style="text-align:center;">'+_("Who can see this album?")+'</div>',radius:2,hook:{mouse:true,tip:'topLeft'},stem:'topLeft',offset:{x:3,y:12},ajax:{url:'/go/ajax/pro/acl',options:{parameters:{action:'get_album_acl_details',album_id:elem.id.split('_')[1]}}}});});}
ice.album.showAlbumChooser=function(){if(!ice.album.albumChooserWindow){ice.album.albumChooserWindow=new FloatingWindow({dropShadow:true});}
ice.album.albumChooserWindow.show({url:'/go/ajax/pro/album_organizer',modal:true,ajaxoptions:{method:'post',parameters:{action:'album_chooser'}}});}
ice.lightview={};ice.lightview.browseInThickBox=function(container,context,vars,size,startUrl){var params=vars;params.context=context;params.action='get_lightview_photo_urls';if(size)params.size=size;new Ajax.Request('/go/ajax/pub/lightview',{method:'post',parameters:params,onSuccess:function(transport){var items=eval('('+transport.responseText+')');if(typeof(items)=='object'){$(container).update('');for(var i=0;i<items.length;i++){$(container).insert(new Element('a',{href:items[i].url,title:items[i].title+(items[i].desc.blank()?'':'<br/>'+items[i].desc),className:'lightview',rel:'gallery['+context+'album]'}));}
Lightview.updateViews();var startElement=undefined;if(startUrl){startElement=$(container).select('a.lightview').find(function(e){return e.href==startUrl;});;}
if(startElement){Lightview.show(startElement);}else{Lightview.show($(container).down());}}}});}
ice.user_comments={};ice.user_comments.updateUserCommentsStream=function(event,userId,page,maxDisplayed){var lHash=new ICELocationHash();if(!page){var hPage=parseInt(lHash.get('page'));page=isNaN(hPage)?1:hPage;}else{lHash.set('page',page);}
var indicator=$('indicator-box');var params={user_id:userId,max_displayed:maxDisplayed,page:page};new Ajax.Request('/go/ajax/pub/user_comments',{method:'post',onCreate:function(){if(indicator){setCenterInElement(indicator,$('photos'));indicator.show();}},onSuccess:function(transport){var result=eval('('+transport.responseText+')');if(typeof(result)=='object'){$('stream').update(result.comments_stream_content);$('navigator').update(pageNavigator(function(p){ice.user_comments.updateUserCommentsStream(undefined,userId,p,maxDisplayed);},page,result.comment_count,maxDisplayed,_("Viewing %d-%d of %d photos with comments")));$('feedback').update('');}else{$('feedback').update(_("An unexpected error occurred, please try again"));new Effect.Highlight($('feedback'),{delay:.1,duration:3,startColor:'#fff',endColor:'#f00'});}
if(indicator)indicator.hide();},parameters:params});};ice.user_comments.onUserCommentsLoad=function(event){ice.user_comments.updateUserCommentsStream(event,ice.user_comments.user_id,undefined,ice.user_comments.maxCommentPhotosDisplayed);}
ice.photo.custom_location_name_default=_("Set your own name?");ice.photo.location_search_type=null;ice.photo.has_loc_display=false;ice.photo.has_loc_change_link=false;ice.photo.has_save_moved_loc_link=false;ice.photo.show_drop_result_in_text_input=false;ice.photo.has_separate_edit_mode=false;ice.photo.has_recent_location_list=false;ice.photo.block_photo_edit=false;ice.photo.always_show_tip=false;ice.photo.geocodeResult=null;ice.photo.hasPin=false;ice.photo.noCoordinatesTxt=_("only coordinates...");ice.photo.licenseText={0:'&copy; All rights reserved',11:'CC: Attribution Non-commercial No Derivatives',12:'CC: Attribution Non-commercial Share Alike',13:'CC: Attribution Non-commercial',14:'CC: Attribution No Derivatives',15:'CC: Attribution Share Alike',16:'CC: Attribution'};ice.photo.setLocationSearchType=function(type,text_input,has_recent){ice.photo.hasPin=false;ice.photo.search_location_text_input=text_input;ice.photo.location_search_type=type;ice.photo.has_recent_location_list=has_recent;if(type=="lookup"){ice.photo.draggableLocationMarker=true;ice.photo.has_loc_display=false;ice.photo.has_loc_change_link=false;ice.photo.has_save_moved_loc_link=false;ice.photo.show_drop_result_in_text_input=true;ice.photo.always_show_tip=true;ice.photo.has_separate_edit_mode=false;ice.photo.SetGeotagTip(_("Search for a city or press pin to add a new pin to the map"));}else{ice.photo.draggableLocationMarker=true;ice.photo.has_loc_display=true;ice.photo.has_save_moved_loc_link=true;ice.photo.has_loc_change_link=true;ice.photo.show_drop_result_in_text_input=false;ice.photo.always_show_tip=false;ice.photo.has_separate_edit_mode=true;}}
ice.photo.onStackStreamRemove=function(evt){for(var i=0;i<evt.memo.photoIds.length;i++){var e=$('stream-entry_'+evt.memo.photoIds[i]);if(e)e.remove();}
if(!ice.photo.stack.photo_ids)window.location.href='http://'+window.location.host+'/'+ice.user.username+'/photos';}
ice.photo.toggleQLStackBtn=function(successOrCall,photo_ids){if(Object.isFunction(successOrCall)&&Object.isArray(photo_ids)){successOrCall(photo_ids,ice.photo.toggleQLStackBtn);}else if(successOrCall){if($('stack-add_'+photo_ids[0]).visible()){$('stack-add_'+photo_ids[0]).hide();$('stack-remove_'+photo_ids[0]).show();}else{$('stack-add_'+photo_ids[0]).show();$('stack-remove_'+photo_ids[0]).hide();}}}
ice.photo.hasPhotosInStack=function(){return!(!ice.photo.stack||!Object.isArray(ice.photo.stack.photo_ids)||ice.photo.stack.photo_ids.length<1||!ice.photo.stack.url)}
ice.photo.updatePhotoStack=function(noEffect){if(!ice.photo.hasPhotosInStack()){var tip=ice.photo.findStackTip();if(tip)tip.remove();if($('photo-stack'))$('photo-stack').remove();return;}
if(!$('photo-stack')){ice.photo.createPhotoStackUI();new Tip('photo-stack',ice.photo.createPhotoStackContent(),{title:_("Your photo stack"),showOn:'click',hideOn:{element:'closeButton',event:'click'},hook:{target:'bottomRight',tip:'bottomLeft'},stem:'leftBottom',border:2,radius:2,width:'180px',offset:{x:0,y:-5}});$('photo-stack').observe('prototip:shown',function(){elem=ice.photo.findStackTip();elem.setStyle({position:'fixed'});});$('photo-stack').observe('prototip:hidden',function(){if(ice.photo.stack.hide_tip)return;new Ajax.Request('/go/ajax/pro/photo_stack',{parameters:{action:'hide_tip'},onSuccess:function(transport){if(transport.responseText=='1')ice.photo.stack.hide_tip=true;}});});}
var strPhoto=_sp("%d photo","%d photos",ice.photo.stack.photo_ids.length);$('photo-stack').down('div').update(strPhoto);$('photo-stack').down('img').src=ice.photo.stack.url;if(!noEffect)$('photo-stack').shake({distance:'5px'});if(!ice.photo.stack.hide_tip){$('photo-stack').prototip.show();}}
ice.photo.findStackTip=function(){return $$('div.prototip').find(function(e){if(e.select('div.stack-menu').length>0)return true;return false;});}
ice.photo.sendStackToBatchOp=function(){var params='ids='+$A(ice.photo.stack.photo_ids).join(',');submitPost('/go/user/photos/batchop',params);}
ice.photo.createPhotoStackUI=function(){var stack=new Element('div',{id:'photo-stack',className:'photo-stack'}).insert(new Element('div',{id:'stack-count'})).insert(new Element('img',{src:ice.photo.stack.url}));document.body.insert(stack);}
ice.photo.createPhotoStackContent=function(){var options=new Element('ul');options.insert(new Element('a',{href:'/go/user/stack'}).update(_("View")));options.insert(' | ');var editLink=new Element('a',{href:'/go/user/photos/edit'}).update(_("Edit"));options.insert(editLink);options.insert(' | ');options.insert(new Element('a',{href:'/go/user/inbox#action=compose&attachment=stack'}).update(_("Share")));options.insert(' | ');var clearLink=new Element('a',{href:'javascript:;'}).update(_("Clear"));clearLink.observe('click',function(){ice.photo.removeFromStack(ice.photo.stack.photo_ids);});options.insert(clearLink);var info=new Element('div',{id:'stack-info'}).setStyle({display:'none'});info.insert(new Element('div',{className:'stack-menu'}).insert(options));return info;}
ice.photo.addToStack=function(photo_ids,callback){if(photo_ids.length==0)return;new Ajax.Request('/go/ajax/pro/photo_stack',{method:'post',onSuccess:function(transport){var success=false;var result=eval('('+transport.responseText+')');if(typeof(result)=='object'){ice.photo.stack=result;ice.photo.updatePhotoStack();if(result.message)notify(result.message);success=true;document.body.fire('stack:added',{photoIds:photo_ids});}else{alert(_("Sorry, but we could not add to stack at this time. Please, try again later."));}
if(Object.isFunction(callback))callback(success,photo_ids);},parameters:{action:'add',photo_ids:photo_ids.toJSON()}});return false;}
ice.photo.removeFromStack=function(photo_ids,callback){if(Object.isArray(photo_ids)&&photo_ids.length==ice.photo.stack.photo_ids.length){if(!confirm(_("Are you sure you want to clear your stack?")))return;}
new Ajax.Request('/go/ajax/pro/photo_stack',{method:'post',onSuccess:function(transport){var success=false;var result=eval('('+transport.responseText+')');if(typeof(result)=='object'){ice.photo.stack=result;ice.photo.updatePhotoStack();success=true;document.body.fire('stack:removed',{photoIds:photo_ids});}else{alert(_("Sorry, but we could not remove from the stack at this time. Please, try again later."));}
if(Object.isFunction(callback))callback(success,photo_ids);},parameters:{action:'remove',photo_ids:photo_ids.toJSON()}});return false;}
ice.photo.toggleStackLink=function(success){if(success){if($('add_stack_link').visible()){$('add_stack_link').hide();$('remove_stack_link').show()}else{$('add_stack_link').show();$('remove_stack_link').hide()}}}
ice.photo.showEXIF=function(photo_id){if(!ice.exifWindow){ice.exifWindow=new FloatingWindow({dropShadow:true});}
ice.exifWindow.show({url:'/go/ajax/pub/exif?photo_id='+photo_id,modal:true});}
ice.photo.getPhotosUploadedOn=function(user_id,date,from,obj){new Ajax.Updater(obj,'/go/ajax/pro/get_photos_uploaded_on',{method:'get',insertion:Insertion.Bottom,parameters:{user_id:user_id,date:date,from:from}});return false;}
ice.photo.addPhotosToFavorites=function(photoIds,mCookie){$('photo-edit-feedback').update(loading(''));new Ajax.Request('/go/ajax/pro/edit_photo',{onSuccess:function(transport){if(transport.responseText=='1'){$('photo-edit-feedback').update(_("Successfully added photos as favorites."));}else{$('photo-edit-feedback').update(_("An unknown error occurred, please again later."));}
highlightEffect($('photo-edit-feedback'));},parameters:{action:'add_to_favorites',photo_ids:photoIds.toJSON(),magic_cookie:mCookie}});}
ice.photo.addToFavorites=function(photo_id,magic_cookie){new Ajax.Request('/go/ajax/pub/add_to_favorites',{method:'post',onCreate:function(transport){$('favoritees').innerHTML='<img src=\'http://static.us.expono.com/expono-0.9.6-4585/images/indicator_medium.gif\'>';},onSuccess:function(transport){if(transport.responseText=='1'){$('processing_'+photo_id).remove();}else{$('processing_'+photo_id).remove();alert(_("Sorry, but we could not add to favorites at this time. Please, try again later."));}},onComplete:function(transport){ice.photo.getFavoritees(photo_id,'favoritees');},parameters:{photo_id:photo_id,magic_cookie:magic_cookie}});return false;}
ice.photo.removeFromFavorites=function(photo_id,magic_cookie,hide){if(confirm(_("Do you want to remove this photo from your favorites?"))){var height=20;new Ajax.Request('/go/ajax/pub/remove_from_favorites',{method:'post',onCreate:function(transport){$('favoritees').innerHTML='<img src=\'http://static.us.expono.com/expono-0.9.6-4585/images/indicator_medium.gif\'>';},onSuccess:function(transport){if(transport.responseText=='1'){if(hide){height=height+$('photo_'+photo_id).height;$('photo_frame'+photo_id).innerHTML='<div style="text-align:center;width:90%;height:'+height+'px;top:50%;display:table-cell; vertical-align:middle;"><h3 style="color:#cccccc;">'+_("FAVORITE REMOVED")+'</h3></div>';}else{$('processing_'+photo_id).remove();}}else{$('processing_'+photo_id).remove();alert(_("Sorry, but we could not remove this photo from your favorites at this time. Please, try again later."));}},onComplete:function(transport){ice.photo.getFavoritees(photo_id,'favoritees');},parameters:{photo_id:photo_id,magic_cookie:magic_cookie}});return false;}
return false;}
ice.photo.deletePhoto=function(photo_id,magic_cookie,redirect_url){if(confirm(_("Are you sure you want to delete this image?"))){var height=50;var indicator=new Element('img',{id:('processing_'+photo_id),src:'http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif',alt:_("processing")});$('btn-delete_'+photo_id).insert({before:indicator});$('btn-delete_'+photo_id).hide();new Ajax.Request('/go/ajax/pro/delete_photo',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){if(redirect_url){window.location=redirect_url;}
height=height+$('photo_'+photo_id).height;$('photo_frame'+photo_id).innerHTML='<div style="text-align:center;width:90%;height:'+height+'px;top:50%;display:table-cell; vertical-align:middle;"><h2 style="color:#cccccc;">'+_("PHOTO DELETED")+'</h2></div>';}else{$('btn-delete_'+photo_id).show();$('processing_'+photo_id).remove();alert(_("Could not delete your image at this time."));}},parameters:{photo_id:photo_id,magic_cookie:magic_cookie}});}
return false;}
ice.photo.highlight=function(element){if($('form_'+element))return true;if($('form_desc_'+element))return true;highlight(element);}
ice.photo.unhighlight=function(element){if($('form_'+element))return true;if($('form_desc_'+element))return true;unhighlight(element);}
ice.photo.cancelEdit=function(element){var title;title=$('orig_'+element).value;setTimeout(function(){$(element).innerHTML=title;},1);}
ice.photo.editTitle=function(element,magic_cookie){var content;if($('form_'+element))return true;ice.photo.unhighlight(element);content=$(element).innerHTML;$(element).innerHTML='<form id="form_'+element+'" method="post"><input type="hidden" id="orig_'+element+'" name="orig_'+element+'" value="'+content+'"><input type="text" id="edit_'+element+'" autocomplete="off" style="width:100%;" name="edit_'+element+'" value="'+content+'"><br><input type="submit" name="save_'+element+'" value="'+_("SAVE")+'" onclick="ice.photo.saveTitle(\''+element+'\',\''+magic_cookie+'\'); return false;"> or <input type="button" name="cancel_'+element+'" value="'+_("CANCEL")+'" onclick="ice.photo.cancelEdit(\''+element+'\'); return false;"></form>';$('edit_'+element).focus();$('edit_'+element).select();}
ice.photo.saveTitle=function(element,magic_cookie){var photo_title=$F('edit_'+element);var photo_id=element.split('_')[1];new Ajax.Request('/go/ajax/pro/edit_photo_title',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){$(element).innerHTML=$F('edit_'+element).escapeHTML();}else{ice.photo.cancelEdit(element);alert(_("Could not update the title at this time."));}},parameters:{photo_id:photo_id,photo_title:photo_title,magic_cookie:magic_cookie}});return false;}
ice.photo.cancelEditDescription=function(element){var description;description=$('orig_desc_'+element).value;setTimeout(function(){$(element).innerHTML=description;},1);}
ice.photo.editDescription=function(element,magic_cookie){var content;if($('form_desc_'+element))return true;content=$(element).innerHTML;content=content.replace(/<br>/g,'');$(element).innerHTML='<form id="form_desc_'+element+'" method="post"><input type="hidden" id="orig_desc_'+element+'" name="orig_desc_'+element+'" value="'+content+'"><textarea id="edit_desc_'+element+'" rows="5" style="width:490px;" name="edit_desc_'+element+'">'+content+'</textarea><br><input type="submit" name="save_desc_'+element+'" value="'+_("SAVE")+'" onclick="ice.photo.saveDescription(\''+element+'\',\''+magic_cookie+'\'); return false;"> or <input type="button" name="cancel_desc_'+element+'" value="'+_("CANCEL")+'" onclick="ice.photo.cancelEditDescription(\''+element+'\'); return false;"></form>';$('edit_desc_'+element).focus();$('edit_desc_'+element).select();ice.photo.unhighlight(element);}
ice.photo.saveDescription=function(element,magic_cookie){var photo_description=$F('edit_desc_'+element);if(photo_description.blank())$('edit_desc_'+element).value='no description';var photo_id=element.split('_')[1];new Ajax.Request('/go/ajax/pro/edit_photo_description',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){$(element).innerHTML=$F('edit_desc_'+element).escapeHTML();}else{ice.photo.cancelEditDescription(element);alert(_("Could not update the description at this time."));}},parameters:{photo_id:photo_id,photo_description:photo_description,magic_cookie:magic_cookie}});return false;}
ice.photo.getComments=function(photo_id,element,magic_cookie){$(element).innerHTML='<img src=\'http://static.us.expono.com/expono-0.9.6-4585/images/indicator_medium.gif\'>';new Ajax.Updater(element,'/go/ajax/pub/photo_comments',{method:'get',parameters:{photo_id:photo_id,magic_cookie:magic_cookie}});return false;}
ice.photo.postComment=function(photo_id,element,magic_cookie){var photo_comment=$F(element);var indicator=new Element('img',{id:('processing_'+element),src:'http://static.us.expono.com/expono-0.9.6-4585/images/indicator_medium.gif',alt:_("processing")});if(photo_comment==''){alert(_("You must enter a comment!"));return false;}
$(element).insert({before:indicator});$(element).hide();new Ajax.Updater('comments','/go/ajax/pub/photo_comments',{evalScripts:true,insertion:'bottom',parameters:{photo_id:photo_id,photo_comment:photo_comment,magic_cookie:magic_cookie},onComplete:function(){indicator.remove();$(element).value='';$(element).show();}});}
ice.photo.deleteComment=function(photo_id,comment_id,magic_cookie){if(confirm(_("Are you sure you want to delete this comment?"))){var indicator=new Element('img',{id:('processing_'+comment_id),src:'http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif',alt:_("processing")});$('delete_comment_'+comment_id).insert({before:indicator});$('delete_comment_'+comment_id).hide();new Ajax.Request('/go/ajax/pub/delete_photo_comment',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){$('comment_'+comment_id).hide();}else{$('delete_comment_'+comment_id).show();$('processing_'+comment_id).remove();alert(_("Could not delete the comment at this time."));}},parameters:{photo_id:photo_id,comment_id:comment_id,magic_cookie:magic_cookie}});}
return false;}
ice.photo.loadAddToAlbum=function(photoIds){if(!ice.photo.addToAlbumWindow){ice.photo.addToAlbumWindow=new FloatingWindow({dropShadow:true});}
ice.photo.addToAlbumWindow.show({url:'/go/ajax/pro/add_to_album',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{photo_ids:photoIds.toJSON()}}});}
ice.photo.removeLocation=function(element,mCookie){var indicator=loading('');$(element).insert({before:indicator});$(element).hide();var params={action:'remove_location_tag',magic_cookie:mCookie,photo_id:ice.photo.id};new Ajax.Request('/go/ajax/pro/tagging',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){indicator.remove();ice.photo.showDropMarker(false);$(element).show();if(ice.photo.has_loc_change_link){$('location-change-link').hide();}
$('loc-z-help').hide();ice.photo.location=undefined;ice.photo.initLocationMap();$('photo-location').update('<a href="javascript:;" onclick="ice.photo.editLocation(\''+mCookie+'\');">'+_("Set location for this photo")+'</a>');}else{$('photo-location').update('<div class="error-background">'+_("Couldn't remove location, please try later.")+'</div>');}},parameters:params});}
ice.photo.showDropMarker=function(show){if(!$('new-drop-pin')){return;}
if(show){$('new-drop-pin').style.display="inline";}else{$('new-drop-pin').hide();}}
ice.photo.newMarkerAdd=function(mCookie,callback){if(ice.photo.has_separate_edit_mode){ice.photo.editLocation(mCookie);}
ice.photo.showDropMarker(false);ice.photo.setLocationMarker(ice.photo.map.getCenter(),ice.photo.map);ice.photo.onLocationDrop(ice.photo.map.photoMarker);if(callback){callback(ice.photo.map.getCenter());}}
ice.photo.showCustomLocationEdit=function(){ice.photo.hideLocationEdit();ice.photo.hideLocationDisplay();$('custom-location-name').show();if(ice.photo.has_loc_change_link){$('location-cancel-link').show();}
if(ice.photo.has_save_moved_loc_link){$('save-moved-loc').show();}
if(!ice.photo.show_drop_result_in_text_input){$('moved-loc-name').show();}
if(ice.photo.map.photoMarker){ice.photo.SetGeotagTip(_("Drag pin to change it's position"));}}
ice.photo.hideCustomLocationEdit=function(){if(ice.photo.has_save_moved_loc_link){$('save-moved-loc').hide();}
$('custom-location-name').hide();}
ice.photo.showLocationDisplay=function(){ice.photo.hideCustomLocationEdit();ice.photo.hideLocationEdit();$('photo-location').show();if(ice.photo.has_loc_change_link){$('location-change-link').show();}
ice.photo.hideGeotagTip();}
ice.photo.hideLocationDisplay=function(){if(ice.photo.has_loc_display){$('photo-location').hide();}
if(ice.photo.has_loc_change_link){$('geo-search-value').hide();$('location-change-link').hide();}}
ice.photo.showLocationEdit=function(){ice.photo.hideLocationDisplay();ice.photo.hideCustomLocationEdit();if(ice.photo.has_recent_location_list){if($('recent-locations').down('li')){$('recent-container').show();}else{$('recent-link').show();}}
if(!ice.photo.show_drop_result_in_text_input){$('geo-search-container').show();}
if(ice.photo.has_loc_change_link){$('geo-search-value').show();}
if(ice.photo.map.photoMarker){ice.photo.SetGeotagTip(_("Drag pin to change it's position or search for a city"));ice.photo.showDropMarker(false);}else{ice.photo.SetGeotagTip(_("Search for a city or press pin to add a new pin to the map"));ice.photo.showDropMarker(true);}
ice.photo.showGeotagTip();}
ice.photo.SetGeotagTip=function(str){$('drag-pin-tip').update(str);}
ice.photo.showGeotagTip=function(){$('drag-pin-tip').show();}
ice.photo.hideGeotagTip=function(){if(ice.photo.always_show_tip){return;}
$('drag-pin-tip').hide();}
ice.photo.hideLocationEdit=function(){if(ice.photo.has_save_moved_loc_link){$('save-moved-loc').hide();}
if(ice.photo.has_recent_location_list){if($('recent-locations').down('li')){$('recent-container').hide();}else{$('recent-link').hide();}}
if(!ice.photo.show_drop_result_in_text_input){$('geo-search-container').hide();}}
ice.photo.cancelCustomLocationEdit=function(){ice.photo.showLocationDisplay();}
ice.photo.editLocation=function(mCookie){if(!$('photo-location').visible()){ice.photo.showLocationDisplay();return;}
ice.photo.initGeoSearchAutoCompleter($('geo-search-value'),$('geo-search-result-container'),$('geo-search-indicator'),function(text,li){ice.photo.saveLocationFromAutoComplete(text,li,mCookie)});$('geo-search-value').value='Enter city name...';ice.photo.showLocationEdit();$('geo-search-value').focus();$('geo-search-value').select();}
ice.photo.initGeoSearchAutoCompleter=function(searchField,resultContainer,indicator,afterUpdate,onUpdate){if(!ice.photo.geoSearchAutoCompleter){var onShow=function(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,setWidth:false,offsetTop:element.offsetHeight});}
Effect.Appear(update,{duration:0.15});};ice.photo.geoSearchAutoCompleter=new Ajax.Autocompleter(searchField,resultContainer,'/go/ajax/pro/location_search_autocompleter',{minChars:3,paramName:'value',indicator:indicator,afterUpdateElement:afterUpdate,updateElement:onUpdate,onShow:onShow,searchOptionsFilter:ice.photo.geoSearchAutoCompleterFilter});}}
ice.photo.geoSearchAutoCompleterFilter=function(search_str,ajax_url,ajax_options){ice.photo.hasPin=false;var callback_params={ajax_url:ajax_url,ajax_options:ajax_options};ice.location_search.searchLocation(search_str,callback_params,ice.photo.geoSearchAutoCompleterFilterOnGlocalSearchComplete);}
ice.photo.geoSearchAutoCompleterFilterOnGlocalSearchComplete=function(locations,search_str,params){if(locations.length>0){params['ajax_options']['parameters']+="&locations="+locations.toJSON();}
new Ajax.Request(params['ajax_url'],params['ajax_options']);}
ice.photo.saveLocationFromAutoComplete=function(text,li,mCookie){var location_id=li.id.split('_')[1];var google_loc=ice.location_search.getGoogleLoc(location_id,li,null);var params={action:'save_geo_tag',magic_cookie:mCookie,photo_id:ice.photo.id,gps_overwrite:true,overwrite:true,location_id:location_id,google_loc:google_loc};new Ajax.Request('/go/ajax/pro/tagging',{method:'post',onSuccess:function(transport){var result=eval('('+transport.responseText+')');if(typeof(result)=='object'){if(!ice.photo.location){$('location-map').show();if(ice.photo.has_loc_change_link){$('location-change-link').show();}}
if(!$('loc-z-help').visible())$('loc-z-help').show();ice.photo.location=new GLatLng(result.latitude,result.longitude)
if(!ice.photo.map){ice.photo.initLocationMap();}else{ice.photo.map.clearOverlays();ice.photo.map.setCenter(ice.photo.location,parseInt(result.zoom));ice.photo.setLocationMarker(ice.photo.location,ice.photo.map);GEvent.addListener(ice.photo.map,"zoomend",function(oldZoom,newZoom){if($('loc-z-help')&&$('loc-z-help').visible()){$('loc-z-help').hide();$('loc-z-save').show();}});}
$('photo-location').update('in '+result.text+' ');}else{$('photo-location').update('<div class="error-background">'+_("Couldn't set location, please try later.")+'</div>');}
if(ice.photo.has_separate_edit_mode){ice.photo.editLocation();ice.photo.showLocationDisplay();}},parameters:params});}
ice.photo.removeIdentityTag=function(tagId,taggedUserId,mCookie){var params={action:'remove_identity_tag',tag_id:tagId,magic_cookie:mCookie};new Ajax.Request('/go/ajax/pro/tagging',{method:'post',onCreate:function(){$('idt-tag-id_'+tagId).update('<div><div style="float:left;">'+$('idt-tag-id_'+tagId).innerHTML+'</div><div id="idt-indicator_'+tagId+'" style="padding: 5px 0 0 10px;float:left;"><img src="http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif"/></div></div>');},onSuccess:function(transport){if(transport.responseText=='1'){$('idt-tag-id_'+tagId).remove();var taggedUsers=$('idt-tagged-users').value.split(',');if(taggedUsers.indexOf(taggedUserId)>-1){taggedUsers.splice(taggedUsers.indexOf(taggedUserId),1);$('idt-tagged-users').value=taggedUsers.join(',');}
ice.photo.removeContactAnnotation(tagId);}else{$('idt-indicator_'+tagId).remove();$('idt-tag-id_'+tagId).insert(new Element('span',{className:'error-background'}).update(_("An error occured, please try again later.")));}},parameters:params});}
ice.photo.editingContactAnnotation=false;ice.photo.contactAnnotations=new Array();ice.photo.addIdentityTag=function(){if(ice.photo.editingContactAnnotation){return;}
ice.photo.editingContactAnnotation=true;ice.photo.latestContactAnnotation=new ContactAnnotation('photo-area',{width:'50',height:'50',top:50,left:50},{editable:true,showEdit:true,photoId:ice.photo.id,shareOnTag:ice.photo.shareOnIdentityTags});}
ice.photo.removeContactAnnotation=function(id){for(var i=0;i<ice.photo.contactAnnotations.length;i++){if(ice.photo.contactAnnotations[i].id==id){ice.photo.contactAnnotations[i].destroy();ice.photo.contactAnnotations.splice(i,1);}}}
ice.photo.unhighlightIdentityTag=function(id){for(var i=0;i<ice.photo.contactAnnotations.length;i++){if(!id||ice.photo.contactAnnotations[i].id==id){ice.photo.contactAnnotations[i].hideNote();}}}
ice.photo.highlightIdentityTag=function(id){for(var i=0;i<ice.photo.contactAnnotations.length;i++){if(!id||ice.photo.contactAnnotations[i].id==id){ice.photo.contactAnnotations[i].showNote();}}}
ice.photo.toggleAllTaggedIdentities=function(evt){var element=Event.element(evt);if(element.innerHTML=='Highlight all'){element.update(_("Unhighlight all"));}else{element.update(_("Highlight all"));}
ice.photo.toggleTaggedIdentities();}
ice.photo.toggleIdentityPhotoList=function(){var counter=1;var max=$('add-identity-tag')?5:6;$('idt-tag-list').select('li').each(function(e){if(counter>max&&e.id!='add-identity-tag'){e.visible()?e.hide():e.show();}
counter++;});}
ice.photo.toggleTaggedIdentities=function(requestingElement){var lockIt=ice.photo.contactAnnotations[0].isLockedState()?false:true;for(var i=0;i<ice.photo.contactAnnotations.length;i++){if(lockIt){ice.photo.contactAnnotations[i].toggleNote();ice.photo.contactAnnotations[i].setLockedState(lockIt);}else{ice.photo.contactAnnotations[i].setLockedState(lockIt);ice.photo.contactAnnotations[i].toggleNote();}}}
ice.photo.addKeywordTags=function(element,photoIds){var keywords=element.value;if(keywords.length<1){if(ice.photo.id){$('keyword-tagging-feedback').hide();$('keyword-tagging-controls').hide();}
return;}
var params={action:'add_keywords',keywords:keywords};if(ice.photo.id){params['photo_id']=ice.photo.id;}else{params['photo_ids']=photoIds.toJSON();}
new Ajax.Request('/go/ajax/pro/tagging',{method:'post',onCreate:function(){if(ice.photo.id){$('keyword-tagging-controls').hide();element.value='';$('keyword-tagging-feedback').addClassName('feedback-background');$('keyword-tagging-feedback').update(loading('Saving tags...'));$('keyword-tagging-feedback').show();}else{$('photo-edit-feedback').update(loading('Saving tags...',undefined,{}));}},onSuccess:function(transport){var result=eval('('+transport.responseText+')');if(Object.isArray(result)){if(ice.photo.id){var parent=Element.extend($('keyword-tag-list').parentNode);if(!parent.visible())parent.show();$('keyword-tagging-feedback').hide();result.each(ice.photo.addKeywordToList);ice.photo.updateUserKeywords(keywords);}else{$('photo-edit-feedback').update(_("Successfully added keywords."));highlightEffect($('photo-edit-feedback'));}}else{if(ice.photo.id){$('keyword-tagging-feedback').addClassName('error-background');$('keyword-tagging-feedback').update(_("An error occured, please try again later."));}else{$('photo-edit-feedback').update(_("An error occured, please try again later."));}}},parameters:params});}
ice.photo.addKeywordToList=function(keywordTag){var deleteLink=new Element('a',{href:'javascript:;'}).insert(new Element('img',{src:'http://static.us.expono.com/expono-0.9.6-4585/images/icons/mini_icons/trash.gif',title:_("Remove tag")}));Event.observe(deleteLink,'click',function(evt){ice.photo.removeKeywordTag(keywordTag.id,keywordTag.mcookie);});var userLink=new Element('a',{href:keywordTag.user_link,alt:keywordTag.tag}).insert(keywordTag.tag);var tElem=new Element('li',{id:'keyword-tag_'+keywordTag.id}).insert(new Element('a',{href:keywordTag.global_link}).insert(new Element('img',{src:'http://static.us.expono.com/expono-0.9.6-4585/images/icons/mini_icons/globe.gif',className:'absmiddle',title:_("Public photos with this tag")})));tElem.insert('&nbsp;').insert(userLink);tElem.insert('&nbsp;').insert(deleteLink);Element.insert($('add-tags-link'),{before:tElem});new Effect.Highlight(tElem,{delay:.1,duration:3,startColor:'#fff',endColor:'#f00'});}
ice.photo.keywordFieldKeyListener=function(evt,onEnterKey){var valueLength=evt.element().value.length;if(valueLength<1){ice.photo.noKeywordSuggestions();return;}
switch(evt.keyCode){case Event.KEY_TAB:ice.photo.completeSuggestedWord(evt.element());return;case Event.KEY_RETURN:if(onEnterKey){onEnterKey(evt.element());}else{ice.photo.addKeywordTags(evt.element());}
return;case Event.KEY_ESC:break;case Event.KEY_LEFT:break;case Event.KEY_RIGHT:break;case Event.KEY_UP:ice.photo.completeSuggestedWord(evt.element());return;case Event.KEY_DOWN:ice.photo.completeSuggestedWord(evt.element());return;default:var selection=evt.element().selectionStart||valueLength;if(!selection){return;}
var currentKeyword=ice.photo.extractCurrentKeyword(evt.element().value,selection);if(!currentKeyword||valueLength<2||currentKeyword.length<2){ice.photo.noKeywordSuggestions();return}
ice.photo.suggestKeyword(currentKeyword,evt.element());}}
ice.photo.removeKeywordTag=function(tagId,mCookie){var params={action:'remove_keyword_tag',tag_id:tagId,photo_id:ice.photo.id,magic_cookie:mCookie};var element=$('keyword-tag_'+tagId);element.onmouseover=Prototype.emptyFunction;element.onmouseout=Prototype.emptyFunction;new Ajax.Request('/go/ajax/pro/tagging',{method:'post',onCreate:function(){element.update('<img src="http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif" />');},onSuccess:function(transport){if(transport.responseText=='1'){element.remove();}else{alert(_("An unknown error occured, please try again later"));}},parameters:params});}
ice.photo.addKeywordToField=function(keyword,field,nofocus){keyword=keyword.replace(/^\s+|\s+$/g,'');var currentValues=field.value.replace(/^\s+|\s+$/g,'');var reExists=new RegExp("(^\s?|,\s?)"+keyword,"g");if(reExists.test(currentValues)){if(!nofocus)field.focus();return;}
if(currentValues.length==0){field.value=keyword+',';if(!nofocus)field.focus();return;}
if(currentValues.match(/,$/)){field.value+=keyword;}else{field.value+=','+keyword;}
if(!nofocus)field.focus();}
ice.photo.extractCurrentKeyword=function(data,caretPosition){var regexp=/([^,]+)/gi;matches=data.match(regexp);if(matches.length==1){return matches[0];}
var count=0;for(var i=0;i<matches.length;i++){if(caretPosition>=count&&caretPosition<=(count+matches[i].length)){return matches[i].replace(/^\s+|\s+$/g,'');}
count+=matches[i].length+1;}
return false;}
ice.photo.suggestKeyword=function(searchValue,inputField){if(!searchValue){return;}
var regex=new RegExp("^"+searchValue+".","i");var suggestions=[];var currentWordsInInput=inputField.value.split(',');for(var word in userKeywords){if(currentWordsInInput.indexOf(word)>-1){continue;}
if(regex.test(word)){suggestions.push(word);}}
var updateStr='';for(var i=0;i<suggestions.length;i++){var id='';if(i==0){id=' id="suggested-tag" ';updateStr+='<input type="hidden" id="tag-autocomplete-value" value="'+suggestions[i].substring(searchValue.length)+'">';}
updateStr+='<a href="javascript:;" class="suggested-tag" '+id+'>'+suggestions[i]+'</a>&nbsp;';}
if(suggestions.length==0){ice.photo.noKeywordSuggestions();}else{$('suggested-tags').update(updateStr);$('suggested-tags').select('a.suggested-tag').each(function(element){Event.observe(element,'click',function(){inputField.value+=element.innerHTML.substring(searchValue.length)+', ';inputField.focus();ice.photo.noKeywordSuggestions();});});}}
ice.photo.completeSuggestedWord=function(inputField){if($('tag-autocomplete-value')){inputField.value+=$('tag-autocomplete-value').value+', ';inputField.focus();ice.photo.noKeywordSuggestions();}}
ice.photo.noKeywordSuggestions=function(){$('suggested-tags').update(_("Start typing a tag to see suggestions, and try UP, DOWN and TAB keys to autocomplete."));}
ice.photo.updateUserKeywords=function(keywords){var split=keywords.split(',');for(var i=0;i<split.length;i++){var word=split[i].replace(/^\s+|\s+$/g,'');if(word.length>0){if(userKeywords[word]){userKeywords[word]++;}else{userKeywords[word]=1;}}}}
ice.photo.initLocationMap=function(zoom){if(!zoom)zoom=6;if(GBrowserIsCompatible()){if(!ice.photo.location){ice.photo.showDropMarker(true);}
var elem=$('location-map');ice.photo.map=new google.maps.Map2(elem,{mapTypes:[G_NORMAL_MAP,G_SATELLITE_MAP,G_HYBRID_MAP,G_PHYSICAL_MAP]});ice.photo.map.addControl(new GSmallZoomControl());ice.photo.map.addControl(new GMenuMapTypeControl());if(ice.photo.location){ice.photo.map.setCenter(ice.photo.location,zoom);ice.photo.setLocationMarker(ice.photo.location,ice.photo.map);GEvent.addListener(ice.photo.map,"zoomend",function(oldZoom,newZoom){if($('loc-z-help')&&$('loc-z-help').visible()){$('loc-z-help').hide();$('loc-z-save').show();}});}else{ice.photo.map.setCenter(new GLatLng(34,0),1);}}}
ice.photo.onLocationDrop=function(marker){$('custom-location-name').value=ice.photo.custom_location_name_default;ice.photo.showCustomLocationEdit();ice.photo.geocodeResult=undefined;ice.photo.hasPin=false;ice.location_search.geocode(marker.getLatLng(),ice.photo.onGeocodeReturn);}
ice.photo.setLocationMarker=function(location,map){ice.photo.showDropMarker(false);ice.photo.map.photoMarker=new GMarker(location,{draggable:ice.photo.draggableLocationMarker});ice.photo.map.addOverlay(ice.photo.map.photoMarker);if(ice.photo.draggableLocationMarker){GEvent.addListener(ice.photo.map.photoMarker,"dragend",function(){ice.photo.onLocationDrop(ice.photo.map.photoMarker);});}
ice.photo.onSetLocationMarker(ice.photo.map.photoMarker);}
ice.photo.onSetLocationMarker=function(marker){}
ice.photo.hasDragpinLocation=function(){if(ice.photo.geocodeResult==null&&!ice.photo.hasPin){return false;}
ice.photo.hasPin=false;if(ice.photo.has_save_moved_loc_link){return false;}
if($(ice.photo.search_location_text_input).value==ice.photo.noCoordinatesTxt){return true;}
var place=ice.photo.geocodeResult.Placemark[0];return($(ice.photo.search_location_text_input).value==place.address);}
ice.photo.onGeocodeReturn=function(response){if(response==false){if(ice.photo.show_drop_result_in_text_input){$(ice.photo.search_location_text_input).value=ice.photo.noCoordinatesTxt;}else{$('moved-loc-name').update(_("no matching location found, you can still save the coordinates"));}
ice.photo.hasPin=true;return;}
ice.photo.geocodeResult=response;var place=response.Placemark[0];if(ice.photo.show_drop_result_in_text_input){$(ice.photo.search_location_text_input).value=place.address;}else{$('moved-loc-name').update(place.address);}}
ice.photo.initContextBrowser=function(ctxSize,imageList){if(ctxSize==0){return;}
var streamOptions={urlParameters:{action:'stream_update'},availableImageCount:ctxSize,onSelection:function(){}};var stream=new PhotoStream('/go/ajax/pro/album_organizer',imageList,streamOptions);}
ice.photo.getGeocodedLocationParams=function(response,map){var params={};var latlng=map.photoMarker.getLatLng();params.latitude=latlng.lat();params.longitude=latlng.lng();if(!response){return params;}
var place=response.Placemark[0];if(place.address)params.address=place.address;var address=place.AddressDetails;if(address.Country){params.country=address.Country.CountryNameCode;if(address.Country.AdministrativeArea){var locality=null;params.region=address.Country.AdministrativeArea.AdministrativeAreaName;if(address.Country.AdministrativeArea.Locality){locality=address.Country.AdministrativeArea.Locality;}else if(address.Country.AdministrativeArea.SubAdministrativeArea){params.sub_region=address.Country.AdministrativeArea.SubAdministrativeArea.SubAdministrativeAreaName;if(address.Country.AdministrativeArea.SubAdministrativeArea.Locality){locality=address.Country.AdministrativeArea.SubAdministrativeArea.Locality;}}
if(locality){params.city=locality.LocalityName;if(locality.PostalCode){params.postal_code=locality.PostalCode.PostalCodeNumber;}
if(locality.Thoroughfare){params.thoroughfare=locality.Thoroughfare.ThoroughfareName;}}}}
return params;}
ice.photo.saveCustomLocation=function(elem,response,zoom,mCookie,map){var params=ice.photo.getGeocodedLocationParams(ice.photo.geocodeResult,map);params.action='save_geo_tag';params.magic_cookie=mCookie;params.photo_id=ice.photo.id;params.gps_overwrite=true;params.overwrite=true;params.coord_source=3;params.zoom=zoom;if($('custom-location-name').value!=""&&$('custom-location-name').value!=ice.photo.custom_location_name_default){params.custom_name=$('custom-location-name').value;}
var indicator=loading('');elem.insert({before:indicator});elem.hide();new Ajax.Request('/go/ajax/pro/tagging',{method:'post',onSuccess:function(transport){var result=eval('('+transport.responseText+')');if(typeof(result)=='object'){ice.photo.showLocationDisplay();ice.photo.location=new GLatLng(result.latitude,result.longitude);$('photo-location').update('in '+result.text);}else{$('photo-location').update('<div class="error-background">'+_("Couldn't set location, please try later.")+'</div>');}
indicator.remove();},parameters:params});}
ice.photo.saveCustomLocationOnPhotos=function(photoIds,mCookie,overwrite,zoom,map){var params=ice.photo.getGeocodedLocationParams(ice.photo.geocodeResult,map);params.action='set_location_on_photos';params.magic_cookie=mCookie;params.photo_ids=photoIds.toJSON();params.overwrite=overwrite;params.coord_source=3;params.zoom=zoom;if($('custom-location-name').value!=""&&$('custom-location-name').value!=ice.photo.custom_location_name_default){params.custom_name=$('custom-location-name').value;}
new Ajax.Request('/go/ajax/pro/tagging',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){$('photo-edit-feedback').update(_("Successfully added location."));}else{$('photo-edit-feedback').update(_("An unexpected error occured, please try again later."));}
highlightEffect($('photo-edit-feedback'));},parameters:params});}
ice.photo.initRating=function(value,rated,mCookie){var ratingAjaxOptions={method:'post',parameters:{action:'set',magic_cookie:mCookie,photo_id:ice.photo.id},onSuccess:function(transport){try{if(parseInt(transport.responseText)<0){throw _("Error saving rating");}else{$('rating-count').update(parseInt($('rating-count').innerHTML)+1);$('rating-feedback').addClassName('feedback-background');$('rating-feedback').update(_("Thank you!"));Effect.Appear('rating-feedback',{duration:0.8});}}catch(ex){$('rating-feedback').addClassName('error-background');$('rating-feedback').update(_("Unable to save your vote, please try again later"));}}};return new Control.Rating('rating',{max:5,value:value,rated:rated,updateUrl:'/go/ajax/pub/rating',ajaxOptions:ratingAjaxOptions,updateParameterName:'rating'});}
ice.photo.editLicense=function(licenseId,photoIds){var params={action:'edit_license_html',license_id:licenseId};if(Object.isArray(photoIds))params.photo_ids=photoIds.toJSON();if(!ice.photo.editLicenseWindow){ice.photo.editLicenseWindow=new FloatingWindow({dropShadow:true});}
ice.photo.editLicenseWindow.show({url:'/go/ajax/pro/edit_photo',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:params}});}
ice.photo.saveLicense=function(license,mCookie,photo_ids){if(ice.photo.id){photo_ids=false;}
if(Object.isArray(photo_ids)){photo_ids=photo_ids.toJSON();}
new Ajax.Updater('photo-license','/go/ajax/pro/edit_photo',{method:'post',onCreate:function(){if(photo_ids){$('photo-edit-feedback').update(loading(''));}else{$('photo-license').update(loading(''));}},onSuccess:function(transport){if(photo_ids){$('photo-edit-feedback').update(transport.responseText);highlightEffect($('photo-edit-feedback'));}else{highlightEffect($('photo-license'));}},parameters:{action:'set_photo_license',photo_ids:photo_ids||'['+ice.photo.id+']',magic_cookie:mCookie,license:license}});}
ice.photo.onEditKeywordTagsLoad=function(mCookie){$('tag-list').select('a.tag-delete').each(function(e){Event.observe(e,'click',function(){ice.tagging.removeAllKeywordTags(e.up().up().id.split('_')[1],mCookie);});});$('tag-list').select('td.tag-name').each(function(e){var color=e.up().hasClassName('colored')?'#F8F8F8':undefined;new Ajax.InPlaceEditor(e.down(),'/go/ajax/pro/tagging',{highlightcolor:'#99CCFF',highlightendcolor:color,callback:function(form,value){return'action=rename_keyword_tag&tag_id='+e.id.split('_')[1]+'&magic_cookie='+mCookie+'&old_name='+ice.tagging.tags[e.id.split('_')[1]]+'&new_name='+encodeURIComponent(value);},okText:_("ok"),cancelText:_("cancel"),clickToEditText:_("Click to edit"),loadingText:_("Loading..."),savingText:_("Saving...")});});}
ice.photo.onKeywordTagRenamed=function(preId,newId,name,tagUrl){ice.tagging.tags[newId]=name;ice.tagging.tags[preId]=undefined;$('tag-name_'+preId).id='tag-name_'+newId;$('tag-url_'+preId).id='tag-url_'+newId;$('tag-feedback_'+preId).id='tag-feedback_'+newId;$('tag-url_'+newId).href=tagUrl;}
ice.photo.showEditKeywordFeedback=function(tagId,msg,type){if(!type)type='info';$$('td.tag-feedback').each(function(e){e.innerHTML='';});$('tag-feedback_'+tagId).update('&nbsp;<span class="'+type+'">'+msg+'</span>');}
ice.tagging.removeAllKeywordTags=function(tagId,mCookie){if(!confirm('Are you sure you want to delete "'+ice.tagging.tags[tagId]+'" tag?'))return
var params={action:'remove_user_keyword_tag',tag_id:tagId,magic_cookie:mCookie};new Ajax.Request('/go/ajax/pro/tagging',{onCreate:function(){$('tag-feedback_'+tagId).update(loading(''));},onSuccess:function(transport){if(transport.responseText=='1'){$('tag-row_'+tagId).remove();$('tag-feedback_'+tagId).update('');}else{ice.photo.showEditKeywordFeedback(tagId,'An unexpected error occured, please try again later.','alert');}},parameters:params});}
ice.photo.onDefaultStreamLoad=function(){var highlightQL=function(evt){try{e=evt.element().parentNode.parentNode.adjacent('li.quick-links')[0];if(!e.visible())e.show();}catch(ex){}};var unhighlightQL=function(evt){try{evt.element().parentNode.parentNode.adjacent('li.quick-links')[0].hide();}catch(ex){}}
$('stream-list').select('.item-image').each(function(elem){var imgObj=elem.down().down();var liObj=elem.adjacent('li.quick-links')[0];Event.observe(imgObj,'mouseover',highlightQL);Event.observe(liObj,'mouseover',function(evt){evt.element().parentNode.show();});Event.observe(imgObj,'mouseout',unhighlightQL);Event.observe(liObj,'mouseout',function(evt){evt.element().parentNode.hide();});});$('stream-list').select('a.exif-info').each(function(e){new Tip(e.id,{title:e.previousSiblings()[0].title,ajax:{url:'/go/ajax/pub/photo_info',options:{parameters:{photo_id:e.id.split('_')[1]}}},border:4,radius:4,delay:0.2,width:'300px',hook:{mouse:true,tip:'topLeft'},stem:'topLeft',offset:{x:3,y:12}});});}
ice.photo.deleteFromAlbum=function(albumId,photoId,mCookie){var loadElem=new Element('li').insert(loading('Removing photo from album...'));$('in-album-list').insert(loadElem);var albumLi=$('in-album_'+albumId);albumLi.onmouseover=Prototype.emptyFunction;albumLi.onmouseout=Prototype.emptyFunction;albumLi.hide();Element.insert(albumLi,{before:loadElem});new Ajax.Request('/go/ajax/pro/album_organizer',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){albumLi.remove();if($('in-album-list').childElements().length==0){Element.extend($('in-album-list').parentNode).hide();}
loadElem.remove();}else{loadElem.remove();albumLi.show();Element.insert('add-to-album-link',{before:new Element('li').update(_("An error ocurred, please try again later."))});}},parameters:{action:'delete_photo_from_album',magic_cookie:mCookie,photo_id:photoId,album_id:albumId}});}
ice.photo.flag=function(element){var loadElem=loading('Saving...');element.insert({before:loadElem});element.hide();new Ajax.Request('/go/ajax/pro/edit_photo',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){element.update(_("Thank you for the report, we will review it as soon as possible."));}else{element.update(_("An unexpected error occured, please try again later."));}
loadElem.remove();element.show();highlightEffect(element);},parameters:{action:'flag',photo_id:ice.photo.id}});}
ice.photo.editTitleDesc=function(photoIds){if(!ice.photo.editTitleDescWindow){ice.photo.editTitleDescWindow=new FloatingWindow({dropShadow:true});}
ice.photo.editTitleDescWindow.show({url:'/go/ajax/pro/edit_photo',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{action:'edit_title_desc_html',photo_ids:photoIds.toJSON()}}});}
ice.photo.saveTitleDesc=function(title,enumerate,desc,mCookie,photoIds){new Ajax.Request('/go/ajax/pro/edit_photo',{onCreate:function(){$('photo-edit-feedback').update(loading(''));},onSuccess:function(transport){if(transport.responseText==1){$('photo-edit-feedback').update(_("Successfully updated title and description."));document.body.fire('photo-title-desc:changed',{photoIds:photoIds});}else{$('photo-edit-feedback').update(_("An unexpected error occured, please try again later."));}
highlightEffect($('photo-edit-feedback'));},parameters:{action:'set_title_desc',photo_ids:photoIds.toJSON(),magic_cookie:mCookie,title:title,enumerate:enumerate,desc:desc}});}
ice.photo.editPhotoTaken=function(photoIds){var params={action:'edit_taken_html',photo_id:ice.photo.id};if(Object.isArray(photoIds)){params.photo_ids=photoIds.toJSON();}
if(!ice.photo.editPhotoTakenWindow){ice.photo.editPhotoTakenWindow=new FloatingWindow({dropShadow:true});}
ice.photo.editPhotoTakenWindow.show({url:'/go/ajax/pro/edit_photo',modal:true,ajaxoptions:{parameters:params}});}
ice.photo.savePhotoTaken=function(photoIds,dateField,timeField,mCookie){var takenDate=dateField.value;var takenTime=timeField.value;if(takenDate.length==0&&takenTime==0){$('photo-taken-feedback').update(_("You need to enter a valid date or time!"));$('photo-taken-feedback').show();return false;}
var params={action:'set_taken_date',magic_cookie:mCookie,photo_ids:photoIds.toJSON()};if(takenDate.length>0&&!isValidDate(takenDate)){$('photo-taken-feedback').update(_("Invalid date, use <strong>mm/dd/yyyy</strong> format"));$('photo-taken-feedback').show();dateField.focus();return false;}else if(takenDate.length>0){params['taken_date']=takenDate;}
if(takenTime.length>0&&!isValidTime(takenTime)){$('photo-taken-feedback').update(_("Invalid time, use 24h (<strong>hh:mm:ss</strong>) format"));$('photo-taken-feedback').show();timeField.focus();return false;}else if(takenTime.length>0){params['taken_time']=takenTime;}
new Ajax.Request('/go/ajax/pro/edit_photo',{onSuccess:function(transport){if(transport.responseText==1){if($('photo-taken')){var element=$('photo-taken');var split=dateField.value.split('/');if(split.length==3)element.update(ice.month[split[0]-1]+' '+split[1].replace(/^[0]/,'')+', '+split[2]);}else{var element=$('photo-edit-feedback');element.update(_("Successfully updated photo taken date/time."));}}else{var element=$('photo-taken')||$('photo-edit-feedback');element.update(_("An unexpected error occured, please try again later."));}
highlightEffect(element);},parameters:params});if(ice.photo.editPhotoTakenWindow)ice.photo.editPhotoTakenWindow.hide();}
ice.photo.onPhotoTakenWindowHide=function(){ice.photo.photoTakenDatePicker.close();ice.photo.photoTakenDatePicker=false;if($('datepicker-taken-date'))$('datepicker-taken-date').remove();Event.stopObserving(ice.photo.editPhotoTakenWindow.getMainElement(),'window:hide',ice.photo.onPhotoTakenWindowHide);};ice.photo.editKeywordTags=function(photoIds){if(!ice.photo.editKeywordsWindow){ice.photo.editKeywordsWindow=new FloatingWindow({dropShadow:true});}
ice.photo.editKeywordsWindow.show({url:'/go/ajax/pro/edit_photo',modal:true,ajaxoptions:{parameters:{action:'edit_keywords_html',photo_ids:photoIds.toJSON()}}});}
ice.photo.editSafetyLevel=function(photoIds){var params={action:'edit_safety_level_html',photo_id:ice.photo.id};if(Object.isArray(photoIds))params.photo_ids=photoIds.toJSON();if(!ice.photo.editSafetyLevelWindow){ice.photo.editSafetyLevelWindow=new FloatingWindow({dropShadow:true});}
ice.photo.editSafetyLevelWindow.show({url:'/go/ajax/pro/edit_photo',modal:true,ajaxoptions:{evalScripts:true,parameters:params}});}
ice.photo.saveSafetyLevel=function(safetyLevel,mCookie,photoIds){var params={action:'set_safety_level',safety_level:safetyLevel,magic_cookie:mCookie};params.photo_ids=ice.photo.id?'['+ice.photo.id+']':photoIds.toJSON();new Ajax.Request('/go/ajax/pro/edit_photo',{onCreate:function(){$('photo-edit-feedback').update(loading(''));},onSuccess:function(transport){if(transport.responseText==1){$('photo-edit-feedback').update(_("Successfully updated safety level."));}else{$('photo-edit-feedback').update(_("An unexpected error occured, please try again later."));}
highlightEffect($('photo-edit-feedback'));},parameters:params});}
ice.photo.showRecentFromConnections=function(view,page,maxDisplayed,viewParams){if(!page)page=1;var indicator=$('indicator-box');var params={type:'contacts_recent',max_displayed:maxDisplayed,page:page,stream_view:view,stream_params:viewParams};new Ajax.Request('/go/ajax/pub/photostreams',{method:'post',onCreate:function(){if(indicator){setCenterInElement(indicator,$('recent-photos'));indicator.show();}},onSuccess:function(transport){var result=eval('('+transport.responseText+')');if(typeof(result)=='object'){$('stream').update(result.stream_content);$('recent-navigator').update(pageNavigator(function(p){ice.photo.showRecentFromConnections(view,p,maxDisplayed,viewParams);},page,result.photo_count,maxDisplayed,_("Viewing %d-%d of %d photos")));$('feedback').update('');Lightview.updateViews();}else{$('feedback').update(_("An unexpected error occurred, please try again"));new Effect.Highlight($('feedback'),{delay:.1,duration:3,startColor:'#fff',endColor:'#f00'});}
if(indicator)indicator.hide();},parameters:params});}
ice.photo.getRecentLocations=function(container,list,callback){var indicator=loading('');new Ajax.Request('/go/ajax/pro/tagging',{parameters:{action:'get_recent_locations'},onCreate:function(){container.insert(indicator);container.show();},onSuccess:function(transport){indicator.remove();var response=transport.responseText.evalJSON(true);var mCookie=response.magic_cookie;if(Object.isArray(response.locations)){var locations=response.locations;list.update('');for(var i=0;i<locations.length;i++){var li=new Element('li',{id:'rec-loc_'+locations[i].location_id,className:'list-option'}).setStyle({padding:'0 0 0 10px'});var setLink=new Element('a',{href:'javascript:;'}).update(ice.location_search.locationString(locations[i]));if(Object.isFunction(callback)){setLink.observe('click',callback.bind(this,locations[i]));}else{setLink.observe('click',function(event){ice.photo.saveLocationFromAutoComplete(undefined,event.element().parentNode,mCookie);});}
li.insert(setLink);li.insert(' ');var mapLink=new Element('a',{href:'javascript:;',onmouseover:'hoverMap(this, event, '+locations[i].latitude+', '+locations[i].longitude+', { width:\'100px\', height:\'100px\' })'}).update(_("(map)"));li.insert(mapLink);list.insert(li);}}else{list.update("<li>"+_("An unknown error occured, please try later.")+"</li>");}}});}
ice.photo.saveLocationZoom=function(mCookie){var indicator=loading('');$('loc-z-help').insert({before:indicator});$('loc-z-save').hide();new Ajax.Request('/go/ajax/pro/tagging',{parameters:{action:'save_location_zoom',zoom:ice.photo.map.getZoom(),photo_id:ice.photo.id,magic_cookie:mCookie},onSuccess:function(transport){indicator.remove();if(transport.responseText!='1'){$('photo-location').update('<span class="error-background">'+_("An unknown error occured, please try later.")+'</span>');}
$('loc-z-help').show();}});}
ice.photo.editPhotoLocation=function(photoIds){if(!ice.photo.editPhotoLocationWindow){ice.photo.editPhotoLocationWindow=new FloatingWindow({dropShadow:true});}
ice.photo.editPhotoLocationWindow.show({url:'/go/ajax/pro/edit_photo',modal:true,ajaxoptions:{parameters:{action:'edit_photo_location_html',photo_ids:photoIds.toJSON()}}});}
ice.photo.saveLocationOnPhotos=function(photoIds,location,mCookie,overwrite,zoom,google_loc){var params={action:'set_location_on_photos',magic_cookie:mCookie,photo_ids:photoIds.toJSON(),location_id:location.location_id,overwrite:overwrite,zoom:zoom,google_loc:google_loc};new Ajax.Request('/go/ajax/pro/tagging',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){$('photo-edit-feedback').update(_("Successfully added location."));}else{$('photo-edit-feedback').update(_("An unexpected error occured, please try again later."));}
highlightEffect($('photo-edit-feedback'));},parameters:params});}
ice.photo.fixCanvasProfilePictures=function(){if(Prototype.Browser.IE)return;for(var i=0;i<ice.photo.contactAnnotations.length;i++){var li=$('idt-tag-id_'+ice.photo.contactAnnotations[i].id);if(!li)continue;li.select('.idt-photo').each(function(e){if(!e.src.endsWith('profile_photo_s.gif'))return;var profileImg=new Element('canvas',{width:'50px',height:'50px',className:'idt-photo'});var ctx=profileImg.getContext("2d");var img=new Image();Event.observe(img,'load',ice.photo.drawProfilePicFromAnnotation.bind(this,ctx,img,ice.photo.contactAnnotations[i]));img.src=$('photo_'+ice.photo.id).src;e.replace(profileImg);});}}
ice.photo.drawProfilePicFromAnnotation=function(ctx,img,annotation){var rect=annotation.annotation.rect;ctx.drawImage(img,rect.left,rect.top,rect.width,rect.height,0,0,50,50);}
ice.photo.toggleKeywordTagControls=function(event){if($('keyword-tag-list').select('li').length>=101){$('keyword-tagging-feedback').update(_("Maximum number of keyword tags reached for this photo."));$('keyword-tagging-feedback').show();highlightEffect($('keyword-tagging-feedback'));return;}
$('keyword-tagging-controls').toggle();$('keyword-tag-input').focus();}
ice.photo.addPhotosTaggedToStack=function(tagId,ownerId){new Ajax.Request('/go/ajax/pro/tagging',{parameters:{action:'photos_keyword_tagged',tag_id:tagId,owner_id:ownerId},onSuccess:function(transport){var result=transport.responseText.evalJSON(true);if(Object.isArray(result)){ice.photo.addToStack(result);}}});}
ice.photo.restoreThumbnails=function(photo_id,refresh_url){if(!ice.photo.restoreThumbnailsWindow){ice.photo.restoreThumbnailsWindow=new FloatingWindow({dropShadow:true,disableClose:true});}
ice.photo.restoreThumbnailsWindow.show({url:'/go/ajax/pro/restore_thumbnails',modal:true,ajaxoptions:{evalScripts:true,parameters:{photo_id:photo_id,refresh_url:refresh_url}}});}
ice.photo.restoreThumbnailsStart=function(photo_id,magic_cookie){$('restore-warning').hide();$('restore-start').hide();$('restore-fail').hide();$('restore-progress').show();new Ajax.Request('/go/ajax/pro/restore_thumbnails/start',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){$('restore-progress').hide();$('restore-start').hide();$('restore-done').show();$('restore-success').show();}else{$('restore-progress').hide();$('restore-warning').show();$('restore-start').show();$('restore-fail').show();}},parameters:{photo_id:photo_id,magic_cookie:magic_cookie}});return false;}
ice.photo.rotateThumbnails=function(photo_id,refresh_url){if(!ice.photo.rotateThumbnailsWindow){ice.photo.rotateThumbnailsWindow=new FloatingWindow({dropShadow:true,disableClose:true});}
ice.photo.rotateThumbnailsWindow.show({url:'/go/ajax/pro/rotate_thumbnails',modal:true,ajaxoptions:{evalScripts:true,parameters:{photo_id:photo_id,refresh_url:refresh_url}}});}
ice.photo.rotateThumbnailsStart=function(photo_id,degrees){$('rotate-warning').hide();$('rotate-start').hide();$('rotate-fail').hide();$('rotate-choice').hide();$('rotate-progress').show();new Ajax.Request('/go/ajax/pro/rotate_thumbnails/start',{method:'post',onSuccess:function(transport){if(transport.responseText=='1'){$('rotate-progress').hide();$('rotate-start').hide();$('rotate-choice').show();$('rotate-links').hide();$('rotate-done').show();$('rotate-success').show();}else{$('rotate-progress').hide();$('rotate-warning').show();$('rotate-choice').show();$('rotate-start').show();$('rotate-fail').show();}},parameters:{photo_id:photo_id,degrees:degrees}});return false;}
ice.photo.getEditSelection=function(){var ids=new Array();$$('li.stream-entry-edit-selected').each(function(e){var split=e.id.split('_');var val=undefined;if(split.length==2&&!isNaN(val=parseInt(split[1]))){ids.push(val);}});if(ids.length<1)return ice.photo.editIds;return ids;}
ice.photo.updateEditSelection=function(){if(ice.photo.editSelectionCount==0){$('selection-feedback').update();}else{var clrLink='<a href="javascript:;" onclick="$$(\'li.stream-entry-edit-selected\').each(function(e){ e.removeClassName(\'stream-entry-edit-selected\');e.addClassName(\'stream-entry-edit\');ice.photo.editSelectionCount--;$(\'selection-feedback\').update(\'&nbsp;\');});">'+_("Clear Selections")+'</a>';var photo_count_str=_sp("%d photo selected","%d photos seleted",ice.photo.editSelectionCount);$('selection-feedback').update(photo_count_str+' | '+clrLink+' | ');}}
ice.photo.editPrivacy2=function(photoIds){if(!ice.photo.editPrivacyWindow){ice.photo.editPrivacyWindow=new FloatingWindow({dropShadow:true});}
var params={action:'photo'};if(ice.photo.id)params['photo_id']=ice.photo.id;if(Object.isArray(photoIds))params['photo_ids']=photoIds.toJSON();ice.photo.editPrivacyWindow.show({url:'/go/ajax/pro/add_privacy',modal:true,ajaxoptions:{method:'post',parameters:params}});}
ice.photo.onPhotoPrivacyChange=function(value){value==50?$('privacy-container').show():$('privacy-container').hide();}
ice.photo.savePrivacy=function(privacy,mCookie,photoIds,callback){var photo_ids=Object.isArray(photoIds)?photoIds.toJSON():false;var params={action:'set_privacy',photo_ids:photo_ids||'['+ice.photo.id+']',magic_cookie:mCookie,privacy:privacy};new Ajax.Request('/go/ajax/pro/edit_photo',{method:'post',onCreate:function(){$('privacy-dropdown').hide();$('privacy-controls').hide();$('privacy-container').hide();$('privacy-feedback').show();},onSuccess:function(transport){if(transport.responseText=='1'){if(photo_ids){$('photo-edit-feedback').update(_("Successfully changed privacy of your selected photos."));highlightEffect($('photo-edit-feedback'));}else{$('pp-container').down('img').src=ice.privacyIcons[privacy];$('pp-container').down('span').update(ice.privacyText[privacy]);privacy==50?$('photo-acl-details').show():$('photo-acl-details').hide();ice.photo.addAclDetailsTip();highlightEffect($('pp-container'));}
document.body.fire('photo-privacy:changed',{photoIds:photo_ids,privacy:privacy});if(Object.isFunction(callback))callback();}else{$('privacy-feedback').update('<span class="error-background">'+_("Unkown error occured, please try again later")+'</span>');}},parameters:params});}
ice.photo.addAclDetailsTip=function(){var elem=$('photo-acl-details');if(!elem||!elem.visible())return;new Tip(elem,{title:'<div style="text-align:center;">'+_("Who can see this photo?")+'</div>',radius:2,hook:{mouse:true,tip:'topLeft'},stem:'topLeft',offset:{x:3,y:12},ajax:{url:'/go/ajax/pro/acl',options:{parameters:{action:'get_photo_acl_details',photo_id:ice.photo.id}}}});}
ice.photo.editDefaultPrivacy=function(type){if(!ice.photo.editPrivacyWindow){ice.photo.editPrivacyWindow=new FloatingWindow({dropShadow:true});}
ice.photo.editPrivacyWindow.show({url:'/go/ajax/pro/settings',modal:true,ajaxoptions:{method:'post',evalScripts:true,parameters:{action:'edit_default_privacy',type:type}}});}
ice.photo.loadPrivacyTooltips=function(){$$('div.privacy-icon-custom').each(function(elem){new Tip(elem,{title:'<div style="text-align:center;">'+_("Who can see this photo?")+'</div>',radius:2,hook:{mouse:true,tip:'topLeft'},stem:'topLeft',offset:{x:3,y:12},ajax:{url:'/go/ajax/pro/acl',options:{parameters:{action:'get_photo_acl_details',photo_id:elem.id.split('_')[1]}}}});});}
ice.photo.photoLightViewPrevious=function(){if(!ice.photo.lightViewPrevious)return false;if(ice.photo.lightViewPrevious.length<1)return false;ice.photo.photoLightViewNext(ice.photo.lightViewPrevious.pop());}
ice.photo.photoLightViewNext=function(hash){if(ice.photo.photoLightUpdating)return false;ice.photo.photoLightUpdating=true;if(Object.isString(hash)){hash=ice.queryStringToHash(hash);ice.photo.lightViewNextId=hash.photo;ice.photo.lightViewContext=hash.context;ice.photo.lightViewContextParams={};ice.photo.lightViewContextParams=$H(hash).keys().each(function(key){if(key!='photo'&&key!='context')ice.photo.lightViewContextParams[key]=hash[key];});if(ice.photo.lightViewPrevious){var hashQueryString=window.location.hash.replace(/^.*#/,'');var preIdx=ice.photo.lightViewPrevious.indexOf(hashQueryString);if(preIdx>=0){ice.photo.lightViewPrevious.splice(preIdx,ice.photo.lightViewPrevious.length-preIdx);}}}else{if(!ice.photo.lightViewPrevious)ice.photo.lightViewPrevious=[];var hashQueryString=window.location.hash.replace(/^.*#/,'');var preIdx=ice.photo.lightViewPrevious.indexOf(hashQueryString);if(preIdx>=0){ice.photo.lightViewPrevious.splice(preIdx,ice.photo.lightViewPrevious.length-preIdx);}else{ice.photo.lightViewPrevious.push(hashQueryString);}}
if(ice.photo.lightViewPrevious&&ice.photo.lightViewPrevious.length>0){$('pre-photo-link').removeClassName('s-img-disabled');}else{$('pre-photo-link').addClassName('s-img-disabled');}
if(!ice.photo.lightViewNextId){ice.photo.photoLightUpdating=false;return false;}
var indicator=new FloatingWindow({dropShadow:true,disableClose:true});indicator.show({indicator:true});var params=ice.photo.lightViewContextParams;params['type']='light';params['photo_id']=ice.photo.lightViewNextId;params['context']=ice.photo.lightViewContext;new Ajax.Request('/go/ajax/pub/get_photos',{parameters:params,onFailure:function(){indicator.hide();if(!Object.isUndefined(userId)){window.location.href=window.location.href.substring(0,window.location.href.indexOf('/photos/')+7);}else{window.location.href='http://'+window.location.host+'/go/login';}},onSuccess:function(transport){var response=transport.responseText.evalJSON(true);if(response.next_photo&&response.next_photo.id)ice.photo.lightViewNextId=response.next_photo.id;var imgLoadFunc=function(){ice.photo.updateLightPhotoView(response);if(response.context_info){var clink=$('context-link').update(response.context_title);clink.href=response.context_url;$('context-info').update(response.context_info);$('context-container').show();}
ice.photo.updateLightUser(response.user);ice.photo.updateLightComments(response.comments);ice.photo.updateLightTags(response.tags);ice.photo.updateLightIdentities(response.identities);ice.photo.lightViewSet=response;indicator.hide();if(response.next_photo){ice.photo.lightViewSet.next_photo.imgObject=new Image();ice.photo.lightViewSet.next_photo.imgObject.onload=function(){ice.photo.lightViewSet.next_photo.loaded=true;}
ice.photo.lightViewSet.next_photo.imgObject.src=response.next_photo.url;$('next-photo-link').removeClassName('s-img-disabled');}else{$('next-photo-link').addClassName('s-img-disabled');}
ice.photo.lightViewSet=response;ice.photo.photoLightUpdating=false;}
if(ice.photo.lightViewSet&&ice.photo.lightViewSet.next_photo&&ice.photo.lightViewSet.next_photo.id==response.id&&ice.photo.lightViewSet.next_photo.imgObject&&!ice.photo.lightViewSet.next_photo.loaded){ice.photo.lightViewSet.next_photo.imgObject.onload=imgLoadFunc;}else if(ice.photo.lightViewSet&&ice.photo.lightViewSet.next_photo&&ice.photo.lightViewSet.next_photo.id==response.id&&ice.photo.lightViewSet.next_photo.imgObject&&ice.photo.lightViewSet.next_photo.loaded){imgLoadFunc();}else{var img=new Image();img.onload=imgLoadFunc;img.src=response.url;}}});}
ice.photo.updateLightUser=function(user){if(ice.photo.userId==user.id)return;ice.photo.userId=user.id;$('user-badge-container').update(user.user_badge);var reAReplace=new RegExp('http:\/\/'+window.location.host+'\/[^\/]+\/',"i");$('boxmenu-container').select('li').each(function(elem){var aTag=elem.down();aTag.href=aTag.href.replace(reAReplace,'http://'+window.location.host+'/'+user.username+'/');});$('bm-user-fullname').update(user.fullname);}
ice.photo.updateLightPhotoView=function(photo){var img=$('photo-area').down('img');img.setAttribute('src',photo.url);img.setAttribute('id','photo_'+photo.id);img.setStyle({width:photo.width+'px',height:photo.height+'px'});$('title-container').update(photo.title);$('desc-container').update(photo.desc);var ratingAjaxOptions={parameters:{action:'set',magic_cookie:photo.rating_cookie,photo_id:photo.id},onSuccess:function(transport){try{if(parseInt(transport.responseText)<0){throw _("Error saving rating");}else{$('rating-count').update(parseInt($('rating-count').innerHTML)+1);$('rating-feedback').addClassName('feedback-background');$('rating-feedback').update(_("Thank you!"));Effect.Appear('rating-feedback',{duration:0.8});}}catch(ex){$('rating-feedback').addClassName('error-background');$('rating-feedback').update(_("Unable to save your vote, please try again later"));}}};var newRatingDiv=new Element('div',{className:'rating_container right'});var ratingDiv=$('rating');ratingDiv.insert({before:newRatingDiv});ratingDiv.remove();newRatingDiv.setAttribute('id','rating');$('rating-count').update(photo.rating);$('rating-feedback').hide();ice.photo.ratingControl=new Control.Rating('rating',{max:5,value:photo.rating,rated:photo.is_rated=='true',updateUrl:'/go/ajax/pub/rating',ajaxOptions:ratingAjaxOptions,updateParameterName:'rating'});$('photo-license').update(ice.photo.licenseText[photo.license]);$('photo-taken').update(photo.photo_taken);$('photo-views').update(photo.views);ice.photo.id=photo.id;var lHash=new ICELocationHash();var context=lHash.get('context');var contextId=lHash.get('context_id');$('detail-link').href='/'+photo.user.username+'/photos/'+photo.id+(context?'/in/'+context+(contextId?'/'+contextId:''):'');photo.flaggable?$('flag-container').show():$('flag-container').hide();var hashQuery=$H({photo:photo.id,context:context,context_id:contextId}).toQueryString()
jQuery.historyLoad(hashQuery);}
ice.photo.updateLightComments=function(comments){var container=$('comments');container.update('');if(!Object.isArray(comments)){$('comments-summary').update(_("No comments"));return;}
$('comments-summary').update(comments.length>0?((comments.length==1?_("One comment"):comments.length+_(" comments"))+_(" so far...")):_("No comments"));comments.each(function(e){var c=new Element('div',{id:'comment_'+e.id,className:'photo-comment'});c.insert(new Element('div',{className:'photo-comment-user-pic'}).update(e.user_badge));var h=new Element('div',{className:'photo-comment-posted-by'});h.insert(new Element('a',{href:'/'+e.username}).setStyle({fontWeight:'bold'}).update(e.fullname));var ago_text=_s("&nbsp;posted&nbsp;%s&nbsp;ago&nbsp;",'<acronym title="'+e.created+'">'+e.created_ago+'</acronym>');var info=new Element('span',{className:'smallgrey'}).insert(ago_text);info.insert(e.remove);h.insert(info);c.insert(h);c.insert(new Element('div',{className:'photo-comment-message'}).update(e.message));container.insert(c);});}
ice.photo.updateLightTags=function(tags){if(!Object.isArray(tags)){$('keyword-tags-container').hide();return;}
if(tags.length==0){$('keyword-tags-container').hide();}else{var html=[];tags.each(function(tag){html.push('<a href="'+tag.url+'" title="'+_("Tagged by")+' '+tag.tagged_by+'">'+tag.tag+'</a>');});$('keyword-tags').update(html.join(', '));$('keyword-tags-container').show();}}
ice.photo.updateLightIdentities=function(identities){if(Object.isArray(ice.photo.contactAnnotations))ice.photo.contactAnnotations.each(function(o){o.destroy();});ice.photo.contactAnnotations=[];if(!Object.isArray(identities)){$('identities-container').hide();return;}
if(identities.length==0){$('identities-container').hide();return;}
idtList=$('idt-tag-list');idtList.update();identities.each(function(identity){var li=new Element('li',{id:'idt-tag-id_'+identity.id}).setStyle({paddingBottom:'2px'});li.insert(new Element('a',{href:identity.photos_url,title:_("View all photos of ")+identity.name}).insert(new Element('img',{src:identity.pic_url,alt:identity.name}).setStyle({width:'25px',height:'25px',marginRight:'5px',float:'left'})));li.insert(new Element('div').setStyle({float:'left',overflow:'hidden',width:'119px'}).insert(new Element('a',{href:identity.identity_url}).setStyle({fontWeight:'bold'}).update(identity.name)));li.observe('mouseover',function(){ice.photo.highlightIdentityTag(identity.id);});li.observe('mouseout',function(){ice.photo.unhighlightIdentityTag(identity.id);});idtList.insert(li);ice.photo.contactAnnotations.push(new ContactAnnotation('photo-area',{width:identity.width,height:identity.height,top:identity.top,left:identity.left},{id:identity.id,hidden:true},{id:identity.identity_id,name:identity.name}));});$('identities-container').show();}
ice.photo.getFavoritees=function(photo_id,obj,view){new Ajax.Updater(obj,'/go/ajax/pub/get_favoritees',{method:'get',parameters:{photo_id:photo_id,container:obj,view:view},evalScripts:true});return false;}
ice.location_search={};ice.location_search.photo_autocompleter_google_locations=null;ice.location_search.loadGoogleSearch=function(){ice.location_search.google_search=new GlocalSearch();ice.location_search.google_search.setNoHtmlGeneration();ice.location_search.google_search.setResultSetSize(GSearch.LARGE_RESULTSET);}
ice.location_search.searchLocation=function(search_str,params,onGlocalSearchCompleteCallback){ice.location_search.googleSearch(search_str,params,onGlocalSearchCompleteCallback,ice.location_search.onSearchLocationComplete);}
ice.location_search.googleSearch=function(search_str,params,onGlocalSearchCompleteCallback,callbackMethod){if(search_str.length<4){ice.location_search.skipSearch(search_str,params,onGlocalSearchCompleteCallback);}else{ice.location_search.google_search.setSearchCompleteCallback(null,callbackMethod,[search_str,params,onGlocalSearchCompleteCallback]);ice.location_search.google_search.execute(search_str);}}
ice.location_search.skipSearch=function(search_str,params,onGlocalSearchCompleteCallback){var locations=new Array();onGlocalSearchCompleteCallback(locations,search_str,params);}
ice.location_search.onSearchLocationComplete=function(search_str,params,onGlocalSearchCompleteCallback){var results=ice.location_search.google_search.results;var locations=ice.location_search.restructureGLocalResults(results);ice.location_search.google_search.clearResults();onGlocalSearchCompleteCallback(locations,search_str,params);}
ice.location_search.isGoogleLocation=function(location_id){if(location_id==""){return false;}
return(location_id.substring(0,3)=='goo');}
ice.location_search.getGoogleLoc=function(location_id,li,null_value){if(ice.location_search.isGoogleLocation(location_id)){return li.down("input").value;}else{return null_value;}}
ice.location_search.locationString=function(location){if(location.name&&location.name!=""){var name=location.name;}else{var name=false;}
if(location.city_name&&location.city_name!=""){var city=location.city_name;}else{var city=false;}
if(location.region_name&&location.region_name!=""){var region=location.region_name;}else{var region=false;}
if(location.country_name&&location.country_name!=""){var country=location.country_name;}else{var country=false;}
var result="";if(name){result+=name;if(city&&city!=name&&name.substring(name.length-city.length)!=city){result+=', '+city;}}else if(city){result+=city;}
if(region){result+=' ('+region+')';}
if(country){result+=', '+country;}
if(result==""&&location.latLngStr){result=location.latLngStr;}
return result;}
ice.location_search.restructureGLocalResults=function(results){var locations=new Array();if(results.length<1){return locations;}
for(var i=0;i<results.length;i++){var res=results[i];var loc_obj={};if(res.city==""){continue;}else if(res.phoneNumbers){continue;}
if(res.titleNoFormatting==res.streetAddress){res.streetAddress="";}
if(res.titleNoFormatting==res.city){res.titleNoFormatting="";}
var city_part=", "+res.city;var city_part_start=res.titleNoFormatting.length-city_part.length;if(city_part_start>2&&res.titleNoFormatting.substring(city_part_start)==city_part){res.titleNoFormatting=res.titleNoFormatting.substring(0,city_part_start);}
var region_part=", "+res.region;var region_part_start=res.titleNoFormatting.length-region_part.length;if(region_part_start>2&&res.titleNoFormatting.substring(region_part_start)==region_part){res.titleNoFormatting=res.titleNoFormatting.substring(0,region_part_start);}
loc_obj['name']=res.titleNoFormatting;loc_obj['city_name']=res.city;loc_obj['country_name']=res.country;loc_obj['region_name']=res.region;loc_obj['latitude']=res.lat;loc_obj['longitude']=res.lng;loc_obj['address']=res.streetAddress;locations.push(loc_obj);}
return locations;}
ice.location_search.geocode=function(latlng,callback){if(!ice.location_search.geocoder)ice.location_search.geocoder=new GClientGeocoder();ice.location_search.geocoder.getLocations(latlng,function(response){if(response.Status.code!=200){callback(false);}else{var place=response.Placemark[0];callback(response);}});}
ice.user.badgeShowTimeOut={};ice.user.badgeHideTimeOut={};ice.user.showUserBadge=function(id,userId){if(ice.user.badgeHideTimeOut[id])clearTimeout(ice.user.badgeHideTimeOut[id]);ice.user.badgeShowTimeOut[id]=setTimeout(function(){ice.user.getUserBadge(userId,id);},250);}
ice.user.hideUserBadge=function(id){if(ice.user.badgeShowTimeOut[id])clearTimeout(ice.user.badgeShowTimeOut[id]);ice.user.badgeHideTimeOut[id]=setTimeout(function(){$(id).hide();},250);}
ice.user.getUserBadge=function(user_id,user_badge_id){if($(user_badge_id).innerHTML==''){new Ajax.Request('/go/ajax/pub/user_badge',{method:'get',onSuccess:function(transport){$(user_badge_id).innerHTML='<div class="drop-shadow"></div>'+transport.responseText;$(user_badge_id).show();},parameters:{uid:user_id}});}else{$(user_badge_id).show();}
return false;}
ice.user.initLocationMap=function(){if(GBrowserIsCompatible()){if(ice.user.location){var elem=$('user-location-map');ice.user.map=new google.maps.Map2(elem);ice.user.map.setCenter(ice.user.location,4);ice.user.map.addOverlay(new GMarker(ice.user.location));}else{var elem=$('user-location-map');ice.user.map=new google.maps.Map2(elem);ice.user.map.setCenter(new GLatLng(34,0),1);ice.user.map.addControl(new google.maps.SmallZoomControl());}}}
ice.user.updateLocationMap=function(latitude,longitude){if(GBrowserIsCompatible()){var zoom=4;ice.user.location=new GLatLng(latitude,longitude)
if(latitude==34&&longitude==0){zoom=1;}
if(!ice.user.map){ice.user.initLocationMap();}else{ice.user.map.clearOverlays();ice.user.map.setCenter(ice.user.location,4);if(zoom>1){ice.user.map.addOverlay(new GMarker(ice.user.location));}}}}
ice.user.redeemCode=function(code){var result=false;if(code=='')return false;new Ajax.Request('/go/ajax/pro/get_code_content',{method:'get',onSuccess:function(transport){result=confirm(transport.responseText);},asynchronous:false,parameters:{code:code}});return result;}
ice.upload.completedIds=undefined;ice.upload.basicElements=undefined;ice.upload.startTime=undefined;ice.upload.uploadItems=undefined;ice.upload.totalBytes=0;ice.upload.totalBytesUploaded=0;ice.upload.estimatedKbps=0;ice.upload.cancelled=false;ice.upload.confirmExit=false;ice.upload.failedFileObjIds=new Array();ice.upload.acl={};ice.upload.defaultPrivacy=0;ice.upload.selectedAlbum=0;ice.upload.startBasicUpload=function(mCookie,albumId){if($('new-album').visible()&&!albumId){ice.album.createNewAlbum(mCookie,function(albumId){ice.upload.startBasicUpload('',albumId);});return;}else if(parseInt($F('album-selection'))>0&&!albumId){albumId=parseInt($F('album-selection'));}
if(parseInt(albumId)>0){ice.upload.selectedAlbum=albumId;}
ice.upload.basicElements=new Array();ice.upload.completedIds=new Array();if($F('file1').length>0)ice.upload.basicElements.push('file1');if($F('file2').length>0)ice.upload.basicElements.push('file2');if($F('file3').length>0)ice.upload.basicElements.push('file3');if($F('file4').length>0)ice.upload.basicElements.push('file4');if($F('file5').length>0)ice.upload.basicElements.push('file5');if(ice.upload.basicElements.length==0)return;$('file-inputs').hide();$('upload-indicator').show();for(var i=0;i<ice.upload.basicElements.length;i++){ice.upload.iframeFileUpload(ice.upload.basicElements[i],'/go/ajax/pub/upload',function(result){var matches=false;if(matches=/(\d+)/.exec(result)){ice.upload.completedIds.push(matches[1]);}
ice.upload.basicElements.pop();if(ice.upload.basicElements.length==0){$('upload-indicator').hide();$('upload-completed').show();}});}}
ice.upload.iframeFileUpload=function(field,url,onComplete){field=$(field).cloneNode(true);$(field).removeAttribute('id');$(field).name='Filedata';var targetId=new Date().getTime();var form=new Element('form',{name:'uploadForm',action:url,target:'uploadFrame_'+targetId,enctype:'multipart/form-data',method:'post'});form.insert(new Element('input',{type:'hidden',name:'privacy',value:ice.upload.defaultPrivacy}));if(ice.upload.acl){form.insert(new Element('input',{type:'hidden',name:'privacy_custom',value:new Hash(ice.upload.acl).toJSON()}));}
form.insert(new Element('input',{type:'hidden',name:'license',value:$F('default_license')}));var safetyLevel=$('upload_form').getInputs('radio','safety_level').find(function(e){return e.checked;});if(safetyLevel){form.insert(new Element('input',{type:'hidden',name:'safety_level',value:safetyLevel.value}));}
if(ice.upload.selectedAlbum){form.insert(new Element('input',{type:'hidden',name:'album_id',value:ice.upload.selectedAlbum}));}
form.insert($(field));var hiddenForm=new Element('div').setStyle({display:'none'});hiddenForm.insert(form);var iframe=new Element('iframe',{name:'uploadFrame_'+targetId,width:'0',height:'0',border:'0'}).setStyle({width:'0',height:'0',border:'none'});document.body.insert(hiddenForm);document.body.insert(iframe);window.frames[window.frames.length-1].name=iframe.name;var func=function(){if(Object.isFunction(onComplete)){onComplete(iframe.contentWindow.document.body.innerHTML);}
iframe.stopObserving('load',func);setTimeout(function(){hiddenForm.remove();iframe.remove();},1000);};iframe.observe('load',func);form.submit();}
ice.upload.initAdvUploader=function(sessionId){if(typeof(SWFUpload)==="undefined"){$('upload-loading').hide();$('upload-loading-failed').show();}
ice.upload.uploadItems=new Array();ice.upload.completedIds=new Array();ice.upload.uploader=new SWFUpload({flash_url:"/js/third_party/swfupload/swfupload.swf",upload_url:"/go/ajax/pub/upload",post_params:{"PHPSESSID":sessionId,"MAX_FILE_SIZE":"20971520"},file_types:"*.jpg;*.jpeg;*.png;*.gif;*.JPG;*.JPEG;*.PNG;*.GIF",file_types_description:"Images",file_size_limit:"20480",swfupload_loaded_handler:ice.upload.loadedHandler,file_queued_handler:ice.upload.fileQueuedHandler,upload_start_handler:ice.upload.startHandler,upload_progress_handler:ice.upload.progressHandler,upload_complete_handler:ice.upload.completeHandler,upload_success_handler:ice.upload.successHandler,button_image_url:"/js/third_party/swfupload/images/click_select_files-"+window.usr_lang+".gif",button_placeholder_id:"swfupload-insertion",button_width:400,button_height:28,button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT,button_cursor:SWFUpload.CURSOR.HAND,minimum_flash_version:"9.0.28",swfupload_pre_load_handler:Prototype.emptyFunction,swfupload_load_failed_handler:function(){$('swfu-container').hide();$('upload-loading-failed').show();},debug:false});ice.upload.uploader.customSettings.fileContainer=$('fileContainer');Event.observe($('create-new-album'),'click',function(){$('album-selection').value='0';$('new-album').show();});Event.observe($('album-selection'),'change',function(evt){$('new-album').hide();$('album-title-field').value='';$('album-desc-field').value='';});ice.upload.loadingTimeoutId=setTimeout(function(){$('upload-loading').hide();$('upload-loading-timeout').show();},90000);}
ice.upload.loadedHandler=function(){if(ice.upload.loadingTimeoutId)clearTimeout(ice.upload.loadingTimeoutId);$('upload-loading').remove();}
ice.upload.startHandler=function(fileObj){ice.upload.startTime=new Date().getTime();if(ice.upload.debug)$('upload-debug').innerHTML+="<br/>"+_("Upload start")+" "+fileObj.name;return true;}
ice.upload.fileQueuedHandler=function(fileObj){if(!$('upload-settings').visible()){$('used-storage').hide();$('used-bandwidth').hide();ice.upload.uploader.setButtonImageURL('/js/third_party/swfupload/images/add_more.gif');ice.upload.uploader.setButtonDimensions(100,22);$('swfu-container').removeClassName('swfu-container');$('swfu-container').setStyle({top:'326px',left:'93px',width:'105px'});$('upload-settings').show();$('upload_header').show();$('upload_footer').show();}
ice.upload.uploadItems.push(new UploadItem(fileObj,this.customSettings.fileContainer));ice.upload.updateFileInformation();$('startUploadLink').style.display='';}
ice.upload.updateFileInformation=function(){ice.upload.totalBytes=0;ice.upload.uploadItems.each(function(obj){ice.upload.totalBytes+=obj.fileObj.size;});$('total-filesize').update(humanFileSize(ice.upload.totalBytes));$('total-added-files').update(ice.upload.uploadItems.length+_(" files"));}
ice.upload.progressHandler=function(fileObj,bytesUploaded,fileTotalBytes){var currentTime=new Date().getTime();var kBps=0;if(bytesUploaded<204800&&ice.upload.totalBytesUploaded>0){kBps=ice.upload.estimatedKbps;}else{kBps=(bytesUploaded/1024)/((currentTime-ice.upload.startTime)/1000);ice.upload.estimatedKbps=kBps;}
var eta;if(ice.upload.cancelled){eta=(((fileTotalBytes-bytesUploaded)/1024)/kBps)*1000;}else{eta=(((ice.upload.totalBytes-(bytesUploaded+ice.upload.totalBytesUploaded))/1024)/kBps)*1000;}
var humanEta=humanTime(eta);$('upload-eta').update(_("Est. time left ~")+(humanEta?humanEta:_("0min")));$('files-processed').update(_("Uploading photo ")+((ice.upload.uploadItems.length-this.getStats().files_queued)+1)+' of '+ice.upload.uploadItems.length);var uItem=new UploadItem(fileObj,this.customSettings.fileContainer);var percent=Math.ceil((bytesUploaded/fileTotalBytes)*100);uItem.setProgressPercent(percent);}
ice.upload.completeHandler=function(fileObj){if(ice.upload.cancelled){if(ice.upload.debug)$('upload-debug').innerHTML+='<br/>'+_("Upload cancelled");return;}
if(ice.upload.debug)$('upload-debug').innerHTML+="<br/>"+_("File complete")+" "+fileObj.name;ice.upload.totalBytesUploaded+=fileObj.size;var uItem=new UploadItem(fileObj,this.customSettings.fileContainer);uItem.setProgressPercent(100);uItem.moveToEnd();if(this.getStats().files_queued>0){this.startUpload();}else{ice.upload.confirmExit=false;$('cancel-upload-link').hide();$('upload-eta-container').hide();$('total-filesize').hide();$('fileContainer').scrollTop=0;if(ice.upload.completedIds.length>0){new Ajax.Request('/go/ajax/pub/upload_post_handler',{method:'post',parameters:{ids:ice.upload.completedIds.join(',')}});$('next-step-link').show();ice.upload.uploadItems.each(function(item){item.progressBgElement.style.display='none';item.fileItem.style.color='#eee';});var _tmp=$('upload-completed').remove();$('fileContainer').appendChild(_tmp);Effect.Appear('upload-completed',{duration:1.0});}
if(ice.upload.failedFileObjIds.length>0){if(ice.upload.completedIds.length==0){$('upload-feedback').update(_("All files failed to upload, this may occur if the network connection is bad on your end."));}else{$('upload-feedback').update(_("Some files failed to upload, this may occur if the network connection is bad on your end."));}
$('upload-feedback').show();}}}
ice.upload.successHandler=function(fileObj,response){if(!isNaN(parseInt(response))&&parseInt(response)>0){ice.upload.completedIds.push(response);}else{ice.upload.failedFileObjIds.push(fileObj.id);}
if(ice.upload.debug)$('upload-debug').innerHTML+="<br/>"+_("Upload success")+" "+fileObj.name+_(" server response: ")+response;}
ice.upload.start=function(mCookie){ice.upload.confirmExit=true;$('startUploadLink').hide();$('addFilesLink').hide();$('upload-settings').hide();$('global_menu').hide();$('upload-eta-container').show();$('cancel-upload-link').show();$('info-guide').show();ice.upload.uploader.setButtonDimensions(1,1);var progressElems=$$('.file-progress-percent');for(var i=0;i<progressElems.length;i++){progressElems[i].style.display='';}
var removeElems=$$('.delete');for(var i=0;i<removeElems.length;i++){removeElems[i].style.display='none';}
$('removeOrProgressHeader').innerHTML=_("Progress");Effect.Appear('info-guide',{duration:1.0});var postParams=ice.upload.uploader.getSetting("post_params");postParams['privacy']=ice.upload.defaultPrivacy;if(ice.upload.acl)postParams['privacy_custom']=new Hash(ice.upload.acl).toJSON();postParams['license']=$F('default_license');var safetyLevel=$('upload-settings-form').getInputs('radio','safety_level').find(function(e){return e.checked;});if(safetyLevel){postParams['safety_level']=safetyLevel.value;}
ice.upload.uploader.setPostParams(postParams);if($('new-album').visible()&&!postParams['album_id']){ice.album.createNewAlbum(mCookie,function(albumId){if(parseInt(albumId)>0){var postParams=ice.upload.uploader.getSetting("post_params");postParams['album_id']=albumId;ice.upload.selectedAlbum=postParams['album_id'];ice.upload.uploader.setPostParams(postParams);ice.upload.uploader.startUpload();}else{alert(_("Error creating album."));}});return;}else if(parseInt($F('album-selection'))>0){postParams['album_id']=parseInt($F('album-selection'));ice.upload.uploader.setPostParams(postParams);}
if(parseInt(postParams['album_id'])>0){ice.upload.selectedAlbum=postParams['album_id'];}
ice.upload.uploader.startUpload();}
ice.upload.cancel=function(mCookie){if(ice.upload.uploader.getStats().files_queued==0){return;}
if(ice.upload.cancelled){ice.upload.cancelled=false;$('upload-status').update('');$('cancel-upload-link-text').value=_("Stop Upload");ice.upload.start(mCookie);return;}
ice.upload.confirmExit=false;$('upload-status').update(_("Upload stopped"));$('cancel-upload-link-text').value=_("Resume Upload");ice.upload.cancelled=true;ice.upload.uploader.stopUpload();$('upload-eta-container').hide();}
ice.upload.removeItemFromQueue=function(id){ice.upload.uploader.cancelUpload(id);var item=document.getElementById(id);item.parentNode.removeChild(item);var idx=ice.upload.getUploadItemIdx(id);ice.upload.uploadItems.splice(idx,1);ice.upload.updateFileInformation();if(ice.upload.uploader.getStats().files_queued==0){$('startUploadLink').style.display='none';}}
ice.upload.getUploadItemIdx=function(id){for(var i=0;i<ice.upload.uploadItems.length;i++){if(ice.upload.uploadItems[i].fileItem.id==id){return i;}}
return false;}
ice.upload.onBeforeUnload=function(){if(ice.upload.confirmExit)return _("Upload is currently in progress.\nLeaving the page now will break the upload.");}
ice.upload.editPrivacy=function(type){if(!ice.photo.editPrivacyWindow){ice.photo.editPrivacyWindow=new FloatingWindow({dropShadow:true});}
ice.photo.editPrivacyWindow.show({url:'/go/ajax/pro/settings',modal:true,ajaxoptions:{method:'post',parameters:{action:'edit_upload_privacy',type:type}}});}
function UploadItem(fileObj,fileContainer){this.fileObj=fileObj;this.progressTxtElement;this.progressBgElement;this.fileContainer=fileContainer;this.fileItem;this.showUI(fileContainer);}
UploadItem.prototype.showUI=function(fileContainer){this.fileItem=document.getElementById(this.fileObj.id);if(!this.fileItem){var _this=this;this.fileItem=document.createElement('div');this.fileItem.className='fileitem';this.fileItem.id=this.fileObj.id;var progressBg=document.createElement('div');progressBg.className='progress-indicator';this.fileItem.appendChild(progressBg);this.fileItem.appendChild(document.createElement('div'));var fileName=document.createElement('div');fileName.className='filename';fileName.appendChild(document.createTextNode(truncString(this.fileObj.name,40)));this.fileItem.appendChild(fileName);var fileSize=document.createElement('div');fileSize.className='filesize';fileSize.appendChild(document.createTextNode(humanFileSize(this.fileObj.size)));this.fileItem.appendChild(fileSize);var removeContainer=document.createElement('div');removeContainer.className='delete';var removeLink=document.createElement('a');removeLink.href='javascript:;';removeLink.onclick=function(){ice.upload.removeItemFromQueue(_this.fileObj.id);};var removeImg=document.createElement('img');removeImg.alt=_("Remove file from queue");removeImg.src='http://static.us.expono.com/expono-0.9.6-4585/images/delete.gif';removeImg.style.border='0px';removeLink.appendChild(removeImg);removeContainer.appendChild(removeLink);this.fileItem.appendChild(removeContainer);var progressTxt=document.createElement('div');progressTxt.className='file-progress-percent';progressTxt.style.display='none';progressTxt.appendChild(document.createTextNode('0%'));this.fileItem.appendChild(progressTxt);var clear=document.createElement('div');clear.className='clear';this.fileItem.appendChild(clear);fileContainer.appendChild(this.fileItem);}
this.progressBgElement=this.fileItem.childNodes[0];this.removeElement=this.fileItem.childNodes[4];this.progressTxtElement=this.fileItem.childNodes[5];}
UploadItem.prototype.setProgressPercent=function(percent){if(percent!='100'){this.progressBgElement.style.borderRight='2px solid #98a906';}else{this.progressBgElement.style.borderRight='0px solid #98a906';}
if(ice.upload.failedFileObjIds.indexOf(this.fileItem.id)>-1){this.fileItem.style.backgroundColor='#CC0000';this.fileItem.style.textDecoration='line-through';this.progressBgElement.style.display='none';}
this.progressBgElement.style.width=percent+'%';var spacer=' ';if(percent<10){spacer='  ';}
this.progressTxtElement.innerHTML=spacer+percent+'%'}
UploadItem.prototype.moveToEnd=function(){var item=document.getElementById(this.fileObj.id);this.fileContainer.removeChild(item);this.fileContainer.appendChild(item);}
ice.privacy.groupExists=function(elem,saveButton){var newGroupName=elem.value;var exists=false;$('group-list').select('li').each(function(e){if(e.id=='new-group')return;if(newGroupName.toLowerCase()==e.down('div').down('a').innerHTML.toLowerCase())exists=true;});if(exists){$('group-name-warn').show();$(saveButton).disable();elem.focus();}else{$('group-name-warn').hide();$(saveButton).enable();}
return exists;}
ice.privacy.updateGroupCount=function(){var count=0;$('group-list').select('li').each(function(e){if(e.down('input').checked)count++;});$('group-count').update(count==0?'':'('+count+')');}
ice.privacy.updateIdentityCount=function(){var count=$('identity-list').select('li').length;$('identity-count').update(count==0?'':'('+count+')');}
ice.privacy.updatePasswordCount=function(){var count=$('password-list').select('li').length;$('password-count').update(count==0?'':'('+count+')');}
ice.privacy.addPrivacy=function(callback){var newGroupLi=$('new-group');if(newGroupLi&&newGroupLi.down(0).checked&&!newGroupLi.down(1).value.blank()){new Ajax.Request('/go/ajax/pro/acl',{parameters:{action:'create_group',name:newGroupLi.down(1).value},onSuccess:function(transport){if(parseInt(transport.responseText)>0){callback({group_id:transport.responseText,name:newGroupLi.down(1).value});}else{$('privacy-feedback').addClassName('alert');$('privacy-feedback').update(_("Unkown error while creating group, please try again later"));}}});}else{callback();}}
ice.privacy.getACL=function(){var groups=[];$('group-list').select('li').each(function(e){if(!e.down('input').checked)return;var split=e.id.split('_');groups.push({group_id:split.length>1?split[1]:0,name:e.id=='new-group'?e.down('input',1).value:e.down('div').down('a').innerHTML});});var identities=[];if($('identity-list')){$('identity-list').select('li').each(function(e){identities.push({identity_id:e.id.split('_')[1],name:e.select('span.name')[0].innerHTML,email:e.down('div').down('span').next(),photo_url:encodeURIComponent(e.down('img').src)});});}
var passwords=[];if($('password-list')){$('password-list').select('li').each(function(e){passwords.push({value:e.down('span').innerHTML});});}
return{groups:groups,identities:identities,passwords:passwords};}
ice.privacy.addPassword=function(field){var value;if(Object.isElement(field)){if(field.value.blank()||field.value.strip().length<4){$('password-warning').show();return;}
value=field.value.strip();field.value='';$('password-warning').hide();}else{value=field.strip();}
var newLi=new Element('li').setStyle({marginBottom:'2px'});newLi.insert(new Element('span').setStyle({fontWeight:'bold',float:'left'}).update(value));var removeLink=new Element('a',{href:'javascript:;'});newLi.insert(new Element('div').setStyle({margin:'2px 0 0 5px',float:'right',padding:'4px 0 4px 0'}).insert(removeLink.insert(new Element('img',{src:'http://static.us.expono.com/expono-0.9.6-4585/images/icons/mini_icons/trash.gif'}).setStyle({width:'10px',height:'10px'}))));removeLink.observe('click',function(evt){ice.privacy.removePassword(removeLink);});newLi.insert('<div class="clear"></div>');$('password-list').insert(newLi);ice.privacy.updatePasswordCount();}
ice.privacy.addIdentity=function(identityId,name,email,imgSrc){ice.addIdentityRow('identity-list',identityId,name,email,imgSrc,ice.privacy.removeIdentity);ice.privacy.updateIdentityCount();}
ice.privacy.removeIdentity=function(elem){var e=elem.parentNode.parentNode;ice.photo.privacyIdentityCompleter.options.excludeList.splice(ice.photo.privacyIdentityCompleter.options.excludeList.indexOf(e.id.split('_')[1]),1);e.remove();ice.privacy.updateIdentityCount();}
ice.privacy.removePassword=function(elem){var e=elem.parentNode.parentNode;e.remove();ice.privacy.updatePasswordCount();}
ice.privacy.loadGroupTooltips=function(){$('group-list').select('li').each(function(elem){new Tip(elem,{title:'<div style="text-align:center;">'+_("People in this group")+'</div>',radius:2,hook:{mouse:true,tip:'topLeft'},stem:'topLeft',offset:{x:3,y:12},ajax:{url:'/go/ajax/pro/acl',options:{parameters:{action:'get_identities_in_group',group_id:elem.id.split('_')[1]}}},width:'auto'});});}
ice.sharing={};ice.sharing.showShareWindow=function(type,id,service){if(!ice.sharing.shareWindow){ice.sharing.shareWindow=new FloatingWindow({dropShadow:true});}
ice.sharing.shareWindow.show({url:'/go/ajax/pro/share',modal:true,ajaxoptions:{method:'post',parameters:{'type':type,'id':id,'service':service}}});return false;}
ice.sharing.showShareInviteWindow=function(id){if(!ice.sharing.shareWindow){ice.sharing.shareWindow=new FloatingWindow({dropShadow:true});}
ice.sharing.shareWindow.show({url:'/go/ajax/pro/invite',modal:true,ajaxoptions:{method:'post',parameters:{'identity_id':id}}});}
ice.sharing.showSharedWith=function(container_id,sharer_id,content_type,content_id,date){var indicator=new FloatingWindow({dropShadow:false,disableClose:true});indicator.show({indicator:true,modal:false});new Ajax.Updater($(container_id),'/go/ajax/pro/shared_with',{onSuccess:function(){indicator.hide();},asynchronous:true,evalScripts:true,parameters:{'sharer_id':sharer_id,'type':content_type,'id':content_id,'date':date}});}
ice.sharing.shareToFriendfeed=function(action,id,msg){$('share_to_friendfeed').update(loading(_("Sharing...")));setCenterOfViewport($('window-border'));new Ajax.Request('/go/ajax/pro/friendfeed_operations',{parameters:{msg:msg,action:action,id:id},onSuccess:function(transport){if(transport.responseText!='1'){alert(_("An unknown error occured! Please try again later."));}else{$('share_to_friendfeed').update(_("Successfully shared to FriendFeed..."));setTimeout(function(){try{ice.sharing.shareWindow.hide();}catch(ex){}},1000);}}});}
ice.facebook={};ice.facebook.onConnected=Prototype.emptyFunction;ice.facebook.onNotConnected=Prototype.emptyFunction;ice.facebook.shareToFacebook=function(action,id){$('share_to_facebook').update(loading(_("Sharing...")));setCenterOfViewport($('window-border'));new Ajax.Request('/go/ajax/pro/facebook_operations',{parameters:{action:action,id:id},onSuccess:function(transport){if(transport.responseText!='1'){if(transport.responseText=='-100'){setTimeout(function(){FB.Connect.showPermissionDialog('publish_stream',function(accepted){if(accepted){ice.facebook.addPermission('publish_stream',function(){ice.facebook.shareToFacebook(action,id);});}else{alert(_("You cannot share to Facebook without allowing Expono to publish stories on your wall."));ice.sharing.shareWindow.hide();}});},500);}else{alert(_("An unknown error occured! Please try again later."));}}else{$('share_to_facebook').update(_("Successfully shared to Facebook..."));setTimeout(function(){try{ice.sharing.shareWindow.hide();}catch(ex){}},2000);}}});}
ice.facebook.addPermission=function(type,onSuccess){new Ajax.Request('/go/ajax/pro/facebook_operations',{parameters:{action:'add_permission',type:type},onSuccess:function(transport){if(transport.responseText=='1'){if(Object.isFunction(onSuccess))onSuccess();}else{alert(_("An unknown error occured! Please try again later."));}}});}
ice.twitter={};ice.twitter.onConnected=Prototype.emptyFunction;ice.twitter.onNotConnected=Prototype.emptyFunction;ice.twitter.shareToTwitter=function(action,id,msg){$('share_to_twitter').update(loading(_("Sharing...")));setCenterOfViewport($('window-border'));new Ajax.Request('/go/ajax/pro/twitter_operations',{evalScripts:true,parameters:{action:action,id:id,msg:msg},onSuccess:function(transport){if(transport.responseText!='1'){alert(_("An unknown error occured! Please try again later."));}else{$('share_to_twitter').update(_("Successfully shared to Twitter..."));setTimeout(function(){try{ice.sharing.shareWindow.hide();}catch(ex){}},1000);}}});}
ice.twitter.charCount=function(id,id_cnt,available){formcontent=$(id).value;$(id_cnt).innerHTML=(available-formcontent.length)+_(" chars left.");}
if(typeof(Control)=='undefined')
Control={};Control.Rating=Class.create();Object.extend(Control.Rating,{instances:[],findByElementId:function(id){return Control.Rating.instances.find(function(instance){return(instance.container.id&&instance.container.id==id);});}});Object.extend(Control.Rating.prototype,{container:false,value:false,options:{},initialize:function(container,options){Control.Rating.instances.push(this);this.value=false;this.links=[];this.container=$(container);this.container.update('');this.options={min:1,max:5,rated:false,input:false,reverse:false,capture:true,multiple:false,classNames:{off:'rating_off',half:'rating_half',on:'rating_on',selected:'rating_selected'},updateUrl:false,updateParameterName:'value',afterChange:Prototype.emptyFunction};Object.extend(this.options,options||{});if(this.options.value){this.value=this.options.value;delete this.options.value;}
if(this.options.input){this.options.input=$(this.options.input);this.options.input.observe('change',function(input){this.setValueFromInput(input);}.bind(this,this.options.input));this.setValueFromInput(this.options.input,true);}
var range=$R(this.options.min,this.options.max);(this.options.reverse?$A(range).reverse():range).each(function(i){var link=this.buildLink(i);this.container.appendChild(link);this.links.push(link);}.bind(this));this.setValue(this.value||this.options.min-1,false,true);},buildLink:function(rating){var link=$(document.createElement('a'));link.value=rating;if(this.options.multiple||(!this.options.rated&&!this.options.multiple)){link.href='';link.onmouseover=this.mouseOver.bind(this,link);link.onmouseout=this.mouseOut.bind(this,link);link.onclick=this.click.bindAsEventListener(this,link);}else{link.style.cursor='default';link.observe('click',function(event){Event.stop(event);return false;}.bindAsEventListener(this));}
link.addClassName(this.options.classNames.off);return link;},disable:function(){this.links.each(function(link){link.onmouseover=Prototype.emptyFunction;link.onmouseout=Prototype.emptyFunction;link.onclick=Prototype.emptyFunction;link.observe('click',function(event){Event.stop(event);return false;}.bindAsEventListener(this));link.style.cursor='default';}.bind(this));},setValueFromInput:function(input,prevent_callbacks){this.setValue((input.options?input.options[input.options.selectedIndex].value:input.value),true,prevent_callbacks);},setValue:function(value,force_selected,prevent_callbacks){this.value=value;if(this.options.input){if(this.options.input.options){$A(this.options.input.options).each(function(option,i){if(option.value==this.value){this.options.input.options.selectedIndex=i;throw $break;}}.bind(this));}else
this.options.input.value=this.value;}
this.render(this.value,force_selected);if(!prevent_callbacks){if(this.options.updateUrl){var params={};params[this.options.updateParameterName]=this.value;var ajaxOptions={};Object.extend(ajaxOptions,this.options.ajaxOptions||{});Object.extend(ajaxOptions.parameters,params||{});new Ajax.Request(this.options.updateUrl,ajaxOptions);}
this.notify('afterChange',this.value);}},render:function(rating,force_selected){(this.options.reverse?this.links.reverse():this.links).each(function(link,i){if(link.value<=Math.ceil(rating)){link.className=this.options.classNames[link.value<=rating?'on':'half'];if(this.options.rated||force_selected)
link.addClassName(this.options.classNames.selected);}else
link.className=this.options.classNames.off;}.bind(this));},mouseOver:function(link){this.render(link.value,true);},mouseOut:function(link){this.render(this.value);},click:function(event,link){this.options.rated=true;this.setValue((link.value?link.value:link),true);if(!this.options.multiple)
this.disable();if(this.options.capture){Event.stop(event);return false;}},notify:function(event_name){try{if(this.options[event_name])
return[this.options[event_name].apply(this.options[event_name],$A(arguments).slice(1))];}catch(e){if(e!=$break)
throw e;else
return false;}}});if(typeof(Object.Event)!='undefined')
Object.Event.extend(Control.Rating);function PhotoStream(url,imageList,params){this.initialize(url,imageList,params);}
PhotoStream.prototype.initialize=function(url,imageList,params){this.url=url;this.unloadedImages=new Array();this.loadedImages=imageList;this.currentPage=1;this.pageSize=11;this.isScrolling=false;this.scrollSize=8;this.imageGetSize=300;this.imageWidth=85;this.availableImageCount=parseInt(params.availableImageCount?params.availableImageCount:imageList.length);this.selectedImages=new Array();this.params=params;this.previousSliderValue=0;this.queueScope='photostream';this.imageContainer=$('thumb-container');this.sliderHandleId='handle1';this.sliderTrackId='track1';this.initSlider();this.updateFeedback();}
PhotoStream.prototype.getMoreImages=function(numberOfImages,callback){var from=this.loadedImages.length+this.unloadedImages.length;if(from>=this.availableImageCount){return;}
var num=numberOfImages||0;var to=(from+num+this.imageGetSize)>this.availableImageCount?this.availableImageCount:(from+num+this.imageGetSize);var params=this.params.urlParameters;params.from=from;params.to=to;var onSuccess=function(transport){this.unloadedImages=this.unloadedImages.concat(eval(transport.responseText));callback();};new Ajax.Request(this.url,{method:'post',parameters:params,onSuccess:onSuccess.bind(this)});}
PhotoStream.prototype.loadImages=function(size){var currentPos=-(parseInt(this.imageContainer.getStyle('left')));var neededSize=Math.ceil(currentPos/this.imageWidth)+(this.scrollSize*3);if(this.loadedImages.length>neededSize){return;}
var onSuccess=function(){size=neededSize-this.loadedImages.length;var imagesToAdd=this.unloadedImages.splice(0,size);this.addImages(imagesToAdd);};if((this.loadedImages.length+this.unloadedImages.length)<neededSize&&(this.loadedImages.length+this.unloadedImages.length)<this.availableImageCount){this.getMoreImages(neededSize-(this.loadedImages.length+this.unloadedImages.length),onSuccess.bind(this));}else{onSuccess.bind(this)();}}
PhotoStream.prototype.addImages=function(images){for(var i=0;i<images.length;i++){var imgElem=this.createImageElement(images[i]);this.imageContainer.appendChild(imgElem);new ICEDraggable(imgElem.id,{revert:true,ghosting:true,floating:true});}
this.loadedImages=this.loadedImages.concat(images);}
PhotoStream.prototype.createImageElement=function(imageData){return new Element('img',{id:'photo_'+imageData.id,className:'draggable-image',onclick:'onStreamImageClick(event,this);',src:imageData.url,alt:imageData.title});}
PhotoStream.prototype.scroll=function(container,more){if(this.isScrolling)return;if(this.availableImageCount<=this.pageSize)return
if(more){var newValue=this.slider.values[0]+((1/this.availableImageCount)*this.scrollSize);if(newValue>1){newValue=1;}
this.slider.setValue(newValue,0);}else{var newValue=this.slider.values[0]-((1/this.availableImageCount)*this.scrollSize);if(newValue<0){newValue=0;}
this.slider.setValue(newValue,0);}}
PhotoStream.prototype.updateFeedback=function(){var from=parseInt((-parseInt(this.imageContainer.getStyle('left')))/this.imageWidth)+1;var to=from+this.pageSize;if(to>this.availableImageCount){to=this.availableImageCount;}
$('stream-feedback').update(_("Showing photos ")+from+' - '+to+_(" of total ")+this.availableImageCount);}
PhotoStream.prototype.selectImage=function(id){$(id).addClassName('image-selected');this.selectedImages=$$('.image-selected');this.updateSelection();}
PhotoStream.prototype.deSelectImage=function(id){$(id).removeClassName('image-selected');this.selectedImages=$$('.image-selected');this.updateSelection();}
PhotoStream.prototype.updateSelection=function(){$('stream-selection').update(this.selectedImages.length+_(" photos selected"));if(this.params.onSelection){this.params.onSelection(this.selectedImages);}}
PhotoStream.prototype.getSelectedImages=function(){return this.toImageObjects($$('.image-selected'));}
PhotoStream.prototype.toImageObjects=function(elements){var result=new Array();for(var i=0;i<elements.length;i++){var id=elements[i].id.split('_')[1];var obj=this.getImageObject(id);if(obj){result.push(obj);}}
return result;}
PhotoStream.prototype.getImageObject=function(id){for(var i=0;i<this.loadedImages.length;i++){if(this.loadedImages[i].id==id){return this.loadedImages[i];}}
return false;}
PhotoStream.prototype.selectAllLoadedImages=function(){var _this=this;$$('.draggable-image').each(function(element){_this.selectImage(element.id)});}
PhotoStream.prototype.clearSelection=function(){var _this=this;$$('.draggable-image').each(function(element){_this.deSelectImage(element.id)});}
PhotoStream.prototype.setStream=function(url,imageList,params){this.initialize(url,[],params);this.imageContainer.update('');this.imageContainer.setStyle({left:'0px'});this.addImages(imageList);this.updateSelection();}
PhotoStream.prototype.initSlider=function(){if(!$('track1'))return;if(this.slider){this.slider.dispose();}
if(this.availableImageCount<=this.pageSize){$('track1').hide();}else{$('track1').show();}
var onChange=function(v){this.isScrolling=true;var currentLeft=parseInt(this.imageContainer.getStyle('left'));var maxWidth=(this.availableImageCount-(this.pageSize-2))*this.imageWidth;var value=0;var newPage=null;if(v==0){newPage=1;}else{newPage=Math.ceil((this.availableImageCount/this.pageSize)*v);}
if(this.previousSliderValue<v){value=-(maxWidth*(v-this.previousSliderValue));}else{value=maxWidth*(this.previousSliderValue-v);if(value<1){value=-(currentLeft);}}
this.previousSliderValue=v;var afterFinish=function(){this.loadImages();this.currentPage=newPage;this.updateFeedback();this.isScrolling=false;};new Effect.MoveBy(this.imageContainer.id,0,value,{afterFinish:afterFinish.bind(this),queue:{scope:this.queueScope,position:'end'}});};this.slider=new Control.Slider(this.sliderHandleId,this.sliderTrackId,{onChange:onChange.bind(this)});}
var Annotation=Class.create({initialize:function(container,rect,options){this.rect=rect;this.options=options;this.editable=options.editable||false;this.editMode=false;this.container=$(container);this.id=this.options.id||new Date().getTime();this.idSuffix=this.id;this.dragHandle='an-handle_'+this.idSuffix;this.annotationAreaId='an-area_'+this.idSuffix;this.outerBorderId='annotation-outer-border_'+this.idSuffix;this.middleBorderId=this.dragHandle;this.innerBorderId='annotation-inner-border_'+this.idSuffix;this.outerBorderHighlight='annotation-outer-border';this.initElements();this.initEvents();},initElements:function(){var innerBorder=new Element('div',{id:this.innerBorderId,className:'annotation-inner-border'});if(Prototype.Browser.IE){innerBorder.insert(new Element('div').setStyle({height:'100%',backgroundColor:'white',opacity:'0'}));}
this.annotationArea=new Element('div',{id:this.annotationAreaId,className:'annotation-area'});this.annotationArea.insert(new Element('div',{id:this.outerBorderId,className:'annotation-outer-table'}).insert(new Element('div',{id:this.dragHandle,className:'annotation-middle-border'}).insert(new Element('div',{className:'table-div'}).insert(innerBorder))));this.annotationArea.insert(new Element('div',{className:'resize-box resize-tl'}).setStyle({display:'none'}));this.annotationArea.insert(new Element('div',{className:'resize-box resize-tm'}).setStyle({display:'none'}));this.annotationArea.insert(new Element('div',{className:'resize-box resize-tr'}).setStyle({display:'none'}));this.annotationArea.insert(new Element('div',{className:'resize-box resize-ml'}).setStyle({display:'none'}));this.annotationArea.insert(new Element('div',{className:'resize-box resize-mr'}).setStyle({display:'none'}));this.annotationArea.insert(new Element('div',{className:'resize-box resize-bl'}).setStyle({display:'none'}));this.annotationArea.insert(new Element('div',{className:'resize-box resize-bm'}).setStyle({display:'none'}));this.annotationArea.insert(new Element('div',{className:'resize-box resize-br'}).setStyle({display:'none'}));this.annotationArea.setStyle({top:this.rect.top+'px',left:this.rect.left+'px',width:this.rect.width+'px',height:this.rect.height+'px'});this.container.insert(this.annotationArea);},initEvents:function(){this.boundMouseOverOuterBorder=this.options.onMouseOver||this.mouseOverOuterBorder.bind(this);this.boundMouseOutOuterBorder=this.options.onMouseOut||this.mouseOutOuterBorder.bind(this);this.boundOnClick=this.onClick.bind(this);Event.observe(this.annotationArea,'mouseover',this.boundMouseOverOuterBorder);Event.observe(this.annotationArea,'mouseout',this.boundMouseOutOuterBorder);Event.observe(this.annotationArea,'click',this.boundOnClick);},mouseOverOuterBorder:function(){this.highlight();},mouseOutOuterBorder:function(){this.unhighlight();},onClick:function(){if(this.options.editOnClick){this.setEditable(true);}},highlight:function(){$(this.outerBorderId).addClassName(this.outerBorderHighlight);},unhighlight:function(){$(this.outerBorderId).removeClassName(this.outerBorderHighlight);},hide:function(){this.annotationArea.hide();},show:function(){this.annotationArea.show();},setEditable:function(editable){if(!this.editable){return;}
if(editable&&this.editMode){return;}
if(editable){Event.stopObserving(this.annotationArea,'mouseover',this.boundMouseOverOuterBorder);Event.stopObserving(this.annotationArea,'mouseout',this.boundMouseOutOuterBorder);this.editMode=true;if(this.options.draggableOptions.change){this.suppliedDraggableOnChange=this.options.draggableOptions.change;this.options.draggableOptions.change=this.onRectChange.bind(this);}
if(this.options.resizableOptions.onResize){this.suppliedResizableOnResize=this.options.resizableOptions.onResize;this.options.resizableOptions.onResize=this.onRectChange.bind(this);}
this.draggable=new Draggable(this.annotationAreaId,Object.extend(this.options.draggableOptions||{},{handle:this.dragHandle}));this.resizable=new Resizable(this.annotationAreaId,this.options.resizableOptions||{});this.highlight();this.annotationArea.addClassName('annotation-movable');this.annotationArea.select('div.resize-box').each(function(elem){elem.show();});if(this.options.onEditBegin){this.options.onEditBegin();}}else{this.editMode=false;this.annotationArea.removeClassName('annotation-movable');this.unhighlight();Event.observe(this.annotationArea,'mouseover',this.boundMouseOverOuterBorder);Event.observe(this.annotationArea,'mouseout',this.boundMouseOutOuterBorder);this.draggable.destroy();this.resizable.destroy();this.annotationArea.select('div.resize-box').each(function(elem){elem.hide();});if(this.options.onEditEnd){this.options.onEditEnd();}}},onRectChange:function(obj){var elem=obj.element;this.rect={height:elem.getHeight(),width:elem.getWidth(),top:parseInt(elem.getStyle('top')),left:parseInt(elem.getStyle('left'))};this.suppliedDraggableOnChange(obj);this.suppliedResizableOnResize(obj);},destroy:function(){if(this.editMode){this.draggable.destroy();this.resizable.destroy();}
this.annotationArea.remove();},getRect:function(){return this.rect;}});var ContactAnnotation=Class.create({initialize:function(container,rect,options,contact){this.container=$(container);this.contact=contact;this.editable=options.editable||false;this.lockedState=false;this.options=options;if(this.editable){var annotationOptions={draggableOptions:{change:this.annotationRectChange.bind(this),snap:this.annotationSnap.bind(this)},resizableOptions:{onResize:this.annotationRectChange.bind(this),bind:true},onEditBegin:this.onEditBegin.bind(this),onEditEnd:this.onEditEnd.bind(this),editable:true,onMouseOver:this.showNote.bind(this),onMouseOut:this.hideNote.bind(this)};}else{var annotationOptions={editable:false,onMouseOver:this.showNote.bind(this),onMouseOut:this.hideNote.bind(this)};}
this.id=options.id;this.annotation=new Annotation(container,rect,annotationOptions);this.initElements();if(options.showEdit){this.annotation.setEditable(true);}},initElements:function(){if(this.editable){this.initSearchElements();}else{this.initNoteElements();}},initNoteElements:function(){this.note=new Element('div',{className:'annotation-note'}).setStyle({display:'none'}).update(this.contact.name);if(this.options.hidden){this.note.setStyle({display:'none'});$(this.annotation.outerBorderId).removeClassName('annotation-outer-border');$(this.annotation.middleBorderId).removeClassName('annotation-middle-border');$(this.annotation.innerBorderId).removeClassName('annotation-inner-border');}
Element.insert(this.annotation.annotationArea,{after:this.note});this.note.clonePosition(this.annotation.annotationArea,{setWidth:false,setHeight:false,offsetTop:this.annotation.annotationArea.getDimensions().height+5});this.boundShowNote=this.showNote.bind(this);this.boundHideNote=this.hideNote.bind(this);},initSearchElements:function(){this.searchContainer=new Element('div',{id:'contact-search-container',className:'contact-search-container'}).insert('<div style="width:200px;"><span style="float:left;">'+_("Contact Name:")+'</span><span style="float:right;font-size:9px;"><a href="javascript:;" onclick="ice.photo.latestContactAnnotation.addNew();">'+_("Add as new")+'</a></span></div>');this.searchField=new Element('input',{type:'text',id:'contact-search',name:'autocomplete_parameter',value:_("Find contact or add new..")});this.searchField.observe('focus',function(e){e.element().select();});this.searchContainer.insert(this.searchField);this.searchContainer.insert(new Element('span',{id:'contact-search-indicator'}).setStyle({display:'none'}).insert(new Element('img',{src:'http://static.us.expono.com/expono-0.9.6-4585/images/indicator.gif',alt:_("Loading...")}))).insert('<br/>');this.searchContainer.insert(new Element('div',{id:'contact-search-results',className:'list-result-container'}).setStyle({display:'none'}));this.idtEmailContainer=new Element('div',{id:'add-identity-email'}).setStyle({display:'none'});this.idtEmailContainer.insert('<span style="display:block;font-size:9px;border:1px solid #666;width:195px;padding:2px;color:#000;background-color:#eee;">'+_("Enter an email address for this contact. We will add it to your Address Book so it is easier to share and tag your photos with this contact next time.")+'</span>'+_("Email:")+'<br/>');this.idtEmailContainer.insert(new Element('input',{id:'add-identity-email-field',type:'text'}));this.userGroupsDiv=new Element('div').setStyle({display:'none'});this.userGroupsDDLB=new Element('select',{id:'add-identity-to-group'}).setStyle({display:'block',width:'190px'});this.userGroupsDiv.insert('<span>'+_("Add to group:")+'</span>');this.userGroupsDiv.insert(this.userGroupsDDLB);this.idtEmailContainer.insert(this.userGroupsDiv);var shareChkBox=new Element('input',{type:'checkbox',id:'idt-share-check'}).setStyle({verticalAlign:'middle'})
if(this.options.shareOnTag)shareChkBox.setAttribute('checked','checked');this.idtEmailContainer.insert(shareChkBox);this.idtEmailContainer.insert('&nbsp;<label for="idt-share-check">'+_("Share this photo now")+'</label<br/>');this.searchContainer.insert(this.idtEmailContainer);this.saveButton=new Element('input',{type:'button',value:_("Save")});this.searchContainer.insert(this.saveButton).insert('&nbsp');this.cancelButton=new Element('input',{type:'button',value:_("Cancel")});this.searchContainer.insert(this.cancelButton);this.searchContainer.setStyle({display:'none'});Element.insert(this.annotation.annotationArea,{after:this.searchContainer});this.autocompleter=new ICE_Autocompleter('contact-search','contact-search-results','/go/ajax/pro/contacts',{ajaxOptions:{parameters:{action:'get_user_identities_autocomplete',include_me:'true'}},indicator:'contact-search-indicator',formatItem:this.formatContactItem,updateElement:this.contactSelected.bind(this),onNoResultsFound:this.onNoResultsFound.bind(this),excludeList:$('idt-tagged-users').value.split(',')});Event.observe('contact-search','keyup',function(evt){$$('.hover-container').each(function(e){e.remove();})});this.boundSave=this.save.bind(this)
Event.observe(this.saveButton,'click',this.boundSave);Event.observe(this.cancelButton,'click',this.onCancel.bind(this));Event.observe(this.searchField,'keyup',this.onSearchFieldKeyDown.bind(this));},onSearchFieldKeyDown:function(event){if(this.contact&&this.searchField.value!=this.contact.name){this.contact=null;}
if(!$('contact-search-results').visible()&&event.which==Event.KEY_RETURN){this.save();}},isLockedState:function(){return this.lockedState;},setLockedState:function(lock){this.lockedState=lock;},showNote:function(){if(this.isLockedState()){return;}
this.note.show();var tag=$('idt-tag-id_'+this.id);if(tag)tag.select('.idt-photo').each(function(e){e.addClassName('idt-photo-highlight');});},hideNote:function(){if(this.isLockedState()){return;}
this.note.hide();var tag=$('idt-tag-id_'+this.id);if(tag)tag.select('.idt-photo').each(function(e){e.removeClassName('idt-photo-highlight');});},toggleNote:function(){if(this.note.visible()){this.hideNote();}else{this.showNote();}},onEditBegin:function(){this.annotationRectChange({element:this.annotation.annotationArea});this.searchContainer.show();this.searchField.focus();},onEditEnd:function(){if(this.searchContainer)this.searchContainer.hide();},annotationSnap:function(x,y,draggable){var maxDim=this.container.getDimensions();var elemDim=draggable.element.getDimensions();var maxX=maxDim.width-elemDim.width;var maxY=maxDim.height-elemDim.height;var newX,newY;newX=x>0?x:0;newX=x>maxX?maxX:newX;newY=y>0?y:0;newY=y>maxY?maxY:newY;return[newX,newY];},annotationRectChange:function(obj){var elem=obj.element;$('contact-search-container').clonePosition(elem,{setWidth:false,setHeight:false,offsetLeft:elem.getDimensions().width+20});},contactSelected:function(liObj){$('contact-search').value=liObj.down('span').innerHTML;this.contact={id:liObj.id.split('_')[1],name:$('contact-search').value,email:$('add-identity-email-field').value};},onSaveSuccess:function(transport){var result;try{result=transport.responseText.evalJSON(true);}catch(ex){}
if(typeof(result)!='object'){this.onSaveFailure(transport);return;}
var taggedUsers=$('idt-tagged-users').value.split(',');taggedUsers.push(this.contact.id);$('idt-tagged-users').value=taggedUsers.join(',');var deleteLink=new Element('a').insert(new Element('img',{src:'http://static.us.expono.com/expono-0.9.6-4585/images/delete.png'}));if(result.photo_url=='http://static.us.expono.com/expono-0.9.6-4585/images/profile_photo_s.gif'&&!Prototype.Browser.IE){var profileImg=new Element('canvas',{width:'50px',height:'50px',className:'idt-photo'});var ctx=profileImg.getContext("2d");var img=new Image();img.onload=function(){ctx.drawImage(img,result.coord_x,result.coord_y,result.width,result.height,0,0,50,50);}
img.src=$('photo_'+ice.photo.id).src;}else{var profileImg=new Element('img',{src:result.photo_url,alt:result.identity_text,className:'idt-photo'})}
var li=new Element('li',{id:'idt-tag-id_'+result.tag_id,className:'idt-tag'}).insert(new Element('div',{className:'relative'}).insert(new Element('a',{href:'/go/people/'+(result.tagged_user_id>0?result.tagged_username:result.tagged_identity_id)}).insert(profileImg)).insert(new Element('div',{className:'idt-quick-link'}).insert(deleteLink)));if(!$('idt-highlight-link')){var hLink=new Element('a',{id:'idt-highlight-link',href:'javascript:;'}).update(_("Highlight all"));Event.observe(hLink,'click',ice.photo.toggleAllTaggedIdentities);$('idt-tag-list').next(0).insert(hLink);}
Event.observe(deleteLink,'click',function(){ice.photo.removeIdentityTag(result.tag_id,result.tagged_identity_id,result.mcookie);});Event.observe(li,'mouseover',function(){ice.photo.highlightIdentityTag(result.tag_id);});Event.observe(li,'mouseout',function(){ice.photo.unhighlightIdentityTag(result.tag_id);});Element.insert($('add-identity-tag'),{before:li});this.id=result.tag_id;ice.photo.contactAnnotations.push(this);ice.photo.editingContactAnnotation=false;},onSaveFailure:function(transport){ice.photo.editingContactAnnotation=false;$('photo-operation-feedback').update('<span class="feedback-background">'+transport.responseText+'</span>');this.destroy();},save:function(){if(!this.options.photoId){throw("Saving requires photoId option");}
if(!this.contact){this.contact={id:0,name:$F('contact-search'),email:$('add-identity-email-field').value};}
this.initNoteElements();var rect=this.annotation.getRect();var params={action:'save_identity_tag',coord_x:rect.left,coord_y:rect.top,width:rect.width,height:rect.height,photo_id:this.options.photoId,tagged_identity_id:this.contact.id,identity_text:this.contact.name,email:this.contact.email};ice.photo.shareOnIdentityTags=$('idt-share-check').checked;if(this.contact.id==0){params.share=$('idt-share-check').checked?1:0;params.group_id=$('add-identity-to-group').value;}
this.autocompleter.options.indicator=false;this.searchContainer.remove();this.searchContainer=null;this.annotation.setEditable(false);new Ajax.Request('/go/ajax/pro/tagging',{method:'post',onSuccess:this.onSaveSuccess.bind(this),onFailure:this.onSaveFailure.bind(this),parameters:params});},extractContactExcludeList:function(){return $F('idt-tagged-users');},onCancel:function(){ice.photo.editingContactAnnotation=false;this.destroy();},formatContactItem:function(object,objectIdx,foundPos,entryLength){$('add-identity-email').hide();var emailOrSource=object.email||object.source||'';var name='<strong>'+object.text.substr(0,entryLength)+'</strong>'+object.text.substr(entryLength);object.source_icon='/favicon.ico';return'<li id="contact_'+object.id+'" onmouseover="hoverImage(this, event, \''+object.pic_url+'\');" class="contact-autocomplete" style="margin-bottom:2px;"><span style="display:none;">'+object.text+'</span><img src="'+object.pic_url+'"/><div><span class="name">'+name+'</span><span class="email">'+emailOrSource+'</span></div></li>';},addNew:function(){$('add-identity-email').show();$('add-identity-email-field').focus();this.contact=undefined;},destroy:function(){if(this.note)this.note.remove();if(this.searchContainer){this.autocompleter.options.indicator=false;this.searchContainer.remove();}
this.annotation.destroy();},onNoResultsFound:function(){$('add-identity-email').show();if(typeof(ice.user.groups)!='object'){new Ajax.Request('/go/ajax/pro/acl',{parameters:{action:'get_user_groups'},onSuccess:this.addGroupsDDLB.bind(this)});}else{this.addGroupsDDLB();}},addGroupsDDLB:function(transport){if(transport){ice.user.groups=transport.responseText.evalJSON();}
if(typeof(ice.user.groups)=='object'&&this.userGroupsDDLB.options.length==0){ice.user.groups.each(function(group){var attribs={value:group.group_id};if(parseInt(group.system_group_id)==20)attribs.selected='selected';this.userGroupsDDLB.insert(new Element('option',attribs).update(group.group_name));}.bind(this));this.userGroupsDiv.show();}}});function groupByCountry(locations){var hash={};for(var i=0;i<locations.length;i++){if(!hash[locations[i].country]){hash[locations[i].country]=[];}
hash[locations[i].country].push(locations[i]);}
var result=[];for(var key in hash){result.push({country:key,cities:hash[key]});}
return result;}
function searchDestinations(searchWord,limit,options){if(!limit){limit=100;}
if(!options){options={};}
if(searchWord.length<1){return false;}
var params={action:'search',value:searchWord,limit:limit,from:0};var ajaxOptions={parameters:params};Object.extend(ajaxOptions,options.ajaxOptions||{});new Ajax.Request('/go/ajax/pub/geo_search',ajaxOptions);}
function hoverMap(obj,event,latitude,longitude,options){options=options||{};var element=new Element('div').setStyle({width:options.width||'200px',height:options.height||'200px',backgroundColor:'white',overflow:'hidden',border:'1px solid gray'}).update(loading());var loadMap=function(){if(GBrowserIsCompatible()){var map=new google.maps.Map2(element);var latLng=new GLatLng(latitude,longitude);map.setCenter(latLng,4);map.addOverlay(new GMarker(latLng));}}
hoverElement(obj,event,element,{onVisible:loadMap});}
function initGoogleMap(id,lat,lng,marker,options){if(!options)var options={};map=new google.maps.Map2(document.getElementById(id));if(!lat||!lng){map.setCenter(new GLatLng(34,0),1);}else{var location=new GLatLng(lat,lng);map.setCenter(location,6);}
if(marker)map.addOverlay(new GMarker(location));if(options.control){map.addControl(options.control);}else{map.addControl(new google.maps.SmallZoomControl());map.addControl(new GMapTypeControl());}
return map;}