function renderMenu() {
	$('#content').empty();
	$('#list').empty();

	$('#list').append('<li><a class="openable" href="http://delicious.com/' + localStorage['username'] + '">Delicious.com Profile</a></li>');
	$('#list').append('<li><a onclick="renderTags()" href="">Browse by tag</a></li>');
	$('#list').append('<li><a onclick="renderStacks()" href="">Browse by stack</a></li>');
	$('#list').append('<hr />');
	$('#list').append('<li><a onclick="renderInsertForm()" href="">Add to my bookmarks</a></li>');

	openLinksNewTab('.openable');
}


// HELPERS

function openLinksNewTab(selector) {
	$(selector).click(function(){
		chrome.tabs.create({'url' : $(this).attr('href')});
		return false;
	});
}

function clear() {
	$('#content').empty();
	$('#list').empty();
}

function api(url, success, error) {
	var user = localStorage["username"];
	var pass = localStorage["password"];

	$.ajax({
		url : url,
		contentType: 'application/xml; charset=utf-8',
		dataType : 'xml',
		beforeSend : function(xhr) {
			xhr.setRequestHeader('Authorization', 'Basic ' + window.btoa(unescape(encodeURIComponent(user+':'+pass))));
		},
		success : success,
		error : function(xml, msg, error) {
			$('#content').empty().append('<p>An unexpected failure! '+msg+' - '+error+'.</p>');
			$('#container').css({'min-width' : '300px'});
		}
	});
}

function say(str) {
	$('#content').empty();
	$('#content').empty().append('<p>'+str+'.</p>');
}
@@ -250,32 +250,33 @@
 erTags()%22 href=%22
+#
 %22%3EBrowse by tag%3C
@@ -536,16 +536,501 @@
 e');%0A%7D%0A%0A
+function renderTags() %7B%0A%09clear();%0A%09$('#list').append('%3Cli%3E%3Ca onclick=%22renderMenu()%22 href=%22%22%3EMenu%3C/a%3E%3C/li%3E');%0A%09$('#list').append('%3Chr /%3E');%0A%0A%09api('https://api.del.icio.us/v1/tags/get', function(xml) %7B%0A%09%09$(xml).find('tag').each(function() %7B%0A%09%09%09var tag = $(this).attr('tag');%0A%09%09%09var link = $('%3Ca href=%22#%22%3E'+tag+'%3C/a%3E').click(function() %7B%0A%09%09%09%09renderBookmarks(%5B$(this).val()%5D);%0A%09%09%09%09false;%0A%09%09%09%7D);%0A%09%09%09var item = $('%3Cli%3E%3C/li%3E');%0A%09%09%09item.append(link);%0A%09%09%09$('#list').append(item);%0A%09%09%7D);%0A%09%7D);%0A%7D%0A%0A
 %0A// HELP

Add tags list.