Merge branch 'master' into dev
diff --git a/build.json b/build.json
index 7b1dfe6..6efbbc3 100644
--- a/build.json
+++ b/build.json
@@ -23,7 +23,4 @@
 	"public/js/complete_setup.js": [
 		"erpnext/startup/js/complete_setup.js",
 	],
-	"public/js/product_category.js": [
-		"erpnext/website/js/product_category.js",
-	],
 }
\ No newline at end of file
diff --git a/data/master.sql.gz b/data/master.sql.gz
index e8f45a9..e9896e4 100644
--- a/data/master.sql.gz
+++ b/data/master.sql.gz
Binary files differ
diff --git a/erpnext/patches/june_2012/cms2.py b/erpnext/patches/june_2012/cms2.py
new file mode 100644
index 0000000..cf494c0
--- /dev/null
+++ b/erpnext/patches/june_2012/cms2.py
@@ -0,0 +1,88 @@
+def execute():
+	import webnotes
+	import webnotes.model.sync
+	
+	# sync doctypes required for the patch
+	webnotes.model.sync.sync('website', 'web_cache')
+	webnotes.model.sync.sync('website', 'web_page')
+	webnotes.model.sync.sync('website', 'blog')
+	webnotes.model.sync.sync('website', 'website_settings')
+	webnotes.model.sync.sync('stock', 'item')
+
+	cleanup()
+
+	save_pages()
+	
+	save_website_settings()
+	
+def cleanup():
+	import webnotes
+		
+	# delete pages from `tabPage` of module Website or of type Webpage
+	webnotes.conn.sql("""\
+		delete from `tabPage`
+		where module='Website' and ifnull(web_page, 'No') = 'Yes'""")
+	
+	# change show_in_website value in item table to 0 or 1
+	webnotes.conn.sql("""\
+		update `tabItem`
+		set show_in_website = if(show_in_website = 'Yes', 1, 0)
+		where show_in_website is not null""")
+		
+	# move comments from comment_doctype Page to Blog
+	webnotes.conn.sql("""\
+		update `tabComment` comm, `tabBlog` blog
+		set comm.comment_doctype = 'Blog', comm.comment_docname = blog.name
+		where comm.comment_docname = blog.page_name""")
+		
+	# delete deprecated pages
+	import webnotes.model
+	for page in ['products', 'contact', 'blog', 'about']:
+		try:
+			webnotes.model.delete_doc('Page', page)
+		except Exception, e:
+			webnotes.modules.patch_handler.log(unicode(e))
+
+	import os
+	import conf
+	# delete other html files
+	exception_list = ['app.html', 'unsupported.html', 'blank.html']
+	conf_dir = os.path.dirname(os.path.abspath(conf.__file__))
+	public_path = os.path.join(conf_dir, 'public')
+	for f in os.listdir(public_path):
+		if f.endswith('.html') and f not in exception_list:
+			os.remove(os.path.join(public_path, f))
+
+def save_pages():
+	"""save all web pages, blogs to create content"""
+	query_map = {
+		'Web Page': """select name from `tabWeb Page` where docstatus=0""",
+		'Blog': """\
+			select name from `tabBlog`
+			where docstatus = 0 and ifnull(published, 0) = 1""",
+		'Item': """\
+			select name from `tabItem`
+			where docstatus = 0 and ifnull(show_in_website, 0) = 1""",
+	}
+
+	import webnotes
+	from webnotes.model.doclist import DocList
+	import webnotes.modules.patch_handler
+
+	for dt in query_map:
+		for result in webnotes.conn.sql(query_map[dt], as_dict=1):
+			try:
+				DocList(dt, result['name'].encode('utf-8')).save()
+			except Exception, e:
+				webnotes.modules.patch_handler.log(unicode(e))
+			
+def save_website_settings():
+	from webnotes.model.code import get_obj
+	
+	# rewrite pages
+	get_obj('Website Settings').on_update()
+	
+	ss = get_obj('Style Settings')
+	ss.validate()
+	ss.doc.save()
+	ss.on_update()
\ No newline at end of file
diff --git a/erpnext/patches/may_2012/cms.py b/erpnext/patches/may_2012/cms.py
deleted file mode 100644
index 2711b1d..0000000
--- a/erpnext/patches/may_2012/cms.py
+++ /dev/null
@@ -1,12 +0,0 @@
-import webnotes
-
-def execute():
-	from webnotes.model.code import get_obj
-	
-	# rewrite pages
-	get_obj('Website Settings').rewrite_pages()
-	
-	ss = get_obj('Style Settings')
-	ss.validate()
-	ss.doc.save()
-	ss.on_update()
\ No newline at end of file
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index ab95e95..5a6748c 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -339,11 +339,6 @@
 	},
 	{
 		'patch_module': 'patches.may_2012',
-		'patch_file': 'cms',
-		'description': 'generate html pages'
-	},
-	{
-		'patch_module': 'patches.may_2012',
 		'patch_file': 'reload_reports',
 		'description': 'reload reports: itemwise sales/delivery details'
 	},
@@ -487,4 +482,9 @@
 		'patch_file': 'deprecate_import_data_control',
 		'description': "deprecate doctype - Import Data Control and page - Import Data"
 	},
+	{
+		'patch_module': 'patches.june_2012',
+		'patch_file': 'cms2',
+		'description': 'cms2 release patches'
+	},
 ]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/listview.js b/erpnext/selling/doctype/sales_order/listview.js
index cbe35da..3fa63a5 100644
--- a/erpnext/selling/doctype/sales_order/listview.js
+++ b/erpnext/selling/doctype/sales_order/listview.js
@@ -3,21 +3,23 @@
 	init: function(d) {
 		this._super(d)
 		this.fields = this.fields.concat([
-			"`tabSales Order`.customer_name", 
+			"`tabSales Order`.customer_name",
+			"`tabSales Order`.status",
+			"`tabSales Order`.order_type",
 			"ifnull(`tabSales Order`.per_delivered,0) as per_delivered", 
 			"ifnull(`tabSales Order`.per_billed,0) as per_billed",
 			"`tabSales Order`.currency", 
 			"ifnull(`tabSales Order`.grand_total_export,0) as grand_total_export"
 		]);
-		this.stats = this.stats.concat(['status', 'company']);
+		this.stats = this.stats.concat(['status', 'order_type', 'company']);
 	},
 	
 	columns: [
 		{width: '3%', content: 'check'},
-		{width: '5%', content:'avatar'},
-		{width: '3%', content:'docstatus'},
-		{width: '15%', content:'name'},
-		{width: '32%', content:'customer_name+tags', css: {color:'#222'}},
+		{width: '5%', content: 'avatar'},
+		{width: '3%', content: 'docstatus'},
+		{width: '15%', content: 'name'},
+		{width: '29%', content: 'customer_name+tags', css: {color:'#222'}},
 		{
 			width: '18%', 
 			content: function(parent, data) { 
@@ -25,7 +27,19 @@
 			},
 			css: {'text-align':'right'}
 		},
-		{width: '8%', content: 'per_delivered', type:'bar-graph', label:'Delivered'},
+		{
+			width: '11%',
+			content: function(parent, data, me) {
+				var order_type = data.order_type.toLowerCase();
+
+				if (order_type === 'sales') {
+					me.render_icon(parent, 'icon-tag', data.order_type);
+					me.render_bar_graph(parent, data, 'per_billed', 'Delivered');
+				} else if (order_type === 'maintenance') {
+					me.render_icon(parent, 'icon-wrench', data.order_type);
+				}
+			},
+		},
 		{width: '8%', content: 'per_billed', type:'bar-graph', label:'Billed'},
 		{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
 	]
diff --git a/erpnext/startup/js/complete_setup.js b/erpnext/startup/js/complete_setup.js
index 9180dfa..83d6567 100644
--- a/erpnext/startup/js/complete_setup.js
+++ b/erpnext/startup/js/complete_setup.js
@@ -138,7 +138,7 @@
 		'Dominican Republic', 'East Timor', 'Ecuador', 'Egypt', 'El Salvador', 
 		'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia', 'Federated States of Micronesia', 
 		'Fiji', 'Finland', 'France', 'Gabon', 'Georgia', 'Germany', 'Ghana', 'Greece', 
-		'Grenada', 'Guatemala', 'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti', 'Honduras', 
+		'Grenada', 'Guatemala', 'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti', 'Honduras', 'Hong Kong',
 		'Hungary', 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Israel', 'Italy', 
 		'Jamaica', 'Japan', 'Jordan', 'Kazakhstan', 'Kenya', 'Kingdom of the Netherlands', 
 		'Kiribati', 'Kuwait', 'Kyrgyzstan', 'Laos', 'Latvia', 'Lebanon', 'Lesotho', 'Liberia', 
@@ -147,7 +147,7 @@
 		'Mexico', 'Moldova', 'Monaco', 'Mongolia', 'Montenegro', 'Morocco', 'Mozambique', 
 		'Myanmar', 'Namibia', 'Nauru', 'Nepal', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 
 		'North Korea', 'Norway', 'Oman', 'Pakistan', 'Palau', 'Panama', 'Papua New Guinea', 
-		'Paraguay', "People's Republic of China", 'Peru', 'Philippines', 'Poland', 'Portugal', 
+		'Paraguay', "China", 'Peru', 'Philippines', 'Poland', 'Portugal', 
 		'Qatar', 'Republic of Ireland', 'Republic of the Congo', 'Romania', 'Russia', 'Rwanda', 
 		'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Vincent and the Grenadines', 'Samoa', 
 		'San Marino', 'Saudi Arabia', 'Senegal', 'Serbia', 'Seychelles', 'Sierra Leone', 
@@ -252,6 +252,11 @@
 		'Cape Verde': ['Atlantic/Cape_Verde'],
 		'Central African Republic': ['Africa/Bangui'],
 		'Chad': ['Africa/Ndjamena'],
+		'China': ['Asia/Shanghai',
+		                               'Asia/Harbin',
+		                               'Asia/Chongqing',
+		                               'Asia/Urumqi',
+		                               'Asia/Kashgar'],
 		'Chile': ['America/Santiago', 'Pacific/Easter'],
 		'Colombia': ['America/Bogota'],
 		'Comoros': ['Indian/Comoro'],
@@ -292,6 +297,7 @@
 		'Guyana': ['America/Guyana'],
 		'Haiti': ['America/Guatemala'],
 		'Honduras': ['America/Tegucigalpa'],
+		'Hong Kong': ['Asia/Hong_Kong'],
 		'Hungary': ['Europe/Budapest'],
 		'Iceland': ['Atlantic/Reykjavik'],
 		'India': ['Asia/Calcutta'],
@@ -365,11 +371,6 @@
 		'Panama': ['America/Panama'],
 		'Papua New Guinea': ['Pacific/Port_Moresby'],
 		'Paraguay': ['America/Asuncion'],
-		"People's Republic of China": ['Asia/Shanghai',
-		                               'Asia/Harbin',
-		                               'Asia/Chongqing',
-		                               'Asia/Urumqi',
-		                               'Asia/Kashgar'],
 		'Peru': ['America/Lima'],
 		'Philippines': ['Asia/Manila'],
 		'Poland': ['Europe/Warsaw'],
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 65698c1..572a790 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -29,8 +29,23 @@
 		}
 		$c_obj(make_doclist(doc.doctype, doc.name),'check_if_sle_exists','',callback);
 	}
+	
+	cur_frm.cscript.hide_website_fields(doc);
 }
 
+cur_frm.cscript.hide_website_fields = function(doc) {
+	var website_fields_list = ['page_name', 'website_image', 'web_short_description',
+								'web_long_description']
+	if (cint(doc.show_in_website)) {
+		unhide_field(website_fields_list);
+	} else {
+		hide_field(website_fields_list);
+	}
+}
+
+cur_frm.cscript.show_in_website = function(doc, dt, dn) {
+	cur_frm.cscript.hide_website_fields(doc);
+}
 
 cur_frm.fields_dict['default_bom'].get_query = function(doc) {
    //var d = locals[this.doctype][this.docname];
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 0f6cc4c..9864fc9 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -46,6 +46,8 @@
 		return ret
 
 	def on_update(self):
+		self.update_page_name()
+		
 		bin = sql("select stock_uom from `tabBin` where item_code = '%s' " % self.doc.item_code)
 		if bin and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
 			msgprint("Please Update Stock UOM with the help of Stock UOM Replace Utility.")
@@ -78,9 +80,13 @@
 			child.conversion_factor = 1
 			child.save()
 
+		self.clear_web_cache()
+
 	# On delete 1. Delete BIN (if none of the corrosponding transactions present, it gets deleted. if present, rolled back due to exception)
 	def on_trash(self):
 		sql("delete from tabBin where item_code='%s'"%(self.doc.item_code))
+		
+		self.delete_web_cache(self.doc.page_name)
 
 	# Check whether Ref Rate is not entered twice for same Price List and Currency
 	def check_ref_rate_detail(self):
@@ -162,9 +168,9 @@
 		if self.doc.has_serial_no == 'Yes' and self.doc.is_stock_item == 'No':
 			msgprint("'Has Serial No' can not be 'Yes' for non-stock item", raise_exception=1)
 
-		# make product page
-		self.make_page()
-
+		if self.doc.name:
+			self.old_page_name = webnotes.conn.get_value('Item', self.doc.name, 'page_name')
+		
 	def check_non_asset_warehouse(self):
 		if self.doc.is_asset_item == "Yes":
 			existing_qty = sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name)
@@ -217,35 +223,38 @@
 	def on_rename(self,newdn,olddn):
 		sql("update tabItem set item_code = %s where name = %s", (newdn, olddn))
 
-	def make_page(self):
-		if self.doc.show_in_website=='Yes':
+	def delete_web_cache(self, page_name):
+		import website.web_cache
+		website.web_cache.delete_cache(page_name)
 
-			import website.utils
+	def clear_web_cache(self):
+		if hasattr(self, 'old_page_name') and self.old_page_name and \
+				self.doc.page_name != self.old_page_name:
+			self.delete_web_cache(self.doc.page_name)
+		
+		if self.doc.show_in_website:
+			import website.web_cache
+			website.web_cache.create_cache(self.doc.page_name, self.doc.doctype, self.doc.name)
+			website.web_cache.clear_cache(self.doc.page_name, self.doc.doctype, self.doc.name)
+		else:
+			self.delete_web_cache(self.doc.page_name)
+	
+	def update_page_name(self):
+		import website.utils
+		
+		# if same name, do not repeat twice
+		if self.doc.name == self.doc.item_name:
+			page_name = self.doc.name
+		else:
+			page_name = self.doc.name + " " + self.doc.item_name
 
-			if self.doc.page_name:
-				import webnotes.model
-				webnotes.model.delete_doc('Page', self.doc.page_name)
-				
-			p = website.utils.add_page("Product " + self.doc.item_name)
-			self.doc.page_name = p.name
+		self.doc.page_name = website.utils.page_name(page_name)
 
-			from jinja2 import Template
-			import markdown2
-			import os
-
-
-			self.doc.long_description_html = markdown2.markdown(self.doc.description or '')
-
-			with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
-				p.content = Template(f.read()).render(doc=self.doc)
-
-			with open(os.path.join(os.path.dirname(__file__), 'product_page.js'), 'r') as f:
-				p.script = Template(f.read()).render(doc=self.doc)
-
-			p.save()
-
-			website.utils.add_guest_access_to_page(p.name)
-
-			del self.doc.fields['long_description_html']
-
-			
\ No newline at end of file
+		webnotes.conn.set_value('Item', self.doc.name, 'page_name', self.doc.page_name)
+	
+		# no need to check for uniqueness, as name is unique
+		
+	def prepare_template_args(self):
+		import markdown2
+		self.doc.web_description_html = markdown2.markdown(self.doc.description or '',
+										extras=["wiki-tables"])
diff --git a/erpnext/stock/doctype/item/item.txt b/erpnext/stock/doctype/item/item.txt
index 8a079b8..06806ba 100644
--- a/erpnext/stock/doctype/item/item.txt
+++ b/erpnext/stock/doctype/item/item.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-04-30 18:33:53',
+		'creation': '2012-06-08 12:54:51',
 		'docstatus': 0,
-		'modified': '2012-06-07 16:16:24',
+		'modified': '2012-07-04 11:10:29',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -59,73 +59,6 @@
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Material Master Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Material Master Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
 		'cancel': 1,
 		'create': 1,
 		'doctype': u'DocPerm',
