/*
HTTP Host: b.static.ak.fbcdn.net
Generated: March 14th 2010 1:24:26 PM PDT
Machine: 10.16.139.103
Locale: nu_ll
Path: js/sav3ej94vkgc40cw.pkg.js
*/

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

function CIBase(a,b){copy_properties(this,{ci_config:a,element_ids:b});return this;}copy_properties(CIBase.prototype,{getId:function(a){return this.element_ids[a];},setId:function(a,b){this.element_ids[a]=b;return this;},setAjaxMode:function(a){this.ajax_mode=a;return this;},getConfigData:function(){var a={type:this.ci_config.type,flow:this.ci_config.flow,domain_id:this.ci_config.domain_id,import_id:this.ci_config.import_id,tracked_params:this.ci_config.tracked_params};return a;}});
function captchaRefresh(d,e,f,a,b){var c={new_captcha_type:d,id:f,t_auth_token:a};c.skipped_captcha_data=$('captcha_persist_data').value;if(e)c.registration_page=true;new AsyncRequest().setURI('/captcha/refresh_ajax.php').setMethod('GET').setReadOnly(true).setData(c).setHandler(function(i){var g=ge('captcha');var h=ge('captcha_error_msg');if(g)DOM.setContent(g,HTML(i.getPayload().captcha));if(b&&h)hide(h);}).send();}
function CICaptcha(a){copy_properties(this,{captcha_endpoint:'/contact_importer/ajax/captcha.php',callback:a,form_name:'ci_captcha_form'});return this;}copy_properties(CICaptcha.prototype,{showDialog:function(){var a=new AsyncRequest().setMethod('GET').setReadOnly(true).setURI(this.captcha_endpoint).setData({form_name:this.form_name}).setHandler(bind(this,'handleCaptchaRender')).send();},handleCaptchaRender:function(c){var b=c.getPayload();var a=[{name:'submit',label:_tx("Aceptar"),handler:bind(this,'submitCaptchaResponse')},Dialog.CANCEL];new Dialog().setTitle('').setBody(b.content).setButtons(a).show();},submitCaptchaResponse:function(){var a=serialize_form($(this.form_name));new AsyncRequest().setURI(this.captcha_endpoint).setMethod('POST').setData(a).setHandler(bind(this,'handleCaptchaVerification')).send();},handleCaptchaVerification:function(b){var a=b.getPayload();if(a.error){new ErrorDialog().showError(a.error.title,a.error.message);}else this.callback();}});
function CIInputController(b,c,d,a){this.parent.construct(this,b,c);this.parent.setAjaxMode(a);copy_properties(this,{show_captcha:d});return this;}CIInputController.extend('CIBase');copy_properties(CIInputController.prototype,{onSubmit:function(b){if(this.show_captcha){var a=new CICaptcha(bind(this,'_submitLoginForm'));a.showDialog();return false;}return this._submitLoginForm(b);},_submitLoginForm:function(h){var e=$(this.getId('form'));var a=get_form_attr(e,'action');var c=serialize_form(e);if(h)copy_properties(c,h);if((h&&h.full_post)||!this.ajax_mode){var d=DOM.create('form',{action:this.ci_config.full_endpoint,method:'POST'});create_hidden_inputs(c,d);DOM.getRootElement().appendChild(d);d.submit();return false;}var b=new AsyncRequest();if(c.jsonp){var f=this.getId('login_input');var i=this.getId('password');var g={};g[f]=c[f];g[i]=c[i];c.creds=Base64.encodeObject(g);delete c[f];delete c[i];b.setOption('jsonp',true).setMethod('GET').setReadOnly(true);}b.setURI(a).setData(c).setHandler(bind(this,function(j){this.handleLoginSubmit(j.getPayload());})).setStatusElement(this.getId('login_status'));if(c.jsonp)b.addStatusIndicator();b.send();return false;},handleLoginSubmit:function(c){if(c.error){new ErrorDialog().showError(c.error.title,c.error.body);return;}var a=c.content;var b=this.getId('contacts_container');DOM.replace($(b),HTML(c.content));},getLoginString:function(){return trim($(this.getId('login_input')).value);},initializeCookieChecking:function(a){this.clearCookie();if(this.cookieTimer)clearTimeout(this.cookieTimer);this.checkCookie(a);},_getAPICookies:function(){return ['fb_api_auth_token'];},clearCookie:function(){var a=this._getAPICookies();for(var b=0;b<a.length;b++){var c=getCookie(a[b]);if(c)setCookie(a[b],'');}},getAuthToken:function(b){var c=this._getAPICookies();for(var d=0;d<c.length;d++){var e=getCookie(c[d]);if(!e)continue;var a=e.substr(0,1);if(a==b)return e.substr(2);}return null;},openAPIPopup:function(a,c){var b=this.getConfigData();copy_properties(b,{api_instance:a,login_str:c});var d=new URI(this.ci_config.api_endpoint).addQueryData(b);if(a==1){popup_attrs='status=0,toolbar=0,location=1,resizable=1,width=600,'+'height=350,left='+((screen.width-600)/2)+',top='+((screen.height-350)/2)+',alwaysRaised=1';}else if(a==3){popup_attrs='height=430,width=450,left='+((screen.width-500)/2)+',top='+((screen.height-450)/2)+',resizable=1,toolbar=0,status=0';}else popup_attrs='height=600,width=830,left='+((screen.width-830)/2)+',top='+((screen.height-600)/2)+',resizable=1,scrollbars=1,toolbar=0,status=0';window.open(d,'api_contact_importer',popup_attrs);this.initializeCookieChecking(a);},checkCookie:function(a){var b=this.getAuthToken(a);if(b){var d={api_instance:a,auth_token:b};this.clearCookie();if(this.show_captcha){var c=new CICaptcha(bind(this,'_submitLoginForm',d));c.showDialog();}else this._submitLoginForm(d);}else this.cookieTimer=setTimeout(bind(this,'checkCookie',a),500);}});
function CIWebmailValidator(c,b,d,a){copy_properties(this,{domains:c,domain_importer_map:b,enabled_apis:d,api_instances:a});return this;}copy_properties(CIWebmailValidator.prototype,{isValidEmail:function(a){var b=new RegExp("[a-z0-9_!#$%&'*+/=?^`{|}~-]+(?:\\.[a-z0-9_!#$%&'*+/=?^`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");return b.test(a);},getDomain:function(b){var a=b.split('@');return a[1];},getImporter:function(a){return this.domain_importer_map[this.getDomain(a)];},getAPIInstance:function(a){var b=this.getImporter(a);if(this.enabled_apis[b])return b;return null;},isLiveDomain:function(a){return this.getImporter(a)==this.api_instances.msft;},isGmailDomain:function(a){return this.getImporter(a)==this.api_instances.gmail;},isYahooDomain:function(a){return this.getImporter(a)==this.api_instances.yahoo;},isSupportedDomain:function(b){var a=this.getDomain(b);var d=this.domains.length;for(var c=0;c<d;c++)if(a==this.domains[c])return true;return false;}});function CIWebmailInputController(b,d,e,a,f){this.parent.construct(this,b,d,e,a);copy_properties(this,{validator:f,login_str:null,ms_login:null,timer:null});this.importer_widget=$(this.getId('widget'));var c=$(this.getId('login_input'));if(ua.firefox()){addEventBase(c,'keypress',bind(this,'delayOnKeypress'));}else addEventBase(c,'keydown',bind(this,'delayOnKeypress'));addEventBase(c,'focus',bind(this,'pollField'));addEventBase(c,'blur',bind(this,'cancelPoll'));c=null;this.validate();CIWebmailInputController.instance=this;return this;}CIWebmailInputController.extend('CIInputController');copy_properties(CIWebmailInputController.prototype,{onSubmit:function(){this.validate();var b=this.getLoginString();var a=this.validator.getAPIInstance(b);var c=(this instanceof CINUXToDoWebmailInputController&&this.validator.isGmailDomain(b));if(c)a=2;if(a){this.openAPIPopup(a,b);return false;}return this.parent.onSubmit();},injectApplet:function(){var b=$(this.getId('login_status'));CSS.addClass(b,'async_saving');show(b);var a=DOM.create('applet',{height:1,width:1,archive:"/contact_importer/CI.jar?rand="+Math.random(),code:"com.facebook.CI"});a.setAttribute("mayscript","true");a.setAttribute("scriptable","true");a.appendChild(DOM.create('param',{name:'username',value:this.getLoginString()}));a.appendChild(DOM.create('param',{name:'password',value:trim($(this.getId('password')).value)}));this.importer_widget.appendChild(a);},validateOnKeypress:function(a){if(this.timer)clearTimeout(this.timer);if(Event.getKeyCode(a)==KEYS.TAB){this.validate();}else this.timer=setTimeout(bind(this,this.validate),300);},delayOnKeypress:function(a){if(this.timer)clearTimeout(this.timer);if(Event.getKeyCode(a)==KEYS.TAB){this.validate();}else this.timer=setTimeout(bind(this,this.pollField),300);},pollField:function(){if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(bind(this,function(){this.validate();this.pollField();}),300);},cancelPoll:function(){if(this.timer)clearTimeout(this.timer);this.validate();},validate:function(){var b=this.getLoginString();if(!b){this.setDefault();return;}if(b==this.login_str)return;this.login_str=b;var c=this.validator;if(!c.isValidEmail(b)){this.setDefault();return;}if(c.isSupportedDomain(b)){var a=c.getAPIInstance(b);if(a){if(c.isLiveDomain(b)){this.setWindowsLive();}else if(c.isYahooDomain(b)){this.setYahoo();}else if(c.isGmailDomain(b))this.setGmail();}else this.setValid();}else this.setUnsupported();},setWindowsLive:function(){CSS.setClass(this.importer_widget,'windows_live_noiframe');this.disablePassword();},setGmail:function(){CSS.setClass(this.importer_widget,'gmail');this.disablePassword();},setYahoo:function(){CSS.setClass(this.importer_widget,'yahoo');this.disablePassword();},setValid:function(){this.enablePassword();CSS.setClass(this.importer_widget,'valid');},setUnsupported:function(){CSS.setClass(this.importer_widget,'unsupported');this.disablePassword();var a=this.getConfigData();a.unsupported_login=this.login_str;new AsyncSignal(this.ci_config.log_endpoint,a).send();},setDefault:function(){CSS.setClass(this.importer_widget,'default');this.enablePassword();},canHidePassword:function(){return !CSS.hasClass(this.importer_widget,'default');},disablePassword:function(){var a=$(this.getId('password'));if(!this.canHidePassword())return;hide(a.parentNode.parentNode);},enablePassword:function(){var b=$('password');var a=b.parentNode.parentNode;if(!shown(a))show(a);}});function CINUXToDoWebmailInputController(b,c,d,a,e){this.parent.construct(this,b,c,d,a,e);return this;}CINUXToDoWebmailInputController.extend('CIWebmailInputController');copy_properties(CINUXToDoWebmailInputController.prototype,{disablePassword:function(){},enablePassword:function(){},setYahoo:function(){},setGmail:function(){},setWindowsLive:function(){}});
function emu_Client(g,h,a,f,e,c,b,d){this.unitId=g;this.unitType=h;this.contextType=a;this.root=f;this.iData=e;this.flags=b;this.hash=d;this.frameStates={};this.eventFrameId=null;this.setStates(c);DataStore.set(this.root,'emuClient',this);}copy_properties(emu_Client,{constants:{EMU_FRAME_EVENT_INIT:1,EMU_FRAME_EVENT_CLICK:2,EMU_FRAME_EVENT_SUBMIT:3,EMU_SERVER_COMMAND_RENDER_FRAME:1000,EMU_SERVER_COMMAND_SET_FRAME_STATE:1001,EMU_SERVER_COMMAND_PLAY_VIDEO:1003,EMU_CLIENT_COMMAND_FRAME_EVENT:2000,EMU_LINK_TARGET_DEFAULT:1,EMU_LINK_TARGET_NEW_WINDOW:2,EMU_FRAME_CONTEXT_TARGET_INLINE:1,EMU_FRAME_CONTEXT_TARGET_DIALOG:2,EMU_FRAME_EVENT_HANDLER:'/ajax/emu/h.php'},getParentDivId:function(a){return 'emu_'+a;},getClient:function(b){var a=ge(emu_Client.getParentDivId(b));if(!a)return null;return DataStore.get(a,'emuClient');}});copy_properties(emu_Client.prototype,{getFrameDivId:function(a){return emu_Client.getParentDivId(this.unitId)+'_'+a;},_emuCmdHandler:function(a){var g=a.getPayload();for(var f=0;f<g.length;f++){var b=g[f];switch(b.cmd){case emu_Client.constants.EMU_SERVER_COMMAND_RENDER_FRAME:if(emu_Client.constants.EMU_FRAME_CONTEXT_TARGET_INLINE==b.params.surface.targetType){var e=this.getFrameDivId(b.params.surface.targetId);var d=ge(e);if(!d){var d=$N('div',{id:e});this.root.appendChild(d);}set_inner_html(d,b.params.surface.buffer);}else if(emu_Client.constants.EMU_FRAME_CONTEXT_TARGET_DIALOG==b.params.surface.targetType){if(!this.root.dialog||!this.root.dialog._showing)this.root.dialog=new Dialog();var c=this.root.dialog;if(b.params.surface.buffer)c.setBody(b.params.surface.buffer);if(b.params.surface.title)c.setTitle(b.params.surface.title);if(b.params.surface.width)c.setContentWidth(b.params.surface.width);c.setButtons(Dialog.OK).show();}break;case emu_Client.constants.EMU_SERVER_COMMAND_SET_FRAME_STATE:this.frameStates[b.params.frameId]=b.params.state;break;}}this.eventFrameId=null;},_emuErrorHandler:function(d){var c=ge('submit_progress_'+this.eventFrameId);if(c)CSS.addClass(c,'hidden');frameDiv=ge(this.getFrameDivId(this.eventFrameId));if(frameDiv){var b=get_all_form_inputs(frameDiv);for(var a=0;a<b.length;a++)b[a].disabled=false;}this.eventFrameId=null;},setStates:function(b){for(var a in b)this.frameStates[a]=b[a];},onEvent:function(e,c,b){if(this.eventFrameId)return;this.eventFrameId=e;switch(c){case emu_Client.constants.EMU_FRAME_EVENT_CLICK:var a=b;break;case emu_Client.constants.EMU_FRAME_EVENT_SUBMIT:var a=serialize_form(b);var d=get_all_form_inputs(b);for(var f=0;f<d.length;f++)d[f].disabled=true;var h=ge('submit_progress_'+this.eventFrameId);if(h)CSS.removeClass(h,'hidden');break;}var g={fss:this.frameStates,ut:this.unitType,ct:this.contextType,f:this.flags,x:this.hash,ida:this.iData,fid:e,et:c,ed:a,rt:'a'};var i=new AsyncRequest();i.setURI(emu_Client.constants.EMU_FRAME_EVENT_HANDLER).setData(g).setHandler(bind(this,'_emuCmdHandler')).setErrorHandler(bind(this,'_emuErrorHandler')).setTransportErrorHandler(bind(this,'_emuErrorHandler')).send();},onRedirect:function(e,b,h){var c=this.root.appendChild($N('form',{action:emu_Client.constants.EMU_FRAME_EVENT_HANDLER,method:'POST',target:(emu_Client.constants.EMU_LINK_TARGET_NEW_WINDOW==h)?'_blank':'',style:{display:'none'}}));var f={ut:this.unitType,ct:this.contextType,f:this.flags,x:this.hash,ida:this.iData,fid:e,et:emu_Client.constants.EMU_FRAME_EVENT_CLICK,rt:'h'};for(var a in b)f['ed['+a+']']=b[a];for(var d in this.frameStates)f['fss['+d+']']=this.frameStates[d];if(ge('post_form_id'))f.post_form_id=$('post_form_id').value;if(ge('fb_dtsg'))f.fb_dtsg=$('fb_dtsg').value;for(var g in f)c.appendChild($N('input',{type:'hidden',name:g,value:f[g]}));c.submit();this.root.removeChild(c);}});function emu_redirect_wrapper(a){emu_Client.getClient(a.adId).onRedirect(a.frameId,a.eventData,a.target);return false;}function emu_action_wrapper(a){emu_Client.getClient(a.adId).onEvent(a.frameId,a.eventType,a.eventData);return false;}
function InviteEmuUIController(a,b,c){this.parent.construct(this,a,b,c);return this;}InviteEmuUIController.extend('CommentableEmuUIController');copy_properties(InviteEmuUIController.prototype,{_init:function(){this.parent._init();},_getCommentInput:function(){return DOM.scry(this.emuFrame,'input[name="email_list"]')[0];}});

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