/*
HTTP Host: static.ak.fbcdn.net
Generated: March 18th 2010 7:50:35 AM PDT
Machine: 10.16.139.102
Locale: nu_ll
Path: js/da57hu34ixsksgk0.pkg.js
*/

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/da57hu34ixsksgk0.pkg.js"]); }

function adjustImage(c){var a=c.parentNode;while(CSS.getStyle(a,'display')!='block'&&a.parentNode)a=a.parentNode;var d=a.offsetWidth;if(c.offsetWidth>d)try{if(ua.ie()<8){var b=document.createElement('div');b.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+c.src.replace('"','%22')+'", sizingMethod="scale")';b.style.width=d+'px';b.style.height=Math.floor(((d/c.offsetWidth)*c.offsetHeight))+'px';if(c.parentNode.tagName=='A')b.style.cursor='pointer';c.parentNode.insertBefore(b,c);c.parentNode.removeChild(c);}else throw 1;}catch(e){c.style.width=d+'px';}CSS.removeClass(c,'img_loading');}function imageConstrainSize(e,b,c,d){var a=new Image();a.onload=function(){if(a.width>0&&a.height>0){var k=a.width;var h=a.height;if(k>b||h>c){var g=c/b;var f=h/k;if(f>g){k=k*(c/h);h=c;}else{h=h*(b/k);k=b;}}var j=ge(d);if(j){var i=document.createElement('img');i.src=e;i.width=k;i.height=h;j.parentNode.insertBefore(i,j);j.parentNode.removeChild(j);}}};a.src=e;}function image_has_loaded(a){if(a.naturalWidth!==undefined){return a.complete&&a.width!=0;}else if(a.height==20&&a.width==20&&a.complete){return false;}else if(a.complete===undefined&&ua.safari()<500){var b=new Image();b.src=a.src;return b.complete;}return a.complete;}function image_has_failed(a){if((a.complete==null&&a.width==20&&a.height==20)||(a.mimeType!=null&&a.complete&&a.mimeType=='')||(a.naturalHeight!=null&&a.complete&&a.naturalHeight==0))return true;}
var Configurable={getOption:function(a){if(typeof(this.option[a])=='undefined')return null;return this.option[a];},setOption:function(a,b){if(!(typeof(this.option[a])=='undefined'))this.option[a]=b;return this;},getOptions:function(){return this.option;}};
function Nectar(){}copy_properties(Nectar,{linkHandler:function(c,a){var b=Nectar.getNectarParams();b.ia=1;var e=a.href;if(!e){e=URI.getRequestURI().toString();b.err=1;}b.url=e;var d='/ajax/nectar.php'+'?'+URI.implodeQuery({nctr:b})+'&';new AsyncSignal(d,{}).send();return c;},getNectarParams:function(){var c={};var a=env_get('nctrlid');if(a)c.id=a;var b=env_get('nctrlnid');if(b)c.nid=b;if(a||b)c.ct=(new Date()).getTime();copy_properties(c,Nectar.extraData.get_query_data());return c;},extraData:function(){var a={};var b=[];return {set_item:function(c,e,d){var f=a[c];if(f===undefined){if(d)b.push(c);f=[];a[c]=f;}return f.push(e);},get_item:function(c){return a[c]||[];},get_query_data:function(){var c,f,d,e={};for(c=0;c<b.length;c++){d=b[c];f=a[d];if(f)e[d]=f.join(',');}a=[];b=[];return e;}};}()});
var PhotostreamConstants={ShowPhoto:'photostream/showPhoto'};
function NectarPhotosLog(){}copy_properties(NectarPhotosLog,{PHOTOS_BUF_LEN:20,showPhotoHandler:function(g,b){var e,c,a,f;c=b.node;e=b.pid;a=b.aid;f=b.ss;var d=Nectar.extraData.get_item('pts');if(e!==undefined){if(d.length==0){Nectar.extraData.set_item('url',c.href,false);Nectar.extraData.set_item('aid',a,true);Nectar.extraData.set_item('ss',f,false);}Nectar.extraData.set_item('pts',e,true);}d=Nectar.extraData.get_item('pts');if(d.length>=NectarPhotosLog.PHOTOS_BUF_LEN)NectarPhotosLog.flushLog();return false;},flushLog:function(){var a=Nectar.extraData.get_item('pts');if(a.length>0){var b=Nectar.extraData.get_item('url')[0];Nectar.linkHandler(false,{href:b});}return false;}});onloadRegister(function(){Arbiter.subscribe(PhotostreamConstants.ShowPhoto,NectarPhotosLog.showPhotoHandler);});onbeforeunloadRegister(function(){NectarPhotosLog.flushLog();},false);
function Task(a,b){copy_properties(this,{task:a,option:{synchronous:!!b},status:Task.WAITING,result:null,queue:null});}copy_properties(Task,{WAITING:0,READY:1,RUNNING:2,DONE:3,ERROR:4});copy_properties(Task.prototype,Configurable);copy_properties(Task.prototype,{run:function(){this.status=Task.RUNNING;try{var a=this.task();}catch(exception){this.status=Task.ERROR;exception._task=this;throw exception;}if(this.getOption('synchronous'))this.didComplete(a);},didComplete:function(a){this.result=a;this.status=Task.DONE;if(this.queue)this.queue.didCompleteTask(this);return this;}});function TaskQueue(){copy_properties(this,{queue:[],executingTasks:0,executionDepth:0,option:{synchronous:true,concurrency:2}});}copy_properties(TaskQueue.prototype,Configurable);copy_properties(TaskQueue.prototype,{addTask:function(a){this.queue.push(a);a.queue=this;return a;},didCompleteTask:function(a){this.executingTasks--;this.reapQueue();if(!this.executionDepth)this.start();},runTask:function(a){this.executingTasks++;if(this.getOption('synchronous')){try{a.run();}catch(exception){this.didCompleteTask();}}else setTimeout(bind(a,'run'),10);},reapQueue:function(){var c;var a,b;for(a=0,b=this.queue.length;a<b;a++){c=this.queue[a].status;if(c!=Task.DONE&&c!=Task.ERROR)break;}if(a)this.queue=this.queue.slice(a);},start:function(){this.executionDepth++;while(this.executingTasks<this.getOption('concurrency')){for(var a=0,b=this.queue.length;a<b;a++)if(this.queue[a].status==Task.READY){this.runTask(this.queue[a]);break;}if(a==b)break;}this.executionDepth--;},ready:function(c){c=c||1;for(var a=0,b=this.queue.length;a<b;a++)if(this.queue[a].status==Task.WAITING){this.queue[a].status=Task.READY;if(!(--c))break;}this.start();}});
function UrlDetector(a){this.element=a;this.lastCharCount=0;this.lastScrapedURL=null;this.detectionInterval=null;this.suppressDetection=bagofholding;Event.listen(a,'focus',this.startDetectionInterval.bind(this));Event.listen(a,'blur',this.stopDetectionInterval.bind(this));var b=DOM.isNode(this.element,['input','textarea']);copy_properties(this,{getText:b?function(){return this.element.value;}:function(){return DOM.getText(this.element);},setText:b?function(c){this.element.value=c;}:function(c){DOM.setText(this.element,c);}});}UrlDetector.mixin('Arbiter',{getText:bagofholding,setText:bagofholding,setSuppressDetectionCheck:function(a){this.suppressDetection=a;},startDetectionInterval:function(){if(this.detectionInterval||this.suppressDetection())return;this.detectionInterval=setInterval(this.detectionIntervalFire.bind(this),250);},stopDetectionInterval:function(){this.detectionInterval=clearInterval(this.detectionInterval);},detectionIntervalFire:function(){if(this.suppressDetection())return;var a=this.getText().length;if((a-this.lastCharCount)>5||(this.lastCharCount==0&&a>1))var b=true;this.lastCharCount=a;var c=this.detectUrl(b);if(c)this.inform('urlDetected',c);},detectUrl:function(c){var f='',e=this.getText(),d=endPos=-1;if(c){f=e.match(/www\.\S*/i);if(f){d=e.indexOf(f[0]);endPos=d+f[0].length;f="http://"+f[0];}else{var b=e.match(/(http|fb):\/\/\S*/i);if(b){f=b[0];d=e.indexOf(b[0]);endPos=d+b[0].length;}}}else{f=e.match(/www\.\S*[\s|\)|\!]/i);if(f){d=e.indexOf(f[0]);endPos=d+f[0].length;f="http://"+f[0];}else{var b=e.match(/(http|fb):\/\/\S*[\s|\)|\!]/i);if(b){f=b[0];d=e.indexOf(b[0]);endPos=d+b[0].length;}}}if(f){f=f.replace(/[\s|\)|\!]/g,'');var a=f.charAt(f.length-1);if(a.match(/[,|.]/))f=f.substr(0,f.length-1);if(f!=this.lastScrapedURL){this.lastScrapedURL=f;if(f.search('fb:')==0)this.setText(e.substr(0,d)+e.substr(endPos));}else f='';}return f;}});
function PhotoTag(a,b,d,c){copy_properties(this,{centerPoint:new Vector2(a/100,b/100),photoOwnerId:d,photoId:c});copy_properties(this,{taggeeName:'',taggeeId:null,taggeeEmail:'',_saved:false,_pendingAsync:false});}copy_properties(PhotoTag,{SYNCING_ENDPOINT:'/ajax/photo_tagging_ajax.php',MAX_TAGS_PER_PHOTO:50,_tagList:{},_photoKey:function(a,b){return a+':'+b;},tagsForPhoto:function(a,c){var b=PhotoTag._photoKey(a,c);return PhotoTag._tagList[b]||[];},clearTagsForPhoto:function(a,c){var b=PhotoTag._photoKey(a,c);PhotoTag._tagList[b]=[];}});copy_properties(PhotoTag.prototype,{setTaggeeEmail:function(a){if(this.saved){return this;}else this.taggeeEmail=a;return this;},setTaggeeName:function(a){if(this.saved){return this;}else this.taggeeName=a;return this;},setTaggeeId:function(a){if(!(this.saved))this.taggeeId=a;return this;},absoluteCenter:function(b,a){return this.centerPoint.mul(b,a);},submit:function(b){if(!this.taggeeName&&!this.taggeeId){return;}else if(this._saved){return;}else if(this._pendingAsync){return;}else if(PhotoTag.MAX_TAGS_PER_PHOTO<=PhotoTag.tagsForPhoto(this.photoId,this.photoOwnerId).length)return;b=b||bagofholding;var a={pid:this.photoId,id:this.photoOwnerId,subject:this.taggeeId,name:this.taggeeName,email:this.taggeeEmail,action:'add',x:this.centerPoint.x*100,y:this.centerPoint.y*100};this._pendingAsync=true;new AsyncRequest().setURI(PhotoTag.SYNCING_ENDPOINT).setData(a).setHandler(bind(this,this._submitHandler,b)).setErrorHandler(bind(this,this._submitHandler,b)).setFinallyHandler(bind(this,function(){this._pendingAsync=false;})).send();},remove:function(c,a){if(!this.taggeeName&&!this.taggeeId){return;}else if(this._pendingAsync){return;}else if(!this._saved){this._removeLocal();return c(this,{});}c=c||bagofholding;var b={pid:this.photoId,id:this.photoOwnerId,subject:this.taggeeId,name:this.taggeeName,action:a||'remove'};this._pendingAsync=true;new AsyncRequest().setURI(PhotoTag.SYNCING_ENDPOINT).setData(b).setHandler(bind(this,this._removeHandler,c)).setFinallyHandler(bind(this,function(){this._pendingAsync=false;})).send();return false;},invite:function(c){var b={pid:this.photoId,id:this.photoOwnerId,subject:this.taggeeId,name:this.taggeeName,email:this.taggeeEmail,x:this.centerPoint.x*100,y:this.centerPoint.y*100};c=c||bagofholding;var a=new AsyncRequest().setURI('/ajax/invite_photo_tag.php').setHandler(c).setData(b);var d=new Dialog().setAsync(a).show();return false;},_removeLocal:function(){var c=PhotoTag._photoKey(this.photoId,this.photoOwnerId);var d=PhotoTag._tagList[c]||[];for(var a=0,b=d.length;a<b;a++)if(d[a]==this){d.splice(a,1);break;}},setLocalSave:function(){var b=PhotoTag._photoKey(this.photoId,this.photoOwnerId);var a=PhotoTag._tagList[b]=PhotoTag._tagList[b]||[];PhotoTag._tagList[b][a.length]=this;return this;},setSaved:function(){this._saved=true;return this.setLocalSave();},getText:function(){return this.taggeeName||this.taggeeEmail;},getTaggeeId:function(){return this.taggeeId;},_submitHandler:function(a,d){var b=d.getError();var c=d.getPayload();if(b){ErrorDialog.showAsyncError(d);if(!c['tag_success'])return;}this.setSaved();this.taggeeName=c.taggeeName;this.taggeeId=c.taggeeId;a(this,c);},_removeHandler:function(a,b){this._removeLocal();(a||bagofholding)(this,b.getPayload());}});
function PhotoTagViewer(c){if(PhotoTagViewer._instances[c])return PhotoTagViewer._instances[c];copy_properties(this,{minTagDistance:83,photoElementId:c,photoOwnerId:null,photoId:null,photoObjectId:null,tagShowCallback:bagofholding,tagHideCallback:bagofholding,showingTag:null,tagFrame:null,nameFrame:null,_taggingEnabled:false});this._getPhotoElement=bind(null,ge,c);this._destruct=function(){b.remove();this.hideTag();this.tagHideCallback();delete PhotoTagViewer._instances[c];};this._wait_for_load=function(d){d.deferUntil(image_has_loaded.bind(this,this._getPhotoElement()),100);};if(!this._getPhotoElement())throw new Error('No images with the id `'+c+'\' '+'found on the page.  PhotoTagViewer Abort.');var a=bind(this,this._photoMouseMove);var b=Event.listen(document,'mousemove',a);onunloadRegister(bind(this,this._destruct));PhotoTagViewer._instances[c]=this;}copy_properties(PhotoTagViewer,{_instances:{},getInstance:function(a){return PhotoTagViewer._instances[a];}});copy_properties(PhotoTagViewer.prototype,{setPhotoData:function(b,a){this.photoOwnerId=b;this.photoId=a;this.hideTag();this.tagHideCallback();return this;},setPhotoObjectId:function(a){this.photoObjectId=a;return this;},setMinTagDistance:function(a){this.minTagDistance=a;return this;},registerTagHover:function(b,a){if(!b&&!a){this.tagShowCallback=bind(this,this.showTagText);this.tagHideCallback=bind(this,this.hideTagText);}else{this.tagShowCallback=b;this.tagHideCallback=a;}return this;},enableTagging:function(){this._taggingEnabled=true;},disableTagging:function(){this._taggingEnabled=false;},_photoClick:function(event){if(!this._getPhotoElement())return this._destruct();if(!this._taggingEnabled)return true;var a=PhotoTag.tagsForPhoto(this.photoId,this.photoOwnerId);if(PhotoTag.MAX_TAGS_PER_PHOTO<=a.length){new ErrorDialog().showError(_tx("Trop de marquages"),_tx("Une photo accepte un maximum de {limit} marquages. Pour en ajouter un, vous devez tout d'abord supprimer l'un des marquages de cette photo.",{limit:PhotoTag.MAX_TAGS_PER_PHOTO}));return $E(event).kill();}},showTag:function(a){if(!this._getPhotoElement())return this._destruct();if(!a)return;if(this._isPhotoCropOn())return;this._wait_for_load(this._showTag.bind(this,a));},_showTag:function(f){if(!this.tagFrame){var e=document.createElement('div');e.style.width=(2*this.minTagDistance)+'px';e.style.height=(2*this.minTagDistance)+'px';CSS.addClass(e,'photo_tag_frame_inside');this.tagFrame=$N('div',null,e);CSS.addClass(this.tagFrame,'photo_tag_frame');this.tagFrame.onclick=bind(this,this._photoClick);DOMScroll.getScrollRoot().appendChild(this.tagFrame);}var d=Vector2.getElementPosition(this._getPhotoElement());var c=Vector2.getElementDimensions(this._getPhotoElement());var i=f.absoluteCenter(c.x,c.y);var a=this._calculateWithinBounds(i,2*this.minTagDistance,this._getPhotoElement());var g=new Vector2(a.size,a.size);var h=g.mul(.5,.5);g.setElementDimensions(DOM.find(this.tagFrame,'div.photo_tag_frame_inside'));new Vector2(-10000,-100000,'document').setElementPosition(this.tagFrame);show(this.tagFrame);var b=Vector2.getElementDimensions(this.tagFrame).sub(a.size,a.size).mul(.5,.5);d.add(a.tagPosition).sub(h).sub(b).setElementPosition(this.tagFrame);},hideTag:function(){hide(this.tagFrame);},showTagText:function(a){if(!this._getPhotoElement())return this._destruct();if(!a||this._taggingEnabled)return;this._wait_for_load(this._showTagText.bind(this,a));},_showTagText:function(d){if(this.nameFrame)this.hideTagText();if(this._isPhotoCropOn())return;this.nameFrame=$N('div',null,$N('span',null,d.getText()));CSS.addClass(this.nameFrame,'photo_tag_name_frame');DOMScroll.getScrollRoot().appendChild(this.nameFrame);var c=Vector2.getElementPosition(this._getPhotoElement());var b=Vector2.getElementDimensions(this._getPhotoElement());var e=d.absoluteCenter(b.x,b.y);var a=this._calculateWithinBounds(e,2*this.minTagDistance,this._getPhotoElement());var f=Vector2.getElementDimensions(this.nameFrame);var g=new Vector2(f.x/2,8+f.y-a.size/2);c.add(a.tagPosition).sub(g).setElementPosition(this.nameFrame);show(this.nameFrame);},hideTagText:function(){if(this.nameFrame)DOM.remove(this.nameFrame);this.nameFrame=null;},_forceWithinBounds:function(c,b,a){c=c.sub(0,0);if(c.x<b){c.x=Math.min(b,a.x);}else if(c.x>a.x-b)c.x=Math.max(0,a.x-b);if(c.y<b){c.y=Math.min(b,a.y);}else if(c.y>a.y-b)c.y=Math.max(0,a.y-b);return c;},_calculateWithinBounds:function(i,b,c){var e=Vector2.getElementPosition(c);var d=Vector2.getElementDimensions(c);var f=Math.max(i.x-b/2,0);var g=Math.min(i.x+b/2,d.x);var j=Math.max(i.y-b/2,0);var a=Math.min(i.y+b/2,d.y);var i=new Vector2((g+f)/2,(j+a)/2);var h=Math.min(g-f,a-j);return {tagPosition:i,size:h};},_photoMouseMove:function(event){if(!this._getPhotoElement())return this._destruct();if(this._taggingEnabled)return;if(!this.tagShowCallback&&!this.tagHideCallback)return;var i=PhotoTag.tagsForPhoto(this.photoId,this.photoOwnerId);if(!i)return;var g=Vector2.getEventPosition(event);var d=Vector2.getElementPosition(this._getPhotoElement());var c=Vector2.getElementDimensions(this._getPhotoElement());var h=g.sub(d);if(h.x>0&&h.x<c.x&&h.y>0&&h.y<c.y){var e=c.magnitude();var f=null;for(var b=0;b<i.length;b++){var a=i[b].absoluteCenter(c.x,c.y);var k=a.sub(h);var j=k.magnitude();if(Math.abs(k.x)<=this.minTagDistance&&Math.abs(k.y)<=this.minTagDistance&&j<=e){e=j;f=i[b];if(0==j)break;}}}if(!f&&this.showingTag&&this.tagHideCallback){this.showingTag=null;this.tagHideCallback(this.showingTag);}else if(f&&this.tagShowCallback&&f!=this.showingTag){this.showingTag=f;this.tagShowCallback(f);}},_isPhotoCropOn:function(){return window.photocrop&&window.photocrop.instance&&true;}});

if (window.Bootloader) { Bootloader.done(["js\/da57hu34ixsksgk0.pkg.js"]); }