@@ -136,11 +69,78 @@
 
 	# DocPerm
 	{
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Master Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material Master Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
 		'doctype': u'DocPerm',
 		'permlevel': 1,
 		'role': u'System Manager'
 	},
 
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
 	# DocField
 	{
 		'doctype': u'DocField',
@@ -734,26 +734,6 @@
 	# DocField
 	{
 		'doctype': u'DocField',
-		'fieldname': u'show_in_website',
-		'fieldtype': u'Select',
-		'label': u'Show in Website',
-		'options': u'No\nYes',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'website_image',
-		'fieldtype': u'Select',
-		'label': u'website_image',
-		'options': u'attach_files:',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
 		'fieldname': u'max_discount',
 		'fieldtype': u'Currency',
 		'label': u'Max Discount (%)',
@@ -796,17 +776,6 @@
 
 	# DocField
 	{
-		'colour': u'White:FFF',
-		'description': u'website page link',
-		'doctype': u'DocField',
-		'fieldname': u'page_name',
-		'fieldtype': u'Data',
-		'label': u'Page Name',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
 		'doctype': u'DocField',
 		'fieldname': u'column_break3',
 		'fieldtype': u'Column Break',
@@ -994,5 +963,63 @@
 		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'website_section',
+		'fieldtype': u'Section Break',
+		'label': u'Website',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'show_in_website',
+		'fieldtype': u'Check',
+		'label': u'Show in Website',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'website page link',
+		'doctype': u'DocField',
+		'fieldname': u'page_name',
+		'fieldtype': u'Data',
+		'label': u'Page Name',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'website_image',
+		'fieldtype': u'Select',
+		'label': u'Image',
+		'options': u'attach_files:',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'web_short_description',
+		'fieldtype': u'Text',
+		'label': u'Short Description',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'web_long_description',
+		'fieldtype': u'Code',
+		'label': u'Long Description',
+		'options': u'Markdown',
+		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/product_page.js b/erpnext/stock/doctype/item/product_page.js
deleted file mode 100644
index 926ef69..0000000
--- a/erpnext/stock/doctype/item/product_page.js
+++ /dev/null
@@ -1,63 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-wn.require('erpnext/website/js/product_category.js');
-
-pscript["onload_{{ doc.page_name }}"] = function(wrapper) {
-	wrapper.product_group = "{{ doc.item_group }}";
-	wrapper.product_name = "{{ doc.name }}";
-	erpnext.make_product_categories(wrapper);
-	$(wrapper).find('.product-inquiry').click(function() {
-		loadpage('contact', function() {
-			$('#content-contact-us [name="contact-message"]').val("Hello,\n\n\
-			Please send me more information on {{ doc.title }} (Item Code:{{ doc.item }})\n\n\
-			My contact details are:\n\nThank you!\
-			");
-		})
-	});
-	
-	// similar products
-	wrapper.similar = new wn.ui.Listing({
-		parent: $(wrapper).find('.similar-products').get(0),
-		hide_refresh: true,
-		page_length: 5,
-		get_query: function() {
-			args = {
-				cat: wrapper.product_group,
-				name: wrapper.product_name
-			};
-			return repl('select t1.name, t1.title, t1.thumbnail_image, \
-				t1.page_name, t1.short_description \
-				from tabProduct t1, tabItem t2 \
-				where t1.item = t2.name \
-				and ifnull(t1.published,0)=1 \
-				and t1.name != "%(name)s" \
-				and t2.item_group="%(cat)s" order by t1.modified desc', args)
-		},
-		render_row: function(parent, data) {
-			if(data.short_description.length > 100) {
-				data.short_description = data.short_description.substr(0,100) + '...';
-			}
-			parent.innerHTML = repl('<div style="float:left; width: 60px;">\
-				<img src="files/%(thumbnail_image)s" style="width:55px;"></div>\
-				<div style="float:left; width: 180px">\
-					<b><a href="#!%(page_name)s">%(title)s</a></b>\
-					<p>%(short_description)s</p></div>\
-				<div style="clear: both; margin-bottom: 15px;"></div>', data);
-		}
-	});
-	wrapper.similar.run();
-}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/template.html b/erpnext/stock/doctype/item/template.html
deleted file mode 100644
index 8a2f4a9..0000000
--- a/erpnext/stock/doctype/item/template.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<div class="layout-wrapper layout-wrapper-background">
-	<div class="web-content" id="content-product-{{ doc.name }}">
-		<div class="layout-main-section">
-			<h1>{{ doc.item_name }}</h1>
-			<div style="float: left;">
-				<br><br>
-				<image src="files/{{ doc.website_image }}" style="width: 300px; 
-					margin-left: 15px;" />
-				<br><br>
-				{{ doc.long_description_html }}
-				<button class="btn primary product-inquiry" 
-					data-product="{{ doc.name }}"
-					data-description="{{ doc.short_description }}">Send Inquiry</button>
-			</div>
-		</div>
-		<div class="layout-side-section">
-			<h4>More Categories</h4>
-			<div class="more-categories"></div>
-			<br>
-			<h4>Similar Products</h4>
-			<div class="similar-products"></div>
-		</div>
-		<div style="clear: both"></div>
-	</div>
-</div>
\ No newline at end of file
diff --git a/erpnext/website/blog.py b/erpnext/website/blog.py
new file mode 100644
index 0000000..a890cc0
--- /dev/null
+++ b/erpnext/website/blog.py
@@ -0,0 +1,128 @@
+import webnotes
+
+@webnotes.whitelist(allow_guest=True)
+def get_blog_list(args=None):
+	"""
+		args = {
+			'limit_start': 0,
+			'limit_page_length': 10,
+		}
+	"""
+	import webnotes
+	
+	if not args: args = webnotes.form_dict
+	
+	query = """\
+		select
+			cache.name as name, cache.html as content,
+			blog.owner as owner, blog.creation as published,
+			blog.title as title
+		from `tabWeb Cache` cache, `tabBlog` blog
+		where cache.doc_type = 'Blog' and blog.page_name = cache.name
+		order by published desc, name asc"""
+	
+	from webnotes.widgets.query_builder import add_limit_to_query
+	query, args = add_limit_to_query(query, args)
+	
+	result = webnotes.conn.sql(query, args, as_dict=1)
+
+	# strip html tags from content
+	import webnotes.utils
+	import website.web_cache
+	
+	for res in result:
+		from webnotes.utils import global_date_format, get_fullname
+		res['full_name'] = get_fullname(res['owner'])
+		res['published'] = global_date_format(res['published'])
+		res['content'] = split_blog_content(res['content'])
+		res['content'] = res['content'][:1000]
+
+	return result
+
+@webnotes.whitelist(allow_guest=True)
+def get_recent_blog_list(args=None):
+	"""
+		args = {
+			'limit_start': 0,
+			'limit_page_length': 5,
+			'name': '',
+		}
+	"""
+	import webnotes
+	
+	if not args: args = webnotes.form_dict
+	
+	query = """\
+		select name, title, left(content, 100) as content
+		from tabBlog
+		where ifnull(published,0)=1 and
+		name!=%(name)s order by creation desc"""
+	
+	from webnotes.widgets.query_builder import add_limit_to_query
+	query, args = add_limit_to_query(query, args)
+	
+	result = webnotes.conn.sql(query, args, as_dict=1)
+
+	# strip html tags from content
+	import webnotes.utils
+	for res in result:
+		res['content'] = webnotes.utils.strip_html(res['content'])
+
+	return result
+
+@webnotes.whitelist(allow_guest=True)
+def add_comment(args=None):
+	"""
+		args = {
+			'comment': '',
+			'comment_by': '',
+			'comment_by_fullname': '',
+			'comment_doctype': '',
+			'comment_docname': '',
+			'page_name': '',
+		}
+	"""
+	import webnotes
+	
+	if not args: args = webnotes.form_dict
+	
+	import webnotes.widgets.form.comments
+	comment = webnotes.widgets.form.comments.add_comment(args)
+	
+	# since comments are embedded in the page, clear the web cache
+	import website.web_cache
+	website.web_cache.clear_cache(args.get('page_name'),
+		args.get('comment_doctype'), args.get('comment_docname'))
+	
+	# loads fresh blog into cache
+	get_blog_content(args.get('page_name'))
+	
+	import webnotes.utils
+	
+	comment['comment_date'] = webnotes.utils.pretty_date(comment['creation'])
+	template_args = { 'comment_list': [comment], 'template': 'html/comment.html' }
+	
+	# get html of comment row
+	comment_html = website.web_cache.build_html(template_args)
+
+	return comment_html
+
+def get_blog_content(blog_page_name):
+	import website.web_cache
+	content = website.web_cache.get_html(blog_page_name)
+	
+	content = split_blog_content(content)
+	
+	import webnotes.utils
+	content = webnotes.utils.escape_html(content)
+
+	return content
+	
+def split_blog_content(content):
+	content = content.split("<!-- begin blog content -->")
+	content = len(content) > 1 and content[1] or content[0]
+
+	content = content.split("<!-- end blog content -->")
+	content = content[0]
+
+	return content
\ No newline at end of file
diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py
index 919b830..e361ece 100644
--- a/erpnext/website/doctype/blog/blog.py
+++ b/erpnext/website/doctype/blog/blog.py
@@ -22,52 +22,40 @@
 
 import webnotes
 import website.utils
+import website.web_page
 
-class DocType():
+class DocType(website.web_page.Page):
 	def __init__(self, d, dl):
+		super(DocType, self).__init__('Blog')
 		self.doc, self.doclist = d, dl
-		
-	def autoname(self):
-		"""save file by its name"""
-		self.doc.name = website.utils.page_name(self.doc.title)
-	
-	def validate(self):
-		"""write/update 'Page' with the blog"""
-		# we need the name for the templates
-		if not self.doc.name:
-			self.autoname()
-		
-		if self.doc.page_name:
-			webnotes.conn.sql("""delete from tabPage where name=%s""", self.doc.page_name)
-		
-		p = website.utils.add_page(self.doc.title)
-		
-		from jinja2 import Template
-		import markdown2
-		import os
-		from webnotes.utils import global_date_format, get_fullname
-		from webnotes.model.code import get_obj
-		
-		self.doc.content_html = unicode(markdown2.markdown(self.doc.content or ''))
-		self.doc.full_name = get_fullname(self.doc.owner)
-		self.doc.updated = global_date_format(self.doc.modified)
-		
-		with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
-			p.content = Template(f.read()).render(doc=self.doc)
-		
-		with open(os.path.join(os.path.dirname(__file__), 'blog_page.js'), 'r') as f:
-			p.script = Template(f.read()).render(doc=self.doc)
-			
-		p.web_page = 'Yes'
-		p.save()
-		get_obj(doc=p).write_cms_page()
-		
-		website.utils.add_guest_access_to_page(p.name)
-		self.doc.page_name = p.name
-		
-		# cleanup
-		for f in ['full_name', 'updated', 'content_html']:
-			if f in self.doc.fields:
-				del self.doc.fields[f]				
 
-			
\ No newline at end of file
+	def on_update(self):
+		super(DocType, self).on_update()
+		if not webnotes.utils.cint(self.doc.published):
+			self.delete_web_cache(self.doc.page_name)
+		else:
+			import website.blog
+			website.blog.get_blog_content(self.doc.page_name)
+
+	def prepare_template_args(self):
+		import webnotes.utils
+		
+		# this is for double precaution. usually it wont reach this code if not published
+		if not webnotes.utils.cint(self.doc.published):
+			raise Exception, "This blog has not been published yet!"
+		
+		# temp fields
+		from webnotes.utils import global_date_format, get_fullname
+		self.doc.full_name = get_fullname(self.doc.owner)
+		self.doc.updated = global_date_format(self.doc.creation)
+
+		self.markdown_to_html(['content'])
+
+		comment_list = webnotes.conn.sql("""\
+			select comment, comment_by_fullname, creation
+			from `tabComment` where comment_doctype="Blog"
+			and comment_docname=%s order by creation""", self.doc.name, as_dict=1)
+		
+		self.doc.comment_list = comment_list or []
+		for comment in self.doc.comment_list:
+			comment['comment_date'] = webnotes.utils.pretty_date(comment['creation'])
\ No newline at end of file
diff --git a/erpnext/website/doctype/blog/blog.txt b/erpnext/website/doctype/blog/blog.txt
index ad44d13..24187e3 100644
--- a/erpnext/website/doctype/blog/blog.txt
+++ b/erpnext/website/doctype/blog/blog.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-04-02 16:02:43',
+		'creation': '2012-05-28 19:22:38',
 		'docstatus': 0,
-		'modified': '2012-04-26 16:58:27',
+		'modified': '2012-06-22 18:56:16',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -21,7 +21,7 @@
 		'name': '__common__',
 		'section_style': u'Simple',
 		'show_in_menu': 0,
-		'version': 5
+		'version': 1
 	},
 
 	# These values are common for all DocField
@@ -51,6 +51,7 @@
 
 	# DocPerm
 	{
+		'cancel': 1,
 		'create': 1,
 		'doctype': u'DocPerm',
 		'permlevel': 0,
@@ -71,7 +72,14 @@
 	{
 		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': u'All'
+		'role': u'Website Manager'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Blogger'
 	},
 
 	# DocField
@@ -99,6 +107,7 @@
 		'fieldname': u'content',
 		'fieldtype': u'Code',
 		'label': u'Content',
+		'options': u'Markdown',
 		'permlevel': 0,
 		'reqd': 0
 	},
@@ -106,19 +115,11 @@
 	# DocField
 	{
 		'doctype': u'DocField',
-		'fieldname': u'content_html',
-		'fieldtype': u'Text',
-		'label': u'Content HTML',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
 		'fieldname': u'page_name',
 		'fieldtype': u'Data',
+		'hidden': 1,
 		'label': u'Page Name',
-		'permlevel': 0
+		'permlevel': 1
 	},
 
 	# DocField
diff --git a/erpnext/website/doctype/blog/blog_page.js b/erpnext/website/doctype/blog/blog_page.js
deleted file mode 100644
index 4b28392..0000000
--- a/erpnext/website/doctype/blog/blog_page.js
+++ /dev/null
@@ -1,83 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-// js inside blog page
-
-pscript['onload_{{ doc.name }}'] = function(wrapper) {
-	// sidebar
-	wrapper.recent_list = new wn.ui.Listing({
-		parent: $(wrapper).find('.recent-posts'),
-		no_toolbar: true,
-		query: 'select name, title, left(content, 100) as content from tabBlog\
-			where ifnull(published,0)=1 and name!="{{ doc.name }}" order by creation desc',
-		hide_refresh: true,
-		render_row: function(parent, data) {
-			//console.log(data);
-			if(data.content && data.content.length==100) data.content += '...';
-			parent.innerHTML = repl('<a href="%(name)s.html">%(title)s</a>\
-				<div class="comment">%(content)s</div><br>', data);
-		},
-		page_length: 5,
-	});
-	wrapper.recent_list.run();
-		
-	wrapper.comment_list = new wn.ui.Listing({
-		parent: $(wrapper).find('.blog-comments').get(0),
-		no_toolbar: true,
-		query: 'select comment, comment_by_fullname, creation\
-			from `tabComment` where comment_doctype="Page"\
-			and comment_docname="{{ doc.name }}" order by creation desc',
-		no_result_message: 'Be the first one to comment',
-		render_row: function(parent, data) {
-			data.comment_date = prettyDate(data.creation);
-			$(parent).html(repl("<div style='color:#777'>\
-				%(comment_by_fullname)s | %(comment_date)s:\
-				</div>\
-				<p style='margin-left: 20px;'>%(comment)s</p><br>", data))
-		},
-		hide_refresh: true
-	});
-	wrapper.comment_list.run();
-	
-	// add comment
-	$(wrapper).find('.layout-main-section').append('<br><button class="btn add-comment">\
-		Add Comment</button>');
-	$(wrapper).find('button.add-comment').click(function(){
-		d = new wn.widgets.Dialog({
-			title: 'Add Comment',
-			fields: [
-				{fieldname:'comment_by_fullname', label:'Your Name', reqd:1, fieldtype:'Data'},
-				{fieldname:'comment_by', label:'Email Id', reqd:1, fieldtype:'Data'},
-				{fieldname:'comment', label:'Comment', reqd:1, fieldtype:'Text'},
-				{fieldname:'post', label:'Post', fieldtype:'Button'}
-			]
-		});
-		d.fields_dict.post.input.onclick = function() {
-			var btn = this;
-			var args = d.get_values();
-			if(!args) return;
-			args.comment_doctype = 'Page';
-			args.comment_docname = '{{ doc.name }}';
-			$(btn).set_working();
-			$c('webnotes.widgets.form.comments.add_comment', args, function(r) {
-				$(btn).done_working();
-				d.hide();
-				wrapper.comment_list.refresh();
-			})
-		}
-		d.show();
-	})
-}
\ No newline at end of file
diff --git a/erpnext/website/doctype/blog/template.html b/erpnext/website/doctype/blog/template.html
deleted file mode 100644
index 510f1be..0000000
--- a/erpnext/website/doctype/blog/template.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<div class="layout-wrapper layout-wrapper-background">
-	<div class="web-content" id="blog-{{ doc.name }}">
-		<div class="layout-main-section">
-			<h2>{{ doc.title }}</h2>
-			<div class="help">By {{ doc.full_name }} on {{ doc.updated }}</div>
-			<br>
-			{{ doc.content_html }}
-			<hr><h3>Comments</h3>
-			<br>
-			<div class="blog-comments"></div>
-		</div>
-		<div class="layout-side-section">
-			<p><a href="blog.html">All Blogs</a></p>
-			<h4>Recent Posts</h4>
-			<div class="recent-posts" style="min-height: 100px;"></div>
-			<h4>Subscribe</h4>
-			<p>
-				<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
-				<a href="rss.xml" target="_blank">RSS Feed</a>
-			</p>
-		</div>
-		<div style="clear: both"></div>
-	</div>
-</div>
\ No newline at end of file
diff --git a/erpnext/website/page/about/__init__.py b/erpnext/website/doctype/web_cache/__init__.py
similarity index 100%
rename from erpnext/website/page/about/__init__.py
rename to erpnext/website/doctype/web_cache/__init__.py
diff --git a/erpnext/website/doctype/web_cache/web_cache.txt b/erpnext/website/doctype/web_cache/web_cache.txt
new file mode 100644
index 0000000..98a4891
--- /dev/null
+++ b/erpnext/website/doctype/web_cache/web_cache.txt
@@ -0,0 +1,99 @@
+# DocType, Web Cache
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-06-21 12:01:17',
+		'docstatus': 0,
+		'modified': '2012-06-21 17:25:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'doctype': 'DocType',
+		'document_type': u'System',
+		'module': u'Website',
+		'name': '__common__',
+		'version': 1
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Web Cache',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Web Cache',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'write': 1
+	},
+
+	# DocType, Web Cache
+	{
+		'doctype': 'DocType',
+		'name': u'Web Cache'
+	},
+
+	# DocPerm
+	{
+		'create': 0,
+		'doctype': u'DocPerm',
+		'role': u'All'
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'role': u'Website Manager'
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'role': u'Blogger'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'doc_type',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'DocType',
+		'options': u'DocType',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'doc_name',
+		'fieldtype': u'Data',
+		'in_filter': 0,
+		'label': u'DocName',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'html',
+		'fieldtype': u'Long Text',
+		'label': u'HTML'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/website/doctype/web_page/template.html b/erpnext/website/doctype/web_page/template.html
deleted file mode 100644
index c6d4b40..0000000
--- a/erpnext/website/doctype/web_page/template.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<div class="layout-wrapper layout-wrapper-background">
-	<div class="web-content" 
-		style="text-align: {{ doc.text_align }};">
-		
-		{% if doc.layout and doc.layout.startswith('Two column') %}
-		<div class="layout-main-section">
-		{% else %}
-		<div class="layout-main">
-		{% endif %}
-			{{ doc.main_section_html }}
-			{% if doc.next_page_html %}
-				{{ doc.next_page_html }}
-			{% endif %}
-
-		</div>
-		
-		{% if doc.layout and doc.layout.startswith('Two column') %}
-		<div class="layout-side-section">
-			{{ doc.side_section_html }}
-			{% if doc.see_also %}
-			<div class="info-box">
-				<h4>See Also</h4>
-				{{ doc.see_also }}
-			</div>
-			{% endif %}
-		</div>
-		{% endif %}
-		<div style="clear: both"></div>
-	</div>
-</div>
diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py
index 27ce5c0..2a3e84a 100644
--- a/erpnext/website/doctype/web_page/web_page.py
+++ b/erpnext/website/doctype/web_page/web_page.py
@@ -16,82 +16,25 @@
 
 import webnotes
 import website.utils
+import website.web_page
 
-class DocType:
+class DocType(website.web_page.Page):
 	def __init__(self, d, dl):
+		super(DocType, self).__init__('Web Page')
 		self.doc, self.doclist = d, dl
-	
-	def autoname(self):
-		"""name from title"""
-		self.doc.name = website.utils.page_name(self.doc.title)
 
 	def on_update(self):
-		"""make page for this product"""
-		from jinja2 import Template
-		from webnotes.utils import global_date_format
-		from webnotes.model.code import get_obj
-		import os
-
-		# we need the name for the templates
-		if self.doc.name.startswith('New Web Page'):
-			self.autoname()
-
-		if self.doc.page_name:
-			webnotes.conn.sql("""delete from tabPage where name=%s""", self.doc.page_name)
-
-		p = website.utils.add_page(self.doc.name)
-		self.doc.page_name = p.name
-		
-		self.doc.updated = global_date_format(self.doc.modified)
-		website.utils.markdown(self.doc, ['head_section','main_section', 'side_section'])
-				
-		with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
-			p.content = Template(f.read()).render(doc=self.doc)
-
-		p.title = self.doc.title
-		p.web_page = 'Yes'
-		
-		if self.doc.insert_code:
-			p.script = self.doc.javascript
-
-		if self.doc.insert_style:
-			p.style = self.doc.css
-
-		p.save()
-		get_obj(doc=p).write_cms_page()
-		
-		website.utils.add_guest_access_to_page(p.name)
-		self.cleanup_temp()
-
-		self.doc.save()
-
+		super(DocType, self).on_update()
 		self.if_home_clear_cache()
-			
-	def add_page_links(self):
-		"""add links for next_page and see_also"""
-		if self.doc.next_page:
-			self.doc.next_page_html = """<div class="info-box round" style="text-align: right">
-				<b>Next:</b>
-				<a href="#!%(name)s">%(title)s</a></div>""" % {"name":self.doc.next_page, \
-						"title": webnotes.conn.get_value("Page", self.doc.next_page, "title")}
 
-		self.doc.see_also = ''
-		for d in self.doclist:
-			if d.doctype=='Related Page':
-				tmp = {"page":d.page, "title":webnotes.conn.get_value('Page', d.page, 'title')}
-				self.doc.see_also += """<div><a href="#!%(page)s">%(title)s</a></div>""" % tmp
-				
-	def cleanup_temp(self):
-		"""cleanup temp fields"""
-		fl = ['main_section_html', 'side_section_html', 'see_also', \
-			'next_page_html', 'head_section_html', 'updated']
-		for f in fl:
-			if f in self.doc.fields:
-				del self.doc.fields[f]
-				
 	def if_home_clear_cache(self):
 		"""if home page, clear cache"""
 		if webnotes.conn.get_value("Website Settings", None, "home_page")==self.doc.name:
 			from webnotes.session_cache import clear_cache
-			clear_cache('Guest')			
-	
\ No newline at end of file
+			clear_cache('Guest')
+			import website.web_cache
+			website.web_cache.clear_cache(self.doc.page_name)
+			website.web_cache.clear_cache('index')
+			
+	def prepare_template_args(self):
+		self.markdown_to_html(['head_section','main_section', 'side_section'])
\ No newline at end of file
diff --git a/erpnext/website/doctype/web_page/web_page.txt b/erpnext/website/doctype/web_page/web_page.txt
index c40caff..a1fd894 100644
--- a/erpnext/website/doctype/web_page/web_page.txt
+++ b/erpnext/website/doctype/web_page/web_page.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-04-02 16:02:43',
+		'creation': '2012-06-19 15:02:20',
 		'docstatus': 0,
-		'modified': '2012-05-02 15:24:31',
+		'modified': '2012-06-22 18:49:02',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -36,13 +36,15 @@
 
 	# These values are common for all DocPerm
 	{
+		'amend': 0,
 		'doctype': u'DocPerm',
 		'name': '__common__',
 		'parent': u'Web Page',
 		'parentfield': u'permissions',
 		'parenttype': u'DocType',
 		'read': 1,
-		'role': u'Website Manager'
+		'role': u'Website Manager',
+		'submit': 0
 	},
 
 	# DocType, Web Page
@@ -53,6 +55,7 @@
 
 	# DocPerm
 	{
+		'cancel': 1,
 		'create': 1,
 		'doctype': u'DocPerm',
 		'permlevel': 0,
@@ -61,8 +64,11 @@
 
 	# DocPerm
 	{
+		'cancel': 0,
+		'create': 0,
 		'doctype': u'DocPerm',
-		'permlevel': 1
+		'permlevel': 1,
+		'write': 0
 	},
 
 	# DocField
@@ -88,6 +94,17 @@
 
 	# DocField
 	{
+		'colour': u'White:FFF',
+		'description': u'Page url name (auto-generated) ',
+		'doctype': u'DocField',
+		'fieldname': u'page_name',
+		'fieldtype': u'Data',
+		'label': u'Page Name',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
 		'doctype': u'DocField',
 		'fieldname': u'cb1',
 		'fieldtype': u'Column Break',
@@ -101,7 +118,7 @@
 		'fieldname': u'layout',
 		'fieldtype': u'Select',
 		'label': u'Layout',
-		'options': u'Two column with header\nTwo column\nSingle column',
+		'options': u'Single column\nTwo column\nTwo column with header',
 		'permlevel': 0
 	},
 
@@ -176,6 +193,7 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
+		'description': u'Add code as &lt;script&gt;',
 		'doctype': u'DocField',
 		'fieldname': u'insert_code',
 		'fieldtype': u'Check',
@@ -215,15 +233,6 @@
 	# DocField
 	{
 		'doctype': u'DocField',
-		'fieldname': u'page_name',
-		'fieldtype': u'Data',
-		'label': u'Page Name',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
 		'fieldname': u'file_list',
 		'fieldtype': u'Text',
 		'hidden': 1,
diff --git a/erpnext/website/doctype/website_settings/website_settings.py b/erpnext/website/doctype/website_settings/website_settings.py
index 9390e74..eb304d2 100644
--- a/erpnext/website/doctype/website_settings/website_settings.py
+++ b/erpnext/website/doctype/website_settings/website_settings.py
@@ -28,38 +28,17 @@
 		self.validate_domain_list()	
 
 	def on_update(self):
-		self.rewrite_pages()
-		
-		from webnotes.session_cache import clear_cache
-		clear_cache('Guest')
-		
-	def rewrite_pages(self):
-		"""rewrite all web pages"""
-		import webnotes
-		from webnotes.model.doclist import DocList
-		from webnotes.model.code import get_obj
-		
-		# rewrite all web pages
-		for name in webnotes.conn.sql("""select name, modified from `tabWeb Page` 
-			where docstatus=0"""):
-			DocList('Web Page', name[0]).save()
-			webnotes.conn.set_value('Web Page', name[0], 'modified', name[1])
-
-		# rewrite all blog pages
-		for name in webnotes.conn.sql("""select name, modified from `tabBlog` 
-			where docstatus=0 and ifnull(published,0)=1"""):
-			DocList('Blog', name[0]).save()
-			webnotes.conn.set_value('Blog', name[0], 'modified', name[1])
-		
+		# make js and css
 		from webnotes.cms.make import make_web_core
 		make_web_core()
 		
-		get_obj('Page', 'blog').write_cms_page(force=True)
-		get_obj('Page', 'Login Page').write_cms_page(force=True)
-		
-		webnotes.msgprint('Rebuilt all blogs and pages')
-		
-		
+		# clear web cache
+		import website.web_cache
+		website.web_cache.refresh_cache(build=['Blog'])
+
+		from webnotes.session_cache import clear_cache
+		clear_cache('Guest')
+
 	def set_home_page(self):
 
 		import webnotes
diff --git a/erpnext/website/doctype/website_settings/website_settings.txt b/erpnext/website/doctype/website_settings/website_settings.txt
index 368f963..3ae0fbe 100644
--- a/erpnext/website/doctype/website_settings/website_settings.txt
+++ b/erpnext/website/doctype/website_settings/website_settings.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-05-03 18:43:46',
+		'creation': '2012-05-21 15:54:09',
 		'docstatus': 0,
-		'modified': '2012-05-21 14:59:25',
+		'modified': '2012-07-09 16:20:58',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -18,7 +18,7 @@
 		'doctype': 'DocType',
 		'document_type': u'Other',
 		'issingle': 1,
-		'max_attachments': 1,
+		'max_attachments': 10,
 		'module': u'Website',
 		'name': '__common__',
 		'section_style': u'Simple',
@@ -180,21 +180,21 @@
 	# DocField
 	{
 		'doctype': u'DocField',
-		'fieldname': u'file_list',
-		'fieldtype': u'Text',
-		'hidden': 1,
-		'label': u'File List',
-		'no_copy': 1,
-		'permlevel': 0,
-		'print_hide': 1
+		'fieldname': u'misc_section',
+		'fieldtype': u'Section Break',
+		'label': u'Misc',
+		'permlevel': 0
 	},
 
 	# DocField
 	{
+		'colour': u'White:FFF',
+		'description': u'An icon file with .ico extension. Should be 16 x 16 px. Generated using a favicon generator. [<a href="http://favicon-generator.org/" target="_blank">favicon-generator.org</a>]',
 		'doctype': u'DocField',
-		'fieldname': u'domains',
-		'fieldtype': u'Section Break',
-		'label': u'Domains',
+		'fieldname': u'favicon',
+		'fieldtype': u'Select',
+		'label': u'FavIcon',
+		'options': u'attach_files:',
 		'permlevel': 0
 	},
 
@@ -224,6 +224,18 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'File List',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
 		'fieldname': u'analytics',
 		'fieldtype': u'Section Break',
 		'label': u'Startup',
diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js
deleted file mode 100644
index 88cbe8b..0000000
--- a/erpnext/website/js/topbar.js
+++ /dev/null
@@ -1,130 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-wn.provide('erpnext.navbar');
-
-/*
-<li class="dropdown">\
-	<a class="dropdown-toggle" href="#" onclick="return false;"></a>\
-	<ul class="dropdown-menu" id="toolbar-user">\
-	</ul>\
-</li>\
-*/
-
-erpnext.navbar.Navbar = Class.extend({
-	init: function() {
-		this.make();
-		$('.brand').html(wn.boot.website_settings.brand_html || sys_defaults.company);
-		this.make_items();
-		$('.dropdown-toggle').dropdown();
-	},
-	make: function() {
-		$('header').append('<div class="navbar navbar-fixed-top">\
-			<div class="navbar-inner">\
-			<div class="container">\
-				<a class="brand">[brand]</a>\
-				<ul class="nav">\
-				</ul>\
-				<img src="images/lib/ui/spinner.gif" id="spinner"/>\
-				<ul class="nav pull-right">\
-					<li id="login-topbar-item"><a href="#!Login Page">Login</a></li>\
-				</ul>\
-			</div>\
-			</div>\
-			</div>');
-		$('.brand').attr('href', '#!' + (wn.boot.website_settings.home_page || 'Login Page'))
-	},
-	make_items: function() {
-		var items = wn.boot.website_menus;
-		
-		// parent labels
-		for(var i=0;i<items.length;i++) {
-			var item = items[i];
-			if(!item.parent_label && item.parentfield=='top_bar_items') {
-				erpnext.header_link_settings(item);
-				$('header .nav:first').append(repl('<li data-label="%(label)s">\
-					<a href="%(route)s" %(target)s>%(label)s</a></li>', item));
-			}
-		}
-		
-		// child labels
-		for(var i=0;i<items.length;i++) {
-			var item = items[i];
-			if(item.parent_label && item.parentfield=='top_bar_items') {
-				// check if parent label has class "dropdown"
-				$parent_li = $(repl('header li[data-label="%(parent_label)s"]', item));
-				if(!$parent_li.hasClass('dropdown')) {
-					$parent_li.addClass('dropdown');
-					$parent_li.find('a:first').addClass('dropdown-toggle')
-						.attr('data-toggle', 'dropdown')
-						.attr('href', '')
-						.append('<b class="caret"></b>')
-						.click(function() {
-							return false;
-						});
-					$parent_li.append('');
-				}
-				erpnext.header_link_settings(item);
-				$parent_li.find('.dropdown-menu').append(repl('<li data-label="%(label)s">\
-					<a href="%(route)s" %(target)s>%(label)s</a></li>', item))
-			}
-		}
-	}
-});
-
-// footer
-erpnext.Footer = Class.extend({
-	init: function() {
-		if(!wn.boot.website_settings.copyright) {
-			wn.boot.website_settings.copyright = sys_defaults.company;
-		}
-		if(!wn.boot.website_settings.address) {
-			wn.boot.website_settings.address = '';
-		}
-		$('footer').html(repl('<div class="web-footer">\
-			<div class="web-footer-menu"><ul></ul></div>\
-			<div class="web-footer-copyright">&copy; %(copyright)s</div>\
-		</div>', wn.boot.website_settings));
-		this.make_items();
-	},
-	make_items: function() {
-		var items = wn.boot.website_menus
-		for(var i=0;i<items.length;i++) {
-			var item = items[i];
-			if(!item.parent_label && item.parentfield=='footer_items') {
-				erpnext.header_link_settings(item);
-				$('.web-footer-menu ul').append(repl('<li><a href="%(route)s" %(target)s\
-					data-label="%(label)s">%(label)s</a></li>', item))
-			}
-		}
-	}
-});
-
-// customize hard / soft links
-erpnext.header_link_settings = function(item) {
-	item.route = item.url || item.custom_page;
-	if(item.route && item.route.substr(0,4)=='http') {
-		item.target = 'target="_blank"';				
-	} else {
-		item.target = '';
-		item.route = '#!' + item.route;
-	}	
-}
-
-$(document).bind('startup', function() {
-	erpnext.footer = new erpnext.Footer();
-	//erpnext.navbar.navbar = new erpnext.navbar.Navbar();	
-})
diff --git a/erpnext/website/page/about/about.txt b/erpnext/website/page/about/about.txt
deleted file mode 100644
index a106513..0000000
--- a/erpnext/website/page/about/about.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Page, about
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-01-27 11:37:57',
-		'docstatus': 0,
-		'modified': '2012-01-27 13:26:42',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Page
-	{
-		'doctype': 'Page',
-		'module': 'Website',
-		'name': '__common__',
-		'page_name': 'about',
-		'standard': 'Yes',
-		'title': 'About Us'
-	},
-
-	# These values are common for all Page Role
-	{
-		'doctype': 'Page Role',
-		'name': '__common__',
-		'parent': 'about',
-		'parentfield': 'roles',
-		'parenttype': 'Page',
-		'role': 'Guest'
-	},
-
-	# Page, about
-	{
-		'doctype': 'Page',
-		'name': 'about'
-	},
-
-	# Page Role
-	{
-		'doctype': 'Page Role'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/website/page/blog/blog.html b/erpnext/website/page/blog/blog.html
deleted file mode 100644
index 8d7cd00..0000000
--- a/erpnext/website/page/blog/blog.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<div class="layout-wrapper layout-wrapper-background">
-	<div class="web-content" id="content-blog">
-		<div class="layout-main-section">
-			<h1>Blog</h1>
-			<br>
-			<div id="blog-list"></div>
-		</div>
-		<div class="layout-side-section">
-			<!-- for later
-			<h4>Get Updates</h4>
-			<p>
-			<input name="blog-subscribe">
-			<button class="btn" id="blog-subscribe">Subscribe</button>
-			</p>-->
-			<h4>Subscribe</h4>
-			<p>
-			<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
-			<a href="rss.xml" target="_blank">RSS Feed</a>
-			</p>
-		</div>
-		<div style="clear: both"></div>
-	</div>
-</div>
\ No newline at end of file
diff --git a/erpnext/website/page/blog/blog.js b/erpnext/website/page/blog/blog.js
deleted file mode 100644
index 5a10998..0000000
--- a/erpnext/website/page/blog/blog.js
+++ /dev/null
@@ -1,59 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-
-pscript.onload_blog = function(wrapper) {
-	wrapper.blog_list = new wn.ui.Listing({
-		parent: $(wrapper).find('#blog-list').get(0),
-		query: 'select tabBlog.name, title, left(content, 1000) as content, tabBlog.creation, \
-			ifnull(first_name, "") as first_name, ifnull(last_name, "") as last_name \
-			from tabProfile, tabBlog\
-		 	where ifnull(published,0)=1 and tabBlog.owner = tabProfile.name \
-			order by tabBlog.creation desc',
-		hide_refresh: true,
-		no_toolbar: true,
-		render_row: function(parent, data) {
-			if(data.content && data.content.length==1000) data.content += '... (read on)';
-			data.content = wn.markdown(data.content);
-			if(data.last_name) data.last_name = ' ' + data.last_name;
-			data.date = prettyDate(data.creation);
-			parent.innerHTML = repl('<h2>%(title)s</h2>\
-				<p><div class="help">By %(first_name)s%(last_name)s, %(date)s</div></p>\
-				<p>%(content)s</p>\
-				<a href="%(name)s.html">Read Full Text</a><br>', data);
-		},
-		page_length: 10
-	});
-	wrapper.blog_list.run();
-	
-	// subscribe button
-	$('#blog-subscribe').click(function() {
-		var email = $(wrapper).find('input[name="blog-subscribe"]').val();
-		if(!validate_email(email)) {
-			msgprint('Please enter a valid email!');
-		}
-		wn.call({
-			module:'website',
-			page:'blog',
-			method:'subscribe',
-			args:email,
-			btn: this,
-			callback: function() {
-				$(wrapper).find('input[name="blog-subscribe"]').val('');
-			}
-		});		
-	})
-}
\ No newline at end of file
diff --git a/erpnext/website/page/blog/blog.py b/erpnext/website/page/blog/blog.py
deleted file mode 100644
index 9790114..0000000
--- a/erpnext/website/page/blog/blog.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import webnotes
-
-@webnotes.whitelist()
-def subscribe(arg):
-	"""subscribe to blog (blog_subscriber)"""
-	if webnotes.conn.sql("""select name from `tabBlog Subscriber` where name=%s""", arg):
-		webnotes.msgprint("Already a subscriber. Thanks!")
-	else:
-		from webnotes.model.doc import Document
-		d = Document('Blog Subscriber')
-		d.name = arg
-		d.save()
-		webnotes.msgprint("Thank you for subscribing!")
\ No newline at end of file
diff --git a/erpnext/website/page/blog/blog.txt b/erpnext/website/page/blog/blog.txt
deleted file mode 100644
index 4443ec8..0000000
--- a/erpnext/website/page/blog/blog.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Page, blog
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-01-27 15:47:52',
-		'docstatus': 0,
-		'modified': '2012-01-27 15:47:52',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Page
-	{
-		'doctype': 'Page',
-		'module': 'Website',
-		'name': '__common__',
-		'page_name': 'blog',
-		'standard': 'Yes',
-		'title': 'Blog'
-	},
-
-	# These values are common for all Page Role
-	{
-		'__islocal': 1,
-		'doctype': 'Page Role',
-		'name': '__common__',
-		'parent': 'blog',
-		'parentfield': 'roles',
-		'parenttype': 'Page',
-		'role': 'Guest'
-	},
-
-	# Page, blog
-	{
-		'doctype': 'Page',
-		'name': 'blog'
-	},
-
-	# Page Role
-	{
-		'doctype': 'Page Role'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/website/page/contact/__init__.py b/erpnext/website/page/contact/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/website/page/contact/__init__.py
+++ /dev/null
diff --git a/erpnext/website/page/contact/contact.js b/erpnext/website/page/contact/contact.js
deleted file mode 100644
index c794325..0000000
--- a/erpnext/website/page/contact/contact.js
+++ /dev/null
@@ -1,46 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-pscript.onload_contact = function(wrapper) {
-	$('#content-contact-us .btn.primary').click(function() {
-		var me = this;
-		var args = {};
-		args.name = $('#content-contact-us [name="contact-name"]').val();
-		args.email = $('#content-contact-us [name="contact-email"]').val();
-		args.message = $('#content-contact-us [name="contact-message"]').val();
-		
-		if(!validate_email(args.email)) {
-			msgprint('Please enter a valid email id');
-			return;
-		}
-		
-		if(args.name && args.email && args.message) {
-			$(this).set_working();
-			$c_page('website', 'contact', 'send', args, function(r) {
-				$('#content-contact-us [name*="contact"]').val('');
-				$(me).done_working();
-			});
-		} else {
-			msgprint("Please enter info in all the fields.")
-		}
-	});
-	
-	$('#content-contact-us :input').keyup(function(ev) {
-		if(ev.which == 13) {
-			$('#content-contact-us .btn.primary').click();
-		}
-	});
-}
\ No newline at end of file
diff --git a/erpnext/website/page/contact/contact.py b/erpnext/website/page/contact/contact.py
deleted file mode 100644
index 1ee3ab9..0000000
--- a/erpnext/website/page/contact/contact.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import json, webnotes
-
-@webnotes.whitelist(allow_guest=True)
-def send(args):
-	"""create support ticket"""
-	args = json.loads(args)
-	
-	from webnotes.model.doc import Document
-	d = Document('Support Ticket')
-	d.raised_by = args['email']
-	d.description = 'From: ' + args['name'] + '\n\n' + args['message']
-	d.subject = 'Website Query'
-	d.status = 'Open'
-	d.owner = 'Guest'
-	d.save(1)
-	webnotes.msgprint("Thank you for your query. We will respond as soon as we can.")
\ No newline at end of file
diff --git a/erpnext/website/page/contact/contact.txt b/erpnext/website/page/contact/contact.txt
deleted file mode 100644
index 6051c6f..0000000
--- a/erpnext/website/page/contact/contact.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Page, contact
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-01-25 16:02:15',
-		'docstatus': 0,
-		'modified': '2012-01-25 16:02:15',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Page
-	{
-		'doctype': 'Page',
-		'module': 'Website',
-		'name': '__common__',
-		'page_name': 'contact',
-		'standard': 'Yes'
-	},
-
-	# These values are common for all Page Role
-	{
-		'doctype': 'Page Role',
-		'name': '__common__',
-		'parent': 'contact',
-		'parentfield': 'roles',
-		'parenttype': 'Page',
-		'role': 'Guest'
-	},
-
-	# Page, contact
-	{
-		'doctype': 'Page',
-		'name': 'contact'
-	},
-
-	# Page Role
-	{
-		'doctype': 'Page Role'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/website/page/products/README.md b/erpnext/website/page/products/README.md
deleted file mode 100644
index e40b446..0000000
--- a/erpnext/website/page/products/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-## Products
-
-Contains
-
-- List of Products tagged by Item master
-	- image
-	- short description (md)
-	- pricing info (if public) (public pricelist)
-	- stock info (website warehouse)
-- Search
-- Sidebar contains categories (# of items in each category)
-
-When Item is Saved, a page for that item is created with
-
-- Large image
-- Smaller images
-- Long Description
-- Pricing info
-- Stock info
-- Contact Button (instead of Buy / Add to cart)
-
-### Steps
-
-- update item master
-- update item category (show in web + priority) (or in a products settings page)
-- # of public items in each category
-- validation - item cannot have show in item if parent does not have it
\ No newline at end of file
diff --git a/erpnext/website/page/products/__init__.py b/erpnext/website/page/products/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/website/page/products/__init__.py
+++ /dev/null
diff --git a/erpnext/website/page/products/products.html b/erpnext/website/page/products/products.html
deleted file mode 100644
index 30eca4a..0000000
--- a/erpnext/website/page/products/products.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<div class="layout-wrapper layout-wrapper-background" id="content-products">
-	<div class="layout-main-section">
-		<h1 class="products-category"></h1>
-		<div class="products-search" style="margin-bottom: 15px;">
-			<input name="products-search" /><button class="btn" style="margin-left: 7px">Search</button>
-		</div>
-		<div class="products-list"></div>
-	</div>
-	<div class="layout-side-section">
-		<h3>Categories</h3>
-		<div class="more-categories"></div>
-	</div>
-	<div style="clear:both;">
-</div>
\ No newline at end of file
diff --git a/erpnext/website/page/products/products.js b/erpnext/website/page/products/products.js
deleted file mode 100644
index 1e8dcaa..0000000
--- a/erpnext/website/page/products/products.js
+++ /dev/null
@@ -1,109 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-erpnext.products = {}
-
-wn.require('js/product_category.js');
-
-pscript.onload_products = function(wrapper) {
-	erpnext.make_product_categories(wrapper);
-	erpnext.products.wrapper = wrapper;	
-
-	// make lists
-	erpnext.products.make_product_list(wrapper);
-	
-	// button
-	$(wrapper).find('.products-search .btn').click(function() {
-		wrapper.mainlist.run();
-	});
-	
-	$(wrapper).find('.products-search input').keypress(function(ev) {
-		if(ev.which==13) $(wrapper).find('.products-search .btn').click();
-	});
-}
-
-pscript.onshow_products = function(wrapper) {
-	// show default product category
-	erpnext.products.set_group();
-}
-
-erpnext.products.get_group = function() {
-	route = wn.get_route();
-	if(route.length>1) {
-		// from url
-		var grp = route[1];
-		var label = route[1];
-	} else {
-		// default
-		var grp = wn.boot.website_settings.default_product_category;
-		var label = wn.boot.website_settings.default_product_category;
-	}
-	erpnext.products.cur_group = grp;
-	return {grp:grp, label:label};
-}
-
-erpnext.products.make_product_list = function(wrapper) {
-	wrapper.mainlist = new wn.ui.Listing({
-		parent: $(wrapper).find('.products-list').get(0),
-		run_btn: $(wrapper).find('.products-search .btn').get(0),
-		no_toolbar: true,
-		get_query: function() {
-			var srch = $('input[name="products-search"]').val()
-			var search_cond = 'and (description like "%%(srch)s%"\
-				or item_name like "%%(srch)s%")';
-			args = {
-				search_cond: srch ? repl(search_cond, {srch:srch}) : '',
-				cat: erpnext.products.cur_group
-			};
-			return repl('select name, item_name, website_image, \
-				description, page_name \
-				from tabItem \
-				where is_sales_item="Yes" \
-				and item_group="%(cat)s" \
-				%(search_cond)s', args)
-		},
-		render_row: function(parent, data) {
-			parent.innerHTML = repl('<div style="float:left; width: 115px;" class="img-area">\
-				</div>\
-				<div style="float:left; width: 400px">\
-					<p><b><a href="#!%(page_name)s">%(item_name)s</a></b></p>\
-					<p>%(description)s</p></div>\
-				<div style="clear: both;"></div>', data);
-				
-			if(data.website_image) {
-				$(parent).find('.img-area').append(repl(
-					'<img src="files/%(website_image)s" style="width:100px;">', data))
-			} else {
-				$(parent).find('.img-area').append(wn.dom.placeholder(70, 
-					data.item_name));
-			}
-		}
-	});
-}
-
-erpnext.products.set_group = function() {
-	var cat = erpnext.products.get_group();
-	if(!cat.grp) {
-		// still nothing
-		setTimeout('erpnext.products.set_group()', 1000);
-		return;		
-	}
-	// get erpnext.products.default_category
-	var wrapper = erpnext.products.wrapper;
-	
-	$(wrapper).find('h1').html(cat.label);
-	wrapper.mainlist.run();
-}
diff --git a/erpnext/website/page/products/products.txt b/erpnext/website/page/products/products.txt
deleted file mode 100644
index f00a05b..0000000
--- a/erpnext/website/page/products/products.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Page, products
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-01-30 10:49:01',
-		'docstatus': 0,
-		'modified': '2012-01-30 10:49:01',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Page
-	{
-		'doctype': 'Page',
-		'module': 'Website',
-		'name': '__common__',
-		'page_name': 'products',
-		'standard': 'Yes',
-		'title': 'Products'
-	},
-
-	# These values are common for all Page Role
-	{
-		'doctype': 'Page Role',
-		'name': '__common__',
-		'parent': 'products',
-		'parentfield': 'roles',
-		'parenttype': 'Page',
-		'role': 'Guest'
-	},
-
-	# Page, products
-	{
-		'doctype': 'Page',
-		'name': 'products'
-	},
-
-	# Page Role
-	{
-		'doctype': 'Page Role'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/website/product.py b/erpnext/website/product.py
new file mode 100644
index 0000000..aff15d9
--- /dev/null
+++ b/erpnext/website/product.py
@@ -0,0 +1,116 @@
+import webnotes
+
+@webnotes.whitelist(allow_guest=True)
+def get_product_list(args=None):
+	"""
+		args = {
+			'limit_start': 0,
+			'limit_page_length': 20,
+			'search': '',
+			'product_group': '',
+		}
+	"""
+	import webnotes
+	from webnotes.utils import cstr, cint
+	
+	if not args: args = webnotes.form_dict
+	
+	# base query
+	query = """\
+		select name, item_name, page_name, website_image,
+		description, web_short_description
+		from `tabItem`
+		where is_sales_item = 'Yes'
+		and docstatus = 0
+		and show_in_website = 1"""
+	
+	# search term condition
+	if args.get('search'):
+		query += """
+			and (
+				web_short_description like %(search)s or
+				web_long_description like %(search)s or
+				description like %(search)s or
+				item_name like %(search)s or
+				name like %(search)s
+			)"""
+		args['search'] = "%" + cstr(args.get('search')) + "%"
+	
+	# product group condition
+	if args.get('product_group') and args.get('product_group') != 'All Products':
+		query += """
+			and item_group = %(product_group)s"""
+	
+	# order by
+	query += """
+		order by item_name asc, name asc"""
+
+	from webnotes.widgets.query_builder import add_limit_to_query
+	query, args = add_limit_to_query(query, args)
+
+	return webnotes.conn.sql(query, args, as_dict=1)
+
+@webnotes.whitelist(allow_guest=True)
+def get_product_category_list(args=None):
+	"""
+		args = {
+			'limit_start': 0,
+			'limit_page_length': 5,
+		}
+	"""
+	import webnotes
+	
+	if not args: args = webnotes.form_dict
+	
+	query = """\
+		select count(name) as items, item_group
+		from `tabItem`
+		where is_sales_item = 'Yes'
+		and docstatus = 0
+		and show_in_website = 1
+		group by item_group
+		order by items desc"""
+		
+	from webnotes.widgets.query_builder import add_limit_to_query
+	query, args = add_limit_to_query(query, args)
+
+	
+	result = webnotes.conn.sql(query, args, as_dict=1)
+
+	# add All Products link
+	total_count = sum((r.get('items') or 0 for r in result))
+	result = [{'items': total_count, 'item_group': 'All Products'}] + (result or [])
+	
+	return result
+	
+@webnotes.whitelist(allow_guest=True)
+def get_similar_product_list(args=None):
+	"""
+		args = {
+			'limit_start': 0,
+			'limit_page_length': 5,
+			'product_name': '',
+			'product_group': '',
+		}
+	"""
+	import webnotes
+	
+	if not args: args = webnotes.form_dict
+	
+	query = """\
+		select name, item_name, page_name, website_image,
+		description, web_short_description
+		from `tabItem`
+		where is_sales_item = 'Yes'
+		and docstatus = 0
+		and show_in_website = 1
+		and name != %(product_name)s
+		and item_group = %(product_group)s
+		order by item_name"""
+	
+	from webnotes.widgets.query_builder import add_limit_to_query
+	query, args = add_limit_to_query(query, args)
+	
+	result = webnotes.conn.sql(query, args, as_dict=1)
+		
+	return result
\ No newline at end of file
diff --git a/erpnext/website/page/blog/__init__.py b/erpnext/website/templates/__init__.py
similarity index 100%
rename from erpnext/website/page/blog/__init__.py
rename to erpnext/website/templates/__init__.py
diff --git a/erpnext/website/templates/css/blog.css b/erpnext/website/templates/css/blog.css
new file mode 100644
index 0000000..199df1a
--- /dev/null
+++ b/erpnext/website/templates/css/blog.css
@@ -0,0 +1,7 @@
+	<style>
+		h2 > a, h2 > a:link, h2 > a:visited, h2 > a:active,
+		h2 > a:hover, h2 > a:focus {
+			text-decoration: none;
+			color: inherit;
+		}
+	</style>
\ No newline at end of file
diff --git a/erpnext/website/templates/css/blog_page.css b/erpnext/website/templates/css/blog_page.css
new file mode 100644
index 0000000..928b8ac
--- /dev/null
+++ b/erpnext/website/templates/css/blog_page.css
@@ -0,0 +1,9 @@
+	<style>
+		.comment-title {
+			color:#777;
+		}
+		
+		.comment-content {
+			margin-left: 20px;
+		}
+	</style>
\ No newline at end of file
diff --git a/erpnext/website/templates/css/login.css b/erpnext/website/templates/css/login.css
new file mode 100644
index 0000000..4e3e4b1
--- /dev/null
+++ b/erpnext/website/templates/css/login.css
@@ -0,0 +1,10 @@
+	<style>
+		#login_wrapper {
+			width: 300px !important;
+			margin: 20px auto;
+		}
+
+		.login-banner {
+			margin-bottom: 20px;
+		}
+	</style>
\ No newline at end of file
diff --git a/erpnext/website/templates/css/product_page.css b/erpnext/website/templates/css/product_page.css
new file mode 100644
index 0000000..2708625
--- /dev/null
+++ b/erpnext/website/templates/css/product_page.css
@@ -0,0 +1,34 @@
+	<style>
+		.web-long-description {
+			font-size: 18px;
+			line-height: 200%;
+		}
+		.product-page-content {
+			float: left;
+		}
+		/* product page image css */
+		.product-page-content img {
+			max-width: 100%;
+		}
+		
+		/* similar products listing */
+		.similar-products .img-area img {
+			max-width: 55px;
+			max-height: 55px;
+		}
+		
+		.similar-products .img-area {
+			float: left;
+			width: 30%;
+			margin-top: 0.3em;
+		}
+		
+		.similar-product-description {
+			float: left;
+			width: 70%;
+		}
+		
+		.similar-product-description span {
+			font-size: 12px;
+		}
+	</style>
\ No newline at end of file
diff --git a/erpnext/website/templates/css/products.css b/erpnext/website/templates/css/products.css
new file mode 100644
index 0000000..73289c4
--- /dev/null
+++ b/erpnext/website/templates/css/products.css
@@ -0,0 +1,11 @@
+	<style>
+		.img-area {
+			float:left;
+			width: 115px;
+		}
+		
+		.product-list-description {
+			float:left;
+			width: 400px;
+		}
+	</style>
\ No newline at end of file
diff --git a/erpnext/website/templates/html/base.html b/erpnext/website/templates/html/base.html
new file mode 100644
index 0000000..8639a8f
--- /dev/null
+++ b/erpnext/website/templates/html/base.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<head>
+	<meta charset="utf-8">
+	<title>{% block title %}{% endblock %}</title>
+	<meta name="generator" content="wnframework">
+	<script type="text/javascript" src="js/lib/jquery/jquery.min.js"></script>
+	<script type="text/javascript" src="js/all-web.js"></script>
+	<script type="text/javascript" src="js/wn-web.js"></script>
+	<link type="text/css" rel="stylesheet" href="css/all-web.css">
+	<link type="text/css" rel="stylesheet" href="css/wn-web.css">
+	
+	{% if favicon %}
+	<link rel="shortcut icon" href="files/{{ favicon }}" type="image/x-icon">
+	<link rel="icon" href="files/{{ favicon }}" type="image/x-icon">
+	{% else %}
+	<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
+	<link rel="icon" href="images/favicon.ico" type="image/x-icon">
+	{% endif %}
+	
+	
+	{% block header %}
+	{% endblock %}
+</head>
+<body>
+	{% block body %}
+	{% endblock %}
+</body>
\ No newline at end of file
diff --git a/erpnext/website/templates/html/blog_page.html b/erpnext/website/templates/html/blog_page.html
new file mode 100644
index 0000000..e9c1646
--- /dev/null
+++ b/erpnext/website/templates/html/blog_page.html
@@ -0,0 +1,58 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+	{% include "js/blog_page.js" %}
+{% endblock %}
+
+{% block css %}
+	{% include "css/blog_page.css" %}
+{% endblock %}
+
+{% block content %}
+	<div class="layout-wrapper layout-wrapper-background">
+		<div class="web-content" id="blog-{{ name }}">
+
+			<div class="layout-main-section">
+				
+				<h2>{{ title }}</h2>
+
+				<!-- begin blog content -->
+				<div class="help">By {{ full_name }} on {{ updated }}</div>
+				<br>
+				{{ content_html }}
+				<!-- end blog content -->
+
+				<hr>
+				<h3>Comments</h3><br>
+				<div class="blog-comments">
+					
+					{% if not comment_list %}
+					<div class="no-result help hide">
+						<p>Be the first one to comment</p>
+						<br />
+					</div>
+					{% endif %}
+					
+					{% include 'html/comment.html' %}
+					
+					<button class="btn add-comment">Add Comment</button>
+				</div>
+			</div>
+
+			<div class="layout-side-section">
+				<p><a href="blog.html">All Blogs</a></p>
+				<br />
+				<h4>Subscribe</h4>
+				<p>
+					<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
+					<a href="rss.xml" target="_blank">RSS Feed</a>
+				</p>
+				<br />
+				<h4>Recent Posts</h4>
+				<div class="recent-posts" style="min-height: 100px;"></div>
+			</div>
+
+			<div style="clear: both"></div>
+		</div>
+	</div>
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/templates/html/comment.html b/erpnext/website/templates/html/comment.html
new file mode 100644
index 0000000..1323e09
--- /dev/null
+++ b/erpnext/website/templates/html/comment.html
@@ -0,0 +1,14 @@
+{#
+	this template generates comment rows for a blog
+	it is to be included in the blog/blog.html template
+#}
+
+{% for comment in comment_list %}
+<div class="comment-row">
+	<div class="comment-title">
+		{{ comment.comment_by_fullname }} - {{ comment.comment_date }}:
+	</div>
+	<p class="comment-content">{{ comment.comment }}</p>
+	<hr>
+</div>
+{% endfor %}
\ No newline at end of file
diff --git a/erpnext/website/templates/html/outer.html b/erpnext/website/templates/html/outer.html
new file mode 100644
index 0000000..47184fa
--- /dev/null
+++ b/erpnext/website/templates/html/outer.html
@@ -0,0 +1,59 @@
+{#
+	requires, brand, top_bar_items, footer_items, copyright, content
+#}
+
+{% extends "html/base.html" %}
+
+{% block body %}
+
+	<header>
+		<div class="navbar navbar-fixed-top">
+			<div class="navbar-inner">
+			<div class="container">
+				<a class="brand" href="index.html">{{ brand }}</a>
+				<ul class="nav">
+					{% for page in top_bar_items %}
+						{% if not page.parent_label %}
+						<li data-label="{{ page.label }}">
+							<a href="{{ page.url }}" {{ page.target }}>
+							{{ page.label }}
+							{% if page.child_items %}
+								<ul class="dropdown-menu">
+								{% for child in page.child_items %}
+									<li data-label="{{ child.label }}">
+										<a href="{{ child.url }}" {{ child.target }}>
+								{% endfor %}
+								</ul>
+							{% endif %}
+							</a></li>
+						{% endif %}
+					{% endfor %}
+				</ul>
+				<img src="images/lib/ui/spinner.gif" id="spinner"/>
+				<ul class="nav pull-right">
+					<li id="login-topbar-item"><a href="login.html">Login</a></li>
+				</ul>
+			</div>
+			</div>
+			</div>	
+	</header>
+	<div id="body_div">
+		<div class="content" id="page-{{ name }}" style="display: block;">
+		{% block content %}
+		{% endblock %}
+		</div>
+	</div>
+	<footer><div class="web-footer">
+		<div class="web-footer-menu"><ul>
+		{% for item in footer_items %}
+			<li><a href="{{ item.url }}" {{ item.target }}
+				data-label="{{ item.label }}">{{ item.label }}</a></li>
+		{% endfor %}
+		</ul></div>
+		{% if copyright %}
+		<div class="web-footer-copyright">&copy; {{ copyright }}
+		{% endif %}
+		</div>
+	</footer>
+
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/templates/html/page.html b/erpnext/website/templates/html/page.html
new file mode 100644
index 0000000..e2eb6f4
--- /dev/null
+++ b/erpnext/website/templates/html/page.html
@@ -0,0 +1,36 @@
+{% extends "html/outer.html" %}
+
+{% block title %}{{ title }}{% endblock %}
+
+{% block header %}
+	{{ super() }}
+	<script>
+	window.page_name = "{{ name }}";
+
+	$(document).bind('app_ready', function() {
+		var _page = new wn.views.Page(window.page_name);
+	
+		// page script
+		{% block javascript %}
+		{% endblock %}
+	
+		// trigger onload
+		_page.trigger('onload');
+	
+		// activate page
+		wn.container.change_to(window.page_name);
+	});
+	</script>
+	
+	{% block css %}
+	{% if insert_style %}
+	
+	<style>{{ css }}</style>
+
+	{% endif %}
+	{% endblock %}
+{% endblock %}
+
+{% block content %}
+	{{ content }}
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/templates/html/product_page.html b/erpnext/website/templates/html/product_page.html
new file mode 100644
index 0000000..646bba9
--- /dev/null
+++ b/erpnext/website/templates/html/product_page.html
@@ -0,0 +1,48 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+	{% include "js/product_page.js" %}
+{% endblock %}
+
+{% block css %}
+	{% include "css/product_page.css" %}
+{% endblock %}
+
+{% block title %}
+	{% if item_name != name %}
+		{{ item_name }} [{{ name }}]
+	{% else %}
+		{{ item_name }}
+	{% endif %}
+{% endblock %}
+
+{% block content %}
+	<div class="layout-wrapper layout-wrapper-background">
+		<div class="web-content" id="content-product-{{ name }}">
+			<div class="layout-main-section">
+				<h1>{{ item_name }}</h1>
+				<div class="product-page-content">
+					<br><br>
+					{% if website_image %}
+					<image src="files/{{ website_image }}" />
+					{% else %}
+					<div class="img-area"></div>
+					<span style="font-size: 11px">This is an auto-generated Image</span>
+					{% endif %}
+					<br><br>
+					<div class="web-long-description">
+					{{ web_description_html }}
+					</div>
+				</div>
+			</div>
+			<div class="layout-side-section">
+				<h4>More Categories</h4>
+				<div class="more-categories"></div>
+				<br>
+				<h4>Similar Products</h4>
+				<div class="similar-products"></div>
+			</div>
+			<div style="clear: both"></div>
+		</div>
+	</div>
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/templates/html/web_page.html b/erpnext/website/templates/html/web_page.html
new file mode 100644
index 0000000..6fa7d27
--- /dev/null
+++ b/erpnext/website/templates/html/web_page.html
@@ -0,0 +1,29 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+	{% if insert_code %}
+		{{ javascript }}
+	{% endif %}
+{% endblock %}
+
+{% block content %}
+	<div class="layout-wrapper layout-wrapper-background">
+		<div class="web-content" style="text-align: {{ text_align }};">
+
+			{% if layout and layout.startswith('Two column') %}
+			<div class="layout-main-section">
+			{% else %}
+			<div class="layout-main">
+			{% endif %}
+				{{ main_section_html }}
+			</div>
+
+			{% if layout and layout.startswith('Two column') %}
+			<div class="layout-side-section">
+				{{ side_section_html }}
+			</div>
+			{% endif %}
+			<div style="clear: both"></div>
+		</div>
+	</div>
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/js/product_category.js b/erpnext/website/templates/js/blog.js
similarity index 60%
rename from erpnext/website/js/product_category.js
rename to erpnext/website/templates/js/blog.js
index 8d3f898..78dd3b7 100644
--- a/erpnext/website/js/product_category.js
+++ b/erpnext/website/templates/js/blog.js
@@ -14,17 +14,21 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-erpnext.make_product_categories = function(wrapper) {
-	wrapper.category_list = new wn.ui.Listing({
-		parent: $(wrapper).find('.more-categories').get(0),
-		query: 'select count(name) as items, item_group \
-			from tabItem where is_sales_item="Yes" \
-			group by item_group order by items desc',
+// js inside blog page
+wn.pages['{{ name }}'].onload = function(wrapper) {
+	erpnext.blog_list = new wn.ui.Listing({
+		parent: $(wrapper).find('#blog-list').get(0),
+		method: 'website.blog.get_blog_list',
 		hide_refresh: true,
+		no_toolbar: true,
 		render_row: function(parent, data) {
-			parent.innerHTML = repl('<a href="#!products/%(item_group)s">%(item_group)s</a> (%(items)s)', 
-				data);
-		}
+			if(data.content && data.content.length==1000) {
+				data.content += repl('... <a href="%(name)s.html">(read on)</a>', data);
+			}
+			parent.innerHTML = repl('<h2><a href="%(name)s.html">%(title)s</a></h2>\
+				%(content)s<br /><br />', data);
+		},
+		page_length: 10
 	});
-	wrapper.category_list.run();	
-}
+	erpnext.blog_list.run();
+}
\ No newline at end of file
diff --git a/erpnext/website/templates/js/blog_page.js b/erpnext/website/templates/js/blog_page.js
new file mode 100644
index 0000000..7121677
--- /dev/null
+++ b/erpnext/website/templates/js/blog_page.js
@@ -0,0 +1,180 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+// js inside blog page
+
+wn.provide('erpnext.blog');
+wn.pages['{{ name }}'].onload = function(wrapper) {
+	erpnext.blog.wrapper = wrapper;
+	
+	// sidebar
+	erpnext.blog.render_recent_list(wrapper);
+	
+	// unhide no-result if no comments found
+	erpnext.blog.toggle_no_result(wrapper);
+	
+	// bind add comment button to comment dialog
+	erpnext.blog.make_comment_dialog(wrapper);
+	
+	// hide add comment button after 50 comments
+	erpnext.blog.toggle_add_comment_btn(wrapper);
+}
+
+erpnext.blog.adjust_page_height = function(wrapper) {
+	if (!wrapper) { wrapper = erpnext.blog.wrapper; }
+	if (!wrapper) { return; }
+
+	// adjust page height based on sidebar height
+	var $main_page = $(wrapper).find('.layout-main-section');
+	var $sidebar = $(wrapper).find('.layout-side-section');
+	if ($sidebar.height() > $main_page.height()) {
+		$main_page.height($sidebar.height());
+	}
+}
+
+erpnext.blog.render_recent_list = function(wrapper) {
+	if (!wrapper) { wrapper = erpnext.blog.wrapper; }
+	if (!wrapper) { return; }
+	
+	wrapper.recent_list = new wn.ui.Listing({
+		parent: $(wrapper).find('.recent-posts'),
+		no_toolbar: true,
+		method: 'website.blog.get_recent_blog_list',
+		get_args: function() {
+			return { name: '{{ name }}' }
+		},
+		hide_refresh: true,
+		render_row: function(parent, data) {
+			if(data.content && data.content.length>=100) data.content += '...';
+			parent.innerHTML = repl('<a href="%(name)s.html">%(title)s</a>\
+				<div class="comment">%(content)s</div><br>', data);
+			
+			// adjust page height depending on sidebar height
+			erpnext.blog.adjust_page_height(wrapper);
+		},
+		page_length: 5,
+	});
+	wrapper.recent_list.run();
+}
+
+erpnext.blog.toggle_no_result = function(wrapper) {
+	if (!wrapper) { wrapper = erpnext.blog.wrapper; }
+	if (!wrapper) { return; }
+	
+	var $blog_comments = $(wrapper).find('.blog-comments');
+	var $comment_rows = $blog_comments.find('.comment-row');
+	var $no_result = $blog_comments.find('.no-result');
+
+	if ($comment_rows.length == 0) {
+		$no_result.removeClass('hide');
+	} else {
+		$no_result.addClass('hide');
+	}
+}
+
+erpnext.blog.make_comment_dialog = function(wrapper) {
+	if (!wrapper) { wrapper = erpnext.blog.wrapper; }
+	if (!wrapper) { return; }
+	
+	var $comment_btn = $(wrapper).find('button.add-comment');
+	
+	$comment_btn.click(function() {
+		if(!erpnext.blog.comment_dialog) {
+			var d = new wn.widgets.Dialog({
+				title: 'Add Comment',
+				fields: [
+					{
+						fieldname: 'comment_by_fullname', label: 'Your Name',
+						reqd: 1, fieldtype: 'Data'
+					},
+					{
+						fieldname: 'comment_by', label: 'Email Id',
+						reqd: 1, fieldtype: 'Data'
+					},
+					{
+						fieldname: 'comment', label: 'Comment',
+						reqd: 1, fieldtype: 'Text'
+					},
+					{
+						fieldname: 'post_comment', label: 'Post Comment',
+						fieldtype: 'Button'
+					},
+				],
+			});
+			
+			erpnext.blog.comment_dialog = d;
+		}
+		
+		erpnext.blog.comment_dialog.fields_dict.post_comment
+				.input.onclick = function() {
+			erpnext.blog.add_comment(wrapper);
+		}
+		
+		erpnext.blog.comment_dialog.show();
+	});
+
+}
+
+erpnext.blog.add_comment = function(wrapper) {
+	var args = erpnext.blog.comment_dialog.get_values();
+
+	if(!args) return;
+	
+	args.comment_doctype = 'Blog';
+	args.comment_docname = '{{ name }}';
+	args.page_name = '{{ page_name }}';
+	
+	wn.call({
+		method: 'website.blog.add_comment',
+		args: args,
+		btn: this,
+		callback: function(r) {
+			if(!r.exc) {
+				erpnext.blog.add_comment_to_page(wrapper, r.message);
+				erpnext.blog.comment_dialog.hide();
+			}
+		}
+	});
+}
+
+erpnext.blog.add_comment_to_page = function(wrapper, comment) {
+	$blog_comments = $(wrapper).find('.blog-comments');
+	$comment_rows = $blog_comments.find('.comment-row');
+	
+	if ($comment_rows.length) {
+		$blog_comments.append(comment);
+	} else {
+		$blog_comments.append(comment);
+	}
+	
+	erpnext.blog.toggle_no_result(wrapper);
+	erpnext.blog.toggle_add_comment_btn(wrapper);
+}
+
+erpnext.blog.toggle_add_comment_btn = function(wrapper) {
+	var $wrapper = $(wrapper);
+	if ($wrapper.find('.blog-comments .comment-row').length > 50) {
+		var $comment_btn = $wrapper.find('button.add-comment');
+		$comment_btn.addClass('hide');
+		
+		// show comments are close
+		$wrapper.find('.blog-comments').append("\
+			<div class=\"help\"> \
+				<p>Comments Closed</p> \
+				<br /> \
+			</div>");
+	}
+}
\ No newline at end of file
diff --git a/erpnext/website/templates/js/login.js b/erpnext/website/templates/js/login.js
new file mode 100644
index 0000000..29e4922
--- /dev/null
+++ b/erpnext/website/templates/js/login.js
@@ -0,0 +1,91 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+wn.provide('erpnext.login');
+
+wn.pages["{{ name }}"].onload = function(wrapper) {
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
+	wrapper.appframe.title('Login');
+	wrapper.appframe.$w.find('.close').toggle(false);
+
+	var lw = $i('login_wrapper');
+	$bs(lw, '1px 1px 3px #888');
+
+	$('#login_btn').click(erpnext.login.doLogin)
+		
+	$('#password').keypress(function(ev){
+		if(ev.which==13 && $('#password').val()) {
+			$('form').submit(function() {
+				erpnext.login.doLogin();
+				return false;
+			});
+		}
+	});
+	$(document).trigger('login_rendered');
+}
+
+// Login Callback
+erpnext.login.onLoginReply = function(r, rtext) {
+	$('#login_btn').done_working();
+    if(r.message=="Logged In"){
+        window.location.href='app.html' + (get_url_arg('page') ? ('?page='+get_url_arg('page')) : '');
+    } else {
+        $i('login_message').innerHTML = '<span style="color: RED;">'+(r.message)+'</span>';
+        //if(r.exc)alert(r.exc);
+    }
+}
+
+
+// Login
+erpnext.login.doLogin = function(){
+
+    var args = {};
+    args['usr']=$i("login_id").value;
+    args['pwd']=$i("password").value;
+    if($i('remember_me').checked) 
+      args['remember_me'] = 1;
+
+	$('#login_btn').set_working();
+	
+    $c("login", args, erpnext.login.onLoginReply);
+
+	return false;
+}
+
+
+erpnext.login.show_forgot_password = function(){
+    // create dialog
+	var d = new wn.ui.Dialog({
+		title:"Forgot Password",
+		fields: [
+			{'label':'Email Id', 'fieldname':'email_id', 'fieldtype':'Data', 'reqd':true},
+			{'label':'Email Me A New Password', 'fieldname':'run', 'fieldtype':'Button'}
+		]
+	});
+
+	$(d.fields_dict.run.input).click(function() {
+		var values = d.get_values();
+		if(!values) return;
+		wn.call({
+			method:'reset_password',
+			args: { user: values.email_id },
+			callback: function() {
+				d.hide();
+			}
+		})
+	})
+	d.show();
+}
\ No newline at end of file
diff --git a/erpnext/website/templates/js/product_category.js b/erpnext/website/templates/js/product_category.js
new file mode 100644
index 0000000..4229d00
--- /dev/null
+++ b/erpnext/website/templates/js/product_category.js
@@ -0,0 +1,18 @@
+wn.provide('erpnext.products');
+
+erpnext.products.make_product_categories = function(wrapper) {
+	if (!wrapper) { wrapper = erpnext.products.wrapper; }
+	if (!wrapper) { return; }
+
+	wrapper.category_list = new wn.ui.Listing({
+		parent: $(wrapper).find('.more-categories').get(0),
+		method: 'website.product.get_product_category_list',
+		hide_refresh: true,
+		render_row: function(parent, data) {
+			parent.innerHTML = repl(
+				'<a href="products.html#!products/%(item_group)s">%(item_group)s</a> (%(items)s)', 
+				data);
+		}
+	});
+	wrapper.category_list.run();
+}
\ No newline at end of file
diff --git a/erpnext/website/templates/js/product_page.js b/erpnext/website/templates/js/product_page.js
new file mode 100644
index 0000000..0c4abb4
--- /dev/null
+++ b/erpnext/website/templates/js/product_page.js
@@ -0,0 +1,92 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+{% include "js/product_category.js" %}
+
+wn.pages['{{ name }}'].onload = function(wrapper) {
+	wrapper.product_group = "{{ item_group }}";
+	wrapper.product_name = "{{ name }}";
+	erpnext.products.make_product_categories(wrapper);
+	erpnext.products.make_similar_products(wrapper);
+
+	// if website image missing, autogenerate one
+	var $img = $(wrapper).find('.product-page-content .img-area');
+	if ($img && $img.length > 0) {
+		$img.append(wn.dom.placeholder(160, "{{ item_name }}"));
+	}
+	
+	erpnext.products.adjust_page_height(wrapper);
+	
+}
+
+erpnext.products.adjust_page_height = function(wrapper) {
+	if (!wrapper) { wrapper = erpnext.products.wrapper; }
+	if (!wrapper) { return; }
+
+	// adjust page height based on sidebar height
+	var $main_page = $(wrapper).find('.layout-main-section');
+	var $sidebar = $(wrapper).find('.layout-side-section');
+	if ($sidebar.height() > $main_page.height()) {
+		$main_page.height($sidebar.height());
+	}
+}
+
+erpnext.products.make_similar_products = function(wrapper) {
+	if (!wrapper) { wrapper = erpnext.products.wrapper; }
+	if (!wrapper) { return; }
+	
+	// similar products
+	wrapper.similar = new wn.ui.Listing({
+		parent: $(wrapper).find('.similar-products').get(0),
+		hide_refresh: true,
+		page_length: 5,
+		method: 'website.product.get_similar_product_list',
+		get_args: function() {
+			return {
+				product_group: wrapper.product_group,
+				product_name: wrapper.product_name
+			}
+		},
+		render_row: function(parent, data) {
+			if (!data.web_short_description) {
+				data.web_short_description = data.description;
+			}
+			if(data.web_short_description.length > 100) {
+				data.web_short_description = 
+					data.web_short_description.substr(0,100) + '...';
+			}
+			parent.innerHTML = repl('\
+				<a href="%(page_name)s.html"><div class="img-area"></div></a>\
+				<div class="similar-product-description">\
+					<h5><a href="%(page_name)s.html">%(item_name)s</a></h5>\
+					<span>%(web_short_description)s</span>\
+				</div>\
+				<div style="clear:both"></div>', data);
+				
+			if(data.website_image) {
+				$(parent).find('.img-area').append(repl(
+					'<img src="files/%(website_image)s" />', data))
+			} else {
+				$(parent).find('.img-area').append(wn.dom.placeholder(55, 
+					data.item_name));
+			}
+			
+			// adjust page height, if sidebar height keeps increasing
+			erpnext.products.adjust_page_height(wrapper);
+		}
+	});
+	wrapper.similar.run();
+}
\ No newline at end of file
diff --git a/erpnext/website/templates/js/products.js b/erpnext/website/templates/js/products.js
new file mode 100644
index 0000000..f4c68cb
--- /dev/null
+++ b/erpnext/website/templates/js/products.js
@@ -0,0 +1,106 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+// js inside blog page
+
+{% include "js/product_category.js" %}
+
+wn.pages['{{ name }}'].onload = function(wrapper) {
+	erpnext.products.wrapper = wrapper;
+	
+	// make product categories in the sidebar
+	erpnext.products.make_product_categories(wrapper);
+	
+	// make lists
+	erpnext.products.make_product_list(wrapper);
+	
+	// bind search button or enter key
+	$(wrapper).find('.products-search .btn').click(function() {
+		erpnext.products.product_list.run();
+	});
+	
+	$(wrapper).find('.products-search input').keypress(function(ev) {
+		if(ev.which==13) $(wrapper).find('.products-search .btn').click();
+	});
+}
+
+erpnext.products.make_product_list = function(wrapper) {
+	if (!wrapper) { wrapper = erpnext.products.wrapper; }
+	if (!wrapper) { return; }
+	
+	erpnext.products.product_list = new wn.ui.Listing({
+		parent: $(wrapper).find('#products-list').get(0),
+		run_btn: $(wrapper).find('.products-search .btn').get(0),
+		no_toolbar: true,
+		method: 'website.product.get_product_list',
+		get_args: function() {
+			return {
+				search: $('input[name="products-search"]').val() || '',
+				product_group: erpnext.products.cur_group || '',
+			};
+		},
+		render_row: function(parent, data) {
+			if (!data.web_short_description) {
+				data.web_short_description = data.description;
+			}
+			parent.innerHTML = repl('\
+				<a href="%(page_name)s.html"><div class="img-area"></div></a>\
+				<div class="product-list-description">\
+					<h4><a href="%(page_name)s.html">%(item_name)s</a></h4>\
+					<p>%(web_short_description)s</p></div>\
+				<div style="clear: both;"></div>', data);
+				
+			if(data.website_image) {
+				$(parent).find('.img-area').append(repl(
+					'<img src="files/%(website_image)s" style="width:100px;">', data))
+			} else {
+				$(parent).find('.img-area').append(wn.dom.placeholder(100, 
+					data.item_name));
+			}
+		}
+	});
+}
+
+wn.pages['{{ name }}'].onshow = function(wrapper) {
+	// show default product category
+	erpnext.products.set_group();
+}
+
+erpnext.products.set_group = function() {
+	var cat = erpnext.products.get_group();
+
+	// get erpnext.products.default_category
+	var wrapper = erpnext.products.wrapper;
+	
+	$(wrapper).find('h1').html(cat.label);
+	erpnext.products.product_list.run();
+}
+
+erpnext.products.get_group = function() {
+	route = wn.get_route();
+	if(route && route.length>1) {
+		// from url
+		var grp = route[1];
+		var label = route[1];
+		erpnext.products.cur_group = grp;
+	} else {
+		// default
+		var grp = 'Products';
+		var label = 'Products';
+		erpnext.products.cur_group = null;
+	}
+	return {grp:grp, label:label};
+}
\ No newline at end of file
diff --git a/erpnext/website/templates/pages/404.html b/erpnext/website/templates/pages/404.html
new file mode 100644
index 0000000..0423608
--- /dev/null
+++ b/erpnext/website/templates/pages/404.html
@@ -0,0 +1,12 @@
+{% extends "html/outer.html" %}
+
+{% block content %}
+<div class="content">
+	<div class="layout-wrapper layout-main">
+		<h3>Page missing or moved</h3>
+		<br>
+		<p>We are very sorry for this, but the page you are looking for is missing
+			(this could be because of a typo in the address) or moved.</p>
+	</div>
+</div>
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/templates/pages/blog.html b/erpnext/website/templates/pages/blog.html
new file mode 100644
index 0000000..40c90c2
--- /dev/null
+++ b/erpnext/website/templates/pages/blog.html
@@ -0,0 +1,41 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+	{% include "js/blog.js" %}
+{% endblock %}
+
+{% block css %}
+	{% include "css/blog.css" %}
+{% endblock %}
+
+{% block title %}Blog{% endblock %}
+
+{% block content %}
+	<div class="layout-wrapper layout-wrapper-background">
+		<div class="web-content" id="content-blog">
+			
+			<div class="layout-main-section">
+				<h1>Blog</h1>
+				<br>
+				<div id="blog-list">
+					<!-- blog list will be generated dynamically -->
+				</div>
+			</div>
+			
+			<div class="layout-side-section">
+				<!-- for later
+				<h4>Get Updates</h4>
+				<p>
+				<input name="blog-subscribe">
+				<button class="btn" id="blog-subscribe">Subscribe</button>
+				</p>-->
+				<h4>Subscribe</h4>
+				<p>
+				<img src="images/feed.png" style="margin-right: 4px; margin-bottom: -4px">
+				<a href="rss.xml" target="_blank">RSS Feed</a>
+				</p>
+			</div>
+			<div style="clear: both"></div>
+		</div>
+	</div>
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/templates/pages/index.html b/erpnext/website/templates/pages/index.html
new file mode 100644
index 0000000..1307872
--- /dev/null
+++ b/erpnext/website/templates/pages/index.html
@@ -0,0 +1 @@
+{% extends "html/web_page.html" %}
\ No newline at end of file
diff --git a/erpnext/website/templates/pages/login.html b/erpnext/website/templates/pages/login.html
new file mode 100644
index 0000000..9bc3171
--- /dev/null
+++ b/erpnext/website/templates/pages/login.html
@@ -0,0 +1,52 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+	{% include "js/login.js" %}
+{% endblock %}
+
+{% block css %}
+	{% include "css/login.css" %}
+{% endblock %}
+
+{% block title %}
+	Login Page
+{% endblock %}
+
+{% block content %}
+	<div class="layout-wrapper layout-wrapper-appframe" id='login_wrapper'>
+	<div class="appframe-area"></div>
+	<div class="layout-main" style="padding: 15px;">
+	<form autocomplete="on">
+		<table border="0" cellspacing="8">
+			<tbody>
+				<tr>
+					<td>Login Id</td>
+					<td><input id="login_id" type="text" style="width: 180px"/></td>
+				</tr>
+				<tr>
+					<td>Password</td>
+					<td><input id="password" type="password" style="width: 180px" /></td>
+				</tr>
+				<tr>
+					<td style="text-align:right"><input id="remember_me" type="checkbox" /></td>
+					<td>Remember Me</td>
+				</tr>
+				<tr>
+					<td>&nbsp;</td>
+					<td id="login_message">&nbsp;</td>
+				</tr>
+				<tr>
+					<td>&nbsp;</td>
+					<td>
+						<button type="submit" id="login_btn" class="btn btn-small btn-primary">Login</button>
+					</td>
+				</tr>
+			</tbody>
+		</table>
+	</form>
+	<p style="margin-left: 72px;"><span class="link_type" 
+		onclick="erpnext.login.show_forgot_password()">Forgot Password</span></p>
+	</div>
+	</div>
+
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/templates/pages/products.html b/erpnext/website/templates/pages/products.html
new file mode 100644
index 0000000..aa23ea2
--- /dev/null
+++ b/erpnext/website/templates/pages/products.html
@@ -0,0 +1,37 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+	{% include "js/products.js" %}
+{% endblock %}
+
+{% block css %}
+	{% include "css/products.css" %}
+{% endblock %}
+
+{% block title %}
+	Products
+{% endblock %}
+
+{% block content %}
+	<div class="layout-wrapper layout-wrapper-background">
+		<div class="web-content" id="content-products">
+			
+			<div class="layout-main-section">
+				<h1 class="products-category"></h1>
+				<div class="products-search" style="margin-bottom: 15px;">
+					<input name="products-search" />
+					<button class="btn" style="margin-left: 7px">Search</button>
+				</div>
+				<div id="products-list">
+					<!-- product list will be generated dynamically -->
+				</div>
+			</div>
+			
+			<div class="layout-side-section">
+				<h3>Categories</h3>
+				<div class="more-categories"></div>
+			</div>
+			<div style="clear: both"></div>
+		</div>
+	</div>
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/utils.py b/erpnext/website/utils.py
index 57e940a..22fcce7 100644
--- a/erpnext/website/utils.py
+++ b/erpnext/website/utils.py
@@ -17,6 +17,12 @@
 import webnotes
 from webnotes.model.doc import Document
 
+def scrub_page_name(page_name):
+	if page_name.endswith('.html'):
+		page_name = page_name[:-5]
+
+	return page_name
+
 def make_template(doc, path, convert_fields = ['main_section', 'side_section']):
 	"""make template"""
 	import os, jinja2
@@ -29,119 +35,9 @@
 	
 	return temp.render(doc = doc.fields)
 
-def markdown(doc, fields):
-	"""convert fields to markdown"""
-	import markdown2
-	# markdown
-	for f in fields:
-		doc.fields[f + '_html'] = markdown2.markdown(doc.fields[f] or '', \
-			extras=["wiki-tables"])
-
-
 def page_name(title):
-	"""make page name from title, and check that there is no duplicate"""
-	import webnotes.cms
-	return webnotes.cms.page_name(title)
-	
-def add_page(title):
-	"""add a custom page with title"""
-	name = page_name(title)
-	if webnotes.conn.sql("""select name from tabPage where name=%s""", name):
-		p = Document('Page', name)
-	else:
-		p = Document('Page')
-		
-	p.title = title
-	p.name = p.page_name = name
-	p.module = 'Website'
-	p.standard = 'No'
-
-	return p
-
-def add_guest_access_to_page(page):
-	"""add Guest in Page Role"""
-	if not webnotes.conn.sql("""select parent from `tabPage Role`
-		where role='Guest' and parent=%s""", page):
-		d = Document('Page Role')
-		d.parent = page
-		d.role = 'Guest'
-		d.save()
-
-def get_header(page_name):
-	"""get page header"""
-
-	from webnotes.model.doc import Document
-	from jinja2 import Template
-	import webnotes.utils
-
-	def get_item(l, label):
-		for i in l:
-			if i['label']==label:
-				return i
-
-	top_bar_items = webnotes.conn.sql("""select * from `tabTop Bar Item`
-		where parent='Website Settings' and parentfield='top_bar_items'
-		order by idx asc""", as_dict=1)
-		
-	# build child items
-	for t in top_bar_items:
-		if t.get('parent_label'):
-			pi = get_item(top_bar_items, t['parent_label'])
-			if 'child_items' not in pi:
-				pi['child_items'] = []
-			pi['child_items'].append(t)
-
-	website_settings = Document('Website Settings', 'Website Settings')
-	
-	return Template("""<div class="navbar navbar-fixed-top">
-		<div class="navbar-inner">
-		<div class="container">
-			<a class="brand" href="index.html">{{ brand }}</a>
-			<ul class="nav">
-				{% for page in top_bar_items %}
-					{% if not page.parent_label %}
-					<li data-label="{{ page.label }}">
-						<a href="{{ page.url }}" {{ page.target }}>
-						{{ page.label }}
-						{% if page.child_items %}
-							<ul class="dropdown-menu">
-							{% for child in page.child_items %}
-								<li data-label="{{ child.label }}">
-									<a href="{{ child.url }}" {{ child.target }}>
-							{% endfor %}
-							</ul>
-						{% endif %}
-						</a></li>
-					{% endif %}
-				{% endfor %}
-			</ul>
-			<img src="images/lib/ui/spinner.gif" id="spinner"/>
-			<ul class="nav pull-right">
-				<li id="login-topbar-item"><a href="login-page.html">Login</a></li>
-			</ul>
-		</div>
-		</div>
-		</div>""").render(top_bar_items = top_bar_items, 
-			brand=website_settings.brand_html or webnotes.utils.get_defaults('company') or 'ERPNext')
-			
-def get_footer(page_name):
-	"""get page footer"""
-	
-	from webnotes.model.doc import Document
-	from jinja2 import Template
-
-	website_settings = Document('Website Settings', 'Website Settings')
-
-	website_settings.footer_items = webnotes.conn.sql("""select * from `tabTop Bar Item`
-		where parent='Website Settings' and parentfield='footer_items'
-		order by idx asc""", as_dict=1)
-
-	return Template("""<div class="web-footer">
-		<div class="web-footer-menu"><ul>
-		{% for item in footer_items %}
-			<li><a href="{{ item.url }}" {{ item.target }}
-				data-label="{{ item.label }}">{{ item.label }}</a></li>
-		{% endfor %}
-		</ul></div>
-		<div class="web-footer-copyright">&copy; {{ copyright }}
-		</div>""").render(website_settings.fields)
+	"""make page name from title"""
+	import re
+	name = title.lower()
+	name = re.sub('[~!@#$%^&*()<>,."\']', '', name)
+	return '-'.join(name.split()[:4])
diff --git a/erpnext/website/web_cache.py b/erpnext/website/web_cache.py
new file mode 100644
index 0000000..893f7f2
--- /dev/null
+++ b/erpnext/website/web_cache.py
@@ -0,0 +1,248 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# html generation functions
+
+template_map = {
+	'Web Page': 'html/web_page.html',
+	'Blog': 'html/blog_page.html',
+	'Item': 'html/product_page.html',
+}
+
+def get_html(page_name, comments=''):
+	import conf
+	
+	html = ''
+	
+	# load from cache, if auto cache clear is falsy
+	if not (hasattr(conf, 'auto_cache_clear') and conf.auto_cache_clear or 0):
+		html = load_from_cache(page_name)
+
+	if not html:
+		html = load_into_cache(page_name)
+		comments += "\n\npage load status: fresh"
+	
+	# insert comments
+	import webnotes.utils
+	html += """\n<!-- %s -->""" % webnotes.utils.cstr(comments)
+	
+	return html
+
+def load_from_cache(page_name):
+	import webnotes
+	
+	result = search_cache(page_name)
+
+	if not result:
+		if page_name in get_predefined_pages():
+			# if a predefined page doesn't exist, load it into cache
+			return None
+		else:
+			# if page doesn't exist, raise exception
+			raise Exception, "Page %s not found" % page_name
+
+	return result[0][0]
+
+def load_into_cache(page_name):
+	args = prepare_args(page_name)
+	
+	html = build_html(args)
+	
+	# create cache entry for predefined pages, if not exists
+	if page_name in get_predefined_pages():
+		create_cache(page_name)
+	
+	import webnotes
+	webnotes.conn.begin()
+	webnotes.conn.set_value('Web Cache', page_name, 'html', html)
+	webnotes.conn.commit()
+	
+	return html
+
+def get_predefined_pages():
+	"""
+		gets a list of predefined pages
+		they do not exist in `tabWeb Page`
+	"""
+	import os
+	import conf
+	import website.utils
+	
+	pages_path = os.path.join(conf.modules_path, 'website', 'templates', 'pages')
+	
+	page_list = []
+	
+	for page in os.listdir(pages_path):
+		page_list.append(website.utils.scrub_page_name(page))
+
+	return page_list
+
+def prepare_args(page_name):
+	if page_name == 'index':
+		page_name = get_home_page()
+
+	if page_name in get_predefined_pages():
+		args = {
+			'template': 'pages/%s.html' % page_name,
+			'name': page_name,
+		}
+	else:
+		args = get_doc_fields(page_name)
+	
+	args.update(get_outer_env())
+	
+	return args
+	
+def get_home_page():
+	import webnotes
+	doc_name = webnotes.conn.get_value('Website Settings', None, 'home_page')
+	if doc_name:
+		page_name = webnotes.conn.get_value('Web Page', doc_name, 'page_name')
+	else:
+		page_name = 'login'
+
+	return page_name
+
+def get_doc_fields(page_name):
+	import webnotes
+	doc_type, doc_name = webnotes.conn.get_value('Web Cache', page_name, ['doc_type', 'doc_name'])
+	
+	import webnotes.model.code
+	obj = webnotes.model.code.get_obj(doc_type, doc_name)
+	
+	if hasattr(obj, 'prepare_template_args'):
+		obj.prepare_template_args()
+		
+	args = obj.doc.fields
+	args['template'] = template_map[doc_type]
+	
+	return args
+
+def get_outer_env():
+	"""
+		env dict for outer template
+	"""
+	import webnotes
+	return {
+		'top_bar_items': webnotes.conn.sql("""\
+			select * from `tabTop Bar Item`
+			where parent='Website Settings' and parentfield='top_bar_items'
+			order by idx asc""", as_dict=1),
+	
+		'footer_items': webnotes.conn.sql("""\
+			select * from `tabTop Bar Item`
+			where parent='Website Settings' and parentfield='footer_items'
+			order by idx asc""", as_dict=1),
+			
+		'brand': webnotes.conn.get_value('Website Settings', None, 'brand_html') or 'ERPNext',
+		'copyright': webnotes.conn.get_value('Website Settings', None, 'copyright'),
+		'favicon': webnotes.conn.get_value('Website Settings', None, 'favicon')
+	}
+
+def build_html(args):
+	"""
+		build html using jinja2 templates
+	"""
+	import os
+	import conf
+	templates_path = os.path.join(conf.modules_path, 'website', 'templates')
+	
+	from jinja2 import Environment, FileSystemLoader
+	jenv = Environment(loader = FileSystemLoader(templates_path))
+	html = jenv.get_template(args['template']).render(args)
+	return html
+
+# cache management
+def search_cache(page_name):
+	if not page_name: return ()
+	import webnotes
+	return webnotes.conn.sql("""\
+		select html, doc_type, doc_name
+		from `tabWeb Cache`
+		where name = %s""", page_name)
+
+def create_cache(page_name, doc_type=None, doc_name=None):
+	# check if a record already exists
+	result = search_cache(page_name)
+	if result: return
+	
+	# create a Web Cache record
+	import webnotes.model.doc
+	d = webnotes.model.doc.Document('Web Cache')
+	d.name = page_name
+	d.doc_type = doc_type
+	d.doc_name = doc_name
+	d.html = None
+	d.save()
+
+def clear_cache(page_name, doc_type=None, doc_name=None):
+	"""
+		* if no page name, clear whole cache
+		* if page_name, doc_type and doc_name match, clear cache's copy
+		* else, raise exception that such a page already exists
+	"""
+	import webnotes
+
+	if not page_name:
+		webnotes.conn.sql("""update `tabWeb Cache` set html = ''""")
+		return
+	
+	result = search_cache(page_name)
+
+	if not doc_type or (result and result[0][1] == doc_type and result[0][2] == doc_name):
+		webnotes.conn.set_value('Web Cache', page_name, 'html', '')
+	else:
+		webnotes.msgprint("""Page with name "%s" already exists as a %s.
+			Please save it with another name.""" % (page_name, result[0][1]),
+			raise_exception=1)
+
+def delete_cache(page_name):
+	"""
+		delete entry of page_name from Web Cache
+		used when:
+			* web page is deleted
+			* blog is un-published
+	"""
+	import webnotes
+	webnotes.conn.sql("""delete from `tabWeb Cache` where name=%s""", page_name)
+
+def refresh_cache(build=None):
+	"""delete and re-create web cache entries"""
+	import webnotes
+	
+	# webnotes.conn.sql("delete from `tabWeb Cache`")
+	
+	clear_cache(None)
+	
+	query_map = {
+		'Web Page': """select page_name, name from `tabWeb Page` where docstatus=0""",
+		'Blog': """\
+			select page_name, name from `tabBlog`
+			where docstatus = 0 and ifnull(published, 0) = 1""",
+		'Item': """\
+			select page_name, name from `tabItem`
+			where docstatus = 0 and ifnull(show_in_website, 0) = 1""",
+	}
+
+	for dt in query_map:
+		if build and dt in build: 
+			for result in webnotes.conn.sql(query_map[dt], as_dict=1):
+				create_cache(result['page_name'], dt, result['name'])
+				load_into_cache(result['page_name'])
+			
+	for page_name in get_predefined_pages():
+		create_cache(page_name, None, None)
+		if build: load_into_cache(page_name)
\ No newline at end of file
diff --git a/erpnext/website/web_page.py b/erpnext/website/web_page.py
new file mode 100644
index 0000000..1058d7f
--- /dev/null
+++ b/erpnext/website/web_page.py
@@ -0,0 +1,81 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import webnotes
+import website.utils
+import website.web_cache
+
+class Page(object):
+	def __init__(self, doctype):
+		self.doctype = doctype
+		
+	def autoname(self):
+		"""name from title"""
+		self.doc.name = website.utils.page_name(self.doc.title)
+		
+	def validate(self):
+		if self.doc.name:
+			self.old_page_name = webnotes.conn.get_value(self.doctype, self.doc.name, 'page_name')
+
+	def on_update(self):
+		# page name updates with the title
+		self.update_page_name()
+		
+		self.clear_web_cache()
+
+		self.doc.save()
+		
+	def on_trash(self):
+		"""delete Web Cache entry"""
+		self.delete_web_cache(self.doc.page_name)
+	
+	def update_page_name(self):
+		"""set page_name and check if it is unique"""
+		self.doc.page_name = website.utils.page_name(self.doc.title)
+		
+		res = webnotes.conn.sql("""\
+			select count(*) from `tab%s`
+			where page_name=%s and name!=%s""" % (self.doctype, '%s', '%s'),
+			(self.doc.page_name, self.doc.name))
+		if res and res[0][0] > 0:
+			webnotes.msgprint("""A %s with the same title already exists.
+				Please change the title of %s and save again."""
+				% (self.doctype, self.doc.name), raise_exception=1)
+
+	def clear_web_cache(self):
+		"""
+			if web cache entry doesn't exist, it creates one
+			if duplicate entry exists for another doctype, it raises exception
+		"""
+		# delete web cache entry of old name
+		if hasattr(self, 'old_page_name') and self.old_page_name and \
+				self.old_page_name != self.doc.page_name:
+			self.delete_web_cache(self.old_page_name)
+		
+		website.web_cache.create_cache(self.doc.page_name, self.doc.doctype, self.doc.name)
+		website.web_cache.clear_cache(self.doc.page_name, self.doc.doctype, self.doc.name)
+		
+	def delete_web_cache(self, page_name):
+		"""delete entry of page name from Web Cache"""
+		website.web_cache.delete_cache(page_name)
+
+	def markdown_to_html(self, fields_list):
+		"""convert fields from markdown to html"""
+		import markdown2
+		for f in fields_list:
+			field_name = "%s_html" % f
+			self.doc.fields[field_name] = markdown2.markdown(self.doc.fields.get(f) or '', \
+				extras=["wiki-tables"])
\ No newline at end of file
diff --git a/install_erpnext.py b/install_erpnext.py
index c1bb2da..75a44ae 100644
--- a/install_erpnext.py
+++ b/install_erpnext.py
@@ -48,7 +48,7 @@
 # setup lib -- framework repo with read only access
 # change this if you have your own fork
 if not os.path.exists(os.path.join(erpnext_path, 'lib')):
-	os.system('git clone git://github.com/webnotes/wnframework.git lib')
+	os.system('git clone https://github.com/webnotes/wnframework.git lib')
 
 # setup symlinks in public
 if not os.path.exists(os.path.join(erpnext_path, 'public', 'js', 'lib')):
@@ -101,12 +101,7 @@
 
 # apply patches
 os.chdir(erpnext_path)
-os.system("lib/wnf.py -l")
-
-# force sync all
-os.system("lib/wnf.py --sync_all -f")
-
-os.system("lib/wnf.py --cms")
+os.system("lib/wnf.py --update origin master")
 
 # set filemode false
 os.system("git config core.filemode false")
@@ -114,11 +109,56 @@
 os.system("git config core.filemode false")
 
 steps_remaining = """
+Notes:
+------
+
+sample apache conf file
+#-----------------------------------------------------------
+SetEnv PYTHON_EGG_CACHE /var/www
+
+# you can change 99 to any other port
+
+Listen 99
+NameVirtualHost *:99
+<VirtualHost *:99>
+	ServerName localhost
+	DocumentRoot {path to erpnext's folder}/public
+    AddHandler cgi-script .cgi .xml .py
+
+	<Directory {path to erpnext's folder}/public/>
+		# directory specific options
+		Options -Indexes +FollowSymLinks +ExecCGI
+		
+		# directory's index file
+		DirectoryIndex web.py
+
+		# rewrite rule
+		RewriteEngine on
+		
+		# condition 1:
+		# ignore login-page.html, app.html, blank.html, unsupported.html
+		RewriteCond %{REQUEST_URI} ^((?!app\.html|blank\.html|unsupported\.html).)*$
+		
+		# condition 2: if there are no slashes
+		# and file is .html or does not containt a .
+		RewriteCond %{REQUEST_URI} ^(?!.+/)((.+\.html)|([^.]+))$
+
+		# rewrite if both of the above conditions are true
+		RewriteRule ^(.+)$ web.py?page=$1 [NC,L]
+		
+		AllowOverride all
+		Order Allow,Deny
+		Allow from all
+	</Directory>
+</VirtualHost>
+#-----------------------------------------------------------
+
 To Do:
 
 * Configure apache/http conf file to point to public folder
 * chown recursively all files in your folder to apache user
 * login using: user="Administrator" and password="admin"
+
 """
 
 print steps_remaining
diff --git a/public/js/all-app.js b/public/js/all-app.js
index d0e4771..976edb4 100644
--- a/public/js/all-app.js
+++ b/public/js/all-app.js
@@ -252,8 +252,7 @@
 wn.route=function(){if(wn.re_route[window.location.hash]){var re_route_val=wn.get_route_str(wn.re_route[window.location.hash]);var cur_route_val=wn.get_route_str(wn._cur_route);if(decodeURIComponent(re_route_val)===decodeURIComponent(cur_route_val)){window.history.back();return;}else{window.location.hash=wn.re_route[window.location.hash];}}
 wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');}
 wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;case"Report2":wn.views.reportview2.show();break;default:wn.views.pageview.show(route[0]);}}
-wn.get_route=function(route){if(!wn.boot){return[window.page_name];}
-return $.map(wn.get_route_str(route).split('/'),function(r){return decodeURIComponent(r);});}
+wn.get_route=function(route){return $.map(wn.get_route_str(route).split('/'),function(r){return decodeURIComponent(r);});}
 wn.get_route_str=function(route){if(!route)
 route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return route;}
 wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;wn.app.set_favicon();}
@@ -310,13 +309,13 @@
 if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_new_doc:function(new_doctype){new_doc(new_doctype);},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
 this.onrun=a0;if(a0&&a0.callback)
 this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
-this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
-args.simple_query=this.query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}}
+this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){var query=this.get_query?this.get_query():this.query;query=this.add_limits(query);var args={query_max:this.query_max,as_dict:1}
+args.simple_query=query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}}
 if(this.args)
 $.extend(args,this.args)
 if(this.get_args){$.extend(args,this.get_args(opts));}
 return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);this.update_paging(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}}
-if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}},update_paging:function(values){if(values.length>=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return $('<div class="list-row">').appendTo(this.$w.find('.result-list')).get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});
+if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}},update_paging:function(values){if(values.length>=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return $('<div class="list-row">').appendTo(this.$w.find('.result-list')).get(0);},refresh:function(){this.run();},add_limits:function(query){query+=' LIMIT '+this.start+','+(this.page_length+1);return query}});
 /*
  *	lib/js/wn/ui/filters.js
  */
