function createControlPanel() {
	var cE = function(v){return document.createElement(v)};
	var cTN = function(v){return document.createTextNode(v)};

	var bar = document.getElementById("navigation");
	var item = cE("li");
		item.id = "config";
		item.appendChild(cTN("Control Panel"));
		var subList = cE("ul");
			var chStyItem = cE("li");
				chStyItem.appendChild(cTN("Style: "));
				new StyleChooser().appendTo(chStyItem);
			subList.appendChild(chStyItem);

			var textSizeItem = cE("li");
				textSizeItem.appendChild(cTN("Font Size: "));
				new TextSizeControl().appendTo(textSizeItem);
			subList.appendChild(textSizeItem);

		item.appendChild(subList);
	bar.insertBefore(item, bar.firstChild);
}

window.addEventListener("load", createControlPanel, false);


// ScriptSheet to open comments links in new window:
function CommentsLink(elt) {
	this.element = elt;
	this.create();
}
CommentsLink.prototype = {
	create : function() {
		this.element.addEventListener("click", this.open, false);
	},
	open : function(evt) {
		var win = window.open(this.href, 'comments', 'width=500,height=500,status=yes,resizable=yes,scrollbars=yes');
		if(win) evt.preventDefault();
	},
	destroy : function() {
		this.element.removeEventListener("click", this.open, false);
	}
};
CommentsLink.scriptSheetSelector = "a.comments";


// Default icon for OSXBar items:
OSXBar.defaultIcon = "/media/icons/other-64.png";


/*

// Extend OSXBar ScriptSheet triggers to add OSXBarControl panel
// to control panel nav item when OSXBar style is active:

OSXBar.enableScriptSheet = function() {
	OSXBar.tmp = ScriptSheet.enableScriptSheetDefault;
	OSXBar.tmp(); delete OSXBar.tmp;
	
	var inst = OSXBar.scriptSheetInstances || [];
	if(inst.length) {
		var li = inst[0].configLI = document.createElement("li");
			li.appendChild(document.createTextNode("Dock Params:"));
			var config = new OSXBarControl(inst[0]);
			config.appendTo(li);
		var cont = inst[0].icons[0].contents;
		cont[cont.length-1].appendChild(li);
	}
}
OSXBar.disableScriptSheet = function() {
	var inst = OSXBar.scriptSheetInstances || [];
	if(inst.length && inst[0].configLI) {
		inst[0].configLI.parentNode.removeChild(inst[0].configLI);
	}
	
	OSXBar.tmp = ScriptSheet.disableScriptSheetDefault;
	OSXBar.tmp(); delete OSXBar.tmp;
}
*/
