/*    HTTP Host:  static.ak.fbcdn.net                                          */
/*    Generated:  February 10th 2010 3:42:26 AM PST                            */
/*      Machine:  10.16.139.102                                                */
/*       Source:  Backing Store                                                */
/*     Location:  js/da9kndps07wwooc0.pkg.js h:ae6r5rv6                        */
/*       Locale:  nu_ll                                                        */
/*         Path:  js/da9kndps07wwooc0.pkg.js                                   */

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

function CIBase(_L0,_L1){copy_properties(this,{ci_config:_L0,element_ids:_L1});return this;}copy_properties(CIBase.prototype,{getId:function(k){return this.element_ids[k];},setId:function(k,v){this.element_ids[k]=v;return this;},setAjaxMode:function(b){this.ajax_mode=b;return this;},getConfigData:function(){var _L0={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 _L0;}});
function captchaRefresh(_L0,_L1,_L2,_L3,_L4){var _L5={new_captcha_type:_L0,id:_L2,t_auth_token:_L3};_L5.skipped_captcha_data=$('captcha_persist_data').value;if(_L1)_L5.registration_page=true;new AsyncRequest().setURI('/captcha/refresh_ajax.php').setMethod('GET').setReadOnly(true).setData(_L5).setHandler(function(_L6){DOM.setContent($("captcha"),HTML(_L6.getPayload().captcha));if(_L4)DOM.setContent($("captcha_error_msg"),null);}).send();}
function CICaptcha(_L0){copy_properties(this,{captcha_endpoint:'/contact_importer/ajax/captcha.php',callback:_L0,form_name:'ci_captcha_form'});return this;}copy_properties(CICaptcha.prototype,{showDialog:function(){var _L0=new AsyncRequest().setMethod('GET').setReadOnly(true).setURI(this.captcha_endpoint).setData({form_name:this.form_name}).setHandler(bind(this,'handleCaptchaRender')).send();},handleCaptchaRender:function(_L0){var _L1=_L0.getPayload();var _L2=[{name:'submit',label:_tx("Hantar"),handler:bind(this,'submitCaptchaResponse')},Dialog.CANCEL];new Dialog().setTitle('').setBody(_L1.content).setButtons(_L2).show();},submitCaptchaResponse:function(){var _L0=serialize_form($(this.form_name));new AsyncRequest().setURI(this.captcha_endpoint).setMethod('POST').setData(_L0).setHandler(bind(this,'handleCaptchaVerification')).send();},handleCaptchaVerification:function(_L0){var _L1=_L0.getPayload();if(_L1.error){new ErrorDialog().showError(_L1.error.title,_L1.error.message);}else this.callback();}});
function CIInputController(_L0,_L1,_L2,_L3){this.parent.construct(this,_L0,_L1);this.parent.setAjaxMode(_L3);copy_properties(this,{show_captcha:_L2});return this;}CIInputController.extend('CIBase');copy_properties(CIInputController.prototype,{onSubmit:function(_L0){if(this.show_captcha){var _L1=new CICaptcha(bind(this,'_submitLoginForm'));_L1.showDialog();return false;}return this._submitLoginForm(_L0);},_submitLoginForm:function(_L0){var _L1=$(this.getId('form'));var _L2=get_form_attr(_L1,'action');var _L3=serialize_form(_L1);if(_L0)copy_properties(_L3,_L0);if((_L0&&_L0.full_post)||!this.ajax_mode){var f=DOM.create('form',{action:this.ci_config.full_endpoint,method:'POST'});create_hidden_inputs(_L3,f);DOM.getRootElement().appendChild(f);f.submit();return false;}var _L5=new AsyncRequest();if(_L3.jsonp){var _L6=this.getId('login_input');var _L7=this.getId('password');var obj={};obj[_L6]=_L3[_L6];obj[_L7]=_L3[_L7];_L3.creds=Base64.encodeObject(obj);delete _L3[_L6];delete _L3[_L7];_L5.setOption('jsonp',true).setMethod('GET').setReadOnly(true);}_L5.setURI(_L2).setData(_L3).setHandler(bind(this,function(_L9){this.handleLoginSubmit(_L9.getPayload());})).setStatusElement(this.getId('login_status'));if(_L3.jsonp)_L5.addStatusIndicator();_L5.send();return false;},handleLoginSubmit:function(_L0){if(_L0.error){new ErrorDialog().showError(_L0.error.title,_L0.error.body);return;}var _L1=_L0.content;var id=this.getId('contacts_container');DOM.replace($(id),HTML(_L0.content));},getLoginString:function(){return trim($(this.getId('login_input')).value);},showDetailedDisclaimer:function(){var _L0=new AsyncRequest().setURI('/contact_importer/ajax/disclaimer.php');new Dialog().setAsync(_L0).show();},initializeCookieChecking:function(_L0){this.clearCookie();if(this.cookieTimer)clearTimeout(this.cookieTimer);this.checkCookie(_L0);},_getAPICookies:function(){return ['fb_api_auth_token'];},clearCookie:function(){var _L0=this._getAPICookies();for(var i=0;i<_L0.length;i++){var val=getCookie(_L0[i]);if(val)setCookie(_L0[i],'');}},getAuthToken:function(_L0){var _L1=this._getAPICookies();for(var i=0;i<_L1.length;i++){var val=getCookie(_L1[i]);if(!val)continue;var api=val.substr(0,1);if(api==_L0)return val.substr(2);}return null;},openAPIPopup:function(_L0,_L1){var _L2=this.getConfigData();copy_properties(_L2,{api_instance:_L0,login_str:_L1});var url=new URI(this.ci_config.api_endpoint).addQueryData(_L2);if(_L0==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(_L0==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(url,'api_contact_importer',popup_attrs);this.initializeCookieChecking(_L0);},checkCookie:function(_L0){var _L1=this.getAuthToken(_L0);if(_L1){var _L2={api_instance:_L0,auth_token:_L1};this.clearCookie();if(this.show_captcha){var _L3=new CICaptcha(bind(this,'_submitLoginForm',_L2));_L3.showDialog();}else this._submitLoginForm(_L2);}else this.cookieTimer=setTimeout(bind(this,'checkCookie',_L0),500);}});
function CIWebmailValidator(_L0,_L1,_L2,_L3){copy_properties(this,{domains:_L0,domain_importer_map:_L1,enabled_apis:_L2,api_instances:_L3});return this;}copy_properties(CIWebmailValidator.prototype,{isValidEmail:function(_L0){var _L1=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 _L1.test(_L0);},getDomain:function(_L0){var a=_L0.split('@');return a[1];},getImporter:function(_L0){return this.domain_importer_map[this.getDomain(_L0)];},getAPIInstance:function(_L0){var imp=this.getImporter(_L0);if(this.enabled_apis[imp])return imp;return null;},isLiveDomain:function(_L0){return this.getImporter(_L0)==this.api_instances['msft'];},isGmailDomain:function(_L0){return this.getImporter(_L0)==this.api_instances['gmail'];},isYahooDomain:function(_L0){return this.getImporter(_L0)==this.api_instances['yahoo'];},isSupportedDomain:function(_L0){var _L1=this.getDomain(_L0);var len=this.domains.length;for(var i=0;i<len;i++)if(_L1==this.domains[i])return true;return false;}});function CIWebmailInputController(_L0,_L1,_L2,_L3,_L4){this.parent.construct(this,_L0,_L1,_L2,_L3);copy_properties(this,{validator:_L4,login_str:null,ms_login:null,timer:null});this.importer_widget=$(this.getId('widget'));var el=$(this.getId('login_input'));if(ua.firefox()){addEventBase(el,'keypress',bind(this,'delayOnKeypress'));}else addEventBase(el,'keydown',bind(this,'delayOnKeypress'));addEventBase(el,'focus',bind(this,'pollField'));addEventBase(el,'blur',bind(this,'cancelPoll'));el=null;this.validate();CIWebmailInputController.instance=this;return this;}CIWebmailInputController.extend('CIInputController');copy_properties(CIWebmailInputController.prototype,{onSubmit:function(){this.validate();var _L0=this.getLoginString();var _L1=this.validator.getAPIInstance(_L0);if(_L1){this.openAPIPopup(_L1,_L0);return false;}var v=this.validator;if(v.isSupportedDomain(_L0)&&v.isYahooDomain(_L0)){this.injectApplet();return false;}return this.parent.onSubmit();},injectApplet:function(){var el=$(this.getId('login_status'));CSS.addClass(el,'async_saving');show(el);var _L1=DOM.create('applet',{height:1,width:1,archive:"/contact_importer/CI.jar?rand="+Math.random(),code:"com.facebook.CI"});_L1.setAttribute("mayscript","true");_L1.setAttribute("scriptable","true");_L1.appendChild(DOM.create('param',{name:'username',value:this.getLoginString()}));_L1.appendChild(DOM.create('param',{name:'password',value:trim($(this.getId('password')).value)}));this.importer_widget.appendChild(_L1);},validateOnKeypress:function(e){if(this.timer)clearTimeout(this.timer);if(Event.getKeyCode(e)==KEYS.TAB){this.validate();}else this.timer=setTimeout(bind(this,this.validate),300);},delayOnKeypress:function(e){if(this.timer)clearTimeout(this.timer);if(Event.getKeyCode(e)==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 _L0=this.getLoginString();if(!_L0){this.setDefault();return;}if(_L0==this.login_str)return;this.login_str=_L0;var v=this.validator;if(!v.isValidEmail(_L0)){this.setDefault();return;}if(v.isSupportedDomain(_L0)){var _L2=v.getAPIInstance(_L0);if(_L2){if(v.isLiveDomain(_L0)){this.setWindowsLive();}else if(v.isYahooDomain(_L0)){this.setYahoo();}else if(v.isGmailDomain(_L0))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 _L0=this.getConfigData();_L0['unsupported_login']=this.login_str;new AsyncSignal(this.ci_config.log_endpoint,_L0).send();},setDefault:function(){CSS.setClass(this.importer_widget,'default');this.enablePassword();},canHidePassword:function(){return !CSS.hasClass(this.importer_widget,'default');},disablePassword:function(){var _L0=$(this.getId('password'));if(!this.canHidePassword())return;hide(_L0.parentNode.parentNode);},enablePassword:function(){var _L0=$('password');var _L1=_L0.parentNode.parentNode;if(!shown(_L1))show(_L1);}});function CINUXToDoWebmailInputController(_L0,_L1,_L2,_L3,_L4){this.parent.construct(this,_L0,_L1,_L2,_L3,_L4);return this;}CINUXToDoWebmailInputController.extend('CIWebmailInputController');copy_properties(CINUXToDoWebmailInputController.prototype,{disablePassword:function(){},enablePassword:function(){},setYahoo:function(){},setGmail:function(){},setWindowsLive:function(){}});function domainDialog(_L0){copy_properties(this,{dialog:null});if(_L0){var _L1='Supported Email Addresses';var _L2='<p class="domain_description">'+_tx("buat masa ini kami membolehkan domain berikut untuk digunakan melalalui perkhidmatan Webmail Importer kami. Sekiranya anda tidak dapat melihat email domain anda didalam senarai , anda boleh mencuba mencari  rakan anda melalui File Importer  kami.")+'</p>'+'<div class="supported_domains">'+'<ul>';for(var i=0;i<_L0.length;i++)_L2+='<li>'+_L0[i]+'</li>';_L2+='</ul></div>';this.dialog=new Dialog().setTitle(_L1).setButtons(Dialog.OK).setBody(_L2);}}copy_properties(domainDialog.prototype,{show:function(){this.dialog.show();}});function appletSubmit(_L0){var _L1={scraped_data:_L0,full_post:true};CIWebmailInputController.instance.parent.onSubmit(_L1);}

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