@@ -390,7 +389,7 @@
 /*
  *	lib/js/wn/request.js
  */
-wn.provide('wn.request');wn.request.url='index.cgi';wn.request.prepare=function(opts){if(opts.btn)$(opts.btn).set_working();if(opts.show_spinner)set_loading();if(opts.freeze)freeze();if(!opts.args.cmd){console.log(opts)
+wn.provide('wn.request');wn.request.url='server.py';wn.request.prepare=function(opts){if(opts.btn)$(opts.btn).set_working();if(opts.show_spinner)set_loading();if(opts.freeze)freeze();if(!opts.args.cmd){console.log(opts)
 throw"Incomplete Request";}}
 wn.request.cleanup=function(opts,r){if(opts.btn)$(opts.btn).done_working();if(opts.show_spinner)hide_loading();if(opts.freeze)unfreeze();if(wn.boot&&wn.boot.sid&&wn.get_cookie('sid')!=wn.boot.sid){if(!wn.app.logged_out){msgprint('Session Expired. Logging you out');wn.app.logout();}
 return;}
@@ -997,7 +996,7 @@
   </div>',args));this.setup_stat_item_click($item);return $item;},reload_stats:function(){this.$page.find('.layout-side-section .stat-wrapper').remove();this.init_stats();},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}}
 this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];this.show_hide_check_column();},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#222'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});}
 if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;}
