budget distribution cleanup and formatting of markdown
diff --git a/erpnext/accounts/doctype/account/account.txt b/erpnext/accounts/doctype/account/account.txt
index e3ec85a..b649c9a 100644
--- a/erpnext/accounts/doctype/account/account.txt
+++ b/erpnext/accounts/doctype/account/account.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2012-07-03 13:30:50',
 		'docstatus': 0,
-		'modified': '2012-07-11 09:21:01',
+		'modified': '2012-07-11 13:58:44',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -17,6 +17,7 @@
 		'allow_trash': 1,
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
+		'description': u'An **Account** is heading under which financial and business transactions are carried on. For example, \u201cTravel Expense\u201d is an account, \u201cCustomer Zoe\u201d, \u201cSupplier Mae\u201d are accounts. \n\n**Note:** ERPNext creates accounts for Customers and Suppliers automatically.\n\n### Groups and Ledgers\n\nThere are two main kinds of Accounts in ERPNext - Group and Ledger. Groups can have sub-groups and ledgers within them, whereas ledgers are the leaf nodes of your chart and cannot be further classified.\n\nAccounting Transactions can only be made against Ledger Accounts (not Groups)\n',
 		'doctype': 'DocType',
 		'document_type': u'Master',
 		'in_create': 1,
diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.js b/erpnext/accounts/doctype/budget_distribution/budget_distribution.js
index d7deb9a..1f72c3c 100644
--- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.js
+++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.js
@@ -20,6 +20,11 @@
       refresh_field('budget_distribution_details');
     }
     
-    $c('runserverobj',args={'method' : 'get_months', 'docs' : compress_doclist(make_doclist(doc.doctype, doc.name))},callback1);
+    $c('runserverobj',args={'method' : 'get_months', 'docs' : 
+		compress_doclist(make_doclist(doc.doctype, doc.name))},callback1);
   }
+}
+
+cur_frm.cscript.refresh = function(doc,cdt,cdn){
+	cur_frm.toggle_fields('distribution_id', doc.__islocal);
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.py b/erpnext/accounts/doctype/budget_distribution/budget_distribution.py
index 9468b60..090b8fb 100644
--- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.py
+++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.py
@@ -14,31 +14,20 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Please edit this list and import only required elements
 import webnotes
 
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, getchildren, make_autoname
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
+from webnotes.utils import flt
+from webnotes.model.doc import addchild
+from webnotes.model.doclist import getlist
+from webnotes import msgprint
 
 class DocType:
   def __init__(self,doc,doclist=[]):
     self.doc,self.doclist = doc,doclist
     
   def get_months(self):
-    month_list = ['January','February','March','April','May','June','July','August','September','October','November','December']
+    month_list = ['January','February','March','April','May','June','July','August','September',
+		'October','November','December']
     idx =1
     for m in month_list:
       mnth = addchild(self.doc,'budget_distribution_details','Budget Distribution Detail',1,self.doclist)
@@ -50,9 +39,5 @@
     total = 0
     for d in getlist(self.doclist,'budget_distribution_details'):
       total = flt(total) + flt(d.percentage_allocation)
-    if total > 100:
-      msgprint("Percentage Allocation should not exceed 100%.")
-      raise Exception
-    elif total < 100:
-      msgprint("Percentage Allocation should not recede 100%.")
-      raise Exception
\ No newline at end of file
+    if total != 100:
+      msgprint("Percentage Allocation should be equal to 100%%. Currently it is %s%%" % total, raise_exception=1)
diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt b/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt
index ca9b869..ab8a6c8 100644
--- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt
+++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-03-27 14:35:41',
+		'creation': '2012-07-03 13:30:50',
 		'docstatus': 0,
-		'modified': '2012-03-27 14:35:41',
+		'modified': '2012-07-11 14:37:30',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -15,6 +15,7 @@
 		'allow_trash': 1,
 		'autoname': u'field:distribution_id',
 		'colour': u'White:FFF',
+		'description': u'**Budget Distribution** helps you distribute your budget across months if you have seasonality in your business.\n\nTo distribute a budget using this distribution, set this **Budget Distribution** in the **Cost Center**',
 		'doctype': 'DocType',
 		'module': u'Accounts',
 		'name': '__common__',
@@ -22,7 +23,7 @@
 		'section_style': u'Simple',
 		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'version': 24
+		'version': 1
 	},
 
 	# These values are common for all DocField
