<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml'/>
<!--}}}-->
Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected{color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.sparkline {background:[[ColorPalette::PrimaryPale]]; border:0;}
.sparktick {background:[[ColorPalette::PrimaryDark]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:'alpha(opacity:60)';}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0em 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0em 1em 1em; left:0px; top:0px;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0em 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 .3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0em 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0em 0em 0em 0em; margin:0.4em 0em 0.2em 0em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0em 0em 0em; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0em;}
.wizardFooter .status {padding:0em 0.4em 0em 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em 0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0em; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em 0.2em 0.2em 0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em 0.2em 0.2em 0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em 1em 1em 1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0em;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0em 0em 0.5em;}
.tab {margin:0em 0em 0em 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0em 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0em 1em;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0em 0.25em; padding:0em 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0em; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin:1px 0px 1px 0px;}

.sparkline {line-height:1em;}
.sparktick {outline:0;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em 0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0em; right:0em;}
#backstageButton a {padding:0.1em 0.4em 0.1em 0.4em; margin:0.1em 0.1em 0.1em 0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; margin:0em 3em 0em 3em; padding:1em 1em 1em 1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em 0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none ! important;}
#displayArea {margin: 1em 1em 0em 1em;}
/* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
noscript {display:none;}
}
/*}}}*/
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler > fields syncing permalink references jump'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteTiddler'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<!--}}}-->
To get started with this blank TiddlyWiki, you'll need to modify the following tiddlers:
* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* MainMenu: The menu (usually on the left)
* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
These InterfaceOptions for customising TiddlyWiki are saved in your browser

Your username for signing your edits. Write it as a WikiWord (eg JoeBloggs)

<<option txtUserName>>
<<option chkSaveBackups>> SaveBackups
<<option chkAutoSave>> AutoSave
<<option chkRegExpSearch>> RegExpSearch
<<option chkCaseSensitiveSearch>> CaseSensitiveSearch
<<option chkAnimate>> EnableAnimations

----
Also see AdvancedOptions
<<importTiddlers>>















order:1
button:a
buttonLong:active