-if(typeof opts.content=='function'){opts.content(parent,data);}
+if(typeof opts.content=='function'){opts.content(parent,data,me);}
 else if(opts.content=='name'){$(parent).append(repl('<a href="#!Form/%(doctype)s/%(name)s">%(name)s</a>',data));}
 else if(opts.content=='avatar'){$(parent).append(repl('<span class="avatar-small"><img src="%(avatar)s" \
     title="%(fullname)s"/></span>',data));}
@@ -1006,12 +1005,7 @@
     title="%(docstatus_title)s"></i></span>',data));}
 else if(opts.content=='tags'){this.add_user_tags(parent,data);}
 else if(opts.content=='modified'){$(parent).append(data.when);}
-else if(opts.type=='bar-graph'){args={percent:data[opts.content],fully_delivered:(data[opts.content]>99?'bar-complete':''),label:opts.label}
-$(parent).append(repl('<span class="bar-outer" style="width: 30px; float: right" \
-    title="%(percent)s% %(label)s">\
-    <span class="bar-inner %(fully_delivered)s" \
-     style="width: %(percent)s%;"></span>\
-   </span>',args));}
+else if(opts.type=='bar-graph'){this.render_bar_graph(parent,data,opts.content,opts.label);}
 else if(opts.type=='link'&&opts.doctype){$(parent).append(repl('<a href="#!Form/'+opts.doctype+'/'
 +data[opts.content]+'">'+data[opts.content]+'</a>',data));}
 else if(opts.template){$(parent).append(repl(opts.template,data));}