@@ -108,13 +109,16 @@
 
 	# DocField
 	{
+		'colour': u'White:FFF',
+		'description': u'Name of the Budget Distribution',
 		'doctype': u'DocField',
 		'fieldname': u'distribution_id',
 		'fieldtype': u'Data',
-		'label': u'Distribution ID',
+		'label': u'Distribution Name',
 		'oldfieldname': u'distribution_id',
 		'oldfieldtype': u'Data',
-		'permlevel': 0
+		'permlevel': 0,
+		'reqd': 1
 	},
 
 	# DocField
diff --git a/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt b/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt
index d0912be..0acfdbc 100644
--- a/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt
+++ b/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-03-27 14:35:41',
+		'creation': '2012-07-03 13:30:47',
 		'docstatus': 0,
-		'modified': '2012-03-27 14:35:41',
+		'modified': '2012-07-11 14:32:16',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -21,7 +21,7 @@
 		'section_style': u'Tray',
 		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'version': 6
+		'version': 1
 	},
 
 	# These values are common for all DocField
@@ -60,16 +60,5 @@
 		'oldfieldname': u'percentage_allocation',
 		'oldfieldtype': u'Currency',
 		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'aggregate_percentage',
-		'fieldtype': u'Currency',
-		'label': u'Aggregate Percentage',
-		'oldfieldname': u'aggregate_percentage',
-		'oldfieldtype': u'Currency',
-		'permlevel': 2
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.txt b/erpnext/accounts/doctype/cost_center/cost_center.txt
index aea5fbb..e4b529e 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.txt
+++ b/erpnext/accounts/doctype/cost_center/cost_center.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2012-07-03 13:30:47',
 		'docstatus': 0,
-		'modified': '2012-07-10 18:06:51',
+		'modified': '2012-07-11 14:04:33',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -18,6 +18,7 @@
 		'autoname': u'field:cost_center_name',
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
+		'description': u'**Chart of Accounts** is mainly for reporting information for governmental purposes and less for how business actually performs. \n\nMost businesses have multiple activities like different product lines, market segments, areas of business that share some common overheads but should ideally have their own structure to report whether they are profitable or not. For this purpose, there is an alternate structure, called the **Cost Centers**.\n\nA tree of **Cost Centers** to cab be designed to reflect the different units of an organization. Each Income / Expense entry is also tagged against a **Cost Center** and hence you can get Profit and Loss against a **Cost Center** too.\n\n### Budgeting\n\n**Cost Centers** can be used for budgeting purposes too. A budget can be set against each **Account** and the system will either stop, warn or ignore the budget based on the settings in the **Company** master.\n\nBudgets can also be distributed seasonally using **Budget Distribution**.',
 		'doctype': 'DocType',
 		'document_type': u'Master',
 		'in_create': 1,
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js
index 793ee59..5350136 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.js
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js
@@ -154,13 +154,12 @@
 			fields: [
 				{fieldtype:'Data', fieldname:'account_name', label:'New Account Name', reqd:true},
 				{fieldtype:'Select', fieldname:'group_or_ledger', label:'Group or Ledger',
-					options:'Group\nLedger'},
+					options:'Group\nLedger', description:'Further accounts can be made under Groups,\
+					 	but entries can be made against Ledger'},
 				{fieldtype:'Select', fieldname:'account_type', label:'Account Type',
 					options: ['', 'Fixed Asset Account', 'Bank or Cash', 'Expense Account', 'Tax',
 						'Income Account', 'Chargeable'].join('\n') },
 				{fieldtype:'Float', fieldname:'tax_rate', label:'Tax Rate'},
