knowledge base cleanup
diff --git a/erpnext/knowledge_base/page/kb_common/kb_common.js b/erpnext/knowledge_base/page/kb_common/kb_common.js
index a734f65..fd570ec 100644
--- a/erpnext/knowledge_base/page/kb_common/kb_common.js
+++ b/erpnext/knowledge_base/page/kb_common/kb_common.js
@@ -116,59 +116,68 @@
 	$.extend(this, args);
 	var me = this;
 	
-	this.wrapper = $a(me.parent, 'div');
-	this.display = $a(me.wrapper, 'div', me.disp_class, '', me.text);
-	this.input = $a(me.wrapper, 'textarea', me.inp_class, {display:'none'});
+	me.$w = $(repl('<div class="ed-text">\
+		<div class="ed-text-display %(disp_class)s"></div>\
+		<a class="ed-text-edit" style="cursor: pointer; float: right;">[edit]</a>\
+		<textarea class="ed-text-input %(inp_class)s hide"></textarea><br>\
+		<div class="help hide">Formatted as <a href="http://en.wikipedia.org/wiki/Markdown#Syntax_examples"\
+		 	target="_blank">markdown</div>\
+		<button class="btn btn-small btn-info hide ed-text-save">Save</button>\
+		<a class="ed-text-cancel hide" style="cursor: pointer;">Cancel</a>\
+	</div>', args)).appendTo(me.parent);
 	
-	var div = $a(me.wrapper, 'div', '', {marginTop:'5px', height:'23px'});
-	
-	// edit text
-	this.edit_btn = $a(div, 'a', '', {cursor:'pointer'}, '[edit]');
-
-	this.edit_btn.onclick = function() {
-		me.input.value = me.display.innerHTML;
-		me.show_as_input();
+	this.set_display = function(txt) {
+		me.$w.find('.ed-text-display').html(wn.markdown(txt));
+		me.text = txt;
 	}
 	
+	this.set_display(me.text);
+	
+	if(me.height) me.$w.find('.ed-text-input').css('height', me.height);
+	
+	// edit
+	me.$w.find('.ed-text-edit').click(function() {
+		me.$w.find('.ed-text-input').val(me.text);
+		me.show_as_input();
+	})
+	
 	// save button - save the new text
-	// check if text is written
-	this.save_btn = $btn(div, 'Save', function() {
-		var v = me.rich_text ? wn.tinymce.get_value(me.input) : me.input.value;
-		if(!v) {
-			msgprint('Please write something!');
-			return;
+	me.$w.find('.ed-text-save').click(
+		function() {
+			var v = me.$w.find('.ed-text-input').val();
+			// check if text is written
+			if(!v) {
+				msgprint('Please write something!');
+				return;
+			}
+			var btn = this;
+			$(btn).set_working();
+			$c_page('knowledge_base', 'question_view', 'update_item', {
+					dt: me.dt, dn: me.dn, fn: me.fieldname, text: v
+				}, 
+				function(r) {
+					$(btn).done_working();
+					if(r.exc) {msgprint(r.exc); return; }
+					me.set_display(v);
+					me.show_as_text();
+				});
 		}
-		me.save_btn.set_working();
-		$c_page('knowledge_base', 'question_view', 'update_item', {
-				dt: me.dt, dn: me.dn, fn: me.fieldname, text: v
-			}, 
-			function(r, rt) {
-				me.save_btn.done_working();
-				if(r.exc) {msgprint(r.exc); return; }
-				me.display.innerHTML = v;
-				me.show_as_text();
-			});
-	}, {display: 'none'});
+	)
+	
 
 	// cancel button
-	this.cancel_btn = $a(div, 'span', 'link_type', {color: '#555', display:'none'}, 'Cancel', {marginLeft:'7px'});
-	this.cancel_btn.onclick = function() {
+	me.$w.find('.ed-text-cancel').click(function() {
 		me.show_as_text();		
-	}
+	})
 
 	this.show_as_text = function() {
-		$ds(me.display); $ds(me.edit_btn);
-		if(me.rich_text)
-			wn.tinymce.remove(me.input);
-		$dh(me.input); $dh(me.save_btn); $dh(me.cancel_btn);
-				
+		me.$w.find('.ed-text-display, .ed-text-edit').toggle(true);
+		me.$w.find('.ed-text-input, .ed-text-save, .ed-text-cancel, .help').toggle(false);
 	}
 
 	this.show_as_input = function() {
-		$ds(me.input); $ds(me.save_btn); $ds(me.cancel_btn); 
-		$dh(me.edit_btn); $dh(me.display);
-		if(me.rich_text)
-			wn.tinymce.add_simple(me.input, '300px');
-	}	
+		me.$w.find('.ed-text-display, .ed-text-edit').toggle(false);
+		me.$w.find('.ed-text-input, .ed-text-save, .ed-text-cancel, .help').toggle(true);
+	}
 
 }
