function updateDisplay() {
document.getElementById("code_display").innerHTML = document.getElementById("code_entry").value;
}

function updateExample(type) {
if (type == 'paragraph') {
	example_code = 
'<p>This is paragraph 1</p>\n<p>This is paragraph 2</p>\n\nThis is paragraph 1\n<br><br>\nThis is paragraph 2';
}
else if (type == 'lists') {
	example_code = 
'<ol>\n <li>This is ordered list item one</li>\n <li>This is ordered list item two</li>\n <li>This is ordered list item three</li>\n</ol>\n\n<ul>\n <li>This is unordered list item one</li>\n <li>This is unordered list item two</li>\n <li>This is unordered list item three</li>\n</ul>';
}
else if (type == 'headings') {
	example_code = 
'<h1>This is an example of heading 1</h1>\n<h2>This is an example of heading 2</h2>\n<h3>This is an example of heading 3</h3>\n<h4>This is an example of heading 4</h4>\n<h5>This is an example of heading 5</h5>\n<h6>This is an example of heading 6</h6>';
}
else if (type == 'simple_page') {
	example_code = 
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\n"http://www.w3.org/TR/html4/loose.dtd">\n<html>\n <head>\n   <title>This is the title of the page</title>\n   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n </head>\n <body>\n  <h1>This is the heading</h1>\n  <p>This is a paragraph in the body.</p>\n </body>\n</html>';
}
else if (type == 'comments') {
	example_code = 
'<!--\nAnything between these tags are considered comments and won\'t be displayed, so if you want to make some notes in your code, do it between here. You can add comments anywhere on your web page. Just remember to end them.\n-->';
}
else if (type == 'links') {
	example_code = 
'<!-- Below is a Relative URL -->\n<a href="free-web-counter.html">Free web counters</a>\n<br>\n\n<!-- And this is an Absolute URL -->\n<a href="http://www.web-design-factory.net/free-web-counter.html">Free web counters</a>\n<br>';
}
else if (type == 'styled_tags') {
	example_code = 
'<style>\n p {\n  color:#990000;\n  font-family:Georgia, "Times New Roman", Times, serif;\n  font-size:14px;\n  border:1px solid black;\n  background-color:#FFFFCC;\n	padding:2px;\n }\n</style>\n\n<p>This is the styled paragraph.</p>';
}
else if (type == 'styled_class') {
	example_code = 
'<style>\n .test-style {\n  color:#990000;\n  font-family:Georgia, "Times New Roman", Times, serif;\n  font-size:14px;\n  border:1px solid black;\n  background-color:#FFFFCC;\n	padding:2px;\n }\n</style>\n\n<p class="test-style">This is the styled paragraph.</p>';
}
else if (type == 'link_new_window') {
	example_code = 
'<!-- You already saw one link attribute in the "Links" example, which was the "href" attribute. Another useful one is the "target" attribute, which allows you to open a link in another window. -->\n\n<a href="http://www.web-design-factory.net/free-web-counter.html" target="_blank">Free web counters</a>';
}
else if (type == 'image') {
	example_code = 
'<img src="http://www.web-design-factory.net/images/example.jpg">';
}
else if (type == 'image_with_attributes') {
	example_code = 
'<img src="http://www.web-design-factory.net/images/example.jpg" width="300" height="100" alt="Boy and Tuba" title="Boy and Tuba" >\n<img src="http://www.web-design-factory.net/images/example.jpg" width="30" height="250" alt="Boy and Tuba" title="Boy and Tuba">';
}
else if (type == 'div') {
	example_code = 
'<div>\n This is the content in the first div.\n</div>\n<div>\n This is the content in the second div.\n</div>';
}
else if (type == 'stylish_div') {
	example_code = 
'<style>\n .style1 {\n  cursor:pointer;\n  background-color:#009900;\n  color:#FFFFFF;\n  border-left:3px solid blue;\n  border-right:3px dashed #EA76D8;\n  border-bottom:10px double #C6AC1E;\n  border-top:15px groove black;\n  font-weight:bold;\n	font-family:Verdana, Arial, Helvetica, sans-serif;\n	font-size:14px;\n	margin:20px;\n	padding:10px;\n }\n .style1 p {\n  border:2px solid orange;\n  padding:5px;\n	font-family:Arial, Helvetica, sans-serif;\n	color:#006699;\n }\n</style>\n\n<div class="style1">\n This is the content of my stylish div. This is the content of my stylish div. This is the content of my stylish div. This is the content of my stylish div. \n <p>This is a paragraph in the div, notice how it is styled differently. Can you figure out how?</p>\n</div>';
}
document.getElementById("code_display").innerHTML	= example_code;
document.getElementById("code_entry").value			= example_code;
}