@@ -1020,7 +1014,12 @@
 if(diff==1){data.when='Yesterday'}
 if(diff==2){data.when='2 days ago'}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){if($(parent).html().length>0){$(parent).append('<br />');}
 $.each(data._user_tags.split(','),function(i,t){if(t){$('<span class="label label-info" style="cursor: pointer; line-height: 200%">'
-+strip(t)+'</span>').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}},show_hide_check_column:function(){if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}}});wn.provide('wn.views.RecordListView');wn.views.RecordListView=wn.views.DocListView.extend({init:function(doctype,wrapper,ListView){this.doctype=doctype;this.wrapper=wrapper;this.listview=new ListView(this);this.listview.parent=this;this.setup();},setup:function(){var me=this;me.page_length=10;$(me.wrapper).empty();me.init_list();},get_args:function(){var args=this._super();$.each((this.default_filters||[]),function(i,f){args.filters.push(f);});args.docstatus=args.docstatus.concat((this.default_docstatus||[]));return args;},});
++strip(t)+'</span>').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}},show_hide_check_column:function(){if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}},render_bar_graph:function(parent,data,field,label){var args={percent:data[field],fully_delivered:(data[field]>99?'bar-complete':''),label:label}
+$(parent).append(repl('<span class="bar-outer" style="width: 30px; float: right" \
+   title="%(percent)s% %(label)s">\
+   <span class="bar-inner %(fully_delivered)s" \
+    style="width: %(percent)s%;"></span>\
+  </span>',args));},render_icon:function(parent,icon_class,label){var icon_html="<i class='%(icon_class)s' title='%(label)s'></i>";$(parent).append(repl(icon_html,{icon_class:icon_class,label:label}));}});wn.provide('wn.views.RecordListView');wn.views.RecordListView=wn.views.DocListView.extend({init:function(doctype,wrapper,ListView){this.doctype=doctype;this.wrapper=wrapper;this.listview=new ListView(this);this.listview.parent=this;this.setup();},setup:function(){var me=this;me.page_length=10;$(me.wrapper).empty();me.init_list();},get_args:function(){var args=this._super();$.each((this.default_filters||[]),function(i,f){args.filters.push(f);});args.docstatus=args.docstatus.concat((this.default_docstatus||[]));return args;},});
 /*
  *	lib/js/wn/views/formview.js
  */
