cleanup of form, rename, route, added fonts
diff --git a/erpnext/buying/Module Def/Buying/Buying.txt b/erpnext/buying/Module Def/Buying/Buying.txt
deleted file mode 100644
index 16cae81..0000000
--- a/erpnext/buying/Module Def/Buying/Buying.txt
+++ /dev/null
@@ -1,155 +0,0 @@
-# Module Def, Buying
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-01 17:40:38',
-		'docstatus': 0,
-		'modified': '2012-01-10 17:52:19',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'name': '__common__',
-		'parent': 'Buying',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def Item
-	{
-		'doctype': 'Module Def Item',
-		'name': '__common__',
-		'parent': 'Buying',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def
-	{
-		'disabled': 'No',
-		'doctype': u'Module Def',
-		'doctype_list': 'DocType Mapper, Purchase Receipt-Payable Voucher\nDocType Mapper, Purchase Order-Payable Voucher\nDocType Mapper, Purchase Order-Purchase Receipt\nDocType Mapper, Indent-Purchase Order\nPrint Format, Purchase Order Format\nPrint Format, Purchase Receipt Format\nDocType Label, Indent',
-		'file_list': 'scm.gif,FileData/00209',
-		'is_hidden': 'No',
-		'module_desc': '<p>All details about your Suppliers and past transactions</p>',
-		'module_icon': 'Buying.gif',
-		'module_label': 'Buying',
-		'module_name': 'Buying',
-		'module_seq': 4,
-		'name': '__common__'
-	},
-
-	# Module Def, Buying
-	{
-		'doctype': u'Module Def',
-		'name': 'Buying'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Your Supplier Database',
-		'display_name': 'Supplier',
-		'doc_name': 'Supplier',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'id\nsupplier_type\nsupplier_status\ncompany'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Buy requests from various people in your company',
-		'display_name': 'Indent',
-		'doc_name': 'Indent',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\ntransaction_date\nsales_order_no\nremark'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Orders you have placed to your suppliers',
-		'display_name': 'Purchase Order',
-		'doc_name': 'Purchase Order',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\nsupplier\ntransaction_date\ngrand_total'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Itemwise Receipt Details',
-		'doc_name': 'Purchase Receipt Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Purchase in Transit',
-		'doc_name': 'PV Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Pending PO Items To Receive',
-		'doc_name': 'PO Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Pending PO Items To Bill',
-		'doc_name': 'PO Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Itemwise Purchase Details',
-		'doc_name': 'PO Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Ledger details of your creditors',
-		'display_name': "Creditor's Ledger",
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'icon': 'accept.gif'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Purchase User'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Purchase Manager'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Administrator'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Purchase Master Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js
index 2ac62f2..ebf3593 100644
--- a/erpnext/buying/doctype/supplier/supplier.js
+++ b/erpnext/buying/doctype/supplier/supplier.js
@@ -58,15 +58,6 @@
 			parent: cur_frm.fields_dict['Address HTML'].wrapper,
 			page_length: 2,
 			new_doctype: "Address",
-			new_doc_onload: function(dn) {
-				ndoc = locals["Address"][dn];
-				ndoc.supplier = cur_frm.doc.name;
-				ndoc.supplier_name = cur_frm.doc.supplier_name;
-				ndoc.address_type = 'Office';								
-			},		
-			new_doc_onsave: function(dn) {				
-				cur_frm.address_list.run()
-			},	
 			get_query: function() {
 				return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
 			},
@@ -100,14 +91,6 @@
 			parent: cur_frm.fields_dict['Contact HTML'].wrapper,
 			page_length: 2,
 			new_doctype: "Contact",
-			new_doc_onload: function(dn) {
-				ndoc = locals["Contact"][dn];
-				ndoc.supplier = cur_frm.doc.name;
-				ndoc.supplier_name = cur_frm.doc.supplier_name;
-			},
-			new_doc_onsave: function(dn) {				
-				cur_frm.contact_list.run()
-			},
 			get_query: function() {
 				return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
 			},
@@ -128,6 +111,7 @@
 
 // make purchase order list
 cur_frm.cscript.make_po_list = function(parent, doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
 	var lst = new Listing();
 	lst.colwidths = ['5%','25%','20%','25%','25%'];
 	lst.colnames = ['Sr.','Id','Status','PO Date','Grand Total'];
@@ -142,6 +126,7 @@
 
 // make purchase receipt list
 cur_frm.cscript.make_pr_list = function(parent,doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
 	var lst = new Listing();
 	lst.colwidths = ['5%','20%','20%','20%','15%','20%'];
 	lst.colnames = ['Sr.','Id','Status','Receipt Date','% Billed','Grand Total'];
@@ -156,6 +141,7 @@
 
 // make purchase invoice list
 cur_frm.cscript.make_pi_list = function(parent,doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
 	var lst = new Listing();
 	lst.colwidths = ['5%','20%','20%','20%','15%','20%'];
 	lst.colnames = ['Sr.','Id','Posting Date','Credit To','Bill Date','Grand Total'];
diff --git a/erpnext/home/page/desktop/desktop.css b/erpnext/home/page/desktop/desktop.css
index cc6126e..874f11b 100644
--- a/erpnext/home/page/desktop/desktop.css
+++ b/erpnext/home/page/desktop/desktop.css
@@ -46,10 +46,10 @@
 	width: 56px;
 	height: 56px;
 	border: 4px solid white;
-	box-shadow: 0 0 10px 1px black;
-	-moz-box-shadow: 0 0 10px 1px black;
-	-webkit-box-shadow: 0 0 10px 1px black;
-	-o-box-shadow: 0 0 10px 1px black;
+	box-shadow: 0 0 4px 1px black;
+	-moz-box-shadow: 0 0 4px 1px black;
+	-webkit-box-shadow: 0 0 4px 1px black;
+	-o-box-shadow: 0 0 4px 1px black;
 	margin: auto;
 }
 
@@ -65,14 +65,14 @@
 	/*font-size: 12px;*/
 	padding-top: 10px;
 	text-align: center;
-	text-shadow: 1px 1px 5px #000, 3px 3px 5px #000;
+	text-shadow: 0px 0px 3px #000, 0px 0px 3px #000, 0px 0px 2px #000;
 }
 
 /* Hover and click effects */
 .case-border:hover, .circle:hover, .hover-effect {
-	box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
-	-moz-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
-	-webkit-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
+	box-shadow: 0 0 2px 0px black, 0 0 4px 1px white !important;
+	-moz-box-shadow: 0 0 2px 0px black, 0 0 4px 1px white !important;
+	-webkit-box-shadow: 0 0 2px 0px black, 0 0 4px 1px white !important;
 	-o-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
 }
 
@@ -105,10 +105,10 @@
 	margin-top: -74px;
 	margin-right: 10px;
 	border: 2px solid white;
-	box-shadow: 0 0 10px 1px black;
-	-moz-box-shadow: 0 0 10px 1px black;
-	-webkit-box-shadow: 0 0 10px 1px black;
-	-o-box-shadow: 0 0 10px 1px black;
+	box-shadow: 0 0 4px 1px black;
+	-moz-box-shadow: 0 0 4px 1px black;
+	-webkit-box-shadow: 0 0 4px 1px black;
+	-o-box-shadow: 0 0 4px 1px black;
 }
 
 .circle-text {
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index d678077..9f5f717 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -72,15 +72,6 @@
 			parent: cur_frm.fields_dict['Address HTML'].wrapper,
 			page_length: 2,
 			new_doctype: "Address",
-			new_doc_onload: function(dn) {
-				ndoc = locals["Address"][dn];
-				ndoc.customer = cur_frm.doc.name;
-				ndoc.customer_name = cur_frm.doc.customer_name;
-				ndoc.address_type = 'Office';				
-			},
-			new_doc_onsave: function(dn) {				
-				cur_frm.address_list.run()				
-			},
 			get_query: function() {
 				return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
 			},
@@ -114,17 +105,6 @@
 			parent: cur_frm.fields_dict['Contact HTML'].wrapper,
 			page_length: 2,
 			new_doctype: "Contact",
-			new_doc_onload: function(dn) {
-				ndoc = locals["Contact"][dn];
-				ndoc.customer = cur_frm.doc.name;
-				ndoc.customer_name = cur_frm.doc.customer_name;
-				if(cur_frm.doc.customer_type == 'Individual') {
-					ndoc.first_name = cur_frm.doc.customer_name;
-				}
-			},
-			new_doc_onsave: function(dn) {				
-				cur_frm.contact_list.run()
-			},
 			get_query: function() {
 				return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
 			},
@@ -174,6 +154,7 @@
 // make quotation list
 // --------------------
 cur_frm.cscript.make_qtn_list = function(parent,doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
 
 	var lst = new Listing();
 	lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
@@ -191,6 +172,8 @@
 // make so list
 // -------------
 cur_frm.cscript.make_so_list = function(parent,doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
+
 	var lst = new Listing();
 	lst.colwidths = ['5%','20%','20%','30%','25%'];
 	lst.colnames = ['Sr.','Id','Status','Sales Order Date','Grand Total'];
@@ -207,6 +190,8 @@
 // make dn list
 // -------------
 cur_frm.cscript.make_dn_list = function(parent,doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
+
 	var lst = new Listing();
 	lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
 	lst.colnames = ['Sr.','Id','Status','Delivery Note Date','Territory','Grand Total'];
@@ -223,6 +208,8 @@
 // make si list
 // -------------
 cur_frm.cscript.make_si_list = function(parent,doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
+	
 	var lst = new Listing();
 	lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
 	lst.colnames = ['Sr.','Id','Posting Date','Due Date','Debit To','Grand Total'];
diff --git a/erpnext/setup/doctype/contact_control/contact_control.js b/erpnext/setup/doctype/contact_control/contact_control.js
index b6825eb..f58e75d 100755
--- a/erpnext/setup/doctype/contact_control/contact_control.js
+++ b/erpnext/setup/doctype/contact_control/contact_control.js
@@ -1,14 +1,6 @@
 // common partner functions
 // =========================
 
-/*
-// make shipping list body
-// ------------------------
-cur_frm.cscript.make_sl_body = function(){
-	cur_frm.fields_dict['Shipping HTML'].wrapper.innerHTML = '';
-	cur_frm.shipping_html = $a(cur_frm.fields_dict['Shipping HTML'].wrapper,'div');
-}
-*/
 
 // make history list body
 // -----------------------
@@ -18,35 +10,6 @@
 }
 
 
-/*
-// set shipping list message
-// --------------------------
-cur_frm.cscript.set_sl_msg = function(doc){
-	cur_frm.shipping_html.innerHTML = 'Shipping Address Details will appear only when you save the ' + doc.doctype.toLowerCase();
-}
-*/
-/*
-// set history list message
-// -------------------------
-cur_frm.cscript.set_hl_msg = function(doc){
-	cur_frm.history_html.innerHTML= 'History Details will appear only when you save the ' + doc.doctype.toLowerCase();
-}
-*/
-
-
-/*
-// make shipping address
-// -------------
-cur_frm.cscript.make_shipping_address = function(doc, dt, dn){
-  	cur_frm.shipping_html.innerHTML = '';
-
-	var dsn = cur_frm.doc.customer_name;
-	var dsa = cur_frm.doc.address;
-	cl = new AddressList(cur_frm.shipping_html,dt,dn,dsn,dsa);
-}
-*/
-
-
 // make history
 // -------------
 cur_frm.cscript.make_history = function(doc,dt,dn){
@@ -157,406 +120,4 @@
 	cur_frm.fields_dict['territory'].get_query = function(doc,dt,dn) {
 		return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
 	}
-}
-
-
-// =======================================================================================================
-
-// contact list
-// --------------
-ContactList = function(parent,dt,dn,dsn){
-	
-	var me = this;
-	
-	this.dt = dt;
-	this.dn = dn;
-	this.dsn = dsn ? dsn : dn;
-
-	this.wrapper = $a(parent,'div');
-	me.get_list();
-}
-
-// add contact
-// ------------
-ContactList.prototype.add_contact = function(){
-	var me = this;
-	
-	// onload - set default values
-	var cont = LocalDB.create('Contact');
-
-	var c = locals['Contact'][cont];
-	
-	if(me.dt == 'Customer')	{
-		c.is_customer = 1;
-		c.customer = me.dn;
-		c.customer_name = me.dsn;
-	}
-	else if(me.dt == 'Supplier'){
-		c.is_supplier = 1;
-		c.supplier = me.dn;
-		c.supplier_name = me.dsn;
-	}
-	else if(me.dt == 'Sales Partner'){
-		c.is_sales_partner = 1;
-		c.sales_partner = me.dn;
-		//c.sales_partner_name = me.dsn;
-	}
-	
-	loaddoc('Contact',c.name);
-}
-
-// get contact list
-// -----------------
-ContactList.prototype.get_list = function(){
-	var me = this;
-	
-	me.make_list();
-	
-	var dt = me.dt.toLowerCase().split(' ').join('_');
-	
-	// build query
-	me.lst.get_query = function(){
-		this.query = repl("select name, first_name, last_name, concat_ws(' ', first_name, last_name), email_id, contact_no, department, designation, is_primary_contact, has_login, disable_login from tabContact where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
-
-		this.query_max = repl("select count(name) from tabContact where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
-	}
-	
-	// render list ui
-	me.lst.show_cell = function(cell,ri,ci,d){
-		me.render_list(cell,ri,ci,d);
-	}
-	
-	// run query
-	me.lst.run();
-	
-	// onrun
-	me.lst.onrun = function(){
-		if(!this.has_data()){
-			this.rec_label.innerHTML = '';
-			
-			$a(this.rec_label,'span').innerHTML = "You do not have any contact. ";
-			$($a(this.rec_label,'span')).html('Add a new contact').addClass('link_type').click(function(){ me.add_contact(); });
-			
-			$dh(this.results);
-		}
-		else{
-			$ds(this.results);
-		}
-	}	
-}
-
-// make list
-// -----------
-ContactList.prototype.make_list = function(){
-	var me = this;
-	
-	var l = new Listing();
-	l.colwidths = ['5%','30%','30%','20%','20%'];
-	l.colnames = ['Sr.','Contact Name','Email Id','Contact No', 'Action'];
-	l.page_len = 10;
-  
-	me.lst = l;
-	
-	l.make(me.wrapper);
-	
-	// Add contact button
-	me.add_btn = $btn(l.btn_area,'+ Add Contact', function(){ me.add_contact();}, {fontWeight:'bold'});
-}
-
-// make contact cell
-// ------------------
-ContactList.prototype.render_list = function(cell,ri,ci,d){
-	var me = this;
-
-	// name
-	if(ci == 0){
-		var nm = $a($a(cell,'div'),'span','',{cursor:'pointer'});
-		nm.innerHTML = d[ri][3];
-		nm.id = d[ri][0];
-		
-		nm.onclick = function(){
-			loaddoc('Contact', this.id);
-			
-			// on save callback - refresh list
-		}
-
-		// department and designation
-		var des = d[ri][7] ? d[ri][7] : '';
-		var dep = d[ri][6] ? d[ri][6] : '';
-		
-		var sp = $a(cell,'div','comment');
-		sp.innerHTML = des + (dep ? (', ' + dep) : ''); 
-	}
-	
-	// email id, contact no, department, designation
-	// -----------------------------------------------------
-	if(ci == 1) cell.innerHTML = d[ri][4] ? d[ri][4] : '-';
-	if(ci == 2) cell.innerHTML = d[ri][5] ? d[ri][5] : '-';
-	
-	// actions
-	// --------------------------------------
-	if(ci== 3) me.make_actions(cell,ri,ci,d);
-}
-
-// make actions
-// ---------------
-ContactList.prototype.make_actions = function(cell,ri,ci,d){
-	var me = this;
-	
-	var tab = make_table(cell,1,2,'100%',['40%','60%']);
-
-	// Edit and Delete
-	var t = make_table($td(tab,0,0),1,2);
-	
-	var edit = $a($td(t,0,0),'div','wn-icon ic-doc_edit');
-	$(edit).click(function(){ loaddoc('Contact',d[ri][0]); });
-	
-	edit.setAttribute('title','Edit');
-
-// Below code should be uncommented once customer/venodr invitation process is stable
-// ===========================================================================
-/* 
-	var del = $a($td(t,0,1),'div','wn-icon ic-trash');
-	$(del).click(function(){ me.delete_contact(d[ri][0],d[ri][4]) });
-
-	set_custom_tooltip(del, 'Delete');
-	
-	//  Invite, Enable and Disable - Integrate after gateway logic incorporated
-
-	if(d[ri][9] == 'Yes')	{
-		if(d[ri][10] == 'Yes'){
-			var enb = $a($td(tab,0,1),'div','wn-icon ic-checkmark');
-			$(enb).click(function(){ me.enable_login(d[ri][0], d[ri][4]); });
-		}
-		else{
-			var dsb = $a($td(tab,0,1),'div','wn-icon ic-delete');
-			$(dsb).click(function(){ me.disable_login(d[ri][0], d[ri][4]) });
-		}
-	}
-	else{
-		var inv = $a($td(tab,0,1),'div','wn-icon ic-mail');
-		$(inv).click(function(){ me.invite_contact(d[ri][0], d[ri][4], d[ri][1], d[ri][2]) });
-	}*/
-}
-
-// enable login
-// ----------------------------------------------------------
-ContactList.prototype.enable_login = function(id, email_id){
-	var me = this;
-	
-	var callback = function(r,rt){
-		me.get_list();
-		
-		if(!r.exc) msgprint('Login for contact enabled',1);
-		else errprint(r.exc);
-	}
-	
-	var args = {};
-	args.contact = id;
-	args.email = email_id;
-	
-	$c_obj('Contact Control','enable_login',JSON.stringify(args),callback);
-}
-
-// disable login
-// -------------------------------------------------------------
-ContactList.prototype.disable_login = function(id, email_id){
-	var me = this;
-	
-	var callback = function(r,rt){
-		me.get_list();
-		
-		if(!r.exc) msgprint('Login for contact disabled',1);
-		else errprint(r.exc);
-	}
-
-	var args = {};
-	args.contact = id;
-	args.email = email_id;
-		
-	$c_obj('Contact Control','disable_login',JSON.stringify(args),callback);
-}
-
-// delete contact
-// -----------------
-ContactList.prototype.delete_contact = function(id,email_id,has_login){
-	var me = this;
-	
-	var callback = function(r,rt){
-		me.get_list();
-		
-		if(!r.exc) msgprint('Contact deleted successfully');
-		else errprint(r.exc);
-	}
-	
-	var args = {};
-	args.contact = id;
-	args.email = email_id;
-	args.has_login = has_login;
-	
-	$c_obj('Contact Control','delete_contact',JSON.stringify(args),callback);
-}
-
-// invite user
-// --------------------------------------------------------
-ContactList.prototype.invite_contact = function(id,email_id,first_name,last_name){
-	var me = this;
-
-	if(!email_id){
-		msgprint("Please add email id and save the contact first. You can then invite contact to view transactions.")
-	}
-	else{
-		var callback = function(r,rt){
-			if(!r.exc) msgprint('Invitation sent');
-			else errprint(r.exc);
-		}
-	
-		var args = {
-			'contact' : id,
-			'email' : email_id,
-			'first_name' : first_name ? first_name : '',
-			'last_name' : last_name ? last_name : '',
-			'usert_type' : 'Partner'
-		};
-		
-		$c_obj('Contact Control','invite_contact',JSON.stringify(args),callback);	
-	}
-}
-
-
-// address list
-// --------------
-AddressList = function(parent,dt,dn,dsn,dsa){
-	
-	var me = this;
-	
-	this.dt = dt;
-	this.dn = dn;
-	this.dsn = dsn ? dsn : dn;
-        this.dsa = dsa ? dsa : '';
-
-	this.wrapper = $a(parent,'div');
-	me.get_addr_list();
-}
-
-
-// add contact
-// ------------
-AddressList.prototype.add_address = function(){
-	var me = this;
-	
-	// onload - set default values
-	var addr = LocalDB.create('Shipping Address');
-
-	var a = locals['Shipping Address'][addr];
-	
-	a.customer = me.dn;
-	a.customer_name = me.dsn;
-        a.customer_address = me.dsa;	
-	loaddoc('Shipping Address',a.name);
-}
-
-
-// get address list
-// -----------------
-AddressList.prototype.get_addr_list = function(){
-	var me = this;
-	
-	me.make_addr_list();
-	
-	var dt = me.dt.toLowerCase().split(' ').join('_');
-	
-	// build query
-	me.lst.get_query = function(){
-		this.query = repl("select name, ship_to, shipping_address, is_primary_address, shipping_details from `tabShipping Address` where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
-
-		this.query_max = repl("select count(name) from `tabShipping Address` where %(dt)s = '%(dn)s'",{'dt':dt, 'dn':me.dn});
-	}
-	
-	// render list ui
-	me.lst.show_cell = function(cell,ri,ci,d){
-		me.render_list(cell,ri,ci,d);
-	}
-	
-	// run query
-	me.lst.run();
-	
-	// onrun
-	me.lst.onrun = function(){
-		if(!this.has_data()){
-			this.rec_label.innerHTML = '';
-			
-			$a(this.rec_label,'span').innerHTML = "You do not have any shipping address.";
-			$($a(this.rec_label,'span')).html('Add a new address').addClass('link_type').click(function(){ me.add_address(); });
-			
-			$dh(this.results);
-		}
-		else{
-			$ds(this.results);
-		}
-	}	
-}
-
-
-// make list
-// -----------
-AddressList.prototype.make_addr_list = function(){
-	var me = this;
-	
-	var l = new Listing();
-	l.colwidths = ['5%', '15%', '25%','10%','35%','10%'];
-	l.colnames = ['Sr.', 'Ship To', 'Shipping Address','Primary Address', 'Shipping Details', 'Action'];
-    l.page_len = 10;
-  
-	me.lst = l;
-	
-	l.make(me.wrapper);
-	
-	// Add address button
-	me.add_btn = $btn(l.btn_area,'+ Add Address', function(){ me.add_address();}, {fontWeight:'bold'});
-}
-
-
-
-// make address cell
-// ------------------
-AddressList.prototype.render_list = function(cell,ri,ci,d){
-	var me = this;
-
-	// name
-	if(ci == 0){
-		var nm = $a($a(cell,'div'),'span','',{cursor:'pointer'});
-		nm.innerHTML = d[ri][1];
-		nm.id = d[ri][0];
-		
-		nm.onclick = function(){
-			loaddoc('Shipping Address', this.id);
-		}
-	}
-	
-	// shipping address, primary address, shipping details
-	// ----------------------------------------------------
-	if(ci == 1) cell.innerHTML = d[ri][2] ? d[ri][2] : '-';
-	if(ci == 2) cell.innerHTML = d[ri][3] ? d[ri][3] : '-';
-	if(ci == 3) cell.innerHTML = d[ri][4] ? d[ri][4] : '-';
-	
-	// actions
-	// --------------------------------------
-	if(ci== 4) me.make_actions(cell,ri,ci,d);
-}
-
-// make actions
-// ---------------
-AddressList.prototype.make_actions = function(cell,ri,ci,d){
-	var me = this;
-	
-	var tab = make_table(cell,1,2,'100%',['40%','60%']);
-
-	// Edit and Delete
-	var t = make_table($td(tab,0,0),1,2);
-	
-	var edit = $a($td(t,0,0),'div','wn-icon ic-doc_edit');
-	$(edit).click(function(){ loaddoc('Shipping Address',d[ri][0]); });
-	
-	edit.setAttribute('title','Edit');
-}
+}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.js b/erpnext/setup/doctype/sales_partner/sales_partner.js
index 0c315f6..30ab18a 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.js
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.js
@@ -51,15 +51,7 @@
 		cur_frm.address_list = new wn.ui.Listing({
 			parent: cur_frm.fields_dict['Address HTML'].wrapper,
 			page_length: 2,
-			new_doctype: "Address",
-			new_doc_onload: function(dn) {
-				ndoc = locals["Address"][dn];
-				ndoc.sales_partner = cur_frm.doc.name;
-				ndoc.address_type = 'Office';				
-			},
-			new_doc_onsave: function(dn) {				
-				cur_frm.address_list.run()
-			},			
+			new_doctype: "Address",			
 			get_query: function() {
 				return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
 			},
@@ -84,13 +76,6 @@
 			parent: cur_frm.fields_dict['Contact HTML'].wrapper,
 			page_length: 2,
 			new_doctype: "Contact",
-			new_doc_onload: function(dn) {
-				ndoc = locals["Contact"][dn];
-				ndoc.sales_partner = cur_frm.doc.name;				
-			},
-			new_doc_onsave: function(dn) {				
-				cur_frm.contact_list.run()
-			},
 			get_query: function() {
 				return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
 			},
diff --git a/erpnext/utilities/doctype/address/address.js b/erpnext/utilities/doctype/address/address.js
index fc274ef..f607d51 100644
--- a/erpnext/utilities/doctype/address/address.js
+++ b/erpnext/utilities/doctype/address/address.js
@@ -17,5 +17,28 @@
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
 	if(doc.customer) cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
 	if(doc.supplier) cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
+	
+	var route = wn.get_route();
+	if(route[1]=='Supplier') {
+		var supplier = locals.Supplier[route[2]]
+		doc.supplier = supplier.name;
+		doc.supplier_name = supplier.supplier_name;
+		doc.address_type = 'Office';
+	} else if(route[1]=='Customer') {
+		var customer = locals.Customer[route[2]]
+		doc.supplier = customer.name;
+		doc.customer_name = customer.customer_name;
+		doc.address_type = 'Office';
+	} else if(route[1]=='Sales Partner') {
+		var sp = locals['Sales Partner'][route[2]];
+		doc.sales_partner = sp.name;
+		ndoc.address_type = 'Office';				
+	}
 }
 
+cur_frm.cscript.hide_dialog = function() {
+	var route = wn.get_route();
+	cur_frm.address_list.run();
+}
+
+
diff --git a/erpnext/utilities/doctype/contact/contact.js b/erpnext/utilities/doctype/contact/contact.js
index 2aa89c1..3cbc1de 100644
--- a/erpnext/utilities/doctype/contact/contact.js
+++ b/erpnext/utilities/doctype/contact/contact.js
@@ -18,54 +18,28 @@
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
 	if(doc.customer) cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
 	if(doc.supplier) cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
-}
 
-/*
-//---------- on refresh ----------------------
-cur_frm.cscript.refresh = function(doc,cdt,cdn){
-	
-}
-
-
-//------------- Trigger on customer ---------------------
-cur_frm.cscript.is_customer = function(doc,cdt,cdn){
-	if(!doc.is_customer){
-		doc.customer = doc.customer_name = doc.customer_address = doc.customer_group = '';
-		refresh_many(['customer','customer_name','customer_address','customer_group']);
+	var route = wn.get_route();
+	if(route[1]=='Supplier') {
+		var supplier = locals.Supplier[route[2]]
+		doc.supplier = supplier.name;
+		doc.supplier_name = supplier.supplier_name;
+	} else if(route[1]=='Customer') {
+		var customer = locals.Customer[route[2]];
+		doc.customer = customer.name;
+		doc.customer_name = customer.customer_name;
+		if(customer.customer_type == 'Individual') {
+			doc.first_name = customer.customer_name;
+		}		
+	} else if(route[1]=='Sales Partner') {
+		var sp = locals['Sales Partner'][route[2]];
+		doc.sales_partner = sp.name;
 	}
 }
 
-//------------- Trigger on supplier -----------------------
-cur_frm.cscript.is_supplier = function(doc,cdt,cdn){
-	if(!doc.is_supplier){
-		doc.supplier = doc.supplier_name = doc.supplier_address = doc.supplier_type = ''; 
-		refresh_many(['supplier','supplier_address','supplier_name','supplier_type']);
-	}
-}
-	
-//--------------- Trigger on sales partner ---------------------
-cur_frm.cscript.is_sales_partner = function(doc,cdt,cdn){
-	if(!doc.is_sales_partner){
-		doc.sales_partner = doc.sales_partner_address = doc.partner_type = '';
-		refresh_many(['sales_partner','sales_partner_address','partner_type']);
-	}
+cur_frm.cscript.hide_dialog = function() {
+	var route = wn.get_route();
+	cur_frm.contact_list.run();
 }
 
-//----------- Trigger on supplier name ------------------------
-cur_frm.cscript.supplier = function(doc,cdt,cdn){
-	arg = {'dt':'Supplier','dn':doc.supplier,'nm':'supplier_name','fld':'supplier_address','type':'supplier_type'};
-	get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
-}
 
-//------------ Trigger on customer name ------------------------
-cur_frm.cscript.customer = function(doc,cdt,cdn){
-	arg = {'dt':'Customer','dn':doc.customer,'nm':'customer_name','fld':'customer_address','type':'customer_group'};
-	get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
-}
-
-//------------ Trigger on sales partner ------------------------
-cur_frm.cscript.sales_partner = function(doc,cdt,cdn){
-	arg = {'dt':'Sales Partner','dn':doc.sales_partner,'nm':'partner_name','fld':'sales_partner_address','type':'partner_type'};
-	get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
-}
-*/
diff --git a/erpnext/utilities/page/calendar/calendar.js b/erpnext/utilities/page/calendar/calendar.js
index ac1ac88..9aa5df8 100644
--- a/erpnext/utilities/page/calendar/calendar.js
+++ b/erpnext/utilities/page/calendar/calendar.js
@@ -24,7 +24,11 @@
 	if(!erpnext.calendar) {
 		erpnext.calendar = new Calendar();
 		erpnext.calendar.init(wrapper);
-		rename_observers.push(erpnext.calendar);
+
+		var me = this;
+		$(document).bind('rename', function(event, dt, old_name, new_name) {
+			erpnext.calendar.rename_notify(dt, old_name, new_name)
+		});
 	}
 }
 
@@ -63,7 +67,7 @@
 
 Calendar.prototype.rename_notify = function(dt, old_name, new_name) {
 	// calendar
-	if(dt = 'Event'){		
+	if(dt = 'Event'){
 		if(this.events_by_name[old_name]) {
 			delete this.events_by_name[old_name];
 		}
diff --git a/erpnext/website/doctype/style_settings/custom_template.css b/erpnext/website/doctype/style_settings/custom_template.css
index 8eb3d63..28515bf 100644
--- a/erpnext/website/doctype/style_settings/custom_template.css
+++ b/erpnext/website/doctype/style_settings/custom_template.css
@@ -5,7 +5,7 @@
 	background-color: #{{ doc.background_color }};
 {% endif %}	
 {% if doc.font %}
-	font-family: {{ doc.font }} !important;
+	font-family: '{{ doc.font }}', Verdana, Sans !important;
 {% endif %}
 {% if doc.font_size %}
 	font-size: {{ doc.font_size }} !important;
@@ -26,6 +26,6 @@
 
 {% if doc.heading_font %}
 h1, h2, h3, h4, h5 {
-	font-family: {{ doc.heading_font}} !important;
+	font-family: '{{ doc.heading_font}}', Arial, 'Helvetica Neue' !important;
 }	
 {% endif %}
diff --git a/erpnext/website/doctype/style_settings/style_settings.txt b/erpnext/website/doctype/style_settings/style_settings.txt
index f07a947..134237a 100644
--- a/erpnext/website/doctype/style_settings/style_settings.txt
+++ b/erpnext/website/doctype/style_settings/style_settings.txt
@@ -5,150 +5,150 @@
 	{
 		'creation': '2012-02-02 09:57:25',
 		'docstatus': 0,
-		'modified': '2012-02-02 10:47:38',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-20 11:25:05',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1328159294',
+		'_last_update': u'1330594969',
 		'allow_attach': 1,
-		'colour': 'White:FFF',
-		'description': 'Set your background color, font and image (tiled)',
+		'colour': u'White:FFF',
+		'description': u'Set your background color, font and image (tiled)',
 		'doctype': 'DocType',
 		'issingle': 1,
 		'max_attachments': 1,
-		'module': 'Website',
+		'module': u'Website',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
-		'version': 9
+		'version': 14
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Style Settings',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Style Settings',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Style Settings',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Style Settings',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
-		'role': 'Website Manager'
+		'role': u'Website Manager'
 	},
 
 	# DocType, Style Settings
 	{
 		'doctype': 'DocType',
-		'name': 'Style Settings'
+		'name': u'Style Settings'
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Solid background color (default light gray)',
-		'doctype': 'DocField',
-		'fieldname': 'background_color',
-		'fieldtype': 'Data',
-		'label': 'Background Color',
+		'colour': u'White:FFF',
+		'description': u'Solid background color (default light gray)',
+		'doctype': u'DocField',
+		'fieldname': u'background_color',
+		'fieldtype': u'Data',
+		'label': u'Background Color',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'If image is selected, color will be ignored (attach first)',
-		'doctype': 'DocField',
-		'fieldname': 'background_image',
-		'fieldtype': 'Select',
-		'label': 'Background Image',
-		'options': 'attach_files:',
+		'colour': u'White:FFF',
+		'description': u'If image is selected, color will be ignored (attach first)',
+		'doctype': u'DocField',
+		'fieldname': u'background_image',
+		'fieldtype': u'Select',
+		'label': u'Background Image',
+		'options': u'attach_files:',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'font',
-		'fieldtype': 'Select',
-		'label': 'Font',
-		'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma',
+		'doctype': u'DocField',
+		'fieldname': u'font',
+		'fieldtype': u'Select',
+		'label': u'Font',
+		'options': u'\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma\nPontano Sans\nDroid Sans\nGill Sans',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'font_size',
-		'fieldtype': 'Select',
-		'label': 'Font Size',
-		'options': '\n12px\n13px\n14px',
+		'doctype': u'DocField',
+		'fieldname': u'font_size',
+		'fieldtype': u'Select',
+		'label': u'Font Size',
+		'options': u'\n12px\n13px\n14px',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'heading_font',
-		'fieldtype': 'Select',
-		'label': 'Heaing Font',
-		'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma',
+		'doctype': u'DocField',
+		'fieldname': u'heading_font',
+		'fieldtype': u'Select',
+		'label': u'Heading Font',
+		'options': u'\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma\nPontano Sans\nDroid Sans\nGill Sans',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Select a white footer foreground color if you have a dark background',
-		'doctype': 'DocField',
-		'fieldname': 'footer_font_color',
-		'fieldtype': 'Select',
-		'label': 'Footer Font Color',
-		'options': '\nwhite',
+		'colour': u'White:FFF',
+		'description': u'Select a white footer foreground color if you have a dark background',
+		'doctype': u'DocField',
+		'fieldname': u'footer_font_color',
+		'fieldtype': u'Select',
+		'label': u'Footer Font Color',
+		'options': u'\nwhite',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Auto generated',
-		'doctype': 'DocField',
-		'fieldname': 'custom_css',
-		'fieldtype': 'Code',
-		'label': 'Custom CSS',
+		'colour': u'White:FFF',
+		'description': u'Auto generated',
+		'doctype': u'DocField',
+		'fieldname': u'custom_css',
+		'fieldtype': u'Code',
+		'label': u'Custom CSS',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'file_list',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'label': 'File List',
+		'label': u'File List',
 		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1