\ No newline at end of file
diff --git a/erpnext/knowledge_base/page/question_view/question_view.html b/erpnext/knowledge_base/page/question_view/question_view.html
index 9939332..5212445 100644
--- a/erpnext/knowledge_base/page/question_view/question_view.html
+++ b/erpnext/knowledge_base/page/question_view/question_view.html
@@ -1,13 +1,12 @@
-<div class="layout-wrapper">
-	<a class="close" onclick="window.history.back();">&times;</a>
-	<h1>Knowledge Base</h1>
-	<hr>
-	<p style="text-align: right"><a href="#!questions">&larr; Back to Questions</a></p>
-	<div class="qv-question-wrapper">
+<div class="layout-wrapper layout-wrapper-appframe">
+	<div class="layout-appframe"></div>
+	<div class="layout-main">
+		<div class="qv-question-wrapper">
+		</div>
+		<hr>
+		<div class="qv-answer-wrapper">
+		</div>
+		<div class="add-answer-link"></div>
+		<div class="add-answer-area"></div>
 	</div>
-	<hr>
-	<div class="qv-answer-wrapper">
-	</div>
-	<div class="add-answer-link"></div>
-	<div class="add-answer-area"></div>
 </div>
\ No newline at end of file
diff --git a/erpnext/knowledge_base/page/question_view/question_view.js b/erpnext/knowledge_base/page/question_view/question_view.js
index 879ee79..e0dd192 100644
--- a/erpnext/knowledge_base/page/question_view/question_view.js
+++ b/erpnext/knowledge_base/page/question_view/question_view.js
@@ -15,6 +15,9 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 pscript['onload_question-view'] = function(wrapper) {
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe'));
+	wrapper.appframe.title('<a href="#questions">Knowledge Base</a>');
+
 	wrapper.add_answer_area = $('.add-answer-area').get(0);
 }
 
@@ -71,12 +74,10 @@
 	
 	// add a link to open add answer
 	this.make_answer_box_link = function() {
-		$('.add-answer-link').html('<button class="btn btn-small">\
-			<i class="icon-plus"></i> Add you answer</button>').find('button').click(
-				function() {
-					$(this).toggle(false);
-					me.make_answer_box();
-				});
+		wn.pages['question-view'].appframe.add_button('Add your answer', function() {
+			$(this).toggle(false);
+			me.make_answer_box();
+		}, 'icon-plus');
 	}
 	
 	// answer box
@@ -130,9 +131,10 @@
 	$.extend(this, args);
 	
 	this.make_list = function() {
-	
+		wn.pages['question-view'].appframe.clear_buttons();
 		this.list = new wn.ui.Listing({
 			parent: me.parent,
+			appframe: wn.pages['question-view'].appframe,
 			as_dict: 1,
 			no_result_message: 'No answers yet, be the first one to answer!',
 			render_row: function(body, data) {
@@ -143,8 +145,7 @@
 					+"t2.last_name, t1.modified from tabAnswer t1, tabProfile t2 "
 					+"where question='%(qid)s' and t1.owner = t2.name "
 					+"order by t1.points desc, t1.modified desc", {qid: me.qid})
-			},
-			title: 'Answers'
+			}
 		});
 		
 		this.list.run();