@@ -1749,7 +1748,7 @@
 var sec;for(var i=0;i<fl.length;i++){var f=fl[i];if(f.fieldtype=='Section Break'&&fl[i+1]&&fl[i+1].fieldtype=='Section Break')
 continue;var fn=f.fieldname?f.fieldname:f.label;var fld=make_field(f,this.doctype,this.layout.cur_cell,this);this.fields[this.fields.length]=fld;this.fields_dict[fn]=fld;if(sec&&['Section Break','Column Break'].indexOf(f.fieldtype)==-1){fld.parent_section=sec;sec.fields.push(fld);}
 if(f.fieldtype=='Section Break'){sec=fld;this.sections.push(fld);}
-if((f.fieldtype=='Section Break')&&(fl[i+1])&&(fl[i+1].fieldtype!='Column Break')){var c=this.layout.addcell();$y(c.wrapper,{padding:'8px'});}}}
+if((f.fieldtype=='Section Break')&&(fl[i+1])&&(fl[i+1].fieldtype!='Column Break')&&!f.hidden){var c=this.layout.addcell();$y(c.wrapper,{padding:'8px'});}}}
 _f.Frm.prototype.add_custom_button=function(label,fn,icon){this.frm_head.appframe.add_button(label,fn,icon);}
 _f.Frm.prototype.clear_custom_buttons=function(){this.frm_head.refresh_toolbar()}
 _f.Frm.prototype.add_fetch=function(link_field,src_field,tar_field){if(!this.fetch_dict[link_field]){this.fetch_dict[link_field]={'columns':[],'fields':[]}}
@@ -1857,13 +1856,14 @@
  *	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.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)
+_f.ColumnBreak.prototype.make_body=function(){if((!this.perm[this.df.permlevel])||(!this.perm[this.df.permlevel][READ])||this.df.hidden){return;}
+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.refresh=function(layout){if(!this.cell)return;if(this.set_hidden!=this.df.hidden){if(this.df.hidden)
 this.cell.hide();else
-this.cell.show();this.set_hidden=hidden;}}
+this.cell.show();this.set_hidden=this.df.hidden;}}
 _f.SectionBreak=function(){this.fields=[];this.set_input=function(){};this.make_row=function(){this.row=this.df.label?this.frm.layout.addrow():this.frm.layout.addsubrow();}}