-				{fieldtype:'Select', fieldname:'master_type', label:'Master Type',
-					options: ['NA', 'Supplier', 'Customer', 'Employee'].join('\n') },
 				{fieldtype:'Button', fieldname:'create_new', label:'Create New' }
 			]
 		})
@@ -171,11 +170,9 @@
 		$(fd.group_or_ledger.input).change(function() {
 			if($(this).val()=='Group') {
 				$(fd.account_type.wrapper).toggle(false);
-				$(fd.master_type.wrapper).toggle(false);
 				$(fd.tax_rate.wrapper).toggle(false);
 			} else {
 				$(fd.account_type.wrapper).toggle(true);
-				$(fd.master_type.wrapper).toggle(true);
 				if(fd.account_type.get_value()=='Tax') {
 					$(fd.tax_rate.wrapper).toggle(true);
 				}
@@ -200,6 +197,7 @@
 					
 			var node = me.selected_node();
 			v.parent_account = node.data('label');
+			v.master_type = '';
 			v.company = me.company;
 			
 		    $c_obj('GL Control', 'add_ac', v, 
@@ -225,10 +223,11 @@
 			fields: [
 				{fieldtype:'Data', fieldname:'cost_center_name', label:'New Cost Center Name', reqd:true},
 				{fieldtype:'Select', fieldname:'group_or_ledger', label:'Group or Ledger',
-					options:'Group\nLedger'},
+					options:'Group\nLedger', description:'Further accounts can be made under Groups,\
+					 	but entries can be made against Ledger'},
 				{fieldtype:'Button', fieldname:'create_new', label:'Create New' }
 			]
-		})		
+		});
 	
 		// create
 		$(d.fields_dict.create_new.input).click(function() {
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index f5ca6ac..195b021 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -167,6 +167,7 @@
 		ac.old_parent = ''
 		ac_obj = get_obj(doc=ac)
 		ac_obj.doc.freeze_account='No'
+		ac_obj.doc.master_type = ''
 		ac_obj.validate()
 		ac_obj.doc.save(1)
 		ac_obj.on_update()
diff --git a/public/css/all-app.css b/public/css/all-app.css
index 5cfd391..4fa90aa 100644
--- a/public/css/all-app.css
+++ b/public/css/all-app.css
@@ -2244,11 +2244,27 @@
 	position: fixed;
 	bottom: 5px;
 	left: 5px;
-	height: 40px;
-	width: 40px;
+	height: 30px;
+	width: 30px;
 	background: url('../images/erpnext-fade.png') no-repeat top left;
 }
 
+.markdown p {
+	font-size: 13px;
+}
+
+.markdown h1 {
+	margin-bottom: 9px;
+}
+
+.markdown h2 {
+	margin-bottom: 7px;
+}
+
+.markdown h3, .markdown h4 {
+	margin-bottom: 5px;
+}
+
 /*
  *	lib/css/legacy/messages.css
  */
diff --git a/public/css/all-web.css b/public/css/all-web.css
index b32cff8..f825619 100644
--- a/public/css/all-web.css
+++ b/public/css/all-web.css
@@ -2105,11 +2105,27 @@
 	position: fixed;
 	bottom: 5px;
 	left: 5px;
-	height: 40px;
-	width: 40px;
+	height: 30px;
+	width: 30px;
 	background: url('../images/erpnext-fade.png') no-repeat top left;
 }
 
+.markdown p {
+	font-size: 13px;
+}
+
+.markdown h1 {
+	margin-bottom: 9px;
+}
+
+.markdown h2 {
+	margin-bottom: 7px;
+}
+
+.markdown h3, .markdown h4 {
+	margin-bottom: 5px;
+}
+
 /*
  *	lib/css/legacy/messages.css
  */