@@ -169,7 +170,7 @@
 		text: data.answer,
 		inp_class: 'qv-ans-input',
 		disp_class: 'qv-ans-text',
-		rich_text: 1
+		height: '300px'
 	});	
 	
 	$(edtxt.wrapper).addClass('well');
diff --git a/erpnext/knowledge_base/page/questions/questions.html b/erpnext/knowledge_base/page/questions/questions.html
index c76f490..1085b75 100644
--- a/erpnext/knowledge_base/page/questions/questions.html
+++ b/erpnext/knowledge_base/page/questions/questions.html
@@ -1,8 +1,6 @@
 <div class="layout-wrapper layout-wrapper-background">
+	<div class="layout-appframe"></div>
 	<div class="layout-main-section">
-		<a class="close" onclick="window.history.back();">&times;</a>
-		<h1>Knowledge Base</h1>
-		<hr>
 		<div class="well kb-search-wrapper">
 			<textarea></textarea>
 			<div>
diff --git a/erpnext/knowledge_base/page/questions/questions.js b/erpnext/knowledge_base/page/questions/questions.js
index 6b0ca25..c2fe191 100644
--- a/erpnext/knowledge_base/page/questions/questions.js
+++ b/erpnext/knowledge_base/page/questions/questions.js
@@ -17,6 +17,9 @@
 pscript.onload_questions = function(wrapper) {	
 	body = $(wrapper).find('.layout-main-section').get(0);
 	
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe'));
+	wrapper.appframe.title('Knowledge Base');
+	
 	// kb
 	var kb = new KnowledgeBase(body);
 	
@@ -60,7 +63,7 @@
 		if(this.search.value==$(this.search).attr('default_text')) {
 			msgprint('Please enter some text'); return;
 		}
-		this.suggest();
+		this.add_question([]);
 	}
 	
 	// suggest a few users who can answer
diff --git a/erpnext/startup/startup.css b/erpnext/startup/startup.css
index 79ce027..bd21144 100644
--- a/erpnext/startup/startup.css
+++ b/erpnext/startup/startup.css
@@ -1,6 +1,5 @@
 h1, h2, h3, h4, h5 {
 	font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
-	font-weight: normal;
 	margin-top: 0.2em;
 }
 
diff --git a/erpnext/website/doctype/about_us_settings/template.html b/erpnext/website/doctype/about_us_settings/template.html
index 864fb65..404ebe9 100644
--- a/erpnext/website/doctype/about_us_settings/template.html
+++ b/erpnext/website/doctype/about_us_settings/template.html
@@ -1,9 +1,10 @@
-<div class="layout_wrapper">
+<div class="layout-wrapper layout-wrapper-background">
 	<div class="web-content" id="content-about-us">
-		{% if doc.headline %}
-			<h1>{{ doc.headline }}</h1>
-		{% endif %}
-		<div class="web-main-section">
+		<div class="layout-main-section">
+			{% if doc.headline %}
+				<h1>{{ doc.headline }}</h1>
+			{% endif %}
+			
 			{{ doc.main_section_html }}
 			
 			{% if doc.about_team %}
@@ -28,7 +29,7 @@
 				</table>
 			{% endif %}
 		</div>
-		<div class="web-side-section">
+		<div class="layout-side-section">
 			{{ doc.side_section_html }}
 		</div>
 		<div style="clear: both"></div>
diff --git a/erpnext/website/doctype/blog/template.html b/erpnext/website/doctype/blog/template.html
index 1b81fe2..467f301 100644
--- a/erpnext/website/doctype/blog/template.html
+++ b/erpnext/website/doctype/blog/template.html
@@ -1,13 +1,13 @@
-<div class="layout_wrapper">
+<div class="layout-wrapper layout-wrapper-background">
 	<div class="web-content" id="blog-{{ doc.name }}">
-		<h1>Blog</h1>
-		<div class="web-main-section">
+		<div class="layout-main-section">
+			<h1>Blog</h1>
 			<h3>{{ doc.title }}</h3>
 			<div class="help">By {{ doc.full_name }} on {{ doc.updated }}</div>
 			<br>
 			{{ doc.content_html }}
 		</div>
