if(user=='Guest'){$dh(page_body.left_sidebar);}
var current_module;var is_system_manager=0;var module_content_dict={};var user_full_nm={};if(inList(user_roles,'System Manager'))is_system_manager=1;function startup_setup(){pscript.is_erpnext_saas=cint(locals['Control Panel']['Control Panel'].sync_with_gateway)
if(get_url_arg('embed')){$dh(page_body.banner_area);$dh(page_body.wntoolbar);$dh(page_body.footer);return;}
if(user=='Guest'&&!get_url_arg('akey')){if(pscript.is_erpnext_saas){window.location.href='https://www.erpnext.com';return;}}
$td(page_body.wntoolbar.body_tab,0,0).innerHTML='erpnext';$y($td(page_body.wntoolbar.body_tab,0,0),{width:'140px',color:'#FFF',paddingLeft:'8px',paddingRight:'8px',fontSize:'14px'})
$dh(page_body.banner_area);pscript.startup_make_sidebar();$dh(page_body.footer);var callback=function(r,rt){if(r.message){login_file=r.message;}
else{login_file='https://www.erpnext.com';}
pscript.startup_setup_toolbar();}
$c_obj('Home Control','get_login_url','',callback);}
pscript.startup_make_sidebar=function(){$y(page_body.left_sidebar,{width:(100/6)+'%',paddingTop:'8px'});var callback=function(r,rt){var ml=r.message;page_body.left_sidebar.innerHTML='';for(var m=0;mNote: These changes will apply to all users!',ml,update_order,1);}
$c_obj('Home Control','get_module_order','',callback)}
pscript.startup_setup_toolbar=function(){var menu_tab=page_body.wntoolbar.menu_table_right;$td(menu_tab,0,0).innerHTML=''+user_fullname+'';if(pscript.is_erpnext_saas){$td(menu_tab,0,1).innerHTML='Forum';if(is_system_manager){$td(menu_tab,0,3).innerHTML='Billing';}}
else{$dh($td(menu_tab,0,1));$dh($td(menu_tab,0,3));}
$td(menu_tab,0,2).innerHTML='Chat';var cell=menu_tab.rows[0].insertCell(3);cell.innerHTML='Help';$y(cell,page_body.wntoolbar.right_table_style);}
pscript.go_to_account_settings=function(){callback=function(r,rt){if(r.exc){msgprint(r.exc);}
else{msgprint(''
+'Click here to open Account Settings in a new page')}}
$c_page('my_company','my_company','get_account_settings_url','',callback)}
show_chart_browser=function(nm,chart_type){var call_back=function(){if(nm=='Sales Browser'){var sb_obj=new SalesBrowser();sb_obj.set_val(chart_type);}
else if(nm=='Accounts Browser')
pscript.make_chart(chart_type);}
loadpage(nm,call_back);}
ModulePage=function(parent,module_name,module_label,help_page,callback){this.parent=parent;page_body.cur_page.module_page=this;this.wrapper=$a(parent,'div');this.module_name=module_name;this.transactions=[];this.page_head=new PageHeader(this.wrapper,module_label);if(help_page){var btn=this.page_head.add_button('Help',function(){loadpage(this.help_page)},1,'ui-icon-help')
btn.help_page=help_page;}
if(callback)this.callback=function(){callback();}}
get_plural=function(str){if(str.charAt(str.length-1).toLowerCase()=='y')return str.substr(0,str.length-1)+'ies'
else return str+'s';}
pscript.set_user_fullname=function(ele,username,get_latest){var set_it=function(){if(ele)
ele.innerHTML=user_full_nm[username];}
if(get_latest){$c_obj('Home Control','get_user_fullname',username,function(r,rt){user_full_nm[username]=r.message;set_it();});}
else{if(user_full_nm[username]){set_it();}
else
$c_obj('Home Control','get_user_fullname',username,function(r,rt){user_full_nm[username]=r.message;set_it();});}}
startup_setup();