-_f.SectionBreak.prototype.make_body=function(){var me=this;this.make_row();if(this.df.label){if(!this.df.description)
+_f.SectionBreak.prototype.make_body=function(){var me=this;if((!this.perm[this.df.permlevel])||(!this.perm[this.df.permlevel][READ])||this.df.hidden){return;}
+this.make_row();if(this.df.label){if(!this.df.description)
 this.df.description='';$(this.row.main_head).html(repl('<div class="form-section-head">\
     <h3 class="head">%(label)s</h3>\
     <div class="help small" \
@@ -1879,8 +1879,7 @@
 if(f.df.reqd&&!v){return true;}
 if(f.df.fieldtype=='Table'){if(f.grid.get_children().length||f.df.reqd){return true;}}}
 return false;}
-_f.SectionBreak.prototype.refresh=function(from_form){var hidden=0;if((!this.perm[this.df.permlevel])||(!this.perm[this.df.permlevel][READ])||this.df.hidden){hidden=1;}
-if(hidden){if(this.row)this.row.hide();}else{if(this.collapsible){}}}
+_f.SectionBreak.prototype.refresh=function(from_form){if(this.df.hidden){if(this.row)this.row.hide();}else{if(this.collapsible){}}}
 _f.ImageField=function(){this.images={};}
 _f.ImageField.prototype=new Field();_f.ImageField.prototype.onmake=function(){this.no_img=$a(this.wrapper,'div','no_img');this.no_img.innerHTML="No Image";$dh(this.no_img);}
 _f.ImageField.prototype.get_image_src=function(doc){if(doc.file_list){file=doc.file_list.split(',');extn=file[0].split('.');extn=extn[extn.length-1].toLowerCase();var img_extn_list=['gif','jpg','bmp','jpeg','jp2','cgm','ief','jpm','jpx','png','tiff','jpe','tif'];if(in_list(img_extn_list,extn)){var src=wn.request.url+"?cmd=downloadfile&file_id="+file[1];}}else{var src="";}
diff --git a/public/js/all-web.js b/public/js/all-web.js
index 76c4112..1f2396e 100644
--- a/public/js/all-web.js
+++ b/public/js/all-web.js
@@ -139,8 +139,7 @@
 wn.route=function(){if(wn.re_route[window.location.hash]){var re_route_val=wn.get_route_str(wn.re_route[window.location.hash]);var cur_route_val=wn.get_route_str(wn._cur_route);if(decodeURIComponent(re_route_val)===decodeURIComponent(cur_route_val)){window.history.back();return;}else{window.location.hash=wn.re_route[window.location.hash];}}
 wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');}
 wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;case"Report2":wn.views.reportview2.show();break;default:wn.views.pageview.show(route[0]);}}
-wn.get_route=function(route){if(!wn.boot){return[window.page_name];}
-return $.map(wn.get_route_str(route).split('/'),function(r){return decodeURIComponent(r);});}
+wn.get_route=function(route){return $.map(wn.get_route_str(route).split('/'),function(r){return decodeURIComponent(r);});}
 wn.get_route_str=function(route){if(!route)
 route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return route;}
 wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;wn.app.set_favicon();}
@@ -197,13 +196,13 @@
 if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_new_doc:function(new_doctype){new_doc(new_doctype);},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
 this.onrun=a0;if(a0&&a0.callback)
 this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
-this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
-args.simple_query=this.query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}}
+this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){var query=this.get_query?this.get_query():this.query;query=this.add_limits(query);var args={query_max:this.query_max,as_dict:1}
+args.simple_query=query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}}
 if(this.args)
 $.extend(args,this.args)
 if(this.get_args){$.extend(args,this.get_args(opts));}
 return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);this.update_paging(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}}
-if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}},update_paging:function(values){if(values.length>=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return $('<div class="list-row">').appendTo(this.$w.find('.result-list')).get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});
+if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}},update_paging:function(values){if(values.length>=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return $('<div class="list-row">').appendTo(this.$w.find('.result-list')).get(0);},refresh:function(){this.run();},add_limits:function(query){query+=' LIMIT '+this.start+','+(this.page_length+1);return query}});
 /*
  *	lib/js/wn/ui/filters.js
  */
@@ -277,7 +276,7 @@
 /*
  *	lib/js/wn/request.js
  */