diff --git a/public/js/all-app.js b/public/js/all-app.js
index 91da926..859a69e 100644
--- a/public/js/all-app.js
+++ b/public/js/all-app.js
@@ -202,7 +202,7 @@
  *	lib/js/wn/misc/tools.js
  */
 wn.markdown=function(txt){if(!wn.md2html){wn.require('js/lib/showdown.js');wn.md2html=new Showdown.converter();}
-return wn.md2html.makeHtml(txt);}
+return'<div class="markdown">'+wn.md2html.makeHtml(txt)+'</div>';}
 /*
  *	lib/js/wn/misc/user.js
  */
@@ -1706,7 +1706,7 @@
 this.appframe.add_button('Submit',function(){cur_frm.savesubmit();},'icon-lock');if(docstatus==1&&p[SUBMIT]){this.appframe.add_button('Update',function(){cur_frm.saveupdate();},'');if(!cur_frm.doc.__unsaved)this.appframe.buttons['Update'].toggle(false);}
 if(docstatus==1&&p[CANCEL])
 this.appframe.add_button('Cancel',function(){cur_frm.savecancel()},'icon-remove');if(docstatus==2&&p[AMEND])
-this.appframe.add_button('Amend',function(){cur_frm.amend_doc()},'icon-pencil');if(cur_frm.meta.description){this.appframe.add_help_button(wn.markdown('## '+cur_frm.doctype+'\n<br>\n'
+this.appframe.add_button('Amend',function(){cur_frm.amend_doc()},'icon-pencil');if(cur_frm.meta.description){this.appframe.add_help_button(wn.markdown('## '+cur_frm.doctype+'\n\n'
 +cur_frm.meta.description));}},show:function(){},hide:function(){},hide_close:function(){this.$w.find('.close').toggle(false);}})
 /*
  *	lib/js/legacy/widgets/form/form.js
@@ -1858,7 +1858,7 @@
  *	lib/js/legacy/widgets/form/form_fields.js
  */
 _f.ColumnBreak=function(){this.set_input=function(){};}
-_f.ColumnBreak.prototype.make_body=function(){this.cell=this.frm.layout.addcell(this.df.width);$y(this.cell.wrapper,{padding:'8px'});_f.cur_col_break_width=this.df.width;var fn=this.df.fieldname?this.df.fieldname:this.df.label;if(this.df&&this.df.label){this.label=$a(this.cell.wrapper,'div','','',this.df.label);}}
+_f.ColumnBreak.prototype.make_body=function(){this.cell=this.frm.layout.addcell(this.df.width);$y(this.cell.wrapper,{padding:'8px'});_f.cur_col_break_width=this.df.width;var fn=this.df.fieldname?this.df.fieldname:this.df.label;if(this.df&&this.df.label){this.label=$a(this.cell.wrapper,'h4','','',this.df.label);}}
 _f.ColumnBreak.prototype.refresh=function(layout){var hidden=0;if((!this.perm[this.df.permlevel])||(!this.perm[this.df.permlevel][READ])||this.df.hidden){hidden=1;}
 if(this.set_hidden!=hidden){if(hidden)
 this.cell.hide();else
diff --git a/public/js/all-web.js b/public/js/all-web.js
index a92ea61..2e7f1ce 100644
--- a/public/js/all-web.js
+++ b/public/js/all-web.js
@@ -89,7 +89,7 @@
  *	lib/js/wn/misc/tools.js
  */
 wn.markdown=function(txt){if(!wn.md2html){wn.require('js/lib/showdown.js');wn.md2html=new Showdown.converter();}
-return wn.md2html.makeHtml(txt);}
+return'<div class="markdown">'+wn.md2html.makeHtml(txt)+'</div>';}
 /*
  *	lib/js/wn/misc/user.js
  */