/*    HTTP Host:  static.ak.fbcdn.net                                          */
/*    Generated:  January 27th 2010 9:29:35 AM PST                             */
/*      Machine:  10.16.139.106                                                */
/*       Source:  Backing Store                                                */
/*     Location:  js/mobile/activation.js h:dec2gwff                           */
/*       Locale:  nu_ll                                                        */
/*         Path:  js/mobile/activation.js                                      */

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

function mobile_activation_show_carriers(){var _L0=$('selected_country').value;var _L1=$('carrier_country').value;if(_L0)hide($(_L0+'_carrier_select'));$('selected_country').value=_L1;$('selected_carrier').value=0;show($(_L1+'_carrier_select'));}function mobile_activation_update_carrier(){var _L0=$('selected_country').value+'_carrier_select';$('selected_carrier').value=$(_L0).value;}function MobileSmsActivationController(id,_L1,_L2){copy_properties(this,{profile_id:id,parent:parent,source:_L1,misc:_L2,carrier:null,AJAX_URI:'/ajax/mobile/activation.php',redirect_uri:null});this.start();MobileSmsActivationController.instance=this;}MobileSmsActivationController.instance={};MobileSmsActivationController.getInstance=function(){return MobileSmsActivationController.instance;};copy_properties(MobileSmsActivationController.prototype,{goStep:function(_L0){if(_L0==2){this.getShortCode();return;}else if(_L0==3){this.getConfirmCode();return;}this.start();},start:function(_L0){new AsyncRequest().setURI(this.AJAX_URI).setData({'profile_id':this.profile_id,'get_carriers':1,'source':this.source,'misc':this.misc,'error':_L0}).setHandler(this.showCarriers.bind(this)).send();},showCarriers:function(_L0){var _L1=_L0.getPayload();new Dialog().setTitle(_L1['title']).setBody(_L1['html']).setHandler(this.getShortCode.bind(this)).setButtons([Dialog.NEXT,Dialog.CANCEL]).show();},getShortCode:function(){if(!this.carrier){this.carrier=parseInt($('selected_carrier').value);if(!this.carrier){this.start(true);return false;}}Dialog.getCurrent().setButtonsMessage('<img src="/images/loaders/indicator_blue_small.gif" />');new AsyncRequest().setURI(this.AJAX_URI).setData({'profile_id':this.profile_id,'get_shortcode':1,'carrier':this.carrier}).setHandler(this.showShortCode.bind(this)).send();return false;},showShortCode:function(_L0){var _L1=_L0.getPayload();new Dialog().setTitle(_L1['title']).setBody(_L1['html']).setHandler(this.getConfirmCode.bind(this)).setButtons([Dialog.NEXT,Dialog.CANCEL]).show();},getConfirmCode:function(foo,_L1){Dialog.getCurrent().setButtonsMessage('<img src="/images/loaders/indicator_blue_small.gif" />');new AsyncRequest().setURI(this.AJAX_URI).setData({'profile_id':this.profile_id,'get_code':1,'error':_L1}).setHandler(this.showConfirmCode.bind(this)).send();return false;},showConfirmCode:function(_L0){var _L1=_L0.getPayload();new Dialog().setTitle(_L1['title']).setBody(_L1['html']).setHandler(this.activate.bind(this)).setButtons([Dialog.CONFIRM,Dialog.CANCEL]).show();},activate:function(){var _L0=$('sms_code').value;var _L1=ge('profile_add');_L1=_L1?_L1.checked:null;if(!_L0){this.getConfirmCode(false,true);return false;}new AsyncRequest().setURI(this.AJAX_URI).setData({'profile_id':this.profile_id,'confirm':1,'code':_L0,'profile_add':_L1,'source':this.source,'misc':this.misc}).setHandler(this.confirmCode.bind(this)).send();},confirmCode:function(_L0){var _L1=_L0.getPayload();if(_L1['success']){if(_L1['redirect_now']){goURI(_L1['redirect']);return;}this.redirect_uri=_L1['redirect'];new Dialog().setTitle(_L1['title']).setBody(_L1['html']).setHandler(this.redirect.bind(this)).setButtons([Dialog.OK]).show();}},redirect:function(){if(this.redirect_uri=='reload'){window.location.reload();}else goURI(this.redirect_uri);}});

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