-wn.provide('wn.request');wn.request.url='index.cgi';wn.request.prepare=function(opts){if(opts.btn)$(opts.btn).set_working();if(opts.show_spinner)set_loading();if(opts.freeze)freeze();if(!opts.args.cmd){console.log(opts)
+wn.provide('wn.request');wn.request.url='server.py';wn.request.prepare=function(opts){if(opts.btn)$(opts.btn).set_working();if(opts.show_spinner)set_loading();if(opts.freeze)freeze();if(!opts.args.cmd){console.log(opts)
 throw"Incomplete Request";}}
 wn.request.cleanup=function(opts,r){if(opts.btn)$(opts.btn).done_working();if(opts.show_spinner)hide_loading();if(opts.freeze)unfreeze();if(wn.boot&&wn.boot.sid&&wn.get_cookie('sid')!=wn.boot.sid){if(!wn.app.logged_out){msgprint('Session Expired. Logging you out');wn.app.logout();}
 return;}
diff --git a/public/js/complete_setup.js b/public/js/complete_setup.js
index 5947343..ad0f37f 100644
--- a/public/js/complete_setup.js
+++ b/public/js/complete_setup.js
@@ -7,4 +7,4 @@
 $timezone.add_options(timezone_list);}};if(wn.control_panel.company_name){var inp=d.fields_dict.company_name.input;inp.value=wn.control_panel.company_name;inp.disabled=true;}
 if(user_fullname){u=user_fullname.split(' ');if(u[0]){d.fields_dict.first_name.input.value=u[0];}
 if(u[1]){d.fields_dict.last_name.input.value=u[1];}}
-return d;},fy_start_list:['','1st Jan','1st Apr','1st Jul','1st Oct'],currency_list:['','AED','AFN','ALL','AMD','ANG','AOA','ARS','AUD','AZN','BAM','BBD','BDT','BGN','BHD','BIF','BMD','BND','BOB','BRL','BSD','BTN','BYR','BZD','CAD','CDF','CFA','CFP','CHF','CLP','CNY','COP','CRC','CUC','CZK','DJF','DKK','DOP','DZD','EEK','EGP','ERN','ETB','EUR','EURO','FJD','FKP','FMG','GBP','GEL','GHS','GIP','GMD','GNF','GQE','GTQ','GYD','HKD','HNL','HRK','HTG','HUF','IDR','ILS','INR','IQD','IRR','ISK','JMD','JOD','JPY','KES','KGS','KHR','KMF','KPW','KRW','KWD','KYD','KZT','LAK','LBP','LKR','LRD','LSL','LTL','LVL','LYD','MAD','MDL','MGA','MKD','MMK','MNT','MOP','MRO','MUR','MVR','MWK','MXN','MYR','MZM','NAD','NGN','NIO','NOK','NPR','NRs','NZD','OMR','PAB','PEN','PGK','PHP','PKR','PLN','PYG','QAR','RMB','RON','RSD','RUB','RWF','SAR','SCR','SDG','SDR','SEK','SGD','SHP','SOS','SRD','STD','SYP','SZL','THB','TJS','TMT','TND','TRY','TTD','TWD','TZS','UAE','UAH','UGX','USD','USh','UYU','UZS','VEB','VND','VUV','WST','XAF','XCD','XDR','XOF','XPF','YEN','YER','YTL','ZAR','ZMK','ZWR'],industry_list:['','Aerospace and Defence','Agriculture','Apparel','Automobile','Banking','Biotechnology','Chemical','Communications','Consulting','Customer Service','Education','Electronics','Energy','Engineering','Entertainment','Environmental','Finance','Food and Beverage','Government','Healthcare','Hospitality','Information Technology','Insurance','Machinery','Manufacturing','Media','Not For Profit','Recreation','Retail','Shipping','Technology','Telecommunications','Transportation','Trading','Utilities','Other'],country_list:["",'Afghanistan','Albania','Algeria','Andorra','Angola','Antigua and Barbuda','Argentina','Armenia','Australia','Austria','Azerbaijan','Bahamas','Bahrain','Bangladesh','Barbados','Belarus','Belgium','Belize','Benin','Bhutan','Bolivia','Bosnia and Herzegovina','Botswana','Brazil','Brunei Darussalam','Bulgaria','Burkina Faso','Burundi','Cambodia','Cameroon','Canada','Cape Verde','Central African Republic','Chad','Chile','Colombia','Comoros','Costa Rica','Croatia','Cuba','Cyprus','Czech Republic',"C\xc3\xb4te d'Ivoire",'Democratic Republic of the Congo','Denmark','Djibouti','Dominica','Dominican Republic','East Timor','Ecuador','Egypt','El Salvador','Equatorial Guinea','Eritrea','Estonia','Ethiopia','Federated States of Micronesia','Fiji','Finland','France','Gabon','Georgia','Germany','Ghana','Greece','Grenada','Guatemala','Guinea','Guinea-Bissau','Guyana','Haiti','Honduras','Hungary','Iceland','India','Indonesia','Iran','Iraq','Israel','Italy','Jamaica','Japan','Jordan','Kazakhstan','Kenya','Kingdom of the Netherlands','Kiribati','Kuwait','Kyrgyzstan','Laos','Latvia','Lebanon','Lesotho','Liberia','Libya','Liechtenstein','Lithuania','Luxembourg','Macedonia','Madagascar','Malawi','Malaysia','Maldives','Mali','Malta','Marshall Islands','Mauritania','Mauritius','Mexico','Moldova','Monaco','Mongolia','Montenegro','Morocco','Mozambique','Myanmar','Namibia','Nauru','Nepal','New Zealand','Nicaragua','Niger','Nigeria','North Korea','Norway','Oman','Pakistan','Palau','Panama','Papua New Guinea','Paraguay',"People's Republic of China",'Peru','Philippines','Poland','Portugal','Qatar','Republic of Ireland','Republic of the Congo','Romania','Russia','Rwanda','Saint Kitts and Nevis','Saint Lucia','Saint Vincent and the Grenadines','Samoa','San Marino','Saudi Arabia','Senegal','Serbia','Seychelles','Sierra Leone','Singapore','Slovakia','Slovenia','Solomon Islands','Somalia','South Africa','South Korea','Spain','Sri Lanka','Sudan','Suriname','Swaziland','Sweden','Switzerland','Syria','S\xc3\xa3o Tom\xc3\xa9 and Pr\xc3\xadncipe','Tajikistan','Tanzania','Thailand','The Gambia','Togo','Tonga','Trinidad and Tobago','Tunisia','Turkey','Turkmenistan','Tuvalu','Uganda','Ukraine','United Arab Emirates','United Kingdom','United States','Uruguay','Uzbekistan','Vanuatu','Vatican City','Venezuela','Vietnam','Yemen','Zambia','Zimbabwe'],timezone_dict:{'Afghanistan':['Asia/Kabul'],'Albania':['Europe/Tirane'],'Algeria':['Africa/Algiers'],'Andorra':['Europe/Andorra'],'Angola':['Africa/Luanda'],'Antigua and Barbuda':['America/Antigua'],'Argentina':['America/Argentina/Buenos_Aires','America/Argentina/Cordoba','America/Argentina/Jujuy','America/Argentina/Tucuman','America/Argentina/Catamarca','America/Argentina/La_Rioja','America/Argentina/San_Juan','America/Argentina/Mendoza','America/Argentina/Rio_Gallegos','America/Argentina/Ushuaia'],'Armenia':['Asia/Yerevan'],'Australia':['Australia/Lord_Howe','Australia/Hobart','Australia/Currie','Australia/Melbourne','Australia/Sydney','Australia/Broken_Hill','Australia/Brisbane','Australia/Lindeman','Australia/Adelaide','Australia/Darwin','Australia/Perth'],'Austria':['Europe/Vienna'],'Azerbaijan':['Asia/Baku'],'Bahamas':['America/Nassau'],'Bahrain':['Asia/Bahrain'],'Bangladesh':['Asia/Dhaka'],'Barbados':['America/Barbados'],'Belarus':['Europe/Minsk'],'Belgium':['Europe/Brussels'],'Belize':['America/Belize'],'Benin':['Africa/Porto-Novo'],'Bhutan':['Asia/Thimphu'],'Bolivia':['America/La_Paz'],'Bosnia and Herzegovina':['Europe/Sarajevo'],'Botswana':['Africa/Gaborone'],'Brazil':['America/Noronha','America/Belem','America/Fortaleza','America/Recife','America/Araguaina','America/Maceio','America/Bahia','America/Sao_Paulo','America/Campo_Grande','America/Cuiaba','America/Porto_Velho','America/Boa_Vista','America/Manaus','America/Eirunepe','America/Rio_Branco'],'Brunei Darussalam':['Asia/Brunei'],'Bulgaria':['Europe/Sofia'],'Burkina Faso':['Africa/Ouagadougou'],'Burundi':['Africa/Bujumbura'],'Cambodia':['Asia/Phnom_Penh'],'Cameroon':['Africa/Douala'],'Canada':['America/St_Johns','America/Halifax','America/Glace_Bay','America/Moncton','America/Goose_Bay','America/Blanc-Sablon','America/Montreal','America/Toronto','America/Nipigon','America/Thunder_Bay','America/Pangnirtung','America/Iqaluit','America/Atikokan','America/Rankin_Inlet','America/Winnipeg','America/Rainy_River','America/Cambridge_Bay','America/Regina','America/Swift_Current','America/Edmonton','America/Yellowknife','America/Inuvik','America/Dawson_Creek','America/Vancouver','America/Whitehorse','America/Dawson'],'Cape Verde':['Atlantic/Cape_Verde'],'Central African Republic':['Africa/Bangui'],'Chad':['Africa/Ndjamena'],'Chile':['America/Santiago','Pacific/Easter'],'Colombia':['America/Bogota'],'Comoros':['Indian/Comoro'],'Costa Rica':['America/Costa_Rica'],'Croatia':['Europe/Zagreb'],'Cuba':['America/Havana'],'Cyprus':['Asia/Nicosia'],'Czech Republic':['Europe/Prague'],"C\xc3\xb4te d'Ivoire":['Africa/Abidjan'],'Democratic Republic of the Congo':['Africa/Kinshasa','Africa/Lubumbashi'],'Denmark':['Europe/Copenhagen'],'Djibouti':['Africa/Djibouti'],'Dominica':['America/Dominica'],'Dominican Republic':['America/Santo_Domingo'],'East Timor':['Asia/Dili'],'Ecuador':['America/Guayaquil','Pacific/Galapagos'],'Egypt':['Africa/Cairo'],'El Salvador':['America/El_Salvador'],'Equatorial Guinea':['Africa/Malabo'],'Eritrea':['Africa/Asmera'],'Estonia':['Europe/Tallinn'],'Ethiopia':['Africa/Addis_Ababa'],'Federated States of Micronesia':['Pacific/Truk','Pacific/Ponape','Pacific/Kosrae'],'Fiji':['Pacific/Fiji'],'Finland':['Europe/Helsinki'],'France':['Europe/Paris'],'Gabon':['Africa/Libreville'],'Georgia':['Asia/Tbilisi'],'Germany':['Europe/Berlin'],'Ghana':['Africa/Accra'],'Greece':['Europe/Athens'],'Grenada':['America/Grenada'],'Guatemala':['America/Guatemala'],'Guinea':['Africa/Conakry'],'Guinea-Bissau':['Africa/Bissau'],'Guyana':['America/Guyana'],'Haiti':['America/Guatemala'],'Honduras':['America/Tegucigalpa'],'Hungary':['Europe/Budapest'],'Iceland':['Atlantic/Reykjavik'],'India':['Asia/Calcutta'],'Indonesia':['Asia/Jakarta','Asia/Pontianak','Asia/Makassar','Asia/Jayapura'],'Iran':['Asia/Tehran'],'Iraq':['Asia/Baghdad'],'Israel':['Asia/Jerusalem'],'Italy':['Europe/Rome'],'Jamaica':['America/Jamaica'],'Japan':['Asia/Tokyo'],'Jordan':['Asia/Amman'],'Kazakhstan':['Asia/Almaty','Asia/Qyzylorda','Asia/Aqtobe','Asia/Aqtau','Asia/Oral'],'Kenya':['Africa/Nairobi'],'Kingdom of the Netherlands':['Europe/Amsterdam'],'Kiribati':['Pacific/Tarawa','Pacific/Enderbury','Pacific/Kiritimati'],'Kuwait':['Asia/Kuwait'],'Kyrgyzstan':['Asia/Bishkek'],'Laos':['Asia/Vientiane'],'Latvia':['Europe/Riga'],'Lebanon':['Asia/Beirut'],'Lesotho':['Africa/Maseru'],'Liberia':['Africa/Monrovia'],'Libya':['Africa/Tripoli'],'Liechtenstein':['Europe/Vaduz'],'Lithuania':['Europe/Vilnius'],'Luxembourg':['Europe/Luxembourg'],'Macedonia':['Europe/Skopje'],'Madagascar':['Indian/Antananarivo'],'Malawi':['Africa/Blantyre'],'Malaysia':['Asia/Kuala_Lumpur','Asia/Kuching'],'Maldives':['Indian/Maldives'],'Mali':['Africa/Bamako'],'Malta':['Europe/Malta'],'Marshall Islands':['Pacific/Majuro','Pacific/Kwajalein'],'Mauritania':['Africa/Nouakchott'],'Mauritius':['Indian/Mauritius'],'Mexico':['America/Mexico_City','America/Cancun','America/Merida','America/Monterrey','America/Mazatlan','America/Chihuahua','America/Hermosillo','America/Tijuana'],'Moldova':['Europe/Chisinau'],'Monaco':['Europe/Monaco'],'Mongolia':['Asia/Ulaanbaatar','Asia/Hovd','Asia/Choibalsan'],'Montenegro':['Europe/Podgorica'],'Morocco':['Africa/Casablanca'],'Mozambique':['Africa/Maputo'],'Myanmar':['Asia/Rangoon'],'Namibia':['Africa/Windhoek'],'Nauru':['Pacific/Nauru'],'Nepal':['Asia/Katmandu'],'New Zealand':['Pacific/Auckland','Pacific/Chatham'],'Nicaragua':['America/Managua'],'Niger':['Africa/Niamey'],'Nigeria':['Africa/Lagos'],'North Korea':['Asia/Pyongyang'],'Norway':['Europe/Oslo'],'Oman':['Asia/Muscat'],'Pakistan':['Asia/Karachi'],'Palau':['Pacific/Palau'],'Panama':['America/Panama'],'Papua New Guinea':['Pacific/Port_Moresby'],'Paraguay':['America/Asuncion'],"People's Republic of China":['Asia/Shanghai','Asia/Harbin','Asia/Chongqing','Asia/Urumqi','Asia/Kashgar'],'Peru':['America/Lima'],'Philippines':['Asia/Manila'],'Poland':['Europe/Warsaw'],'Portugal':['Europe/Lisbon','Atlantic/Madeira','Atlantic/Azores'],'Qatar':['Asia/Qatar'],'Republic of Ireland':['Europe/Dublin'],'Republic of the Congo':['Africa/Brazzaville'],'Romania':['Europe/Bucharest'],'Russia':['Europe/Kaliningrad','Europe/Moscow','Europe/Volgograd','Europe/Samara','Asia/Yekaterinburg','Asia/Omsk','Asia/Novosibirsk','Asia/Krasnoyarsk','Asia/Irkutsk','Asia/Yakutsk','Asia/Vladivostok','Asia/Sakhalin','Asia/Magadan','Asia/Kamchatka','Asia/Anadyr'],'Rwanda':['Africa/Kigali'],'Saint Kitts and Nevis':['America/St_Kitts'],'Saint Lucia':['America/St_Lucia'],'Saint Vincent and the Grenadines':['America/St_Vincent'],'Samoa':['Pacific/Apia'],'San Marino':['Europe/San_Marino'],'Saudi Arabia':['Asia/Riyadh'],'Senegal':['Africa/Dakar'],'Serbia':['Europe/Belgrade'],'Seychelles':['Indian/Mahe'],'Sierra Leone':['Africa/Freetown'],'Singapore':['Asia/Singapore'],'Slovakia':['Europe/Bratislava'],'Slovenia':['Europe/Ljubljana'],'Solomon Islands':['Pacific/Guadalcanal'],'Somalia':['Africa/Mogadishu'],'South Africa':['Africa/Johannesburg'],'South Korea':['Asia/Seoul'],'Spain':['Europe/Madrid','Africa/Ceuta','Atlantic/Canary'],'Sri Lanka':['Asia/Colombo'],'Sudan':['Africa/Khartoum'],'Suriname':['America/Paramaribo'],'Swaziland':['Africa/Mbabane'],'Sweden':['Europe/Stockholm'],'Switzerland':['Europe/Zurich'],'Syria':['Asia/Damascus'],'S\xc3\xa3o Tom\xc3\xa9 and Pr\xc3\xadncipe':['Africa/Sao_Tome'],'Tajikistan':['Asia/Dushanbe'],'Tanzania':['Africa/Dar_es_Salaam'],'Thailand':['Asia/Bangkok'],'The Gambia':['Africa/Banjul'],'Togo':['Africa/Lome'],'Tonga':['Pacific/Tongatapu'],'Trinidad and Tobago':['America/Port_of_Spain'],'Tunisia':['Africa/Tunis'],'Turkey':['Europe/Istanbul'],'Turkmenistan':['Asia/Ashgabat'],'Tuvalu':['Pacific/Funafuti'],'Uganda':['Africa/Kampala'],'Ukraine':['Europe/Kiev','Europe/Uzhgorod','Europe/Zaporozhye','Europe/Simferopol'],'United Arab Emirates':['Asia/Dubai'],'United Kingdom':['Europe/London'],'United States':['America/New_York','America/Detroit','America/Kentucky/Louisville','America/Kentucky/Monticello','America/Indiana/Indianapolis','America/Indiana/Marengo','America/Indiana/Knox','America/Indiana/Vevay','America/Chicago','America/Indiana/Vincennes','America/Indiana/Petersburg','America/Menominee','America/North_Dakota/Center','America/North_Dakota/New_Salem','America/Denver','America/Boise','America/Shiprock','America/Phoenix','America/Los_Angeles','America/Anchorage','America/Juneau','America/Yakutat','America/Nome','America/Adak','Pacific/Honolulu'],'Uruguay':['America/Montevideo'],'Uzbekistan':['Asia/Samarkand','Asia/Tashkent'],'Vanuatu':['Pacific/Efate'],'Vatican City':['Europe/Vatican'],'Venezuela':['America/Caracas'],'Vietnam':['Asia/Saigon'],'Yemen':['Asia/Aden'],'Zambia':['Africa/Lusaka'],'Zimbabwe':['Africa/Harare'],},});
\ No newline at end of file
+return d;},fy_start_list:['','1st Jan','1st Apr','1st Jul','1st Oct'],currency_list:['','AED','AFN','ALL','AMD','ANG','AOA','ARS','AUD','AZN','BAM','BBD','BDT','BGN','BHD','BIF','BMD','BND','BOB','BRL','BSD','BTN','BYR','BZD','CAD','CDF','CFA','CFP','CHF','CLP','CNY','COP','CRC','CUC','CZK','DJF','DKK','DOP','DZD','EEK','EGP','ERN','ETB','EUR','EURO','FJD','FKP','FMG','GBP','GEL','GHS','GIP','GMD','GNF','GQE','GTQ','GYD','HKD','HNL','HRK','HTG','HUF','IDR','ILS','INR','IQD','IRR','ISK','JMD','JOD','JPY','KES','KGS','KHR','KMF','KPW','KRW','KWD','KYD','KZT','LAK','LBP','LKR','LRD','LSL','LTL','LVL','LYD','MAD','MDL','MGA','MKD','MMK','MNT','MOP','MRO','MUR','MVR','MWK','MXN','MYR','MZM','NAD','NGN','NIO','NOK','NPR','NRs','NZD','OMR','PAB','PEN','PGK','PHP','PKR','PLN','PYG','QAR','RMB','RON','RSD','RUB','RWF','SAR','SCR','SDG','SDR','SEK','SGD','SHP','SOS','SRD','STD','SYP','SZL','THB','TJS','TMT','TND','TRY','TTD','TWD','TZS','UAE','UAH','UGX','USD','USh','UYU','UZS','VEB','VND','VUV','WST','XAF','XCD','XDR','XOF','XPF','YEN','YER','YTL','ZAR','ZMK','ZWR'],industry_list:['','Aerospace and Defence','Agriculture','Apparel','Automobile','Banking','Biotechnology','Chemical','Communications','Consulting','Customer Service','Education','Electronics','Energy','Engineering','Entertainment','Environmental','Finance','Food and Beverage','Government','Healthcare','Hospitality','Information Technology','Insurance','Machinery','Manufacturing','Media','Not For Profit','Recreation','Retail','Shipping','Technology','Telecommunications','Transportation','Trading','Utilities','Other'],country_list:["",'Afghanistan','Albania','Algeria','Andorra','Angola','Antigua and Barbuda','Argentina','Armenia','Australia','Austria','Azerbaijan','Bahamas','Bahrain','Bangladesh','Barbados','Belarus','Belgium','Belize','Benin','Bhutan','Bolivia','Bosnia and Herzegovina','Botswana','Brazil','Brunei Darussalam','Bulgaria','Burkina Faso','Burundi','Cambodia','Cameroon','Canada','Cape Verde','Central African Republic','Chad','Chile','Colombia','Comoros','Costa Rica','Croatia','Cuba','Cyprus','Czech Republic',"C\xc3\xb4te d'Ivoire",'Democratic Republic of the Congo','Denmark','Djibouti','Dominica','Dominican Republic','East Timor','Ecuador','Egypt','El Salvador','Equatorial Guinea','Eritrea','Estonia','Ethiopia','Federated States of Micronesia','Fiji','Finland','France','Gabon','Georgia','Germany','Ghana','Greece','Grenada','Guatemala','Guinea','Guinea-Bissau','Guyana','Haiti','Honduras','Hong Kong','Hungary','Iceland','India','Indonesia','Iran','Iraq','Israel','Italy','Jamaica','Japan','Jordan','Kazakhstan','Kenya','Kingdom of the Netherlands','Kiribati','Kuwait','Kyrgyzstan','Laos','Latvia','Lebanon','Lesotho','Liberia','Libya','Liechtenstein','Lithuania','Luxembourg','Macedonia','Madagascar','Malawi','Malaysia','Maldives','Mali','Malta','Marshall Islands','Mauritania','Mauritius','Mexico','Moldova','Monaco','Mongolia','Montenegro','Morocco','Mozambique','Myanmar','Namibia','Nauru','Nepal','New Zealand','Nicaragua','Niger','Nigeria','North Korea','Norway','Oman','Pakistan','Palau','Panama','Papua New Guinea','Paraguay',"China",'Peru','Philippines','Poland','Portugal','Qatar','Republic of Ireland','Republic of the Congo','Romania','Russia','Rwanda','Saint Kitts and Nevis','Saint Lucia','Saint Vincent and the Grenadines','Samoa','San Marino','Saudi Arabia','Senegal','Serbia','Seychelles','Sierra Leone','Singapore','Slovakia','Slovenia','Solomon Islands','Somalia','South Africa','South Korea','Spain','Sri Lanka','Sudan','Suriname','Swaziland','Sweden','Switzerland','Syria','S\xc3\xa3o Tom\xc3\xa9 and Pr\xc3\xadncipe','Tajikistan','Tanzania','Thailand','The Gambia','Togo','Tonga','Trinidad and Tobago','Tunisia','Turkey','Turkmenistan','Tuvalu','Uganda','Ukraine','United Arab Emirates','United Kingdom','United States','Uruguay','Uzbekistan','Vanuatu','Vatican City','Venezuela','Vietnam','Yemen','Zambia','Zimbabwe'],timezone_dict:{'Afghanistan':['Asia/Kabul'],'Albania':['Europe/Tirane'],'Algeria':['Africa/Algiers'],'Andorra':['Europe/Andorra'],'Angola':['Africa/Luanda'],'Antigua and Barbuda':['America/Antigua'],'Argentina':['America/Argentina/Buenos_Aires','America/Argentina/Cordoba','America/Argentina/Jujuy','America/Argentina/Tucuman','America/Argentina/Catamarca','America/Argentina/La_Rioja','America/Argentina/San_Juan','America/Argentina/Mendoza','America/Argentina/Rio_Gallegos','America/Argentina/Ushuaia'],'Armenia':['Asia/Yerevan'],'Australia':['Australia/Lord_Howe','Australia/Hobart','Australia/Currie','Australia/Melbourne','Australia/Sydney','Australia/Broken_Hill','Australia/Brisbane','Australia/Lindeman','Australia/Adelaide','Australia/Darwin','Australia/Perth'],'Austria':['Europe/Vienna'],'Azerbaijan':['Asia/Baku'],'Bahamas':['America/Nassau'],'Bahrain':['Asia/Bahrain'],'Bangladesh':['Asia/Dhaka'],'Barbados':['America/Barbados'],'Belarus':['Europe/Minsk'],'Belgium':['Europe/Brussels'],'Belize':['America/Belize'],'Benin':['Africa/Porto-Novo'],'Bhutan':['Asia/Thimphu'],'Bolivia':['America/La_Paz'],'Bosnia and Herzegovina':['Europe/Sarajevo'],'Botswana':['Africa/Gaborone'],'Brazil':['America/Noronha','America/Belem','America/Fortaleza','America/Recife','America/Araguaina','America/Maceio','America/Bahia','America/Sao_Paulo','America/Campo_Grande','America/Cuiaba','America/Porto_Velho','America/Boa_Vista','America/Manaus','America/Eirunepe','America/Rio_Branco'],'Brunei Darussalam':['Asia/Brunei'],'Bulgaria':['Europe/Sofia'],'Burkina Faso':['Africa/Ouagadougou'],'Burundi':['Africa/Bujumbura'],'Cambodia':['Asia/Phnom_Penh'],'Cameroon':['Africa/Douala'],'Canada':['America/St_Johns','America/Halifax','America/Glace_Bay','America/Moncton','America/Goose_Bay','America/Blanc-Sablon','America/Montreal','America/Toronto','America/Nipigon','America/Thunder_Bay','America/Pangnirtung','America/Iqaluit','America/Atikokan','America/Rankin_Inlet','America/Winnipeg','America/Rainy_River','America/Cambridge_Bay','America/Regina','America/Swift_Current','America/Edmonton','America/Yellowknife','America/Inuvik','America/Dawson_Creek','America/Vancouver','America/Whitehorse','America/Dawson'],'Cape Verde':['Atlantic/Cape_Verde'],'Central African Republic':['Africa/Bangui'],'Chad':['Africa/Ndjamena'],'China':['Asia/Shanghai','Asia/Harbin','Asia/Chongqing','Asia/Urumqi','Asia/Kashgar'],'Chile':['America/Santiago','Pacific/Easter'],'Colombia':['America/Bogota'],'Comoros':['Indian/Comoro'],'Costa Rica':['America/Costa_Rica'],'Croatia':['Europe/Zagreb'],'Cuba':['America/Havana'],'Cyprus':['Asia/Nicosia'],'Czech Republic':['Europe/Prague'],"C\xc3\xb4te d'Ivoire":['Africa/Abidjan'],'Democratic Republic of the Congo':['Africa/Kinshasa','Africa/Lubumbashi'],'Denmark':['Europe/Copenhagen'],'Djibouti':['Africa/Djibouti'],'Dominica':['America/Dominica'],'Dominican Republic':['America/Santo_Domingo'],'East Timor':['Asia/Dili'],'Ecuador':['America/Guayaquil','Pacific/Galapagos'],'Egypt':['Africa/Cairo'],'El Salvador':['America/El_Salvador'],'Equatorial Guinea':['Africa/Malabo'],'Eritrea':['Africa/Asmera'],'Estonia':['Europe/Tallinn'],'Ethiopia':['Africa/Addis_Ababa'],'Federated States of Micronesia':['Pacific/Truk','Pacific/Ponape','Pacific/Kosrae'],'Fiji':['Pacific/Fiji'],'Finland':['Europe/Helsinki'],'France':['Europe/Paris'],'Gabon':['Africa/Libreville'],'Georgia':['Asia/Tbilisi'],'Germany':['Europe/Berlin'],'Ghana':['Africa/Accra'],'Greece':['Europe/Athens'],'Grenada':['America/Grenada'],'Guatemala':['America/Guatemala'],'Guinea':['Africa/Conakry'],'Guinea-Bissau':['Africa/Bissau'],'Guyana':['America/Guyana'],'Haiti':['America/Guatemala'],'Honduras':['America/Tegucigalpa'],'Hong Kong':['Asia/Hong_Kong'],'Hungary':['Europe/Budapest'],'Iceland':['Atlantic/Reykjavik'],'India':['Asia/Calcutta'],'Indonesia':['Asia/Jakarta','Asia/Pontianak','Asia/Makassar','Asia/Jayapura'],'Iran':['Asia/Tehran'],'Iraq':['Asia/Baghdad'],'Israel':['Asia/Jerusalem'],'Italy':['Europe/Rome'],'Jamaica':['America/Jamaica'],'Japan':['Asia/Tokyo'],'Jordan':['Asia/Amman'],'Kazakhstan':['Asia/Almaty','Asia/Qyzylorda','Asia/Aqtobe','Asia/Aqtau','Asia/Oral'],'Kenya':['Africa/Nairobi'],'Kingdom of the Netherlands':['Europe/Amsterdam'],'Kiribati':['Pacific/Tarawa','Pacific/Enderbury','Pacific/Kiritimati'],'Kuwait':['Asia/Kuwait'],'Kyrgyzstan':['Asia/Bishkek'],'Laos':['Asia/Vientiane'],'Latvia':['Europe/Riga'],'Lebanon':['Asia/Beirut'],'Lesotho':['Africa/Maseru'],'Liberia':['Africa/Monrovia'],'Libya':['Africa/Tripoli'],'Liechtenstein':['Europe/Vaduz'],'Lithuania':['Europe/Vilnius'],'Luxembourg':['Europe/Luxembourg'],'Macedonia':['Europe/Skopje'],'Madagascar':['Indian/Antananarivo'],'Malawi':['Africa/Blantyre'],'Malaysia':['Asia/Kuala_Lumpur','Asia/Kuching'],'Maldives':['Indian/Maldives'],'Mali':['Africa/Bamako'],'Malta':['Europe/Malta'],'Marshall Islands':['Pacific/Majuro','Pacific/Kwajalein'],'Mauritania':['Africa/Nouakchott'],'Mauritius':['Indian/Mauritius'],'Mexico':['America/Mexico_City','America/Cancun','America/Merida','America/Monterrey','America/Mazatlan','America/Chihuahua','America/Hermosillo','America/Tijuana'],'Moldova':['Europe/Chisinau'],'Monaco':['Europe/Monaco'],'Mongolia':['Asia/Ulaanbaatar','Asia/Hovd','Asia/Choibalsan'],'Montenegro':['Europe/Podgorica'],'Morocco':['Africa/Casablanca'],'Mozambique':['Africa/Maputo'],'Myanmar':['Asia/Rangoon'],'Namibia':['Africa/Windhoek'],'Nauru':['Pacific/Nauru'],'Nepal':['Asia/Katmandu'],'New Zealand':['Pacific/Auckland','Pacific/Chatham'],'Nicaragua':['America/Managua'],'Niger':['Africa/Niamey'],'Nigeria':['Africa/Lagos'],'North Korea':['Asia/Pyongyang'],'Norway':['Europe/Oslo'],'Oman':['Asia/Muscat'],'Pakistan':['Asia/Karachi'],'Palau':['Pacific/Palau'],'Panama':['America/Panama'],'Papua New Guinea':['Pacific/Port_Moresby'],'Paraguay':['America/Asuncion'],'Peru':['America/Lima'],'Philippines':['Asia/Manila'],'Poland':['Europe/Warsaw'],'Portugal':['Europe/Lisbon','Atlantic/Madeira','Atlantic/Azores'],'Qatar':['Asia/Qatar'],'Republic of Ireland':['Europe/Dublin'],'Republic of the Congo':['Africa/Brazzaville'],'Romania':['Europe/Bucharest'],'Russia':['Europe/Kaliningrad','Europe/Moscow','Europe/Volgograd','Europe/Samara','Asia/Yekaterinburg','Asia/Omsk','Asia/Novosibirsk','Asia/Krasnoyarsk','Asia/Irkutsk','Asia/Yakutsk','Asia/Vladivostok','Asia/Sakhalin','Asia/Magadan','Asia/Kamchatka','Asia/Anadyr'],'Rwanda':['Africa/Kigali'],'Saint Kitts and Nevis':['America/St_Kitts'],'Saint Lucia':['America/St_Lucia'],'Saint Vincent and the Grenadines':['America/St_Vincent'],'Samoa':['Pacific/Apia'],'San Marino':['Europe/San_Marino'],'Saudi Arabia':['Asia/Riyadh'],'Senegal':['Africa/Dakar'],'Serbia':['Europe/Belgrade'],'Seychelles':['Indian/Mahe'],'Sierra Leone':['Africa/Freetown'],'Singapore':['Asia/Singapore'],'Slovakia':['Europe/Bratislava'],'Slovenia':['Europe/Ljubljana'],'Solomon Islands':['Pacific/Guadalcanal'],'Somalia':['Africa/Mogadishu'],'South Africa':['Africa/Johannesburg'],'South Korea':['Asia/Seoul'],'Spain':['Europe/Madrid','Africa/Ceuta','Atlantic/Canary'],'Sri Lanka':['Asia/Colombo'],'Sudan':['Africa/Khartoum'],'Suriname':['America/Paramaribo'],'Swaziland':['Africa/Mbabane'],'Sweden':['Europe/Stockholm'],'Switzerland':['Europe/Zurich'],'Syria':['Asia/Damascus'],'S\xc3\xa3o Tom\xc3\xa9 and Pr\xc3\xadncipe':['Africa/Sao_Tome'],'Tajikistan':['Asia/Dushanbe'],'Tanzania':['Africa/Dar_es_Salaam'],'Thailand':['Asia/Bangkok'],'The Gambia':['Africa/Banjul'],'Togo':['Africa/Lome'],'Tonga':['Pacific/Tongatapu'],'Trinidad and Tobago':['America/Port_of_Spain'],'Tunisia':['Africa/Tunis'],'Turkey':['Europe/Istanbul'],'Turkmenistan':['Asia/Ashgabat'],'Tuvalu':['Pacific/Funafuti'],'Uganda':['Africa/Kampala'],'Ukraine':['Europe/Kiev','Europe/Uzhgorod','Europe/Zaporozhye','Europe/Simferopol'],'United Arab Emirates':['Asia/Dubai'],'United Kingdom':['Europe/London'],'United States':['America/New_York','America/Detroit','America/Kentucky/Louisville','America/Kentucky/Monticello','America/Indiana/Indianapolis','America/Indiana/Marengo','America/Indiana/Knox','America/Indiana/Vevay','America/Chicago','America/Indiana/Vincennes','America/Indiana/Petersburg','America/Menominee','America/North_Dakota/Center','America/North_Dakota/New_Salem','America/Denver','America/Boise','America/Shiprock','America/Phoenix','America/Los_Angeles','America/Anchorage','America/Juneau','America/Yakutat','America/Nome','America/Adak','Pacific/Honolulu'],'Uruguay':['America/Montevideo'],'Uzbekistan':['Asia/Samarkand','Asia/Tashkent'],'Vanuatu':['Pacific/Efate'],'Vatican City':['Europe/Vatican'],'Venezuela':['America/Caracas'],'Vietnam':['Asia/Saigon'],'Yemen':['Asia/Aden'],'Zambia':['Africa/Lusaka'],'Zimbabwe':['Africa/Harare'],},});
\ No newline at end of file
diff --git a/public/js/product_category.js b/public/js/product_category.js
deleted file mode 100644
index aac872f..0000000
--- a/public/js/product_category.js
+++ /dev/null
@@ -1,7 +0,0 @@
-
-/*
- *	erpnext/website/js/product_category.js
- */
-erpnext.make_product_categories=function(wrapper){wrapper.category_list=new wn.ui.Listing({parent:$(wrapper).find('.more-categories').get(0),query:'select count(name) as items, item_group \
-   from tabItem where is_sales_item="Yes" \
-   group by item_group order by items desc',hide_refresh:true,render_row:function(parent,data){parent.innerHTML=repl('<a href="#!products/%(item_group)s">%(item_group)s</a> (%(items)s)',data);}});wrapper.category_list.run();}
\ No newline at end of file
diff --git a/public/rss.xml b/public/rss.xml
index 3045069..efe083e 100755
--- a/public/rss.xml
+++ b/public/rss.xml
@@ -27,8 +27,12 @@
 import webnotes
 import webnotes.auth
 
+import conf
+sys.path.append(conf.modules_path)
+
 if __name__=='__main__':
-	webnotes.http_request = webnotes.auth.HTTPRequest()
+	# webnotes.http_request = webnotes.auth.HTTPRequest()
+	webnotes.connect()
 	from webnotes.cms import feed
 	try:
 		print 'Content-Type: text/xml'
diff --git a/public/index.cgi b/public/server.py
similarity index 100%
rename from public/index.cgi
rename to public/server.py
diff --git a/public/web.py b/public/web.py
new file mode 100755
index 0000000..34d38fe
--- /dev/null
+++ b/public/web.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""
+return a dynamic page from website templates
+
+all html pages except login-page.html get generated here
+"""
+
+import cgi, cgitb, os, sys
+cgitb.enable()
+
+# import libs
+sys.path.append('..')
+import conf
+sys.path.append('../lib/py')
+sys.path.append(conf.modules_path)
+
+def init():
+	import webnotes
+	webnotes.form = cgi.FieldStorage(keep_blank_values=True)
+	for key in webnotes.form.keys():
+		webnotes.form_dict[key] = webnotes.form.getvalue(key)
+	webnotes.connect()
+
+def respond():
+	import webnotes
+	try:
+		if 'page' in webnotes.form_dict:
+			html = get_html(webnotes.form_dict['page'])
+		else:
+			# show home page
+			html = get_html('index')
+	except Exception, e:
+		html = get_html('404')
+
+	print "Content-Type: text/html"
+	print
+	print html.encode('utf-8')
+
+def get_html(page_name):
+	import website.utils
+	page_name = website.utils.scrub_page_name(page_name)
+	
+	comments = get_comments(page_name)
+	
+	import website.web_cache
+	html = website.web_cache.get_html(page_name, comments)
+	
+	return html
+
+def get_comments(page_name):
+	import webnotes
+	
+	if page_name == '404':
+		comments = """error: %s""" % webnotes.getTraceback()
+	else:
+		comments = """page: %s""" % page_name
+		
+	return comments
+
+if __name__=="__main__":
+	init()
+	respond()
\ No newline at end of file