/***
|Name:|CloseOnCancelPlugin|
|Description:|Closes the tiddler if you click new tiddler then cancel. Default behaviour is to leave it open|
|Version:|3.0.1 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#CloseOnCancelPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
merge(config.commands.cancelTiddler,{

	handler_mptw_orig_closeUnsaved: config.commands.cancelTiddler.handler,

	handler: function(event,src,title) {
		this.handler_mptw_orig_closeUnsaved(event,src,title);
		if (!store.tiddlerExists(title) && !store.isShadowTiddler(title))
			story.closeTiddler(title,true);
	 	return false;
	}

});

//}}}

order:4
button:Collect
!Collect Items
* ...
Name: MptwBlue
Background: #fff
Foreground: #000
PrimaryPale: #cdf
PrimaryLight: #57c
PrimaryMid: #114
PrimaryDark: #012
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88

<<saveChanges>><<search>><<closeAll>>
order:998
button:Conf
buttonClass:tiny
!Configuration
* ...
/***
|''Name:''|CryptoFunctionsPlugin|
|''Description:''|Support for cryptographic functions|
***/
//{{{
if(!version.extensions.CryptoFunctionsPlugin) {
version.extensions.CryptoFunctionsPlugin = {installed:true};

//--
//-- Crypto functions and associated conversion routines
//--

// Crypto "namespace"
function Crypto() {}

// Convert a string to an array of big-endian 32-bit words
Crypto.strToBe32s = function(str)
{
	var be = Array();
	var len = Math.floor(str.length/4);
	var i, j;
	for(i=0, j=0; i<len; i++, j+=4) {
		be[i] = ((str.charCodeAt(j)&0xff) << 24)|((str.charCodeAt(j+1)&0xff) << 16)|((str.charCodeAt(j+2)&0xff) << 8)|(str.charCodeAt(j+3)&0xff);
	}
	while (j<str.length) {
		be[j>>2] |= (str.charCodeAt(j)&0xff)<<(24-(j*8)%32);
		j++;
	}
	return be;
};

// Convert an array of big-endian 32-bit words to a string
Crypto.be32sToStr = function(be)
{
	var str = "";
	for(var i=0;i<be.length*32;i+=8)
		str += String.fromCharCode((be[i>>5]>>>(24-i%32)) & 0xff);
	return str;
};

// Convert an array of big-endian 32-bit words to a hex string
Crypto.be32sToHex = function(be)
{
	var hex = "0123456789ABCDEF";
	var str = "";
	for(var i=0;i<be.length*4;i++)
		str += hex.charAt((be[i>>2]>>((3-i%4)*8+4))&0xF) + hex.charAt((be[i>>2]>>((3-i%4)*8))&0xF);
	return str;
};

// Return, in hex, the SHA-1 hash of a string
Crypto.hexSha1Str = function(str)
{
	return Crypto.be32sToHex(Crypto.sha1Str(str));
};

// Return the SHA-1 hash of a string
Crypto.sha1Str = function(str)
{
	return Crypto.sha1(Crypto.strToBe32s(str),str.length);
};

// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words
Crypto.sha1 = function(x,blen)
{
	// Add 32-bit integers, wrapping at 32 bits
	add32 = function(a,b)
	{
		var lsw = (a&0xFFFF)+(b&0xFFFF);
		var msw = (a>>16)+(b>>16)+(lsw>>16);
		return (msw<<16)|(lsw&0xFFFF);
	};
	// Add five 32-bit integers, wrapping at 32 bits
	add32x5 = function(a,b,c,d,e)
	{
		var lsw = (a&0xFFFF)+(b&0xFFFF)+(c&0xFFFF)+(d&0xFFFF)+(e&0xFFFF);
		var msw = (a>>16)+(b>>16)+(c>>16)+(d>>16)+(e>>16)+(lsw>>16);
		return (msw<<16)|(lsw&0xFFFF);
	};
	// Bitwise rotate left a 32-bit integer by 1 bit
	rol32 = function(n)
	{
		return (n>>>31)|(n<<1);
	};

	var len = blen*8;
	// Append padding so length in bits is 448 mod 512
	x[len>>5] |= 0x80 << (24-len%32);
	// Append length
	x[((len+64>>9)<<4)+15] = len;
	var w = Array(80);

	var k1 = 0x5A827999;
	var k2 = 0x6ED9EBA1;
	var k3 = 0x8F1BBCDC;
	var k4 = 0xCA62C1D6;

	var h0 = 0x67452301;
	var h1 = 0xEFCDAB89;
	var h2 = 0x98BADCFE;
	var h3 = 0x10325476;
	var h4 = 0xC3D2E1F0;

	for(var i=0;i<x.length;i+=16) {
		var j,t;
		var a = h0;
		var b = h1;
		var c = h2;
		var d = h3;
		var e = h4;
		for(j = 0;j<16;j++) {
			w[j] = x[i+j];
			t = add32x5(e,(a>>>27)|(a<<5),d^(b&(c^d)),w[j],k1);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=16;j<20;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),d^(b&(c^d)),w[j],k1);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=20;j<40;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),b^c^d,w[j],k2);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=40;j<60;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),(b&c)|(d&(b|c)),w[j],k3);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}
		for(j=60;j<80;j++) {
			w[j] = rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16]);
			t = add32x5(e,(a>>>27)|(a<<5),b^c^d,w[j],k4);
			e=d; d=c; c=(b>>>2)|(b<<30); b=a; a = t;
		}

		h0 = add32(h0,a);
		h1 = add32(h1,b);
		h2 = add32(h2,c);
		h3 = add32(h3,d);
		h4 = add32(h4,e);
	}
	return Array(h0,h1,h2,h3,h4);
};


}
//}}}
<div macro="showWhenTitleIs 'Action Dashboard'">[[NameDashboards##Action Dashboard]]</div>
<div macro="showWhenTitleIs 'Action Dashboard by Project'">[[NameDashboards##Action Dashboard by Project]]</div>
<div macro="showWhenTitleIs 'Action Dashboard by Context'">[[NameDashboards##Action Dashboard by Context]]</div>
<div macro="showWhenTitleIs 'Next Actions'">[[NameDashboards##Next Actions]]</div>
<div macro="showWhenTitleIs 'Next Actions by Context'">[[NameDashboards##Next Actions by Context]]</div>
<div macro="showWhenTitleIs 'Next Actions by Project'">[[NameDashboards##Next Actions by Project]]</div>
<div macro="showWhenTitleIs 'Projects'">[[NameDashboards##Projects]]</div>
<div macro="showWhenTitleIs 'Next and Waiting Actions'">[[NameDashboards##Next and Waiting Actions]]</div>
<div macro="showWhenTitleIs 'Next and Waiting Actions by Context'">[[NameDashboards##Next and Waiting Actions by Context]]</div>
<div macro="showWhenTitleIs 'Next and Waiting Actions by Project'">[[NameDashboards##Next and Waiting Actions by Project]]</div>
<div macro="showWhenTitleIs 'Done Actions'">[[NameDashboards##Done Actions]]</div>
<div macro="showWhenTitleIs '(No Context)'">[[NameDashboards##(No Context)]]</div>
<div macro="showWhenTitleIs '(No Project)'">[[NameDashboards##(No Project)]]</div>
<div macro="showWhenTitleIs 'Active Projects With No Next Actions'">[[NameDashboards##Active Projects With No Next Actions]]</div>
<div macro="showWhenTagged 'Project'">[[TagDashboards##Project]]</div>
<div macro="showWhenTagged 'Context'">[[TagDashboards##Context]]</div>
[[Action Dashboard]]
[[Projects]]
/***
|''Name:''|DeprecatedFunctionsPlugin|
|''Description:''|Support for deprecated functions removed from core|
***/
//{{{
if(!version.extensions.DeprecatedFunctionsPlugin) {
version.extensions.DeprecatedFunctionsPlugin = {installed:true};

//--
//-- Deprecated code
//--

// @Deprecated: Use createElementAndWikify and this.termRegExp instead
config.formatterHelpers.charFormatHelper = function(w)
{
	w.subWikify(createTiddlyElement(w.output,this.element),this.terminator);
};

// @Deprecated: Use enclosedTextHelper and this.lookaheadRegExp instead
config.formatterHelpers.monospacedByLineHelper = function(w)
{
	var lookaheadRegExp = new RegExp(this.lookahead,"mg");
	lookaheadRegExp.lastIndex = w.matchStart;
	var lookaheadMatch = lookaheadRegExp.exec(w.source);
	if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
		var text = lookaheadMatch[1];
		if(config.browser.isIE)
			text = text.replace(/\n/g,"\r");
		createTiddlyElement(w.output,"pre",null,null,text);
		w.nextMatch = lookaheadRegExp.lastIndex;
	}
};

// @Deprecated: Use <br> or <br /> instead of <<br>>
config.macros.br = {};
config.macros.br.handler = function(place)
{
	createTiddlyElement(place,"br");
};

// Find an entry in an array. Returns the array index or null
// @Deprecated: Use indexOf instead
Array.prototype.find = function(item)
{
	var i = this.indexOf(item);
	return i == -1 ? null : i;
};

// Load a tiddler from an HTML DIV. The caller should make sure to later call Tiddler.changed()
// @Deprecated: Use store.getLoader().internalizeTiddler instead
Tiddler.prototype.loadFromDiv = function(divRef,title)
{
	return store.getLoader().internalizeTiddler(store,this,title,divRef);
};

// Format the text for storage in an HTML DIV
// @Deprecated Use store.getSaver().externalizeTiddler instead.
Tiddler.prototype.saveToDiv = function()
{
	return store.getSaver().externalizeTiddler(store,this);
};

// @Deprecated: Use store.allTiddlersAsHtml() instead
function allTiddlersAsHtml()
{
	return store.allTiddlersAsHtml();
}

// @Deprecated: Use refreshPageTemplate instead
function applyPageTemplate(title)
{
	refreshPageTemplate(title);
}

// @Deprecated: Use story.displayTiddlers instead
function displayTiddlers(srcElement,titles,template,unused1,unused2,animate,unused3)
{
	story.displayTiddlers(srcElement,titles,template,animate);
}

// @Deprecated: Use story.displayTiddler instead
function displayTiddler(srcElement,title,template,unused1,unused2,animate,unused3)
{
	story.displayTiddler(srcElement,title,template,animate);
}

// @Deprecated: Use functions on right hand side directly instead
var createTiddlerPopup = Popup.create;
var scrollToTiddlerPopup = Popup.show;
var hideTiddlerPopup = Popup.remove;

// @Deprecated: Use right hand side directly instead
var regexpBackSlashEn = new RegExp("\\\\n","mg");
var regexpBackSlash = new RegExp("\\\\","mg");
var regexpBackSlashEss = new RegExp("\\\\s","mg");
var regexpNewLine = new RegExp("\n","mg");
var regexpCarriageReturn = new RegExp("\r","mg");

}
//}}}
order:1
button:Work
!Do Work
<slider+ By Context>
* [[Next Actions|Next Actions by Context]]
* [[Next and Waiting Actions|Next and Waiting Actions by Context]]
* [[Action Dashboard|Action Dashboard by Context]]
</slider>
<slider By Project>
* [[Next Actions|Next Actions by Project]]
* [[Next and Waiting Actions|Next and Waiting Actions by Project]]
* [[Action Dashboard|Action Dashboard by Project]]
</slider>
<slider+ Flat>
* [[Next Actions]]
* [[Next and Waiting Actions]]
* [[Done Actions]]
</slider>
<slider+ Contexts>
<<mgtdList startTag:Action tags:'Next && !Done' groupCountOnly:yes group:Context gView:Context where:tiddler.hasActiveProject()>>
</slider>
<slider All contexts>
<<mgtdList startTag:Context>>
</slider>
button:done


/***
|Name:|ExtentTagButtonPlugin|
|Description:|Adds a New tiddler button in the tag drop down|
|Version:|3.2 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#ExtendTagButtonPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{

window.onClickTag_mptw_orig = window.onClickTag;
window.onClickTag = function(e) {
	window.onClickTag_mptw_orig.apply(this,arguments);
	var tag = this.getAttribute("tag");
	var title = this.getAttribute("tiddler");
	// Thanks Saq, you're a genius :)
	var popup = Popup.stack[Popup.stack.length-1].popup;
	createTiddlyElement(createTiddlyElement(popup,"li",null,"listBreak"),"div");
	wikify("<<newTiddler label:'New tiddler' tag:'"+tag+"'>>",createTiddlyElement(popup,"li"));
	return false;
}

//}}}

order:3
button:f
buttonLong:future



/***
|Name:|HideWhenPlugin|
|Description:|Allows conditional inclusion/exclusion in templates|
|Version:|3.1 ($Rev: 3919 $)|
|Date:|$Date: 2008-03-13 02:03:12 +1000 (Thu, 13 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#HideWhenPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
For use in ViewTemplate and EditTemplate. Example usage:
{{{<div macro="showWhenTagged Task">[[TaskToolbar]]</div>}}}
{{{<div macro="showWhen tiddler.modifier == 'BartSimpson'"><img src="bart.gif"/></div>}}}
***/
//{{{

window.hideWhenLastTest = false;

window.removeElementWhen = function(test,place) {
	window.hideWhenLastTest = test;
	if (test) {
		removeChildren(place);
		place.parentNode.removeChild(place);
	}
};


merge(config.macros,{

	hideWhen: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( eval(paramString), place);
	}},

	showWhen: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( !eval(paramString), place);
	}},

	hideWhenTagged: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( tiddler.tags.containsAll(params), place);
	}},

	showWhenTagged: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( !tiddler.tags.containsAll(params), place);
	}},

	hideWhenTaggedAny: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( tiddler.tags.containsAny(params), place);
	}},

	showWhenTaggedAny: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( !tiddler.tags.containsAny(params), place);
	}},

	hideWhenTaggedAll: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( tiddler.tags.containsAll(params), place);
	}},

	showWhenTaggedAll: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( !tiddler.tags.containsAll(params), place);
	}},

	hideWhenExists: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( store.tiddlerExists(params[0]) || store.isShadowTiddler(params[0]), place);
	}},

	showWhenExists: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( !(store.tiddlerExists(params[0]) || store.isShadowTiddler(params[0])), place);
	}},

	hideWhenTitleIs: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( tiddler.title == params[0], place);
	}},

	showWhenTitleIs: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( tiddler.title != params[0], place);
	}},

	'else': { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		removeElementWhen( !window.hideWhenLastTest, place);
	}}

});

//}}}


/***
|Name:|InstantTimestampPlugin|
|Description:|A handy way to insert timestamps in your tiddler content|
|Version:|1.0.9 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#InstantTimestampPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Usage
If you enter {ts} in your tiddler content (without the spaces) it will be replaced with a timestamp when you save the tiddler. Full list of formats:
* {ts} or {t} -> timestamp
* {ds} or {d} -> datestamp
* !ts or !t at start of line -> !!timestamp
* !ds or !d at start of line -> !!datestamp
(I added the extra ! since that's how I like it. Remove it from translations below if required)
!!Notes
* Change the timeFormat and dateFormat below to suit your preference.
* See also http://mptw2.tiddlyspot.com/#AutoCorrectPlugin
* You could invent other translations and add them to the translations array below.
***/
//{{{

config.InstantTimestamp = {

	// adjust to suit
	timeFormat: 'DD/0MM/YY 0hh:0mm',
	dateFormat: 'DD/0MM/YY',

	translations: [
		[/^!ts?$/img,  "'!!{{ts{'+now.formatString(config.InstantTimestamp.timeFormat)+'}}}'"],
		[/^!ds?$/img,  "'!!{{ds{'+now.formatString(config.InstantTimestamp.dateFormat)+'}}}'"],

		// thanks Adapted Cat
		[/\{ts?\}(?!\}\})/ig,"'{{ts{'+now.formatString(config.InstantTimestamp.timeFormat)+'}}}'"],
		[/\{ds?\}(?!\}\})/ig,"'{{ds{'+now.formatString(config.InstantTimestamp.dateFormat)+'}}}'"]
		
	],

	excludeTags: [
		"noAutoCorrect",
		"noTimestamp",
		"html",
		"CSS",
		"css",
		"systemConfig",
		"systemConfigDisabled",
		"zsystemConfig",
		"Plugins",
		"Plugin",
		"plugins",
		"plugin",
		"javascript",
		"code",
		"systemTheme",
		"systemPalette"
	],

	excludeTiddlers: [
		"StyleSheet",
		"StyleSheetLayout",
		"StyleSheetColors",
		"StyleSheetPrint"
		// more?
	]

}; 

TiddlyWiki.prototype.saveTiddler_mptw_instanttimestamp = TiddlyWiki.prototype.saveTiddler;
TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields) {

	tags = (typeof(tags) == "string") ? tags.readBracketedList() : tags;
	var conf = config.InstantTimestamp;

	if ( !tags.containsAny(conf.excludeTags) && !conf.excludeTiddlers.contains(newTitle) ) {

		var now = new Date();
		var trans = config.InstantTimestamp.translations;
		for (var i=0;i<trans.length;i++) {
			newBody = newBody.replace(trans[i][0], eval(trans[i][1]));
		}
	}

	return this.saveTiddler_mptw_instanttimestamp(title,newTitle,newBody,modifier,modified,tags,fields);
}

// you can override these in StyleSheet 
setStylesheet(".ts,.ds { background-color:#ddd; font-style:italic; }","instantTimestampStyles");

//}}}

/***
|Name:|LessBackupsPlugin|
|Description:|Intelligently limit the number of backup files you create|
|Version:|3.0 ($Rev: 2320 $)|
|Date:|$Date: 2007-06-18 22:37:46 +1000 (Mon, 18 Jun 2007) $|
|Source:|http://mptw.tiddlyspot.com/#LessBackupsPlugin|
|Author:|Simon Baird|
|Email:|simon.baird@gmail.com|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Description
You end up with just backup one per year, per month, per weekday, per hour, minute, and second.  So total number won't exceed about 200 or so. Can be reduced by commenting out the seconds/minutes/hours line from modes array
!!Notes
Works in IE and Firefox only.  Algorithm by Daniel Baird. IE specific code by by Saq Imtiaz.
***/
//{{{
window.getSpecialBackupPath = function(backupPath) {

	var MINS  = 60 * 1000;
	var HOURS = 60 * MINS;
	var DAYS  = 24 * HOURS;

	// comment out the ones you don't want
	var modes = [
		["YYYY",  365*DAYS], // one per year for ever
		["MMM",   31*DAYS],  // one per month
		["ddd",   7*DAYS],   // one per weekday
		//["d0DD",  1*DAYS],   // one per day of month
		["h0hh",  24*HOURS], // one per hour
		["m0mm",  1*HOURS],  // one per minute
		["s0ss",  1*MINS],   // one per second
		["latest",0]         // always keep last version. (leave this).
	];

	var now = new Date();

	for (var i=0;i<modes.length;i++) {

		// the filename we will try
		var specialBackupPath = backupPath.replace(/(\.)([0-9]+\.[0-9]+)(\.html)$/,
				'$1'+now.formatString(modes[i][0]).toLowerCase()+'$3')

		// open the file
		try {
			if (config.browser.isIE) {
				var fsobject = new ActiveXObject("Scripting.FileSystemObject")
				var fileExists  = fsobject.FileExists(specialBackupPath);
				if (fileExists) {
					var fileObject = fsobject.GetFile(specialBackupPath);
					var modDate = new Date(fileObject.DateLastModified).valueOf();
				}
			}
			else {
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
				var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
				file.initWithPath(specialBackupPath);
				var fileExists = file.exists();
				if (fileExists) {
					var modDate = file.lastModifiedTime;
				}
			}
		}
		catch(e) {
			// give up
			return backupPath;
		}

		// expiry is used to tell if it's an 'old' one. Eg, if the month is June and there is a
		// June file on disk that's more than an month old then it must be stale so overwrite
		// note that "latest" should be always written because the expiration period is zero (see above)
		var expiry = new Date(modDate + modes[i][1]);
		if (!fileExists || now > expiry)
			return specialBackupPath;
	}
}

// hijack the core function
window.getBackupPath_mptw_orig = window.getBackupPath;
window.getBackupPath = function(localPath) {
	return getSpecialBackupPath(getBackupPath_mptw_orig(localPath));
}

//}}}


MPTW is a distribution or edition of TiddlyWiki that includes a standard TiddlyWiki core packaged with some plugins designed to improve usability and provide a better way to organise your information. For more information see http://mptw.tiddlyspot.com/.
merge(Array.prototype,{

	each: function(func) {
		for (var i=0;i<this.length;i++)
			func(this[i]);
	},

	map: function(func) {
		var result = [];
		this.each(function(item) {
			result.push(func(item));
		});
		return result;
	},

	select: function(func) {
		var result = [];
		this.each(function(item) {
			if (func(item))
				result.push(item);
		});
		return result;
	},

	reject: function(func) {
		var result = [];
		this.each(function(item) {
			if (!func(item))
				result.push(item);
		});
		return result;
	}

});

//------------------------------------------

merge(String.prototype,{

	parseTagExpr: function(debug) {

		if (this.trim() == "")
			return "(true)";

		var logicOps = /(!|&&|\|\||\(|\))/g;

		var spaced = this.
 			// because square brackets in templates are no good
			// this means you can use [(With Spaces)] instead of [[With Spaces]]
			replace(/\[\(/g," [[").
			replace(/\)\]/g,"]] "). 
			// space things out so we can use readBracketedList. tricky eh?
			replace(logicOps," $1 ");


		var expr = "";

		var tokens = spaced.readBracketedList(false); // false means not unique. nice one JR!

		tokens.each(function(tok) {

			if (tok.match(logicOps)) {
				expr += tok;
			}
			else if (tok.match(/^parent:/)) {
				// experimental
				var lookForTagInParent = tok.split(":")[1];
				expr += "tiddler.parents().anyHasTag('"+lookForTagInParent+"')";
			}					
			else {
				expr += "tiddler.tags.contains('%0')".format([
						// fix single quote bug. hurrah
						// but still have nasty round bracket bug
						tok.replace(/'/,"\\'")
					]);
			}
		});

		if (debug)
			alert(expr);

		return '('+expr+')';
	}

});

merge(Tiddler.prototype,{

	matchesEvalExpr: function(evalExpr) {
		var tiddler = this;
		return eval(evalExpr);
	},

	matchesTagExpr: function(tagExpr) {
		return this.matchesEvalExpr(tagExpr.parseTagExpr());
	}

});

//------------------------------------

merge(Tiddler.prototype,{

	render: function(method,renderOptions) {
		return this["render_"+method](renderOptions);
	},

	renderUtil: function(formatString,formatValues) {
		return formatString.format(formatValues);
	},

	sorter: function(field) {
		var sortMethod = "sort_"+field;
		if (this[sortMethod])
			return this[sortMethod]();
		else
			return this[field];
	},

	sorterUtil: function(otherTiddler,method) {
		var desc = false;

		if (method.substring(0,1) == "-") {
			desc = true;
			method = method.substring(1);
		}

		if (this.sorter(method) > otherTiddler.sorter(method))
			return (desc ? -1 : +1);
		else if (this.sorter(method) < otherTiddler.sorter(method))
			return (desc ? +1 : -1);
		else
			return 0;
	}

});

merge(String.prototype,{
	sorterUtil: function(otherTiddler,method) {

		var t1 = store.getTiddler(this);
		var t2 = store.getTiddler(otherTiddler);

		if (t1 && t2)
			return t1.sorterUtil(t2,method);
		// this part is a little flakey but I'm aiming to
		// put the None heading last in all cases
		else if (t2)
			return +1;
		else if (t1)
			return -1;
		else
			return 0;
	}
});

//------------------------------------------

merge(Array.prototype,{

	// returns a hash
	groupBy_hash: function(func) {
		var result = {};
		var leftOverGroup = '__NONE__';
		this.each(function(item) {
			var groups = func(item);
			if (groups.length > 0) {
				groups.each(function(group) {
					if (!result[group])
						result[group] = [];
					result[group].push(item);
				});
			}
			else {
				if (!result[leftOverGroup])
					result[leftOverGroup] = [];
				result[leftOverGroup].push(item);
			}
		});
		return result;
	},

	// returns an array of arrays, like Hash#sort in ruby
	groupBy: function(func,itemSort,groupSort) {

		if (!itemSort) itemSort = "title";
		if (!groupSort) groupSort = "-title";

		var result = this.groupBy_hash(func);
		var sortedResult = [];
		for (var g in result)
			sortedResult.push([g,result[g].sort(function(a,b){return a.sorterUtil(b,itemSort);})]);
		return sortedResult.sort(function(a,b){return a[0].sorterUtil(b[0],groupSort);});
	},

	// for convenience since it's mostly what we want
	groupByTag: function(tag,itemSort,groupSort) {
		return this.groupBy(function(t){return t.getByIndex(tag);},itemSort,groupSort);
 	}

});

//------------------------------------------

// for lists of tiddlers
merge(Array.prototype,{
	
	filterByEval: function(evalExpr) {
		return this.select(function(t) {
			return t.matchesEvalExpr(evalExpr);
		});
	},

	filterByTagExpr: function(tagExpr) {
		return this.filterByEval(tagExpr.parseTagExpr());
	},

	filterGroupsByEval: function(evalExpr) {
		// presumes the group name is a tiddler
		return this.select(function(tGroup) {
			var tiddler = store.getTiddler(tGroup[0]);
			return tiddler && tiddler.matchesEvalExpr(evalExpr);
		});
	},

	filterGroupsByTagExpr: function(tagExpr) {
		return this.filterGroupsByEval(tagExpr.parseTagExpr());
	},

	render: function(renderMethod,renderOptions) {
		return this.map(function(tiddler){
			return tiddler.render(renderMethod,renderOptions);
		}).join("\n");
	},

	renderGrouped: function(listRenderMethod,headingRenderMethod,noneHeading,renderOptions,groupCountOnly) {
		// do I ever use renderOptions??
		// this lost some elegance when I shoehorned the groupCountOnly part in. todo refactor
		var result = "";
		this.each(function(g) {
			var groupName = g[0];
			var groupItems = g[1];

			var showCount = "";
			if (groupCountOnly && groupCountOnly != "")
				showCount = groupItems.length > 0 ? " ("+groupItems.length+")" : "";

			var makeHeading = (groupCountOnly&&groupCountOnly!="") ? "" : "!!";
			if (groupName == "__NONE__") {
				result = result + makeHeading + "[[("+(noneHeading?noneHeading:"No "+headingRenderMethod)+")]]"+showCount+"\n";
			}
			else {
				var gTiddler = store.getTiddler(groupName);
				if (gTiddler) {
					result = result + makeHeading+gTiddler.render(headingRenderMethod)+showCount+"\n";
				}
				else {
					result = result + makeHeading+"[["+groupName+"]]"+showCount+"\n";
				}
			}
			if (!groupCountOnly || groupCountOnly == "")
				result = result + groupItems.render(listRenderMethod,renderOptions) + "\n";
		});
			
		if (groupCountOnly && groupCountOnly != "")
			result = result.replace(/\n$/,''); // hack. remove trailing linefeed

		return result;
	},

	tiddlerSort: function(sortBy) {
		return this.sort(function(a,b) { return a.sorterUtil(b,sortBy); });
	}

});

//------------------------------------------


		
config.options.txtTheme = 'MonkeyGTDTheme';

if (!config.mGTD) config.mGTD = {};

config.mGTD.specialTags = [
		"Action",
		"Project",
		"Area",
		"Realm",
		"Context",
		"View"
]
config.mGTD.tagsToIndex = [
		"Project",
		"Area",
		"Realm",
		"Context",
		"ActionStatus",
		"ProjectStatus",
		"GTDComponent", // ??
		"Sidebar"
];

config.indexedTags = {

	// will be populated with our tag lists
	tagLists: {},

	// will be populated with our tag indexes
	indexes: {},

	// will be populated with the tags that need indexing
	tagsToIndex: [],

	saveTiddlerHijack: function(title,newTitle,newBody,modifier,modified,tags,fields) {
		var before = store.getTiddler(title);
		var oldTags = before ? [].concat(before.tags) : null;  // concat so we get a dup

		store.suspendNotifications();
		var result = this.saveTiddler_orig_indexedTags(title,newTitle,newBody,modifier,modified,tags,fields);
		var newTags = store.getTiddler(newTitle).tags;

		config.indexedTags.updateTagLists(title,oldTags,newTitle,newTags);
		config.indexedTags.updateIndexes(title,newTitle,newTags);

		store.resumeNotifications();
		store.notify(title,true);

		return result;
	},

	removeTiddlerHijack: function(title) {
		var before = store.getTiddler(title);
		var oldTags = before ? [].concat(before.tags) : null;  // concat so we get a dup

		store.suspendNotifications();
		this.removeTiddler_orig_indexedTags(title);

		config.indexedTags.updateTagLists(title,oldTags);
		config.indexedTags.updateIndexes(title);

		store.resumeNotifications();
		store.notify(title,true);
	},

	setTiddlerTagHijack: function(title,status,tag) {
		var before = store.getTiddler(title);
		var oldTags = before ? [].concat(before.tags) : null;  // concat so we get a dup

		store.suspendNotifications();
		this.setTiddlerTag_orig_indexedTags(title,status,tag);

		var after = store.getTiddler(title);
		var newTags = after ? after.tags : null;

		config.indexedTags.updateTagLists(title,oldTags,title,newTags);
		config.indexedTags.updateIndexes(title,title,newTags);

		store.resumeNotifications();
		store.notify(title,true);

	},

	updateTagLists: function(title,oldTags,newTitle,newTags) {
		if (oldTags)
			oldTags.each(function(tagName) {
				config.indexedTags.tagLists[tagName].remove(title);
			});
		if (newTags)
			newTags.each(function(tagName) {
				if (!config.indexedTags.tagLists[tagName])
					config.indexedTags.tagLists[tagName] = [];
				config.indexedTags.tagLists[tagName].pushUnique(newTitle);
			});
	},

	updateIndexes: function(title,newTitle,newTags) {
		delete config.indexedTags.indexes[title];
		if (newTags) {
			config.indexedTags.indexes[newTitle] = {};
			config.indexedTags.tagsToIndex.each(function(tagToIndex) {
				config.indexedTags.indexes[newTitle][tagToIndex] = [];
				newTags.each(function(tag) {
					if (config.indexedTags.tagLists[tagToIndex] && config.indexedTags.tagLists[tagToIndex].contains(tag)) {
						config.indexedTags.indexes[newTitle][tagToIndex].pushUnique(tag);
					}
				});
			});
		}
	},

	initTagLists: function() {
		store.getTags().map(function(pair) { return pair[0]; }).each(function(t) {
			config.indexedTags.tagLists[t] = store.getTaggedTiddlers(t).map(function(tt) { return tt.title; });
		});
	},

	initIndexes: function() {
		store.forEachTiddler(function(title,tiddler) {
			config.indexedTags.updateIndexes(title,title,tiddler.tags);
		});
	},

	dump: function() {
		alert(this.indexes["Buy petrol for mower"]["Project"]);
		alert(this.indexes["Buy petrol for mower"]["Realm"]);
	},

	tiddlerMethods: {
		getByIndex: function(tag) {
			return config.indexedTags.indexes[this.title][tag];
		},

		hasActiveProject: function() {
			var projs = this.getByIndex("Project");

			if (projs.length == 0)
				// no project but we will say it's active
				// because otherwise it will not show up anywhere
				return true;

			for (var i=0;i<projs.length;i++)
				if (
					(config.indexedTags.indexes[projs[i]]['ProjectStatus'].contains('Active'))
					&&
					!store.fetchTiddler(projs[i]).tags.contains('Complete') // seems stupid
					)
					return true;
			return false;
		},

		hasNextAction: function() {
			var children = fastTagged(this.title).filterByTagExpr('Action && !Done && (Next || [(Waiting For)])');
			return children.length > 0;
		}
	},

	globalMethods: {
		fastTagged: function(tag) {
			var list = config.indexedTags.tagLists[tag];
			return (list?list:[]).map(function(t){return store.getTiddler(t);});
		}
	},

	init: function(tagsToIndex) {

		merge(window,this.globalMethods);
		merge(Tiddler.prototype,this.tiddlerMethods);

		this.tagsToIndex = tagsToIndex;
		this.initTagLists();
		this.initIndexes();

		TiddlyWiki.prototype.saveTiddler_orig_indexedTags = TiddlyWiki.prototype.saveTiddler;
		TiddlyWiki.prototype.removeTiddler_orig_indexedTags = TiddlyWiki.prototype.removeTiddler;
		TiddlyWiki.prototype.setTiddlerTag_orig_indexedTags = TiddlyWiki.prototype.setTiddlerTag;
		TiddlyWiki.prototype.saveTiddler = this.saveTiddlerHijack;
		TiddlyWiki.prototype.removeTiddler = this.removeTiddlerHijack;
		TiddlyWiki.prototype.setTiddlerTag = this.setTiddlerTagHijack;

	}
};

config.indexedTags.init(config.mGTD.tagsToIndex);
merge(config.macros,{

	mgtdList: {

		getActiveRealms: function() {
			return store.fetchTiddler("MgtdSettings").getByIndex("Realm");
		},

		getRealm: function() {
			// decide which one to use if multiple realms are active
			// use a slice to get the realm priority and choose the highest one
			var active = config.macros.mgtdList.getActiveRealms();
			if (active.length == 1) {
				return active[0];
			}
			else {
				// TODO, make this prettier
				var toBeat = "zzzzzzz";
				var soFar = active[0];
				for (var i=0;i<active.length;i++) {
					var pri = store.getTiddlerSlice(active[i],"priority");
					if (pri && pri < toBeat) {
						toBeat = pri;
						soFar = active[i];
					}
				}
				return soFar;
			}
		},

		handler: function (place,macroName,params,wikifier,paramString,tiddler) {
			var pp = paramString.parseParams("tags",null,true);

			// title of the list
			var title = getParam(pp,"title","");

			// local means only look at tiddlers tagged with this tiddler
			// global means look at every tiddler
			var tagMode = getParam(pp,"mode","local");

			// optional. ignored unless mode global. specify for speed gains
			var startTag = getParam(pp,"startTag");

			// eg, "Next && !Done"
			var tagExpr = getParam(pp,"tags","");

			// additional filter. gets eval'ed
			var whereExpr = getParam(pp,"where","");

			// group by another tag
			var groupBy = getParam(pp,"group","");

			// group by count only mode
			var groupCountOnly = getParam(pp,"groupCountOnly","");

			// filter the groups by tag expr
			var gTagExpr = getParam(pp,"gTag","");

			// or eval'ed expression
			var gWhereExpr = getParam(pp,"gWhere","");

			// how to render list items
			var viewType = getParam(pp,"view","plain");

			// how to render headings
			var gViewType = getParam(pp,"gView",groupBy);

			// if there are tiddlers who aren't grouped then give them this title
			// mainly used to label future actions...
			var leftoverTitle = getParam(pp,"leftoverTitle","No "+groupBy);

			// if set to "yes" then we ignore the realm and show everthing
			var ignoreRealm = getParam(pp, "ignoreRealm","");

			// sort items
			var sortBy = getParam(pp,"sort","title");

			// sort groups
			var gSortBy = getParam(pp,"gSort","title");

			// new button
			var newButton = getParam(pp,"newButton","");

			if (!startTag)
				if (tagMode != "global")
					startTag = tiddler.title;

			var listRefreshContainer = createTiddlyElement(place,"div");

			// TODO one big attribute?
			listRefreshContainer.setAttribute("refresh","macro");
			listRefreshContainer.setAttribute("macroName",macroName);

			listRefreshContainer.setAttribute("title",title);
			listRefreshContainer.setAttribute("startTag",startTag);
			listRefreshContainer.setAttribute("tagMode",tagMode);
			listRefreshContainer.setAttribute("tagExpr",tagExpr);
			listRefreshContainer.setAttribute("groupBy",groupBy);
			listRefreshContainer.setAttribute("groupCountOnly",groupCountOnly);
			listRefreshContainer.setAttribute("gTagExpr",gTagExpr);
			listRefreshContainer.setAttribute("whereExpr",whereExpr);
			listRefreshContainer.setAttribute("gWhereExpr",gWhereExpr);
			listRefreshContainer.setAttribute("sortBy",sortBy);
			listRefreshContainer.setAttribute("gSortBy",gSortBy);
			listRefreshContainer.setAttribute("viewType",viewType);
			listRefreshContainer.setAttribute("gViewType",gViewType);
			listRefreshContainer.setAttribute("ignoreRealm",ignoreRealm);
			listRefreshContainer.setAttribute("leftoverTitle",leftoverTitle);
			listRefreshContainer.setAttribute("newButton",newButton);

			this.refresh(listRefreshContainer);
		},

		refresh: function(place) {

			removeChildren(place);

			var title = place.getAttribute("title");
			var startTag = place.getAttribute("startTag");
			var tagMode = place.getAttribute("tagMode");
			var tagExpr = place.getAttribute("tagExpr");
			var groupBy = place.getAttribute("groupBy");
			var groupCountOnly = place.getAttribute("groupCountOnly");
			var gTagExpr = place.getAttribute("gTagExpr");
			var whereExpr = place.getAttribute("whereExpr");
			var gWhereExpr = place.getAttribute("gWhereExpr");
			var sortBy = place.getAttribute("sortBy");
			var gSortBy = place.getAttribute("gSortBy");
			var viewType = place.getAttribute("viewType");
			var gViewType = place.getAttribute("gViewType");
			var ignoreRealm = place.getAttribute("ignoreRealm");
			var leftoverTitle = place.getAttribute("leftoverTitle");
			var newButton = place.getAttribute("newButton");

			var wikifyThis = "";

			wikifyThis += "{{mgtdList{\n";

            if (title != "")
			    wikifyThis += "!"+title

			if (newButton != "") {
				var newButtonParams = newButton.readBracketedList();
				var newButtonTiddler = newButtonParams[0];
				newButtonParams.shift();
				var newButtonArgs = newButtonParams.map(function(a){return "[["+a+"]]";}).join(" "); //a better way to create bracketed list?
				// put the realm in here... not sure if it's a good idea
				wikifyThis += " <<tiddler "+newButtonTiddler+" with:[["+config.macros.mgtdList.getRealm()+"]] "+newButtonArgs+">>";
			}

            if (title != "" || newButton != "")
			    wikifyThis += "\n";

			wikifyThis += "{{innerList{\n";

			var checkForContent = wikifyThis;

			var theList = fastTagged(startTag);
			if (tagExpr != "") theList = theList.filterByTagExpr(tagExpr);
			if (whereExpr != "") theList = theList.filterByEval(whereExpr);

			if (ignoreRealm != "yes") {
				var activeRealms = config.macros.mgtdList.getActiveRealms();
				theList = theList.select(function(t) {
					var realm = t.getByIndex("Realm");
					return (
						realm.length == 0 ||  // so something with no realm shows up
						realm.containsAny(activeRealms)
					);
				});
			}

            if (groupBy == "day") {
                // experimental. changing a tag doesn't update modified so
                // this isn't as useful
                theList = theList.groupBy(function(t){return [t.modified.formatString('YYYY-0MM-0DD')];});
				wikifyThis += theList.renderGrouped(viewType,gViewType,leftoverTitle);
            }
			else if (groupBy != "") {
				theList = theList.groupByTag(groupBy,sortBy,gSortBy);
				if (gTagExpr != "") theList = theList.filterGroupsByTagExpr(gTagExpr);
				if (gWhereExpr != "") theList = theList.filterGroupsByEval(gWhereExpr);
				wikifyThis += theList.renderGrouped(viewType,gViewType,leftoverTitle,null,groupCountOnly);
			}
			else {
				theList = theList.tiddlerSort(sortBy);
				wikifyThis += theList.render(viewType);
			}

			if (wikifyThis == checkForContent)
				wikifyThis += "{{none{none}}}";

			wikifyThis += "}}}\n";
			wikifyThis += "}}}\n";

			wikify(wikifyThis,place,null,tiddler);

			forceReflow();

		}
	}

});


// requires MgtdIndexedTags for the fastTagged and getByIndex methods

merge(Tiddler.prototype,{

	setTagFromGroup: function(tagGroup,tag) {
		var tagList = fastTagged(tagGroup);
		for (var i=0;i<tagList.length;i++) {
			// trying to speed this up by not using setTiddlerTag
			this.tags.remove(tagList[i].title);
		}
		// now use it. triggers notify
		if (tag)
			store.setTiddlerTag(this.title,true,tag);
		else 
			store.setTiddlerTag(this.title,false,"blah"); // just so there's at least one notify
	},

	toggleTag: function(tag) {
		store.setTiddlerTag(this.title,!this.hasTag(tag),tag);
	},

	hasTag: function(tag) {
		return this.tags.contains(tag);
	}

});

merge(config.macros,{
	
	singleToggleTag: {

		handler: function(place,macroName,params,wikifier,paramString,tiddler) {

			var pp = paramString.parseParams("tag",null,true);
			
			if (!tiddler)
				tiddler = store.getTiddler(getParam(pp,"title"));
			
			var tag = getParam(pp,"tag");
			var t = store.fetchTiddler(tag);

			var title = getParam(pp,"title",tiddler.title);


			var actOnTiddler = store.getTiddler(title);

			var label = store.getTiddlerSlice(t.title,"button");
			var labelOff = store.getTiddlerSlice(t.title,"buttonOff");

			// dreadful hack
			if (tag == "Starred")
				label = "\u2605";

			var autoClass = "button " + t.title.replace(/[\/ ]/g,'') 

			if (!label) label = t.title;
			if (!labelOff) labelOff = label;


			var curState = actOnTiddler.hasTag(tag);

			var cl = createTiddlyButton(place, curState?label:labelOff, t.title, function(e) {
					actOnTiddler.toggleTag(tag);
					return false;
				},
				autoClass + " " + (curState ? "on" : "off")
				);
		}
		
	},

	groupOfSingleToggleTags: {

		handler: function(place,macroName,params,wikifier,paramString,tiddler) {

			var pp = paramString.parseParams("tag",null,true);
			
			if (!tiddler)
				tiddler = store.getTiddler(getParam(pp,"title"));
			
			var tag = getParam(pp,"tag");

			var title = getParam(pp,"title",tiddler.title);
			var refresh = getParam(pp,"refresh"); // stupid bit for pagetemplate hack

			var actOnTiddler = store.getTiddler(title);

			var getValues = fastTagged(tag).sort(function(a,b){
				return a.sorterUtil(b,"orderSlice");
			});

			getValues.each(function(t) {

				var label = store.getTiddlerSlice(t.title,"button");
				var autoClass = "button " + t.title.replace(/[\/ ]/g,'') 
				if (!label) label = t.title;
				var cl = createTiddlyButton(place, label, t.title, function(e) {
						actOnTiddler.toggleTag(t.title);
						if (refresh == "page")
							refreshPageTemplate();
						return false;
					},
					autoClass + " " + (actOnTiddler.getByIndex(tag).contains(t.title) ? "on" : "off")
					);
			 });
		}
		
	},

	multiToggleTag: {

		handler: function(place,macroName,params,wikifier,paramString,tiddler) {

			var pp = paramString.parseParams("tag",null,true);
			
			if (!tiddler)
				tiddler = store.getTiddler(getParam(pp,"title"));
			
			var tag = getParam(pp,"tag");

			var refresh = getParam(pp,"refresh"); // stupid bit for pagetemplate hack
			var longVersion = getParam(pp,"longVersion");

			var title = getParam(pp,"title",tiddler.title);
			var actOnTiddler = store.getTiddler(title);

			var getValues = fastTagged(tag).sort(function(a,b){
				return a.sorterUtil(b,"orderSlice");
			});


			getValues.each(function(t) {
				var label = store.getTiddlerSlice(t.title,longVersion?"buttonLong":"button");

				var extraClass = store.getTiddlerSlice(t.title,"buttonClass");
				var autoClass = (extraClass ? extraClass : "") + " button " + t.title.replace(/[\/ ]/g,'') 
				if (!label) label = t.title;
				var cl = createTiddlyButton(place, label, t.title, function(e) {
						actOnTiddler.setTagFromGroup(tag,t.title);
						if (refresh == "page")
							refreshPageTemplate();
						return false;
					},
					autoClass + " " + (actOnTiddler.getByIndex(tag).contains(t.title) ? "on" : "off")
					);
			});

		}
	},

	multiSelectTag: {

		handler: function(place,macroName,params,wikifier,paramString,tiddler) {

			var pp = paramString.parseParams("tag",null,true);
			
			if (!tiddler)
				tiddler = store.getTiddler(getParam(pp,"title"));
			
			var tag = getParam(pp,"tag");
			var refresh = getParam(pp,"refresh"); // stupid bit for pagetemplate hack

			var allowNone = getParam(pp,"allowNone");

			var title = getParam(pp,"title",tiddler.title);
			var actOnTiddler = store.getTiddler(title);

			var selectOptions = [];

			if (allowNone)
				selectOptions.push({name: null, caption:'-'});// TODO this doesn't work right?

			var getValues = fastTagged(tag).sort(function(a,b){
				return a.sorterUtil(b,"orderSlice");
			});

			getValues.each(function(t) {
				var useTitle = store.getTiddlerSlice(t.title,"button");
				if (!useTitle) useTitle = t.title;
				selectOptions.push({name: t.title, caption:useTitle});
			});

			var dd = createTiddlyDropDown(place, function(e) {
					actOnTiddler.setTagFromGroup(
						tag,
						selectOptions[this.selectedIndex].name
						);
					if (refresh == "page")
						refreshPageTemplate();
					return false;
				},
				selectOptions,
				actOnTiddler.getByIndex(tag)[0]
			);

		}
	},

	multiCheckboxTag: {

		handler: function(place,macroName,params,wikifier,paramString,tiddler) {

			var pp = paramString.parseParams("tag",null,true);
			
			if (!tiddler)
				tiddler = store.getTiddler(getParam(pp,"title"));
			
			var tag = getParam(pp,"tag");

			var title = getParam(pp,"title",tiddler.title);
			var actOnTiddler = store.getTiddler(title);

			var getValues = fastTagged(tag).sort(function(a,b){
				return a.sorterUtil(b,"orderSlice");
			});

			var output = "";
			getValues.each(function(t) {
				output += "<<toggleTag [[%0]] [[%1]] [[%0]]>>".format([
					t.title,
					actOnTiddler.title
				]);
			});

			wikify(output,place,null,tiddler);

		}
	}

});

setStylesheet(["",
".button.off {font-weight:bold;border-color:#eee;background:#fff;color:#ccc;margin:0px;font-size:110%}",
".button.on {font-weight:bold;border-color:#444;background:#888;color:#fff;margin:0px;font-size:110%}",
".button.tiny { font-size:75%; }",
// TODO move this css elsewhere
"#realmSelector .button.off {margin:0 0.5em;padding:0 1em;border:2px solid #aaa;background:#eee;color:#333;}", // actually reversed, ie off is "on"
"#realmSelector .button.on {margin:0 0.5em;padding:0 1em;border:2px solid #999;background:#999;color:#ccc;}", // actually reversed, ie off is "on"

// temporary
".viewer .Next.button.on {border-color:#55c;background:#cfa;color:#4a4;}",
".viewer .WaitingFor.button.on {border-color:#b84;background:#fdb;color:#b84;}",
".viewer .Future.button.on {border-color:#48b;background:#bdf;color:#48b;}",

".viewer .Active.button.on {border-color:#55c;background:#cfa;color:#4a4;}",
".viewer .SomedayMaybe.button.on {border-color:#48b;background:#bdf;color:#48b;}",

".viewer .Starred.button {padding:0;font-size:170%;}",
".viewer .Starred.button.on {border-color:#fff;background:#fff;color:#f80;}",
".viewer .Starred.button.off {border-color:#fff;background:#fff;color:#ddd;}",

""].join("\n"),"tTag");

//}}}




|Name|MonkeyGTD|
|Description|MonkeyGTD Theme|
|PageTemplate|MonkeyGTDTheme##PageTemplate|
|StyleSheet|MonkeyGTDTheme##StyleSheet|
|ViewTemplate|MonkeyGTDTheme##ViewTemplate|
|EditTemplate|MptwTheme##EditTemplate|

!ViewTemplate
<!--{{{-->
<div macro="showWhen tiddler.tags.containsAny(config.mGTD.specialTags)">
	[[MptwTheme##ViewTemplateToolbar]]
	<div class='titleContainer viewer'>[[TitleButtonsSelector]]</div>
	[[MonkeyGTDTheme##Panel]]
	<div macro="showWhen tiddler.text != ''">
		<div class='viewer'>Notes:</div>
		<div class='viewer postityellow' macro='view text wikified'></div>
	</div>
	<div class='viewer'>[[DashboardSelector]]</div>
</div>
<div macro="hideWhen tiddler.tags.containsAny(config.mGTD.specialTags)">
	<!--- use standard template for non gtd tiddlers --->
	[[MptwTheme##ViewTemplate]]
</div>
<!--}}}-->

!Panel
<!--{{{-->
<!--- nothing as yet? --->
<!--}}}-->

!Dashboard
<!--{{{-->
<div macro="showWhenTagged Project" class="viewer"          >[[Dashboards##Project]]</div>
<div macro="showWhenTagged Area" class="viewer"             >[[Dashboards##Area]]</div>
<div macro="showWhenTagged Realm" class="viewer"            >[[Dashboards##Realm]]</div>
<div macro="showWhenTagged Context" class="viewer"          >[[Dashboards##Context]]</div>

<div macro="showWhenTitleIs 'Action Dashboard'"             >[[Dashboards##Action Dashboard]]</div>
<div macro="showWhenTitleIs 'Action Dashboard by Context'"  >[[Dashboards##Action Dashboard by Context]]</div>
<div macro="showWhenTitleIs 'Just Next Actions'"            >[[Dashboards##Just Next Actions]]</div>
<div macro="showWhenTitleIs 'Just Next Actions by Context'" >[[Dashboards##Just Next Actions by Context]]</div>
<div macro="showWhenTitleIs 'Projects'"                     >[[Dashboards##Projects]]</div>
<!--- many more. but fix DRY issues --->
<!--}}}-->

!Subtitle
<span class='subtitle'>
	Updated
	<span macro='view modified date {{config.mptwDateFormat?config.mptwDateFormat:"MM/0DD/YY"}}'></span>
	(<span macro='message views.wikified.createdPrompt'></span>
	<span macro='view created date {{config.mptwDateFormat?config.mptwDateFormat:"MM/0DD/YY"}}'></span>)
</span>

!PageTemplate
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
	<div class='header2'>MonkeyGTD <span style="font-size:75%;font-weight:normal;">3.0</span></div>
</div>
<div macro='gradient vert [[ColorPalette::PrimaryMid]] [[ColorPalette::PrimaryDark]]'>
	<div class='mtoolbar'>
	<div style="float:right" id='sidebarSwitcher' macro="multiToggleTag title:MgtdSettings tag:Sidebar refresh:page"><span class="label">MENU</span></div>
	<div id='arealmSelector' macro="groupOfSingleToggleTags tag:Realm title:MgtdSettings refresh:page"><span class="label">REALM</span></div>
	</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>[[MonkeyGTDTheme##SidebarMenus]]</div>
<div id='displayArea'>
	<div id='messageArea'></div>
	<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->

!SidebarMenus
<!--{{{-->
<div id='twsidebar' macro="showWhen store.fetchTiddler('MgtdSettings').tags.contains('TW')">
	<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
	<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='twsidebar' macro="hideWhen store.fetchTiddler('MgtdSettings').tags.contains('TW')">
	<div id='sidebarOptions' refresh='content' tiddler='CommonMenu'></div>
</div>
<div id='monkeygtdsidebar' macro="showWhen store.fetchTiddler('MgtdSettings').tags.contains('Do Work')">
	<div class="menu" refresh='content' tiddler='DoWorkMenu'></div>
</div>
<div id='monkeygtdsidebar' macro="showWhen store.fetchTiddler('MgtdSettings').tags.contains('Review')">
	<div class='menu' refresh='content' tiddler='ReviewMenu'></div>
</div>
<div id='monkeygtdsidebar' macro="showWhen store.fetchTiddler('MgtdSettings').tags.contains('Process Inbox')">
	<div class='menu' refresh='content' tiddler='ProcessInboxMenu'></div>
</div>
<div id='monkeygtdsidebar' macro="showWhen store.fetchTiddler('MgtdSettings').tags.contains('Collect Items')">
	<div class='menu' refresh='content' tiddler='CollectItemsMenu'></div>
</div>
<div id='monkeygtdsidebar' macro="showWhen store.fetchTiddler('MgtdSettings').tags.contains('Config')">
	<div class='menu' refresh='content' tiddler='ConfigMenu'></div>
</div>
<!--}}}-->

!StyleSheet
/*{{{*/

[[MptwTheme##StyleSheet]]

.header2 {
	background:url(http://simonbaird.com/images/monkeygtd/logo-trans.gif) no-repeat -15px 2px transparent;
	padding:5px;
	padding-left:80px;
	color:white;
	font-size:1.3em;
	font-weight:bold;
}

#backstageShow { color:[[ColorPalette::PrimaryLight]] ! important; }

/* the png is superior due to alpha transparency. stupid IE */
html>body .header2 {background-image:url(http://simonbaird.com/images/monkeygtd/logo-trans.png)}

.headerShadow, .headerForeground {
	padding:0;
}

.mtoolbar { padding:0.1em; padding-top:0.5em;}
.mtoolbar .button { margin-left:0.5em; padding:0.2em 0.3em; margin:0.2em 0.3em;  }
.mtoolbar .button.off {background-color:[[ColorPalette::TertiaryMid]]!important; color:black; font-weight:normal;border-color:[[ColorPalette::PrimaryDark]];}
.mtoolbar .button.on {background-color:[[ColorPalette::TertiaryLight]]; color:black; border-color:[[ColorPalette::PrimaryDark]];} 

.mtoolbar .label { font-size:80%; color:white; padding:0.5em;}

#displayArea {
	margin: 1em 15.7em 0em 1em; /* use the freed up space */
}

#sidebar, #sidebarOptions
	width:18em;
}

#sidebarTabs {
	width:100%;
}

#mainMenu { display:none; }

#sidebar .menu a {
	font-size:140%;
}

#sidebar .menu ul {
	padding-left:2em;
	padding-top:0;
	margin-top:0;
}
#sidebar .menu h1,
#sidebar .menu h2
{
	color:[[ColorPalette::PrimaryDark]];
	background-color:[[ColorPalette::TertiaryLight]];
	margin:0;
	padding:0;
	margin-top:0.25em;
}
#sidebar .menu h1 {
	font-size:180%;
}
#sidebar .menu h2 {
	font-size:140%;
	margin-left:0.5em;
}


.viewer table {
	border-style:none ! important;
	border-collapse:no-collapse;
	width:100%;
	padding:0; margin:0;
}

.viewer table td {
	border-style:none ! important;
	width:50%;
	vertical-align:top;
	padding-right:1em;
}

.viewer table tr {
	border-style:none ! important;
}

.viewer table.twocol td {
	width:50%;
}
.viewer table.threecol td {
	width:33%;
}


.mgtdList h1 {
	border-bottom:1px solid #aaa;
	color:#444;
	font-size:110%;
	margin:0;
	padding:0;
}

.mgtdList h1 br {
	display:none;
}

.mgtdList h1 .button {
	border-color:transparent;
	font-weight:bold;
	font-size:110%;
}

.mgtdList h1 .button:hover {
	border-color:#999;
}

.mgtdList h2 {
	border-style:none!important;
	font-size:120%;
	margin:0; padding:0;
	margin-top:0.7em;
	margin-left:-0.2em;
	color:#444;
}

.mgtdList {
	padding:0;
	padding-right:1em;
}

.mgtdList .innerList {
	padding:0.5em 1em 0em 1em;
}

.mgtdList .action .tiddlyLinkExisting {
	font-weight: normal ! important;
}

.mgtdList .action .tiddlyLink {
	font-weight: normal ! important;
}

.mgtdList .button {
	font-weight: normal;
	margin:1px;
}

body {
	background: [[ColorPalette::TertiaryLight]];
}

.title { font-size:150%; color:black; }

#monkeygtdsidebar h1 {
	font-size:120%; color:green;
}

.none { color:[[ColorPalette::TertiaryMid]]; font-size:90%; font-style:italic; }

.postityellow {
	background-color:#ffa;
	border:2px solid #dd8;
	padding-left:1em;
	padding-bottom:0.5em;
}
.postityellow h1,
.postityellow h2,
.postityellow h3,
.postityellow h4
{
	background-color:#ffa;
	border-style:none;
}

#sidebar .sliderButton { font-weight:bold; padding-left:0.25em; }
#sidebar .sliderPanel ul { margin-bottom:0px; }
#sidebar .sliderPanel li { font-weight:medium; font-size:90%; }

#sidebar .mgtdList .innerList .tiddlyLink {
	font-size:120%;
}

/* for user styles */
[[StyleSheet]]

/*}}}*/



Name: MptwBlack
Background: #000
Foreground: #fff
PrimaryPale: #333
PrimaryLight: #555
PrimaryMid: #888
PrimaryDark: #aaa
SecondaryPale: #111
SecondaryLight: #222
SecondaryMid: #555
SecondaryDark: #888
TertiaryPale: #222
TertiaryLight: #666
TertiaryMid: #888
TertiaryDark: #aaa
Error: #300

This is in progress. Help appreciated.


Name: MptwBlue
Background: #fff
Foreground: #000
PrimaryPale: #cdf
PrimaryLight: #57c
PrimaryMid: #114
PrimaryDark: #012
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88

/***
|Name:|MptwConfigPlugin|
|Description:|Miscellaneous tweaks used by MPTW|
|Version:|1.0 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#MptwConfigPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#MptwConfigPlugin|
!!Note: instead of editing this you should put overrides in MptwUserConfigPlugin
***/
//{{{
var originalReadOnly = readOnly;
config.options.chkHttpReadOnly = false; // means web visitors can experiment with your site by clicking edit
readOnly = false;						// needed because the above doesn't work any more post 2.1 (??)
config.options.chkInsertTabs = true;    // tab inserts a tab when editing a tiddler
config.views.wikified.defaultText = ""; // don't need message when a tiddler doesn't exist
config.views.editor.defaultText = "";   // don't need message when creating a new tiddler 

config.mptwVersion = "2.3.2";

config.macros.mptwVersion={handler:function(place){wikify(config.mptwVersion,place);}};

if (config.options.txtTheme == '')
	config.options.txtTheme = 'MptwTheme';

// add to default GettingStarted
config.shadowTiddlers.GettingStarted += "\n\nSee also [[MPTW]].";

// add select theme and palette controls in default OptionsPanel
config.shadowTiddlers.OptionsPanel = config.shadowTiddlers.OptionsPanel.replace(/(\n\-\-\-\-\nAlso see AdvancedOptions)/, "{{select{<<selectTheme>>\n<<selectPalette>>}}}$1");

// these are used by ViewTemplate
config.mptwDateFormat = 'DD/MM/YY';
config.mptwJournalFormat = 'Journal DD/MM/YY';

//}}}
Name: MptwGreen
Background: #fff
Foreground: #000
PrimaryPale: #9b9
PrimaryLight: #385
PrimaryMid: #031
PrimaryDark: #020
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88

Name: MptwRed
Background: #fff
Foreground: #000
PrimaryPale: #eaa
PrimaryLight: #c55
PrimaryMid: #711
PrimaryDark: #500
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88

|Name|MptwRounded|
|Description|Mptw Theme with the default TiddlyWiki PageLayout|
|ViewTemplate|MptwTheme##ViewTemplate|
|EditTemplate|MptwTheme##EditTemplate|
|PageTemplate|MptwTheme##PageTemplate|
|StyleSheet|MptwRoundTheme##StyleSheet|

!StyleSheet
/*{{{*/

[[MptwTheme##StyleSheet]]

.tiddler,
.sliderPanel,
.button,
.tiddlyLink,
.tabContents
{ -moz-border-radius: 1em; }

.tab {
	-moz-border-radius-topleft: 0.5em;
	-moz-border-radius-topright: 0.5em;
}
#topMenu {
	-moz-border-radius-bottomleft: 2em;
	-moz-border-radius-bottomright: 2em;
}

/*}}}*/

Name: MptwSmoke
Background: #fff
Foreground: #000
PrimaryPale: #aaa
PrimaryLight: #777
PrimaryMid: #111
PrimaryDark: #000
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88

|Name|MptwStandard|
|Description|Mptw Theme with the default TiddlyWiki PageLayout|
|ViewTemplate|MptwTheme##ViewTemplate|
|EditTemplate|MptwTheme##EditTemplate|
Name: MptwTeal
Background: #fff
Foreground: #000
PrimaryPale: #B5D1DF
PrimaryLight: #618FA9
PrimaryMid: #1a3844
PrimaryDark: #000
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #f8f8f8
TertiaryLight: #bbb
TertiaryMid: #999
TertiaryDark: #888
Error: #f88
|Name|MptwTheme|
|Description|Mptw Theme including custom PageLayout|
|PageTemplate|MptwTheme##PageTemplate|
|ViewTemplate|MptwTheme##ViewTemplate|
|EditTemplate|MptwTheme##EditTemplate|
|StyleSheet|MptwTheme##StyleSheet|

http://mptw.tiddlyspot.com/#MptwTheme ($Rev: 1829 $)

!PageTemplate
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
	<div class='headerShadow'>
		<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
		<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
	</div>
	<div class='headerForeground'>
		<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
		<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
	</div>
</div>
<!-- horizontal MainMenu -->
<div id='topMenu' refresh='content' tiddler='MainMenu'></div>
<!-- original MainMenu menu -->
<!-- <div id='mainMenu' refresh='content' tiddler='MainMenu'></div> -->
<div id='sidebar'>
	<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
	<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
	<div id='messageArea'></div>
	<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->

!ViewTemplate
<!--{{{-->
[[MptwTheme##ViewTemplateToolbar]]

<div class="tagglyTagged" macro="tags"></div>

<div class='titleContainer'>
	<span class='title' macro='view title'></span>
	<span macro="miniTag"></span>
</div>

<div class='subtitle'>
	(updated <span macro='view modified date {{config.mptwDateFormat?config.mptwDateFormat:"MM/0DD/YY"}}'></span>
	by <span macro='view modifier link'></span>)
	<!--
	(<span macro='message views.wikified.createdPrompt'></span>
	<span macro='view created date {{config.mptwDateFormat?config.mptwDateFormat:"MM/0DD/YY"}}'></span>)
	-->
</div>

<div macro="showWhen tiddler.tags.containsAny(['css','html','pre','systemConfig']) && !tiddler.text.match('{{'+'{')">
	<div class='viewer'><pre macro='view text'></pre></div>
</div>
<div macro="else">
	<div class='viewer' macro='view text wikified'></div>
</div>

<div class="tagglyTagging" macro="tagglyTagging"></div>

<!--}}}-->

!ViewTemplateToolbar
<!--{{{-->
<div class='toolbar'>
	<span macro="showWhenTagged systemConfig">
		<span macro="toggleTag systemConfigDisable . '[[disable|systemConfigDisable]]'"></span>
	</span>
	<span macro="showWhenTagged systemTheme"><span macro="applyTheme"></span></span>
	<span macro="showWhenTagged systemPalette"><span macro="applyPalette"></span></span>
	<span macro="showWhen tiddler.tags.contains('css') || tiddler.title == 'StyleSheet'"><span macro="refreshAll"></span></span>
	<span style="padding:1em;"></span>
	<span macro='toolbar closeTiddler closeOthers +editTiddler deleteTiddler > fields syncing permalink references jump'></span> <span macro='newHere label:"new here"'></span>
	<span macro='newJournalHere {{config.mptwJournalFormat?config.mptwJournalFormat:"MM/0DD/YY"}}'></span>
</div>
<!--}}}-->

!EditTemplate
<!--{{{-->
<div class="toolbar" macro="toolbar +saveTiddler saveCloseTiddler closeOthers -cancelTiddler cancelCloseTiddler deleteTiddler"></div>
<div class="title" macro="view title"></div>
<div class="editLabel">Title</div><div class="editor" macro="edit title"></div>
<div macro='annotations'></div>
<div macro="showWhenExists EditPanelTemplate">[[EditPanelTemplate]]</div>
<div class="editLabel">Content</div><div class="editor" macro="edit text"></div>
<div class="editLabel">Tags</div><div class="editor" macro="edit tags"></div>
<div class="editorFooter"><span macro="message views.editor.tagPrompt"></span><span macro="tagChooser"></span></div>
<!--}}}-->

!StyleSheet
/*{{{*/

/* a contrasting background so I can see where one tiddler ends and the other begins */
body {
	background: [[ColorPalette::TertiaryLight]];
}

/* sexy colours and font for the header */
.headerForeground {
	color: [[ColorPalette::PrimaryPale]];
}
.headerShadow, .headerShadow a {
	color: [[ColorPalette::PrimaryMid]];
}

/* separate the top menu parts */
.headerForeground, .headerShadow {
	padding: 1em 1em 0;
}

.headerForeground, .headerShadow {
	font-family: 'Trebuchet MS' sans-serif;
	font-weight:bold;
}
.headerForeground .siteSubtitle {
	color: [[ColorPalette::PrimaryLight]];
}
.headerShadow .siteSubtitle {
	color: [[ColorPalette::PrimaryMid]];
}

/* make shadow go and down right instead of up and left */
.headerShadow {
	left: 1px;
	top: 1px;
}

/* prefer monospace for editing */
.editor textarea, .editor input {
	font-family: 'Consolas' monospace;
	background-color:[[ColorPalette::TertiaryPale]];
}


/* sexy tiddler titles */
.title {
	font-size: 250%;
	color: [[ColorPalette::PrimaryLight]];
	font-family: 'Trebuchet MS' sans-serif;
}

/* more subtle tiddler subtitle */
.subtitle {
	padding:0px;
	margin:0px;
	padding-left:1em;
	font-size: 90%;
	color: [[ColorPalette::TertiaryMid]];
}
.subtitle .tiddlyLink {
	color: [[ColorPalette::TertiaryMid]];
}

/* a little bit of extra whitespace */
.viewer {
	padding-bottom:3px;
}

/* don't want any background color for headings */
h1,h2,h3,h4,h5,h6 {
	background: [[ColorPalette::Background]];
	color: [[ColorPalette::Foreground]];
}

/* give tiddlers 3d style border and explicit background */
.tiddler {
	background: [[ColorPalette::Background]];
	border-right: 2px [[ColorPalette::TertiaryMid]] solid;
	border-bottom: 2px [[ColorPalette::TertiaryMid]] solid;
	margin-bottom: 1em;
	padding:1em 2em 2em 1.5em;
}

/* make options slider look nicer */
#sidebarOptions .sliderPanel {
	border:solid 1px [[ColorPalette::PrimaryLight]];
}

/* the borders look wrong with the body background */
#sidebar .button {
	border-style: none;
}

/* this means you can put line breaks in SidebarOptions for readability */
#sidebarOptions br {
	display:none;
}
/* undo the above in OptionsPanel */
#sidebarOptions .sliderPanel br {
	display:inline;
}

/* horizontal main menu stuff */
#displayArea {
	margin: 1em 15.7em 0em 1em; /* use the freed up space */
}
#topMenu br {
	display: none;
}
#topMenu {
	background: [[ColorPalette::PrimaryMid]];
	color:[[ColorPalette::PrimaryPale]];
}
#topMenu {
	padding:2px;
}
#topMenu .button, #topMenu .tiddlyLink, #topMenu a {
	margin-left: 0.5em;
	margin-right: 0.5em;
	padding-left: 3px;
	padding-right: 3px;
	color: [[ColorPalette::PrimaryPale]];
	font-size: 115%;
}
#topMenu .button:hover, #topMenu .tiddlyLink:hover {
	background: [[ColorPalette::PrimaryDark]];
}

/* make 2.2 act like 2.1 with the invisible buttons */
.toolbar {
	visibility:hidden;
}
.selected .toolbar {
	visibility:visible;
}

/* experimental. this is a little borked in IE7 with the button 
 * borders but worth it I think for the extra screen realestate */
.toolbar { float:right; }

/* fix for TaggerPlugin. from sb56637. improved by FND */
.popup li .tagger a {
   display:inline;
}

/* makes theme selector look a little better */
#sidebarOptions .sliderPanel .select .button {
  padding:0.5em;
  display:block;
}
#sidebarOptions .sliderPanel .select br {
	display:none;
}

/* make it print a little cleaner */
@media print {
	#topMenu {
		display: none ! important;
	}
	/* not sure if we need all the importants */
	.tiddler {
		border-style: none ! important;
		margin:0px ! important;
		padding:0px ! important;
		padding-bottom:2em ! important;
	}
	.tagglyTagging .button, .tagglyTagging .hidebutton {
		display: none ! important;
	}
	.headerShadow {
		visibility: hidden ! important;
	}
	.tagglyTagged .quickopentag, .tagged .quickopentag {
		border-style: none ! important;
	}
	.quickopentag a.button, .miniTag {
		display: none ! important;
	}
}

/* get user styles specified in StyleSheet */
[[StyleSheet]]

/*}}}*/

/***
|Description:|A place to put your config tweaks so they aren't overwritten when you upgrade MPTW|
***/
//{{{

config.mptwDateFormat = 'DD/MM/YY';
config.mptwJournalFormat = 'Journal DD/MM/YY';
//config.mptwDateFormat = 'MM/0DD/YY';
//config.mptwJournalFormat = 'Journal MM/0DD/YY';

//}}}
!Action Dashboard
<!--{{{-->
<table class="threecol"><tr><td>

<div macro="mgtdList title:'Next Actions' startTag:Action tags:'Next && !Done' view:ActionProj mode:global
	where:tiddler.hasActiveProject()
	newButton:'NewActionButton Next [[]]'
	"></div>

<div macro="mgtdList title:'Waiting Actions' startTag:Action tags:'[(Waiting For)] && !Done' view:ActionProj  mode:global
	where:tiddler.hasActiveProject()
	newButton:'NewActionButton [[Waiting For]] [[]]'
	"></div>

</td><td>

<div macro="mgtdList title:'Future Actions' startTag:Action tags:'Future && !Done' view:ActionProj mode:global
	where:tiddler.hasActiveProject()
	newButton:'NewActionButton Future'
	"></div>

<div macro="mgtdList title:'Done Actions' startTag:Action tags:'Done' view:DoneAction mode:global
	"></div>

</td><td>
<div macro="mgtdList title:'Active Projects' startTag:Project tags:'!Complete && !Someday/Maybe' view:ProjectBare mode:global
	"></div>
</td>
</tr></table>
<!--}}}-->

!Action Dashboard by Project
<!--{{{-->
<table class="threecol"><tr><td>

<div macro="mgtdList title:'Next Actions' startTag:Action tags:'Next && !Done' view:ActionProj mode:global
	group:Project
	gView:plain
	where:tiddler.hasActiveProject()
	newButton:'NewActionButton Next [[]]'
	"></div>

<div macro="mgtdList title:'Waiting Actions' startTag:Action tags:'[(Waiting For)] && !Done' view:ActionProj mode:global
	group:Project
	gView:plain
	where:tiddler.hasActiveProject()
	newButton:'NewActionButton [[Waiting For]] [[]]'
	"></div>

</td><td>

<div macro="mgtdList title:'Future Actions' startTag:Action tags:'Future && !Done' view:ActionProj mode:global
	group:Project
	gView:plain
	where:tiddler.hasActiveProject()
	newButton:'NewActionButton Future [[]]'
	"></div>


</td><td>

<div macro="mgtdList title:'Done Actions' startTag:Action tags:'Done' view:DoneAction mode:global
	group:Project
	gView:plain
	where:tiddler.hasActiveProject()
	"></div>

</td></tr></table>
<!--}}}-->

!Action Dashboard by Context
<!--{{{-->
<table class="threecol"><tr><td>

<div macro="mgtdList title:'Next Actions' startTag:Action tags:'Next && !Done' view:ActionProj mode:global
	group:Context
	gView:Context
	where:tiddler.hasActiveProject()
	newButton:'NewActionButton Next [[]]'
	"></div>

<div macro="mgtdList title:'Waiting Actions' startTag:Action tags:'[(Waiting For)] && !Done' view:ActionProj mode:global
	group:Context
	gView:Context
	where:tiddler.hasActiveProject()
	newButton:'NewActionButton [[Waiting For]] [[]]'
	"></div>

</td><td>

<div macro="mgtdList title:'Future Actions' startTag:Action tags:'Future && !Done' view:ActionProj mode:global
	group:Context
	gView:Context
	where:tiddler.hasActiveProject()
	newButton:'NewActionButton Future [[]]'
	"></div>

<div macro="mgtdList title:'Done Actions' startTag:Action tags:'Done' view:DoneAction mode:global
	"></div>

</td><td>

<div macro="mgtdList title:'Active Projects' startTag:Project tags:'!Complete && !Someday/Maybe' view:ProjectBare mode:global
	"></div>

</td></tr></table>
<!--}}}-->

!Next Actions
<!--{{{-->
<div macro="mgtdList startTag:Action tags:'Next && !Done' view:ActionProj mode:global
	where:tiddler.hasActiveProject()
	"></div>
<!--}}}-->

!Next Actions by Context
<!--{{{-->
<div macro="mgtdList startTag:Action tags:'Next && !Done' view:ActionProj mode:global
	group:Context
	where:tiddler.hasActiveProject()
	"></div>
<!--}}}-->

!Next Actions by Project
<!--{{{-->
<div macro="mgtdList startTag:Action tags:'Next && !Done' view:ActionProj mode:global
	group:Project
	gView:plain
	where:tiddler.hasActiveProject()
	"></div>
<!--}}}-->

!Projects
<table class="threecol"><tr><td>

<div macro="mgtdList title:'Active Projects' startTag:Project tags:'Active && !Complete' view:Project mode:global
	newButton:'NewProjectButton Active'
	"></div>

</td><td>

<div macro="mgtdList title:'Someday/Maybe Projects' startTag:Project tags:'Someday/Maybe && !Complete' view:Project mode:global
	newButton:'NewProjectButton Someday/Maybe'
	"></div>

</td><td>

<div macro="mgtdList title:'Completed Projects' startTag:Project tags:'Complete' view:Project mode:global
	"></div>

</td></tr></table>

<!--}}}-->

!Next and Waiting Actions
<!--{{{-->
<table class="twocol"><tr><td>

<div macro="mgtdList startTag:Action title:'Next' tags:'Next && !Done' view:ActionProj mode:global
	where:tiddler.hasActiveProject()
	"></div>

</td><td>

<div macro="mgtdList startTag:Action title:'Waiting' tags:'[(Waiting For)] && !Done' view:ActionProj mode:global
	where:tiddler.hasActiveProject()
	"></div>

</td></tr></table>
<!--}}}-->

!Next and Waiting Actions by Context
<table class="twocol"><tr><td>

<div macro="mgtdList startTag:Action title:'Next' tags:'Next && !Done' view:ActionProj mode:global
	group:Context
	gView:Context
	where:tiddler.hasActiveProject()
	"></div>

</td><td>

<div macro="mgtdList startTag:Action title:'Waiting' tags:'[(Waiting For)] && !Done' view:ActionProj mode:global
	group:Context
	gView:Context
	where:tiddler.hasActiveProject()
	"></div>

</td></tr></table>

!Next and Waiting Actions by Project
<table class="twocol"><tr><td>

<div macro="mgtdList startTag:Action title:'Next' tags:'Next && !Done' view:ActionProj mode:global
	group:Project
	gView:plain
	where:tiddler.hasActiveProject()
	"></div>

</td><td>

<div macro="mgtdList startTag:Action title:'Waiting' tags:'[(Waiting For)] && !Done' view:ActionProj mode:global
	group:Project
	gView:plain
	where:tiddler.hasActiveProject()
	"></div>

</td></tr></table>

!Done Actions
<div macro="mgtdList startTag:Action title:'Done' tags:'Done' view:DoneAction mode:global
  group:day gView:DoneAction
"></div>

!(No Context)
<div macro="mgtdList startTag:Action title:'You should give these actions a context' tags:'!Done' view:DoneAction mode:global
	where:tiddler.getByIndex('Context').length==0
"></div>

!(No Project)
<div macro="mgtdList startTag:Action title:'Actions with no project' tags:'!Done' view:DoneAction mode:global
	where:tiddler.getByIndex('Project').length==0
"></div>

!Active Projects With No Next Actions
<div macro="mgtdList startTag:Project title:'You must assign a next action to these projects'
	tags:'!Complete && !Someday/Maybe' view:Project mode:global
	where:!tiddler.hasNextAction()
"></div>
/***
|Name:|NewHerePlugin|
|Description:|Creates the new here and new journal macros|
|Version:|3.0 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#NewHerePlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
merge(config.macros, {
	newHere: {
		handler: function(place,macroName,params,wikifier,paramString,tiddler) {
			wikify("<<newTiddler "+paramString+" tag:[["+tiddler.title+"]]>>",place,null,tiddler);
		}
	},
	newJournalHere: {
		handler: function(place,macroName,params,wikifier,paramString,tiddler) {
			wikify("<<newJournal "+paramString+" tag:[["+tiddler.title+"]]>>",place,null,tiddler);
		}
	}
});

//}}}

/***
|Name:|NewMeansNewPlugin|
|Description:|If 'New Tiddler' already exists then create 'New Tiddler (1)' and so on|
|Version:|1.0 ($Rev: 2263 $)|
|Date:|$Date: 2007-06-13 04:22:32 +1000 (Wed, 13 Jun 2007) $|
|Source:|http://mptw.tiddlyspot.com/empty.html#NewMeansNewPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Note: I think this should be in the core
***/
//{{{

String.prototype.getNextFreeName = function() {
       var numberRegExp = / \(([0-9]+)\)$/;
       var match = numberRegExp.exec(this);
       if (match) {
               var num = parseInt(match[1]) + 1;
               return this.replace(numberRegExp," ("+num+")");
       }
       else {
               return this + " (1)";
       }
}

config.macros.newTiddler.getName = function(newName) {
       while (store.getTiddler(newName))
               newName = newName.getNextFreeName();
       return newName;
}


config.macros.newTiddler.onClickNewTiddler = function()
{
	var title = this.getAttribute("newTitle");
	if(this.getAttribute("isJournal") == "true") {
		var now = new Date();
		title = now.formatString(title.trim());
	}

	title = config.macros.newTiddler.getName(title); // <--- only changed bit

	var params = this.getAttribute("params");
	var tags = params ? params.split("|") : [];
	var focus = this.getAttribute("newFocus");
	var template = this.getAttribute("newTemplate");
	var customFields = this.getAttribute("customFields");
	story.displayTiddler(null,title,template,false,null,null);
	var tiddlerElem = document.getElementById(story.idPrefix + title);
	if(customFields)
		story.addCustomFields(tiddlerElem,customFields);
	var text = this.getAttribute("newText");
	if(typeof text == "string")
		story.getTiddlerField(title,"text").value = text.format([title]);
	for(var t=0;t<tags.length;t++)
		story.setTiddlerTag(title,tags[t],+1);
	story.focusTiddler(title,focus);
	return false;
};

//}}}

/%
$1: Area
$2: ProjectStatus
%/<<newTiddler title:'New Project' label:+ tag:Project [[$1]] [[$2]]>>
order:1
button:n
buttonLong:next






order:2
priority:2


/***
|Name:|PrettyDatesPlugin|
|Description:|Provides a new date format ('pppp') that displays times such as '2 days ago'|
|Version:|1.0 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#PrettyDatesPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Notes
* If you want to you can rename this plugin. :) Some suggestions: LastUpdatedPlugin, RelativeDatesPlugin, SmartDatesPlugin, SexyDatesPlugin.
* Inspired by http://ejohn.org/files/pretty.js
***/
//{{{
Date.prototype.prettyDate = function() {
	var diff = (((new Date()).getTime() - this.getTime()) / 1000);
	var day_diff = Math.floor(diff / 86400);

	if (isNaN(day_diff))      return "";
	else if (diff < 0)        return "in the future";
	else if (diff < 60)       return "just now";
	else if (diff < 120)      return "1 minute ago";
	else if (diff < 3600)     return Math.floor(diff/60) + " minutes ago";
	else if (diff < 7200)     return "1 hour ago";
	else if (diff < 86400)    return Math.floor(diff/3600) + " hours ago";
	else if (day_diff == 1)   return "Yesterday";
	else if (day_diff < 7)    return day_diff + " days ago";
	else if (day_diff < 14)   return  "a week ago";
	else if (day_diff < 31)   return Math.ceil(day_diff/7) + " weeks ago";
	else if (day_diff < 62)   return "a month ago";
	else if (day_diff < 365)  return "about " + Math.ceil(day_diff/31) + " months ago";
	else if (day_diff < 730)  return "a year ago";
	else                      return Math.ceil(day_diff/365) + " years ago";
}

Date.prototype.formatString_orig_mptw = Date.prototype.formatString;

Date.prototype.formatString = function(template) {
	return this.formatString_orig_mptw(template).replace(/pppp/,this.prettyDate());
}

// for MPTW. otherwise edit your ViewTemplate as required.
// config.mptwDateFormat = 'pppp (DD/MM/YY)'; 
config.mptwDateFormat = 'pppp'; 

//}}}

order:2
button:Inbox
!Process Inbox
* [[Quick Add]]
* <<newTiddler title:'New Next Action' label:'new next action' tag: Action Next>>
* <<newTiddler title:'New Waiting For Action' label:'new waiting for action' tag: Action 'Waiting For'>>
* <<newTiddler title:'New Future Action' label:'new future for action' tag: Action Future>>
* <<newTiddler title:'New Active Project' label:'new project' tag: Project Active>>
* <<newTiddler title:'New Someday/Maybe Project' label:'new someday/maybe project' tag: Project Someday/Maybe>>

/***
|Name:|QuickOpenTagPlugin|
|Description:|Changes tag links to make it easier to open tags as tiddlers|
|Version:|3.0.1 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#QuickOpenTagPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
config.quickOpenTag = {

	dropdownChar: (document.all ? "\u25bc" : "\u25be"), // the little one doesn't work in IE?

	createTagButton: function(place,tag,excludeTiddler) {
		// little hack so we can do this: <<tag PrettyTagName|RealTagName>>
		var splitTag = tag.split("|");
		var pretty = tag;
		if (splitTag.length == 2) {
			tag = splitTag[1];
			pretty = splitTag[0];
		}
		
		var sp = createTiddlyElement(place,"span",null,"quickopentag");
		createTiddlyText(createTiddlyLink(sp,tag,false),pretty);
		
		var theTag = createTiddlyButton(sp,config.quickOpenTag.dropdownChar,
                        config.views.wikified.tag.tooltip.format([tag]),onClickTag);
		theTag.setAttribute("tag",tag);
		if (excludeTiddler)
			theTag.setAttribute("tiddler",excludeTiddler);
    		return(theTag);
	},

	miniTagHandler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var tagged = store.getTaggedTiddlers(tiddler.title);
		if (tagged.length > 0) {
			var theTag = createTiddlyButton(place,config.quickOpenTag.dropdownChar,
                        	config.views.wikified.tag.tooltip.format([tiddler.title]),onClickTag);
			theTag.setAttribute("tag",tiddler.title);
			theTag.className = "miniTag";
		}
	},

	allTagsHandler: function(place,macroName,params) {
		var tags = store.getTags(params[0]);
		var filter = params[1]; // new feature
		var ul = createTiddlyElement(place,"ul");
		if(tags.length == 0)
			createTiddlyElement(ul,"li",null,"listTitle",this.noTags);
		for(var t=0; t<tags.length; t++) {
			var title = tags[t][0];
			if (!filter || (title.match(new RegExp('^'+filter)))) {
				var info = getTiddlyLinkInfo(title);
				var theListItem =createTiddlyElement(ul,"li");
				var theLink = createTiddlyLink(theListItem,tags[t][0],true);
				var theCount = " (" + tags[t][1] + ")";
				theLink.appendChild(document.createTextNode(theCount));
				var theDropDownBtn = createTiddlyButton(theListItem," " +
					config.quickOpenTag.dropdownChar,this.tooltip.format([tags[t][0]]),onClickTag);
				theDropDownBtn.setAttribute("tag",tags[t][0]);
			}
		}
	},

	// todo fix these up a bit
	styles: [
"/*{{{*/",
"/* created by QuickOpenTagPlugin */",
".tagglyTagged .quickopentag, .tagged .quickopentag ",
"	{ margin-right:1.2em; border:1px solid #eee; padding:2px; padding-right:0px; padding-left:1px; }",
".quickopentag .tiddlyLink { padding:2px; padding-left:3px; }",
".quickopentag a.button { padding:1px; padding-left:2px; padding-right:2px;}",
"/* extra specificity to make it work right */",
"#displayArea .viewer .quickopentag a.button, ",
"#displayArea .viewer .quickopentag a.tiddyLink, ",
"#mainMenu .quickopentag a.tiddyLink, ",
"#mainMenu .quickopentag a.tiddyLink ",
"	{ border:0px solid black; }",
"#displayArea .viewer .quickopentag a.button, ",
"#mainMenu .quickopentag a.button ",
"	{ margin-left:0px; padding-left:2px; }",
"#displayArea .viewer .quickopentag a.tiddlyLink, ",
"#mainMenu .quickopentag a.tiddlyLink ",
"	{ margin-right:0px; padding-right:0px; padding-left:0px; margin-left:0px; }",
"a.miniTag {font-size:150%;} ",
"#mainMenu .quickopentag a.button ",
"	/* looks better in right justified main menus */",
"	{ margin-left:0px; padding-left:2px; margin-right:0px; padding-right:0px; }", 
"#topMenu .quickopentag { padding:0px; margin:0px; border:0px; }",
"#topMenu .quickopentag .tiddlyLink { padding-right:1px; margin-right:0px; }",
"#topMenu .quickopentag .button { padding-left:1px; margin-left:0px; border:0px; }",
"/*}}}*/",
		""].join("\n"),

	init: function() {
		// we fully replace these builtins. can't hijack them easily
		window.createTagButton = this.createTagButton;
		config.macros.allTags.handler = this.allTagsHandler;
		config.macros.miniTag = { handler: this.miniTagHandler };
		config.shadowTiddlers["QuickOpenTagStyles"] = this.styles;
		store.addNotification("QuickOpenTagStyles",refreshStyles);
	}
}

config.quickOpenTag.init();

//}}}


/***
|Name:|RenameTagsPlugin|
|Description:|Allows you to easily rename or delete tags across multiple tiddlers|
|Version:|3.0 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#RenameTagsPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
Rename a tag and you will be prompted to rename it in all its tagged tiddlers.
***/
//{{{
config.renameTags = {

	prompts: {
		rename: "Rename the tag '%0' to '%1' in %2 tidder%3?",
		remove: "Remove the tag '%0' from %1 tidder%2?"
	},

	removeTag: function(tag,tiddlers) {
		store.suspendNotifications();
		for (var i=0;i<tiddlers.length;i++) {
			store.setTiddlerTag(tiddlers[i].title,false,tag);
		}
		store.resumeNotifications();
		store.notifyAll();
	},

	renameTag: function(oldTag,newTag,tiddlers) {
		store.suspendNotifications();
		for (var i=0;i<tiddlers.length;i++) {
			store.setTiddlerTag(tiddlers[i].title,false,oldTag); // remove old
			store.setTiddlerTag(tiddlers[i].title,true,newTag);  // add new
		}
		store.resumeNotifications();
		store.notifyAll();
	},

	storeMethods: {

		saveTiddler_orig_renameTags: TiddlyWiki.prototype.saveTiddler,

		saveTiddler: function(title,newTitle,newBody,modifier,modified,tags,fields) {
			if (title != newTitle) {
				var tagged = this.getTaggedTiddlers(title);
				if (tagged.length > 0) {
					// then we are renaming a tag
					if (confirm(config.renameTags.prompts.rename.format([title,newTitle,tagged.length,tagged.length>1?"s":""])))
						config.renameTags.renameTag(title,newTitle,tagged);

					if (!this.tiddlerExists(title) && newBody == "")
						// dont create unwanted tiddler
						return null;
				}
			}
			return this.saveTiddler_orig_renameTags(title,newTitle,newBody,modifier,modified,tags,fields);
		},

		removeTiddler_orig_renameTags: TiddlyWiki.prototype.removeTiddler,

		removeTiddler: function(title) {
			var tagged = this.getTaggedTiddlers(title);
			if (tagged.length > 0)
				if (confirm(config.renameTags.prompts.remove.format([title,tagged.length,tagged.length>1?"s":""])))
					config.renameTags.removeTag(title,tagged);
			return this.removeTiddler_orig_renameTags(title);
		}

	},

	init: function() {
		merge(TiddlyWiki.prototype,this.storeMethods);
	}
}

config.renameTags.init();

//}}}

order:3
button:Review
!Review
* ...


/***
|Name:|SaveCloseTiddlerPlugin|
|Description:|Provides two extra toolbar commands, saveCloseTiddler and cancelCloseTiddler|
|Version:|3.0 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#SaveCloseTiddlerPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
To use these you must add them to the tool bar in your EditTemplate
***/
//{{{
merge(config.commands,{

	saveCloseTiddler: {
		text: 'done/close',
		tooltip: 'Save changes to this tiddler and close it',
		handler: function(e,src,title) {
			config.commands.saveTiddler.handler(e,src,title);
			config.commands.closeTiddler.handler(e,src,title);
			return false;
		}
	},

	cancelCloseTiddler: {
		text: 'cancel/close',
		tooltip: 'Undo changes to this tiddler and close it',
		handler: function(e,src,title) {
			config.commands.cancelTiddler.handler(e,src,title);
			config.commands.closeTiddler.handler(e,src,title);
			return false;
		}
	}

});

//}}}

/***
|Name:|SelectThemePlugin|
|Description:|Lets you easily switch theme and palette|
|Version:|1.0 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#SelectThemePlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!Notes
* Borrows largely from ThemeSwitcherPlugin by Martin Budden http://www.martinswiki.com/#ThemeSwitcherPlugin
* Theme is cookie based. But set a default by setting config.options.txtTheme in MptwConfigPlugin (for example)
* Palette is not cookie based. It actually overwrites your ColorPalette tiddler when you select a palette, so beware. 
!Usage
* {{{<<selectTheme>>}}} makes a dropdown selector
* {{{<<selectPalette>>}}} makes a dropdown selector
* {{{<<applyTheme>>}}} applies the current tiddler as a theme
* {{{<<applyPalette>>}}} applies the current tiddler as a palette
* {{{<<applyTheme TiddlerName>>}}} applies TiddlerName as a theme
* {{{<<applyPalette TiddlerName>>}}} applies TiddlerName as a palette
***/
//{{{

config.macros.selectTheme = {
	label: {
      		selectTheme:"select theme",
      		selectPalette:"select palette"
	},
	prompt: {
		selectTheme:"Select the current theme",
		selectPalette:"Select the current palette"
	},
	tags: {
		selectTheme:'systemTheme',
		selectPalette:'systemPalette'
	}
};

config.macros.selectTheme.handler = function(place,macroName)
{
	var btn = createTiddlyButton(place,this.label[macroName],this.prompt[macroName],this.onClick);
	// want to handle palettes and themes with same code. use mode attribute to distinguish
	btn.setAttribute('mode',macroName);
};

config.macros.selectTheme.onClick = function(ev)
{
	var e = ev ? ev : window.event;
	var popup = Popup.create(this);
	var mode = this.getAttribute('mode');
	var tiddlers = store.getTaggedTiddlers(config.macros.selectTheme.tags[mode]);
	// for default
	if (mode == "selectPalette") {
		var btn = createTiddlyButton(createTiddlyElement(popup,'li'),"(default)","default color palette",config.macros.selectTheme.onClickTheme);
		btn.setAttribute('theme',"(default)");
		btn.setAttribute('mode',mode);
	}
	for(var i=0; i<tiddlers.length; i++) {
		var t = tiddlers[i].title;
		var name = store.getTiddlerSlice(t,'Name');
		var desc = store.getTiddlerSlice(t,'Description');
		var btn = createTiddlyButton(createTiddlyElement(popup,'li'),name ? name : title,desc ? desc : config.macros.selectTheme.label['mode'],config.macros.selectTheme.onClickTheme);
		btn.setAttribute('theme',t);
		btn.setAttribute('mode',mode);
	}
	Popup.show();
	return stopEvent(e);
};

config.macros.selectTheme.onClickTheme = function(ev)
{
	var mode = this.getAttribute('mode');
	var theme = this.getAttribute('theme');
	if (mode == 'selectTheme')
		story.switchTheme(theme);
	else // selectPalette
		config.macros.selectTheme.updatePalette(theme);
	return false;
};

config.macros.selectTheme.updatePalette = function(title)
{
	if (title != "") {
		store.deleteTiddler("ColorPalette");
		if (title != "(default)")
			store.saveTiddler("ColorPalette","ColorPalette",store.getTiddlerText(title),
					config.options.txtUserName,undefined,"");
		refreshAll();
		if(config.options.chkAutoSave)
			saveChanges(true);
	}
};

config.macros.applyTheme = {
	label: "apply",
	prompt: "apply this theme or palette" // i'm lazy
};

config.macros.applyTheme.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
	var useTiddler = params[0] ? params[0] : tiddler.title;
	var btn = createTiddlyButton(place,this.label,this.prompt,config.macros.selectTheme.onClickTheme);
	btn.setAttribute('theme',useTiddler);
	btn.setAttribute('mode',macroName=="applyTheme"?"selectTheme":"selectPalette"); // a bit untidy here
}

config.macros.selectPalette = config.macros.selectTheme;
config.macros.applyPalette = config.macros.applyTheme;

config.macros.refreshAll = { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
	createTiddlyButton(place,"refresh","refresh layout and styles",function() { refreshAll(); });
}};

//}}}

MonkeyGTD
order:2
button:s/m
buttonLong:someday/maybe
/***
|''Name:''|SparklinePlugin|
|''Description:''|Sparklines macro|
***/
//{{{
if(!version.extensions.SparklinePlugin) {
version.extensions.SparklinePlugin = {installed:true};

//--
//-- Sparklines
//--

config.macros.sparkline = {};
config.macros.sparkline.handler = function(place,macroName,params)
{
	var data = [];
	var min = 0;
	var max = 0;
	var v;
	for(var t=0; t<params.length; t++) {
		v = parseInt(params[t]);
		if(v < min)
			min = v;
		if(v > max)
			max = v;
		data.push(v);
	}
	if(data.length < 1)
		return;
	var box = createTiddlyElement(place,"span",null,"sparkline",String.fromCharCode(160));
	box.title = data.join(",");
	var w = box.offsetWidth;
	var h = box.offsetHeight;
	box.style.paddingRight = (data.length * 2 - w) + "px";
	box.style.position = "relative";
	for(var d=0; d<data.length; d++) {
		var tick = document.createElement("img");
		tick.border = 0;
		tick.className = "sparktick";
		tick.style.position = "absolute";
		tick.src = "data:image/gif,GIF89a%01%00%01%00%91%FF%00%FF%FF%FF%00%00%00%C0%C0%C0%00%00%00!%F9%04%01%00%00%02%00%2C%00%00%00%00%01%00%01%00%40%02%02T%01%00%3B";
		tick.style.left = d*2 + "px";
		tick.style.width = "2px";
		v = Math.floor(((data[d] - min)/(max-min)) * h);
		tick.style.top = (h-v) + "px";
		tick.style.height = v + "px";
		box.appendChild(tick);
	}
};


}
//}}}

order:999
button:TW
buttonClass:tiny
<<allTags excludeLists>>
<<tabs txtMoreTab "Tags" "All Tags" TabAllTags "Miss" "Missing tiddlers" TabMoreMissing "Orph" "Orphaned tiddlers" TabMoreOrphans "Shad" "Shadowed tiddlers" TabMoreShadowed>>
<<allTags excludeLists [a-z]>>
!Project
<!--{{{-->
<table class="twocol"><tr><td>
<div macro="mgtdList title:'Next Actions' tags:'Action && Next && !Done' view:ActionProj
	group:Context
	gView:Context
	where:tiddler.hasActiveProject()
	"></div>

<div macro="mgtdList title:'Waiting Actions' tags:'Action && [(Waiting For)] && !Done' view:ActionProj
	group:Context
	gView:Context
	where:tiddler.hasActiveProject()
	"></div>

</td><td>

<div macro="mgtdList title:'Future Actions' tags:'Action && Future && !Done' view:ActionProj
	group:Context
	gView:Context
	where:tiddler.hasActiveProject()
	"></div>

<div macro="mgtdList title:'Done Actions' tags:'Action && Done' view:DoneAction
	"></div>

</td></tr></table>
<!--}}}-->


!Context
<!--{{{-->
<table class="twocol"><tr><td>
<div macro="mgtdList title:'Next' tags:'Action && Next && !Done' view:ActionProj
	where:tiddler.hasActiveProject()
	"></div>

</td><td>
<div macro="mgtdList title:'Waiting' tags:'Action && [(Waiting For)] && !Done' view:ActionProj
	where:tiddler.hasActiveProject()
	"></div>

</td></tr></table>
<!--}}}-->
/***
|Name:|TagglyTaggingPlugin|
|Description:|tagglyTagging macro is a replacement for the builtin tagging macro in your ViewTemplate|
|Version:|3.1 ($Rev: 3919 $)|
|Date:|$Date: 2008-03-13 02:03:12 +1000 (Thu, 13 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#TagglyTaggingPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!Notes
See http://mptw.tiddlyspot.com/#TagglyTagging
***/
//{{{
config.taggly = {

	// for translations
	lingo: {
		labels: {
			asc:        "\u2191", // down arrow
			desc:       "\u2193", // up arrow
			title:      "title",
			modified:   "modified",
			created:    "created",
			show:       "+",
			hide:       "-",
			normal:     "normal",
			group:      "group",
			commas:     "commas",
			sitemap:    "sitemap",
			numCols:    "cols\u00b1", // plus minus sign
			label:      "Tagged as '%0':",
			excerpts:   "excerpts",
			descr:      "descr",
			slices:     "slices",
			contents:   "contents",
			sliders:    "sliders",
			noexcerpts: "title only"
		},

		tooltips: {
			title:    "Click to sort by title",
			modified: "Click to sort by modified date",
			created:  "Click to sort by created date",
			show:     "Click to show tagging list",
			hide:     "Click to hide tagging list",
			normal:   "Click to show a normal ungrouped list",
			group:    "Click to show list grouped by tag",
			sitemap:  "Click to show a sitemap style list",
			commas:   "Click to show a comma separated list",
			numCols:  "Click to change number of columns",
			excerpts: "Click to show excerpts",
			descr:    "Click to show the description slice",
			slices:    "Click to show all slices",
			contents: "Click to show entire tiddler contents",
			sliders:  "Click to show tiddler contents in sliders",
			noexcerpts: "Click to show entire title only"
		}
	},

	config: {
		showTaggingCounts: true,
		listOpts: {
			// the first one will be the default
			sortBy:     ["title","modified","created"],
			sortOrder:  ["asc","desc"],
			hideState:  ["show","hide"],
			listMode:   ["normal","group","sitemap","commas"],
			numCols:    ["1","2","3","4","5","6"],
			excerpts:   ["noexcerpts","excerpts","descr","slices","contents","sliders"]
		},
		valuePrefix: "taggly.",
		excludeTags: ["excludeLists","excludeTagging"],
		excerptSize: 50,
		excerptMarker: "/%"+"%/"
	},

	getTagglyOpt: function(title,opt) {
		var val = store.getValue(title,this.config.valuePrefix+opt);
		return val ? val : this.config.listOpts[opt][0];
	},

	setTagglyOpt: function(title,opt,value) {
		if (!store.tiddlerExists(title))
			// create it silently
			store.saveTiddler(title,title,config.views.editor.defaultText.format([title]),config.options.txtUserName,new Date(),null);
		// if value is default then remove it to save space
		return store.setValue(title,
			this.config.valuePrefix+opt,
			value == this.config.listOpts[opt][0] ? null : value);
	},

	getNextValue: function(title,opt) {
		var current = this.getTagglyOpt(title,opt);
		var pos = this.config.listOpts[opt].indexOf(current);
		// a little usability enhancement. actually it doesn't work right for grouped or sitemap
		var limit = (opt == "numCols" ? store.getTaggedTiddlers(title).length : this.config.listOpts[opt].length);
		var newPos = (pos + 1) % limit;
		return this.config.listOpts[opt][newPos];
	},

	toggleTagglyOpt: function(title,opt) {
		var newVal = this.getNextValue(title,opt);
		this.setTagglyOpt(title,opt,newVal);
	}, 

	createListControl: function(place,title,type) {
		var lingo = config.taggly.lingo;
		var label;
		var tooltip;
		var onclick;

		if ((type == "title" || type == "modified" || type == "created")) {
			// "special" controls. a little tricky. derived from sortOrder and sortBy
			label = lingo.labels[type];
			tooltip = lingo.tooltips[type];

			if (this.getTagglyOpt(title,"sortBy") == type) {
				label += lingo.labels[this.getTagglyOpt(title,"sortOrder")];
				onclick = function() {
					config.taggly.toggleTagglyOpt(title,"sortOrder");
					return false;
				}
			}
			else {
				onclick = function() {
					config.taggly.setTagglyOpt(title,"sortBy",type);
					config.taggly.setTagglyOpt(title,"sortOrder",config.taggly.config.listOpts.sortOrder[0]);
					return false;
				}
			}
		}
		else {
			// "regular" controls, nice and simple
			label = lingo.labels[type == "numCols" ? type : this.getNextValue(title,type)];
			tooltip = lingo.tooltips[type == "numCols" ? type : this.getNextValue(title,type)];
			onclick = function() {
				config.taggly.toggleTagglyOpt(title,type);
				return false;
			}
		}

		// hide button because commas don't have columns
		if (!(this.getTagglyOpt(title,"listMode") == "commas" && type == "numCols"))
			createTiddlyButton(place,label,tooltip,onclick,type == "hideState" ? "hidebutton" : "button");
	},

	makeColumns: function(orig,numCols) {
		var listSize = orig.length;
		var colSize = listSize/numCols;
		var remainder = listSize % numCols;

		var upperColsize = colSize;
		var lowerColsize = colSize;

		if (colSize != Math.floor(colSize)) {
			// it's not an exact fit so..
			upperColsize = Math.floor(colSize) + 1;
			lowerColsize = Math.floor(colSize);
		}

		var output = [];
		var c = 0;
		for (var j=0;j<numCols;j++) {
			var singleCol = [];
			var thisSize = j < remainder ? upperColsize : lowerColsize;
			for (var i=0;i<thisSize;i++) 
				singleCol.push(orig[c++]);
			output.push(singleCol);
		}

		return output;
	},

	drawTable: function(place,columns,theClass) {
		var newTable = createTiddlyElement(place,"table",null,theClass);
		var newTbody = createTiddlyElement(newTable,"tbody");
		var newTr = createTiddlyElement(newTbody,"tr");
		for (var j=0;j<columns.length;j++) {
			var colOutput = "";
			for (var i=0;i<columns[j].length;i++) 
				colOutput += columns[j][i];
			var newTd = createTiddlyElement(newTr,"td",null,"tagglyTagging"); // todo should not need this class
			wikify(colOutput,newTd);
		}
		return newTable;
	},

	createTagglyList: function(place,title) {
		switch(this.getTagglyOpt(title,"listMode")) {
			case "group":  return this.createTagglyListGrouped(place,title); break;
			case "normal": return this.createTagglyListNormal(place,title,false); break;
			case "commas": return this.createTagglyListNormal(place,title,true); break;
			case "sitemap":return this.createTagglyListSiteMap(place,title); break;
		}
	},

	getTaggingCount: function(title) {
		// thanks to Doug Edmunds
		if (this.config.showTaggingCounts) {
			var tagCount = store.getTaggedTiddlers(title).length;
			if (tagCount > 0)
				return " ("+tagCount+")";
		}
		return "";
	},

	getExcerpt: function(inTiddlerTitle,title,indent) {
		if (!indent)
			indent = 1;

		var displayMode = this.getTagglyOpt(inTiddlerTitle,"excerpts");
		var t = store.getTiddler(title);

		if (t && displayMode == "excerpts") {
			var text = t.text.replace(/\n/," ");
			var marker = text.indexOf(this.config.excerptMarker);
			if (marker != -1) {
				return " {{excerpt{<nowiki>" + text.substr(0,marker) + "</nowiki>}}}";
			}
			else if (text.length < this.config.excerptSize) {
				return " {{excerpt{<nowiki>" + t.text + "</nowiki>}}}";
			}
			else {
				return " {{excerpt{<nowiki>" + t.text.substr(0,this.config.excerptSize) + "..." + "</nowiki>}}}";
			}
		}
		else if (t && displayMode == "contents") {
			return "\n{{contents indent"+indent+"{\n" + t.text + "\n}}}";
		}
		else if (t && displayMode == "sliders") {
			return "<slider slide>\n{{contents{\n" + t.text + "\n}}}\n</slider>";
		}
		else if (t && displayMode == "descr") {
			var descr = store.getTiddlerSlice(title,'Description');
			return descr ? " {{excerpt{" + descr  + "}}}" : "";
		}
		else if (t && displayMode == "slices") {
			var result = "";
			var slices = store.calcAllSlices(title);
			for (var s in slices)
				result += "|%0|%1|\n".format([s,slices[s]]);
			return result ? "\n{{excerpt excerptIndent{\n" + result  + "}}}" : "";
		}
		return "";
	},

	notHidden: function(t,inTiddler) {
		if (typeof t == "string") 
			t = store.getTiddler(t);
		return (!t || !t.tags.containsAny(this.config.excludeTags) ||
				(inTiddler && this.config.excludeTags.contains(inTiddler)));
	},

	// this is for normal and commas mode
	createTagglyListNormal: function(place,title,useCommas) {

		var list = store.getTaggedTiddlers(title,this.getTagglyOpt(title,"sortBy"));

		if (this.getTagglyOpt(title,"sortOrder") == "desc")
			list = list.reverse();

		var output = [];
		var first = true;
		for (var i=0;i<list.length;i++) {
			if (this.notHidden(list[i],title)) {
				var countString = this.getTaggingCount(list[i].title);
				var excerpt = this.getExcerpt(title,list[i].title);
				if (useCommas)
					output.push((first ? "" : ", ") + "[[" + list[i].title + "]]" + countString + excerpt);
				else
					output.push("*[[" + list[i].title + "]]" + countString + excerpt + "\n");

				first = false;
			}
		}

		return this.drawTable(place,
			this.makeColumns(output,useCommas ? 1 : parseInt(this.getTagglyOpt(title,"numCols"))),
			useCommas ? "commas" : "normal");
	},

	// this is for the "grouped" mode
	createTagglyListGrouped: function(place,title) {
		var sortBy = this.getTagglyOpt(title,"sortBy");
		var sortOrder = this.getTagglyOpt(title,"sortOrder");

		var list = store.getTaggedTiddlers(title,sortBy);

		if (sortOrder == "desc")
			list = list.reverse();

		var leftOvers = []
		for (var i=0;i<list.length;i++)
			leftOvers.push(list[i].title);

		var allTagsHolder = {};
		for (var i=0;i<list.length;i++) {
			for (var j=0;j<list[i].tags.length;j++) {

				if (list[i].tags[j] != title) { // not this tiddler

					if (this.notHidden(list[i].tags[j],title)) {

						if (!allTagsHolder[list[i].tags[j]])
							allTagsHolder[list[i].tags[j]] = "";

						if (this.notHidden(list[i],title)) {
							allTagsHolder[list[i].tags[j]] += "**[["+list[i].title+"]]"
										+ this.getTaggingCount(list[i].title) + this.getExcerpt(title,list[i].title) + "\n";

							leftOvers.setItem(list[i].title,-1); // remove from leftovers. at the end it will contain the leftovers

						}
					}
				}
			}
		}

		var allTags = [];
		for (var t in allTagsHolder)
			allTags.push(t);

		var sortHelper = function(a,b) {
			if (a == b) return 0;
			if (a < b) return -1;
			return 1;
		};

		allTags.sort(function(a,b) {
			var tidA = store.getTiddler(a);
			var tidB = store.getTiddler(b);
			if (sortBy == "title") return sortHelper(a,b);
			else if (!tidA && !tidB) return 0;
			else if (!tidA) return -1;
			else if (!tidB) return +1;
			else return sortHelper(tidA[sortBy],tidB[sortBy]);
		});

		var leftOverOutput = "";
		for (var i=0;i<leftOvers.length;i++)
			if (this.notHidden(leftOvers[i],title))
				leftOverOutput += "*[["+leftOvers[i]+"]]" + this.getTaggingCount(leftOvers[i]) + this.getExcerpt(title,leftOvers[i]) + "\n";

		var output = [];

		if (sortOrder == "desc")
			allTags.reverse();
		else if (leftOverOutput != "")
			// leftovers first...
			output.push(leftOverOutput);

		for (var i=0;i<allTags.length;i++)
			if (allTagsHolder[allTags[i]] != "")
				output.push("*[["+allTags[i]+"]]" + this.getTaggingCount(allTags[i]) + this.getExcerpt(title,allTags[i]) + "\n" + allTagsHolder[allTags[i]]);

		if (sortOrder == "desc" && leftOverOutput != "")
			// leftovers last...
			output.push(leftOverOutput);

		return this.drawTable(place,
				this.makeColumns(output,parseInt(this.getTagglyOpt(title,"numCols"))),
				"grouped");

	},

	// used to build site map
	treeTraverse: function(title,depth,sortBy,sortOrder) {

		var list = store.getTaggedTiddlers(title,sortBy);
		if (sortOrder == "desc")
			list.reverse();

		var indent = "";
		for (var j=0;j<depth;j++)
			indent += "*"

		var childOutput = "";
		for (var i=0;i<list.length;i++)
			if (list[i].title != title)
				if (this.notHidden(list[i].title,this.config.inTiddler))
					childOutput += this.treeTraverse(list[i].title,depth+1,sortBy,sortOrder);

		if (depth == 0)
			return childOutput;
		else
			return indent + "[["+title+"]]" + this.getTaggingCount(title) + this.getExcerpt(this.config.inTiddler,title,depth) + "\n" + childOutput;
	},

	// this if for the site map mode
	createTagglyListSiteMap: function(place,title) {
		this.config.inTiddler = title; // nasty. should pass it in to traverse probably
		var output = this.treeTraverse(title,0,this.getTagglyOpt(title,"sortBy"),this.getTagglyOpt(title,"sortOrder"));
		return this.drawTable(place,
				this.makeColumns(output.split(/(?=^\*\[)/m),parseInt(this.getTagglyOpt(title,"numCols"))), // regexp magic
				"sitemap"
				);
	},

	macros: {
		tagglyTagging: {
			handler: function (place,macroName,params,wikifier,paramString,tiddler) {
				var refreshContainer = createTiddlyElement(place,"div");
				// do some refresh magic to make it keep the list fresh - thanks Saq
				refreshContainer.setAttribute("refresh","macro");
				refreshContainer.setAttribute("macroName",macroName);
        			refreshContainer.setAttribute("title",tiddler.title);
				this.refresh(refreshContainer);
			},

			refresh: function(place) {
				var title = place.getAttribute("title");
				removeChildren(place);
				if (store.getTaggedTiddlers(title).length > 0) {
					var lingo = config.taggly.lingo;
					config.taggly.createListControl(place,title,"hideState");
					if (config.taggly.getTagglyOpt(title,"hideState") == "show") {
						createTiddlyElement(place,"span",null,"tagglyLabel",lingo.labels.label.format([title]));
						config.taggly.createListControl(place,title,"title");
						config.taggly.createListControl(place,title,"modified");
						config.taggly.createListControl(place,title,"created");
						config.taggly.createListControl(place,title,"listMode");
						config.taggly.createListControl(place,title,"excerpts");
						config.taggly.createListControl(place,title,"numCols");
						config.taggly.createTagglyList(place,title);
					}
				}
			}
		}
	},

	// todo fix these up a bit
	styles: [
"/*{{{*/",
"/* created by TagglyTaggingPlugin */",
".tagglyTagging { padding-top:0.5em; }",
".tagglyTagging li.listTitle { display:none; }",
".tagglyTagging ul {",
"	margin-top:0px; padding-top:0.5em; padding-left:2em;",
"	margin-bottom:0px; padding-bottom:0px;",
"}",
".tagglyTagging { vertical-align: top; margin:0px; padding:0px; }",
".tagglyTagging table { margin:0px; padding:0px; }",
".tagglyTagging .button { visibility:hidden; margin-left:3px; margin-right:3px; }",
".tagglyTagging .button, .tagglyTagging .hidebutton {",
"	color:[[ColorPalette::TertiaryLight]]; font-size:90%;",
"	border:0px; padding-left:0.3em;padding-right:0.3em;",
"}",
".tagglyTagging .button:hover, .hidebutton:hover, ",
".tagglyTagging .button:active, .hidebutton:active  {",
"	border:0px; background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]];",
"}",
".selected .tagglyTagging .button { visibility:visible; }",
".tagglyTagging .hidebutton { color:[[ColorPalette::Background]]; }",
".selected .tagglyTagging .hidebutton { color:[[ColorPalette::TertiaryLight]] }",
".tagglyLabel { color:[[ColorPalette::TertiaryMid]]; font-size:90%; }",
".tagglyTagging ul {padding-top:0px; padding-bottom:0.5em; margin-left:1em; }",
".tagglyTagging ul ul {list-style-type:disc; margin-left:-1em;}",
".tagglyTagging ul ul li {margin-left:0.5em; }",
".editLabel { font-size:90%; padding-top:0.5em; }",
".tagglyTagging .commas { padding-left:1.8em; }",
"/* not technically tagglytagging but will put them here anyway */",
".tagglyTagged li.listTitle { display:none; }",
".tagglyTagged li { display: inline; font-size:90%; }",
".tagglyTagged ul { margin:0px; padding:0px; }",
".excerpt { color:[[ColorPalette::TertiaryDark]]; }",
".excerptIndent { margin-left:4em; }",
"div.tagglyTagging table,",
"div.tagglyTagging table tr,",
"td.tagglyTagging",
" {border-style:none!important; }",
".tagglyTagging .contents { border-bottom:2px solid [[ColorPalette::TertiaryPale]]; padding:0 1em 1em 0.5em;",
"  margin-bottom:0.5em; }",
".tagglyTagging .indent1  { margin-left:3em;  }",
".tagglyTagging .indent2  { margin-left:4em;  }",
".tagglyTagging .indent3  { margin-left:5em;  }",
".tagglyTagging .indent4  { margin-left:6em;  }",
".tagglyTagging .indent5  { margin-left:7em;  }",
".tagglyTagging .indent6  { margin-left:8em;  }",
".tagglyTagging .indent7  { margin-left:9em;  }",
".tagglyTagging .indent8  { margin-left:10em; }",
".tagglyTagging .indent9  { margin-left:11em; }",
".tagglyTagging .indent10 { margin-left:12em; }",
"/*}}}*/",
		""].join("\n"),

	init: function() {
		merge(config.macros,this.macros);
		config.shadowTiddlers["TagglyTaggingStyles"] = this.styles;
		store.addNotification("TagglyTaggingStyles",refreshStyles);
	}
};

config.taggly.init();

//}}}

/***
InlineSlidersPlugin
By Saq Imtiaz
http://tw.lewcid.org/sandbox/#InlineSlidersPlugin

// syntax adjusted to not clash with NestedSlidersPlugin
// added + syntax to start open instead of closed

***/
//{{{
config.formatters.unshift( {
	name: "inlinesliders",
	// match: "\\+\\+\\+\\+|\\<slider",
	match: "\\<slider",
	// lookaheadRegExp: /(?:\+\+\+\+|<slider) (.*?)(?:>?)\n((?:.|\n)*?)\n(?:====|<\/slider>)/mg,
	lookaheadRegExp: /(?:<slider)(\+?) (.*?)(?:>)\n((?:.|\n)*?)\n(?:<\/slider>)/mg,
	handler: function(w) {
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart ) {
			var btn = createTiddlyButton(w.output,lookaheadMatch[2] + " "+"\u00BB",lookaheadMatch[2],this.onClickSlider,"button sliderButton");
			var panel = createTiddlyElement(w.output,"div",null,"sliderPanel");
			panel.style.display = (lookaheadMatch[1] == '+' ? "block" : "none");
			wikify(lookaheadMatch[3],panel);
			w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
		}
   },
   onClickSlider : function(e) {
		if(!e) var e = window.event;
		var n = this.nextSibling;
		n.style.display = (n.style.display=="none") ? "block" : "none";
		return false;
	}
});

//}}}

// for sorting tiddlers

merge(Tiddler.prototype,{

	sort_tickleDate: function() { return this.modified; }, // todo 

	sort_orderSlice: function() { return store.getTiddlerSlice(this.title,"order"); }

});
// for displaying tiddlers in lists

// idea: use <<tiddler with:?>>


if (!config.mGTD) config.mGTD = {};

config.mGTD.data = {
	starOn:    'data:image/gif;base64,R0lGODlhDwAPAMQfAF9h4RYVnZeQJC0u0lRQU42R6P/7Fv74L05NrRkZxi4tW52XXv71D8nAIWxnjnRxr3NuMJKOluXbBe7kCa2x7UFD1vPoB77D8Jqe6n6B5tvTUr62BMrP8lJPh1xbuv///yH5BAEAAB8ALAAAAAAPAA8AAAWD4CeOWQKMaDpESepi3tFlLgpExlK9RT9ohkYi08N8KhWP8nEwMBwIDyJRSTgO2CaDYcBOCAlMgtDYmhmTDSFQ+HAqgbLZIlAMLqiKw7m1EAYuFQsGEhITEwItKBc/EgIEAhINAUYkCBIQAQMBEGonIwAKa21iCgo7IxQDFRQjF1VtHyEAOw==',
	starOff:   'data:image/gif;base64,R0lGODlhDwAPALMPAP///8zj++r7/7vb/rHW/tPt/9Lk+qzT/rbY/sHh/8Te/N7q+Nzy/7nY/djn+f///yH5BAEAAA8ALAAAAAAPAA8AAARg8MkZjpo4k0KyNwlQBB42MICAfEF7APDRBsYzIEkewGKeDI1DgUckMg6GTdFIqC0QgyUgQVhgGkOi4OBBCJYdzILAywIGNcoOgCAQvowBRpE4kgzCQgPjQCAcEwsNTRIRADs=',
	yuiSprite: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAfQCAMAAACHRu2lAAADAFBMVEX////56Lbe3+DrwjXpuiX0yKLokkL2NDSthiL60Jr4YV7xs4ely/8vPqzXsyj1j4/KzumdnZ3MfApzhs5uiqzaow3hehKBmbfx1Ebh4uPopxvUCAH4JCQoMZPg4OGEh8E/atHi4+P1R0ehcw7osjqWqsP4FRXoqzv658otK2vcTQTmmhX1slX76t/mnD/tiRvnpD3laAREWbPqvTczQ6zq6uvxqGG5utdtbW3VMQGtscTOtm6FhYX3VVX0dXX4175zc3Pm5ubqwCna2tvElhb4Cwvmdi7OsUzc3N3Q0dIlK4cTDkv566j3xIC0k0j24FM7Q5tSY7rtiyH71dV+f6zkig7wmjTmsh5JSUkuN5z2amrodA7peRThdBEZG2pcfsrZxovrVlf2enp3dJPgWQLlyk0fJHdNaMMkKpE8Ubbptzj5xcXfyXXwlizX2Nr+/v7BwcH8/Pz7+/v6+vr39/fn6Ojj4+Xv8PD19fVCb9nm8f/f4ODs7Ozy8vL29vbh4eLg4eL19fYAAADn8f/c7P/V5//n8v/5+frH3//o6uri7v/r6+zj8P/l5ubf4OH6+vvx8fLX6P/5+fnr7Ozl8P/R5v/L4v/P4//E3f/f7f/39/na6f/g7f/y9PTt7+9Bbtd/f38iIiLy8vT19vbMztDn6Oqsr7Dw8PHx8fH5+vq+wcLJyss7Zcs5YcS62P/29vdAa9Ts7e3U1dYuUrAwVrXo6Oo5Y8g9Z87d3d/v7+/09PT09fXExca4u703X8Ls7O3m5+jw8PDt7e/X19jw8fGztbfl5eZAbNVAbdbx8vIoTKYrTqvhdxvx0lj5vLzzUkf1y0yxsbHh5++Wlpbzzjxqamrm2sHx1WfXhgbo6Oj7f3/14Iz8cXfPt4f97+LWPCDh7v+eo9Gkq9vy+f/ujynkznb711DqCgvzozvnfhfqkWH+/fRRb8b22n3iYQ0gJIH77Ww6TbLtLi+kpKXbwE1mZmYmR6Dm5ufb3N2/2v+lqKvY2Nrc3d/o8v////8zW7zbSCWcAAAAAXRSTlMAQObYZgAACOFJREFUeNrt3Hl4FPUdx/FvmpAgsIFgwJCwseRGMEuuutoQIglyRCRYyWYBoSpijFpBsd221Oja1lpaa7V3a9vtfd/3Se8rgYSQpijWorRKD+hd29ppf/NLKnGP+X2iEza7fF5/BJ593s9vZ3aTZ77PzsyKBZIkhjeC8HAnSG4Cyc0guRcknwbJ10HyE5C8BCTfBsldIHk9SOaB5EmQ/BvEkCFDhgwZMmTIMBVDItJ6QBMQ3gaSYpA8ByRfAckqkLSA5Hsg+RxIVoPkAyD5OEi+AZKPgeSbIPkBSD4Ekn+BGDJkyJAhQ4YMGU6ikIjGx/2T8e6fY78TJLtAcitIQiC5HyT3gOTDIPkqSD4LkvtA0gCSD4JkLwi/YODFIPzKAvjDq7tB+IdXT4AYMmTIkCFDhgwZRodENGJHfLFdgg8Hdjz7cCCkfoQGjOGAvzFkhRr9A6ZQNY27G+3a9NSqbD7ZOe3M7mZ/825gZ9AV4W3MG93rPOOKeaGnfrr0zphC+LeHiIgm9wTg2DkfCp5x6PcnJ/SPci9M4s64/M4Ij+ZERJwAJnwCSFY4IRNAmrw8nACIiE63CSBJZwGedg7AORxzDsAxDI35fN3wmf2YziHM8/v3QDsDrwhvozX2HIDpdcwLufzO8CwAEREngAmcAAZCWDgwIUdX6DoAy9rjP3kcdmNFeBvxvc4LuT6bcQIgIkpXfojqdiA3De7wT0iI3IaYIGzobIgXxtyceCgSHop6SIfR9ybujYQje6Me02HU1/9eqLoLo78TWIdRtyZ2hsOrY+5X1OHtTzdPrTgv6rHbdfiKKMWqLI56TIcx3+u7KhLujHpIh7tjtHS2RD2iw1sAOkRuyNPhywE6hPjx33AiIk4A6TQB+BsShFEH+6Fw5FDMUBBvAog3AMSdAOKOAPEmgF27VofDncAEEHcEiDcBxBsA4k4AfwtHVsUMBXEngJjDPycAIqLU95dmf3Me0DUO9lg9g43GLm9QH7kHjWs29+iwp9k4pIwOA37XVhwc3cZB1/Zaralex0H+OhERUcq4ID8/vxzozio/YB0oP8vYlZf/asaMGXeUG9fMPzDDdiDfGFo6fDTftRXhbbT3+lFkr9Wa4OtIREQ0KaT5dQANDdBZgJ2HIrGnARKcBYCuA7DPAcSeBog9C7BARQv0D8NZgCF9BmBeJNxpOAtQ3Fk85h/DdQBxJLgOgGcBiIg4AaTWlYDYdQBxxZkAhvTBf++QaQIY0gd/NQYMuTUB6KsAYi8ESHAdAHgl4KpI7IUA8SeAlhZOAERElH7CI9ASXRN9dr4BRMn03hFoia6JPjvfAKJTesTHRwN8hsCHDbdX5KRBNK4jPj4a4DMEPmy4vSInDaJTNBSM4wCOf6gQ5sGZKCWGgnEcwPEPFeCDOBGd+oM+thZ0IFcNzzcQpdRBH1sLOpCrhucbaJLJzDQ3vSJnZGbW1Z2h/2vu6roN5RLV1WX013V3q3KJ8/aNdGVl1YaNrKuz+u2uLNsYZvSrrLKy1xB2d/+hX2WVS4xhWX+/3ZnCjLKMfjtbUt2bgXXVzmVv5f+z6uxspyev7B0j2/yG9/IPg4gove07vF85vM/Y7Z82bdrS/SU5+8zd0qamphJDaXclL1D/mZmT41g+sHGj7qRJhU0O4f4HnlovZ36Ocyhy3dIcHVYYwivtquS6mfOLHMKSjXqxnJkiV1Y4heoJFb0XORV/dggPq2yp3u2ZFSs2Or2OFRUV0/R+r1hR5PyKq7KipGS+qVPlihFF5t+KKx4rKnrsin38OyIiSjkPHlT6HjR2qvrN8uVZWX2Grk9VdmcsVaWKvkAgsMgQZmXphQOBDYZd6bOfsq+wsPAXwI7rrs+9TgoLF0GdLAI7Fc52OYRt2ACuCIezZ7u9jURE9Cyd3d7V1dV+tik7LxisvbbeE+zynufcddX+vv4R6xGPx3vCsQzWXuPxzLJmeVS5xmn76rfWezy169er0HPissRhe32tKs48cqYdehcmDrv+pBYcfWpPcItDuPXak6GnLXF4YmzodQjb118zGga93u0O23hZ+9ZgMKhCr9J2lcPrs6a23esdCbe0Ob4zW054vUdmHbG7C5zfw4Vbtq/xrtneZujs7VzY1ta28Cr+GRERpZxf5yrXm7u/Xn1xRkFm7krjelf/LmNdwcHluc83hLkXZ/zRDrNaTWHBunV2GDCGBwsKqqoyswJTDeH1uZmZw8NZgVbTNsrK3Kzh4UDrJebXZ+Wc4eE5U4EX/IVzlEuQsFRBwp9rQPhQae4cbMWpra2lD0G/P6Wl/BsiIkpF/wElM3w1SO4AyctAePgmkLwOJK8FybtA8naQvBIk7wTJG0HyKpC8GSRvBclbQPIakLwNJP8EMWTIkCFDhgwZMowOiWh8XgpKZvgeEB7+GCQ/AslnQPJcEB5+GSSfAMmXQPJJkHwLJP8F4eEXQPJ5kPwMJD8Fyd9BDBkyZMiQIUOGDKNDIpogFiglwhtBExDuBOHhTSC5GSR3guQdILkVJCGQfA0k94DkOyD5Lkj2gOSLIPkHiCFDhgwZMmTIkGF0SESn8WcADBkyTL8wFT7bgz+yewNIPgpK5kd27wPJ90HybpDcB5K7QPiguQAkd4PkCZC8CMSQIUOGp1tIRNqnQPgdOfBN0PBt1fCN2vCt3/DN5PDt6fAN7/At9PBN+fBt/vAXB8BfRQB/uQH8dQnuf1MD/CUR8NdOpMJ3aDBkyJAhQ4YMGZ4uIRGl3+n9tDppdy9IdoHk/SC5HyQfAeHn4uCr4m8ByQ9BchtIngQxZMiQIUOGDBkynEQhET0T02tqpiPdspqOG2qWAWH2pWsXb8o2d1NqFlu/9NVMMYbHjq61LN+mXuOebHp8sQp9pv05d1NHR4d6at/m4+c6hs/b/LjPZ1X5fL7jv3Xqqmo6LvX5qtaq8Ng5Ti9R9uYbVNNx1A63XeT4Wqvk6LIpx+bOndt7/nSHBY8p1ZY117bt4YTh8ct1MWW6/ufyooThRdu2naOcrxUVPcw/ECIiIiIionTwP2GPpt8/BTzoAAAAAElFTkSuQmCC',

	unicodeStar: "\u2605" // "black star"
};


merge(Tiddler.prototype,{

	render_Action: function() { return this.renderUtil(
		'{{action{'+
		'<<toggleTag Done [[%0]] ->>'+
		'<<multiToggleTag tag:ActionStatus title:[[%0]]>>'+
		//'<<multiSelectTag tag:Project title:[[%0]]>>'+
		//'<<multiCheckboxTag tag:ActionStatus title:[[%0]]>>'+
		'<<singleToggleTag tag:Starred title:[[%0]]>>'+
		' &nbsp;[[%0]] }}}',
		[
			this.title
		]
	);},

	render_Project: function() { return this.renderUtil(
		'{{project{'+
		'<<toggleTag Complete [[%0]] ->>'+
		'<<multiToggleTag tag:ProjectStatus title:[[%0]]>>'+
		//'<<multiSelectTag tag:Project title:[[%0]]>>'+
		//'<<multiCheckboxTag tag:ActionStatus title:[[%0]]>>'+
		'<<singleToggleTag tag:Starred title:[[%0]]>>'+
		' &nbsp;[[%0]] }}}',
		[
			this.title
		]
	);},

	render_ProjectBare: function() { return this.renderUtil(
		'{{project{'+
		//'<<multiSelectTag tag:Project title:[[%0]]>>'+
		//'<<multiCheckboxTag tag:ActionStatus title:[[%0]]>>'+
		'<<singleToggleTag tag:Starred title:[[%0]]>>'+
		'&nbsp;[[%0]] }}}',
		[
			this.title
		]
	);},

	render_ActionProj: function() {

		// actually it's not going to be easy to have
		// an action in more than one project
		// but just in case....
		var pLink = "";
		this.getByIndex("Project").each(function(p){
			// shows just the P
			pLink += " [/%%/[[P|"+p+"]]]";
			// shows entire project
			//pLink += " [/%%/[["+p+"]]]";
		});

       		return this.renderUtil(
		'{{action{'+
		'<<toggleTag Done [[%0]] ->>'+
		'<<multiToggleTag tag:ActionStatus title:[[%0]]>>'+
		'<<singleToggleTag tag:Starred title:[[%0]]>>'+
		' &nbsp;[[%0]] %1}}}',
		[
			this.title,
			pLink
		]
	);},

	render_DoneAction: function() { return this.renderUtil(
		'{{action{'+
		'<<toggleTag Done [[%0]] ->>'+
		' [[%0]] }}}',
		[
			this.title
		]
	);},

	render_ProjectHeading: function() { return this.renderUtil(
		'{{project{'+
		'[[%0]] '+
		'<<toggleTag Complete [[%0]] ->>'+
		'@@font-size:80%;<<multiToggleTag tag:ProjectStatus title:[[%0]]>>@@'+
		'<<singleToggleTag tag:Starred title:[[%0]]>>'+
 		'}}}',
		[
			this.title
		]
	);},

	render_Context: function() { return this.renderUtil(
		'[[%0]]',
		[
			this.title
		]
	);},

	render_plain: function() { return this.renderUtil(
		'[[%0]]',
		[
			this.title
		]
	);}



});


!Project
<!--{{{-->
<span class='title' macro='view title'></span> (Project)
<span macro="toggleTag Complete . -"></span>
<span macro="multiToggleTag ProjectStatus longVersion:on"></span>
<span macro="singleToggleTag tag:Starred"></span>
<br/>
Area:<span macro="multiSelectTag Area allowNone:on"></span>
Realm:<span macro="multiSelectTag Realm"></span>
[[MonkeyGTDTheme##Subtitle]]
<!--}}}-->

!Action
<!--{{{-->
<span class='title' macro='view title'></span> (Action)
<span macro="toggleTag Done . -"></span>
<span macro="multiToggleTag ActionStatus longVersion:on"></span>
<span macro="singleToggleTag tag:Starred"></span>
<br/>
Context:<span macro="multiSelectTag Context allowNone:on"></span>
Project:<span macro="multiSelectTag Project allowNone:on"></span>
Realm:<span macro="multiSelectTag Realm"></span>
[[MonkeyGTDTheme##Subtitle]]
<!--}}}-->

!View
<!--{{{-->
<span class='title' macro='view title'></span>
<!--}}}-->

!Context
<!--{{{-->
<span class='title' macro='view title'></span> (Context)
<!--}}}-->

<div macro="showWhenTagged 'Project'">[[TitleButtons##Project]]</div>
<div macro="showWhenTagged 'Action'">[[TitleButtons##Action]]</div>
<div macro="showWhenTagged 'View'">[[TitleButtons##View]]</div>
<div macro="showWhenTagged 'Context'">[[TitleButtons##Context]]</div>
/***
|Name:|ToggleTagPlugin|
|Description:|Makes a checkbox which toggles a tag in a tiddler|
|Version:|3.0.1 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#ToggleTagPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Usage
{{{<<toggleTag }}}//{{{TagName TiddlerName LabelText}}}//{{{>>}}}
* TagName - the tag to be toggled, default value "checked"
* TiddlerName - the tiddler to toggle the tag in, default value the current tiddler
* LabelText - the text (gets wikified) to put next to the check box, default value is '{{{[[TagName]]}}}' or '{{{[[TagName]] [[TiddlerName]]}}}'
(If a parameter is '.' then the default will be used)
!!Examples
|Code|Description|Example|h
|{{{<<toggleTag>>}}}|Toggles the default tag (checked) in this tiddler|<<toggleTag>>|
|{{{<<toggleTag TagName>>}}}|Toggles the TagName tag in this tiddler|<<toggleTag TagName>>|
|{{{<<toggleTag TagName TiddlerName>>}}}|Toggles the TagName tag in the TiddlerName tiddler|<<toggleTag TagName TiddlerName>>|
|{{{<<toggleTag TagName TiddlerName 'click me'>>}}}|Same but with custom label|<<toggleTag TagName TiddlerName 'click me'>>|
|{{{<<toggleTag . . 'click me'>>}}}|dot means use default value|<<toggleTag . . 'click me'>>|
!!Notes
* If TiddlerName doesn't exist it will be silently created
* Set label to '-' to specify no label
* See also http://mgtd-alpha.tiddlyspot.com/#ToggleTag2
!!Known issues
* Doesn't smoothly handle the case where you toggle a tag in a tiddler that is current open for editing
* Should convert to use named params
***/
//{{{

merge(config.macros,{

	toggleTag: {

		createIfRequired: true,
		shortLabel: "[[%0]]",
		longLabel: "[[%0]] [[%1]]",

		handler: function(place,macroName,params,wikifier,paramString,tiddler) {
			var tag   = (params[0] && params[0] != '.') ? params[0] : "checked";
			var title = (params[1] && params[1] != '.') ? params[1] : tiddler.title;
			var label = (params[2] && params[2] != '.') ? params[2] : defaultLabel;
			var defaultLabel = (title == tiddler.title ? this.shortLabel : this.longLabel);
			label = (label == '-' ? '' : label);
			var theTiddler = (title == tiddler.title ? tiddler : store.getTiddler(title));
			var cb = createTiddlyCheckbox(place, label.format([tag,title]), theTiddler && theTiddler.isTagged(tag), function(e) {
				if (!store.tiddlerExists(title)) {
					if (config.macros.toggleTag.createIfRequired) {
						var content = store.getTiddlerText(title); // just in case it's a shadow
						store.saveTiddler(title,title,content?content:"",config.options.txtUserName,new Date(),null);
					}
					else 
						return false;
				}
				store.setTiddlerTag(title,this.checked,tag);
				return true;
			});
		}
	}
});

//}}}

order:2
button:w
buttonLong:waiting for
order:1
priority:1