/*
HTTP Host: b.static.ak.fbcdn.net
Generated: March 18th 2010 6:30:54 PM PDT
Machine: 10.16.139.108
Locale: nu_ll
Path: js/dialogpro.js
*/

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

function generic_dialog(_L0,_L1){this.className=_L0;this.content=null;this.obj=null;this.popup=null;this.overlay=null;this.modal=null;this.iframe=null;this.hidden_objects=[];if(_L1==true)this.modal=true;}generic_dialog.dialog_stack=null;generic_dialog.prototype.setClassName=function(_L0){if(this.obj)CSS.addClass(this.obj,_L0);this.className=_L0;};generic_dialog.hide_all=function(){if(generic_dialog.dialog_stack!==null){var _L0=generic_dialog.dialog_stack.clone();generic_dialog.dialog_stack=null;for(var i=_L0.length-1;i>=0;i--)_L0[i].hide();}};generic_dialog.prototype.should_hide_objects=!ua.windows();generic_dialog.prototype.should_use_iframe=ua.ie()<7||(ua.osx()&&ua.firefox());generic_dialog.prototype.show_dialog=function(_L0){if(generic_dialog.dialog_stack===null)onunloadRegister(generic_dialog.hide_all,true);if(!this.obj)this.build_dialog();if(typeof(_L0)=='string')_L0=HTML(_L0).setDeferred(true);DOM.setContent(this.content,_L0);var _L1=this.content.getElementsByTagName('img');for(var i=0;i<_L1.length;i++)_L1[i].onload=chain(_L1[i].onload,this.hide_objects.bind(this));this.show();this._focus_first_textbox_or_button.bind(this).defer();return this;};generic_dialog.prototype._focus_first_textbox_or_button=function(){var _L0=['input[type="text"]','textarea','input[type="password"]','input[type="button"]','input[type="submit"]'];var _L1=[];for(var ii=0;ii<_L0.length&&_L1.length==0;ii++)_L1=DOM.scry(this.content,_L0[ii]);if(_L1.length>0){var _L3=_L1[0];try{if(elementY(_L3)>0&&elementX(_L3)>0)_L3.focus();}catch(e){}}return true;};generic_dialog.prototype.make_modal=function(){if(this.modal)return;this.modal=true;if(ua.ie()==7)this.build_iframe();this.build_overlay();this.reset_iframe();};generic_dialog.prototype.show_loading=function(_L0){if(!_L0)_L0=_tx("T\u00e9l\u00e9chargement...");return this.show_dialog('<div class="dialog_loading">'+_L0+'</div>');};generic_dialog.prototype._show_ajax_dialog_custom_loader=function(_L0,src,_L2,_L3){if(_L0)this.show_loading(_L0);var _L4=function(_L3,_L7){var _L0=_L3?_L7.getPayload():_L7.getPayload().responseText;this.show_dialog(_L0);}.bind(this,_L3);var _L5=function(_L7){ErrorDialog.showAsyncError(_L7);this.hide(false);}.bind(this);var _L6=new AsyncRequest().setOption('suppressEvaluation',!_L3).setURI(src).setData(_L2||{}).setHandler(_L4).setErrorHandler(_L5).setTransportErrorHandler(_L5);if(!_L2)_L6.setMethod('GET').setReadOnly(true);_L6.send();return this;};generic_dialog.prototype.show_ajax_dialog=function(src,_L1,_L2){_L1=_L1||false;var _L3=_tx("T\u00e9l\u00e9chargement...");return this._show_ajax_dialog_custom_loader(_L3,src,_L1,_L2);};generic_dialog.prototype.show_prompt=function(_L0,_L1){return this.show_dialog('<h2 class="dialog_title"><span>'+_L0+'</span></h2><div class="dialog_content">'+_L1+'</div>');};generic_dialog.prototype.show_message=function(_L0,_L1,_L2){if(_L2==null)_L2=_tx("Ok");return this.show_choice(_L0,_L1,_L2,function(){generic_dialog.get_dialog(this).fade_out(100);});};generic_dialog.prototype.show_choice=function(title,content,button1,button1js,button2,button2js,buttons_msg,button3,button3js){var buttons='<div class="dialog_buttons" id="dialog_buttons">';if(typeof(buttons_msg)!='undefined'){buttons+='<div class="dialog_buttons_msg">';buttons+=buttons_msg;buttons+='</div>';}buttons+='<input class="inputsubmit" type="button" value="'+button1+'" id="dialog_button1" />';if(button2){var button2_class='inputsubmit';if(button2==_tx("Annuler"))button2_class+=' inputaux';buttons+='<input class="'+button2_class+'" type="button" value="'+button2+'" id="dialog_button2" />';}if(button3){var button3_class='inputsubmit';if(button3==_tx("Annuler"))button3_class+=' inputaux';buttons+='<input class="'+button3_class+'" type="button" value="'+button3+'" id="dialog_button3" />';}this.show_prompt(title,this.content_to_markup(content)+buttons);var inputs=this.obj.getElementsByTagName('input');if(button3){button1obj=inputs[inputs.length-3];button2obj=inputs[inputs.length-2];button3obj=inputs[inputs.length-1];}else if(button2){button1obj=inputs[inputs.length-2];button2obj=inputs[inputs.length-1];}else button1obj=inputs[inputs.length-1];if(button1js&&button1){if(typeof button1js=='string')eval('button1js = function() {'+button1js+'}');button1obj.onclick=button1js;}if(button2js&&button2){if(typeof button2js=='string')eval('button2js = function() {'+button2js+'}');button2obj.onclick=button2js;}if(button3js&&button3){if(typeof button3js=='string')eval('button3js = function() {'+button3js+'}');button3obj.onclick=button3js;}if(!this.modal){document.onkeyup=function(e){var _L1=(e&&e.which)?e.which:event.keyCode;var _L2=(typeof button2obj!='undefined');var _L3=(typeof button3obj!='undefined');var _L4=ua.safari();if(_L4&&_L1==13)button1obj.click();if(_L1==27)if(_L3){button3obj.click();}else if(_L2){button2obj.click();}else button1obj.click();document.onkeyup=function(){};};this.button_to_focus=button1obj;button1obj.offsetWidth&&button1obj.focus();}return this;};generic_dialog.prototype.content_to_markup=function(_L0){return (typeof _L0=='string')?'<div class="dialog_body">'+_L0+'</div>':'<div class="dialog_summary">'+_L0.summary+'</div><div class="dialog_body">'+_L0.body+'</div>';};generic_dialog.prototype.hide=function(_L0){if(this.obj)this.obj.style.display='none';if(this.iframe)this.iframe.style.display='none';if(this.overlay)this.overlay.style.display='none';if(this.timeout){clearTimeout(this.timeout);this.timeout=null;return;}if(this.hidden_objects.length){for(var i=0,il=this.hidden_objects.length;i<il;i++)this.hidden_objects[i].style.visibility='';this.hidden_objects=[];}clearInterval(this.active_hiding);if(!_L0){if(generic_dialog.dialog_stack){var _L3=generic_dialog.dialog_stack;for(var i=_L3.length-1;i>=0;i--)if(_L3[i]==this)_L3.splice(i,1);if(_L3.length)_L3[_L3.length-1].show();}if(this.obj){this.obj.parentNode.removeChild(this.obj);this.obj=null;}if(this.close_handler)this.close_handler();}return this;};generic_dialog.prototype.fade_out=function(_L0,_L1,_L2){if(!this.popup)return this;try{animation(this.obj).duration(_L1||0).checkpoint().to('opacity',0).hide().duration(_L0||350).ondone(function(){_L2&&_L2();this.hide();}.bind(this)).go();}catch(e){this.hide();}return this;};generic_dialog.prototype.show=function(){if(this.obj&&this.obj.style.display){this.obj.style.visibility='hidden';this.obj.style.display='';this.reset_dialog();this.obj.style.visibility='';this.obj.dialog=this;}else this.reset_dialog();this.hide_objects();clearInterval(this.active_hiding);this.active_hiding=setInterval(this.active_resize.bind(this),500);var _L0=generic_dialog.dialog_stack?generic_dialog.dialog_stack:generic_dialog.dialog_stack=[];if(_L0.length){var _L1=_L0[_L0.length-1];if(_L1!=this&&!_L1.is_stackable)_L1.hide();}for(var i=_L0.length-1;i>=0;i--)if(_L0[i]==this){_L0.splice(i,1);}else _L0[i].hide(true);_L0.push(this);return this;};generic_dialog.prototype.active_resize=function(){if(this.last_offset_height!=this.content.offsetHeight){this.hide_objects();this.last_offset_height=this.content.offsetHeight;}};generic_dialog.prototype.hide_objects=function(){var _L0=[],_L1=[];var _L2=['',0,1,2,4,5,9,3];for(var i=0;i<_L2.length;i++){var _L4=ge('ad_'+_L2[i]);if(_L4!=null)_L0.push(_L4);}var _L5={x:elementX(this.content),y:elementY(this.content),w:this.content.offsetWidth,h:this.content.offsetHeight};if(this.should_hide_objects){var _L6=document.getElementsByTagName('iframe');for(var i=0;i<_L6.length;i++)if(_L6[i].className.indexOf('share_hide_on_dialog')!=-1)_L1.push(_L6[i]);}var _L7=[].concat($A(DOM.scry(document.body,'embed')),$A(DOM.scry(document.body,'object')));for(var i=0;i<_L7.length;i++)if((_L7[i].getAttribute('wmode')||'').toLowerCase()!='transparent'||this.should_hide_objects)_L1.push(_L7[i]);for(var i=0;i<_L1.length;i++){var _L8=_L1[i].offsetHeight?_L1[i]:_L1[i].parentNode;swf_rect={x:elementX(_L8),y:elementY(_L8),w:_L8.offsetWidth,h:_L8.offsetHeight};if(!DOM.contains(this.content,_L1[i])&&_L5.y+_L5.h>swf_rect.y&&swf_rect.y+swf_rect.h>_L5.y&&_L5.x+_L5.w>swf_rect.x&&swf_rect.x+swf_rect.w>_L5.w&&this.hidden_objects.indexOf(_L8)==-1)_L0.push(_L8);}for(var i=0;i<_L0.length;i++){this.hidden_objects.push(_L0[i]);_L0[i].style.visibility='hidden';}};generic_dialog.prototype.build_dialog=function(){if(!this.obj)this.obj=document.createElement('div');CSS.setClass(this.obj,'generic_dialog'+(this.className?' '+this.className:''));this.obj.style.display='none';onloadRegister(function(){DOM.getRootElement().appendChild(this.obj);}.bind(this));if(this.should_use_iframe||(this.modal&&ua.ie()==7))this.build_iframe();if(!this.popup){this.popup=document.createElement('div');CSS.setClass(this.popup,'generic_dialog_popup');}this.popup.style.left=this.popup.style.top='';this.obj.appendChild(this.popup);if(this.modal)this.build_overlay();};generic_dialog.prototype.build_iframe=function(){if(!this.iframe&&!(this.iframe=ge('generic_dialog_iframe'))){this.iframe=document.createElement('iframe');this.iframe.id='generic_dialog_iframe';this.iframe.src="/common/blank.html";}this.iframe.frameBorder='0';onloadRegister(function(){DOM.getRootElement().appendChild(this.iframe);}.bind(this));};generic_dialog.prototype.build_overlay=function(){this.overlay=document.createElement('div');this.overlay.id='generic_dialog_overlay';this.overlay.style.height=Vector2.getDocumentDimensions().y+'px';onloadRegister(function(){DOM.getRootElement().appendChild(this.overlay);}.bind(this));};generic_dialog.prototype.reset_dialog=function(){if(!this.popup)return;onloadRegister(function(){this.reset_dialog_obj();this.reset_iframe();}.bind(this));};generic_dialog.prototype.reset_iframe=function(){if(!this.should_use_iframe&&!(this.modal&&ua.ie()==7))return;if(this.modal){this.iframe.style.left='0px';this.iframe.style.top='0px';this.iframe.style.width='100%';var _L0=Vector2.getDocumentDimensions().y;if(_L0>10000)_L0=10000;this.iframe.style.height=_L0+'px';}else{this.iframe.style.left=elementX(this.frame)+'px';this.iframe.style.top=elementY(this.frame)+'px';this.iframe.style.width=this.frame.offsetWidth+'px';this.iframe.style.height=this.frame.offsetHeight+'px';}this.iframe.style.display='';};generic_dialog.prototype.reset_dialog_obj=function(){};generic_dialog.get_dialog=function(obj){while(!obj.dialog&&obj.parentNode)obj=obj.parentNode;return obj.dialog?obj.dialog:false;};function pop_dialog(_L0,_L1,_L2){this.top=125;this.parent.construct(this,_L0,_L2);}pop_dialog.extend('generic_dialog');pop_dialog.prototype.do_expand_animation=false;pop_dialog.prototype.kill_expand_animation=true;pop_dialog.prototype.show_ajax_dialog=function(src,_L1,_L2,_L3){_L1=_L1||false;if(this.do_expand_animation&&!this.kill_expand_animation){var _L4=null;this.show_loading_title(_L2);}else var _L4=_tx("T\u00e9l\u00e9chargement...");return this._show_ajax_dialog_custom_loader(_L4,src,_L1,_L3);};pop_dialog.prototype.show_message=function(_L0,_L1,_L2){if(this.do_expand_animation&&!this.kill_expand_animation){this.show_loading_title(_L0);}else this.show_loading();return this.parent.show_message(_L0,_L1,_L2);};pop_dialog.prototype.show_dialog=function(_L0,_L1){var _L2=this.parent.show_dialog(_L0);if(this.do_expand_animation&&!_L1&&!this.kill_expand_animation){function _L3(_L8,i){var i=(i?i:0);if(this.done_loading_title!=true&&i<10){i++;setTimeout(_L3.bind(this,_L8,i),50);}else _L8&&_L8();}function _L4(_L0,_L8,_L9){var _La=0;var _Lb=_L0.getElementsByTagName('img');var _Lc=ua.safari()<3;for(var i=0;i<_Lb.length;i++){var _Ld=_Lb[i];if(image_has_loaded(_Ld))_La++;}if(_La!=_Lb.length){if(_L9<20){_L9++;setTimeout(function(){_L4(_L0,_L8,_L9);},100);}else _L8();}else _L8();}var _L5=this.content.getElementsByTagName('div');for(var i=0;i<_L5.length;i++)if(_L5[i].className=='dialog_content'){expand_animation_div=_L5[i];break;}var _L7=document.createElement('div');_L7.style.padding='0px';_L7.style.margin='0px';_L7.style.overflow='visible';expand_animation_div.parentNode.insertBefore(_L7,expand_animation_div);_L7.appendChild(expand_animation_div);expand_animation_div.style.overflow='hidden';_L4(expand_animation_div,function(){_L3.bind(this,function(){this.content.getElementsByTagName('h2')[0].className='';animation(expand_animation_div).to('height','auto').from(0).from('opacity',0).to(1).ease(animation.ease.both).show().duration(200).ondone(function(){_L7.parentNode.insertBefore(expand_animation_div,_L7);_L7.parentNode.removeChild(_L7);if(!this.button_to_focus){var _L8=this.obj.getElementsByTagName('input');for(var i=0;i<_L8.length;i++)if(_L8[i].type=='button'&&_L8[i].id=='dialog_button1'){this.button_to_focus=_L8[i];break;}}if(this.button_to_focus)setTimeout(function(){this.button_to_focus.focus();}.bind(this),50);expand_animation_div.style.overflow='visible';this.do_expand_animation=false;this.show();}.bind(this,{expand_animation_div:expand_animation_div,container_div:_L7})).go();}.bind(this))();}.bind(this,{expand_animation_div:expand_animation_div}),0);}return _L2;};pop_dialog.prototype.build_dialog=function(){this.parent.build_dialog();CSS.addClass(this.obj,'pop_dialog');if(intl_locale_is_rtl())CSS.addClass(this.obj,'pop_dialog_rtl');var _L0;if(ua.ie()<=6){_L0='<div class="pop_squarecontainer">'+'<div class="pop_squareborder pop_borderopacity"></div>'+'<div class="pop_content pop_content_old" id="pop_content"></div>'+'</div>';}else if(ua.firefox()>=3||ua.safari()>=3){_L0='<div class="pop_container_advanced">'+'<div class="pop_content" id="pop_content"></div>'+'</div>';}else _L0='<div class="pop_container">'+'<div class="pop_verticalslab"></div>'+'<div class="pop_horizontalslab"></div>'+'<div class="pop_topleft"></div>'+'<div class="pop_topright"></div>'+'<div class="pop_bottomright"></div>'+'<div class="pop_bottomleft"></div>'+'<div class="pop_content pop_content_old" id="pop_content"></div>'+'</div>';set_inner_html(this.popup,_L0);this.frame=DOM.find(this.popup,'div.pop_content');this.content=this.frame;};pop_dialog.prototype.reset_dialog_obj=function(){this.popup.style.top=Vector2.getScrollPosition().y+this.top+'px';};pop_dialog.prototype.show_prompt=function(_L0,_L1){if(!this.do_expand_animation||this.kill_expand_animation)return this.show_dialog('<h2 class="dialog_title"><span>'+_L0+'</span></h2><div class="dialog_content">'+_L1+'</div>');return this.show_dialog('<h2 class="dialog_loading"><span>'+_L0+'</span></h2><div class="dialog_content" style="display:none;">'+_L1+'</div>');};pop_dialog.prototype.show_loading_title=function(_L0){if(!this.kill_expand_animation){this.do_expand_animation=true;this.show_dialog('<h2 class="dialog_loading"><span>'+_L0+'</span></h2>',true);setTimeout(function(){this.done_loading_title=true;}.bind(this),200);}else this.show_loading();};

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