/*
HTTP Host: b.static.ak.fbcdn.net
Generated: March 16th 2010 5:18:37 PM PDT
Machine: 10.16.139.110
Locale: nu_ll
Path: js/acyhmhwdjsowc0kw.pkg.js
*/

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/acyhmhwdjsowc0kw.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)DOM.setContent(captcha_error_msg,null);}).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("Submit"),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();}});
Base64={_initialized:false,_chars:null,_inv:null,_init:function(){Base64._chars=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];Base64._inv={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,a:26,b:27,c:28,d:29,e:30,f:31,g:32,h:33,i:34,j:35,k:36,l:37,m:38,n:39,o:40,p:41,q:42,r:43,s:44,t:45,u:46,v:47,w:48,x:49,y:50,z:51,"0":52,"1":53,"2":54,"3":55,"4":56,"5":57,"6":58,"7":59,"8":60,"9":61,"+":62,"/":63};Base64._initialized=true;},encodeObject:function(a){return Base64.encode(JSON.encode(a));},decodeObject:function(a){return JSON.decode(Base64.decode(a));},_toUtf8:function(d){var c='';for(var b=0;b<d.length;b++){var a=d.charCodeAt(b);if(a<128){c+=String.fromCharCode(a);}else{if(a<2048){c+=String.fromCharCode((a>>6)|192);}else{if(a<65536){c+=String.fromCharCode((a>>12)|224);}else{c+=String.fromCharCode((a>>18)|240);c+=String.fromCharCode(((a>>12)&63)|128);}c+=String.fromCharCode(((a>>6)&63)|128);}c+=String.fromCharCode((a&63)|128);}}return c;},_fromUtf8:function(d){var c='';for(var b=0;b<d.length;b++){var a=d.charCodeAt(b);if(a<128){c+=String.fromCharCode(a);}else if(!(a<192))if(a<224&&d.length>b+1){c+=String.fromCharCode(((a&31)<<6)|(d.charCodeAt(++b)&63));}else if(a<240&&d.length>b+2){c+=String.fromCharCode(((a&15)<<12)|((d.charCodeAt(++b)&63)<<6)|(d.charCodeAt(++b)&63));}else if(a<248&&d.length>b+3)c+=String.fromCharCode(((a&7)<<18)|((d.charCodeAt(++b)&63)<<12)|((d.charCodeAt(++b)&63)<<6)|(d.charCodeAt(++b)&63));}return c;},encode:function(e){if(!Base64._initialized)Base64._init();e=Base64._toUtf8(e);var d='';var c='';var a=e.length%3;if(a>0)for(;a<3;a++){c+='=';e+="\0";}for(a=0;a<e.length;a+=3){var b=(e.charCodeAt(a)<<16)+(e.charCodeAt(a+1)<<8)+e.charCodeAt(a+2);b=[(b>>>18)&63,(b>>>12)&63,(b>>>6)&63,b&63];d+=Base64._chars[b[0]]+Base64._chars[b[1]]+Base64._chars[b[2]]+Base64._chars[b[3]];}return d.substring(0,d.length-c.length)+c;},decode:function(e){if(!Base64._initialized)Base64._init();e=e.replace(new RegExp('[^'+Base64._chars.join("")+'=]','g'),"");var c=(e.charAt(e.length-1)=='='?(e.charAt(e.length-2)=='='?'AA':'A'):"");var d="";e=e.substr(0,e.length-c.length)+c;for(var a=0;a<e.length;a+=4){var b=(Base64._inv[e.charAt(a)]<<18)+(Base64._inv[e.charAt(a+1)]<<12)+(Base64._inv[e.charAt(a+2)]<<6)+Base64._inv[e.charAt(a+3)];d+=String.fromCharCode((b>>>16)&255,(b>>>8)&255,b&255);}d=d.substring(0,d.length-c.length);return Base64._fromUtf8(d);}};
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 domainDialog(c){copy_properties(this,{dialog:null});if(c){var d=_tx("Supported Email Addresses");var a='<p class="domain_description">'+_tx("We currently support the domains listed below for use through our Webmail Importer. If you do not see your email domain in this list, please try finding your friends through our File Importer.")+'</p>'+'<div class="supported_domains">'+'<ul>';for(var b=0;b<c.length;b++)a+='<li>'+c[b]+'</li>';a+='</ul></div>';this.dialog=new Dialog().setTitle(d).setButtons(Dialog.OK).setBody(a);}}copy_properties(domainDialog.prototype,{show:function(){this.dialog.show();}});function appletSubmit(a){var b={scraped_data:a,full_post:true};CIWebmailInputController.instance.parent.onSubmit(b);}
function contact_dialog_async_with_form(a){var b=new AsyncRequest().setMethod('GET').setReadOnly(true).setData({app_id:a}).setURI('/ajax/apps/contact_developer.php');new Dialog().setAsync(b).show();}

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