-		<div class="web-side-section">
+		<div class="layout-side-section">
 			<p><a href="#!blog">All Blogs</a></p>
 			<h4>Subscribe</h4>
 			<p>
diff --git a/erpnext/website/doctype/contact_us_settings/template.html b/erpnext/website/doctype/contact_us_settings/template.html
index 6453784..508b534 100644
--- a/erpnext/website/doctype/contact_us_settings/template.html
+++ b/erpnext/website/doctype/contact_us_settings/template.html
@@ -1,9 +1,9 @@
-<div class="layout_wrapper">
+<div class="layout-wrapper layout-wrapper-background">
 	<div class="web-content" id="content-contact-us">
-		{% if doc.headline %}
-			<h1>{{ doc.headline }}</h1>
-		{% endif %}
-		<div class="web-main-section">
+		<div class="layout-main-section">
+			{% if doc.headline %}
+				<h1>{{ doc.headline }}</h1>
+			{% endif %}
 			<label>Your Name*</label>
 			<div><input name="contact-name" type="text"/></div>
 			<br>
@@ -16,7 +16,7 @@
 			<div><button class="btn primary">Send</button></div>
 			{{ doc.main_section_html }}
 		</div>
-		<div class="web-side-section">
+		<div class="layout-side-section">
 			{{ doc.side_section_html }}
 		</div>
 		<div style="clear: both"></div>
diff --git a/erpnext/website/doctype/web_page/template.html b/erpnext/website/doctype/web_page/template.html
index e6f071d..2c92a25 100644
--- a/erpnext/website/doctype/web_page/template.html
+++ b/erpnext/website/doctype/web_page/template.html
@@ -1,26 +1,21 @@
-<div class="layout_wrapper">
+<div class="layout-wrapper layout-wrapper-background">
 	<div class="web-content" id="content-{{ doc.name }}" 
 		style="text-align: {{ doc.text_align }};">
-		{% if doc.head_section and doc.layout=='Two column with header' %}
-		<div class="web-head-section">
-			{{ doc.head_section_html }}
-		</div>
-		{% endif %}
 		
 		{% if doc.layout.startswith('Two column') %}
-		<div class="web-main-section">
+		<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 %}
 
-		{% if doc.layout.startswith('Two column') %}
 		</div>
-		{% endif %}
 		
 		{% if doc.layout.startswith('Two column') %}
-		<div class="web-side-section">
+		<div class="layout-side-section">
 			{{ doc.side_section_html }}
 			{% if doc.see_also %}
 			<div class="info-box">
diff --git a/erpnext/website/page/blog/blog.html b/erpnext/website/page/blog/blog.html
index 79ea7f0..ffb8128 100644
--- a/erpnext/website/page/blog/blog.html
+++ b/erpnext/website/page/blog/blog.html
@@ -1,10 +1,10 @@
-<div class="layout_wrapper">
+<div class="layout-wrapper layout-wrapper-background">
 	<div class="web-content" id="content-blog">
-		<h1>Blog</h1>
-		<br>
-		<div class="web-main-section">
+		<div class="layout-main-section">
+			<h1>Blog</h1>
+			<br>
 		</div>
-		<div class="web-side-section">
+		<div class="layout-side-section">
 			<!-- for later
 			<h4>Get Updates</h4>
 			<p>
diff --git a/erpnext/website/page/blog/blog.js b/erpnext/website/page/blog/blog.js
index bc7aec4..418fc6c 100644
--- a/erpnext/website/page/blog/blog.js
+++ b/erpnext/website/page/blog/blog.js
@@ -17,7 +17,7 @@
 
 pscript.onload_blog = function(wrapper) {
 	wrapper.blog_list = new wn.ui.Listing({
-		parent: $(wrapper).find('.web-main-section').get(0),
+		parent: $(wrapper).find('.layout-main-section').get(0),
 		query: 'select tabBlog.name, title, left(content, 300) as content, tabBlog.modified, \
 			ifnull(first_name, "") as first_name, ifnull(last_name, "") as last_name \
 			from tabProfile, tabBlog\