(function(){function AccountConstructor(){this.layer_name='account';this.tab={};this.cur_tab='main';this.account_data={};this.superclass=SimpleLayer.prototype;this.init=function(){_debug('account.init');this.superclass.init.apply(this);var self=this;this.tab['main']=new Showable(create_block_element("main_container",this.container)).setParent(this).setDependencies(this.tab,['payment','agreement','terms']);this.tab['main'].content=new Scrollable(create_block_element("main_content",this.tab['main'].dom_obj),this.tab['main'].dom_obj);this.tab['main'].onshow=function(){self.tab['main'].content.scrollbar.reset()};stb.load({"type":"account_info","action":"get_main_info"},function(result){this.account_data=result;this.fill_main_info(result);if(this.account_data['account_payment_info']){this.tab['payment'].content.dom_obj.innerHTML=this.account_data['account_payment_info'];} if(this.account_data['account_agreement_info']){this.tab['agreement'].content.dom_obj.innerHTML=this.account_data['account_agreement_info'];} if(this.account_data['account_terms_info']){this.tab['terms'].content.dom_obj.innerHTML=this.account_data['account_terms_info'];}},this);this.tab['payment']=new Showable(create_block_element("payment_container",this.container)).setParent(this).setDependencies(this.tab,['main','agreement','terms']);this.tab['payment'].content=new Scrollable(create_block_element("payment_content",this.tab['payment'].dom_obj),this.tab['payment'].dom_obj);this.tab['payment'].onshow=function(){self.tab['payment'].content.scrollbar.reset()};this.tab['payment'].dom_obj.hide();stb.load({"type":"account_info","action":"get_payment_info"},function(result){if(!this.account_data['account_payment_info']){this.tab['payment'].content.dom_obj.innerHTML=result;}},this);this.tab['agreement']=new Showable(create_block_element("agreement_container",this.container)).setParent(this).setDependencies(this.tab,['main','payment','terms']);this.tab['agreement'].content=new Scrollable(create_block_element("agreement_content",this.tab['agreement'].dom_obj),this.tab['agreement'].dom_obj);this.tab['agreement'].onshow=function(){self.tab['agreement'].content.scrollbar.reset()};this.tab['agreement'].dom_obj.hide();stb.load({"type":"account_info","action":"get_agreement_info"},function(result){if(!this.account_data['account_agreement_info']){this.tab['agreement'].content.dom_obj.innerHTML=result;}},this);this.tab['terms']=new Showable(create_block_element("terms_container",this.container)).setParent(this).setDependencies(this.tab,['main','payment','agreement']);this.tab['terms'].content=new Scrollable(create_block_element("terms_content",this.tab['terms'].dom_obj),this.tab['terms'].dom_obj);this.tab['terms'].onshow=function(){self.tab['terms'].content.scrollbar.reset()};this.tab['terms'].dom_obj.hide();stb.load({"type":"account_info","action":"get_terms_info"},function(result){if(!this.account_data['account_terms_info']){this.tab['terms'].content.dom_obj.innerHTML=result;}},this);this.hide();(function(){_debug('blocking key.blue');module.blocking.hide();module.account.show(module.blocking);module.account.tab['payment'].show();module.account.cur_tab='payment';module.account.update_header_path([{"alias":"tab","item":word['account_payment']}]);module.account.color_buttons.get('red').enable();if(stb.profile['external_payment_page_url']){module.account.color_buttons.get('green').enable();module.account.color_buttons.get('green').setText(get_word('account_pay'));}else{module.account.color_buttons.get('green').disable();} module.account.color_buttons.get('yellow').enable();module.account.color_buttons.get('blue').enable();}).bind(key.BLUE,module.blocking);(function(){_debug('blocking key.info');module.blocking.hide();module.account.show(module.blocking);}).bind(key.INFO,module.blocking).bind(key.YELLOW,module.blocking);var blocking_account_payment=create_block_element('blocking_account_info',module.blocking.blocking_buttons);blocking_account_payment.innerHTML='
'+get_word('blocking_account_info');var blocking_account_info=create_block_element('blocking_account_payment',module.blocking.blocking_buttons);blocking_account_info.innerHTML=' '+get_word('blocking_account_payment');var scope=this;this.parent_password_promt=new ModalForm({"title":get_word('parent_password_title'),"parent":main_menu});this.parent_password_promt.enableOnExitClose();this.parent_password_promt.addItem(new ModalFormInput({"label":get_word('password_label'),"name":"parent_password","type":"password","onchange":function(){_debug('change');scope.parent_password_promt.resetStatus()}}));this.parent_password_promt.addItem(new ModalFormButton({"value":get_word("ok_btn"),"onclick":function(){var parent_password=scope.parent_password_promt.getItemByName('parent_password').getValue();_debug('parent_password',parent_password);_debug('stb.user.parent_password',stb.user.parent_password);if(parent_password==stb.user.parent_password){scope.parent_password_promt.hide();scope.parent_password_promt.callback&&scope.parent_password_promt.callback();}else{scope.parent_password_promt.setStatus(get_word('parent_password_error'));}}}));this.parent_password_promt.addItem(new ModalFormButton({"value":get_word("cancel_btn"),"onclick":function(){scope.parent_password_promt.hide();}}));};this.show=function(return_layer){_debug('account.show');this.superclass.show.apply(this);this.return_layer=return_layer;this.update_header_path([{"alias":"tab","item":word['account_info']}]);this.color_buttons.get('red').disable();this.color_buttons.get('green').enable();this.color_buttons.get('yellow').enable();this.color_buttons.get('blue').enable();stb.load({"type":"account_info","action":"get_main_info"},function(result){this.account_data=result;this.fill_main_info(result);if(this.account_data['account_payment_info']){this.tab['payment'].content.dom_obj.innerHTML=this.account_data['account_payment_info'];} if(this.account_data['account_agreement_info']){this.tab['agreement'].content.dom_obj.innerHTML=this.account_data['account_agreement_info'];} if(this.account_data['account_terms_info']){this.tab['terms'].content.dom_obj.innerHTML=this.account_data['account_terms_info'];}},this);};this.fill_main_info=function(result){_debug('account.fill_main_info',result);var info='';if(result['fname']){info+=''+get_word('User')+': '+result['fname']+'