<!--{{{-->
<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]];}

.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#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 0 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0 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:0 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 0.3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

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

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

.tiddlerPopupButton {padding:0.2em;}
.popupTiddler {position: absolute; z-index:300; padding: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 0;}
.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 0 0 0.5em;}
.tab {margin:0 0 0 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 0 14em;}

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

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

.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:0 0.25em; padding:0 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 0; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}

.fieldsetFix {border:0; padding:0; margin: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;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding: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;}
noscript {display:none;} /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
}
/*}}}*/
<!--{{{-->
<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 [[ToolbarCommands::ViewToolbar]]'></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 [[ToolbarCommands::EditToolbar]]'></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 excludeLists'></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>>
&nbsp;&nbsp; <<tiddler "CustomCommands::NewNotification">> +++^[S8P Place Holder|S8P Place Holder]
----
~S8P Place Holder: ~WD73WA
xxxx09-xxxx09 EL Break in Work
Do not modify this Notification
Data not yet populated - Do not Delete / Release / etc.
Note: ~FunctLocation ~WD73WA & Main ~WorkCtr EL
----
===

<script>
   var out=[];
   var fmt='| [[%0|%0]] | %1 | %2 | %3 |';
   var tids=store.getMatchingTiddlers("Notification && ! excludeLists && ! Trash","created").reverse();
   var hdr="| !Notification # | !Tag | !Info | !Work Order # |h"

   out.push(hdr);
	if (!tids.length) out=["No Notifications found"];

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	var val2=tids[i].tags;
	var val3=store.getTiddlerSlice(val1,'Info')
	var val4=store.getTiddlerSlice(val1,'WorkOrder')
	out.push(fmt.format([val1,val2,val3,val4]));
   }
   return out.join('\n');
</script>
/***
|Name|AutoClearMessage|
|Description|Automatically Clear displayMessage|
|Version|1.0|
|Author|Morris Gray|
!!!Code
***/
//{{{
window.oldDisplayMessage = displayMessage;
displayMessage = function (text,linkText)
{ oldDisplayMessage(text,linkText);
setTimeout( 'clearMessage()', 7000 );}
//}}}

!!~ExxonMobil US Production
!!BEHAVIORAL JOB SAFETY ANALYSIS WORKSHEET
Location: WDWA
Date:<<today>>
Revision: 1
Analysis Made By:  <<tiddler ShowUserName>>
Supervisor: L. Rutland / L. Christensen
!!!!''Job: ''
!!!Personal Protective Equipment:
| [_(hat@)]Hard Hat | [_(glasses@)]Safety Glasses | [_(boots@)]Steel Toe Boots | [_(gloves@)]Work Gloves | [_(buds@)]Hearing Protection | [_(radio@)]Radio |
| [_(res@)]Respirator | [_(facesheild@)]Face Shield | [_(rubbergloves@)]Rubber Gloves | [_(rubberapron@)]Rubber Apron | [_(goggles@)]Goggles | [_(vest@)]Work Vest |
| [_(harness@)]Safety Harness | [_(detector@)]Gas Detector | [_(norm@)]NORM Meter | [_(firext@)]Fire Extinguisher | [_(container@)]Container for parts | [_(bucket@)]Bucket |
!!!Analysis
| Sequence of Basic Job Steps | Potential Accidents or Hazards | Recommended Safe Job Procedure written in Behavioral Terms  (When…. Do….) |
| 1) Review / Update BJSA | BJSA Current | Steps in Order and Complete When working, verify the BJSA reflects current weather, SIMOPS, staffing and other working variables When writing a BJSA ensure all hazards are identified and job steps are in sequential order |
| 2) Keep BJSA on Person | BJSA Accessible | When performing task, BJSA must be available for review, reference and upgrade |
| 3) Step Back 5x5 and evaluate weather conditions | Proper clothing, Proper Hydration, taking breaks as needed in inclement weather | When working outdoors make sure you are wearing the appropriate clothing for the weather.  Maintain proper hydration year round and emphasize increased water consumption in the summer months.  Take breaks as needed to get out of inclement weather (Heat, Rain, Cold, ect.) |
| 4)  |  |  |
| 5)  |  |  |
| 6)  |  |  |
| 7)  |  |  |
| 8) |  |  |
| 9) |  |  |
| 10) |  |  |
| 11) |  |  |
| 12) Step Back 5x5 | unknown hazards | Use this step to identify hazards before, during, and after the job.  This will allow hazards to become known to all workers in the area. |
| 13) Critique and Update BJSA if anything changes while performing job. | unknown hazards, BJSA Current | After using the Step Back 5x5 procedure and identifying new hazards, use this to critique and update BJSA  once the hazard has been identified. When working, verify the BJSA reflects current weather, SIMOPS, staffing and other working variables. |

/***
|Name|CheckboxPlugin|
|Source|http://www.TiddlyTools.com/#CheckboxPlugin|
|Documentation|http://www.TiddlyTools.com/#CheckboxPluginInfo|
|Version|2.4.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Add checkboxes to your tiddler content|
This plugin extends the TiddlyWiki syntax to allow definition of checkboxes that can be embedded directly in tiddler content.  Checkbox states are preserved by:
* by setting/removing tags on specified tiddlers,
* or, by setting custom field values on specified tiddlers,
* or, by saving to a locally-stored cookie ID,
* or, automatically modifying the tiddler content (deprecated)
When an ID is assigned to the checkbox, it enables direct programmatic access to the checkbox DOM element, as well as creating an entry in TiddlyWiki's config.options[ID] internal data.  In addition to tracking the checkbox state, you can also specify custom javascript for programmatic initialization and onClick event handling for any checkbox, so you can provide specialized side-effects in response to state changes.
!!!!!Documentation
>see [[CheckboxPluginInfo]]
!!!!!Revisions
<<<
2008.01.08 [*.*.*] plugin size reduction: documentation moved to [[CheckboxPluginInfo]]
2008.01.05 [2.4.0] set global "window.place" to current checkbox element when processing checkbox clicks.  This allows init/beforeClick/afterClick handlers to reference RELATIVE elements, including using "story.findContainingTiddler(place)".  Also, wrap handlers in "function()" so "return" can be used within handler code.
|please see [[CheckboxPluginInfo]] for additional revision details|
2005.12.07 [0.9.0] initial BETA release
<<<
!!!!!Code
***/
//{{{
version.extensions.CheckboxPlugin = {major: 2, minor: 4, revision:0 , date: new Date(2008,1,5)};
//}}}
//{{{
config.checkbox = { refresh: { tagged:true, tagging:true, container:true } };
config.formatters.push( {
	name: "checkbox",
	match: "\\[[xX_ ][\\]\\=\\(\\{]",
	lookahead: "\\[([xX_ ])(=[^\\s\\(\\]{]+)?(\\([^\\)]*\\))?({[^}]*})?({[^}]*})?({[^}]*})?\\]",
	handler: 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) {
			// get params
			var checked=(lookaheadMatch[1].toUpperCase()=="X");
			var id=lookaheadMatch[2];
			var target=lookaheadMatch[3];
			if (target) target=target.substr(1,target.length-2).trim(); // trim off parentheses
			var fn_init=lookaheadMatch[4];
			var fn_clickBefore=lookaheadMatch[5];
			var fn_clickAfter=lookaheadMatch[6];
			var tid=story.findContainingTiddler(w.output);  if (tid) tid=tid.getAttribute("tiddler");
			var srctid=w.tiddler?w.tiddler.title:null;
			config.macros.checkbox.create(w.output,tid,srctid,w.matchStart+1,checked,id,target,config.checkbox.refresh,fn_init,fn_clickBefore,fn_clickAfter);
			w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
		}
	}
} );
config.macros.checkbox = {
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		if(!(tiddler instanceof Tiddler)) { // if no tiddler passed in try to find one
			var here=story.findContainingTiddler(place);
			if (here) tiddler=store.getTiddler(here.getAttribute("tiddler"))
		}
		var srcpos=0; // "inline X" not applicable to macro syntax
		var target=params.shift(); if (!target) target="";
		var defaultState=params[0]=="checked"; if (defaultState) params.shift();
		var id=params.shift(); if (id && !id.length) id=null;
		var fn_init=params.shift(); if (fn_init && !fn_init.length) fn_init=null;
		var fn_clickBefore=params.shift();
		if (fn_clickBefore && !fn_clickBefore.length) fn_clickBefore=null;
		var fn_clickAfter=params.shift();
		if (fn_clickAfter && !fn_clickAfter.length) fn_clickAfter=null;
		var refresh={ tagged:true, tagging:true, container:false };
		this.create(place,tiddler.title,tiddler.title,0,defaultState,id,target,refresh,fn_init,fn_clickBefore,fn_clickAfter);
	},
	create: function(place,tid,srctid,srcpos,defaultState,id,target,refresh,fn_init,fn_clickBefore,fn_clickAfter) {
		// create checkbox element
		var c = document.createElement("input");
		c.setAttribute("type","checkbox");
		c.onclick=this.onClickCheckbox;
		c.srctid=srctid; // remember source tiddler
		c.srcpos=srcpos; // remember location of "X"
		c.container=tid; // containing tiddler (may be null if not in a tiddler)
		c.tiddler=tid; // default target tiddler 
		c.refresh = {};
		c.refresh.container = refresh.container;
		c.refresh.tagged = refresh.tagged;
		c.refresh.tagging = refresh.tagging;
		place.appendChild(c);
		// set default state
		c.checked=defaultState;
		// track state in config.options.ID
		if (id) {
			c.id=id.substr(1); // trim off leading "="
			if (config.options[c.id]!=undefined)
				c.checked=config.options[c.id];
			else
				config.options[c.id]=c.checked;
		}
		// track state in (tiddlername|tagname) or (fieldname@tiddlername)
		if (target) {
			var pos=target.indexOf("@");
			if (pos!=-1) {
				c.field=pos?target.substr(0,pos):"checked"; // get fieldname (or use default "checked")
				c.tiddler=target.substr(pos+1); // get specified tiddler name (if any)
				if (!c.tiddler || !c.tiddler.length) c.tiddler=tid; // if tiddler not specified, default == container
				if (store.getValue(c.tiddler,c.field)!=undefined)
					c.checked=(store.getValue(c.tiddler,c.field)=="true"); // set checkbox from saved state
			} else {
				var pos=target.indexOf("|"); if (pos==-1) var pos=target.indexOf(":");
				c.tag=target;
				if (pos==0) c.tag=target.substr(1); // trim leading "|" or ":"
				if (pos>0) { c.tiddler=target.substr(0,pos); c.tag=target.substr(pos+1); }
				if (!c.tag.length) c.tag="checked";
				var t=store.getTiddler(c.tiddler);
				if (t && t.tags)
					c.checked=t.isTagged(c.tag); // set checkbox from saved state
			}
		}
		// trim off surrounding { and } delimiters from init/click handlers
		if (fn_init) c.fn_init="(function(){"+fn_init.trim().substr(1,fn_init.length-2)+"})()";
		if (fn_clickBefore) c.fn_clickBefore="(function(){"+fn_clickBefore.trim().substr(1,fn_clickBefore.length-2)+"})()";
		if (fn_clickAfter) c.fn_clickAfter="(function(){"+fn_clickAfter.trim().substr(1,fn_clickAfter.length-2)+"})()";
		c.init=true; c.onclick(); c.init=false; // compute initial state and save in tiddler/config/cookie
	},
	onClickCheckbox: function(event) {
		window.place=this;
		if (this.init && this.fn_init) // custom function hook to set initial state (run only once)
			{ try { eval(this.fn_init); } catch(e) { displayMessage("Checkbox init error: "+e.toString()); } }
		if (!this.init && this.fn_clickBefore) // custom function hook to override changes in checkbox state
			{ try { eval(this.fn_clickBefore) } catch(e) { displayMessage("Checkbox onClickBefore error: "+e.toString()); } }
		if (this.id)
			// save state in config AND cookie (only when ID starts with 'chk')
			{ config.options[this.id]=this.checked; if (this.id.substr(0,3)=="chk") saveOptionCookie(this.id); }
		if (this.srctid && this.srcpos>0 && (!this.id || this.id.substr(0,3)!="chk") && !this.tag && !this.field) {
			// save state in tiddler content only if not using cookie, tag or field tracking
			var t=store.getTiddler(this.srctid); // put X in original source tiddler (if any)
			if (t && this.checked!=(t.text.substr(this.srcpos,1).toUpperCase()=="X")) { // if changed
				t.set(null,t.text.substr(0,this.srcpos)+(this.checked?"X":"_")+t.text.substr(this.srcpos+1),null,null,t.tags);
				if (!story.isDirty(t.title)) story.refreshTiddler(t.title,null,true);
				store.setDirty(true);
			}
		}
		if (this.field) {
			if (this.checked && !store.tiddlerExists(this.tiddler))
				store.saveTiddler(this.tiddler,this.tiddler,"",config.options.txtUserName,new Date());
			// set the field value in the target tiddler
			store.setValue(this.tiddler,this.field,this.checked?"true":"false");
			// DEBUG: displayMessage(this.field+"@"+this.tiddler+" is "+this.checked);
		}
		if (this.tag) {
			if (this.checked && !store.tiddlerExists(this.tiddler))
				store.saveTiddler(this.tiddler,this.tiddler,"",config.options.txtUserName,new Date());
			var t=store.getTiddler(this.tiddler);
			if (t) {
				var tagged=(t.tags && t.tags.indexOf(this.tag)!=-1);
				if (this.checked && !tagged) { t.tags.push(this.tag); store.setDirty(true); }
				if (!this.checked && tagged) { t.tags.splice(t.tags.indexOf(this.tag),1); store.setDirty(true); }
			}
			// if tag state has been changed, update display of corresponding tiddlers (unless they are in edit mode...)
			if (this.checked!=tagged) {
				if (this.refresh.tagged) {
					if (!story.isDirty(this.tiddler)) // the TAGGED tiddler in view mode
						story.refreshTiddler(this.tiddler,null,true); 
					else // the TAGGED tiddler in edit mode (with tags field)
						config.macros.checkbox.refreshEditorTagField(this.tiddler,this.tag,this.checked);
				}
				if (this.refresh.tagging)
					if (!story.isDirty(this.tag)) story.refreshTiddler(this.tag,null,true); // the TAGGING tiddler
			}
		}
		if (!this.init && this.fn_clickAfter) // custom function hook to react to changes in checkbox state
			{ try { eval(this.fn_clickAfter) } catch(e) { displayMessage("Checkbox onClickAfter error: "+e.toString()); } }
		// refresh containing tiddler (but not during initial rendering, or we get an infinite loop!) (and not when editing container)
		if (!this.init && this.refresh.container && this.container!=this.tiddler)
			if (!story.isDirty(this.container)) story.refreshTiddler(this.container,null,true); // the tiddler CONTAINING the checkbox
		return true;
	},
	refreshEditorTagField: function(title,tag,set) {
		var tagfield=story.getTiddlerField(title,"tags");
		if (!tagfield||tagfield.getAttribute("edit")!="tags") return; // if no tags field in editor (i.e., custom template)
		var tags=tagfield.value.readBracketedList();
		if (tags.contains(tag)==set) return; // if no change needed
		if (set) tags.push(tag); // add tag
		else tags.splice(tags.indexOf(tag),1); // remove tag
		for (var t=0;t<tags.length;t++) tags[t]=String.encodeTiddlyLink(tags[t]);
		tagfield.value=tags.join(" "); // reassemble tag string (with brackets as needed)
		return;
	}
}
//}}}

{{center{
{{tiddler{<<tiddler "CustomCommands::NewCigar">>+++^[Ratings Scale]<<tiddler [[Cigar Ratings System]]>>===}}}

{{small{
<script>
   var out=[];
   var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && ! Trash","created");
   var cigar=tids.length.toString();

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") != "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
	out.push([val1]);
   }
   var NR= out.length.toString();

return ("__" + cigar + " Cigar(s) found __" + "\n"+ NR + " Cigar(s) [[not Rated|CigarNR]]");
</script><script>
   var out=[];
   var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && ! Trash","created");

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") != "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "No") continue;
	out.push([val1]);
   }
   var RC= out.length.toString();

return (" & "+ RC + " Cigar(s) [[Recommended |CigarRec]] ");
</script>
}}}
{{centeredTable{
<script>
   var out=[];
   var fmt='| %0 | %1 | %2 | %3 | %4 | %5 | %6 | {{fine{[[%7|%7]]}}} |';
   var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && ! Trash","modified").reverse();
//   var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && ! Trash","+title");
   var hdr="|sortable|k\n| !Brand | !Name | !Size | !Wrapper | !Strength | !Personal Rank | !Professional Rank ||h"

   var out=[];
   out.push(hdr);
	if (!tids.length) out=["No Cigars found"];

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") < 9) continue;
	if (store.getTiddlerSlice(val1,"PersonalRank") == "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
	var val2=store.getTiddlerSlice(val1,'Brand')
	var val3=store.getTiddlerSlice(val1,'Name')
	var val4=store.getTiddlerSlice(val1,'Size')
	var val5=store.getTiddlerSlice(val1,'Wrapper')
	var val6=store.getTiddlerSlice(val1,'Strength')
	var val7=store.getTiddlerSlice(val1,'PersonalRank')
	var val8=store.getTiddlerSlice(val1,'ProfessionalRank')
	out.push(fmt.format([val2,val3,val4,val5,val6,val7,val8,val1]));
   }
   return out.join('\n');
</script>
}}}
+++[Ranked Below 9]
{{centeredTable{
<script>
   var out=[];
   var fmt='| %0 | %1 | %2 | %3 | %4 | %5 | %6 | {{fine{[[%7|%7]]}}} |';
   var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && ! Trash","modified").reverse();
//   var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && ! Trash","+title");
   var hdr="|sortable|k\n| !Brand | !Name | !Size | !Wrapper | !Strength | !Personal Rank | !Professional Rank ||h"

   var out=[];
   out.push(hdr);
	if (!tids.length) out=["No Cigars found"];

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") >=9 ) continue;
	if (store.getTiddlerSlice(val1,"PersonalRank") <8 ) continue;
	if (store.getTiddlerSlice(val1,"PersonalRank") == "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
	var val2=store.getTiddlerSlice(val1,'Brand')
	var val3=store.getTiddlerSlice(val1,'Name')
	var val4=store.getTiddlerSlice(val1,'Size')
	var val5=store.getTiddlerSlice(val1,'Wrapper')
	var val6=store.getTiddlerSlice(val1,'Strength')
	var val7=store.getTiddlerSlice(val1,'PersonalRank')
	var val8=store.getTiddlerSlice(val1,'ProfessionalRank')
	out.push(fmt.format([val2,val3,val4,val5,val6,val7,val8,val1]));
   }
   return out.join('\n');
</script>
}}}===
+++[Ranked Below 8]
{{centeredTable{
<script>
   var out=[];
   var fmt='| %0 | %1 | %2 | %3 | %4 | %5 | %6 | {{fine{[[%7|%7]]}}} |';
   var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && ! Trash","modified").reverse();
//   var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && ! Trash","+title");
   var hdr="|sortable|k\n| !Brand | !Name | !Size | !Wrapper | !Strength | !Personal Rank | !Professional Rank ||h"

   var out=[];
   out.push(hdr);
	if (!tids.length) out=["No Cigars found"];

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") >=8 ) continue;
	if (store.getTiddlerSlice(val1,"PersonalRank") == "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
	var val2=store.getTiddlerSlice(val1,'Brand')
	var val3=store.getTiddlerSlice(val1,'Name')
	var val4=store.getTiddlerSlice(val1,'Size')
	var val5=store.getTiddlerSlice(val1,'Wrapper')
	var val6=store.getTiddlerSlice(val1,'Strength')
	var val7=store.getTiddlerSlice(val1,'PersonalRank')
	var val8=store.getTiddlerSlice(val1,'ProfessionalRank')
	out.push(fmt.format([val2,val3,val4,val5,val6,val7,val8,val1]));
   }
   return out.join('\n');
</script>
}}}===}}}
| Personal | Professional | Reference Information |h
| 10 | 95-100 | the rare classic, memorable cigars reserved for special occasions and events |
| 9 | 90-94 | exemplary, among the best |
| 8 | 85-89 | good-to-excellent, a respectable staple in any collection |
| 7 | 80-84 | just okay. Probably wouldn’t buy it again, but would happily smoke if gifted |
| 6 | 75-79 | may have merit, but also has serious issues. Humi-fodder that eventually gets tossed |
| 5 | <75 | should be banished to the composter before it contaminates something |
{{centeredTable{
<script>
   var out=[];
   var fmt='| %0 | %1 | %2 | %3 | %4 | {{fine{[[%5|%5]]}}} |';
   var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && ! Trash","created");
//   var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && ! Trash","+title");
   var hdr="|sortable|k\n| !Brand | !Name | !Wrapper | !Recommended By | !Purchased ||h"

   out.push(hdr);
	if (!tids.length) out=["No Cigars found"];

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") != "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
	var val2=store.getTiddlerSlice(val1,'Brand')
	var val3=store.getTiddlerSlice(val1,'Name')
	var val4=store.getTiddlerSlice(val1,'Wrapper')
	var val5=store.getTiddlerSlice(val1,'RecommendedBy')
	var val6=store.getTiddlerSlice(val1,'Purchased')
	out.push(fmt.format([val2,val3,val4,val5,val6,val1]));
   }
   return out.join('\n');
</script>
}}}
{{centeredTable{
<script>
   var out=[];
   var fmt='| %0 | %1 | %2 | %3 | %4 | {{fine{[[%5|%5]]}}} |';
   var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && ! Trash","created");
//   var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && ! Trash","+title");
   var hdr="|sortable|k\n| !Brand | !Name | !Wrapper | !Recommended By | !Purchased ||h"

   out.push(hdr);
	if (!tids.length) out=["No Cigars found"];

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") != "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "No") continue;
	var val2=store.getTiddlerSlice(val1,'Brand')
	var val3=store.getTiddlerSlice(val1,'Name')
	var val4=store.getTiddlerSlice(val1,'Wrapper')
	var val5=store.getTiddlerSlice(val1,'RecommendedBy')
	var val6=store.getTiddlerSlice(val1,'Purchased')
	out.push(fmt.format([val2,val3,val4,val5,val6,val1]));
   }
   return out.join('\n');
</script>
}}}
Name: 
Brand: 
Size: 
Strength: ?
Wrapper: ?
Country: ?
~PersonalRank: Not Rated
~ProfessionalRank: N/A
~RecommendedBy: N/A
Purchased: No
!!!Notes:


<<newReminder>>
/***
|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;
	}

});

//}}}
{{floatright{<<paletteView {{story.findContainingTiddler(place).getAttribute('tiddler')}}>>}}}
Name: Orange
Background: #000
Foreground: #ff9
PrimaryPale: #000
PrimaryLight: #F60
PrimaryMid: #ed9121
PrimaryDark: #F60
SecondaryPale: #f90
SecondaryLight: #fc6
SecondaryMid: #F40
SecondaryDark: #ffa500
TertiaryPale: #000
TertiaryLight: #fc6
TertiaryMid: #555
TertiaryDark: #F90
{{floatright{<<paletteView {{story.findContainingTiddler(place).getAttribute('tiddler')}}>>}}}
Name: Blue
Background: #000
Foreground: #0af
PrimaryPale: #9eccf9
PrimaryLight: #fff
PrimaryMid: #06c
PrimaryDark: #72a3e4
SecondaryPale: #0252b1
SecondaryLight: #1e90ff
SecondaryMid: #9eccf9
SecondaryDark: #0af
TertiaryPale: #000
TertiaryLight: #06c
TertiaryMid: #ddd
TertiaryDark: #06c
{{floatright{<<paletteView {{story.findContainingTiddler(place).getAttribute('tiddler')}}>>}}}
Name: Brown
Background: #c95
Foreground: #ffc
PrimaryPale: #963
PrimaryLight: #930
PrimaryMid: #000
PrimaryDark: #930
SecondaryPale: #530
SecondaryLight: #630
SecondaryMid: #730
SecondaryDark: #000
TertiaryPale: #c95
TertiaryLight: #000
TertiaryMid: #DEB887
TertiaryDark: #930
{{floatright{<<paletteView {{story.findContainingTiddler(place).getAttribute('tiddler')}}>>}}}
Name: Fire
Background: #000
Foreground: #f50
PrimaryPale: #000
PrimaryLight: #F60
PrimaryMid: #ed9121
PrimaryDark: #F60
SecondaryPale: #FFEC8B
SecondaryLight: #FFEC8B
SecondaryMid: #fc6
SecondaryDark: #ffa500
TertiaryPale: #000
TertiaryLight: #fc6
TertiaryMid: #555
TertiaryDark: #F90
{{floatright{<<paletteView {{story.findContainingTiddler(place).getAttribute('tiddler')}}>>}}}
Name: Green
Background: #000
Foreground: #ff9
PrimaryPale: #444
PrimaryLight: #3f0
PrimaryMid: #0b0
PrimaryDark: #3c6
SecondaryPale: #222
SecondaryLight: #3f0
SecondaryMid: #563
SecondaryDark: #363
TertiaryPale: #000
TertiaryLight: #3f0
TertiaryMid: #444
TertiaryDark: #363
{{floatright{<<paletteView {{story.findContainingTiddler(place).getAttribute('tiddler')}}>>}}}
Name: Orange
Background: #000
Foreground: #ff9
PrimaryPale: #000
PrimaryLight: #F60
PrimaryMid: #ed9121
PrimaryDark: #F60
SecondaryPale: #f90
SecondaryLight: #fc6
SecondaryMid: #F40
SecondaryDark: #ffa500
TertiaryPale: #000
TertiaryLight: #fc6
TertiaryMid: #555
TertiaryDark: #F90
{{floatright{<<paletteView {{story.findContainingTiddler(place).getAttribute('tiddler')}}>>}}}
Name: Red
Background: #000
Foreground: #f30
PrimaryPale: #000
PrimaryLight: #f00
PrimaryMid: #c00
PrimaryDark: #f30
SecondaryPale: #ff0
SecondaryLight: #fc6
SecondaryMid: #ff9
SecondaryDark: #fc3
TertiaryPale: #000
TertiaryLight: #ffa500
TertiaryMid: #555
TertiaryDark: #f90
{{floatright{<<paletteView {{story.findContainingTiddler(place).getAttribute('tiddler')}}>>}}}
Name: White
Background: #000
Foreground: #ccc
PrimaryPale: #888
PrimaryLight: #eee
PrimaryMid: #fff
PrimaryDark: #ccc
SecondaryPale: #000
SecondaryLight: #303030
SecondaryMid: #999
SecondaryDark: #fff
TertiaryPale: #000
TertiaryLight: #ccc
TertiaryMid: #555
TertiaryDark: #ddd
{{floatright{<<paletteView {{story.findContainingTiddler(place).getAttribute('tiddler')}}>>}}}
Name: xx Bloody2
HeaderTop: #300
HeaderMid: #f00
HeaderBottom: #300
Background: #b22222
Foreground: #fff
PrimaryPale: #b22222
PrimaryLight: #400
PrimaryMid: #300
PrimaryDark: #900
SecondaryPale: #800
SecondaryLight: #d00
SecondaryMid: #ccc
SecondaryDark: #fff
TertiaryPale: #fff
TertiaryLight: #300
TertiaryMid: #600
TertiaryDark: #800
Error: #F30
Test: #0F0
{{floatright{<<paletteView {{story.findContainingTiddler(place).getAttribute('tiddler')}}>>}}}
Name: xx Inverse Default
Background: #04b
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #000
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
{{floatright{<<paletteView {{story.findContainingTiddler(place).getAttribute('tiddler')}}>>}}}
Name: xx STRM Blue 1
Background:#06c
Foreground: #fff
PrimaryPale: #9eccf9
PrimaryLight: #fff
PrimaryMid: #14163d
PrimaryDark: #72a3e4
SecondaryPale: #0252b1
SecondaryLight: #19f
SecondaryMid: #9be1ff
SecondaryDark: #9be1ff
TertiaryPale: #a1a1a1
TertiaryLight: #14163d
TertiaryMid: #ccc
TertiaryDark: #000
{{floatright{<<paletteView {{story.findContainingTiddler(place).getAttribute('tiddler')}}>>}}}
Name: xx TestPalette
Background: #000
Foreground: #ff0
PrimaryPale: #ccc
PrimaryLight: #6cf
PrimaryMid: #0b0
PrimaryDark: #ff9
SecondaryPale: #f00
SecondaryLight: #f0f
SecondaryMid: #c06
SecondaryDark: #306
TertiaryPale: #f60
TertiaryLight: #f9c
TertiaryMid: #996
TertiaryDark: #601
<<deleteCompleted daysOld:0 title:'Delete All Completed Items'>>
Business: 
Name: 
Phone: 
Email: mailto:
Webpage: 
Address: 
City, State: 
ZIP/Postal Code: 

!!!Notes

<<newReminder>>
| <<tiddler "CustomCommands::HomeContact">> | <<tiddler "CustomCommands::BillContact">> | <<tiddler "CustomCommands::EmergencyContact">> | <<tiddler "CustomCommands::WorkContact">> |
| <<tag [[Home Directory|HDir]]>> | <<tag Bills>> | <<tag [[Emergency Contacts|EmergencyContacts]]>> | <<tag [[Work Directory|WDir]]>> |
/***
|Name|CoreTweaks|
|Source|http://www.TiddlyTools.com/#CoreTweaks|
|Version|use with TW2.4.3|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.2.0|
|Type|plugin|
|Requires||
|Overrides|various|
|Description|a small collection of overrides to TW core functions|
This tiddler contains changes TW core functions to provide minor changes in standard features or behavior.  It is hoped that some of these tweaks may someday be added into the TW core, so that these adjustments will be available without needing these add-on definitions.
>''Note: the changes contained in this tiddler are generally applicable for version 2.4.3 of TiddlyWiki.''
>Please view [[CoreTweaksArchive]] for tweaks that may be used with earlier versions of TiddlyWiki.
***/
//{{{
// calculate TW version number - used to determine which tweaks should be applied
var ver=version.major+version.minor/10+version.revision/100;
//}}}
/***
----

***/
// // open tickets:
// // {{block{
/***
!!!890 add conditional test to """<<tiddler>>""" macro
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/890 - OPEN
This tweak extends the {{{<<tiddler>>}}} macro syntax so you can include a javascript-based //test expression// to determine if the tiddler transclusion should be performed:
{{{
<<tiddler TiddlerName if:{{...}} with: param param etc.>>
}}}
If the test is ''true'', then the tiddler is transcluded as usual.  If the test is ''false'', then the transclusion is skipped and //no output is produced//.
***/
//{{{
config.macros.tiddler.if_handler = config.macros.tiddler.handler;
config.macros.tiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	params = paramString.parseParams('name',null,true,false,true);
	if (!getParam(params,'if',true)) return;
	this.if_handler.apply(this,arguments);
};
//}}}
// // }}}}}}// // {{block{
/***
!!!831 backslash-quoting for embedding newlines in 'line-mode' formats
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/831 - OPEN
This tweak pre-processes source content to convert 'double-backslash-newline' into {{{<br>}}} before wikify(), so that literal newlines can be embedded in line-mode wiki syntax (e.g., tables, bullets, etc.)
***/
//{{{
window.coreWikify = wikify;
window.wikify = function(source,output,highlightRegExp,tiddler)
{
	if (source) arguments[0]=source.replace(/\\\\\n/mg,'<br>');
	coreWikify.apply(this,arguments);
}
//}}}
// // }}}}}}// // {{block{
/***
!!!829 """<<tag>>""" macro - sortby parameter
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/829 - OPEN
This tweak adds an optional 'sortby' parameter to the """<<tag tagname label tip sortby>>""" macro, as well as the """<<allTags excludeTag sortby>>""" macro used to generate the sidebar contents 'tags' list.  Specify the field on which the contents of each tag popup is to be sorted, with a '+' or '-' prefix to indicate ascending/descending order, respectively.

Example: """<<tag systemConfig "plugins" "list plugins by date, most recent first" "-modified">>"""
Try it: <<tag systemConfig "plugins" "list plugins by date, most recent first" "-modified">>

Similarly, to change the sort order used by the popups from all tags shown in the sidebar contents, edit the [[TagTags]] shadow tiddler and enter: """<<allTags excludeLists -modified>>"""
***/
//{{{
// hijack tag handler() to add 'sortby' attribute to tag button
config.macros.tag.CoreTweaksSortTags_handler=config.macros.tag.handler;
config.macros.tag.handler = function(place,macroName,params)
{
	this.CoreTweaksSortTags_handler.apply(this,arguments);
	var btn=place.lastChild;
	if (params[3]) btn.setAttribute('sortby',params[3]);
}

// tweak <<allTags>> macro to add 'sortby' attribute to each tag button
var fn=config.macros.allTags.handler;
var lines=fn.toString().split('\n');
lines.splice(lines.length-2,0,['if(params[1]) btn.setAttribute("sortby",params[1]);']);
fn=lines.join('\n');
eval('config.macros.allTags.handler='+fn);

// tweak tag event handler to:
// * use tag filtering (only if '[' is present in tag value)
// * use optional 'sortby' attribute
// * save 'sortby' value in 'open all' command (for displaying tiddlers in sorted order)
var fn=onClickTag;
fn=fn.toString().replace(
	/store.getTaggedTiddlers\(tag\);/g,
	'(tag.indexOf("[")==-1?store.getTaggedTiddlers(tag):store.filterTiddlers(tag));'
	+'var sortby=this.getAttribute("sortby");'
	+'if(sortby&&sortby.length) store.sortTiddlers(tagged,sortby);'
);
fn=fn.toString().replace(
	/openAll.setAttribute\("tag",\s*tag\);/g,
	'openAll.setAttribute("tag",tag); openAll.setAttribute("sortby",sortby);'
);
eval(fn);

// tweak 'open all' event handler to use 'sortby' attribute
var fn=onClickTagOpenAll;
fn=fn.toString().replace(
	/story.displayTiddlers\(this,\s*tiddlers\);/g,
	'var sortby=this.getAttribute("sortby");'
	+'if(sortby&&sortby.length) store.sortTiddlers(tiddlers,sortby);'
	+'story.displayTiddlers(this,tiddlers);'
);
eval(fn);
//}}}
// // }}}}}}// // {{block{
/***
!!!824 ~WindowTitle - alternative to combined ~SiteTitle/~SiteSubtitle in window titlebar
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/824 - OPEN
This tweak allows definition of an optional [[WindowTitle]] tiddler that, when present, provides alternative text for display in the browser window's titlebar, instead of using the combined text content from [[SiteTitle]] and [[SiteSubtitle]] (which will still be displayed as usual in the TiddlyWiki document header area).

Note: this ticket replaces http://trac.tiddlywiki.org/ticket/401 (closed), which proposed using a custom [[PageTitle]] tiddler for this purpose.  ''If you were using the previous '401 ~PageTitle' tweak, you will need to rename [[PageTitle]] to [[WindowTitle]] to continue to use your custom window title text''
***/
//{{{
config.shadowTiddlers.WindowTitle='<<tiddler SiteTitle>> - <<tiddler SiteSubtitle>>';
window.getPageTitle=function() { return wikifyPlain('WindowTitle'); }
store.addNotification('WindowTitle',refreshPageTitle); // so title stays in sync with tiddler changes
//}}}
// // }}}}}}// // {{block{
/***
!!!784 allow tiddler sections in TiddlyLinks to be used as anchor points for intra-tiddler scrolling.  
>http://trac.tiddlywiki.org/ticket/784 - OPEN - Please see separate [[SectionLinksPlugin]]
!!!683 FireFox3 Import bug: 'browse' button replacement
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/683 - OPEN
The web standard 'type=file' input control that has been used as a local path/file picker for TiddlyWiki no longer works as expected in FireFox3, which has, for security reasons, limited javascript access to this control so that *no* local filesystem path information can be revealed, even when it is intentional and necessary, as it is with TiddlyWiki.  This tweak provides alternative HTML source that patches the backstage import panel.  It replaces the 'type=file' input control with a text+button combination of controls that invokes a system-native secure 'file-chooser' dialog box to provide TiddlyWiki with access to a complete path+filename so that TW functions properly locate user-selected local files.
>Note: ''This tweak also requires http://trac.tiddlywiki.org/ticket/604 - cross-platform askForFilename()''
***/
//{{{
if (window.Components) {
	var fixhtml='<input name="txtBrowse" style="width:30em"><input type="button" value="..."'
		+' onClick="window.browseForFilename(this.previousSibling,true)">';
	var cmi=config.macros.importTiddlers;
	cmi.step1Html=cmi.step1Html.replace(/<input type='file' size=50 name='txtBrowse'>/,fixhtml);
}

merge(config.messages,{selectFile:'Please enter or select a file'}); // ready for I18N translation

window.browseForFilename=function(target,mustExist) { // note: both params are optional
	var msg=config.messages.selectFile;
	if (target && target.title) msg=target.title; // use target field tooltip (if any) as dialog prompt text
	// get local path for current document
	var path=getLocalPath(document.location.href);
	var p=path.lastIndexOf('/'); if (p==-1) p=path.lastIndexOf('\\'); // Unix or Windows
	if (p!=-1) path=path.substr(0,p+1); // remove filename, leave trailing slash
	var file=''
	var result=window.askForFilename(msg,path,file,mustExist); // requires #604
	if (target && result.length) // set target field and trigger handling
		{ target.value=result; target.onchange(); }
	return result; 
}
//}}}
// // }}}}}}// // {{block{
/***
!!!604 cross-platform askForFilename()
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/604 - OPEN
invokes a system-native secure 'file-chooser' dialog box to provide TiddlyWiki with access to a complete path+filename so that TW functions properly locate user-selected local files.
***/
//{{{
window.askForFilename=function(msg,path,file,mustExist) {
	var r = window.mozAskForFilename(msg,path,file,mustExist);
	if(r===null || r===false)
		r = window.ieAskForFilename(msg,path,file,mustExist);
	if(r===null || r===false)
		r = window.javaAskForFilename(msg,path,file,mustExist);
	if(r===null || r===false)
		r = prompt(msg,path+file);
	return r||'';
}

window.mozAskForFilename=function(msg,path,file,mustExist) {
	if(!window.Components) return false;
	try {
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
		var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
		var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
		picker.init(window, msg, mustExist?nsIFilePicker.modeOpen:nsIFilePicker.modeSave);
		var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
		thispath.initWithPath(path);
		picker.displayDirectory=thispath;
		picker.defaultExtension='html';
		picker.defaultString=file;
		picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
		if (picker.show()!=nsIFilePicker.returnCancel)
			var result=picker.file.persistentDescriptor;
	}
	catch(ex) { displayMessage(ex.toString()); }
	return result;
}

window.ieAskForFilename=function(msg,path,file,mustExist) {
	if(!config.browser.isIE) return false;
	try {
		var s = new ActiveXObject('UserAccounts.CommonDialog');
		s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|';
		s.FilterIndex=3; // default to HTML files;
		s.InitialDir=path;
		s.FileName=file;
		return s.showOpen()?s.FileName:'';
	}
	catch(ex) { displayMessage(ex.toString()); }
	return result;
}

window.javaAskForFilename=function(msg,path,file,mustExist) {
	if(!document.applets['TiddlySaver']) return false;
	// TBD: implement java-based askFile(...) function
	try { return document.applets['TiddlySaver'].askFile(msg,path,file,mustExist); } 
	catch(ex) { displayMessage(ex.toString()); }
}
//}}}
// // }}}}}}// // {{block{
/***
!!!657 wrap tabs onto multiple lines
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/657 - OPEN
This tweak inserts an extra space element following each tab, allowing them to wrap onto multiple lines if needed.
***/
//{{{
config.macros.tabs.handler = function(place,macroName,params)
{
	var cookie = params[0];
	var numTabs = (params.length-1)/3;
	var wrapper = createTiddlyElement(null,'div',null,'tabsetWrapper ' + cookie);
	var tabset = createTiddlyElement(wrapper,'div',null,'tabset');
	tabset.setAttribute('cookie',cookie);
	var validTab = false;
	for(var t=0; t<numTabs; t++) {
		var label = params[t*3+1];
		var prompt = params[t*3+2];
		var content = params[t*3+3];
		var tab = createTiddlyButton(tabset,label,prompt,this.onClickTab,'tab tabUnselected');
		createTiddlyElement(tab,'span',null,null,' ',{style:'font-size:0pt;line-height:0px'}); // ELS
		tab.setAttribute('tab',label);
		tab.setAttribute('content',content);
		tab.title = prompt;
		if(config.options[cookie] == label)
			validTab = true;
	}
	if(!validTab)
		config.options[cookie] = params[1];
	place.appendChild(wrapper);
	this.switchTab(tabset,config.options[cookie]);
};
//}}}
// // }}}}}}// // {{block{
/***
!!!628 hide 'no such macro' errors
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/628 - OPEN
When invoking a macro that is not defined, this tweak prevents the display of the 'error in macro... no such macro' message.  This is useful when rendering tiddler content or templates that reference macros that are defined by //optional// plugins that have not been installed in the current document.

<<option chkHideMissingMacros>> hide 'no such macro' error messages
***/
//{{{
if (config.options.chkHideMissingMacros===undefined)
	config.options.chkHideMissingMacros=false;

window.coreTweaks_missingMacro_invokeMacro = window.invokeMacro;
window.invokeMacro = function(place,macro,params,wikifier,tiddler) {
	if (!config.macros[macro] || !config.macros[macro].handler)
		if (config.options.chkHideMissingMacros) return;
	window.coreTweaks_missingMacro_invokeMacro.apply(this,arguments);
}
//}}}
// // }}}}}}// // {{block{
/***
!!!608/609/610 toolbars - toggles, separators and transclusion
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/608 - OPEN (more/less toggle)
http://trac.tiddlywiki.org/ticket/609 - OPEN (separators)
http://trac.tiddlywiki.org/ticket/610 - OPEN (wikify tiddler/slice/section content)

This combination tweak extends the """<<toolbar>>""" macro to add use of '<' to insert a 'less' menu command (the opposite of '>' == 'more'), as well as use of '*' to insert linebreaks and "!" to insert a vertical line separator between toolbar items.  In addition, this tweak add the ability to use references to tiddlernames, slices, or sections and render their content inline within the toolbar, allowing easy creation of new toolbar commands using TW content (such as macros, links, inline scripts, etc.)

To produce a one-line style, with "less" at the end, use
| ViewToolbar| foo bar baz > yabba dabba doo < |
resulting in:
{{{
foo bar baz more
   and
foo bar baz yabba dabba doo less
}}}
or to use the CoreTweaks? two-line style:
| ViewToolbar| foo bar baz > < * yabba dabba doo |
which would produce:
{{{
foo bar baz more
   and
foo bar baz less
yabba dabba doo
}}}
''see [[ToolbarCommands]] for examples of how these features can be used''
***/
//{{{
merge(config.macros.toolbar,{
	moreLabel: 'more\u25BC',
	morePrompt: 'Show additional commands',
	lessLabel: '\u25C4less',
	lessPrompt: 'Hide additional commands',
	separator: '|'
});
config.macros.toolbar.onClickMore = function(ev) {
	var e = this.nextSibling;
	e.style.display = 'inline'; // show menu
	this.style.display = 'none'; // hide button
	return false;
};
config.macros.toolbar.onClickLess = function(ev) {
	var e = this.parentNode;
	var m = e.previousSibling;
	e.style.display = 'none'; // hide menu
	m.style.display = 'inline'; // show button
	return false;
};
config.macros.toolbar.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
	for(var t=0; t<params.length; t++) {
		var c = params[t];
		switch(c) {
			case '!':  // ELS - SEPARATOR (added)
				createTiddlyText(place,this.separator);
				break;
			case '*':  // ELS - LINEBREAK (added)
				createTiddlyElement(place,'BR');
				break;
			case '<': // ELS - LESS COMMAND (added)
				var btn = createTiddlyButton(place,
					this.lessLabel,this.lessPrompt,config.macros.toolbar.onClickLess,'moreCommand');
				break;
			case '>':
				var btn = createTiddlyButton(place,
					this.moreLabel,this.morePrompt,config.macros.toolbar.onClickMore,'moreCommand');
				var e = createTiddlyElement(place,'span',null,'moreCommand');
				e.style.display = 'none';
				place = e;
				break;
			default:
				var theClass = '';
				switch(c.substr(0,1)) {
					case '+':
						theClass = 'defaultCommand';
						c = c.substr(1);
						break;
					case '-':
						theClass = 'cancelCommand';
						c = c.substr(1);
						break;
				}
				if(c in config.commands)

					this.createCommand(place,c,tiddler,theClass);
				else { // ELS - WIKIFY TIDDLER/SLICE/SECTION (added)
					if (c.substr(0,1)=='~') c=c.substr(1); // ignore leading ~
					var txt=store.getTiddlerText(c);
					if (txt) {
						// trim any leading/trailing newlines
						txt=txt.replace(/^\n*/,'').replace(/\n*$/,'');
						// trim PRE format wrapper if any
						txt=txt.replace(/^\{\{\{\n/,'').replace(/\n\}\}\}$/,'');
						// render content into toolbar
						wikify(txt,createTiddlyElement(place,'span'),null,tiddler);
					}
				} // ELS - end WIKIFY CONTENT
				break;
		}
	}
};
//}}}
// // }}}}}}// // {{block{
/***
!!!529 IE fixup - case-sensitive element lookup of tiddler elements
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/529 - OPEN
This tweak hijacks the standard browser function, document.getElementById(), to work-around the case-INsensitivity error in Internet Explorer (all versions up to and including IE7) //''Note: This tweak is only applied when using IE, and only for lookups of rendered tiddler elements within the containing 'tiddlerDisplay' element.''//
***/
//{{{
if (config.browser.isIE) {
document.coreTweaks_coreGetElementById=document.getElementById;
document.getElementById=function(id) {
	var e=document.coreTweaks_coreGetElementById(id);
	if (!e || !e.parentNode || e.parentNode.id!='tiddlerDisplay') return e;
	for (var i=0; i<e.parentNode.childNodes.length; i++)
		if (id==e.parentNode.childNodes[i].id) return e.parentNode.childNodes[i];
	return null;
};
}
//}}}
// // }}}}}}// // {{block{
/***
!!!471 'creator' field for new tiddlers
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/471 - OPEN
This tweak HIJACKS the core's saveTiddler() function to automatically add a 'creator' field to a tiddler when it is FIRST created. You can use """<<view creator>>""" (or """<<view creator wikified>>""" if you prefer) to show this value embedded directly within the tiddler content, or {{{<span macro="view creator"></span>}}} in the ViewTemplate and/or EditTemplate to display the creator value in each tiddler.  
***/
//{{{
// hijack saveTiddler()
TiddlyWiki.prototype.CoreTweaks_creatorSaveTiddler=TiddlyWiki.prototype.saveTiddler;
TiddlyWiki.prototype.saveTiddler=function(title,newTitle,newBody,modifier,modified,tags,fields)
{
	var existing=store.tiddlerExists(title);
	var tiddler=this.CoreTweaks_creatorSaveTiddler.apply(this,arguments);
	if (!existing) store.setValue(title,'creator',config.options.txtUserName);
	return tiddler;
}
//}}}
// // }}}}}}
// // closed: won't fix //(leave as core tweaks)//
// // {{block{
/***
!!!637 TiddlyLink tooltip - custom formatting
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/637 - CLOSED: WON'T FIX
This tweak modifies the tooltip format that appears when you mouseover a link to a tiddler.  It adds an option to control the date format, as well as displaying the size of the tiddler (in bytes)

Tiddler link tooltip format:
{{stretch{<<option txtTiddlerLinkTootip>>}}}
^^where: %0=title, %1=username, %2=modification date, %3=size in bytes, %4=description slice^^
Tiddler link tooltip date format:
{{stretch{<<option txtTiddlerLinkTooltipDate>>}}}
***/
//{{{
config.messages.tiddlerLinkTooltip='%0 - %1, %2 (%3 bytes) - %4';
config.messages.tiddlerLinkTooltipDate='DDD, MMM DDth YYYY 0hh12:0mm AM';

config.options.txtTiddlerLinkTootip=
	config.options.txtTiddlerLinkTootip||config.messages.tiddlerLinkTooltip;
config.options.txtTiddlerLinkTooltipDate=
	config.options.txtTiddlerLinkTooltipDate||config.messages.tiddlerLinkTooltipDate;

Tiddler.prototype.getSubtitle = function() {
	var modifier = this.modifier;
	if(!modifier) modifier = config.messages.subtitleUnknown;
	var modified = this.modified;
	if(modified) modified = modified.formatString(config.options.txtTiddlerLinkTooltipDate);
	else modified = config.messages.subtitleUnknown;
	var descr=store.getTiddlerSlice(this.title,'Description')||'';
	return config.options.txtTiddlerLinkTootip.format([this.title,modifier,modified,this.text.length,descr]);
};
//}}}
// // }}}}}}// // {{block{
/***
!!!607 add HREF link on permaview command
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/607 - CLOSED: WON'T FIX
This tweak automatically sets the HREF for the 'permaview' sidebar command link so you can use the 'right click' context menu for faster, easier bookmarking.  Note that this does ''not'' automatically set the permaview in the browser's current location URL... it just sets the HREF on the command link.  You still have to click the link to apply the permaview.
***/
//{{{
config.macros.permaview.handler = function(place)
{
	var btn=createTiddlyButton(place,this.label,this.prompt,this.onClick);
	addEvent(btn,'mouseover',this.setHREF);
	addEvent(btn,'focus',this.setHREF);
};
config.macros.permaview.setHREF = function(event){
	var links = [];
	story.forEachTiddler(function(title,element) {
		links.push(String.encodeTiddlyLink(title));
	});
	var newURL=document.location.href;
	var hashPos=newURL.indexOf('#');
	if (hashPos!=-1) newURL=newURL.substr(0,hashPos);
	this.href=newURL+'#'+encodeURIComponent(links.join(' '));
}
//}}}
// // }}}}}}// // {{block{
/***
!!!458 add permalink-like HREFs on internal TiddlyLinks
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/458 - CLOSED: WON'T FIX
This tweak assigns a permalink-like HREF to internal Tiddler links (which normally do not have any HREF defined).  This permits the link's context menu (right-click) to include 'open link in another window/tab' command.  Based on a request from Dustin Spicuzza.
***/
//{{{
window.coreTweaks_createTiddlyLink=window.createTiddlyLink;
window.createTiddlyLink=function(place,title,includeText,theClass,isStatic,linkedFromTiddler,noToggle)
{
	// create the core button, then add the HREF (to internal links only)
	var link=window.coreTweaks_createTiddlyLink.apply(this,arguments);
	if (!isStatic)
		link.href=document.location.href.split('#')[0]+'#'+encodeURIComponent(String.encodeTiddlyLink(title));
	return link;
}
//}}}
// // }}}}}}
// // <<foldHeadings>>
!!![[Home]]
<<tiddler "CustomCommands::HomeContact">>
<<tiddler "CustomCommands::BillContact">>
<<tiddler "CustomCommands::EmergencyContact">>
!!![[Work]]
<<tiddler "CustomCommands::NewNotification">>
<<tiddler "CustomCommands::NewBJSA">>
<<tiddler "CustomCommands::WorkContact">>
!!![[Cigar|Cigar Information]]
<<tiddler "CustomCommands::NewCigar">>
<hr>
[[Cigar Ratings]]
[[Not Rated|CigarNR]]
[[Recommended|CigarRec]]
!!![[Wine|Wine Information]]
<<tiddler "CustomCommands::NewWine">>
<hr>
[[Wine Ratings]]
[[Not Rated|WineNR]]
[[Recommended|WineRec]]
@@display:none;
!!!Examples
~~Slice: {{{<<tiddler "CustomCommands::NewCigar">>}}}~~
~~Tiddler: {{{<<newTiddler label:'New Tiddler' title:'New Tiddler Title' text:{{store.getTiddlerText('NewTemplate','')}} tag:'Tag1]] [[Tag2'>>}}}~~
~~Home~~
NewCigar: <<newTiddler label:'New Cigar' title:'New Cigar' text:{{store.getTiddlerText('CigarTemplate','')}} tag:'Cigar'>>

NewWine: <<newTiddler label:'New Wine' title:'New Wine' text:{{store.getTiddlerText('WineTemplate','')}} tag:'Wine'>>

HomeContact: <<newTiddler label:'New Home Contact' title:'New Home Contact' text:{{store.getTiddlerText('ContactTemplate','')}} tag:'HDir'>>

BillContact: <<newTiddler label:'New Bill Contact' title:'New Bill Contact' text:{{store.getTiddlerText('ContactTemplate','')}} tag:'Bills'>>

EmergencyContact: <<newTiddler label:'New Emergency Contact' title:'New Emergency Contact' text:{{store.getTiddlerText('ContactTemplate','')}} tag:'EmergencyContact'>>

~~Work~~
WorkContact: <<newTiddler label:'New Work Contact' title:'New Work Contact' text:{{store.getTiddlerText('ContactTemplate','')}} tag:'WDir'>>

NewNotification: <<newTiddler label:'New Notification' title:'New Notification' text:{{store.getTiddlerText('NotificationTemplate','')}} tag:'Notification'>>

NewPurchase: <<newTiddler label:'New Purchase' title:'New Purchase' text:{{store.getTiddlerText('PurchaseTemplate','')}} tag:'WD73Purchase'>>

NewBJSA: <<newTiddler label:'New BJSA' title:'New BJSA' text:{{store.getTiddlerText('BJSATemplate','')}} tag:'BJSA'>>

~~Encrypted~~
EncryptHome: <<newTiddler label:'New Encrypted Home Tiddler' title:'New Encrypted Home Tiddler' text:{{store.getTiddlerText('Template','')}} tag:'Encrypted Home]] [[Encrypt(Home)'>>

EncryptWork: <<newTiddler label:'New Encrypted Work Tiddler' title:'New Encrypted Work Tiddler' text:{{store.getTiddlerText('Template','')}} tag:'Encrypted Work]] [[Encrypt(Work)'>>
!!!End@@
/%
|Code modified for this site, do not distribute|MTP|
|Based On|DigitalClock|
|Source|http://www.TiddlyTools.com/#DigitalClock|
%/<script>
	window.DC=function(id){
		var e=document.getElementById(id); if (!e) return;
		e.innerHTML=new Date().formatString(e.fmt);
		setTimeout('window.DC('+id+')',e.tick*1000);
	}
	var e=createTiddlyElement(place,'a',new Date().getTime()+Math.random());
	e.style.cursor='pointer';
	e.fmt=('$1'=='$'+'1')?'DDD, mmm DD YYYY, hh12:0mm:0ss am':'$1';
	e.tick=('$2'=='$'+'2')?'1':'$2';
	window.DC(e.id);
</script>
[[Home]]
[[Work]]
[[Projects]]
/***
|''Name:''|DeliciousTaggingPlugin|
|''Version:''|0.1|
|''Source''|http://jackparke.googlepages.com/jtw.html#DeliciousTaggingPlugin ([[del.icio.us|http://del.icio.us/post?url=http://jackparke.googlepages.com/jtw.html%DeliciousTaggingPlugin]])|
|''Author:''|[[Jack]]|
|Description|Allows easy 'del.icio.us'-like tagging in the EditTemplate by showing all tags as a list of link-buttons.|

!Usage
Replace your the editorFooter div in your [[EditTemplate]] with the following:
{{{
<div class='editorFooter' macro='deliciousTagging'></div>
}}}
!Code
***/
//{{{
version.extensions.deliciousTagging = {major: 0, minor: 1, revision: 0, date: new Date("June 11, 2007")};

config.macros.deliciousTagging= {};

config.macros.deliciousTagging.onTagClick = function(e)
{
 if(!e) var e = window.event;
 var tag = this.getAttribute("tag");
 var title = this.getAttribute("tiddler");
 if(!readOnly)
  story.setTiddlerTag(title,tag,0);
 return false;
};

config.macros.deliciousTagging.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
 if(tiddler instanceof Tiddler) {
  var title = tiddler.title;
  if(!e) var e = window.event;
  var tags = store.getTags();
  var lingo = config.views.editor.tagChooser;
  for(var t=0; t<tags.length; t++) {
   var theTag = createTiddlyButton(place,tags[t][0],lingo.tagTooltip.format([tags[t][0]]),config.macros.deliciousTagging.onTagClick);
   theTag.setAttribute("tag",tags[t][0]);
   theTag.setAttribute("tiddler",tiddler.title);
   place.appendChild(document.createTextNode(" "));
  }
 }
};
//}}}



/***
|''Name:''|FieldsEditorPlugin|
|''Description:''|//create//, //edit//, //view// and //delete// commands in toolbar <<toolbar fields>>.|
|''Version:''|1.0.2|
|''Date:''|Dec 21,2007|
|''Source:''|http://visualtw.ouvaton.org/VisualTW.html|
|''Author:''|Pascal Collin|
|''License:''|[[BSD open source license|License]]|
|''~CoreVersion:''|2.2.0|
|''Browser:''|Firefox 2.0; InternetExplorer 6.0, others|
!Demo:
On [[homepage|http://visualtw.ouvaton.org/VisualTW.html]], see [[FieldEditor example]]
!Installation:
*import this tiddler from [[homepage|http://visualtw.ouvaton.org/VisualTW.html]] (tagged as systemConfig)
*save and reload
*optionnaly : add the following css text in your StyleSheet : {{{#popup tr.fieldTableRow td {padding:1px 3px 1px 3px;}}}}
!Code
***/

//{{{

config.commands.fields.handlePopup = function(popup,title) {
	var tiddler = store.fetchTiddler(title);
	if(!tiddler)
		return;
	var fields = {};
	store.forEachField(tiddler,function(tiddler,fieldName,value) {fields[fieldName] = value;},true);
	var items = [];
	for(var t in fields) {
		var editCommand = "<<untiddledCall editFieldDialog "+escape(title)+" "+escape(t)+">>";
		var deleteCommand = "<<untiddledCall deleteField "+escape(title)+" "+escape(t)+">>";
		var renameCommand = "<<untiddledCall renameField "+escape(title)+" "+escape(t)+">>";
		items.push({field: t,value: fields[t], actions: editCommand+renameCommand+deleteCommand});
	}
	items.sort(function(a,b) {return a.field < b.field ? -1 : (a.field == b.field ? 0 : +1);});
	var createNewCommand = "<<untiddledCall createField "+escape(title)+">>";
	items.push({field : "", value : "", actions:createNewCommand });
	if(items.length > 0)
		ListView.create(popup,items,this.listViewTemplate);
	else
		createTiddlyElement(popup,"div",null,null,this.emptyText);
}

config.commands.fields.listViewTemplate = {
	columns: [
		{name: 'Field', field: 'field', title: "Field", type: 'String'},
		{name: 'Actions', field: 'actions', title: "Actions", type: 'WikiText'},
		{name: 'Value', field: 'value', title: "Value", type: 'WikiText'}
	],
	rowClasses: [
			{className: 'fieldTableRow', field: 'actions'}
	],
	buttons: [	//can't use button for selected then delete, because click on checkbox will hide the popup
	]
}

config.macros.untiddledCall = {  // when called from listview, tiddler is unset, so we need to pass tiddler as parameter
	handler : function(place,macroName,params,wikifier,paramString) {
		var macroName = params.shift();
		if (macroName) var macro = config.macros[macroName];
		var title = params.shift();
		if (title) var tiddler = store.getTiddler(unescape(title));
		if (macro) macro.handler(place,macroName,params,wikifier,paramString,tiddler);		
	}
}

config.macros.deleteField = {
	handler : function(place,macroName,params,wikifier,paramString,tiddler) {
		if(!readOnly && params[0]) {
			fieldName = unescape(params[0]);
			var btn = createTiddlyButton(place,"delete", "delete "+fieldName,this.onClickDeleteField);
			btn.setAttribute("title",tiddler.title);
			btn.setAttribute("fieldName", fieldName);
		}
	},
	onClickDeleteField : function() {
		var title=this.getAttribute("title");
		var fieldName=this.getAttribute("fieldName");
		var tiddler = store.getTiddler(title);
		if (tiddler && fieldName && confirm("delete field " + fieldName+" from " + title +" tiddler ?")) {
			delete tiddler.fields[fieldName];
			store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
			story.refreshTiddler(title,"ViewTemplate",true);
		}
		return false;
	}
}

config.macros.createField = {
	handler : function(place,macroName,params,wikifier,paramString,tiddler) {
		if(!readOnly) {
			var btn = createTiddlyButton(place,"create new", "create a new field",this.onClickCreateField);
			btn.setAttribute("title",tiddler.title);
		}
	},
	onClickCreateField : function() {
		var title=this.getAttribute("title");
		var tiddler = store.getTiddler(title);
		if (tiddler) {
			var fieldName = prompt("Field name","");
			if (store.getValue(tiddler,fieldName)) {
				window.alert("This field already exists.");
			}
			else if (fieldName) {
				var v = prompt("Field value","");
				tiddler.fields[fieldName]=v;
				store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
				story.refreshTiddler(title,"ViewTemplate",true);
			}
		}
		return false;
	}
}

config.macros.editFieldDialog = {
	handler : function(place,macroName,params,wikifier,paramString,tiddler) {
		if(!readOnly && params[0]) {
			fieldName = unescape(params[0]);
			var btn = createTiddlyButton(place,"edit", "edit this field",this.onClickEditFieldDialog);
			btn.setAttribute("title",tiddler.title);
			btn.setAttribute("fieldName", fieldName);
		}
	},
	onClickEditFieldDialog : function() {
		var title=this.getAttribute("title");
		var tiddler = store.getTiddler(title);
		var fieldName=this.getAttribute("fieldName");
		if (tiddler && fieldName) {
			var value = tiddler.fields[fieldName];
			value = value ? value : "";
			var lines = value.match(/\n/mg);
			lines = lines ? true : false;
			if (!lines || confirm("This field contains more than one line. Only the first line will be kept if you edit it here. Proceed ?")) {
				var v = prompt("Field value",value);
				tiddler.fields[fieldName]=v;
				store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
				story.refreshTiddler(title,"ViewTemplate",true);
			}
		}
		return false;
	}
}

config.macros.renameField = {
	handler : function(place,macroName,params,wikifier,paramString,tiddler) {
		if(!readOnly && params[0]) {
			fieldName = unescape(params[0]);
			var btn = createTiddlyButton(place,"rename", "rename "+fieldName,this.onClickRenameField);
			btn.setAttribute("title",tiddler.title);
			btn.setAttribute("fieldName", fieldName);
		}
	},
	onClickRenameField : function() {
		var title=this.getAttribute("title");
		var fieldName=this.getAttribute("fieldName");
		var tiddler = store.getTiddler(title);
		if (tiddler && fieldName) {
			var newName = prompt("Rename " + fieldName + " as ?", fieldName);
			if (newName) {
				tiddler.fields[newName]=tiddler.fields[fieldName];
				delete tiddler.fields[fieldName];
				store.saveTiddler(tiddler.title,tiddler.title,tiddler.text,tiddler.modifier,tiddler.modified,tiddler.tags,tiddler.fields);
				story.refreshTiddler(title,"ViewTemplate",true);
			}
		}
		return false;
	}
}

config.shadowTiddlers.StyleSheetFieldsEditor = "/*{{{*/\n";
config.shadowTiddlers.StyleSheetFieldsEditor += ".fieldTableRow td {padding : 1px 3px}\n";
config.shadowTiddlers.StyleSheetFieldsEditor += ".fieldTableRow .button {border:0; padding : 0 0.2em}\n";
config.shadowTiddlers.StyleSheetFieldsEditor +="/*}}}*/";
store.addNotification("StyleSheetFieldsEditor", refreshStyles);

//}}}

/***
|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);
	}}

});

//}}}
!!!&nbsp;"today is the tomorrow you worried about yesterday" {{floatright{+++^[Statistics]<<tiddler ShowTiddlerStatistics>>===+++^65em^[Reminders]{{small{<<tiddler Reminders>>}}}===}}}
[>img(400px+,auto)[Family Picture|Images/yourpicturehere.JPG]]<<tiddler HomeMenu>>
| <<tiddler "CustomCommands::HomeContact">> | <<tiddler "CustomCommands::BillContact">> | <<tiddler "CustomCommands::EmergencyContact">> | <<tiddler "CustomCommands::EncryptHome">> |
| <<tag [[Home Directory|HDir]]>> | <<tag Bills>> | <<tag [[Emergency Contacts|EmergencyContacts]]>> | <<tag [[Encrypted Home]]>> |
/***
|Name|ImageSizePlugin|
|Source|http://www.TiddlyTools.com/#ImageSizePlugin|
|Version|1.2.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin,formatter|
|Requires||
|Overrides|'image' formatter|
|Description|adds support for resizing images|
This plugin adds optional syntax to scale an image to a specified width and height and/or interactively resize the image with the mouse.
!!!!!Usage
<<<
The extended image syntax is:
{{{
[img(w+,h+)[...][...]]
}}}
where ''(w,h)'' indicates the desired width and height (in CSS units, e.g., px, em, cm, in, or %). Use ''auto'' (or a blank value) for either dimension to scale that dimension proportionally (i.e., maintain the aspect ratio). You can also calculate a CSS value 'on-the-fly' by using a //javascript expression// enclosed between """{{""" and """}}""". Appending a plus sign (+) to a dimension enables interactive resizing in that dimension (by dragging the mouse inside the image). Use ~SHIFT-click to show the full-sized (un-scaled) image. Use ~CTRL-click to restore the starting size (either scaled or full-sized).
<<<
!!!!!Examples
<<<
{{{
[img(100px+,75px+)[images/meow2.jpg]]
}}}
[img(100px+,75px+)[images/meow2.jpg]]
{{{
[<img(34%+,+)[images/meow.gif]]
[<img(21% ,+)[images/meow.gif]]
[<img(13%+, )[images/meow.gif]]
[<img( 8%+, )[images/meow.gif]]
[<img( 5% , )[images/meow.gif]]
[<img( 3% , )[images/meow.gif]]
[<img( 2% , )[images/meow.gif]]
[img(  1%+,+)[images/meow.gif]]
}}}
[<img(34%+,+)[images/meow.gif]]
[<img(21% ,+)[images/meow.gif]]
[<img(13%+, )[images/meow.gif]]
[<img( 8%+, )[images/meow.gif]]
[<img( 5% , )[images/meow.gif]]
[<img( 3% , )[images/meow.gif]]
[<img( 2% , )[images/meow.gif]]
[img(  1%+,+)[images/meow.gif]]
{{tagClear{
}}}
<<<
!!!!!Revisions
<<<
2009.02.24 [1.2.1] cleanup width/height regexp, use '+' suffix for resizing
2009.02.22 [1.2.0] added stretchable images
2008.01.19 [1.1.0] added evaluated width/height values
2008.01.18 [1.0.1] regexp for "(width,height)" now passes all CSS values to browser for validation
2008.01.17 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.ImageSizePlugin= {major: 1, minor: 2, revision: 1, date: new Date(2009,2,24)};
//}}}
//{{{
var f=config.formatters[config.formatters.findByField("name","image")];
f.match="\\[[<>]?[Ii][Mm][Gg](?:\\([^,]*,[^\\)]*\\))?\\[";
f.lookaheadRegExp=/\[([<]?)(>?)[Ii][Mm][Gg](?:\(([^,]*),([^\)]*)\))?\[(?:([^\|\]]+)\|)?([^\[\]\|]+)\](?:\[([^\]]*)\])?\]/mg;
f.handler=function(w) {
	this.lookaheadRegExp.lastIndex = w.matchStart;
	var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
	if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
		var floatLeft=lookaheadMatch[1];
		var floatRight=lookaheadMatch[2];
		var width=lookaheadMatch[3];
		var height=lookaheadMatch[4];
		var tooltip=lookaheadMatch[5];
		var src=lookaheadMatch[6];
		var link=lookaheadMatch[7];

		// Simple bracketted link
		var e = w.output;
		if(link) { // LINKED IMAGE
			if (config.formatterHelpers.isExternalLink(link)) {
				if (config.macros.attach && config.macros.attach.isAttachment(link)) {
					// see [[AttachFilePluginFormatters]]
					e = createExternalLink(w.output,link);
					e.href=config.macros.attach.getAttachment(link);
					e.title = config.macros.attach.linkTooltip + link;
				} else
					e = createExternalLink(w.output,link);
			} else 
				e = createTiddlyLink(w.output,link,false,null,w.isStatic);
			addClass(e,"imageLink");
		}

		var img = createTiddlyElement(e,"img");
		if(floatLeft) img.align="left"; else if(floatRight) img.align="right";
		if(width||height) {
			var x=width.trim(); var y=height.trim();
			var stretchW=(x.substr(x.length-1,1)=='+'); if (stretchW) x=x.substr(0,x.length-1);
			var stretchH=(y.substr(y.length-1,1)=='+'); if (stretchH) y=y.substr(0,y.length-1);
			if (x.substr(0,2)=="{{")
				{ try{x=eval(x.substr(2,x.length-4))} catch(e){displayMessage(e.description||e.toString())} }
			if (y.substr(0,2)=="{{")
				{ try{y=eval(y.substr(2,y.length-4))} catch(e){displayMessage(e.description||e.toString())} }
			img.style.width=x.trim(); img.style.height=y.trim();
			config.formatterHelpers.addStretchHandlers(img,stretchW,stretchH);
		}
		if(tooltip) img.title = tooltip;

		// GET IMAGE SOURCE
		if (config.macros.attach && config.macros.attach.isAttachment(src))
			src=config.macros.attach.getAttachment(src); // see [[AttachFilePluginFormatters]]
		else if (config.formatterHelpers.resolvePath) { // see [[ImagePathPlugin]]
			if (config.browser.isIE || config.browser.isSafari) {
				img.onerror=(function(){
					this.src=config.formatterHelpers.resolvePath(this.src,false);
					return false;
				});
			} else
				src=config.formatterHelpers.resolvePath(src,true);
		}
		img.src=src;
		w.nextMatch = this.lookaheadRegExp.lastIndex;
	}
}

config.formatterHelpers.addStretchHandlers=function(e,stretchW,stretchH) {
	e.title=((stretchW||stretchH)?'DRAG=stretch/shrink, ':'')
		+'SHIFT-CLICK=show full size, CTRL-CLICK=restore initial size';
	e.statusMsg='width=%0, height=%1';
	e.style.cursor='move';
	e.originalW=e.style.width;
	e.originalH=e.style.height;
	e.minW=Math.max(e.offsetWidth/20,10);
	e.minH=Math.max(e.offsetHeight/20,10);
	e.stretchW=stretchW;
	e.stretchH=stretchH;
	e.onmousedown=function(ev) { var ev=ev||window.event;
		this.sizing=true;
		this.startX=!config.browser.isIE?ev.pageX:(ev.clientX+findScrollX());
		this.startY=!config.browser.isIE?ev.pageY:(ev.clientY+findScrollY());
		this.startW=this.offsetWidth;
		this.startH=this.offsetHeight;
		return false;
	};
	e.onmousemove=function(ev) { var ev=ev||window.event;
		if (this.sizing) {
			var s=this.style;
			var currX=!config.browser.isIE?ev.pageX:(ev.clientX+findScrollX());
			var currY=!config.browser.isIE?ev.pageY:(ev.clientY+findScrollY());
			var newW=(currX-this.offsetLeft)/(this.startX-this.offsetLeft)*this.startW;
			var newH=(currY-this.offsetTop )/(this.startY-this.offsetTop )*this.startH;
			if (this.stretchW) s.width =Math.floor(Math.max(newW,this.minW))+'px';
			if (this.stretchH) s.height=Math.floor(Math.max(newH,this.minH))+'px';
			clearMessage(); displayMessage(this.statusMsg.format([s.width,s.height]));
		}
		return false;
	};
	e.onmouseup=function(ev) { var ev=ev||window.event;
		if (ev.shiftKey) { this.style.width=this.style.height=''; }
		if (ev.ctrlKey)  { this.style.width=this.originalW; this.style.height=this.originalH; }
		this.sizing=false;
		clearMessage();
		return false;
	};
	e.onmouseout=function(ev) { var ev=ev||window.event;
		this.sizing=false;
		clearMessage();
		return false;
	};
}
//}}}
/***
|Name|ImportTiddlersPlugin|
|Source|http://www.TiddlyTools.com/#ImportTiddlersPlugin|
|Documentation|http://www.TiddlyTools.com/#ImportTiddlersPluginInfo|
|Version|4.5.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|config.macros.importTiddlers.handler|
|Description|interactive controls for import/export with filtering.|
Combine tiddlers from any two TiddlyWiki documents.  An interactive control panel lets you pick a source document and import selected tiddlers, with prompting for skip, rename, merge or replace actions when importing tiddlers that match existing titles.  Generates a detailed report of import 'history' in ImportedTiddlers.
!!!!!Documentation
<<<
see [[ImportTiddlersPluginInfo]] for details
<<<
!!!!!interactive control panel:
<<<
<<importTiddlers inline>>
{{clear{
^^(see also: [[ImportTiddlers]] shadow tiddler)^^}}}
<<<
!!!!!Revisions
<<<
2009.05.04 [4.5.0] import from CSV-formatted files
|please see [[ImportTiddlersPluginInfo]] for additional revision details|
2005.07.20 [1.0.0] Initial Release
<<<
!!!!!Code
***/
//{{{
version.extensions.ImportTiddlersPlugin= {major: 4, minor: 5, revision: 0, date: new Date(2009,5,4)};

// IE needs explicit global scoping for functions/vars called from browser events
window.onClickImportButton=onClickImportButton;
window.refreshImportList=refreshImportList;

// default cookie/option values
if (!config.options.chkImportReport) config.options.chkImportReport=true;

// default shadow definition
config.shadowTiddlers.ImportTiddlers='<<importTiddlers inline>>';

// use shadow tiddler content in backstage panel
if (config.tasks) config.tasks.importTask.content='<<tiddler ImportTiddlers>>' // TW2.2 or above
//}}}
//{{{
// backward-compatiblity for TW2.0.x and TW1.2.x
if (config.macros.importTiddlers==undefined) config.macros.importTiddlers={};
if (typeof merge=='undefined') {
	function merge(dst,src,preserveExisting) {
		for(var i in src) { if(!preserveExisting || dst[i] === undefined) dst[i] = src[i]; }
		return dst;
	}
}
if (config.browser.isGecko===undefined)
	config.browser.isGecko=(config.userAgent.indexOf('gecko')!=-1);
//}}}
//{{{
merge(config.macros.importTiddlers,{
	$: function(id) { return document.getElementById(id); }, // abbreviation
	label: 'import tiddlers',
	prompt: 'Copy tiddlers from another document',
	openMsg: 'Opening %0',
	openErrMsg: 'Could not open %0 - error=%1',
	readMsg: 'Read %0 bytes from %1',
	foundMsg: 'Found %0 tiddlers in %1',
	filterMsg: "Filtered %0 tiddlers matching '%1'",
	summaryMsg: '%0 tiddler%1 in the list',
	summaryFilteredMsg: '%0 of %1 tiddler%2 in the list',
	plural: 's are',
	single: ' is',
	countMsg: '%0 tiddlers selected for import',
	processedMsg: 'Processed %0 tiddlers',
	importedMsg: 'Imported %0 of %1 tiddlers from %2',
	loadText: 'please load a document...',
	closeText: 'close',
	doneText: 'done',
	startText: 'import',
	stopText: 'stop',
	local: true,		// default to import from local file
	src: '',		// path/filename or URL of document to import (retrieved from SiteUrl)
	proxy: '',		// URL for remote proxy script (retrieved from SiteProxy)
	useProxy: false,	// use specific proxy script in front of remote URL
	inbound: null,		// hash-indexed array of tiddlers from other document
	newTags: '',		// text of tags added to imported tiddlers
	addTags: true,		// add new tags to imported tiddlers
	listsize: 10,		// # of lines to show in imported tiddler list
	importTags: true,	// include tags from remote source document when importing a tiddler
	keepTags: true,		// retain existing tags when replacing a tiddler
	sync: false,		// add 'server' fields to imported tiddlers (for sync function)
	lastFilter: '',		// most recent filter (URL hash) applied
	lastAction: null,	// most recent collision button performed
	index: 0,		// current processing index in import list
	sort: ''		// sort order for imported tiddler listbox
});
//}}}
//{{{
// hijack core macro handler
if (config.macros.importTiddlers.coreHandler==undefined)
	config.macros.importTiddlers.coreHandler=config.macros.importTiddlers.handler;

config.macros.importTiddlers.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
	if (!params[0] || params[0].toLowerCase()=='core') { // default to built in
		if (config.macros.importTiddlers.coreHandler)
			config.macros.importTiddlers.coreHandler.apply(this,arguments);
		else 
			createTiddlyButton(place,this.label,this.prompt,onClickImportMenu);
	} else if (params[0]=='link') { // show link to floating panel
		createTiddlyButton(place,params[1]||this.label,params[2]||this.prompt,onClickImportMenu);
	} else if (params[0]=='inline') {// show panel as INLINE tiddler content
		createImportPanel(place);
		this.$('importPanel').style.position='static';
		this.$('importPanel').style.display='block';
	} else if (config.macros.loadTiddlers)
		config.macros.loadTiddlers.handler(place,macroName,params); // any other params: loadtiddlers
}
//}}}
//{{{
// Handle link click to create/show/hide control panel
function onClickImportMenu(e) { var e=e||window.event;
	var parent=resolveTarget(e).parentNode;
	var panel=document.getElementById('importPanel');
	if (panel==undefined || panel.parentNode!=parent) panel=createImportPanel(parent);
	var isOpen=panel.style.display=='block';
	if(config.options.chkAnimate)
		anim.startAnimating(new Slider(panel,!isOpen,false,'none'));
	else
		panel.style.display=isOpen?'none':'block';
	e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); return(false);
}
//}}}
//{{{
// Create control panel: HTML, CSS
function createImportPanel(place) {
	var cmi=config.macros.importTiddlers; // abbrev
	var panel=cmi.$('importPanel');
	if (panel) { panel.parentNode.removeChild(panel); }
	setStylesheet(cmi.css,'importTiddlers');
	panel=createTiddlyElement(place,'span','importPanel',null,null)
	panel.innerHTML=cmi.html;
	refreshImportList();
	var siteURL=store.getTiddlerText('SiteUrl'); if (!siteURL) siteURL='';
	cmi.$('importSourceURL').value=siteURL;
	cmi.src=siteURL;
	var siteProxy=store.getTiddlerText('SiteProxy'); if (!siteProxy) siteProxy='SiteProxy';
	cmi.$('importSiteProxy').value=siteProxy;
	cmi.proxy=siteProxy;
	if (config.browser.isGecko) { // FF3 FIXUP
		cmi.$('fileImportSource').style.display='none';
		cmi.$('importLocalPanelFix').style.display='block';
	}
	cmi.$('chkSync').checked=cmi.sync;
	cmi.$('chkImportTags').checked=cmi.importTags;
	cmi.$('chkKeepTags').checked=cmi.keepTags;
	cmi.$('chkAddTags').checked=cmi.addTags;
	cmi.$('txtNewTags').value=cmi.newTags;
	cmi.$('txtNewTags').style.display=cmi.addTags?'block':'none';
	cmi.$('chkSync').checked=cmi.sync;
	cmi.$('chkImportReport').checked=config.options.chkImportReport;
	return panel;
}
//}}}
//{{{
config.macros.importTiddlers.css = '\
#importPanel {\
	display: none; position:absolute; z-index:11; width:35em; right:105%; top:3em;\
	background-color: #eee; color:#000; font-size: 8pt; line-height:110%;\
	border:1px solid black; border-bottom-width: 3px; border-right-width: 3px;\
	padding: 0.5em; margin:0em; -moz-border-radius:1em;-webkit-border-radius:1em;\
}\
#importPanel a, #importPanel td a { color:#009; display:inline; margin:0px; padding:1px; }\
#importPanel table { width:100%; border:0px; padding:0px; margin:0px; font-size:8pt; line-height:110%; background:transparent; }\
#importPanel tr { border:0px;padding:0px;margin:0px; background:transparent; }\
#importPanel td { color:#000; border:0px;padding:0px;margin:0px; background:transparent; }\
#importPanel select { width:100%;margin:0px;font-size:8pt;line-height:110%;}\
#importPanel input  { width:98%;padding:0px;margin:0px;font-size:8pt;line-height:110%}\
#importPanel .box { border:1px solid #000; background-color:#eee; padding:3px 5px; margin-bottom:5px; -moz-border-radius:5px;-webkit-border-radius:5px;}\
#importPanel .topline { border-top:1px solid #999; padding-top:2px; margin-top:2px; }\
#importPanel .rad { width:auto; }\
#importPanel .chk { width:auto; margin:1px;border:0; }\
#importPanel .btn { width:auto; }\
#importPanel .btn1 { width:98%; }\
#importPanel .btn2 { width:48%; }\
#importPanel .btn3 { width:32%; }\
#importPanel .btn4 { width:23%; }\
#importPanel .btn5 { width:19%; }\
#importPanel .importButton { padding: 0em; margin: 0px; font-size:8pt; }\
#importPanel .importListButton { padding:0em 0.25em 0em 0.25em; color: #000000; display:inline }\
#backstagePanel #importPanel { left:10%; right:auto; }\
';
//}}}
//{{{
config.macros.importTiddlers.html = '\
<!-- source and report -->\
<table><tr><td align=left>\
	import from\
	<input type="radio" class="rad" name="importFrom" id="importFromFile" value="file" CHECKED\
		onclick="onClickImportButton(this,event)" title="show file controls"> local file\
	<input type="radio" class="rad" name="importFrom" id="importFromWeb"  value="http"\
		onclick="onClickImportButton(this,event)" title="show web controls"> web server\
</td><td align=right>\
	<input type=checkbox class="chk" id="chkImportReport"\
		onClick="config.options[\'chkImportReport\']=this.checked;"> create report\
</td></tr></table>\
\
<div class="box" id="importSourcePanel" style="margin:.5em">\
<div id="importLocalPanel" style="display:block;margin-bottom:2px;"><!-- import from local file  -->\
enter or browse for source path/filename<br>\
<input type="file" id="fileImportSource" size=57 style="width:100%"\
	onKeyUp="config.macros.importTiddlers.src=this.value"\
	onChange="config.macros.importTiddlers.src=this.value;document.getElementById(\'importLoad\').onclick()">\
<div id="importLocalPanelFix" style="display:none"><!-- FF3 FIXUP -->\
	<input type="text" id="fileImportSourceFix" style="width:90%"\
		title="Enter a path/file to import"\
		onKeyUp="config.macros.importTiddlers.src=this.value"\
		onChange="config.macros.importTiddlers.src=this.value;document.getElementById(\'importLoad\').onclick()">\
	<input type="button" id="fileImportSourceFixButton" style="width:7%" value="..."\
		title="Select a path/file to import"\
		onClick="var r=config.macros.importTiddlers.askForFilename(this); if (!r||!r.length) return;\
			document.getElementById(\'fileImportSourceFix\').value=r;\
			config.macros.importTiddlers.src=r;\
			document.getElementById(\'importLoad\').onclick()">\
</div><!--end FF3 FIXUP-->\
</div><!--end local-->\
<div id="importHTTPPanel" style="display:none;margin-bottom:2px;"><!-- import from http server -->\
<table><tr><td align=left>\
	enter a URL or <a href="javascript:;" id="importSelectFeed"\
		onclick="onClickImportButton(this,event)" title="select a pre-defined \'systemServer\' URL">\
		select a server</a><br>\
</td><td align=right>\
	<input type="checkbox" class="chk" id="importUsePassword"\
		onClick="config.macros.importTiddlers.usePassword=this.checked;\
			config.macros.importTiddlers.showPanel(\'importIDPWPanel\',this.checked,true);">password\
	<input type="checkbox" class="chk" id="importUseProxy"\
		onClick="config.macros.importTiddlers.useProxy=this.checked;\
			config.macros.importTiddlers.showPanel(\'importSiteProxy\',this.checked,true);">proxy\
</td></tr></table>\
<input type="text" id="importSiteProxy" style="display:none;margin-bottom:1px" onfocus="this.select()" value="SiteProxy"\
	onKeyUp="config.macros.importTiddlers.proxy=this.value"\
	onChange="config.macros.importTiddlers.proxy=this.value;">\
<input type="text" id="importSourceURL" onfocus="this.select()" value="SiteUrl"\
	onKeyUp="config.macros.importTiddlers.src=this.value"\
	onChange="config.macros.importTiddlers.src=this.value;">\
<div id="importIDPWPanel" style="text-align:center;margin-top:2px;display:none";>\
username: <input type=text id="txtImportID" style="width:25%" \
	onChange="config.options.txtRemoteUsername=this.value;">\
 password: <input type=password id="txtImportPW" style="width:25%" \
	onChange="config.options.txtRemotePassword=this.value;">\
</div><!--end idpw-->\
</div><!--end http-->\
</div><!--end source-->\
\
<div class="box" id="importSelectPanel" style="display:none;margin:.5em;">\
<table><tr><td align=left>\
select:\
<a href="javascript:;" id="importSelectAll"\
	onclick="onClickImportButton(this);return false;" title="SELECT all tiddlers">\
	all</a>\
&nbsp;<a href="javascript:;" id="importSelectNew"\
	onclick="onClickImportButton(this);return false;" title="SELECT tiddlers not already in destination document">\
	added</a>\
&nbsp;<a href="javascript:;" id="importSelectChanges"\
	onclick="onClickImportButton(this);return false;" title="SELECT tiddlers that have been updated in source document">\
	changes</a>\
&nbsp;<a href="javascript:;" id="importSelectDifferences"\
	onclick="onClickImportButton(this);return false;" title="SELECT tiddlers that have been added or are different from existing tiddlers">\
	differences</a>\
</td><td align=right>\
<a href="javascript:;" id="importListSmaller"\
	onclick="onClickImportButton(this);return false;" title="SHRINK list size">\
	&nbsp;&#150;&nbsp;</a>\
<a href="javascript:;" id="importListLarger"\
	onclick="onClickImportButton(this);return false;" title="GROW list size">\
	&nbsp;+&nbsp;</a>\
<a href="javascript:;" id="importListMaximize"\
	onclick="onClickImportButton(this);return false;" title="MAXIMIZE/RESTORE list size">\
	&nbsp;=&nbsp;</a>\
</td></tr></table>\
<select id="importList" size=8 multiple\
	onchange="setTimeout(\'refreshImportList(\'+this.selectedIndex+\')\',1)">\
	<!-- NOTE: delay refresh so list is updated AFTER onchange event is handled -->\
</select>\
<div style="text-align:center">\
	<a href="javascript:;"\
		title="click for help using filters..."\
		onclick="alert(\'A filter consists of one or more space-separated combinations of:\\n\\ntiddler titles\\ntag:[[tagvalue]]\\ntag:[[tag expression]] (requires MatchTagsPlugin)\\nstory:[[TiddlerName]]\\nsearch:[[searchtext]]\\n\\nUse a blank filter for all tiddlers.\')"\
	>filter</a>\
	<input type="text" id="importLastFilter" style="margin-bottom:1px; width:65%"\
		title="Enter a combination of one or more filters. Use a blank filter for all tiddlers."\
		onfocus="this.select()" value=""\
		onKeyUp="config.macros.importTiddlers.lastFilter=this.value"\
		onChange="config.macros.importTiddlers.lastFilter=this.value;">\
	<input type="button" id="importApplyFilter" style="width:20%" value="apply"\
		title="filter list of tiddlers to include only those that match certain criteria"\
		onclick="onClickImportButton(this)">\
	</div>\
</div><!--end select-->\
\
<div class="box" id="importOptionsPanel" style="text-align:center;margin:.5em;display:none;">\
	apply tags: <input type=checkbox class="chk" id="chkImportTags" checked\
		onClick="config.macros.importTiddlers.importTags=this.checked;">from source&nbsp;\
	<input type=checkbox class="chk" id="chkKeepTags" checked\
		onClick="config.macros.importTiddlers.keepTags=this.checked;">keep existing&nbsp;\
	<input type=checkbox class="chk" id="chkAddTags" \
		onClick="config.macros.importTiddlers.addTags=this.checked;\
			config.macros.importTiddlers.showPanel(\'txtNewTags\',this.checked,false);\
			if (this.checked) document.getElementById(\'txtNewTags\').focus();">add tags<br>\
	<input type=text id="txtNewTags" style="margin-top:4px;display:none;" size=15\ onfocus="this.select()" \
		title="enter tags to be added to imported tiddlers" \
		onKeyUp="config.macros.importTiddlers.newTags=this.value;\
		document.getElementById(\'chkAddTags\').checked=this.value.length>0;" autocomplete=off>\
	<nobr><input type=checkbox class="chk" id="chkSync" \
		onClick="config.macros.importTiddlers.sync=this.checked;">\
		link tiddlers to source document (for sync later)</nobr>\
</div><!--end options-->\
\
<div id="importButtonPanel" style="text-align:center">\
	<input type=button id="importLoad"	class="importButton btn3" value="open"\
		title="load listbox with tiddlers from source document"\
		onclick="onClickImportButton(this)">\
	<input type=button id="importOptions"	class="importButton btn3" value="options..."\
		title="set options for tags, sync, etc."\
		onclick="onClickImportButton(this)">\
	<input type=button id="importStart"	class="importButton btn3" value="import"\
		title="start/stop import of selected source tiddlers into current document"\
		onclick="onClickImportButton(this)">\
	<input type=button id="importClose"	class="importButton btn3" value="done"\
		title="clear listbox or hide control panel"\
		onclick="onClickImportButton(this)">\
</div>\
\
<div class="none" id="importCollisionPanel" style="display:none;margin:.5em 0 .5em .5em;">\
	<table><tr><td style="width:65%" align="left">\
		<table><tr><td align=left>\
			tiddler already exists:\
		</td><td align=right>\
			<input type=checkbox class="chk" id="importApplyToAll" \
			onclick="document.getElementById(\'importRename\').disabled=this.checked;"\
			checked>apply to all\
		</td></tr></table>\
		<input type=text id="importNewTitle" size=15 autocomplete=off">\
	</td><td style="width:34%" align="center">\
		<input type=button id="importMerge"\
			class="importButton" style="width:47%" value="merge"\
			title="append the incoming tiddler to the existing tiddler"\
			onclick="onClickImportButton(this)"><!--\
		--><input type=button id="importSkip"\
			class="importButton" style="width:47%" value="skip"\
			title="do not import this tiddler"\
			onclick="onClickImportButton(this)"><!--\
		--><br><input type=button id="importRename"\
			class="importButton" style="width:47%" value="rename"\
			title="rename the incoming tiddler"\
			onclick="onClickImportButton(this)"><!--\
		--><input type=button id="importReplace"\
			class="importButton" style="width:47%" value="replace"\
			title="discard the existing tiddler"\
			onclick="onClickImportButton(this)">\
	</td></tr></table>\
</div><!--end collision-->\
';
//}}}
//{{{
// process control interactions
function onClickImportButton(which,event) {
	var cmi=config.macros.importTiddlers; // abbreviation
	var list=cmi.$('importList'); if (!list) return;
	var thePanel=cmi.$('importPanel');
	var theCollisionPanel=cmi.$('importCollisionPanel');
	var theNewTitle=cmi.$('importNewTitle');
	var count=0;
	switch (which.id)
		{
		case 'importFromFile':	// show local panel
		case 'importFromWeb':	// show HTTP panel
			cmi.local=(which.id=='importFromFile');
			cmi.showPanel('importLocalPanel',cmi.local);
			cmi.showPanel('importHTTPPanel',!cmi.local);
			break;
		case 'importOptions':	// show/hide options panel
			cmi.showPanel('importOptionsPanel',cmi.$('importOptionsPanel').style.display=='none');
			break;
		case 'fileImportSource':
		case 'importLoad':		// load import source into hidden frame
			importReport();		// if an import was in progress, generate a report
			cmi.inbound=null;	// clear the imported tiddler buffer
			refreshImportList();	// reset/resize the listbox
			if (cmi.src=='') break;
			// Load document, read it's DOM and fill the list
			cmi.loadRemoteFile(cmi.src,cmi.filterTiddlerList);
			break;
		case 'importSelectFeed':	// select a pre-defined systemServer feed URL
			var p=Popup.create(which); if (!p) return;
			var tids=store.getTaggedTiddlers('systemServer');
			if (!tids.length)
				createTiddlyText(createTiddlyElement(p,'li'),'no pre-defined server feeds');
			for (var t=0; t<tids.length; t++) {
				var u=store.getTiddlerSlice(tids[t].title,'URL');
				var d=store.getTiddlerSlice(tids[t].title,'Description');
				if (!d||!d.length) d=store.getTiddlerSlice(tids[t].title,'description');
				if (!d||!d.length) d=u;
				createTiddlyButton(createTiddlyElement(p,'li'),tids[t].title,d,
					function(){
						var u=this.getAttribute('url');
						document.getElementById('importSourceURL').value=u;
						config.macros.importTiddlers.src=u;
						document.getElementById('importLoad').onclick();
					},
					null,null,null,{url:u});
			}
			Popup.show();
			event.cancelBubble = true;
			if (event.stopPropagation) event.stopPropagation();
			return(false);
			// create popup with feed list
			// onselect, insert feed URL into input field.
			break;
		case 'importSelectAll':		// select all tiddler list items (i.e., not headings)
			importReport();		// if an import was in progress, generate a report
			for (var t=0,count=0; t < list.options.length; t++) {
				if (list.options[t].value=='') continue;
				list.options[t].selected=true;
				count++;
			}
			clearMessage(); displayMessage(cmi.countMsg.format([count]));
			cmi.$('importStart').disabled=!count;
			break;
		case 'importSelectNew':		// select tiddlers not in current document
			importReport();		// if an import was in progress, generate a report
			for (var t=0,count=0; t < list.options.length; t++) {
				list.options[t].selected=false;
				if (list.options[t].value=='') continue;
				list.options[t].selected=!store.tiddlerExists(list.options[t].value);
				count+=list.options[t].selected?1:0;
			}
			clearMessage(); displayMessage(cmi.countMsg.format([count]));
			cmi.$('importStart').disabled=!count;
			break;
		case 'importSelectChanges':		// select tiddlers that are updated from existing tiddlers
			importReport();		// if an import was in progress, generate a report
			for (var t=0,count=0; t < list.options.length; t++) {
				list.options[t].selected=false;
				if (list.options[t].value==''||!store.tiddlerExists(list.options[t].value)) continue;
				for (var i=0; i<cmi.inbound.length; i++) // find matching inbound tiddler
					{ var inbound=cmi.inbound[i]; if (inbound.title==list.options[t].value) break; }
				list.options[t].selected=(inbound.modified-store.getTiddler(list.options[t].value).modified>0); // updated tiddler
				count+=list.options[t].selected?1:0;
			}
			clearMessage(); displayMessage(cmi.countMsg.format([count]));
			cmi.$('importStart').disabled=!count;
			break;
		case 'importSelectDifferences':		// select tiddlers that are new or different from existing tiddlers
			importReport();		// if an import was in progress, generate a report
			for (var t=0,count=0; t < list.options.length; t++) {
				list.options[t].selected=false;
				if (list.options[t].value=='') continue;
				if (!store.tiddlerExists(list.options[t].value)) { list.options[t].selected=true; count++; continue; }
				for (var i=0; i<cmi.inbound.length; i++) // find matching inbound tiddler
					{ var inbound=cmi.inbound[i]; if (inbound.title==list.options[t].value) break; }
				list.options[t].selected=(inbound.modified-store.getTiddler(list.options[t].value).modified!=0); // changed tiddler
				count+=list.options[t].selected?1:0;
			}
			clearMessage(); displayMessage(cmi.countMsg.format([count]));
			cmi.$('importStart').disabled=!count;
			break;
		case 'importApplyFilter':	// filter list to include only matching tiddlers
			importReport();		// if an import was in progress, generate a report
			clearMessage();
			if (!cmi.all) // no tiddlers loaded = '0 selected'
				{ displayMessage(cmi.countMsg.format([0])); return false; }
			var hash=cmi.$('importLastFilter').value;
			cmi.inbound=cmi.filterByHash('#'+hash,cmi.all);
			refreshImportList();	// reset/resize the listbox
			break;
		case 'importStart':		// initiate the import processing
			importReport();		// if an import was in progress, generate a report
			cmi.$('importApplyToAll').checked=false;
			cmi.$('importStart').value=cmi.stopText;
			if (cmi.index>0) cmi.index=-1; // stop processing
			else cmi.index=importTiddlers(0); // or begin processing
			importStopped();
			break;
		case 'importClose':		// unload imported tiddlers or hide the import control panel
			// if imported tiddlers not loaded, close the import control panel
			if (!cmi.inbound) { thePanel.style.display='none'; break; }
			importReport();		// if an import was in progress, generate a report
			cmi.inbound=null;	// clear the imported tiddler buffer
			refreshImportList();	// reset/resize the listbox
			break;
		case 'importSkip':	// don't import the tiddler
			cmi.lastAction=which;
			var theItem	= list.options[cmi.index];
			for (var j=0;j<cmi.inbound.length;j++)
			if (cmi.inbound[j].title==theItem.value) break;
			var theImported = cmi.inbound[j];
			theImported.status='skipped after asking';			// mark item as skipped
			theCollisionPanel.style.display='none';
			cmi.index=importTiddlers(cmi.index+1);	// resume with NEXT item
			importStopped();
			break;
		case 'importRename':		// change name of imported tiddler
			cmi.lastAction=which;
			var theItem		= list.options[cmi.index];
			for (var j=0;j<cmi.inbound.length;j++)
			if (cmi.inbound[j].title==theItem.value) break;
			var theImported		= cmi.inbound[j];
			theImported.status	= 'renamed from '+theImported.title;	// mark item as renamed
			theImported.set(theNewTitle.value,null,null,null,null);		// change the tiddler title
			theItem.value		= theNewTitle.value;			// change the listbox item text
			theItem.text		= theNewTitle.value;			// change the listbox item text
			theCollisionPanel.style.display='none';
			cmi.index=importTiddlers(cmi.index);	// resume with THIS item
			importStopped();
			break;
		case 'importMerge':	// join existing and imported tiddler content
			cmi.lastAction=which;
			var theItem	= list.options[cmi.index];
			for (var j=0;j<cmi.inbound.length;j++)
			if (cmi.inbound[j].title==theItem.value) break;
			var theImported	= cmi.inbound[j];
			var theExisting	= store.getTiddler(theItem.value);
			var theText	= theExisting.text+'\n----\n^^merged from: ';
			theText		+='[['+cmi.src+'#'+theItem.value+'|'+cmi.src+'#'+theItem.value+']]^^\n';
			theText		+='^^'+theImported.modified.toLocaleString()+' by '+theImported.modifier+'^^\n'+theImported.text;
			var theDate	= new Date();
			var theTags	= theExisting.getTags()+' '+theImported.getTags();
			theImported.set(null,theText,null,theDate,theTags);
			theImported.status   = 'merged with '+theExisting.title;	// mark item as merged
			theImported.status  += ' - '+theExisting.modified.formatString('MM/DD/YYYY 0hh:0mm:0ss');
			theImported.status  += ' by '+theExisting.modifier;
			theCollisionPanel.style.display='none';
			cmi.index=importTiddlers(cmi.index);	// resume with this item
			importStopped();
			break;
		case 'importReplace':		// substitute imported tiddler for existing tiddler
			cmi.lastAction=which;
			var theItem		  = list.options[cmi.index];
			for (var j=0;j<cmi.inbound.length;j++)
			if (cmi.inbound[j].title==theItem.value) break;
			var theImported     = cmi.inbound[j];
			var theExisting	  = store.getTiddler(theItem.value);
			theImported.status  = 'replaces '+theExisting.title;		// mark item for replace
			theImported.status += ' - '+theExisting.modified.formatString('MM/DD/YYYY 0hh:0mm:0ss');
			theImported.status += ' by '+theExisting.modifier;
			theCollisionPanel.style.display='none';
			cmi.index=importTiddlers(cmi.index);	// resume with THIS item
			importStopped();
			break;
		case 'importListSmaller':		// decrease current listbox size, minimum=5
			if (list.options.length==1) break;
			list.size-=(list.size>5)?1:0;
			cmi.listsize=list.size;
			break;
		case 'importListLarger':		// increase current listbox size, maximum=number of items in list
			if (list.options.length==1) break;
			list.size+=(list.size<list.options.length)?1:0;
			cmi.listsize=list.size;
			break;
		case 'importListMaximize':	// toggle listbox size between current and maximum
			if (list.options.length==1) break;
			list.size=(list.size==list.options.length)?cmi.listsize:list.options.length;
			break;
		}
}
//}}}
//{{{
config.macros.importTiddlers.showPanel=function(place,show,skipAnim) {
	if (typeof place=='string') var place=document.getElementById(place);
	if (!place||!place.style) return;
	if(!skipAnim && anim && config.options.chkAnimate) anim.startAnimating(new Slider(place,show,false,'none'));
	else place.style.display=show?'block':'none';
}
//}}}
//{{{
function refreshImportList(selectedIndex) {
	var cmi=config.macros.importTiddlers; // abbrev
	var list=cmi.$('importList'); if (!list) return;
	// if nothing to show, reset list content and size
	if (!cmi.inbound) {
		while (list.length > 0) { list.options[0] = null; }
		list.options[0]=new Option(cmi.loadText,'',false,false);
		list.size=cmi.listsize;
		cmi.$('importLoad').disabled=false;
		cmi.$('importLoad').style.display='inline';
		cmi.$('importStart').disabled=true;
		cmi.$('importOptions').disabled=true;
		cmi.$('importOptions').style.display='none';
		cmi.$('fileImportSource').disabled=false;
		cmi.$('importFromFile').disabled=false;
		cmi.$('importFromWeb').disabled=false;
		cmi.$('importStart').value=cmi.startText;
		cmi.$('importClose').value=cmi.doneText;
		cmi.$('importSelectPanel').style.display='none';
		cmi.$('importOptionsPanel').style.display='none';
		return;
	}
	// there are inbound tiddlers loaded...
	cmi.$('importLoad').disabled=true;
	cmi.$('importLoad').style.display='none';
	cmi.$('importOptions').style.display='inline';
	cmi.$('importOptions').disabled=false;
	cmi.$('fileImportSource').disabled=true;
	cmi.$('importFromFile').disabled=true;
	cmi.$('importFromWeb').disabled=true;
	cmi.$('importClose').value=cmi.closeText;
	if (cmi.$('importSelectPanel').style.display=='none')
		cmi.showPanel('importSelectPanel',true);

	// get the sort order
	if (!selectedIndex)   selectedIndex=0;
	if (selectedIndex==0) cmi.sort='title';		// heading
	if (selectedIndex==1) cmi.sort='title';
	if (selectedIndex==2) cmi.sort='modified';
	if (selectedIndex==3) cmi.sort='tags';
	if (selectedIndex>3) {
		// display selected tiddler count
		for (var t=0,count=0; t < list.options.length; t++) {
			if (!list.options[t].selected) continue;
			if (list.options[t].value!='')
				count+=1;
			else { // if heading is selected, deselect it, and then select and count all in section
				list.options[t].selected=false;
				for ( t++; t<list.options.length && list.options[t].value!=''; t++) {
					list.options[t].selected=true;
					count++;
				}
			}
		}
		clearMessage(); displayMessage(cmi.countMsg.format([count]));
	}
	cmi.$('importStart').disabled=!count;
	if (selectedIndex>3) return; // no refresh needed

	// get the alphasorted list of tiddlers
	var tiddlers=cmi.inbound;
	tiddlers.sort(function (a,b) {if(a['title'] == b['title']) return(0); else return (a['title'] < b['title']) ? -1 : +1; });
	// clear current list contents
	while (list.length > 0) { list.options[0] = null; }
	// add heading and control items to list
	var i=0;
	var indent=String.fromCharCode(160)+String.fromCharCode(160);
	if (cmi.all.length==tiddlers.length)
		var summary=cmi.summaryMsg.format([tiddlers.length,(tiddlers.length!=1)?cmi.plural:cmi.single]);
	else
		var summary=cmi.summaryFilteredMsg.format([tiddlers.length,cmi.all.length,(cmi.all.length!=1)?cmi.plural:cmi.single]);
	list.options[i++]=new Option(summary,'',false,false);
	list.options[i++]=new Option(((cmi.sort=='title'   )?'>':indent)+' [by title]','',false,false);
	list.options[i++]=new Option(((cmi.sort=='modified')?'>':indent)+' [by date]','',false,false);
	list.options[i++]=new Option(((cmi.sort=='tags')?'>':indent)+' [by tags]','',false,false);
	// output the tiddler list
	switch(cmi.sort) {
		case 'title':
			for(var t = 0; t < tiddlers.length; t++)
				list.options[i++] = new Option(tiddlers[t].title,tiddlers[t].title,false,false);
			break;
		case 'modified':
			// sort descending for newest date first
			tiddlers.sort(function (a,b) {if(a['modified'] == b['modified']) return(0); else return (a['modified'] > b['modified']) ? -1 : +1; });
			var lastSection = '';
			for(var t = 0; t < tiddlers.length; t++) {
				var tiddler = tiddlers[t];
				var theSection = tiddler.modified.toLocaleDateString();
				if (theSection != lastSection) {
					list.options[i++] = new Option(theSection,'',false,false);
					lastSection = theSection;
				}
				list.options[i++] = new Option(indent+indent+tiddler.title,tiddler.title,false,false);
			}
			break;
		case 'tags':
			var theTitles = {}; // all tiddler titles, hash indexed by tag value
			var theTags = new Array();
			for(var t=0; t<tiddlers.length; t++) {
				var title=tiddlers[t].title;
				var tags=tiddlers[t].tags;
				if (!tags || !tags.length) {
					if (theTitles['untagged']==undefined) { theTags.push('untagged'); theTitles['untagged']=new Array(); }
					theTitles['untagged'].push(title);
				}
				else for(var s=0; s<tags.length; s++) {
					if (theTitles[tags[s]]==undefined) { theTags.push(tags[s]); theTitles[tags[s]]=new Array(); }
					theTitles[tags[s]].push(title);
				}
			}
			theTags.sort();
			for(var tagindex=0; tagindex<theTags.length; tagindex++) {
				var theTag=theTags[tagindex];
				list.options[i++]=new Option(theTag,'',false,false);
				for(var t=0; t<theTitles[theTag].length; t++)
					list.options[i++]=new Option(indent+indent+theTitles[theTag][t],theTitles[theTag][t],false,false);
			}
			break;
		}
	list.selectedIndex=selectedIndex;		  // select current control item
	if (list.size<cmi.listsize) list.size=cmi.listsize;
	if (list.size>list.options.length) list.size=list.options.length;
}
//}}}
//{{{
// re-entrant processing for handling import with interactive collision prompting
function importTiddlers(startIndex) {
	var cmi=config.macros.importTiddlers; // abbrev
	if (!cmi.inbound) return -1;
	var list=cmi.$('importList'); if (!list) return;
	var t;
	// if starting new import, reset import status flags
	if (startIndex==0)
		for (var t=0;t<cmi.inbound.length;t++)
			cmi.inbound[t].status='';
	for (var i=startIndex; i<list.options.length; i++) {
		// if list item is not selected or is a heading (i.e., has no value), skip it
		if ((!list.options[i].selected) || ((t=list.options[i].value)==''))
			continue;
		for (var j=0;j<cmi.inbound.length;j++)
			if (cmi.inbound[j].title==t) break;
		var inbound = cmi.inbound[j];
		var theExisting = store.getTiddler(inbound.title);
		// avoid redundant import for tiddlers that are listed multiple times (when 'by tags')
		if (inbound.status=='added')
			continue;
		// don't import the 'ImportedTiddlers' history from the other document...
		if (inbound.title=='ImportedTiddlers')
			continue;
		// if tiddler exists and import not marked for replace or merge, stop importing
		if (theExisting && (inbound.status.substr(0,7)!='replace') && (inbound.status.substr(0,5)!='merge'))
			return i;
		// assemble tags (remote + existing + added)
		var newTags = '';
		if (cmi.importTags)
			newTags+=inbound.getTags()	// import remote tags
		if (cmi.keepTags && theExisting)
			newTags+=' '+theExisting.getTags(); // keep existing tags
		if (cmi.addTags && cmi.newTags.trim().length)
			newTags+=' '+cmi.newTags; // add new tags
		inbound.set(null,null,null,null,newTags.trim());
		// set the status to 'added' (if not already set by the 'ask the user' UI)
		inbound.status=(inbound.status=='')?'added':inbound.status;
		// set sync fields
		if (cmi.sync) {
			if (!inbound.fields) inbound.fields={}; // for TW2.1.x backward-compatibility
			inbound.fields['server.page.revision']=inbound.modified.convertToYYYYMMDDHHMM();
			inbound.fields['server.type']='file';
			inbound.fields['server.host']=(cmi.local?'file://':'')+cmi.src;
		}
		// do the import!
		store.suspendNotifications();
		store.saveTiddler(inbound.title, inbound.title, inbound.text, inbound.modifier, inbound.modified, inbound.tags, inbound.fields, true, inbound.created);
                store.fetchTiddler(inbound.title).created = inbound.created; // force creation date to imported value (needed for TW2.1.x and earlier)
		store.resumeNotifications();
		}
	return(-1);	// signals that we really finished the entire list
}
function importStopped() {
	var cmi=config.macros.importTiddlers; // abbrev
	var list=cmi.$('importList'); if (!list) return;
	var theNewTitle=cmi.$('importNewTitle');
	if (cmi.index==-1){ 
		cmi.$('importStart').value=cmi.startText;
		importReport();	// import finished... generate the report
	} else {
		// import collision...
		// show the collision panel and set the title edit field
		cmi.$('importStart').value=cmi.stopText;
		cmi.showPanel('importCollisionPanel',true);
		theNewTitle.value=list.options[cmi.index].value;
		if (cmi.$('importApplyToAll').checked && cmi.lastAction && cmi.lastAction.id!='importRename')
			onClickImportButton(cmi.lastAction);
	}
}
//}}}
//{{{
function importReport() {
	var cmi=config.macros.importTiddlers; // abbrev
	if (!cmi.inbound) return;
	// if import was not completed, the collision panel will still be open... close it now.
	var panel=cmi.$('importCollisionPanel'); if (panel) panel.style.display='none';
	// get the alphasorted list of tiddlers
	var tiddlers = cmi.inbound;
	// gather the statistics
	var count=0; var total=0;
	for (var t=0; t<tiddlers.length; t++) {
		if (!tiddlers[t].status || !tiddlers[t].status.trim().length) continue;
		if (tiddlers[t].status.substr(0,7)!='skipped') count++;
		total++;
	}
	// generate a report
	if (total) displayMessage(cmi.processedMsg.format([total]));
	if (count && config.options.chkImportReport) {
		// get/create the report tiddler
		var theReport = store.getTiddler('ImportedTiddlers');
		if (!theReport) { theReport=new Tiddler(); theReport.title='ImportedTiddlers'; theReport.text=''; }
		// format the report content
		var now = new Date();
		var newText = 'On '+now.toLocaleString()+', '+config.options.txtUserName
		newText +=' imported '+count+' tiddler'+(count==1?'':'s')+' from\n[['+cmi.src+'|'+cmi.src+']]:\n';
		if (cmi.addTags && cmi.newTags.trim().length)
			newText += 'imported tiddlers were tagged with: "'+cmi.newTags+'"\n';
		newText += '<<<\n';
		for (var t=0; t<tiddlers.length; t++) if (tiddlers[t].status)
			newText += '#[['+tiddlers[t].title+']] - '+tiddlers[t].status+'\n';
		newText += '<<<\n';
		// update the ImportedTiddlers content and show the tiddler
		theReport.text	 = newText+((theReport.text!='')?'\n----\n':'')+theReport.text;
		theReport.modifier = config.options.txtUserName;
		theReport.modified = new Date();
                store.saveTiddler(theReport.title, theReport.title, theReport.text, theReport.modifier, theReport.modified, theReport.tags, theReport.fields);
		story.displayTiddler(null,theReport.title,1,null,null,false);
		story.refreshTiddler(theReport.title,1,true);
	}
	// reset status flags
	for (var t=0; t<cmi.inbound.length; t++) cmi.inbound[t].status='';
	// mark document as dirty and let display update as needed
	if (count) { store.setDirty(true); store.notifyAll(); }
	// always show final message when tiddlers were actually loaded
	if (count) displayMessage(cmi.importedMsg.format([count,tiddlers.length,cmi.src.replace(/%20/g,' ')]));
}
//}}}
//{{{
// // File and XMLHttpRequest I/O
config.macros.importTiddlers.askForFilename=function(here) {
	var msg=here.title; // use tooltip as dialog box message
	var path=getLocalPath(document.location.href);
	var slashpos=path.lastIndexOf('/'); if (slashpos==-1) slashpos=path.lastIndexOf('\\'); 
	if (slashpos!=-1) path = path.substr(0,slashpos+1); // remove filename from path, leave the trailing slash
	var file='';
	var result='';
	if(window.Components) { // moz
		try {
			netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

			var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
			var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
			picker.init(window, msg, nsIFilePicker.modeOpen);
			var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
			thispath.initWithPath(path);
			picker.displayDirectory=thispath;
			picker.defaultExtension='html';
			picker.defaultString=file;
			picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
			if (picker.show()!=nsIFilePicker.returnCancel) var result=picker.file.persistentDescriptor;
		}
		catch(e) { alert('error during local file access: '+e.toString()) }
	}
	else { // IE
		try { // XPSP2 IE only
			var s = new ActiveXObject('UserAccounts.CommonDialog');
			s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|';
			s.FilterIndex=3; // default to HTML files;
			s.InitialDir=path;
			s.FileName=file;
			if (s.showOpen()) var result=s.FileName;
		}
		catch(e) {  // fallback
			var result=prompt(msg,path+file);
		}
	}
	return result;
}

config.macros.importTiddlers.loadRemoteFile = function(src,callback) {
	if (src==undefined || !src.length) return null; // filename is required
	var original=src; // URL as specified
	var hashpos=src.indexOf('#'); if (hashpos!=-1) src=src.substr(0,hashpos); // URL with #... suffix removed (needed for IE)
	clearMessage();
	displayMessage(this.openMsg.format([src.replace(/%20/g,' ')]));
	if (src.substr(0,5)!='http:' && src.substr(0,5)!='file:') { // if not a URL, read from local filesystem
		var txt=loadFile(src);
		if (!txt) { // file didn't load, might be relative path.. try fixup
			var pathPrefix=document.location.href;  // get current document path and trim off filename
			var slashpos=pathPrefix.lastIndexOf('/'); if (slashpos==-1) slashpos=pathPrefix.lastIndexOf('\\'); 
			if (slashpos!=-1 && slashpos!=pathPrefix.length-1) pathPrefix=pathPrefix.substr(0,slashpos+1);
			src=pathPrefix+src;
			if (pathPrefix.substr(0,5)!='http:') src=getLocalPath(src);
			var txt=loadFile(src);
		}
		if (!txt) { // file still didn't load, report error
			displayMessage(config.macros.importTiddlers.openErrMsg.format([src.replace(/%20/g,' '),'(filesystem error)']));
		} else {
			displayMessage(config.macros.importTiddlers.readMsg.format([txt.length,src.replace(/%20/g,' ')]));
			if (callback) callback(true,original,convertUTF8ToUnicode(txt),src,null);
		}
	} else {
		var name=config.options.txtRemoteUsername; var pass=config.options.txtRemotePassword;
		var xhr=doHttp('GET',src,null,null,name,pass,callback,original,null)
		if (!xhr) displayMessage(config.macros.importTiddlers.openErrMsg.format([src,'(XMLHTTPRequest error)']));
	}
}

config.macros.importTiddlers.readTiddlersFromHTML=function(html)
{
	var remoteStore=new TiddlyWiki();
	remoteStore.importTiddlyWiki(html);
	return remoteStore.getTiddlers('title');	
}

config.macros.importTiddlers.readTiddlersFromCSV=function(CSV) {
	var remoteStore=new TiddlyWiki();
	var lines=CSV.split('\n'); var names=lines[0].split(','); CSV=lines.join('\n')
	// ENCODE commas and newlines within quoted values
	var comma='!~comma~!'; var commaRE=new RegExp(comma,'g');
	var newline='!~newline~!'; var newlineRE=new RegExp(newline,'g');
	CSV=CSV.replace(/\x22((?:[^\x22]|\x22\x22)*?)\x22/g,
		function(x){ return x.substr(1,x.length-2).replace(/\,/g,comma).replace(/\n/g,newline); });
	// PARSE lines
	var lines=CSV.split('\n');
	for (var i=1; i<lines.length; i++) { if (!lines[i].length) continue;
		var values=lines[i].split(',');
		// DECODE commas, newlines and doubled-quotes within quoted values
		for (var v=0; v<values.length; v++)
			values[v]=values[v].replace(commaRE,',').replace(newlineRE,'\n').replace(/\x22\x22/g,'\x22');
		// EXTRACT tiddler values
		var title=''; var text=''; var tags=[]; var fields={};
		var created=null; var when=new Date(); var who=config.options.txtUserName;
		for (var v=0; v<values.length; v++) { var val=values[v];
			if (names[v]) switch(names[v].toLowerCase()) {
				case 'title':	title=val.replace(/\[\]\|/g,'_'); break;
				case 'created': created=new Date(val); break;
				case 'modified':when=new Date(val); break;
				case 'modifier':who=val; break;
				case 'text':	text=val; break;
				case 'tags':	tags=val.readBracketedList(); break;
				default:	fields[names[v].toLowerCase()]=val; break;
			}
		}
		// CREATE tiddler in temporary store
		if (title.length) remoteStore.saveTiddler(title,title,text,who,when,tags,fields,true,created||when);
	}
	return remoteStore.getTiddlers('title');	
}

config.macros.importTiddlers.filterTiddlerList=function(success,params,txt,src,xhr) {
	var cmi=config.macros.importTiddlers; // abbreviation
	var src=src.replace(/%20/g,' ');
	if (!success) { displayMessage(cmi.openErrMsg.format([src,xhr.status])); return; }
	cmi.all=cmi.readTiddlersFromHTML(txt);
	if (!cmi.all||!cmi.all.length) cmi.all=cmi.readTiddlersFromCSV(txt)
	var count=cmi.all?cmi.all.length:0;
	var querypos=src.lastIndexOf('?'); if (querypos!=-1) src=src.substr(0,querypos);
	displayMessage(cmi.foundMsg.format([count,src]));
	cmi.inbound=cmi.filterByHash(params,cmi.all); // use full URL including hash (if any)
	cmi.$('importLastFilter').value=cmi.lastFilter;
	window.refreshImportList(0);
}

config.macros.importTiddlers.filterByHash=function(src,tiddlers)
{
	var hashpos=src.lastIndexOf('#'); if (hashpos==-1) return tiddlers;
	var hash=src.substr(hashpos+1); if (!hash.length) return tiddlers;
	var tids=[];
	var params=hash.parseParams('anon',null,true,false,false);
	for (var p=1; p<params.length; p++) {
		switch (params[p].name) {
			case 'anon':
			case 'open':
				tids.pushUnique(params[p].value);
				break;
			case 'tag':
				if (store.getMatchingTiddlers) { // for boolean expressions - see MatchTagsPlugin
					var r=store.getMatchingTiddlers(params[p].value,null,tiddlers);
					for (var t=0; t<r.length; t++) tids.pushUnique(r[t].title);
				} else for (var t=0; t<tiddlers.length; t++)
					if (tiddlers[t].isTagged(params[p].value))
						tids.pushUnique(tiddlers[t].title);
				break;
			case 'story':
				for (var t=0; t<tiddlers.length; t++)
					if (tiddlers[t].title==params[p].value) {
						tiddlers[t].changed();
						for (var s=0; s<tiddlers[t].links.length; s++)
							tids.pushUnique(tiddlers[t].links[s]);
						break;
					}
				break;
			case 'search':
				for (var t=0; t<tiddlers.length; t++)
					if (tiddlers[t].text.indexOf(params[p].value)!=-1)
						tids.pushUnique(tiddlers[t].title);
				break;
		}
	}
	var matches=[];
	for (var t=0; t<tiddlers.length; t++)
		if (tids.contains(tiddlers[t].title))
			matches.push(tiddlers[t]);
	displayMessage(config.macros.importTiddlers.filterMsg.format([matches.length,hash]));
	config.macros.importTiddlers.lastFilter=hash;
	return matches;
}
//}}}
On Sunday, August 30, 2009 10:18:13 AM, Mike P. imported 1 tiddler from
[[|]]:
<<<
#[[WorkMenu]] - added
<<<

----
On Sunday, August 30, 2009 10:18:04 AM, Mike P. imported 1 tiddler from
[[E:\Private\Documents\TidlyWiki\MikeP.html|E:\Private\Documents\TidlyWiki\MikeP.html]]:
<<<
#[[HomeMenu]] - added
<<<

----
On Wednesday, August 26, 2009 2:04:29 PM, YourName imported 124 tiddlers from
[[E:\Private\Documents\TidlyWiki\NewLayout.html|E:\Private\Documents\TidlyWiki\NewLayout.html]]:
<<<
#[[Activity Report]] - added
#[[AutoClearMessage]] - added
#[[BJSATemplate]] - added
#[[Bills]] - added
#[[CheckboxPlugin]] - added
#[[CheckboxToggleTag]] - added
#[[Cigar Information]] - added
#[[Cigar Ratings]] - added
#[[Cigar Ratings System]] - added
#[[CigarNR]] - added
#[[CigarRec]] - added
#[[CigarTemplate]] - added
#[[CloseOnCancelPlugin]] - added
#[[ColorPalette]] - added
#[[ColorPalette Blue]] - added
#[[ColorPalette Brown]] - added
#[[ColorPalette Green]] - added
#[[ColorPalette Orange]] - added
#[[ColorPalette Red]] - added
#[[ColorPalette White]] - added
#[[ColorPalette xx Bloody2]] - added
#[[ColorPalette xx Inverse Default]] - added
#[[ColorPalette xx STRM Blue 1]] - added
#[[ColorPalette xx TestPalette]] - added
#[[Completed]] - added
#[[ContactTemplate]] - added
#[[Contacts]] - added
#[[CoreTweaks]] - added
#[[CustomCommands]] - added
#[[DateTime]] - added
#[[DefaultTiddlers]] - added
#[[DeliciousTaggingPlugin]] - added
#[[EmergencyContacts]] - added
#[[FieldsEditorPlugin]] - added
#[[HDir]] - added
#[[HideWhenPlugin]] - added
#[[Home]] - added
#[[ImageSizePlugin]] - added
#[[ImportTiddlersPlugin]] - skipped after asking
#[[InlineJavascriptPlugin]] - added
#[[LessBackupsPlugin]] - added
#[[MainMenu]] - added
#[[MatchTagsPlugin]] - added
#[[NLStyleSheet]] - added
#[[NestedSlidersPlugin]] - added
#[[NewLayoutTheme]] - added
#[[NewMeansNewPlugin]] - added
#[[No Tag]] - added
#[[NotificationTemplate]] - added
#[[OptionsPanel]] - added
#[[PaletteManagementPlugin]] - added
#[[ProjectTemplate]] - added
#[[Projects]] - added
#[[PurchaseTemplate]] - added
#[[QuickEditPackage]] - added
#[[QuickEditPlugin]] - added
#[[QuickEditToolbar]] - added
#[[QuickEdit_align]] - added
#[[QuickEdit_color]] - added
#[[QuickEdit_convert]] - added
#[[QuickEdit_custom]] - added
#[[QuickEdit_customList]] - added
#[[QuickEdit_font]] - added
#[[QuickEdit_fontList]] - added
#[[QuickEdit_format]] - added
#[[QuickEdit_image]] - added
#[[QuickEdit_insert]] - added
#[[QuickEdit_link]] - added
#[[QuickEdit_macro]] - added
#[[QuickEdit_replace]] - added
#[[QuickEdit_sort]] - added
#[[QuickEdit_split]] - added
#[[QuickOpenTagPlugin]] - added
#[[Quotations]] - added
#[[QuoteOfTheDayPlugin]] - added
#[[ReminderPlugin]] - added
#[[Reminders]] - added
#[[RenameTagsPlugin]] - added
#[[SaveCloseTiddlerPlugin]] - added
#[[SearchOptionsPlugin]] - added
#[[ShowLocalDirectory]] - added
#[[ShowPopup]] - added
#[[ShowTiddlerStatistics]] - added
#[[SideBarTabs]] - added
#[[StickyPopupPlugin]] - added
#[[StyleSheetPrint]] - added
#[[StyleSheetShortcuts]] - added
#[[StyleSheetTiddlersBar]] - added
#[[TabMore]] - added
#[[TableHighlight]] - added
#[[TableSortingPlugin]] - added
#[[TagglyTaggingPlugin]] - added
#[[TaskManagerPackage]] - added
#[[TaskManagerPlugin]] - added
#[[TaskTabs]] - added
#[[TiddlerCommands]] - added
#[[TiddlerEncryptionPlugin]] - added
#[[TiddlersBarPlugin]] - added
#[[ToggleLeftSidebar]] - added
#[[ToggleRightSidebar]] - added
#[[ToggleScrollingSidebars]] - added
#[[ToolbarCommands]] - added
#[[TrashPlugin]] - added
#[[WDir]] - added
#[[Wine Information]] - added
#[[Wine Ratings]] - added
#[[Wine Ratings System]] - added
#[[WineNR]] - added
#[[WineRec]] - added
#[[WineTemplate]] - added
#[[Work]] - added
#[[config.options.txt]] - added
#[[contentFooter]] - added
#[[contentHeader]] - added
#[[deleteAllTaggedPlugin]] - added
#[[deleteCompletedPlugin]] - added
#[[extendRenameTag]] - added
#[[extendTagButtonPlugin]] - added
#[[palette]] - added
#[[test]] - added
#[[test1]] - added
#[[test2]] - added
#[[test3]] - added
#[[test4]] - added
#[[zConfig]] - added
<<<
/***
|Name|InlineJavascriptPlugin|
|Source|http://www.TiddlyTools.com/#InlineJavascriptPlugin|
|Documentation|http://www.TiddlyTools.com/#InlineJavascriptPluginInfo|
|Version|1.9.5|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Insert Javascript executable code directly into your tiddler content.|
''Call directly into TW core utility routines, define new functions, calculate values, add dynamically-generated TiddlyWiki-formatted output'' into tiddler content, or perform any other programmatic actions each time the tiddler is rendered.
!!!!!Documentation
>see [[InlineJavascriptPluginInfo]]
!!!!!Revisions
<<<
2009.04.11 [1.9.5] pass current tiddler object into wrapper code so it can be referenced from within 'onclick' scripts
2009.02.26 [1.9.4] in $(), handle leading '#' on ID for compatibility with JQuery syntax
|please see [[InlineJavascriptPluginInfo]] for additional revision details|
2005.11.08 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.InlineJavascriptPlugin= {major: 1, minor: 9, revision: 5, date: new Date(2009,4,11)};

config.formatters.push( {
	name: "inlineJavascript",
	match: "\\<script",
	lookahead: "\\<script(?: src=\\\"((?:.|\\n)*?)\\\")?(?: label=\\\"((?:.|\\n)*?)\\\")?(?: title=\\\"((?:.|\\n)*?)\\\")?(?: key=\\\"((?:.|\\n)*?)\\\")?( show)?\\>((?:.|\\n)*?)\\</script\\>",

	handler: 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 src=lookaheadMatch[1];
			var label=lookaheadMatch[2];
			var tip=lookaheadMatch[3];
			var key=lookaheadMatch[4];
			var show=lookaheadMatch[5];
			var code=lookaheadMatch[6];
			if (src) { // external script library
				var script = document.createElement("script"); script.src = src;
				document.body.appendChild(script); document.body.removeChild(script);
			}
			if (code) { // inline code
				if (show) // display source in tiddler
					wikify("{{{\n"+lookaheadMatch[0]+"\n}}}\n",w.output);
				if (label) { // create 'onclick' command link
					var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",wikifyPlainText(label));
					var fixup=code.replace(/document.write\s*\(/gi,'place.bufferedHTML+=(');
					link.code="function _out(place,tiddler){"+fixup+"\n};_out(this,this.tiddler);"
					link.tiddler=w.tiddler;
					link.onclick=function(){
						this.bufferedHTML="";
						try{ var r=eval(this.code);
							if(this.bufferedHTML.length || (typeof(r)==="string")&&r.length)
								var s=this.parentNode.insertBefore(document.createElement("span"),this.nextSibling);
							if(this.bufferedHTML.length)
								s.innerHTML=this.bufferedHTML;
							if((typeof(r)==="string")&&r.length) {
								wikify(r,s,null,this.tiddler);
								return false;
							} else return r!==undefined?r:false;
						} catch(e){alert(e.description||e.toString());return false;}
					};
					link.setAttribute("title",tip||"");
					var URIcode='javascript:void(eval(decodeURIComponent(%22(function(){try{';
					URIcode+=encodeURIComponent(encodeURIComponent(code.replace(/\n/g,' ')));
					URIcode+='}catch(e){alert(e.description||e.toString())}})()%22)))';
					link.setAttribute("href",URIcode);
					link.style.cursor="pointer";
					if (key) link.accessKey=key.substr(0,1); // single character only
				}
				else { // run script immediately
					var fixup=code.replace(/document.write\s*\(/gi,'place.innerHTML+=(');
					var c="function _out(place,tiddler){"+fixup+"\n};_out(w.output,w.tiddler);";
					try	 { var out=eval(c); }
					catch(e) { out=e.description?e.description:e.toString(); }
					if (out && out.length) wikify(out,w.output,w.highlightRegExp,w.tiddler);
				}
			}
			w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
		}
	}
} )
//}}}

// // Backward-compatibility for TW2.1.x and earlier
//{{{
if (typeof(wikifyPlainText)=="undefined") window.wikifyPlainText=function(text,limit,tiddler) {
	if(limit > 0) text = text.substr(0,limit);
	var wikifier = new Wikifier(text,formatter,null,tiddler);
	return wikifier.wikifyPlain();
}
//}}}

// // GLOBAL FUNCTION: $(...) -- 'shorthand' convenience syntax for document.getElementById()
//{{{
if (typeof($)=='undefined') { function $(id) { return document.getElementById(id.replace(/^#/,'')); } }
//}}}
/***
|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 code by by Saq Imtiaz.
!!!Code
***/
//{{{
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 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_orig = window.getBackupPath;
window.getBackupPath = function(localPath) {
	return getSpecialBackupPath(getBackupPath_orig(localPath));
}

//}}}
[[Projects]]
[[Reminders]]
<<tag systemConfig>>
<<tag Scripts>>
<hr>
{{small{<script>
javascript:(function(){document.write('\nLast modified:<br>'+document.lastModified);})()
</script>}}}
<hr>
[[Download|http://www.strm.us/tw/examples_twgg/download.php?file=../newlayout.html]]
/***
|Name|MatchTagsPlugin|
|Source|http://www.TiddlyTools.com/#MatchTagsPlugin|
|Documentation|http://www.TiddlyTools.com/#MatchTagsPluginInfo|
|Version|2.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|'tag matching' with full boolean expressions (AND, OR, NOT, and nested parentheses)|
!!!!!Documentation
> see [[MatchTagsPluginInfo]]
!!!!!Revisions
<<<
2008.09.04 [2.0.0] added "report" and "panel" options to generate formatted results and store in a tiddler.  Also, added config.macros.matchTags.formatList(place,fmt,sep) API to return formatted output for use with other plugins/scripts
| please see [[MatchTagsPluginInfo]] for additional revision details |
2008.02.28 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.MatchTagsPlugin= {major: 2, minor: 0, revision: 0, date: new Date(2008,9,4)};

// store.getMatchingTiddlers() processes boolean expressions for tag matching
//    sortfield (optional) sets sort order for tiddlers - default=title
//    tiddlers (optional) use alternative set of tiddlers (instead of current store)
TiddlyWiki.prototype.getMatchingTiddlers = function(tagexpr,sortfield,tiddlers) {

	var debug=config.options.chkDebug; // abbreviation
	var cmm=config.macros.matchTags; // abbreviation
	var r=[]; // results are an array of tiddlers
	var tids=tiddlers||store.getTiddlers(sortfield||"title");
	if (tiddlers && sortfield) store.sortTiddlers(tids,sortfield);
	if (debug) displayMessage(cmm.msg1.format([tids.length]));

	// try simple lookup to quickly find single tags or tags that
	// contain boolean operators as literals, e.g. "foo and bar"
	for (var t=0; t<tids.length; t++)
		if (tids[t].isTagged(tagexpr)) r.pushUnique(tids[t]);
	if (r.length) {
		if (debug) displayMessage(cmm.msg4.format([r.length,tagexpr]));
		return r;
	}
	
	// convert expression into javascript code with regexp tests,
	// so that "tag1 AND ( tag2 OR NOT tag3 )" becomes
	// "/\~tag1\~/.test(...) && ( /\~tag2\~/.test(...) || ! /\~tag3\~/.test(...) )"

	// normalize whitespace, tokenize operators, delimit with "~"
	var c=tagexpr.trim(); // remove leading/trailing spaces
	c = c.replace(/\s+/ig," "); // reduce multiple spaces to single spaces
	c = c.replace(/\(\s?/ig,"~(~"); // open parens
	c = c.replace(/\s?\)/ig,"~)~"); // close parens
	c = c.replace(/(\s|~)?&&(\s|~)?/ig,"~&&~"); // &&
	c = c.replace(/(\s|~)AND(\s|~)/ig,"~&&~"); // AND
	c = c.replace(/(\s|~)?\|\|(\s|~)?/ig,"~||~"); // ||
	c = c.replace(/(\s|~)OR(\s|~)/ig,"~||~"); // OR
	c = c.replace(/(\s|~)?!(\s|~)?/ig,"~!~"); // !
	c = c.replace(/(^|~|\s)NOT(\s|~)/ig,"~!~"); // NOT
	c = c.replace(/(^|~|\s)NOT~\(/ig,"~!~("); // NOT(
	// change tag terms to regexp tests
	var terms=c.split("~"); for (var i=0; i<terms.length; i++) { var t=terms[i];
		if (/(&&)|(\|\|)|[!\(\)]/.test(t) || t=="") continue; // skip operators/parens/spaces
		if (t==config.macros.matchTags.untaggedKeyword)
			terms[i]="tiddlertags=='~~'"; // 'untagged' tiddlers
		else
			terms[i]="/\\~"+t+"\\~/.test(tiddlertags)";
	}
	c=terms.join(" ");
	if (debug) { displayMessage(cmm.msg2.format([tagexpr])); displayMessage(cmm.msg3.format([c])); }

	// scan tiddlers for matches
	for (var t=0; t<tids.length; t++) {
	 	// assemble tags from tiddler into string "~tag1~tag2~tag3~"
		var tiddlertags = "~"+tids[t].tags.join("~")+"~";
		try { if(eval(c)) r.push(tids[t]); } // test tags
		catch(e) { // error in test
			displayMessage(cmm.msg2.format([tagexpr]));
			displayMessage(cmm.msg3.format([c]));
			displayMessage(e.toString());
			break; // skip remaining tiddlers
		}
	}
	if (debug) displayMessage(cmm.msg4.format([r.length,tagexpr]));
	return r;
}
//}}}
//{{{
config.macros.matchTags = {
	msg1: "scanning %0 input tiddlers",
	msg2: "looking for '%0'",
	msg3: "using expression: '%0'",
	msg4: "found %0 tiddlers matching '%1'",
	noMatch: "no matching tiddlers",
	untaggedKeyword: "-",



	untaggedLabel: "no tags",
	untaggedPrompt: "show tiddlers with no tags",
	defTiddler: "MatchingTiddlers",
	defFormat: "%0",
	defSeparator: "\n",
	reportHeading: "Found %0 tiddlers tagged with: '{{{%1}}}'\n----\n",
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var mode=params[0]?params[0].toLowerCase():'';
		if (mode=="inline")
			params.shift();
		if (mode=="report" || mode=="panel") {
			params.shift();
			var target=params.shift()||this.defTiddler;
		}
		if (mode=="popup") {
			params.shift();
			if (params[0]&&params[0].substr(0,6)=="label:") var label=params.shift().substr(6);
			if (params[0]&&params[0].substr(0,7)=="prompt:") var prompt=params.shift().substr(7);
		} else {
			var fmt=(params.shift()||this.defFormat).unescapeLineBreaks();
			var sep=(params.shift()||this.defSeparator).unescapeLineBreaks();
		}
		var sortBy="+title";
		if (params[0]&&params[0].substr(0,5)=="sort:") sortBy=params.shift().substr(5);
		var expr = params.join(" ");
		if (mode!="panel" && (!expr||!expr.trim().length)) return;
		if (expr==this.untaggedKeyword)
			{ var label=this.untaggedLabel; var prompt=this.untaggedPrompt };
		switch (mode) {
			case "popup": this.createPopup(place,label,expr,prompt,sortBy); break;
			case "panel": this.createPanel(place,expr,fmt,sep,sortBy,target); break;
			case "report": this.createReport(target,expr,fmt,sep,sortBy); break;
			case "inline": default: this.createInline(place,expr,fmt,sep,sortBy); break;
		}
	},
	formatList: function(tids,fmt,sep) {
		var out=[];
		for (var t=0; t<tids.length; t++) {
			var title="[["+tids[t].title+"]]";
			var who=tids[t].modifier;
			var when=tids[t].modified.toLocaleString();
			var text=tids[t].text;
			var first=tids[t].text.split("\n")[0];
			var desc=store.getTiddlerSlice(tids[t].title,"description");
			desc=desc||store.getTiddlerSlice(tids[t].title,"Description");
			desc=desc||store.getTiddlerText(tids[t].title+"##description");
			desc=desc||store.getTiddlerText(tids[t].title+"##Description");
			out.push(fmt.format([title,who,when,text,first,desc]));
		}
		return out.join(sep);
	},
	createInline: function(place,expr,fmt,sep,sortBy) {
		wikify(this.formatList(store.sortTiddlers(store.getMatchingTiddlers(expr),sortBy),fmt,sep),place);
	},
	createPopup: function(place,label,expr,prompt,sortBy) {
		var btn=createTiddlyButton(place,
			(label||expr).format([expr]),
			(prompt||config.views.wikified.tag.tooltip).format([expr]),
			function(ev){ return config.macros.matchTags.showPopup(this,ev||window.event); });
		btn.setAttribute("sortBy",sortBy);
		btn.setAttribute("expr",expr);
	},
	showPopup: function(here,ev) {
		var p=Popup.create(here); if (!p) return false;
		var tids=store.getMatchingTiddlers(here.getAttribute("expr"));
		store.sortTiddlers(tids,here.getAttribute("sortBy"));
		var list=[]; for (var t=0; t<tids.length; t++) list.push(tids[t].title);
		if (!list.length) createTiddlyText(p,this.noMatch);
		else {
			var b=createTiddlyButton(createTiddlyElement(p,"li"),
				config.views.wikified.tag.openAllText,
				config.views.wikified.tag.openAllTooltip,
				function() {
					var list=this.getAttribute("list").readBracketedList();
					story.displayTiddlers(null,tids);
				});
			b.setAttribute("list","[["+list.join("]] [[")+"]]");
			createTiddlyElement(p,"hr");
		}
		var out=this.formatList(tids," &nbsp;%0&nbsp; ","\n"); wikify(out,p);
		Popup.show(p,false);
		ev.cancelBubble=true;
		if(ev.stopPropagation) ev.stopPropagation();
		return false;
	},
	createReport: function(target,expr,fmt,sep,sortBy) {
		var tids=store.sortTiddlers(store.getMatchingTiddlers(expr),sortBy);
		if (!tids.length) { displayMessage('no matches for: '+expr); return false; }
		var msg=config.messages.overwriteWarning.format([target]);
		if (store.tiddlerExists(target) && !confirm(msg)) return false;
		var out=this.reportHeading.format([tids.length,expr])
		out+=this.formatList(tids,fmt,sep);
		store.saveTiddler(target,target,out,config.options.txtUserName,new Date(),[],{});
		story.closeTiddler(target); story.displayTiddler(null,target);
	},
	createPanel: function(place,expr,fmt,sep,sortBy,tid) {
		var html="<form style='display:inline'><!-- \
			--><input type='text'    name='expr' style='width:55%' title='tag expression'><!-- \
			--><input type='text'    name='fmt'  style='width:10%' title='list item format'><!-- \
			--><input type='text'    name='sep'  style='width:5%'  title='list item separator'><!-- \
			--><input type='text'    name='tid'  style='width:20%' title='target tiddler title'><!-- \
			--><input type='button'  name='go'   style='width:8%'  value='go' onclick=\" \
				var expr=this.form.expr.value; \
				if (!expr.length) { alert('Enter a boolean tag expression'); return false; } \
				var fmt=this.form.fmt.value; \
				if (!fmt.length) { alert('Enter the list item output format'); return false; } \
				var sep=this.form.sep.value.unescapeLineBreaks(); \
				var tid=this.form.tid.value; \
				if (!tid.length) { alert('Enter a target tiddler title'); return false; } \
				config.macros.matchTags.createReport(tid,expr,fmt,sep,'title'); \
				return false;\"> \
			</form>";
		var s=createTiddlyElement(place,"span"); s.innerHTML=html;
		var f=s.getElementsByTagName("form")[0];
		f.expr.value=expr; f.fmt.value=fmt; f.sep.value=sep.escapeLineBreaks(); f.tid.value=tid;
	}
};
//}}}
//{{{
// SHADOW TIDDLER for displaying default panel input form
config.shadowTiddlers.MatchTags="{{smallform{<<matchTags panel>>}}}";
//}}}
//{{{
// TWEAK core filterTiddlers() for enhanced boolean matching in [tag[...]] syntax:
// use getMatchingTiddlers instead getTaggedTiddlers
var fn=TiddlyWiki.prototype.filterTiddlers;
fn=fn.toString().replace(/getTaggedTiddlers/g,"getMatchingTiddlers");
eval("TiddlyWiki.prototype.filterTiddlers="+fn);
//}}}
//{{{
// REDEFINE core handler for enhanced boolean matching in tag:"..." paramifier
// use filterTiddlers() instead of getTaggedTiddlers() to get list of tiddlers.
config.paramifiers.tag = {
	onstart: function(v) {
		var tagged = store.filterTiddlers("[tag["+v+"]]");
		story.displayTiddlers(null,tagged,null,false,null);
	}
};
//}}}
/*Basic Style Definitions*/
[[StyleSheetShortcuts]]
/*{{{*/
/*Table Style row highlighting*/
.evenRow{background-color: [[ColorPalette::TertiaryMid]];}
.highlight, .marked {background:[[ColorPalette::SecondaryLight]] !important;}
table.sortable td.sortedCol {background: [[ColorPalette::SecondaryMid]];}

/*Center Table Style*/
.viewer div.centeredTable {
	text-align: center;
}
.viewer div.centeredTable table {
	margin: 0 auto;
	text-align: left;
}
/*}}}*/

/*Experimental Style*/
/*{{{*/
/* auto tiddler expansion expand tiddler to fit contents if needed */
.tiddler {overflow: auto; padding: .75em;}
/* more subtle subtitle */
.subtitle {font-size:0.8em;}
/*Color & Layout Tweaks*/
body {background: [[ColorPalette::PrimaryMid]];}
.tiddler {background: [[ColorPalette::Background]]; border: 1px [[ColorPalette::SecondaryLight]] solid;}
#mainMenu, #sidebar{
	background: [[ColorPalette::Background]];
	-moz-border-radius: 1em;
	padding:.5em;
	margin-left: .5em;
	margin-right: .5em;
	margin-top: 1em;
	border: 1px [[ColorPalette::SecondaryLight]] solid;
}
/* NestedSlidersPlugin popup */
.floatingPanel {background-color:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]]; border: 1px solid [[ColorPalette::TertiaryMid]]; }
/*}}}*/

/*Tiddler Spacing*/
/*{{{*/
.tiddler {
	margin-bottom: 1em;
}
/*}}}*/

/*Header & Footer Div Style*/
/*{{{*/
/* Modify Tiddler margin/padding to fit TiddlersBar better */
.hD, .fD {
	-moz-border-radius: 1em;
	webkit-border-radius:1em;
	background: [[ColorPalette::Background]];
	border: 1px [[ColorPalette::SecondaryLight]] solid;
	color: [[ColorPalette::Foreground]];
	margin-bottom: 1em;
}
/*}}}*/

/*Title & Menu Shadows ~FF3.5*/
/*{{{*/
.siteTitle {text-shadow: 1px 1px 0px [[ColorPalette::TertiaryPale]], -1px 1px 2px [[ColorPalette::TertiaryPale]]; font-size: 350%;}
.siteSubtitle {text-shadow: 1px 1px 0px [[ColorPalette::TertiaryPale]], -1px 1px 2px [[ColorPalette::TertiaryPale]]; font-size: 175%;}
/*}}}*/

/*Rounded Corners Style ~FF3.0*/
/*{{{*/
.tiddler, .viewer {
	-moz-border-radius: 1em;
	webkit-border-radius:1em;
}
.toolbar .button, .toolbar a, #messageArea, .tagging, .tagged, .tabContents, #sidebarOptions .sliderPanel {
	-moz-border-radius: 1em;
	webkit-border-radius:1em;
}
#sidebarTabs .tab, .tabSelected, .tabUnselected {
	-moz-border-radius-topleft:.5em;
	-moz-border-radius-topright:.5em;
	webkit-border-radius:.5em;
}
/*}}}*/

/*Align Header*/
/*{{{*/
.header, .headerNow, .hD, .fD {
/*	text-align: center;*/
/*	text-align: left;*/
/*	text-align: right;*/
	padding-left: .75em;
	padding-right: .75em;
}
.header, .headerNow {
	color: [[ColorPalette::PrimaryMid]];
//	font-family: times, serif;
	font-family: ariel, serif;
	font-weight:bold;
}
/*}}}*/

/* prefer monospace for editing */
/*{{{*/
.editor textarea {
	font-family: 'Consolas' monospace;
}
/*}}}*/

/* sexy tiddler titles */
/*{{{*/
.title {
	font-size: 175%;
	color: [[ColorPalette::PrimaryLight]];
	font-family: ariel, serif;
}
/*}}}*/

/* make 2.2 act like 2.1 with the invisible buttons */
/*{{{*/
.toolbar {
	float:right;
	display:inline;
	padding-bottom:0;
	visibility:hidden;
}
.selected .toolbar {
	visibility:visible;
}
/*}}}*/

/* for Index Pop Up*/
/*{{{*/
.popup li a {
	display:inline;
}
/*}}}*/
/***
|Name|NestedSlidersPlugin|
|Source|http://www.TiddlyTools.com/#NestedSlidersPlugin|
|Documentation|http://www.TiddlyTools.com/#NestedSlidersPluginInfo|
|Version|2.4.9|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Options|##Configuration|
|Description|show content in nest-able sliding/floating panels, without creating separate tiddlers for each panel's content|
!!!!!Documentation
>see [[NestedSlidersPluginInfo]]
!!!!!Configuration
<<<
<<option chkFloatingSlidersAnimate>> allow floating sliders to animate when opening/closing
>Note: This setting can cause 'clipping' problems in some versions of InternetExplorer.
>In addition, for floating slider animation to occur you must also allow animation in general (see [[AdvancedOptions]]).
<<<
!!!!!Revisions
<<<
2008.11.15 - 2.4.9 in adjustNestedSlider(), don't make adjustments if panel is marked as 'undocked' (CSS class).  In onClickNestedSlider(), SHIFT-CLICK docks panel (see [[MoveablePanelPlugin]])
|please see [[NestedSlidersPluginInfo]] for additional revision details|
2005.11.03 - 1.0.0 initial public release.  Thanks to RodneyGomes, GeoffSlocock, and PaulPetterson for suggestions and experiments.
<<<
!!!!!Code
***/
//{{{
version.extensions.NestedSlidersPlugin= {major: 2, minor: 4, revision: 9, date: new Date(2008,11,15)};

// options for deferred rendering of sliders that are not initially displayed
if (config.options.chkFloatingSlidersAnimate===undefined)
	config.options.chkFloatingSlidersAnimate=false; // avoid clipping problems in IE

// default styles for 'floating' class
setStylesheet(".floatingPanel { position:absolute; z-index:10; padding:0.5em; margin:0em; \
	background-color:#eee; color:#000; border:1px solid #000; text-align:left; }","floatingPanelStylesheet");

// if removeCookie() function is not defined by TW core, define it here.
if (window.removeCookie===undefined) {
	window.removeCookie=function(name) {
		document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;'; 
	}
}

config.formatters.push( {
	name: "nestedSliders",
	match: "\\n?\\+{3}",
	terminator: "\\s*\\={3}\\n?",
	lookahead: "\\n?\\+{3}(\\+)?(\\([^\\)]*\\))?(\\!*)?(\\^(?:[^\\^\\*\\@\\[\\>]*\\^)?)?(\\*)?(\\@)?(?:\\{\\{([\\w]+[\\s\\w]*)\\{)?(\\[[^\\]]*\\])?(\\[[^\\]]*\\])?(?:\\}{3})?(\\#[^:]*\\:)?(\\>)?(\\.\\.\\.)?\\s*",
	handler: function(w)
		{
			lookaheadRegExp = new RegExp(this.lookahead,"mg");
			lookaheadRegExp.lastIndex = w.matchStart;
			var lookaheadMatch = lookaheadRegExp.exec(w.source)
			if(lookaheadMatch && lookaheadMatch.index == w.matchStart)
			{
				var defopen=lookaheadMatch[1];
				var cookiename=lookaheadMatch[2];
				var header=lookaheadMatch[3];
				var panelwidth=lookaheadMatch[4];
				var transient=lookaheadMatch[5];
				var hover=lookaheadMatch[6];
				var buttonClass=lookaheadMatch[7];
				var label=lookaheadMatch[8];
				var openlabel=lookaheadMatch[9];
				var panelID=lookaheadMatch[10];
				var blockquote=lookaheadMatch[11];
				var deferred=lookaheadMatch[12];

				// location for rendering button and panel
				var place=w.output;

				// default to closed, no cookie, no accesskey, no alternate text/tip
				var show="none"; var cookie=""; var key="";
				var closedtext=">"; var closedtip="";
				var openedtext="<"; var openedtip="";

				// extra "+", default to open
				if (defopen) show="block";

				// cookie, use saved open/closed state
				if (cookiename) {
					cookie=cookiename.trim().slice(1,-1);
					cookie="chkSlider"+cookie;
					if (config.options[cookie]==undefined)
						{ config.options[cookie] = (show=="block") }
					show=config.options[cookie]?"block":"none";
				}

				// parse label/tooltip/accesskey: [label=X|tooltip]
				if (label) {
					var parts=label.trim().slice(1,-1).split("|");
					closedtext=parts.shift();
					if (closedtext.substr(closedtext.length-2,1)=="=")	
						{ key=closedtext.substr(closedtext.length-1,1); closedtext=closedtext.slice(0,-2); }
					openedtext=closedtext;
					if (parts.length) closedtip=openedtip=parts.join("|");
					else { closedtip="show "+closedtext; openedtip="hide "+closedtext; }
				}

				// parse alternate label/tooltip: [label|tooltip]
				if (openlabel) {
					var parts=openlabel.trim().slice(1,-1).split("|");
					openedtext=parts.shift();
					if (parts.length) openedtip=parts.join("|");
					else openedtip="hide "+openedtext;
				}

				var title=show=='block'?openedtext:closedtext;
				var tooltip=show=='block'?openedtip:closedtip;

				// create the button
				if (header) { // use "Hn" header format instead of button/link
					var lvl=(header.length>5)?5:header.length;
					var btn = createTiddlyElement(createTiddlyElement(place,"h"+lvl,null,null,null),"a",null,buttonClass,title);
					btn.onclick=onClickNestedSlider;
					btn.setAttribute("href","javascript:;");
					btn.setAttribute("title",tooltip);
				}
				else
					var btn = createTiddlyButton(place,title,tooltip,onClickNestedSlider,buttonClass);
				btn.innerHTML=title; // enables use of HTML entities in label

				// set extra button attributes
				btn.setAttribute("closedtext",closedtext);
				btn.setAttribute("closedtip",closedtip);
				btn.setAttribute("openedtext",openedtext);
				btn.setAttribute("openedtip",openedtip);
				btn.sliderCookie = cookie; // save the cookiename (if any) in the button object
				btn.defOpen=defopen!=null; // save default open/closed state (boolean)
				btn.keyparam=key; // save the access key letter ("" if none)
				if (key.length) {
					btn.setAttribute("accessKey",key); // init access key
					btn.onfocus=function(){this.setAttribute("accessKey",this.keyparam);}; // **reclaim** access key on focus
				}
				btn.setAttribute("hover",hover?"true":"false");
				btn.onmouseover=function(ev) {
					// optional 'open on hover' handling
					if (this.getAttribute("hover")=="true" && this.sliderPanel.style.display=='none') {
						document.onclick.call(document,ev); // close transients
						onClickNestedSlider(ev); // open this slider
					}
					// mouseover on button aligns floater position with button
					if (window.adjustSliderPos) window.adjustSliderPos(this.parentNode,this,this.sliderPanel);
				}

				// create slider panel
				var panelClass=panelwidth?"floatingPanel":"sliderPanel";
				if (panelID) panelID=panelID.slice(1,-1); // trim off delimiters
				var panel=createTiddlyElement(place,"div",panelID,panelClass,null);
				panel.button = btn; // so the slider panel know which button it belongs to
				btn.sliderPanel=panel; // so the button knows which slider panel it belongs to
				panel.defaultPanelWidth=(panelwidth && panelwidth.length>2)?panelwidth.slice(1,-1):"";
				panel.setAttribute("transient",transient=="*"?"true":"false");
				panel.style.display = show;
				panel.style.width=panel.defaultPanelWidth;
				panel.onmouseover=function(event) // mouseover on panel aligns floater position with button
					{ if (window.adjustSliderPos) window.adjustSliderPos(this.parentNode,this.button,this); }

				// render slider (or defer until shown) 
				w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
				if ((show=="block")||!deferred) {
					// render now if panel is supposed to be shown or NOT deferred rendering
					w.subWikify(blockquote?createTiddlyElement(panel,"blockquote"):panel,this.terminator);
					// align floater position with button
					if (window.adjustSliderPos) window.adjustSliderPos(place,btn,panel);
				}
				else {
					var src = w.source.substr(w.nextMatch);
					var endpos=findMatchingDelimiter(src,"+++","===");
					panel.setAttribute("raw",src.substr(0,endpos));
					panel.setAttribute("blockquote",blockquote?"true":"false");
					panel.setAttribute("rendered","false");
					w.nextMatch += endpos+3;
					if (w.source.substr(w.nextMatch,1)=="\n") w.nextMatch++;
				}
			}
		}
	}
)

function findMatchingDelimiter(src,starttext,endtext) {
	var startpos = 0;
	var endpos = src.indexOf(endtext);
	// check for nested delimiters
	while (src.substring(startpos,endpos-1).indexOf(starttext)!=-1) {
		// count number of nested 'starts'
		var startcount=0;
		var temp = src.substring(startpos,endpos-1);
		var pos=temp.indexOf(starttext);
		while (pos!=-1)  { startcount++; pos=temp.indexOf(starttext,pos+starttext.length); }
		// set up to check for additional 'starts' after adjusting endpos
		startpos=endpos+endtext.length;
		// find endpos for corresponding number of matching 'ends'
		while (startcount && endpos!=-1) {
			endpos = src.indexOf(endtext,endpos+endtext.length);
			startcount--;
		}
	}
	return (endpos==-1)?src.length:endpos;
}
//}}}
//{{{
window.onClickNestedSlider=function(e)
{
	if (!e) var e = window.event;
	var theTarget = resolveTarget(e);
	while (theTarget && theTarget.sliderPanel==undefined) theTarget=theTarget.parentNode;
	if (!theTarget) return false;
	var theSlider = theTarget.sliderPanel;
	var isOpen = theSlider.style.display!="none";

	// if SHIFT-CLICK, dock panel first (see [[MoveablePanelPlugin]])
	if (e.shiftKey && config.macros.moveablePanel) config.macros.moveablePanel.dock(theSlider,e);

	// toggle label
	theTarget.innerHTML=isOpen?theTarget.getAttribute("closedText"):theTarget.getAttribute("openedText");
	// toggle tooltip
	theTarget.setAttribute("title",isOpen?theTarget.getAttribute("closedTip"):theTarget.getAttribute("openedTip"));

	// deferred rendering (if needed)
	if (theSlider.getAttribute("rendered")=="false") {
		var place=theSlider;
		if (theSlider.getAttribute("blockquote")=="true")
			place=createTiddlyElement(place,"blockquote");
		wikify(theSlider.getAttribute("raw"),place);
		theSlider.setAttribute("rendered","true");
	}

	// show/hide the slider
	if(config.options.chkAnimate && (!hasClass(theSlider,'floatingPanel') || config.options.chkFloatingSlidersAnimate))
		anim.startAnimating(new Slider(theSlider,!isOpen,e.shiftKey || e.altKey,"none"));
	else
		theSlider.style.display = isOpen ? "none" : "block";

	// reset to default width (might have been changed via plugin code)
	theSlider.style.width=theSlider.defaultPanelWidth;

	// align floater panel position with target button
	if (!isOpen && window.adjustSliderPos) window.adjustSliderPos(theSlider.parentNode,theTarget,theSlider);

	// if showing panel, set focus to first 'focus-able' element in panel
	if (theSlider.style.display!="none") {
		var ctrls=theSlider.getElementsByTagName("*");
		for (var c=0; c<ctrls.length; c++) {
			var t=ctrls[c].tagName.toLowerCase();
			if ((t=="input" && ctrls[c].type!="hidden") || t=="textarea" || t=="select")
				{ try{ ctrls[c].focus(); } catch(err){;} break; }
		}
	}
	var cookie=theTarget.sliderCookie;
	if (cookie && cookie.length) {
		config.options[cookie]=!isOpen;
		if (config.options[cookie]!=theTarget.defOpen) window.saveOptionCookie(cookie);
		else window.removeCookie(cookie); // remove cookie if slider is in default display state
	}

	// prevent SHIFT-CLICK from being processed by browser (opens blank window... yuck!)
	// prevent clicks *within* a slider button from being processed by browser
	// but allow plain click to bubble up to page background (to close transients, if any)
	if (e.shiftKey || theTarget!=resolveTarget(e))
		{ e.cancelBubble=true; if (e.stopPropagation) e.stopPropagation(); }
	Popup.remove(); // close open popup (if any)
	return false;
}
//}}}
//{{{
// click in document background closes transient panels 
document.nestedSliders_savedOnClick=document.onclick;
document.onclick=function(ev) { if (!ev) var ev=window.event; var target=resolveTarget(ev);

	if (document.nestedSliders_savedOnClick)
		var retval=document.nestedSliders_savedOnClick.apply(this,arguments);
	// if click was inside a popup... leave transient panels alone
	var p=target; while (p) if (hasClass(p,"popup")) break; else p=p.parentNode;
	if (p) return retval;
	// if click was inside transient panel (or something contained by a transient panel), leave it alone
	var p=target; while (p) {
		if ((hasClass(p,"floatingPanel")||hasClass(p,"sliderPanel"))&&p.getAttribute("transient")=="true") break;
		p=p.parentNode;
	}
	if (p) return retval;
	// otherwise, find and close all transient panels...
	var all=document.all?document.all:document.getElementsByTagName("DIV");
	for (var i=0; i<all.length; i++) {
		 // if it is not a transient panel, or the click was on the button that opened this panel, don't close it.
		if (all[i].getAttribute("transient")!="true" || all[i].button==target) continue;
		// otherwise, if the panel is currently visible, close it by clicking it's button
		if (all[i].style.display!="none") window.onClickNestedSlider({target:all[i].button})
		if (!hasClass(all[i],"floatingPanel")&&!hasClass(all[i],"sliderPanel")) all[i].style.display="none";
	}
	return retval;
};
//}}}
//{{{
// adjust floating panel position based on button position
if (window.adjustSliderPos==undefined) window.adjustSliderPos=function(place,btn,panel) {
	if (hasClass(panel,"floatingPanel") && !hasClass(panel,"undocked")) {
		// see [[MoveablePanelPlugin]] for use of 'undocked'
		var rightEdge=document.body.offsetWidth-1;
		var panelWidth=panel.offsetWidth;
		var left=0;
		var top=btn.offsetHeight; 
		if (place.style.position=="relative" && findPosX(btn)+panelWidth>rightEdge) {
			left-=findPosX(btn)+panelWidth-rightEdge; // shift panel relative to button
			if (findPosX(btn)+left<0) left=-findPosX(btn); // stay within left edge
		}
		if (place.style.position!="relative") {
			var left=findPosX(btn);
			var top=findPosY(btn)+btn.offsetHeight;
			var p=place; while (p && !hasClass(p,'floatingPanel')) p=p.parentNode;
			if (p) { left-=findPosX(p); top-=findPosY(p); }
			if (left+panelWidth>rightEdge) left=rightEdge-panelWidth;
			if (left<0) left=0;
		}
		panel.style.left=left+"px"; panel.style.top=top+"px";
	}
}
//}}}
//{{{
// TW2.1 and earlier:
// hijack Slider stop handler so overflow is visible after animation has completed
Slider.prototype.coreStop = Slider.prototype.stop;
Slider.prototype.stop = function()
	{ this.coreStop.apply(this,arguments); this.element.style.overflow = "visible"; }

// TW2.2+
// hijack Morpher stop handler so sliderPanel/floatingPanel overflow is visible after animation has completed
if (version.major+.1*version.minor+.01*version.revision>=2.2) {
	Morpher.prototype.coreStop = Morpher.prototype.stop;
	Morpher.prototype.stop = function() {
		this.coreStop.apply(this,arguments);
		var e=this.element;
		if (hasClass(e,"sliderPanel")||hasClass(e,"floatingPanel")) {
			// adjust panel overflow and position after animation
			e.style.overflow = "visible";
			if (window.adjustSliderPos) window.adjustSliderPos(e.parentNode,e.button,e);
		}
	};
}
//}}}
|''Name''|NewLayoutTheme|
|''Description''|Custom Theme Spawned from MPTW by MTP 11.08.08|
|''Last Revision''|MTP 11.20.08|

!Author Mode
|PageTemplate|##PageTemplate|
|ViewTemplate|##ViewTemplate|
|EditTemplate|##EditTemplate|
|StyleSheet|NLStyleSheet|
|ColorPalette|ColorPalette|

!PageTemplate
<!--{{{-->
<div class='header' macro='gradient vert  [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]] '>
	<div class='headerNow'>
		<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 class='hD' id='hD' refresh='content' tiddler='contentHeader'></div> 
	<div id='messageArea'></div>
<div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'></div>
	<div id='tiddlerDisplay'></div>
	<div class='fD' id='fD' refresh='content' tiddler='contentFooter'></div>
</div>
<!--}}}-->

!ViewTemplate
<!--{{{-->
<!-- Last Revision 07.19.09 -->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class="tagglyTagged" macro="tags"></div>

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

<div class='subtitle'>
	modified <span macro='view modified date "DDD MMM 0DD, YYYY"'></span>
	(<span macro='message views.wikified.createdPrompt'></span>
	<span macro='view created date "0MM.0DD.YY"'></span>)
</div>

<div class='viewer' macro='view text wikified'></div>

<div class="tagglyTagging" macro="tagglyTagging"></div>
<span macro="tiddler TableHighlight"></span>
<!--}}}-->
!EditTemplate
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='tiddler QuickEditToolbar'></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 excludeLists'></span></div>
<span macro='deliciousTagging'></span>
<!--}}}-->
!End
/***
|Name:|NewMeansNewPlugin|
|Description:|If 'New Tiddler' already exists then create 'New Tiddler (1)' and so on|
|Version:|1.1.1 ($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
***/
//{{{

// change this or set config.newMeansNewForJournalsToo it in MptwUuserConfigPlugin
if (config.newMeansNewForJournalsToo == undefined) config.newMeansNewForJournalsToo = true;

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.checkForUnsaved = function(newName) {
	var r = false;
	story.forEachTiddler(function(title,element) {
		if (title == newName)
			r = true;
	});
	return r;
}

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


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

	// ---- these three lines should be the only difference between this and the core onClickNewTiddler
	if (config.newMeansNewForJournalsToo || this.getAttribute("isJournal") != "true")
		title = config.macros.newTiddler.getName(title);

	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");
	if(!customFields && !store.isShadowTiddler(title))
		customFields = String.encodeHashMap(config.defaultCustomFields);
	story.displayTiddler(null,title,template,false,null,null);
	var tiddlerElem = story.getTiddler(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;
};

//}}}
<script>
  var out=[];
  var tids=store.getTiddlers('title','excludeLists');
  for (var t=0; t<tids.length; t++)
     if (tids[t].tags.length==0) out.push('[['+tids[t].title+']]');
  return out.join('\n');
</script> 
~~Requires: InlineJavascriptPlugin~~
Info: xxxx09-xxxx09 EL Break In Work
~WorkOrder: undefined
!!!Wednesday
~WD73Q Example - 1EL, 1hr

!!!Thursday

!!!Friday

!!!Saturday

!!!Sunday

!!!Monday

!!!Tuesday
!!!~TiddlyWiki Interface Options
User: <<tiddler config.options.txt with: UserName>>
Backup Folder: <<tiddler config.options.txt with: BackupFolder>>
Toggle ~TabsBar: <script label="Toggle Tabs Bar" title="Switch TiddlersBar on or off">
	if (window.version && window.version.title=='TiddlyWiki') {
		var tb=document.getElementById('tiddlersBar');
		var show=tb.style.display=='none';
		if (!show) { tb.style.display='none'; var margin='1em'; }
		else { tb.style.display='block'; var margin=config.options.txtDisplayAreaTopMargin||''; }
		document.getElementById('displayArea').style.marginTop=margin;
		config.options.chkShowTiddlersBar=show;
		saveOptionCookie('chkShowTiddlersBar');
		var sm=document.getElementById('storyMenu'); if (sm) config.refreshers.content(sm);
 	}
	return false;
</script><script>
	place.lastChild.innerHTML=('$'+'1'=='$1')?'&radic;':'$1';
	place.lastChild.style.fontWeight="normal";
</script>
<<tiddler SetPopupsHeight>>
<<option chkSaveBackups>> ~SaveBackups
<<option chkAutoSave>> ~AutoSave
<<option chkRegExpSearch>> ~RegExpSearch
<<option chkCaseSensitiveSearch>> ~CaseSensitiveSearch
<<option chkAnimate>> ~EnableAnimations
<<option chkDisableTabsBar>> ~DisableTabsBar {{tiny{<html><a href="javascript:;"onclick="window.location.reload( false );">(Reload)</a></html>}}}
----
Also see [[AdvancedOptions]]
/***
|Name|PaletteManagementPlugin|
|Description|Lets you easily change & display color palette|
|Version|1.0|
|Date|08.18.09|

!!!Combined SelectPalettePlugin & PaletteViewMacro (See Below)

***/
/***
| Name|SelectPalettePlugin|
| Description|Lets you easily change colour palette|
| Version|3.0 ($Rev: 1845 $)|
| Date|$Date: 2007-03-16 15:19:22 +1000 (Fri, 16 Mar 2007) $|
| Source|http://mptw.tiddlyspot.com/#SelectPalettePlugin|
| Author|Simon Baird <simon.baird@gmail.com>|
| License|http://mptw.tiddlyspot.com/#TheBSDLicense|

Modifications:
Removed Last line of Code MTP 11.09.08 {{{config.shadowTiddlers.OptionsPanel = "<<selectPalette>>\n\n" + config.shadowTiddlers.OptionsPanel;}}}
Does not match Source website, maintaining as a variant (Intentionally not using latest version with Theme capabilities to reduce overhead)
/***
!!Usage:
{{{<<<selectPalette>>}}}
<<selectPalette>>

!!WARNING
Will overwrite your ColorPalette tiddler.
***/

//{{{

merge(config.macros,{

	setPalette: {

		handler: function(place,macroName,params,wikifier,paramString,tiddler) {
			var paletteName = params[0] ? params[0] : tiddler.title;
			createTiddlyButton(place,"apply","Apply this palette",function(e) {
				config.macros.selectPalette.updatePalette(tiddler.title);
				return false;
			});
		}
	},

	selectPalette: {

		handler: function(place,macroName,params,wikifier,paramString,tiddler) {
			createTiddlyDropDown(place,this.onPaletteChange,this.getPalettes());
		},

		getPalettes: function() {
			var result = [
				{caption:"-palette-", name:""},
				{caption:"(Default)", name:"(default)"}
			];
			var tagged = store.getTaggedTiddlers("palette","title");
			for(var t=0; t<tagged.length; t++) {
				var caption = tagged[t].title;
				var sliceTitle = store.getTiddlerSlice(caption,"Name");
				if (sliceTitle)
					caption = sliceTitle;
				result.push({caption:sliceTitle, name:tagged[t].title});
			}
			return result;
		},

		onPaletteChange: function(e) {
			config.macros.selectPalette.updatePalette(this.value);
			return true;
		},

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

		refreshPalette: function() {
			config.macros.refreshDisplay.onClick();
//			config.macros.story.refreshTiddler();.onClick();
		}
	}
});

//}}}

/***
| ''Name''|PaletteViewMacro|
| ''Version''|0.2|
| ''Author''|FND|
| ''Source''|[[FND's DevPad|http://devpad.tiddlyspot.com/#PaletteViewMacro]]|
| ''License''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
| ''~CoreVersion''|2.1|
| ''Type''|macro|
| ''Requires''|N/A|
| ''Overrides''|N/A|
| ''Description''|Displays color palettes.|
!Notes
There is also [[ViewPalettePlugin|http://simon.tiddlyspot.com/#ViewPalettePlugin]], which currently does not work with TiddlyWiki v2.2 though.
!Usage
{{{
<<paletteView [tiddler name]>>
}}}
!!Example
<<paletteView [[ColorPalette]]>>
!Revision History
!!v0.1 (2007-11-18)
* initial release
!!v0.2 (2007-11-20)
* limited processing to slices containing [[actual color values|http://www.w3.org/TR/CSS21/syndata.html#color-units]]
* changed fallback value to the tiddler the macro is called from (instead of using [[ColorPalette]])
!To Do
* selection list for all available palettes (tag-based)
* parameter for custom table class
* customizable column order
* documentation (e.g. using from within [[ViewTemplate]])
!Code
***/
//{{{
config.macros.paletteView = {};

config.macros.paletteView.handler = function(place, macroName, params, wikifier, paramString, tiddler) {
	var title = params[0] || tiddler.title;
	//var palettes = store.getTaggedTiddlers(params[0]); // DEBUG: yet to be implemented
	var colors = store.calcAllSlices(title);
	var labels = [];
	for(var c in colors) {
		if(this.isColor(colors[c])) {
			labels.push(c);
		}
	}
	if(labels.length > 0) {
		var output = "|!Sample|!Value|!Name|h\n";
		for(var i = 0; i < labels.length; i++) {
			output += "|padding:0 4em;background-color:" + colors[labels[i]] + ";&nbsp;|"
				+ "{{{" + colors[labels[i]] + "}}}|"
				+ "[[" + labels[i] + "|" + title + "]]|\n";
		}
		wikify(output, place);
	}
};

config.macros.paletteView.isColor = function(s) {
	var colors = ["Black", "Green", "Silver", "Lime", "Gray", "Olive", "White", "Yellow",
		"Maroon", "Navy", "Red", "Blue", "Purple", "Teal", "Fuchsia", "Aqua", "Orange"];
	var match = s.match(/^#[0-9A-F]{3}$|^#[0-9A-F]{6}$|^RGB\([\d,\s]{5,}\)$/i);
	if(match) return true;
	if(colors.contains(s)) return true;
	return false;
};
refreshDisplay();

//}}}
<<tabs txtProject1
'Urgent Project1' 'Urgent Project1 Tab' Project1##Urgent
'Pending Project1' 'Pending Project1 Tab' Project1##Pending
'Completed Project1' 'Completed Project1 Tab' Project1##Completed
>>
{{button{<script label="New Task">
 var newTiddler = new Tiddler();
 newTiddler.title = prompt('Enter a new task title','New Project Task');
 newTiddler.tags[0] = "Project1";
 newTiddler.tags[1] = "Task";
 newTiddler.tags[2] = "excludeLists";
 newTiddler.modifier = config.options.txtUserName;
 if(config.macros.reminders){
 newTiddler.text = "Task:\nReminder: <<newReminder>>\n!!!Items\n#\n#\n!!!Notes\n\n!!!Due";
 } else {newTiddler.text = "Task:\n!!!Items\n#\n#\n!!!Notes\n\n!!!Due";}
 store.addTiddler(newTiddler);
 story.displayTiddler(null,newTiddler.title,DEFAULT_EDIT_TEMPLATE);
 story.focusTiddler(newTiddler.title,"title");
</script>}}} <<deleteAllTagged "Delete this Project" delete>>
@@display:none;"
!!!Urgent
~~Urgent Items~~
<script>
//	var tag=store.getMatchingTiddlers("Project1 && Urgent && ! Completed && ! Trash","+title");
	var tag=store.getMatchingTiddlers("Project1 && Urgent && ! Completed && ! Trash","modified").reverse();
	var hdr="|sortable|k\n| !Title | !Task | !Reminders | !Urgent? | !Complete? |h";
	var fmt="| [[%0|%0]] | %1 | ~~<<tiddler [[%0##Due]]>>~~ | [X(%0:Urgent)] | [X(%0:Completed)] |";
	var out=[hdr];
		if (!tag.length) out=["No Tiddlers found"];
	for (var i=0; i<tag.length; i++)
		out.push(fmt.format([tag[i].title,store.getTiddlerSlice(tag[i].title, "Task") ]));
	return out.join('\n');
</script>
!!!Pending
~~Pending Items~~
<script>
//	var tag=store.getMatchingTiddlers("Project1 && ! Urgent && ! Completed && ! Trash","+title");
	var tag=store.getMatchingTiddlers("Project1 && ! Urgent && ! Completed && ! Trash","modified").reverse();
	var hdr="|sortable|k\n| !Title | !Task | !Reminders | !Urgent? | !Complete? |h";
	var fmt="| [[%0|%0]] | %1 | ~~<<tiddler [[%0##Due]]>>~~ | [X(%0:Urgent)] | [X(%0:Completed)] |";
	var out=[hdr];
		if (!tag.length) out=["No Tiddlers found"];
	for (var i=0; i<tag.length; i++)
		out.push(fmt.format([tag[i].title,store.getTiddlerSlice(tag[i].title, "Task") ]));
	return out.join('\n');
</script>
!!!Completed
~~Completed Items~~
<script>
//	var tag=store.getMatchingTiddlers("Project1 && Completed && ! Trash","+title");
	var tag=store.getMatchingTiddlers("Project1 && Completed && ! Trash","modified").reverse();
	var hdr="|sortable|k\n| !Title | !Task | !Urgent? | !Complete? |h";
	var fmt="| [[%0|%0]] | %1 | [X(%0:Urgent)] | [X(%0:Completed)] |";
	var out=[hdr];
		if (!tag.length) out=["No Tiddlers found"];
	for (var i=0; i<tag.length; i++)
		out.push(fmt.format([tag[i].title,store.getTiddlerSlice(tag[i].title, "Task") ]));
	return out.join('\n');
</script>
@@
<<tiddler TaskTabs>>
Vendor: 
Amount: $
Description: 
Date: 
!!!Items

!!!Notes

<<newReminder>>
This package provides a toolbar of interactive 'power tools' that you can use while editing a tiddler to quickly insert TiddlyWiki tiddler links, images, macros, etc. or common formatting sequences directly into tiddler content, as well as perform other functions (such as find/replace, sort, split, convert, etc.) that can be used to modify the current tiddler's source content in a variety of ways.

<<tiddler QuickEditToolbar with: show>>
!!!!!Installation:
<<<
Individual ~QuickEdit buttons are defined in separate tiddlers (e.g., [[QuickEdit_replace]]) that have also been //transcluded// into a single toolbar definition named [[QuickEditToolbar]].  You can edit this definition to add, remove, or rearrange the toolbar buttons to best suit your needs, and then embed the [[QuickEditToolbar]] tiddler into your document's [[EditTemplate]], like this:
{{{
<div macro='tiddler QuickEditToolbar'></div>
}}}
Next, in order to support some of the formatting 'shortcuts' provided by the toolbar, add a reference to the shortcuts CSS class definitions in your [[StyleSheet]]:
{{{
[[StyleSheetShortcuts]]
}}}
By default, the QuickEdit toolbar is hidden until you enable it by using the ''toggleQuickEdit'' command, which you can add to the ~EditToolbar definition in [[ToolbarCommands]]:
{{{
|EditToolbar|... toggleQuickEdit ...|
}}}
You can also toggle the ~QuickEdit toolbar display via a single checkbox option that can be added to [[SideBarOptions]] (or any other desired location):
{{{
<<option chkShowQuickEdit>> show QuickEdit toolbar
}}}
Note: You can 'hard-code' the ''chkShowQuickEdit'' setting, so that the toolbar will be //initially// displayed, by creating a tiddler (e.g., ConfigTweaks), tagged with <<tag systemConfig>>, containing:
{{{
config.options.chkShowQuickEdit=true;
}}}
Alternatively, if you want the toolbar to //always// be displayed, regardless of the option setting, you can add a special keyword, ''show'', to the [[EditTemplate]] syntax, like this:
{{{
<div macro='tiddler QuickEditToolbar with: show'></div>
}}}
<<<
/***
|Name|QuickEditPlugin|
|Source|http://www.TiddlyTools.com/#QuickEditPlugin|
|Documentation|http://www.TiddlyTools.com/#QuickEditPlugin|
|Version|2.4.3|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Support functions for ~QuickEdit package: styles, utility functions, and 'toggleQuickEdit' command|
!!!!!Revisions
<<<
2009.06.11 [2.4.3] added keyup() function to abbreviate listbox handling for CR and ESC
2009.05.07 [2.4.2] added processed() function to abbreviate event handler code
2008.09.07 [2.4.1] added removeCookie() function for compatibility with [[CookieManagerPlugin]]
2008.05.17 [2.4.0] copied code from StickyPopupPlugin to remove dependency
2008.05.12 [2.3.0] added "toggleQuickEdit" command handler (replaces inline script command)
2008.01.11 [2.2.0] converted from inline script
2007.03.29 [1.0.0] initial release (as inline script)
<<<
!!!!!Code
***/
//{{{
version.extensions.QuickEditPlugin= {major: 2, minor: 4, revision: 3, date: new Date(2009,6,11)};

// SET STYLESHEET
setStylesheet("\
.quickEdit a { border:2px outset ButtonFace; padding:0px 3px !important; \
	-moz-border-radius:.5em; -webkit-border-radius:.5em; \
	-moz-appearance:button !important; -webkit-appearance:push-button !important; \
	background-color:ButtonFace; color:ButtonText !important;  \
	line-height:200%; font-weight:normal; } \
.quickEdit a:hover { border: 2px inset ButtonFace; background-color:ButtonFace; }\
", "quickEditStyles");

// REMOVE COOKIE
if (window.removeCookie===undefined) {
	window.removeCookie=function(name) {
		document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;'; 
	}
}

// UTILITY FUNCTIONS
config.quickEdit = {
	processed: function(ev) { ev=ev||window.event;
		ev.cancelBubble=true;
		if(ev.stopPropagation) ev.stopPropagation();
		return false;
	},
	keyup: function(ev){ var k=(ev||window.event).keyCode;
		if (k==13) this.onclick();
		if (k==27) Popup.remove();
	},
	getField: function(where) {
		var here=story.findContainingTiddler(where); if (!here) return null;
		var e=story.getTiddlerField(here.getAttribute("tiddler"),"text");
		if (e&&e.getAttribute("edit")=="text") return e;
		return null;
	},
	setSelection: function(where,newtext) {
		var e=this.getField(where); if (!e) return false;
		e.focus(); replaceSelection(e,newtext);
		return false;
	},
	wrapSelection: function(where,before,after) {
		var e=this.getField(where); if (!e) return false;
		e.focus(); replaceSelection(e,before+config.quickEdit.getSelection(e)+after);
		return false;
	},
	getSelection: function(e) {
		var seltext="";
		if (e&&e.setSelectionRange)
			seltext=e.value.substr(e.selectionStart,e.selectionEnd-e.selectionStart);
		else if (document.selection) {
			var range = document.selection.createRange();
			if (range.parentElement()==e) seltext=range.text
		}
		return seltext;
	},
	promptForFilename: function(msg,path,file) {
		if(window.Components) { // moz
			try {
				netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
				var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
				var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
				picker.init(window, msg, nsIFilePicker.modeOpen);
				var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
				thispath.initWithPath(path);
				picker.displayDirectory=thispath;
				picker.defaultExtension='jpg';
				picker.defaultString=file;
				picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterImages);
				if (picker.show()!=nsIFilePicker.returnCancel)
					var result="file:///"+picker.file.persistentDescriptor.replace(/\\/g,'/');
			}
			catch(e) { alert('error during local file access: '+e.toString()) }
		}
		else { // IE
			try { // XP only
				var s = new ActiveXObject('UserAccounts.CommonDialog');
				s.Filter='All files|*.*|JPG files|*.jpg|GIF files|*.gif|PNG files|*.png|';
				s.FilterIndex=1; // default to JPG
				s.InitialDir=path;
				s.FileName=file;
				if (s.showOpen()) var result=s.FileName;
			}
			catch(e) { var result=prompt(msg,path+file); } // fallback for non-XP IE
		}
		return result;
	}
}
//}}}

//{{{
if (config.options.chkShowQuickEdit===undefined) config.options.chkShowQuickEdit=false;
config.commands.toggleQuickEdit = {
	hideReadOnly: true,
	getText: function() { return config.options.chkShowQuickEdit?'\u221Aquickedit':'quickedit'; },

	tooltip: 'show QuickEdit toolbar buttons',
	handler: function(event,src,title) {
		config.options.chkShowQuickEdit=!config.options.chkShowQuickEdit;
		config.macros.option.propagateOption("chkShowQuickEdit","checked", config.options.chkShowQuickEdit,"input");
		if (config.options.chkShowQuickEdit) saveOptionCookie("chkShowQuickEdit");
		else removeCookie("chkShowQuickEdit");
		src.innerHTML=config.commands.toggleQuickEdit.getText();
		story.forEachTiddler(function(t,e){if (story.isDirty(t)) refreshElements(e);});
		return false;
	}
};
//}}}

// // COPIED FROM [[StickyPopupPlugin]] TO ELIMINATE PLUGIN DEPENDENCY
//{{{
if (config.options.chkStickyPopups==undefined) config.options.chkStickyPopups=false;
Popup.stickyPopup_onDocumentClick = function(ev)
{
	// if click is in a sticky popup, ignore it so popup will remain visible
	var e = ev ? ev : window.event; var target = resolveTarget(e);
	var p=target; while (p) {
		if (hasClass(p,"popup") && (hasClass(p,"sticky")||config.options.chkStickyPopups)) break;
		else p=p.parentNode;
	}
	if (!p) // not in sticky popup (or sticky popups disabled)... use normal click handling
		Popup.onDocumentClick(ev);
	return true;
};
try{removeEvent(document,"click",Popup.onDocumentClick);}catch(e){};
try{addEvent(document,"click",Popup.stickyPopup_onDocumentClick);}catch(e){};
//}}}
/%
|Name|QuickEditToolbar|
|Source|http://www.TiddlyTools.com/#QuickEditToolbar|
|Version|2.4.3|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.2|
|Type|transclusion|
|Requires|QuickEditPlugin|
|Optional|QuickEdit_*|
|Description|format/insert TiddlyWiki content using toolbar buttons|

Usage:
* install [[QuickEditPlugin]] (runtime support functions)

* add the toolbar to [[EditTemplate]]:
	<div macro='tiddler QuickEditToolbar with: show'></div>

* 'show' (optional) forces the toolbar to always be displayed or,
  omit keyword and use <<option chkShowQuickEdit>> setting

* selected QuickEdit buttons can also be added individually to the
  regular tiddler toolbar by adding references directly in [[EditTemplate]]:
	<span class='toolbar' macro='tiddler QuickEdit_...'></span>

* see [[QuickEditPackage]] for additional installation options

%/<<tiddler HideTiddlerTags>>/%
%/{{hidden fine center quickEdit{
<<tiddler {{ // show/hide toolbar
	var here=story.findContainingTiddler(place); if (here) var tid=here.getAttribute('tiddler');
	var show='$1'!='$'+'1'||config.options.chkShowQuickEdit||tid=='QuickEditToolbar'; 
	place.style.display=show?'block':'none';
'';}}>>/%

TOOLBAR DEFINITION - add, remove, or re-order items as desired:
= = = = = = = = = =
%/<<tiddler QuickEdit_replace>>/%
%/<<tiddler QuickEdit_split>>/%
%/<<tiddler QuickEdit_sort>>/%
%/<<tiddler QuickEdit_convert>>/%
%/ &nbsp;/% (SPACER)
%/<<tiddler QuickEdit_link>>/%
%/<<tiddler QuickEdit_insert>>/%
%/<<tiddler QuickEdit_macro>>/%
%/<<tiddler QuickEdit_image>>/%
%/ &nbsp;/% (SPACER)
%/<<tiddler QuickEdit_format>>/%
%/<<tiddler QuickEdit_align>>/%
%/<<tiddler QuickEdit_color>>/%
%/<<tiddler QuickEdit_font>>/%
%/ &nbsp;/% (SPACER)
%/<<tiddler QuickEdit_custom>>/%
%/}}}
/%
|Name|QuickEdit_align|
|Source|http://www.TiddlyTools.com/#QuickEdit_align|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - text alignment|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="align text"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('select text alignment...','');
	s.options[s.length]=new Option('left','left');
	s.options[s.length-1].title='{{left{...}}}';
	s.options[s.length]=new Option('center','center');
	s.options[s.length-1].title='{{center{...}}}';
	s.options[s.length]=new Option('right','right');
	s.options[s.length-1].title='{{right{...}}}';
	s.options[s.length]=new Option('justify','justify');
	s.options[s.length-1].title='{{justify{...}}}';
	s.options[s.length]=new Option('float left','floatleft');
	s.options[s.length-1].title='{{floatleft{...}}}';
	s.options[s.length]=new Option('float right','floatright');
	s.options[s.length-1].title='{{floatright{...}}}';
	s.size=s.length;
	s.onclick=function(){ if (!this.value.length) return;
		config.quickEdit.wrapSelection(this.button,'{{'+this.value+'{','}}}');
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>align</a></html>
/%
|Name|QuickEdit_color|
|Source|http://www.TiddlyTools.com/#QuickEdit_color|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - text/background color|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="text/background color - @@color:#RGB;background-color:#RGB;...@@"
onclick="var p=Popup.create(this,null,'popup sticky smallform'); if (!p) return false;
 	p.style.padding='2px';
	function hex(d) { return '0123456789ABCDEF'.substr(d,1); }
	var fg=createTiddlyElement(p,'select'); fg.button=this;
	fg.style.width='12em';
	fg.options[0]=new Option('text color...','');
	fg.options[1]=new Option('\xa0 or enter a value','_ask');
	fg.options[2]=new Option('\xa0 or use default color','');
	for (var r=0;r<16;r+=3) for (var g=0;g<16;g+=3) for (var b=0;b<16;b+=3) {
		var label=hex(r)+hex(g)+hex(b);
		fg.options[fg.length]=new Option(label,'#'+label);
		fg.options[fg.length-1].style.color='#'+label;
	}
	fg.onchange=function(){ var val=this.value;
		if (val=='_ask') { val=prompt('Enter a CSS color value');
		if (!val||!val.length) return false; }
		this.options[0].value=val; this.options[0].text=val.length?'text: '+val:'text color...';
		var bg=this.nextSibling;
		for (var i=3;i<bg.options.length;i++) bg.options[i].style.color=val;
		var preview=this.nextSibling.nextSibling.nextSibling;
		var t=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
		t=t.replace(/^@@(color\:.+;)?(background-color\:.+;)?/,'').replace(/@@$/,'');
		if (!t.length) t='~AaBbCcDdEeFfGgHhIiJj 1234567890';
		var fg=this.value; if (fg.length) fg='color:'+fg+';';
		var bg=this.nextSibling.value; if (bg.length) bg='background-color:'+bg+';';
		if (fg.length||bg.length) t='@@'+fg+bg+t+'@@';
		removeChildren(preview); wikify(t,preview);
		this.selectedIndex=0; return false;
	};
	var bg=createTiddlyElement(p,'select'); bg.button=this;
	bg.style.width='12em';
	bg.options[0]=new Option('background color...','');
	bg.options[1]=new Option('\xa0 or enter a value','_ask');
	bg.options[2]=new Option('\xa0 or use default color','');
	for (var r=0;r<16;r+=3) for (var g=0;g<16;g+=3) for (var b=0;b<16;b+=3) {
		var label=hex(15-r)+hex(15-g)+hex(15-b);
		bg.options[bg.length]=new Option(label,'#'+label);
		bg.options[bg.length-1].style.backgroundColor='#'+label;
	}
	bg.onchange=function(){ var val=this.value;
		if (val=='_ask') { val=prompt('Enter a CSS color value');
		if (!val||!val.length) return false; }
		this.options[0].value=val;
		this.options[0].text=val.length?'background: '+val:'background color...';
		var fg=this.previousSibling;
		for (var i=3;i<fg.options.length;i++) fg.options[i].style.backgroundColor=val;
		var preview=this.nextSibling.nextSibling;
		var t=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
		t=t.replace(/^@@(color\:.+;)?(background-color\:.+;)?/,'').replace(/@@$/,'');
		if (!t.length) t='~AaBbCcDdEeFfGgHhIiJj 1234567890';
		var fg=this.previousSibling.value; if (fg.length) fg='color:'+fg+';';
		var bg=this.value; if (bg.length) bg='background-color:'+bg+';';
		if (fg.length||bg.length) t='@@'+fg+bg+t+'@@';
		removeChildren(preview); wikify(t,preview);
		this.selectedIndex=0; return false;
	};
	var b=createTiddlyElement(p,'input',null,null,null,{type:'button'}); b.button=this;
	b.value='ok'; b.style.width='4em';
	b.onclick=function() {
		var fg=this.previousSibling.previousSibling.value; if (fg.length) fg='color:'+fg+';';
		var bg=this.previousSibling.value; if (bg.length) bg='background-color:'+bg+';';
		var t=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
		t=t.replace(/^@@(color\:.+;)?(background-color\:.+;)?/,'').replace(/@@$/,'');
		if (fg.length||bg.length) config.quickEdit.setSelection(this.button,'@@'+fg+bg+t+'@@');
		Popup.remove(); return false;
	};
	var preview=createTiddlyElement(p,'div',null,'viewer'); var s=preview.style;
	s.border='1px solid'; s.margin='2px'; s.width='24em'; s.padding='3px'; s.MozBorderRadius='3px';
	s.overflow='hidden'; s.textAlign='center'; s.whiteSpace='normal';
	var t=config.quickEdit.getSelection(config.quickEdit.getField(this));
	wikify(t.length?t:'~AaBbCcDdEeFfGgHhIiJj 1234567890',preview);
	Popup.show();
	event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>color</a></html>
/%
|Name|QuickEdit_convert|
|Source|http://www.TiddlyTools.com/#QuickEdit_convert|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - convert between comma/tab-separated and TW table format|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="convert between comma/tab-separated and TW table format"
onclick="var e=config.quickEdit.getField(this);
	if (e) e.focus(); var txt=config.quickEdit.getSelection(e);
	if (txt.indexOf(',')+txt.indexOf('\t')+txt.indexOf('|')==-3) {
		alert('Please select text containing tabs, commas, or TiddlyWiki table syntax.');
		return false;
	}
	var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('select a converter...','');
	if (txt.indexOf(',')!=-1) {
		s.options[s.length]=new Option('commas -> table','commasToTable');
		s.options[s.length]=new Option('commas -> tabs','commasToTabs');
	}
	if (txt.indexOf('\t')!=-1) {
		s.options[s.length]=new Option('tabs -> table','tabsToTable');
		s.options[s.length]=new Option('tabs -> commas','tabsToCommas');
	}
	if (txt.indexOf('|')!=-1) {
		s.options[s.length]=new Option('table -> tabs','tableToTabs');
		s.options[s.length]=new Option('table -> commas','tableToCommas');
	}
	s.size=s.length;
	s.onclick=function(){ if (!this.value.length) return;
	        var e=config.quickEdit.getField(this.button); if (!e) return false;
		e.focus(); var txt=config.quickEdit.getSelection(e);
		switch(this.value) {
			case 'tabsToTable':
				txt=txt.replace(/\t/g,'|').replace(/^|$/g,'|');
				txt=txt.replace(/\n/g,'|\n|').replace(/^\|$/g,'');
				break;
			case 'tableToTabs':
				txt=txt.replace(/\t/g,' ').replace(/\|/g,'\t');
				txt=txt.replace(/^\t/g,'').replace(/\t$/g,'');
				txt=txt.replace(/\n\t/g,'\n').replace(/\t\n/g,'\n');
				break;
			case 'commasToTable':
				txt=txt.replace(/,/g,'|').replace(/^|$/g,'|');
				txt=txt.replace(/\n/g,'|\n|').replace(/^\|$/g,''); 
				break;
			case 'tableToCommas':
				txt=txt.replace(/,/g,' ').replace(/\|/g,',');
				txt=txt.replace(/^,/g,'').replace(/,$/g,''); 
				txt=txt.replace(/\n,/g,'\n').replace(/,\n/g,'\n'); 
				break;
			case 'tabsToCommas':
				txt=txt.replace(/\t/g,',');
				break;
			case 'commasToTabs':
				txt=txt.replace(/,/g,'\t');
				break;
		}
		replaceSelection(e,txt);
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>convert</a></html>
/%
|Name|QuickEdit_custom|
|Source|http://www.TiddlyTools.com/#QuickEdit_custom|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - custom defined formats|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

!help
Reminders:

Custom formats are stored as an "HR-separated list" in [[QuickEdit_customList]], where the first line of each list item is the text 'label' to show in the droplist, followed by one or more lines of wiki content to be inserted into the tiddler source.

Substitution markers can be used to dynamically insert values into the formatted output: $1 inserts the tiddler editor's current selected text. $[[message|default value]] interactively prompts for a value to be inserted. $[[message|$1]] uses the selected text as the default value. $[[message|{{javascript}}]] calculates the default value using javascript code.
!end help

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" title="custom defined formats"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('select a custom format...','');
	var items=store.getTiddlerText('QuickEdit_customList','').split('\n----\n');
	for (var i=0; i<items.length; i++) {
		if (!items[i].length) continue; var lines=items[i].split('\n');
		var label=lines.shift(); var val=lines.join('\n');
		s.options[s.length]=new Option(label,val); s.options[s.length-1].title=val;
	}
	s.options[s.length]=new Option('[Edit custom formats...]','_edit');
	s.options[s.length-1].title='add/change custom format definitions...';
	s.size=Math.min(s.length,15);
	s.onclick=function(){ if (!this.value.length) return;
		if (this.value=='_edit') {
			alert(store.getTiddlerText('QuickEdit_custom##help'));
			story.displayTiddler(story.findContainingTiddler(this.button),
				'QuickEdit_customList',DEFAULT_EDIT_TEMPLATE);
		} else {
		        var e=config.quickEdit.getField(this.button); if (!e) return false;
			e.focus(); var txt=config.quickEdit.getSelection(e);
			replaceSelection(e, this.value.replace(/\$\x31/g,txt)
				.replace(/\$\[\[[^\]]+\]\]/g, function(t){
					x=t.substr(3,t.length-5).split('|');
					var msg=x[0]; var def=x[1]||'';
					if (def.startsWith('{{')) {
						try{def=eval(def.substr(2,def.length-4))} catch(ex){showException(ex)}
					}
					return prompt(msg,def)||'';
				})
			);
		}
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>custom</a></html>
timestamp
$[[enter a date|{{new Date().formatString('DDD, MMM DDth, YYYY hh12:0mm:0ssam')}}]]
----
scrollbox
@@display:block;height:10em;overflow:auto;$[[enter scrolling content|$1]]@@@@display:block;text-align:right;^^scroll for more...^^@@
----
nested slider
+++[$1]<<tiddler $1>>===
----
big red
@@font-size:36pt;color:red;$1@@
----
/%
|Name|QuickEdit_font|
|Source|http://www.TiddlyTools.com/#QuickEdit_font|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - select font family|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="set font-family CSS attribute - @@font-family:facename;...@@"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('select a font family...','');
	var fonts=store.getTiddlerText('QuickEdit_fontList','').split('\n');
	for (var i=0; i<fonts.length; i++) {
		if (!fonts[i].length) continue;
		s.options[s.length]=new Option(fonts[i],fonts[i]);
		s.options[s.length-1].style.fontFamily=fonts[i];
	}
	s.options[s.length]=new Option('[Edit font list...]','_edit');
	s.options[s.length-1].title='enter fonts, one per line...';
	s.size=Math.min(s.length,15);
	s.onclick=function(){
		if (this.value=='_edit')
			story.displayTiddler(story.findContainingTiddler(this.button),'QuickEdit_fontList',DEFAULT_EDIT_TEMPLATE);			
		else
			config.quickEdit.wrapSelection(this.button,'@@font-family:\x22'+this.value+'\x22;','@@');
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>font</a></html>
Arial,helvetica,sans-serif
Times New Roman,times,serif
Courier,monospaced
/%
|Name|QuickEdit_format|
|Source|http://www.TiddlyTools.com/#QuickEdit_format|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - basic text formats, headings, blockquotes, etc.|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="plain text (remove ALL formatting)" accesskey="P" 
onclick="var e=config.quickEdit.getField(this); if (e) e.focus(); var txt=config.quickEdit.getSelection(e);
	config.quickEdit.setSelection(e,wikifyPlainText(txt)); return false;"
>&nbsp;~&nbsp;</a></html>/%

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="''bold''" accesskey="B"
onclick="config.quickEdit.wrapSelection(this,'\x27\x27','\x27\x27'); return false;"
>&nbsp;B&nbsp;</a></html>/%

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="//italics//" accesskey="I" 
onclick="config.quickEdit.wrapSelection(this,'//','//'); return false;"
>&nbsp;I&nbsp;</a></html>/%

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="__underline__" accesskey="U" 
onclick="config.quickEdit.wrapSelection(this,'__','__'); return false;"
>&nbsp;U&nbsp;</a></html>/%

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="--strikethrough--" accesskey="S" 
onclick="config.quickEdit.wrapSelection(this,'--','--'); return false;"
>&nbsp;S&nbsp;</a></html>/%

%/ &nbsp;/%  SPACER

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="format text"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('select text format...','');
	s.options[s.length]=new Option('CSS class wrapper','{{$1{,}}},Enter a CSS classname');
	s.options[s.length-1].title='CSS class wrapper - {{classname classname etc{...}}}';
	s.options[s.length]=new Option('inline CSS styles','@@$1,@@,Enter CSS (attribute:value;attribute:value;...;)');
	s.options[s.length-1].title='inline CSS styles - @@attr:value;attr:value;...@@';
	s.options[s.length]=new Option('heading 1','\n!,\n');
	s.options[s.length-1].title='H1 heading - !';
	s.options[s.length]=new Option('heading 2','\n!!,\n');
	s.options[s.length-1].title='H2 heading - !!';
	s.options[s.length]=new Option('heading 3','\n!!!,\n');
	s.options[s.length-1].title='H3 heading - !!!';
	s.options[s.length]=new Option('heading 4','\n!!!!,\n');
	s.options[s.length-1].title='H4 heading - !!!!';
	s.options[s.length]=new Option('heading 5','\n!!!!!,\n');
	s.options[s.length-1].title='H5 heading - !!!!!';
	s.options[s.length]=new Option('blockquote','\n\<\<\<\n,\n\<\<\<\n');
	s.options[s.length-1].title='indented blockquote - \<\<\<';
	s.options[s.length]=new Option('monospaced','{{{,}}}');
	s.options[s.length-1].title='inline monospaced text - {{{...}}}';
	s.options[s.length]=new Option('plain text','\n{{{\n,\n}}}\n');
	s.options[s.length-1].title='multi-line monospaced text box - {{{...}}}';
	s.options[s.length]=new Option('superscript','^^,^^');
	s.options[s.length-1].title='^^superscript^^';
	s.options[s.length]=new Option('subscript','~~,~~');
	s.options[s.length-1].title='~~subscript~~';
	s.options[s.length]=new Option('HTML','<html>,<\x2fhtml>');
	s.options[s.length-1].title='HTML syntax - <html>...<\x2fhtml>';
	s.options[s.length]=new Option('comment','/%,%/');
	s.options[s.length-1].title='comment (hidden content) - /%...%/';
	s.size=s.length;
	s.onclick=function(){ if (!this.value.length) return;
		var parts=this.value.split(',');
		var prefix=parts[0]; var suffix=parts[1]; var ask=parts[2];
		if (ask) {
			var val=prompt(ask); if (!val) { Popup.remove(); return false; }
			prefix=prefix.replace(/\$1/g,val); suffix=suffix.replace(/\$1/g,val);
		}
		config.quickEdit.wrapSelection(this.button,prefix,suffix);
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>format</a></html>
/%
|Name|QuickEdit_image|
|Source|http://www.TiddlyTools.com/#QuickEdit_image|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - embed an image|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
	title="embed an image (jpg/gif/png) - [img[tooltip|URL]] or [img[tooltip|path/to/file.ext]]"
	onclick="var fn=config.quickEdit.promptForFilename('Enter/select an image file',getLocalPath(document.location.href),'');
	if (!fn) return false;  /* cancelled by user */
	var tip=prompt('Enter a tooltip for this image',''); if (!tip) tip=''; else tip+='|';
	return config.quickEdit.setSelection(this,'[img['+tip+fn+']]');"
>image</a></html>
/%
|Name|QuickEdit_insert|
|Source|http://www.TiddlyTools.com/#QuickEdit_insert|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - insert content from another tiddler or external file|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="insert content from another tiddler or external file"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';

	var s2=createTiddlyElement(p,'select'); s2.title='filter by tag';
	s2.options[0]=new Option('filter by tag...','');
	s2.options[s2.length]=new Option('[all tiddlers]','');
	var tags=store.getTags();
	for (var t=0; t<tags.length; t++) s2.options[s2.length]=new Option(tags[t][0],tags[t][0]);
	s2.onchange=function(){
		var tag=this.value;
		var tids=tag.length?store.reverseLookup('tags',tag,true):store.reverseLookup('tags','excludeLists');
		var list=this.nextSibling.nextSibling;
		while (list.length) list.options[0]=null;
		var prompt='select a tiddler or file...';
		if (tag.length) prompt='select a tagged tiddler ['+tids.length+' matches]...';
		list.options[0]=new Option(prompt,'');
		if (!tag.length) list.options[list.length]=new Option('[browse for file...]','_file');
		for (var t=0; t<tids.length; t++) {
			list.options[list.length]=new Option(tids[t].title,tids[t].title);
			list.options[list.length-1].title=tids[t].getSubtitle();
		}
		list.size=Math.min(list.length,10);
		list.selectedIndex=0; list.focus();
		this.style.width=list.offsetWidth+'px';
		if (!tag.length) this.selectedIndex=0;
	};
	createTiddlyElement(p,'br');

	var s=createTiddlyElement(p,'select'); s.button=this;
	s.title='select a tiddler or file';
	s.options[0]=new Option('select a tiddler or file...','');
	s.options[s.length]=new Option('[browse for file...]','_file');
	var tids=store.reverseLookup('tags','excludeLists');
	for (var t=0; t<tids.length; t++) {
		s.options[s.length]=new Option(tids[t].title,tids[t].title);
		s.options[s.length-1].title=tids[t].getSubtitle();
	}
	s.size=Math.min(s.length,10);
	s.onclick=function(){ if (!this.value.length) return false;
		if (this.value=='_file') {
			var fn=config.quickEdit.promptForFilename(
				'Enter/select a text file',getLocalPath(document.location.href),'');
			if (!fn) return false; /* cancelled by user */
			var txt=loadFile(getLocalPath(fn));
			if (!txt) { alert('Error: unable to read contents from \0027'+fn+'\0027'); return; }
		}
		else var txt=store.getTiddlerText(this.value);
		if (!txt) {
			displayMessage(this.value+' not found');
			this.selectedIndex=0; this.focus();
			return false;
		}
		config.quickEdit.setSelection(this.button,txt);
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s2.style.width=s.offsetWidth+'px';
	s.focus();
	return config.quickEdit.processed(event);"
>insert</a></html>
/%
|Name|QuickEdit_link|
|Source|http://www.TiddlyTools.com/#QuickEdit_link|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - link to tiddler or external file|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="add a link to a tiddler or external file - [[link text|TiddlerName]]"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';

	var s2=createTiddlyElement(p,'select'); s2.title='filter by tag';
	s2.options[0]=new Option('filter by tag...','');
	s2.options[s2.length]=new Option('[all tiddlers]','');
	var tags=store.getTags();
	for (var t=0; t<tags.length; t++) s2.options[s2.length]=new Option(tags[t][0],tags[t][0]);
	s2.onchange=function(){
		var tag=this.value;
		var tids=tag.length?store.reverseLookup('tags',tag,true):store.reverseLookup('tags','excludeLists');
		var list=this.nextSibling.nextSibling;
		while (list.length) list.options[0]=null;
		var prompt='select a tiddler or file...';
		if (tag.length) prompt='select a tagged tiddler ['+tids.length+' matches]...';
		list.options[0]=new Option(prompt,'');
		if (!tag.length) list.options[list.length]=new Option('[browse for file...]','_file');
		for (var t=0; t<tids.length; t++) {
			list.options[list.length]=new Option(tids[t].title,tids[t].title);
			list.options[list.length-1].title=tids[t].getSubtitle();
		}
		list.size=Math.min(list.length,10);
		list.selectedIndex=0; list.focus();
		this.style.width=list.offsetWidth+'px';
		if (!tag.length) this.selectedIndex=0;
	};
	createTiddlyElement(p,'br');

	var s=createTiddlyElement(p,'select'); s.button=this;
	s.title='select a tiddler or file';
	s.options[0]=new Option('select a tiddler or file...','');
	s.options[s.length]=new Option('[browse for file...]','_file');
	var tids=store.reverseLookup('tags','excludeLists');
	for (var t=0; t<tids.length; t++) {
		s.options[s.length]=new Option(tids[t].title,tids[t].title);
		s.options[s.length-1].title=tids[t].getSubtitle();
	}
	s.size=Math.min(s.length,10);
	s.onclick=function(){ if (!this.value.length) return false;
		var title=this.value; var txt=title;
		if (title=='_file') {
			title=config.quickEdit.promptForFilename('Select a file',
				getLocalPath(document.location.href),'');
			if (!title) { this.selectedIndex=0; this.focus(); return false; }
			var txt=title.substr(title.lastIndexOf('/')+1);
		}
		var txt=prompt('Enter the text to display for this link',txt);
		if (!txt) { this.selectedIndex=0; this.focus(); return false; }
		config.quickEdit.setSelection(this.button,'[['+txt+'|'+title+']]');
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s2.style.width=s.offsetWidth+'px';
	s.focus();
	return config.quickEdit.processed(event);"
>link</a></html>
/%
|Name|QuickEdit_macro|
|Source|http://www.TiddlyTools.com/#QuickEdit_macro|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - embed a macro with 'guide text'|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

Note:
Optional 'guideText' can be used to add suggested defaults/placeholders for specific macro parameters.
Add guideText to your own plugin-defined macros using:
	config.macros.macroName.guideText='guide text goes here';

%/<<tiddler {{
	/* define guide text for a few common TW core macros */
	config.macros.edit.guideText='fieldname #rows';
	config.macros.view.guideText='fieldname (link,wikified,date) format';
	config.macros.slider.guideText='cookie TiddlerName label tooltip';
	config.macros.option.guideText='(txtCookieName,chkCookieName)';
	config.macros.tiddler.guideText='TiddlerName with: params...';
	''; /* must return blank to suppress output */ }}>>/%

%/<html><hide linebreaks><a href='javascript:;' class='tiddlyLink' tabindex='-1' 
title='add a macro - \<\<macroName ...\>\>'
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('select a macro...','');
	var macros=[]; for (var m in config.macros) if (config.macros[m].handler) macros.push(m); macros.sort();
	for (var i=0; i<macros.length; i++) { var m=macros[i];
		var help=config.macros[m].guideText; if (!help) help=''; else help=' '+help;
		s.options[s.length]=new Option(m,m+help);
		s.options[s.length-1].title='\<\<'+m+help+'\>\>';
	}
	s.size=Math.min(s.length,15);
	s.onclick=function(){ if (!this.value.length) return;
		config.quickEdit.setSelection(this.button,'\<\<'+this.value+'\>\>');
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>macro</a></html>
/%
|Name|QuickEdit_replace|
|Source|http://www.TiddlyTools.com/#QuickEdit_replace|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - find/replace selected text with replacement text|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="find/replace selected text with replacement text"
onclick="var here=story.findContainingTiddler(this); if (!here) return false;
	var e=config.quickEdit.getField(here);
	var s=config.quickEdit.getSelection(e); 
	var p=Popup.create(this,null,'popup sticky smallform'); if (!p) return false;
	var t=createTiddlyElement(p,'input'); t.onfocus=function(){this.select()};
	t.value=s.length?s:'enter target text';
	var r=createTiddlyElement(p,'input'); r.onfocus=function(){this.select()};
	r.value='enter replacement text';
	var tid=here.getAttribute('tiddler');
	var b=createTiddlyElement(p,'button',null,null,'?',{tid:tid});
	b.style.width='2em';
	b.title='FIND/FIND NEXT target text';
	b.onclick=function(ev) { /* FIND */
		var e=story.getTiddlerField(this.getAttribute('tid'),'text');
		if (!e||e.getAttribute('edit')!='text') return;
		var t=this.previousSibling.previousSibling;
		e.focus();
		if (e.setSelectionRange) { /* MOZ */
			var newstart=e.value.indexOf(t.value,e.selectionStart+1);
			if (newstart==-1) newstart=e.value.indexOf(t.value); /* wrap around */
			if (newstart==-1) { alert('\u0022'+t.value+'\u0022 not found'); t.focus(); return; }
			e.setSelectionRange(newstart,newstart+t.value.length);
			var linecount=e.value.split('\n').length;
			var thisline=e.value.substr(0,e.selectionStart).split('\n').length;
			e.scrollTop=Math.floor((thisline-1-e.rows/2)*e.scrollHeight/linecount);
		} else if (document.selection) { /* IE */
			var range=document.selection.createRange();
			if(range.parentElement()==e) {
				range.collapse(false);
				var found=false; try{found=range.findText(t.value,e.value.length,4)}catch(e){}
				if (found) range.select();
				else { alert('\u0022'+t.value+'\u0022 not found'); t.focus(); }
			}
		}
	};
	b=createTiddlyElement(p,'button',null,null,'=',{tid:tid});
	b.style.width='2em';
	b.title='REPLACE selected text';
	b.onclick=function(ev) { /* REPLACE */
		var e=story.getTiddlerField(this.getAttribute('tid'),'text');
		if (!e||e.getAttribute('edit')!='text') return;
		var t=this.previousSibling.previousSibling.previousSibling;
		var r=this.previousSibling.previousSibling;
		if (   (e.selectionStart!==undefined && e.selectionEnd==e.selectionStart)
		    || (document.selection && document.selection.createRange().text==''))
			this.previousSibling.click(); /* no selection... do FIND first */
		if (   (e.selectionStart!==undefined && e.selectionEnd==e.selectionStart)
		    || (document.selection && document.selection.createRange().text==''))
			{ t.focus(); return; } /* still no selection... goto target input */
		e.focus(); replaceSelection(e,r.value);
	};
	b=createTiddlyElement(p,'button',null,null,'+',{tid:tid});
	b.style.width='2em';
	b.title='REPLACE selected text AND FIND NEXT target text';
	b.onclick=function(ev) { /* REPLACE and FIND NEXT */
		this.previousSibling.click();
		this.previousSibling.previousSibling.click();
	};
	b=createTiddlyElement(p,'button',null,null,'!',{tid:tid});
	b.style.width='2em';
	b.title='REPLACE ALL occurrences of target text';
	b.onclick=function(ev) { /* REPLACE ALL */
		var e=story.getTiddlerField(this.getAttribute('tid'),'text');
		if (!e||e.getAttribute('edit')!='text') return;
		var t=this.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling;
		var r=this.previousSibling.previousSibling.previousSibling.previousSibling;
		if (!t.value.length) { alert('Please enter the target text'); t.focus(); return; }
		var m='This will replace all occurences of:\n\n';
		m+='\''+t.value+'\'\n\nwith:\n\n\''+r.value+'\'\n\nAre you sure?';
		if (!confirm(m)) { r.focus(); r.select(); return; }
		e.value=e.value.replace(new RegExp(t.value.escapeRegExp(),'gm'),r.value);
		e.focus(); e.select(); Popup.remove();
	};
	Popup.show();
	if (!s.length) {t.focus();t.select()} else {r.focus();r.select()}
	event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>replace</a></html>
/%
|Name|QuickEdit_sort|
|Source|http://www.TiddlyTools.com/#QuickEdit_sort|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - sort lines of text|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="sort lines of text"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('select sort order...','');
	s.options[s.length]=new Option('ascending','A');
	s.options[s.length-1].title='ascending';
	s.options[s.length]=new Option('descending','D');
	s.options[s.length-1].title='descending';
	s.size=s.length;
	s.onclick=function(){ if (!this.value.length) return;
		var e=config.quickEdit.getField(this.button); if (!e) return false;
		var lines=config.quickEdit.getSelection(e).split('\n').sort();
		if (this.value=='D') lines=lines.reverse();
		replaceSelection(e,lines.join('\n'));
		e.focus();
		Popup.remove(); return false;
	};
	s.onkeyup=config.quickEdit.keyup;
	Popup.show();
	s.focus();
	return config.quickEdit.processed(event);"
>sort</a></html>
/%
|Name|QuickEdit_split|
|Source|http://www.TiddlyTools.com/#QuickEdit_split|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - move selection to new tiddler and insert link, embedded tiddler, or slider|

Usage: see  http://www.TiddlyTools.com/#QuickEditToolbar

Based on ideas originally developed by YannPerrin
(http://yann.perrin.googlepages.com/twkd.html#easySlicer)

%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" 
title="move selection to new tiddler and insert link, embedded tiddler, or slider"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
	p.style.whiteSpace='nowrap';
	var i=createTiddlyElement(p,'input');
	i.defaultValue='Enter a new tiddler title';
	i.onfocus=function(){this.select()};
	var s=createTiddlyElement(p,'select'); s.button=this;
	s.options[0]=new Option('select type...','');
	s.options[0].title='select split type';
	s.options[1]=new Option('link','link');
	s.options[1].title='replace with [[TiddlerName]]';
	s.options[2]=new Option('embed','embed');
	s.options[2].title='replace with \<\<tiddler TiddlerName\>\>';
	s.options[3]=new Option('slider','slider');
	s.options[3].title='replace with \<\<slider \u0022\u0022 [[TiddlerName]] [[label]] [[tooltip]]\>\>';
	s.onchange=function(){
		if (s.previousSibling.value==s.previousSibling.defaultValue)
			{ alert('A tiddler title is required'); s.selectedIndex=0; s.previousSibling.focus(); return false; }
		var tid=s.previousSibling.value;
		if (store.tiddlerExists(tid) && !confirm(config.messages.overwriteWarning.format([tid])))
			{ s.previousSibling.focus(); return false; }
		switch(s.value) {
			case 'link':
				var newtxt='[['+tid+']]';
				break;
			case 'embed':
				var newtxt='\<\<tiddler [['+tid+']]\>\>';
				break;
			case 'slider':
				var label=prompt('Enter a slider label',tid);
				if (!label) { Popup.remove(); return false; }
				var tip=prompt('Enter a slider tooltip',label);
				if (!tip) { Popup.remove(); return false; }
				var newtxt='\<\<slider \u0022\u0022 [['+tid+']] [['+label+']] [['+tip+']]\>\>';
				break;
		}
		var txt=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
		store.saveTiddler(tid,tid,txt,config.options.txtUserName,new Date(),[],{});
		story.displayTiddler(story.findContainingTiddler(this.button),tid);
		config.quickEdit.setSelection(this.button,newtxt);
		Popup.remove(); return false;
	};
	Popup.show();
	event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>split</a></html>
/***
|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();

//}}}
The way to learn to use ~TiddlyWiki is to forget that you don't know how to use ~TiddlyWiki...
----
If you have 2P and I have 2P, then one of us has 2Q2P!
----
"Knock, Knock"...  "Who's there?"... "Oh! I guess you know that one..."
----
In theory, there is no difference between theory and practice. But, in practice, there is.
----
Sometimes when reading Goethe I have the paralyzing suspicion that he is trying to be funny.
----
Before I got married I had six theories about bringing up children; now I have six children and no theories.
----
A witty saying proves nothing.
----
The problem with some people is that when they aren't drunk, they're sober.
----
The great thing about television is that if something important happens anywhere in the world, day or night, you can always change the channel.
----
Don't be so humble - you are not that great.
----
The combination "ough" can be pronounced in nine different ways. The following sentence contains them all: "A rough-coated, dough-faced, thoughtful ploughman strode through the streets of Scarborough; after falling into a slough, he coughed and hiccoughed." 
----
If you lived here, you'd be home by now...
----
I love my dust. It shows I had something better to do.
----
Time flies like an arrow... Fruit flies like a banana [Groucho Marx]
----
If you don't know where you're going, you'll probably end up somewhere else.
----
Weebles wobble... but they don't fall down!
----
It's all very simple... or else it's all very complex... or perhaps it's neither... or both.
----
Accepting reality is the first step to insanity
----
Oops!  Sorry. My karma ran over your dogma.
----
If it looks like a duck, walks like a duck and sounds like a duck, it's probably something else.
----
Some times you feel like a nut, some times you bolt.
----
Santaclaustrophobia... The feeling that Christmas is closing in all around you.
----
Don't touch that! You don't know where it's been...
----
Why is abbreviation such a long word?
----
Life's a trip, not a destination.  So watch out for the cows.
----
Diplomacy is the art of saying 'Nice doggie!'... until you can find a rock.
----
Scientists working on cloning technology have done what the american educational system has been doing for years - producing identical sheep.
----
Umm... What's another word for thesaurus?
----
Give me ambiguity or give me something else
----
Don't anthropomorphize your computer, it doesn't like it.
----
Ninth Law of Cartoon Physics: Everything falls faster than an anvil.
----
New clinical studies show there aren't any answers.  So just enjoy the questions...
----
Oh yeah?  Far out!
----
Boycott Shampoo - Demand the REAL poo!
----
On Blintze! On Bagel! On Spaetzle! On Strudel! On Matzo! On Latke! On Kuchen! On Kugel!...   Merry Chanukah!
----
Remember: Don't sweat the petty things... and don't pet the sweaty things.
----
Sign in lunch room: Shoes are required to eat in the cafeteria... socks can eat anywhere they want.
----
Don't be irreplaceable, if you can't be replaced, you can't be promoted.
----
5 out of 4 people have problems with fractions...
----
Osborne's Law of Mathematics: Variables won't; constants aren't.
----
Always remember you're unique, just like everyone else.
----
Something to ponder: What was the best thing *before* sliced bread?   Hmmm...
----
Physics Joke #27: Two hydrogen atoms bump into each other while walking down the street: 'Are you alright?'... 'No, I lost an electron!'... 'Are you sure?'... 'Yeah, I'm Positive!'
----
The one thing I can't stand is intolerant people!
----
Old programmers never die. . . they just can't C as well.
----
World Shortest 'Bar' joke: A guy walks into a bar...   OUCH! he says...
----
Who are you going to believe, me or your own eyes? 
----
Never judge a man 'til you have walked a mile in his shoes, because by then, he's a mile away, you've got his shoes, and you can say whatever the hell you want to.
----
The problem with troubleshooting is that real trouble shoots back.
----
How much wood would a woochuck chuck if a woodchuck could chuck wood?
----
These are the roots of rhythm: boom, de boom, de-boom, ding-dong, ooh! [Leila ~Gallagher-Breen]
----
These are the roots of music: boom-chicky-chicky boom, meow, meow, baddom, baddom,  ding-aling-a-long, chicky-boom! [Leila ~Gallagher-Breen]
----
Classified ad (in Physics Quarterly): Got Mole problems?  Call Avagadro Exterminators: 602-1023
----
He who laughs last thinks slowest
----
Would a fly without wings be called a walk?
----
The winner of the World's Worst Analogy contest: 'The little boat glided across the water in exactly the way a bowling ball wouldn't.'
----
From the 'say what?!?' files: We are ready for any unforeseen event that may or may not occur. [Dan Quayle 9/22/90]
----
I believe you should live each day as if it is your last, which is why I don't have any clean laundry because, come on, who wants to wash clothes on the last day of their life? [Jack Handy]
----
PRINTER - A device consisting of three main parts: the case, the jammed paper tray, and the blinking red light.
----
Dilbert's Laws of Work: The more crap you put up with, the more crap you are going to get.
----
Q: Why'd the electron cross the road? A: 'Cause he was already on the other side...
----
When the going gets tough, remember STRESSED spelled backwards is DESSERTS.
----
Foobar... baz. Mumble: frotz, gronk, snork. Snerfle? Natter and gromish!
----
Pentiums melt in your PC, not in your hand.
----
everyone is cute... even me.  But in purple... I'm STUNNING!! [Londo Mollari] 
----
I always wanted to be somebody, but I should have been more specific. [Lily Tomlin] 
----
It's OK to change horses in mid-stream, especially if the first horse can't swim! [Laura Shulman] 
----
Work is the curse of the drinking classes. [Oscar Wilde] 
----
We have only two things to worry about:  That things will never get back to normal, and that they already have.
----
Intelligence is a funny thing: those who don't have it think they do, and those who do are smart enough to know better.
----
Life is hard, Love is strange.  Nothing lasts, people change.   Dream of a long and wonderful future, but live now.
----
'Can you prove any of the stuff you believe in?', my friend asked. When I said that's not how belief works, he nodded and said that's what he thought but he was just checking to make sure he hadn't missed a key point.
----
Life ... It's a good place to be!
----
Do not follow where the path may lead.  Go, instead, where there is no path, and leave a trail.
----
History is made at night... character is what you are in the dark. [Dr. Emilio Lizardo, aka Lord John Worfin] 
----
You can't always get what you want... but if you try sometimes, you just may find, that you get what you need. [The Rolling Stones] 
----
The only man who behaved sensibly was my tailor; he took my measurement anew every time he saw me, while all the rest went on with their old measurements and expected them to fit me. [George Bernard Shaw] 
----
In matters of style, swim with the current: in matters of principle, stand like a rock. [Thomas Jefferson] 
----
Great things are not done by impulse, but by a series of small things brought together. [Vincent van Gogh] 
----
'I think there is a world market for maybe five computers.' [Thomas Watson, chairman of IBM, 1943] 
----
We have to live today by what truth we can get today, and be ready tomorrow to call it falsehood. [William James] 
----
There are two ways of spreading light: to be the candle or the mirror that reflects it. [Edith Wharton] 
----
Talent develops in tranquility, character in the full current of human life. [Johann Wolfgang von Goethe (1749-1832)] 
----
Our firmest convictions are apt to be the most suspect; they mark our limitations and our bounds.  Life is a petty thing unless it is moved by the indomitable urge to extend its boundaries. [Jose Ortega y Gasset] 
----
It takes courage to grow up and turn out to be who you really are. [e e cummings (1894-1962)] 
----
If we knew what it was we were doing, it would not be called research, would it? [Albert Einstein] 
----
To invent, you need a good imagination and a pile of junk. [Thomas Edison] 
----
Dare to be naive. [R. Buckminster Fuller] 
----
Quiet minds cannot be perplexed or frightened, but go on in fortune or misfortune at their own private pace, like a clock during a thunderstorm. [Robert Louis Stevenson] 
----
In the struggle between yourself and the world, second the world. [Franz Kafka] 
----
Every man's condition is a solution in hieroglyph to those inquiries he would put.  He acts it as life before he apprehends it as truth. [Ralph Waldo Emerson] 
----
One can remain alive...if one is unafraid of change, insatiable in intellectual curiosity, interested in big things, and happy in small ways. [Edith Wharton] 
----
a rock is like space because it doesnt move; and space is like a rock because it is empty.  words are buddhas. [Jack Kerouac] 
----
The whole problem with the world is that fools and fanatics are always so certain of themselves, and wiser people so full of doubts. [Bertrand Russell] 
----
Doubt is not a pleasant state of mind, but certainty is absurd. [Voltaire] 
----
Education is not the filling of a pail, but the lighting of a fire. [William Butler Yeats] 
----
If you take yourself too seriously, no one else will take you seriously enough... [Eric Shulman] 
----
There are only four questions of value in life... What is sacred? Of what is the spirit made? What is worth living for, and what is worth dying for? The answer to each is the same: only love. [Don Juan ~DeMarco] 
----
If you are a dreamer, come in.  If you are a dreamer, a wisher, a liar, a hope-er, a pray-er, a magic bean buyer... If you're a pretender, come sit by my fire... For we have some flax-golden tales to spin.  Come in!  Come in! [Shel Silverstein] 
----
O money, money, money, I'm not necessarily one of those who think thee holy, But I often stop to wonder how thou canst go out so fast when thou comest in so slowly. [Ogden Nash] 
----
There is no progress without struggle. [Frederick Douglass] 
----
Before you can do something, you must become something. [Goethe] 
----
The man who follows the crowd will usually get no further than the crowd.  The man who walks alone is likely to find himself in places no one has ever been. [Alan ~Ashley-Pit] 
----
Weep not for the dead for they are but empty cages from which the bird has flown. [Tibetan Book of The Dead] 
----
I wish it would dawn upon engineers that, in order to be an engineer, it is not enough to be an engineer. [Jose Ortega y Gasset] 
----
Every exit is an entry somewhere. [Tom Stoppard] 
----
Wherever we are, it is but a stage on the way to somewhere else, and whatever we do, however well we do it, it is only a preparation to do something else that shall be different. [Robert Louis Stevenson] 
----
We judge ourselves by what we feel capable of doing, while others judge us by what we have already done. [Henry Wadsworth Longfellow] 
----
All our words are but crumbs that fall down from the feast of the mind. [Kahlil Gibran, "Sand and Foam"] 
----
It's a lot harder to find joy than it is to find bread.  Feed your soul first, then go shopping. [Eric Shulman] 
----
Why do you hasten to remove anything which hurts your eye, while if something affects your soul you postpone the cure until next year? [Horace] 
----
Not to know is bad.  Not to want to know is worse.  Not to hope is unthinkable.  Not to care is unforgivable.  [Nigerian folk saying] 
----
Only half of writing is saying what you mean. The other half is preventing people from reading what they expected you to mean. [James Richardson, 'Ploughshares'] 
----
There are no shortcuts to anyplace worth going. [Beverly Sills] 
----
Somewhere, something incredible is waiting to be known. [Carl Sagan] 
----
Courage is the price that Life extracts for granting peace. [Amelia Earhart] 
----
Great things are not done by impulse, but by a series of small things brought together. [Vincent van Gogh] 
----
Choose a job you love, and you will never have to work a day in your life. [Confucius] 
----
There is only one success - to be able to spend your life in your own way. [Christopher Morley] 
----
We choose our joys and sorrows long before we experience them. [Kahlil Gibran] 
----
It is all a frame of mind, this enjoyment of living. [Lin Yutang] 
----
Work for something because it is good, not just because it stands a chance to succeed. [Vaclav Havel] 
----
The easiest way to get what you want is to help others get what they want. [Deepak Chopra] 
----
All generalizations are false, including this one. [Bucky Radfish]
----
In science, 'fact' can only mean 'confirmed to such a degree that it would be perverse to withhold provisional assent.' I suppose that apples might start to rise tomorrow, but the possibility does not merit equal time in physics classrooms. [Stephen Jay Gould (1941 - 2002)]
----
Twenty years from now, you will be more disappointed by the things you didn't do, than by the ones you did. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore, dream... [Mark Twain]
----
To live only for some future goal is shallow.  It's the sides of the mountain that sustain life, not the top. [Robert M. Pirsig]
----
Nothing is so contagious as enthusiasm; it moves stones, it charms brutes.  Enthusiasm is the genius of sincerity, and truth accomplishes no victories without it. [Edward G. E. ~Bulwer-Lytton (1803 - 1873)]
----
The past is but the beginning of a beginning, and all that is and has been is but the twilight of the dawn. [Herbert George Wells]
----
We grow great by dreams. All big men are dreamers. They see things in the soft haze of a spring day or in the red fire of a long winter's evening. Some of us let these great dreams die, but others nourish and protect them; nurse them through bad days till they bring them to the sunshine and light, which comes always to those who sincerely hope that their dreams will come true. [Woodrow Wilson]
----
Be brave enough to live life creatively. The creative is the place where no one else has ever been.  You have to leave the city of your comfort and go into the wilderness of your intuition. You can't get there by bus, only by hard work and risk and by not quite knowing what you're doing. What you'll discover will be wonderful. What you'll discover will be yourself. [Alan Alda]
----
If we had no winter, the spring would not be so pleasant; if we did not sometimes taste of adversity, prosperity would not be so welcome.
----
Solitude, if rightly used, becomes not only a privilege but a necessity.  Only a superficial soul fears to fraternize with itself.
----
One of the symptoms of an approaching nervous breakdown is the belief that one's work is terribly important.
----
Hope is like a road in the country: there was never a road, but when many people walk on it, the road comes into existence.
----
You can only find truth with logic if you have already found truth without it.
----
Love is always bestowed as a gift - freely, willingly and without expectation. We don't love to be loved; we love to love.
----
Always listen to experts. They'll tell you what can't be done, and why. Then do it.
----
Distance between two hearts is not an obstacle; rather a great reminder of just how strong true love can be.
----
Not everything that can be counted counts, and not everything that counts can be counted.
----
Life's challenges are not supposed to paralyze you, they're supposed to help you discover who you are.
----
Nothing splendid has ever been achieved except by those who dared believe that something inside them was superior to circumstances.
----
Whether you think that you can, or that you can't, you are usually right.
----
The only time you run out of chances is when you stop taking them.
----
Knowledge speaks, but wisdom listens.
----
Too often we give our children answers to remember rather than problems to solve.
----
Books are the shoes with which we tread the footsteps of great minds.  A book may lie dormant for fifty years or for two thousand years in a forgotten corner of a library, only to reveal, upon being opened, the marvels or the abysses that it contains, or the line that seems to have been written for me alone. In this respect the writer is not different from any other human being: whatever we say or do can have far-reaching consequences.
----
A people that values its privileges above its principles soon loses both.
----
Treat everyone with politeness, even those who are rude to you. Not because they are nice, but because you are.
----
The ultimate measure of a man is not where he stands in moments of comfort and convenience, but where he stands in times of challenge and controversy.  What lies behind us and what lies before us, are only small matters compared to what lies within us. 
----
Being in charge of your own reality is a little tougher; it takes a lot of thinking and brutal honesty. [Phil Glatz]
----
There are always going to be amazingly creative people doing wonderful things. [Phil Glatz]
----
The trick is to rise above the symptoms of being aware, and actually BE aware. [Phil Glatz]
----
A revolution is coming - a revolution which will be peaceful if we are wise enough; compassionate if we care enough; successful if we are fortunate enough - but a revolution which is coming whether we will it or not. We can affect its character, we cannot alter its inevitability. [John F. Kennedy]
----
On two occasions I have been asked (by members of Parliament!), 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. [Charles Babbage]
----
In your presence even my shadow acquires the sensation of touch.
----
You cannot legislate the poor into prosperity by legislating the wealthy out of prosperity. What one person receives without working for, another person must work for without receiving. The government cannot give to anybody any-thing that the government does not first take from somebody else. When half of the people get the idea that they do not have to work because the other half is going to take care of them, and when the other half gets the idea that it does no good to work because somebody else is going to get what they work for, that my dear friend, is the begin-ning of the end of any nation. You cannot multiply wealth by dividing it. [Adrian Rogers, 1931-2005]
----
Today is the tomorrow you worried about yesterday.
----
Do what you have to do now, so you can do what you want to do later.
----
Some People are like Slinkys, Not Really good for ANYTHING, but they bring a Smile to your Face when Pushed Down the Stairs.
----
American children and adolescents spend 22 to 28 hours per week viewing television, more than any other activity except sleeping. By the age of 70 they will have spent 7 to 10 years of their lives watching TV. http://www.turnoffyourtv.com
----
We shall go on to the end, we shall fight in France, we shall fight on the seas and oceans, we shall fight with growing confidence and growing strength in the air, we shall defend our Island, whatever the cost may be, we shall fight on the beaches, we shall fight on the landing grounds, we shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender! [Sir Winston Churchill, June 4th 1940]
/***
|Name|QuoteOfTheDayPlugin|
|Source|http://www.TiddlyTools.com/#QuoteOfTheDayPlugin|
|Documentation|http://www.TiddlyTools.com/#QuoteOfTheDayPluginInfo|
|Version|1.4.1|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Display a randomly selected "quote of the day" from a list defined in a separate tiddler|

!!!!!Documentation
>see [[QuoteOfTheDayPluginInfo]]
!!!!!Revisions
<<<
2008.03.21 [1.4.1] in showNextItem(), corrected handling for random selection so that //initial// index value will randomized correctly instead of always showing first item, even when randomizing.  Thanks to Riccardo Gherardi for finding this.
| Please see [[QuoteOfTheDayPluginInfo]] for previous revision details |
2005.10.21 [1.0.0] Initial Release.  Based on a suggestion by M.Russula
<<<
!!!!!Code
***/
//{{{
version.extensions.QOTD = {major: 1, minor: 4, revision: 1, date: new Date(2008,3,21)};
config.macros.QOTD = {
	clickTooltip: "click to view another item",
	timerTooltip: "auto-timer stopped...  'mouseout' to restart timer",
	timerClickTooltip: "auto-timer stopped...  click to view another item, or 'mouseout' to restart timer",
	handler:
	function(place,macroName,params) {
		var tid=params.shift(); // source tiddler containing HR-separated quotes
		var p=params.shift();
		var click=true; // allow click for next item
		var inline=false; // wrap in slider for animation effect
		var random=true; // pick an item at random (default for "quote of the day" usage)
		var folder=false; // use local filesystem folder list
		var cookie=""; // default to no cookie
		var next=0; // default to first item (or random item)
		while (p) {
			if (p.toLowerCase()=="noclick") var click=false;
			if (p.toLowerCase()=="inline") var inline=true;
			if (p.toLowerCase()=="norandom") var random=false;
			if (p.toLowerCase().substr(0,7)=="cookie:") var cookie=p.substr(8);
			if (!isNaN(p)) var delay=p;
			p=params.shift();
		}
		if ((click||delay) && !inline) {
			var panel = createTiddlyElement(null,"div",null,"sliderPanel");
			panel.style.display="none";
			place.appendChild(panel);
			var here=createTiddlyElement(panel,click?"a":"span",null,"QOTD");
		}
		else
			var here=createTiddlyElement(place,click?"a":"span",null,"QOTD");
		here.id=(new Date()).convertToYYYYMMDDHHMMSSMMM()+Math.random().toString(); // unique ID
		// get items from tiddler or file list
		var list=store.getTiddlerText(tid,"");
		if (!list||!list.length) { // not a tiddler... maybe an image directory?
			var list=this.getImageFileList(tid);
			if (!list.length) { // maybe relative path... fixup and try again
				var h=document.location.href;
				var p=getLocalPath(decodeURIComponent(h.substr(0,h.lastIndexOf("/")+1)));
				var list=this.getImageFileList(p+tid);
			}
		}
		if (!list||!list.length) return false; // no contents... nothing to display!
		here.setAttribute("list",list);
		if (delay) here.setAttribute("delay",delay);
		here.setAttribute("random",random);
		here.setAttribute("cookie",cookie);
		if (click) {
			here.title=this.clickTooltip
			if (!inline) here.style.display="block";
			here.setAttribute("href","javascript:;");
			here.onclick=function(event)
				{ config.macros.QOTD.showNextItem(this); }
		}
		if (config.options["txtQOTD_"+cookie]!=undefined) next=parseInt(config.options["txtQOTD_"+cookie]);
		here.setAttribute("nextItem",next);
		config.macros.QOTD.showNextItem(here);
		if (delay) {
			here.title=click?this.timerClickTooltip:this.timerTooltip
			here.onmouseover=function(event)
				{ clearTimeout(this.ticker); };
			here.onmouseout=function(event)
				{ this.ticker=setTimeout("config.macros.QOTD.tick('"+this.id+"')",this.getAttribute("delay")); };
			here.ticker=setTimeout("config.macros.QOTD.tick('"+here.id+"')",delay);
		}
	},
	tick: function(id) {
		var here=document.getElementById(id); if (!here) return;
		config.macros.QOTD.showNextItem(here);
		here.ticker=setTimeout("config.macros.QOTD.tick('"+id+"')",here.getAttribute("delay"));
	},
	showNextItem:
	function (here) {
		// hide containing slider panel (if any)
		var p=here.parentNode;
		if (p.className=="sliderPanel") p.style.display = "none"
		// get a new quote
		var index=here.getAttribute("nextItem"); 
		var items=here.getAttribute("list").split("\n----\n");
		if (index<0||index>=items.length) index=0;
		if (here.getAttribute("random")=="true") index=Math.floor(Math.random()*items.length);
		var txt=items[index];
		// re-render quote display element, and advance index counter
		removeChildren(here); wikify(txt,here);
		index++; here.setAttribute("nextItem",index);
		var cookie=here.getAttribute("cookie");
		if (cookie.length) {
			config.options["txtQOTD_"+cookie]=index.toString();
			saveOptionCookie("txtQOTD_"+cookie);
		}
		// redisplay slider panel (if any)
		if (p.className=="sliderPanel") {
			if(anim && config.options.chkAnimate)
				anim.startAnimating(new Slider(p,true,false,"none"));
			else p.style.display="block";
		}
	},
	getImageFileList: function(cwd) { // returns HR-separated list of image files
		function isImage(fn) {
			var ext=fn.substr(fn.length-3,3).toLowerCase();
			return ext=="jpg"||ext=="gif"||ext=="png";
		}
		var files=[];
		if (config.browser.isIE) {
			cwd=cwd.replace(/\//g,"\\");
			// IE uses ActiveX to read filesystem info
			var fso = new ActiveXObject("Scripting.FileSystemObject");
			if(!fso.FolderExists(cwd)) return [];
			var dir=fso.GetFolder(cwd);
			for(var f=new Enumerator(dir.Files); !f.atEnd(); f.moveNext())
				if (isImage(f.item().path)) files.push("[img[%0]]".format(["file:///"+f.item().path.replace(/\\/g,"/")]));
		} else {
			// FireFox (mozilla) uses "components" to read filesystem info
			// get security access
			if(!window.Components) return;
			try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); }
			catch(e) { alert(e.description?e.description:e.toString()); return []; }
			// open/validate directory
			var file=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
			try { file.initWithPath(cwd); } catch(e) { return []; }
			if (!file.exists() || !file.isDirectory()) { return []; }
			var folder=file.directoryEntries;
			while (folder.hasMoreElements()) {
				var f=folder.getNext().QueryInterface(Components.interfaces.nsILocalFile);
				if (f instanceof Components.interfaces.nsILocalFile)
					if (isImage(f.path)) files.push("[img[%0]]".format(["file:///"+f.path.replace(/\\/g,"/")]));
			}
		}
		return files.join("\n----\n");
	}
}
//}}}
/***
|''Name:''|ReminderPlugin|
|''Version:''|2.3.10 (Jun 28, 2007)|
|''Source:''|http://remindermacros.tiddlyspot.com|
|''Author:''|Jeremy Sheeley(pop1280 [at] excite [dot] com) Maintainer: simon.baird@gmail.com|
|''Licence:''|[[BSD open source license]]|
|''Macros:''|reminder, showreminders, displayTiddlersWithReminders, newReminder|
|''TiddlyWiki:''|2.0+|
|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|
|Description|plugin provides macros for tagging a date with a reminder|

!Description
This plugin provides macros for tagging a date with a reminder.  Use the {{{reminder}}} macro to do this.  The {{{showReminders}}} and {{{displayTiddlersWithReminder}}} macros automatically search through all available tiddlers looking for upcoming reminders.

!Installation
* Create a new tiddler in your tiddlywiki titled ReminderPlugin and give it the {{{systemConfig}}} tag.  The tag is important because it tells TW that this is executable code.
* Double click this tiddler, and copy all the text from the tiddler's body.
* Paste the text into the body of the new tiddler in your TW.
* Save and reload your TW.
* You can copy some examples into your TW as well.  See [[ReminderExamples]], [[Holidays]], [[showReminders]] and [[Personal Reminders]]

!Syntax:
|>|See [[ReminderSyntax]] and [[showRemindersSyntax]]|

!Revision history
* v2.3.10 (Jun 28, 2007)
** Removed window.story = window backwards compatibility hacks since they were breaking TW 2.2
* v2.3.9 (Apr 26, 2007)
** allow bracketed list format in tags param lets you use tags with spaces
* v2.3.8 (Mar 9, 2006)
**Bug fix: A global variable had snuck in, which was killing FF 1.5.0.1
**Feature: You can now use TIDDLER and TIDDLERNAME in a regular reminder format
* v2.3.6 (Mar 1, 2006)
**Bug fix: Reminders for today weren't being matched sometimes.
**Feature:  Solidified integration with DatePlugin and CalendarPlugin
**Feature:  Recurring reminders will now return multiple hits in showReminders and the calendar.
**Feature:  Added TIDDLERNAME to the replacements for showReminders format, for plugins that need the title without brackets.
* v2.3.5 (Feb 8, 2006)
**Bug fix: Sped up reminders lots.  Added a caching mechanism for reminders that have already been matched.
* v2.3.4 (Feb 7, 2006)
**Bug fix: Cleaned up code to hopefully prevent the Firefox 1.5.0.1 crash that was causing lots of plugins 
to crash Firefox.  Thanks to http://www.jslint.com
* v2.3.3 (Feb 2, 2006)
**Feature: newReminder now has drop down lists instead of text boxes.
**Bug fix:  A trailing space in a title would trigger an infinite loop.
**Bug fix:  using tag:"birthday !reminder" would filter differently than tag:"!reminder birthday"
* v2.3.2 (Jan 21, 2006)
**Feature: newReminder macro, which will let you easily add a reminder to a tiddler. Thanks to Eric Shulman (http://www.elsdesign.com) for the code to do this.
** Bug fix: offsetday was not working sometimes
** Bug fix: when upgrading to 2.0, I included a bit to exclude tiddlers tagged with excludeSearch.  I've reverted back to searching through all tiddlers
* v2.3.1 (Jan 7, 2006)
**Feature: 2.0 compatibility
**Feature AlanH sent some code to make sure that showReminders prints a message if no reminders are found.
* v2.3.0 (Jan 3, 2006)
** Bug Fix:  Using "Last Sunday (-0)" as a offsetdayofweek wasn't working.
** Bug Fix:  Daylight Savings time broke offset based reminders (for example year:2005 month:8 day:23 recurdays:7 would match Monday instead of Tuesday during DST.

!Code
***/
//{{{

//============================================================================
//============================================================================
//           ReminderPlugin
//============================================================================
//============================================================================

version.extensions.ReminderPlugin = {major: 2, minor: 3, revision: 8, date: new Date(2006,3,9), source: "http://remindermacros.tiddlyspot.com/"};

//============================================================================
// Configuration
// Modify this section to change the defaults for 
// leadtime and display strings
//============================================================================

config.macros.reminders = {};
config.macros["reminder"] = {};
config.macros["newReminder"] = {};
config.macros["showReminders"] = {};
config.macros["displayTiddlersWithReminders"] = {};

config.macros.reminders["defaultLeadTime"] = [0,6000];
config.macros.reminders["defaultReminderMessage"] = "DIFF: TITLE on DATE ANNIVERSARY";
config.macros.reminders["defaultShowReminderMessage"] = "DIFF: TITLE on DATE ANNIVERSARY -- TIDDLER";
config.macros.reminders["defaultAnniversaryMessage"] = "(DIFF)";
config.macros.reminders["untitledReminder"] = "Untitled Reminder";
config.macros.reminders["noReminderFound"] = "Couldn't find a match for TITLE in the next LEADTIMEUPPER days."
config.macros.reminders["todayString"] = "Today";
config.macros.reminders["tomorrowString"] = "Tomorrow";
config.macros.reminders["ndaysString"] = "DIFF days";
config.macros.reminders["emtpyShowRemindersString"] = "There are no upcoming events";


//============================================================================
//  Code
// You should not need to edit anything 
// below this.  Make sure to edit this tiddler and copy 
// the code from the text box, to make sure that 
// tiddler rendering doesn't interfere with the copy 
// and paste.
//============================================================================

//this object will hold the cache of reminders, so that we don't
//recompute the same reminder over again.
var reminderCache = {};

config.macros.showReminders.handler = function showReminders(place,macroName,params)
{
   var now = new Date().getMidnight();
   var paramHash = {};
   var leadtime = [0,14];
   paramHash = getParamsForReminder(params);
   var bProvidedDate = (paramHash["year"] != null) || 
			(paramHash["month"] != null) || 
			(paramHash["day"] != null) || 
			(paramHash["dayofweek"] != null);
   if (paramHash["leadtime"] != null)
   {
      leadtime = paramHash["leadtime"];
      if (bProvidedDate)
      {
         //If they've entered a day, we need to make 
         //sure to find it.  We'll reset the 
         //leadtime a few lines down.
         paramHash["leadtime"] = [-10000, 10000];
      }
   }
   var matchedDate = now;
   if (bProvidedDate)
   {
      var leadTimeLowerBound = new Date().getMidnight().addDays(paramHash["leadtime"][0]);
      var leadTimeUpperBound = new Date().getMidnight().addDays(paramHash["leadtime"][1]);
      matchedDate = findDateForReminder(paramHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound); 
   }

   var arr = findTiddlersWithReminders(matchedDate, leadtime, paramHash["tag"], paramHash["limit"]);
   var elem = createTiddlyElement(place,"span",null,null, null);
   var mess = "";
   if (arr.length == 0)
   {
      mess += config.macros.reminders.emtpyShowRemindersString; 
   }
   for (var j = 0; j < arr.length; j++)
   {
      if (paramHash["format"] != null)
      {
         arr[j]["params"]["format"] = paramHash["format"];
      }
      else
      {
         arr[j]["params"]["format"] = config.macros.reminders["defaultShowReminderMessage"];
      }
      mess += getReminderMessageForDisplay(arr[j]["diff"], arr[j]["params"], arr[j]["matchedDate"], arr[j]["tiddler"]);
      mess += "\n";
   }
   wikify(mess, elem, null, null);
};


config.macros.displayTiddlersWithReminders.handler = function displayTiddlersWithReminders(place,macroName,params)
{
   var now = new Date().getMidnight();
   var paramHash = {};
   var leadtime = [0,14];
   paramHash = getParamsForReminder(params);
   var bProvidedDate = (paramHash["year"] != null) || 
			(paramHash["month"] != null) || 
			(paramHash["day"] != null) || 
			(paramHash["dayofweek"] != null);
   if (paramHash["leadtime"] != null)
   {
      leadtime = paramHash["leadtime"];
      if (bProvidedDate)
      {
         //If they've entered a day, we need to make 
         //sure to find it.  We'll reset the leadtime 
         //a few lines down.
         paramHash["leadtime"] = [-10000,10000];
      }
   }
   var matchedDate = now;
   if (bProvidedDate)
   {
      var leadTimeLowerBound = new Date().getMidnight().addDays(paramHash["leadtime"][0]);
      var leadTimeUpperBound = new Date().getMidnight().addDays(paramHash["leadtime"][1]);
      matchedDate = findDateForReminder(paramHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound); 
   }
   var arr = findTiddlersWithReminders(matchedDate, leadtime, paramHash["tag"], paramHash["limit"]);
   for (var j = 0; j < arr.length; j++)
   {
      displayTiddler(null, arr[j]["tiddler"], 0, null, false, false, false);
   }
};

config.macros.reminder.handler = function reminder(place,macroName,params)
{
   var dateHash = getParamsForReminder(params);
   if (dateHash["hidden"] != null)
   {
      return;
   }
   var leadTime = dateHash["leadtime"];
   if (leadTime == null)
   {
      leadTime = config.macros.reminders["defaultLeadTime"]; 
   }
   var leadTimeLowerBound = new Date().getMidnight().addDays(leadTime[0]);
   var leadTimeUpperBound = new Date().getMidnight().addDays(leadTime[1]);
   var matchedDate = findDateForReminder(dateHash, new Date().getMidnight(), leadTimeLowerBound, leadTimeUpperBound);
   if (!store.getTiddler) 
   {
      store.getTiddler=function(title) {return this.tiddlers[title];};
   }
   var title = window.story.findContainingTiddler(place).id.substr(7);
   if (matchedDate != null)
   {
      var diff = matchedDate.getDifferenceInDays(new Date().getMidnight());
      var elem = createTiddlyElement(place,"span",null,null, null);
      var mess = getReminderMessageForDisplay(diff, dateHash, matchedDate, title);
      wikify(mess, elem, null, null);
   }
   else
   {
      createTiddlyElement(place,"span",null,null, config.macros.reminders["noReminderFound"].replace("TITLE", dateHash["title"]).replace("LEADTIMEUPPER", leadTime[1]).replace("LEADTIMELOWER", leadTime[0]).replace("TIDDLERNAME", title).replace("TIDDLER", "[[" + title + "]]") );
   }
};

config.macros.newReminder.handler = function newReminder(place,macroName,params)
{
  var today=new Date().getMidnight();
  var formstring = '<html><form>Year: <select name="year"><option value="">Every year</option>';
  for (var i = 0; i < 5; i++)
  {
    formstring += '<option' + ((i == 0) ? ' selected' : '') + ' value="' + (today.getFullYear() +i) + '">' + (today.getFullYear() + i) + '</option>';
  }
  formstring += '</select>&nbsp;&nbsp;Month:<select name="month"><option value="">Every month</option>';
  for (i = 0; i < 12; i++)
  {
    formstring += '<option' + ((i == today.getMonth()) ? ' selected' : '') + ' value="' + (i+1) + '">' + config.messages.dates.months[i] + '</option>';
  }
  formstring += '</select>&nbsp;&nbsp;Day:<select name="day"><option value="">Every day</option>';
  for (i = 1; i < 32; i++)
  {
    formstring += '<option' + ((i == (today.getDate() )) ? ' selected' : '') + ' value="' + i + '">' + i + '</option>';
  }

formstring += '</select>&nbsp;&nbsp;Reminder Title:<input type="text" size="40" name="title" value="please enter a title" onfocus="this.select();"><input type="button" value="ok" onclick="addReminderToTiddler(this.form)"></form></html>';

  var panel = config.macros.slider.createSlider(place,null,"New Reminder","Open a form to add a new reminder to this tiddler");
  wikify(formstring ,panel,null,store.getTiddler(params[1]));
};

// onclick: process input and insert reminder at 'marker'
window.addReminderToTiddler = function(form) {
   if (!store.getTiddler) 
   {
      store.getTiddler=function(title) {return this.tiddlers[title];};
   }
   var title = window.story.findContainingTiddler(form).id.substr(7);
   var tiddler=store.getTiddler(title);
  var txt='\n<<reminder ';
  if (form.year.value != "")
    txt += 'year:'+form.year.value + ' ';
  if (form.month.value != "")
    txt += 'month:'+form.month.value + ' ';
  if (form.day.value != "")
    txt += 'day:'+form.day.value + ' ';
  txt += 'title:"'+form.title.value+'" ';
  txt +='>>';
   tiddler.set(null,tiddler.text + txt);
   window.story.refreshTiddler(title,1,true);
   store.setDirty(true);
};

function hasTag(tiddlerTags, tagFilters)
{
  //Make sure we respond well to empty tiddlerTaglists or tagFilterlists
  if (tagFilters.length==0 || tiddlerTags.length==0)
  {
    return true;
  }

  var bHasTag = false;
  
  /*bNoPos says: "'till now there has been no check using a positive filter"
     Imagine a filterlist consisting of 1 negative filter:
         If the filter isn't matched, we want hasTag to be true.
         Yet bHasTag is still false ('cause only positive filters cause bHasTag to change)
         
     If no positive filters are present bNoPos is true, and no negative filters are matched so we have not returned false
         Thus: hasTag returns true.
      
      If at any time a positive filter is encountered, we want at least one of the tags to match it, so we turn bNoPos to false, which
      means bHasTag must be true for hasTag to return true*/
  var bNoPos=true;
  
for (var t3 = 0; t3 < tagFilters.length; t3++)
  {
      for(var t2=0; t2<tiddlerTags.length; t2++)
      {
           if (tagFilters[t3].length > 1 && tagFilters[t3].charAt(0) == '!') 
           {
              if (tiddlerTags[t2] == tagFilters[t3].substring(1))
              {
                 //If at any time a negative filter is matched, we return false
                  return false;
              }
           }
           else 
           {
              if (bNoPos)
              {
                 //We encountered the first positive filter
                 bNoPos=false;
              }
              if (tiddlerTags[t2] == tagFilters[t3])
              {
                  //A positive filter is matched. As long as no negative filter is matched, hasTag will return true
                  bHasTag=true;
              }
           }
        }
    }
    return (bNoPos || bHasTag);
};

//This function searches all tiddlers for the reminder  //macro.  It is intended that other plugins (like //calendar) will use this function to query for 
//upcoming reminders.
//The arguments to this function filter out reminders //based on when they will fire.
//
//ARGUMENTS:
//baseDate is the date that is used as "now".  
//leadtime is a two element int array, with leadtime[0] 
//         as the lower bound and leadtime[1] as the
//         upper bound.  A reasonable default is [0,14]
//tags is a space-separated list of tags to use to filter 
//         tiddlers.  If a tag name begins with an !, then 
//         only tiddlers which do not have that tag will 
//         be considered.  For example "examples holidays"  
//         will search for reminders in any tiddlers that  
//         are tagged with examples or holidays and 
//         "!examples !holidays" will search for reminders 
//         in any tiddlers that are not tagged with 
//         examples or holidays.  Pass in null to search 
//         all tiddlers.
//limit.  If limit is null, individual reminders can 
//        override the leadtime specified earlier.  
//        Pass in 1 in order to override that behavior.

window.findTiddlersWithReminders = function findTiddlersWithReminders(baseDate, leadtime, tags, limit)
{
//function(searchRegExp,sortField,excludeTag)
//   var macroPattern = "<<([^>\\]+)(?:\\*)([^>]*)>>";
   var macroPattern = "<<(reminder)(.*)>>";
   var macroRegExp = new RegExp(macroPattern,"mg");
   var matches = store.search(macroRegExp,"title","");
   var arr = [];
   var tagsArray = null;
   if (tags != null)
   {
      // tagsArray = tags.split(" ");
      tagsArray = tags.readBracketedList(); // allows tags with spaces. thanks Robin Summerhill, 4-Oct-06.
   }
   for(var t=matches.length-1; t>=0; t--)
   {
      if (tagsArray != null)
      {
         //If they specified tags to filter on, and this tiddler doesn't 
	 //match, skip it entirely.
         if ( ! hasTag(matches[t].tags, tagsArray))
         {
            continue;
         }
      }

      var targetText = matches[t].text;
      do {
         // Get the next formatting match
         var formatMatch = macroRegExp.exec(targetText);
         if(formatMatch && formatMatch[1] != null && formatMatch[1].toLowerCase() == "reminder")
         {
            //Find the matching date.
            
            var params = formatMatch[2] != null ? formatMatch[2].readMacroParams() : {};
            var dateHash = getParamsForReminder(params);
            if (limit != null || dateHash["leadtime"] == null)
            {
               if (leadtime == null)
                   dateHash["leadtime"] = leadtime;
               else
               {
                  dateHash["leadtime"] = [];
                  dateHash["leadtime"][0] = leadtime[0];
                  dateHash["leadtime"][1] = leadtime[1];
               }
            }
	    if (dateHash["leadtime"] == null)
               dateHash["leadtime"] = config.macros.reminders["defaultLeadTime"]; 
            var leadTimeLowerBound = baseDate.addDays(dateHash["leadtime"][0]);
            var leadTimeUpperBound = baseDate.addDays(dateHash["leadtime"][1]);
            var matchedDate = findDateForReminder(dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound);
            while (matchedDate != null)
            {
               var hash = {};
               hash["diff"] = matchedDate.getDifferenceInDays(baseDate);
               hash["matchedDate"] = new Date(matchedDate.getFullYear(), matchedDate.getMonth(), matchedDate.getDate(), 0, 0);
               hash["params"] = cloneParams(dateHash);
               hash["tiddler"] = matches[t].title;
               hash["tags"] = matches[t].tags;
               arr.pushUnique(hash);
	       if (dateHash["recurdays"] != null || (dateHash["year"] == null))
	       {
	         leadTimeLowerBound = leadTimeLowerBound.addDays(matchedDate.getDifferenceInDays(leadTimeLowerBound)+ 1);
                 matchedDate = findDateForReminder(dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound);
	       }
	       else matchedDate = null;
            }
         }
      }while(formatMatch);
   }
   if(arr.length > 1)  //Sort the array by number of days remaining.
   {
      arr.sort(function (a,b) {if(a["diff"] == b["diff"]) {return(0);} else {return (a["diff"] < b["diff"]) ? -1 : +1; } });
   }
   return arr;
};

//This function takes the reminder macro parameters and
//generates the string that is used for display.
//This function is not intended to be called by 
//other plugins.
 window.getReminderMessageForDisplay= function getReminderMessageForDisplay(diff, params, matchedDate, tiddlerTitle)
{
   var anniversaryString = "";
   var reminderTitle = params["title"];
   if (reminderTitle == null)
   {
      reminderTitle = config.macros.reminders["untitledReminder"];
   }
   if (params["firstyear"] != null)
   {
      anniversaryString = config.macros.reminders["defaultAnniversaryMessage"].replace("DIFF", (matchedDate.getFullYear() - params["firstyear"]));
   }
   var mess = "";
   var diffString = "";
   if (diff == 0)
   {
      diffString = config.macros.reminders["todayString"];
   }
   else if (diff == 1)
   {
      diffString = config.macros.reminders["tomorrowString"];
   }
   else
   {
      diffString = config.macros.reminders["ndaysString"].replace("DIFF", diff);
   }
   var format = config.macros.reminders["defaultReminderMessage"];
   if (params["format"] != null)
   {
      format = params["format"];
   }
   mess = format;
//HACK!  -- Avoid replacing DD in TIDDLER with the date
   mess = mess.replace(/TIDDLER/g, "TIDELER");
   mess = matchedDate.formatStringDateOnly(mess);
   mess = mess.replace(/TIDELER/g, "TIDDLER");
   if (tiddlerTitle != null)
   {
      mess = mess.replace(/TIDDLERNAME/g, tiddlerTitle);
      mess = mess.replace(/TIDDLER/g, "[[" + tiddlerTitle + "]]");
   }
   
   mess = mess.replace("DIFF", diffString).replace("TITLE", reminderTitle).replace("DATE", matchedDate.formatString("DDD MMM DD, YYYY")).replace("ANNIVERSARY", anniversaryString);
   return mess;
};

// Parse out the macro parameters into a hashtable.  This
// handles the arguments for reminder, showReminders and 
// displayTiddlersWithReminders.
window.getParamsForReminder = function getParamsForReminder(params)
{
   var dateHash = {};
   var type = "";
   var num = 0;
   var title = "";
   for(var t=0; t<params.length; t++)
   {
      var split = params[t].split(":");
      type = split[0].toLowerCase();
      var value = split[1];
      for (var i=2; i < split.length; i++)
      {
         value += ":" + split[i];
      }
      if (type == "nolinks" || type == "limit" || type == "hidden")
      {
         num = 1;
      }
      else if (type == "leadtime")
      {
         var leads = value.split("...");
         if (leads.length == 1)
         {
            leads[1]= leads[0];
            leads[0] = 0;
         }
         leads[0] = parseInt(leads[0], 10);
         leads[1] = parseInt(leads[1], 10);
         num = leads;
      }
      else if (type == "offsetdayofweek")
      {
          if (value.substr(0,1) == "-")
          {
             dateHash["negativeOffsetDayOfWeek"] = 1;
	     value = value.substr(1);
          }
          num = parseInt(value, 10);
      }
      else if (type != "title" && type != "tag" && type != "format")
      {
         num = parseInt(value, 10);
      }
      else
      {
         title = value;
         t++;
         while (title.substr(0,1) == '"' && title.substr(title.length - 1,1) != '"' && params[t] != undefined)
         {
            title += " " + params[t++];
         }
         //Trim off the leading and trailing quotes
         if (title.substr(0,1) == "\"" && title.substr(title.length - 1,1)== "\"")
         {
            title = title.substr(1, title.length - 2);
            t--;
         }
         num = title;
      }
      dateHash[type] = num;
   }
   //date is synonymous with day
   if (dateHash["day"] == null)
   {
      dateHash["day"] = dateHash["date"];
   }
   return dateHash;
};

//This function finds the date specified in the reminder 
//parameters.  It will return null if no match can be
//found.  This function is not intended to be used by
//other plugins.
window.findDateForReminder= function findDateForReminder( dateHash, baseDate, leadTimeLowerBound, leadTimeUpperBound)
{
   if (baseDate == null)
   {
     baseDate = new Date().getMidnight();
   }
   var hashKey = baseDate.convertToYYYYMMDDHHMM();
   for (var k in dateHash)
   {
      hashKey += "," + k + "|" + dateHash[k];
   }
   hashKey += "," + leadTimeLowerBound.convertToYYYYMMDDHHMM();
   hashKey += "," + leadTimeUpperBound.convertToYYYYMMDDHHMM();
   if (reminderCache[hashKey] == null)
   {
      //If we don't find a match in this run, then we will
      //cache that the reminder can't be matched.
      reminderCache[hashKey] = false;
   }
   else if (reminderCache[hashKey] == false)
   {
      //We've already tried this date and failed
      return null;
   }
   else
   {
      return reminderCache[hashKey];
   }
   
   var bOffsetSpecified = dateHash["offsetyear"] != null || 
				dateHash["offsetmonth"] != null || 
				dateHash["offsetday"] != null || 
				dateHash["offsetdayofweek"] != null || 
				dateHash["recurdays"] != null;
   
   // If we are matching the base date for a dayofweek offset, look for the base date a 
   //little further back.
   var tmp1leadTimeLowerBound = leadTimeLowerBound;  
   if ( dateHash["offsetdayofweek"] != null)
   {
      tmp1leadTimeLowerBound = leadTimeLowerBound.addDays(-6);  
   }
   var matchedDate = baseDate.findMatch(dateHash, tmp1leadTimeLowerBound, leadTimeUpperBound);
   if (matchedDate != null)
   {
      var newMatchedDate = matchedDate;
      if (dateHash["recurdays"] != null)
      {
         while (newMatchedDate.getTime() < leadTimeLowerBound.getTime())
         {
            newMatchedDate = newMatchedDate.addDays(dateHash["recurdays"]);
         }
      }
      else if (dateHash["offsetyear"] != null || 
		dateHash["offsetmonth"] != null || 
		dateHash["offsetday"] != null || 
		dateHash["offsetdayofweek"] != null)
      {
         var tmpdateHash = cloneParams(dateHash);
         tmpdateHash["year"] = dateHash["offsetyear"];
         tmpdateHash["month"] = dateHash["offsetmonth"];
         tmpdateHash["day"] = dateHash["offsetday"];
         tmpdateHash["dayofweek"] = dateHash["offsetdayofweek"];
	 var tmpleadTimeLowerBound = leadTimeLowerBound;
	 var tmpleadTimeUpperBound = leadTimeUpperBound;
	 if (tmpdateHash["offsetdayofweek"] != null)
	 {
	 	if (tmpdateHash["negativeOffsetDayOfWeek"] == 1)
		{
		   tmpleadTimeLowerBound = matchedDate.addDays(-6);
		   tmpleadTimeUpperBound = matchedDate;

		}
		else
		{
		   tmpleadTimeLowerBound = matchedDate;
		   tmpleadTimeUpperBound = matchedDate.addDays(6);
		}

	 }
	 newMatchedDate = matchedDate.findMatch(tmpdateHash, tmpleadTimeLowerBound, tmpleadTimeUpperBound);
         //The offset couldn't be matched.  return null.
         if (newMatchedDate == null)
         {
            return null;
         }
      }
      if (newMatchedDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
      {
         reminderCache[hashKey] = newMatchedDate;
         return newMatchedDate;
      }
   }
   return null;
};

//This does much the same job as findDateForReminder, but
//this one doesn't deal with offsets or recurring 
//reminders.
Date.prototype.findMatch = function findMatch(dateHash, leadTimeLowerBound, leadTimeUpperBound)
{

   var bSpecifiedYear =     (dateHash["year"] != null);
   var bSpecifiedMonth =     (dateHash["month"] != null);
   var bSpecifiedDay =     (dateHash["day"] != null);
   var bSpecifiedDayOfWeek =     (dateHash["dayofweek"] != null);
   if (bSpecifiedYear && bSpecifiedMonth && bSpecifiedDay)
   {
      return new Date(dateHash["year"], dateHash["month"]-1, dateHash["day"], 0, 0);
   }
   var bMatchedYear = !bSpecifiedYear;
   var bMatchedMonth = !bSpecifiedMonth;
   var bMatchedDay = !bSpecifiedDay;
   var bMatchedDayOfWeek = !bSpecifiedDayOfWeek;
   if (bSpecifiedDay && bSpecifiedMonth && !bSpecifiedYear && !bSpecifiedDayOfWeek)
   {

      //Shortcut -- First try this year.  If it's too small, try next year.
      var tmpMidnight = this.getMidnight();
      var tmpDate = new Date(this.getFullYear(), dateHash["month"]-1, dateHash["day"], 0,0);
      if (tmpDate.getTime() < leadTimeLowerBound.getTime())
      {
         tmpDate = new Date((this.getFullYear() + 1), dateHash["month"]-1, dateHash["day"], 0,0);
      }
      if ( tmpDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
      {
         return tmpDate;
      }
      else
      {
         return null;
      }
   }

   var newDate = leadTimeLowerBound; 
   while (newDate.isBetween(leadTimeLowerBound, leadTimeUpperBound))
   {
      var tmp = testDate(newDate, dateHash, bSpecifiedYear, bSpecifiedMonth, bSpecifiedDay, bSpecifiedDayOfWeek);
      if (tmp != null)
        return tmp;
      newDate = newDate.addDays(1);
   }
};

function testDate(testMe, dateHash, bSpecifiedYear, bSpecifiedMonth, bSpecifiedDay, bSpecifiedDayOfWeek)
{
   var bMatchedYear = !bSpecifiedYear;
   var bMatchedMonth = !bSpecifiedMonth;
   var bMatchedDay = !bSpecifiedDay;
   var bMatchedDayOfWeek = !bSpecifiedDayOfWeek;
   if (bSpecifiedYear)
   {
      bMatchedYear = (dateHash["year"] == testMe.getFullYear());
   }
   if (bSpecifiedMonth)
   {
      bMatchedMonth = ((dateHash["month"] - 1)  == testMe.getMonth() );
   }
   if (bSpecifiedDay)
   {
      bMatchedDay = (dateHash["day"] == testMe.getDate());
   }
   if (bSpecifiedDayOfWeek)
   {
      bMatchedDayOfWeek = (dateHash["dayofweek"] == testMe.getDay());
   }

   if (bMatchedYear && bMatchedMonth && bMatchedDay && bMatchedDayOfWeek)
   {
      return testMe;
   }
};

//Returns true if the date is in between two given dates
Date.prototype.isBetween = function isBetween(lowerBound, upperBound)
{
  return (this.getTime() >= lowerBound.getTime() && this.getTime() <= upperBound.getTime());
}
//Return a new date, with the time set to midnight (0000)
Date.prototype.getMidnight = function getMidnight()
{
   return new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0);
};
// Add the specified number of days to a date.
Date.prototype.addDays = function addDays(numberOfDays)
{
   return new Date(this.getFullYear(), this.getMonth(), this.getDate() + numberOfDays, 0, 0);
};
//Return the number of days between two dates.
Date.prototype.getDifferenceInDays = function getDifferenceInDays(otherDate)
{
//I have to do it this way, because this way ignores daylight savings
   var tmpDate = this.addDays(0);
   if (this.getTime() > otherDate.getTime())
   {
      var i = 0;
      for (i = 0; tmpDate.getTime() > otherDate.getTime(); i++)
      {
         tmpDate = tmpDate.addDays(-1);
      }
      return i;
   }
   else
   {
      var i = 0;
      for (i = 0; tmpDate.getTime() < otherDate.getTime(); i++)
      {
         tmpDate = tmpDate.addDays(1);
      }
      return i * -1;
   }
   return 0;
};
function cloneParams(what) {
    var tmp = {};
    for (var i in what) {
        tmp[i] = what[i];
    }
    return tmp;
}
// Substitute date components into a string
Date.prototype.formatStringDateOnly = function formatStringDateOnly(template)
{
	template = template.replace("YYYY",this.getFullYear());
	template = template.replace("YY",String.zeroPad(this.getFullYear()-2000,2));
	template = template.replace("MMM",config.messages.dates.months[this.getMonth()]);
	template = template.replace("0MM",String.zeroPad(this.getMonth()+1,2));
	template = template.replace("MM",this.getMonth()+1);
	template = template.replace("DDD",config.messages.dates.days[this.getDay()]);
	template = template.replace("0DD",String.zeroPad(this.getDate(),2));
	template = template.replace("DD",this.getDate());
	return template;
};

//}}}
!!Reminders (45 Day Outlook)
{{centeredTable{
<<showReminders leadtime:45 format:"| DIFF | DATE | ANNIVERSARY | TITLE | TIDDLER |" tag:"!Completed !Trash">>
}}}{{center{
+++[Reminders -45 Days]
<<showReminders leadtime:-45...-1 tag:"!Completed !Trash">>
===}}}
/***
|Name:|RenameTagsPlugin|
|Description:|Allows you to easily rename or delete tags across multiple tiddlers|
|Version:|3.0 ($Rev: 5501 $)|
|Date:|$Date: 2008-06-10 23:11:55 +1000 (Tue, 10 Jun 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,clearChangeCount,created) {
			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,clearChangeCount,created);
		},

		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();

//}}}
/***
|Name:|SaveCloseTiddlerPlugin|
|Description:|Provides two extra toolbar commands, saveCloseTiddler and cancelCloseTiddler|
|Version:|3.0 ($Rev: 5502 $)|
|Date:|$Date: 2008-06-10 23:31:39 +1000 (Tue, 10 Jun 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(ev,src,title) {
			var closeTitle = title;
			var newTitle = story.saveTiddler(title,ev.shiftKey);
			if (newTitle)
				closeTitle = newTitle;
			return config.commands.closeTiddler.handler(ev,src,closeTitle);
		}
	},

	cancelCloseTiddler: {
		text: 'cancel/close',
		tooltip: 'Undo changes to this tiddler and close it',
		handler: function(ev,src,title) {
			// the same as closeTiddler now actually
			return config.commands.closeTiddler.handler(ev,src,title);
		}
	}

});

//}}}
/***
|Name|SearchOptionsPlugin|
|Source|http://www.TiddlyTools.com/#SearchOptionsPlugin|
|Documentation|http://www.TiddlyTools.com/#SearchOptionsPluginInfo|
|Version|3.0.5|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|Story.prototype.search, TiddlyWiki.prototype.search, config.macros.search.onKeyPress|
|Options|##Configuration|
|Description|extend core search function with additional user-configurable options|
Adds extra options to core search function including selecting which data items to search, enabling/disabling incremental key-by-key searches, and generating a ''list of matching tiddlers'' instead of immediately displaying all matches.  This plugin also adds syntax for rendering 'search links' within tiddler content to embed one-click searches using pre-defined 'hard-coded' search terms.
!!!!!Documentation
>see [[SearchOptionsPluginInfo]]
!!!!!Configuration
<<<
Search in:
<<option chkSearchTitles>> titles <<option chkSearchText>> text <<option chkSearchTags>> tags <<option chkSearchFields>> fields <<option chkSearchShadows>> shadows
<<option chkSearchHighlight>> Highlight matching text in displayed tiddlers
<<option chkSearchList>> Show list of matches
<<option chkSearchListTiddler>> Write list to [[SearchResults]] tiddler
<<option chkSearchTitlesFirst>> Show title matches first
<<option chkSearchByDate>> Sort matching tiddlers by modification date (most recent first)
<<option chkIncrementalSearch>> Incremental key-by-key search: {{twochar{<<option txtIncrementalSearchMin>>}}} or more characters,  {{threechar{<<option txtIncrementalSearchDelay>>}}} msec delay
<<option chkSearchOpenTiddlers>> Search only in tiddlers that are currently displayed
<<option chkSearchExcludeTags>> Exclude tiddlers tagged with: <<option txtSearchExcludeTags>>
<<<
!!!!!Revisions
<<<
2009.01.16 [3.0.5] added chkSearchOpenTiddlers option to limit searches to displayed tiddlers only
|please see [[SearchOptionsPluginInfo]] for additional revision details|
2005.10.18 [1.0.0] Initial Release
<<<
!!!!!Code
***/
//{{{
version.extensions.SearchOptionsPlugin= {major: 3, minor: 0, revision: 5, date: new Date(2009,1,16)};

var co=config.options; // abbrev
if (co.chkSearchTitles===undefined) co.chkSearchTitles=true;
if (co.chkSearchText===undefined) co.chkSearchText=true;
if (co.chkSearchTags===undefined) co.chkSearchTags=true;
if (co.chkSearchFields===undefined) co.chkSearchFields=true;
if (co.chkSearchTitlesFirst===undefined) co.chkSearchTitlesFirst=true;
if (co.chkSearchList===undefined) co.chkSearchList=true;
if (co.chkSearchHighlight===undefined) co.chkSearchHighlight=true;
if (co.chkSearchListTiddler===undefined) co.chkSearchListTiddler=false;
if (co.chkSearchByDate===undefined) co.chkSearchByDate=false;
if (co.chkIncrementalSearch===undefined) co.chkIncrementalSearch=true;
if (co.chkSearchShadows===undefined) co.chkSearchShadows=true;
if (co.txtIncrementalSearchDelay===undefined) co.txtIncrementalSearchDelay=500;
if (co.txtIncrementalSearchMin===undefined) co.txtIncrementalSearchMin=3;
if (co.chkSearchOpenTiddlers===undefined) co.chkSearchOpenTiddlers=false;
if (co.chkSearchExcludeTags===undefined) co.chkSearchExcludeTags=true;
if (co.txtSearchExcludeTags===undefined) co.txtSearchExcludeTags="excludeSearch";
if (config.macros.search.reportTitle==undefined)
	config.macros.search.reportTitle="SearchResults"; // note: not a cookie!
config.macros.search.label+="\xa0"; // a little bit of space just because it looks better
//}}}
// // searchLink: {{{[search[text to find]] OR [search[text to display|text to find]]}}}
//{{{
config.formatters.push( {
	name: "searchLink",
	match: "\\[search\\[",
	lookaheadRegExp: /\[search\[(.*?)(?:\|(.*?))?\]\]/mg,
	prompt: "search for: '%0'",
	handler: function(w)
	{
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			var label=lookaheadMatch[1];
			var text=lookaheadMatch[2]||label;
			var prompt=this.prompt.format([text]);
			var btn=createTiddlyButton(w.output,label,prompt,
				function(){story.search(this.getAttribute("searchText"))},"searchLink");
			btn.setAttribute("searchText",text);
			w.nextMatch = this.lookaheadRegExp.lastIndex;
		}
	}
});
//}}}
// // incremental search uses option settings instead of hard-coded delay and minimum input values
//{{{
var fn=config.macros.search.onKeyPress;
fn=fn.toString().replace(/500/g, "config.options.txtIncrementalSearchDelay||500");
fn=fn.toString().replace(/> 2/g, ">=(config.options.txtIncrementalSearchMin||3)");
eval("config.macros.search.onKeyPress="+fn);
//}}}
// // REPLACE story.search() for option to "show search results in a list"
//{{{
Story.prototype.search = function(text,useCaseSensitive,useRegExp)
{
	var co=config.options; // abbrev
	var re=new RegExp(useRegExp ? text : text.escapeRegExp(),useCaseSensitive ? "mg" : "img");
	if (config.options.chkSearchHighlight) highlightHack=re;
	var matches = store.search(re,co.chkSearchByDate?"modified":"title","");
	if (co.chkSearchByDate) matches=matches.reverse(); // most recent first
	var q = useRegExp ? "/" : "'";
	clearMessage();
	if (!matches.length) {
		if (co.chkSearchListTiddler) discardSearchResults();
		displayMessage(config.macros.search.failureMsg.format([q+text+q]));
	} else {
		if (co.chkSearchList||co.chkSearchListTiddler) 
			reportSearchResults(text,matches);
		else {
			var titles = []; for(var t=0; t<matches.length; t++) titles.push(matches[t].title);
			this.closeAllTiddlers(); story.displayTiddlers(null,titles);
			displayMessage(config.macros.search.successMsg.format([matches.length, q+text+q]));
		}
	}
	highlightHack = null;
}
//}}}
// // REPLACE store.search() for enhanced searching/sorting options
//{{{
TiddlyWiki.prototype.search = function(searchRegExp,sortField,excludeTag)
{
	var co=config.options; // abbrev
	var tids = this.reverseLookup("tags",excludeTag,false,sortField);
	var opened=[]; story.forEachTiddler(function(tid,elem){opened.push(tid);});

	// eliminate tiddlers tagged with excluded tags
	if (co.chkSearchExcludeTags&&co.txtSearchExcludeTags.length) {
		var ex=co.txtSearchExcludeTags.readBracketedList();
		var temp=[]; for(var t=tids.length-1; t>=0; t--)
			if (!tids[t].tags.containsAny(ex)) temp.push(tids[t]);
		tids=temp;
	}

	// scan for matching titles first...
	var results = [];
	if (co.chkSearchTitles) {
		for(var t=0; t<tids.length; t++) {
			if (co.chkSearchOpenTiddlers && !opened.contains(tids[t].title)) continue; 
			if(tids[t].title.search(searchRegExp)!=-1) results.push(tids[t]);
		}
		if (co.chkSearchShadows)
			for (var t in config.shadowTiddlers) {
				if (co.chkSearchOpenTiddlers && !opened.contains(t)) continue; 
				if ((t.search(searchRegExp)!=-1) && !store.tiddlerExists(t))
					results.push((new Tiddler()).assign(t,config.shadowTiddlers[t]));
			}
	}
	// then scan for matching text, tags, or field data
	for(var t=0; t<tids.length; t++) {
		if (co.chkSearchOpenTiddlers && !opened.contains(tids[t].title)) continue; 
		if (co.chkSearchText && tids[t].text.search(searchRegExp)!=-1)
			results.pushUnique(tids[t]);
		if (co.chkSearchTags && tids[t].tags.join(" ").search(searchRegExp)!=-1)
			results.pushUnique(tids[t]);
		if (co.chkSearchFields && store.forEachField!=undefined)
			store.forEachField(tids[t],
				function(tid,field,val) {
					if (val.search(searchRegExp)!=-1) results.pushUnique(tids[t]);
				},
				true); // extended fields only
	}
	// then check for matching text in shadows
	if (co.chkSearchShadows)
		for (var t in config.shadowTiddlers) {
			if (co.chkSearchOpenTiddlers && !opened.contains(t)) continue; 
			if ((config.shadowTiddlers[t].search(searchRegExp)!=-1) && !store.tiddlerExists(t))
				results.pushUnique((new Tiddler()).assign(t,config.shadowTiddlers[t]));
		}

	// if not 'titles first', or sorting by modification date,
	// re-sort results to so titles, text, tag and field matches are mixed together
	if(!sortField) sortField = "title";
	var bySortField=function(a,b){
		if(a[sortField]==b[sortField])return(0);else return(a[sortField]<b[sortField])?-1:+1;
	}
	if (!co.chkSearchTitlesFirst || co.chkSearchByDate) results.sort(bySortField);

	return results;
}
//}}}
// // HIJACK core {{{<<search>>}}} macro to add "report" and "simple inline" output
//{{{
config.macros.search.SOP_handler=config.macros.search.handler;
config.macros.search.handler = function(place,macroName,params)
{
	// if "report", use SearchOptionsPlugin report generator for inline output
	if (params[1]&&params[1].substr(0,6)=="report") {
		var keyword=params[0];
		var options=params[1].split("=")[1]; // split "report=option+option+..."
		var heading=params[2]?params[2].unescapeLineBreaks():"";
		var matches=store.search(new RegExp(keyword.escapeRegExp(),"img"),"title","excludeSearch");
		if (matches.length) wikify(heading+window.formatSearchResults(keyword,matches,options),place);
	} else if (params[1]) {
		var keyword=params[0];
		var heading=params[1]?params[1].unescapeLineBreaks():"";
		var seperator=params[2]?params[2].unescapeLineBreaks():", ";
		var matches=store.search(new RegExp(keyword.escapeRegExp(),"img"),"title","excludeSearch");
		if (matches.length) {
			var out=[];
			for (var m=0; m<matches.length; m++) out.push("[["+matches[m].title+"]]");
			wikify(heading+out.join(seperator),place);
		}
	} else
		config.macros.search.SOP_handler.apply(this,arguments);
};
//}}}
// // SearchResults panel handling
//{{{
setStylesheet(".searchResults { padding:1em 1em 0 1em; }","searchResults"); // matches std tiddler padding

config.macros.search.createPanel=function(text,matches,body) {

	function getByClass(e,c) { var d=e.getElementsByTagName("div");
		for (var i=0;i<d.length;i++) if (hasClass(d[i],c)) return d[i]; }
	var panel=createTiddlyElement(null,"div","searchPanel","searchPanel");
	this.renderPanel(panel,text,matches,body);
	var oldpanel=document.getElementById("searchPanel");
	if (!oldpanel) { // insert new panel just above tiddlers
		var da=document.getElementById("displayArea");
		da.insertBefore(panel,da.firstChild);
	} else { // if panel exists
		var oldwrap=getByClass(oldpanel,"searchResults");
		var newwrap=getByClass(panel,"searchResults");
		// if no prior content, just insert new content
		if (!oldwrap) oldpanel.insertBefore(newwrap,null);
		else {	// swap search results content but leave containing panel intact
			oldwrap.style.display='block'; // unfold wrapper if needed
			var i=oldwrap.getElementsByTagName("input")[0]; // get input field
			if (i) { var pos=this.getCursorPos(i); i.onblur=null; } // get cursor pos, ignore blur
			oldpanel.replaceChild(newwrap,oldwrap);
			panel=oldpanel; // use existing panel
		} 
	}
	this.showPanel(true,pos);
	return panel;
}

config.macros.search.renderPanel=function(panel,text,matches,body) {

	var wrap=createTiddlyElement(panel,"div",null,"searchResults");
	wrap.onmouseover = function(e){ addClass(this,"selected"); }
	wrap.onmouseout = function(e){ removeClass(this,"selected"); }
	// create toolbar: "open all", "fold/unfold", "close"
	var tb=createTiddlyElement(wrap,"div",null,"toolbar");
	var b=createTiddlyButton(tb, "open all", "open all matching tiddlers", function() {
		story.displayTiddlers(null,this.getAttribute("list").readBracketedList()); return false; },"button");
	var list=""; for(var t=0;t<matches.length;t++) list+='[['+matches[t].title+']] ';
	b.setAttribute("list",list);
	var b=createTiddlyButton(tb, "fold", "toggle display of search results", function() {
		config.macros.search.foldPanel(this); return false; },"button");
	var b=createTiddlyButton(tb, "close", "dismiss search results",	function() {
		config.macros.search.showPanel(false); return false; },"button");
	createTiddlyText(createTiddlyElement(wrap,"div",null,"title"),"Search for: "+text); // title
	wikify(body,createTiddlyElement(wrap,"div",null,"viewer")); // report
	return panel;
}

config.macros.search.showPanel=function(show,pos) {
	var panel=document.getElementById("searchPanel");
	var i=panel.getElementsByTagName("input")[0];
	i.onfocus=show?function(){config.macros.search.stayFocused(true);}:null;
	i.onblur=show?function(){config.macros.search.stayFocused(false);}:null;
	if (show && panel.style.display=="block") { // if shown, grab focus, restore cursor
		if (i&&this.stayFocused()) { i.focus(); this.setCursorPos(i,pos); }
		return;
	}
	if(!config.options.chkAnimate) {
		panel.style.display=show?"block":"none";
		if (!show) { removeChildren(panel); config.macros.search.stayFocused(false); }
	} else {
		var s=new Slider(panel,show,false,show?"none":"children");
		s.callback=function(e,p){e.style.overflow="visible";}
		anim.startAnimating(s);
	}
	return panel;
}

config.macros.search.foldPanel=function(button) {
	var d=document.getElementById("searchPanel").getElementsByTagName("div");
	for (var i=0;i<d.length;i++) if (hasClass(d[i],"viewer")) var v=d[i]; if (!v) return;
	var show=v.style.display=="none";
	if(!config.options.chkAnimate)
		v.style.display=show?"block":"none";
	else {
		var s=new Slider(v,show,false,"none");
		s.callback=function(e,p){e.style.overflow="visible";}
		anim.startAnimating(s);
	}
	button.innerHTML=show?"fold":"unfold";
	return false;
}

config.macros.search.stayFocused=function(keep) { // TRUE/FALSE=set value, no args=get value
	if (keep===undefined) return this.keepReportInFocus;
	this.keepReportInFocus=keep;
	return keep
}	

config.macros.search.getCursorPos=function(i) {
	var s=0; var e=0; if (!i) return { start:s, end:e };
	try {
		if (i.setSelectionRange) // FF
			{ s=i.selectionStart; e=i.selectionEnd; }
		if (document.selection && document.selection.createRange) { // IE
			var r=document.selection.createRange().duplicate();
			var len=r.text.length; s=0-r.moveStart('character',-100000); e=s+len;
		}
	}catch(e){};
	return { start:s, end:e };
}
config.macros.search.setCursorPos=function(i,pos) {
	if (!i||!pos) return; var s=pos.start; var e=pos.end;
	if (i.setSelectionRange) //FF
		i.setSelectionRange(s,e);
	if (i.createTextRange) // IE
		{ var r=i.createTextRange(); r.collapse(true); r.moveStart("character",s); r.select(); }
}
//}}}
// // SearchResults report generation
// note: these functions are defined globally, so they can be more easily redefined to customize report formats//
//{{{
if (!window.reportSearchResults) window.reportSearchResults=function(text,matches)
{
	var cms=config.macros.search; // abbrev
	var body=window.formatSearchResults(text,matches);
	if (!config.options.chkSearchListTiddler) // show #searchResults panel
		window.scrollTo(0,ensureVisible(cms.createPanel(text,matches,body)));
	else { // write [[SearchResults]] tiddler
		var title=cms.reportTitle;
		var who=config.options.txtUserName;
		var when=new Date();
		var tags="excludeLists excludeSearch temporary";
		var tid=store.getTiddler(title); if (!tid) tid=new Tiddler();
		tid.set(title,body,who,when,tags);
		store.addTiddler(tid);
		story.closeTiddler(title);
		story.displayTiddler(null,title);
	}
}

if (!window.formatSearchResults) window.formatSearchResults=function(text,matches,opt)
{
	var body='';
	var title=config.macros.search.reportTitle
	var q = config.options.chkRegExpSearch ? "/" : "'";
	if (!opt) var opt="all";
	var parts=opt.split("+");
	for (var i=0; i<parts.length; i++) { var p=parts[i].toLowerCase();
		if (p=="again"||p=="all")   body+=window.formatSearchResults_again(text,matches);
		if (p=="summary"||p=="all") body+=window.formatSearchResults_summary(text,matches);
		if (p=="list"||p=="all")    body+=window.formatSearchResults_list(text,matches);
		if (p=="buttons"||p=="all") body+=window.formatSearchResults_buttons(text,matches);
	}
	return body;
}

if (!window.formatSearchResults_again) window.formatSearchResults_again=function(text,matches)
{
	var title=config.macros.search.reportTitle
	var body='';
	// search again
	body+='{{span{<<search "'+text.replace(/"/g,'&#x22;')+'">> /%\n';
	body+='%/<html><input type="button" value="search again"';
	body+=' onclick="var t=this.parentNode.parentNode.getElementsByTagName(\'input\')[0];';
	body+=' config.macros.search.doSearch(t); return false;">';
	body+=' <a href="javascript:;" onclick="';
	body+=' var e=this.parentNode.nextSibling;';
	body+=' var show=e.style.display!=\'block\';';
	body+=' if(!config.options.chkAnimate) e.style.display=show?\'block\':\'none\';';
	body+=' else anim.startAnimating(new Slider(e,show,false,\'none\'));';
	body+=' return false;">options...</a>';
	body+='</html>@@display:none;border-left:1px dotted;margin-left:1em;padding:0;padding-left:.5em;font-size:90%;/%\n';
	body+='	%/<<option chkSearchTitles>>titles /%\n';
	body+='	%/<<option chkSearchText>>text /%\n';
	body+='	%/<<option chkSearchTags>>tags /%\n';
	body+='	%/<<option chkSearchFields>>fields /%\n';
	body+='	%/<<option chkSearchShadows>>shadows\n';
	body+='	<<option chkCaseSensitiveSearch>>case-sensitive /%\n';
	body+='	%/<<option chkRegExpSearch>>text patterns /%\n';
	body+='	%/<<option chkSearchByDate>>sorted by date\n';
	body+='	<<option chkSearchHighlight>> highlight matching text in displayed tiddlers\n';
	body+='	<<option chkIncrementalSearch>>incremental key-by-key search: /%\n';
	body+='	%/{{twochar{<<option txtIncrementalSearchMin>>}}} or more characters, /%\n';
	body+='	%/{{threechar{<<option txtIncrementalSearchDelay>>}}} msec delay\n';
	body+='	<<option chkSearchOpenTiddlers>> search only in tiddlers that are currently displayed\n';
	body+='	<<option chkSearchExcludeTags>>exclude tiddlers tagged with:\n';
	body+='	{{editor{<<option txtSearchExcludeTags>>}}}/%\n';
	body+='%/@@}}}\n\n';
	return body;
}

if (!window.formatSearchResults_summary) window.formatSearchResults_summary=function(text,matches)
{
	// summary: nn tiddlers found matching '...', options used
	var body='';
	var co=config.options; // abbrev
	var title=config.macros.search.reportTitle
	var q = co.chkRegExpSearch ? "/" : "'";
	body+="''"+config.macros.search.successMsg.format([matches.length,q+"{{{"+text+"}}}"+q])+"''\n";
	var opts=[];
	if (co.chkSearchTitles) opts.push("titles");
	if (co.chkSearchText) opts.push("text");
	if (co.chkSearchTags) opts.push("tags");
	if (co.chkSearchFields) opts.push("fields");
	if (co.chkSearchShadows) opts.push("shadows");
	if (co.chkSearchOpenTiddlers) body+="^^//search limited to displayed tiddlers only//^^\n";
	body+="~~&nbsp; searched in "+opts.join(" + ")+"~~\n";
	body+=(co.chkCaseSensitiveSearch||co.chkRegExpSearch?"^^&nbsp; using ":"")
		+(co.chkCaseSensitiveSearch?"case-sensitive ":"")
		+(co.chkRegExpSearch?"pattern ":"")
		+(co.chkCaseSensitiveSearch||co.chkRegExpSearch?"matching^^\n":"");
	return body;
}

if (!window.formatSearchResults_list) window.formatSearchResults_list=function(text,matches)
{
	// bullet list of links to matching tiddlers
	var body='';
	var pattern=co.chkRegExpSearch?text:text.escapeRegExp();
	var sensitive=co.chkCaseSensitiveSearch?"mg":"img";
	var link='{{tiddlyLinkExisting{<html><nowiki><a href="javascript:;" onclick="'
		+'if(config.options.chkSearchHighlight)'
		+'	highlightHack=new RegExp(\x27'+pattern+'\x27.escapeRegExp(),\x27'+sensitive+'\x27);'
		+'story.displayTiddler(null,\x27%0\x27);'
		+'highlightHack = null; return false;'
		+'" title="%2">%1</a></html>}}}';
	for(var t=0;t<matches.length;t++) {
		body+="* ";
		if (config.options.chkSearchByDate)
			body+=matches[t].modified.formatString('YYYY.0MM.0DD 0hh:0mm')+" ";
		var title=matches[t].title;
		var fixup=title.replace(/'/g,"\\x27").replace(/"/g,"\\x22");
		var tid=store.getTiddler(title);
		var tip=tid?tid.getSubtitle():''; tip=tip.replace(/"/g,"&quot;");
		body+=link.format([fixup,title,tip])+'\n';
	}
	return body;
}

if (!window.formatSearchResults_buttons) window.formatSearchResults_buttons=function(text,matches)
{
	// embed buttons only if writing SearchResults to tiddler
	if (!config.options.chkSearchListTiddler) return "";
	// "open all" button
	var title=config.macros.search.reportTitle;
	var body="";
	body+="@@diplay:block;<html><input type=\"button\" href=\"javascript:;\" "
		+"onclick=\"story.displayTiddlers(null,[";
	for(var t=0;t<matches.length;t++)
		body+="'"+matches[t].title.replace(/\'/mg,"\\'")+"'"+((t<matches.length-1)?", ":"");
	body+="],1);\" accesskey=\"O\" value=\"open all matching tiddlers\"></html> ";
	// "discard SearchResults" button
	body+="<html><input type=\"button\" href=\"javascript:;\" "
		+"onclick=\"discardSearchResults()\" value=\"discard "+title+"\"></html>";
	body+="@@\n";
	return body;
}

if (!window.discardSearchResults) window.discardSearchResults=function()
{
	// remove the tiddler
	story.closeTiddler(config.macros.search.reportTitle);
	store.deleteTiddler(config.macros.search.reportTitle);
	store.notify(config.macros.search.reportTitle,true);
}
//}}}
/%
|Name|SetPopupsHeight|
|Source|http://www.TiddlyTools.com/#SetPopupsHeight|
|Version|1.1.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides||
|Description|use CSS to set a scrolling, fixed or percentage height for popups (e.g. tags display)|

usage: <<tiddler SetPopupsHeight with: height>>

where 'height' is an *optional* param to override the current value (if any)

%/<script>
	// if removeCookie() function is not defined by TW core, define it here.
	if (window.removeCookie===undefined) {
		window.removeCookie=function(name) {
			document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;'; 
		}
	}
	if (config.options.txtPopupsHeight==undefined) config.options.txtPopupsHeight="auto";
	if ('$'+'1'!='$1') config.options.txtPopupsHeight='$1';
	window.setPopupsHeight=function() {
		var opt="txtPopupsHeight";
		var h=config.options[opt]; if (!h.length) h='auto';
		if (!h.replace(/[0-9]*/,"").length) h+="px"; // add "px" suffix if only numeric value
		config.options[opt]=h;
		if (h.indexOf("%")!=-1)
			h=(findWindowHeight()*parseInt(h.replace(/%/,""))/100)+"px"; // % of window
		var heightParam=(config.browser.isIE?"height":"max-height")+":"+h;
		var overflowParam='overflow:'+(h!='auto'?'auto':'hidden')+' !important'; 
		var css='.popup { '+heightParam+'; '+overflowParam+'; }';
		setStylesheet(css,"popupStyles");
		if (config.options[opt]=="auto") removeCookie(opt);
		else config.macros.option.propagateOption(opt,"value",config.options[opt],"input");
	}
	setTimeout('window.setPopupsHeight()',1); // initialize height
	if (window.addEventListener) window.addEventListener("resize",window.setPopupsHeight,false);
</script>popups height: {{smallform{<<option txtPopupsHeight>><script>
	var t=place.lastChild
	t.style.width="4em";
	t.style.textAlign="center";
	t.title="enter height using CSS dimensions (px, em, in, cm, %) or 'auto'";
	t.onfocus=function(){this.select();};
	t.onblur=function(){this.onchange();}; /* for IE */
	// hijack onchange for this field so CSS can be updated on the fly
	t.coreOnChange=t.onchange;
	t.onchange=function() {
		if (this.coreOnChange) this.coreOnChange();
		window.setPopupsHeight();
	};
</script>}}}
/%
|Name|ShowLocalDirectory|
|Source|http://www.TiddlyTools.com/#ShowLocalDirectory|
|Version|1.2.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides||
|Description|display local filesystem directory listings|

usage: <<tiddler ShowLocalDirectory>> or <<tiddler ShowLocalDirectory with: localpath format>>

where:
	"localpath" uses system-specific file naming conventions (or keyword "here" for the
	current document directory).  Note: for Windows filesystem, use doubled backslashes and
	enclose the entire path in square brackets (e.g., [[C:\\temp\\foo]])
and
	"format" determines the type of output produced:
		"plain"
			show fully-qualified path/filenames AS-IS, without any additional formatting.
		"list"
			show fully-qualified path/filenames using formatted "PrettyLinks", so that the
			local system-specific filename can be *displayed* while linking to a valid
			system-independent "file:" URL for browser navigation.
		"directory" (default)
			show header followed by a formatted table, containing PrettyLinks for
			filenames, filesizes (in bytes), and modification dates, plus a summary
			footer reporting the total file and byte counts.

%/<script>
	window.getCurrentFolder=function() {
		var h=document.location.href;
		return getLocalPath(decodeURIComponent(h.substr(0,h.lastIndexOf("/")+1)));
	}
	window.getParentFolder=function(cwd) {
		var lastchar=cwd.substr(cwd.length-1,1);
		if (lastchar=="/" || lastchar=="\\") cwd=cwd.substr(0,cwd.length-1);
		var pos=cwd.lastIndexOf("/"); if (pos==-1) pos=cwd.lastIndexOf("\\");
		return pos!=-1?cwd.substr(0,pos+1):null;
	}
	window.askForFolder=function(cwd) {
		if (config.browser.isIE) {
			try { // XPSP2 IE only
				var s = new ActiveXObject('UserAccounts.CommonDialog');
				s.InitialDir=cwd.replace(/\//g,"\\");
				s.FileName=''; s.Filter='All files|*.*|'; s.FilterIndex=1;
				var path=s.showOpen()?s.FileName.substr(0,s.FileName.lastIndexOf("\\")+1):null;
			}
			catch(e) { var path=prompt("Enter a directory path:",cwd.replace(/\//g,"\\"));	}
		} else { // FireFox
			if(!window.Components) return;
			try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); }
			catch(e) { alert(e.description?e.description:e.toString()); return; }
			var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
			var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
			picker.init(window, "Select a folder", nsIFilePicker.modeGetFolder);
			var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
			try { thispath.initWithPath(cwd.replace(/\\/g,"/")); }
			catch(e) { thispath.initWithPath(getLocalPath(decodeURIComponent(document.location.href.substr(0,document.location.href.lastIndexOf("/")+1)))); }
			picker.displayDirectory=thispath;
			picker.appendFilters(nsIFilePicker.filterAll); picker.defaultString=''; picker.defaultExtension=''; 
			var path=picker.show()!=nsIFilePicker.returnCancel?picker.file.persistentDescriptor:null;
		}
		return path;
	}

	window.getFileList=function(cwd) { // returns array of file info (path,name,size,isFolder,url,modified)
		var files=[];
		if (config.browser.isIE) {
			cwd=cwd.replace(/\//g,"\\");
			var fso = new ActiveXObject("Scripting.FileSystemObject");
			if(!fso.FolderExists(cwd)) return [];
			var dir=fso.GetFolder(cwd);
			for(var f=new Enumerator(dir.SubFolders); !f.atEnd(); f.moveNext())
				files.push({ path:f.item().path, name:f.item().name, size:f.item().size,
					url:"file:///"+f.item().path.replace(/\\/g,"/"), isFolder:fso.FolderExists(f.item().path),
					modified:new Date(f.item().DateLastModified).formatString("YYYY.0MM.0DD 0hh:0mm:0ss")});
			for(var f=new Enumerator(dir.Files); !f.atEnd(); f.moveNext())
				files.push({ path:f.item().path, name:f.item().name, size:f.item().size,
					url:"file:///"+f.item().path.replace(/\\/g,"/"), isFolder:fso.FolderExists(f.item().path),
					modified:new Date(f.item().DateLastModified).formatString("YYYY.0MM.0DD 0hh:0mm:0ss")});
		} else { // FF
			if(!window.Components) return;
			try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); }
			catch(e) { alert(e.description?e.description:e.toString()); return null; }
			var file=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
			try { file.initWithPath(cwd); } catch(e) { return []; }
			if (!file.exists() || !file.isDirectory()) { return []; }
			var folder=file.directoryEntries;
			while (folder.hasMoreElements()) {
				var f=folder.getNext().QueryInterface(Components.interfaces.nsILocalFile);
				if (f instanceof Components.interfaces.nsILocalFile)
					files.push({path:f.path, name:f.leafName, size:f.fileSize,
						isFolder:f.isDirectory(), url:"file:///"+f.path.replace(/\\/g,"/"),
						modified:new Date(f.lastModifiedTime).formatString("YYYY.0MM.0DD 0hh:0mm:0ss")});
			}
		}
		return files;
	}

	window.renderDirectoryList=function(target,cwd,fmt) {
		var files=getFileList(cwd);
		if (!files||!files.length) { // maybe relative directory... fixup and try again...
			var fixup=getCurrentFolder()+cwd;
			var files=getFileList(fixup);
			if (!files||!files.length) {
				var out="{{errorButton{error reading "+cwd+"}}}";
				removeChildren(target); wikify(out,target);
				target.style.display="block";
				return false;
			} else cwd=fixup;
		}
		if (!cwd||!cwd.length) cwd=config.options.txtLocalDirectory;
		if (!cwd||!cwd.length) cwd=getCurrentFolder();
		config.options.txtLocalDirectory=cwd;
		var header=""; var item=""; var folderitem=""; var folderscript=""; var footer="";
		switch (fmt) {
			case "plain": item=folderitem="<nowiki>%0</nowiki>\n"; break;
			case "list": item=folderitem="[[%1|file:///%0]]\n"; break;
			default:
				var header="Index of {{{%0}}}\n^^(as of %1)^^\n|filename&nbsp;&nbsp;| size&nbsp;&nbsp;|modified|h\n";
				var item="|[[%1|%2]]&nbsp;&nbsp;| %3&nbsp;&nbsp;|%4|\n";
				var folderscript='<'+'script label="%1" title="open %1...">';
				folderscript+='		var t=place.parentNode.parentNode.parentNode.parentNode.parentNode;';
				folderscript+='		window.renderDirectoryList(t,"%0","");';
				folderscript+='		return false;';
				folderscript+='	</'+'script>';
				var folderitem='|'+folderscript+'&nbsp;&nbsp;| |%4|\n';
				var footer="|>|>|>| !Total of %0 bytes in %1 files |f\n|borderless sortable|k\n";
				var showDirectory=true;
				break;
		}
		var out=header.format([cwd,new Date().toLocaleString()]);
		if (showDirectory) {
			var p=getParentFolder(cwd);
			if (p) files.unshift({path:p, name:"(parent folder)", size:0, isFolder:true, url:"file:///"+p.replace(/\\/g,"/"),
				modified:new Date().formatString("YYYY.0MM.0DD 0hh:0mm:0ss")});
		}
		var total=0;
		for (var i=0; i<files.length; i++) {
			var line=(files[i].isFolder?folderitem:item).format([files[i].path,files[i].name,files[i].url,files[i].size,files[i].modified]);
			if (showDirectory) line=line.replace(/\\/g,"\\\\"); // fixup for PC-style file paths embedded in 'folderscript'
			if (!files[i].isFolder) total+=files[i].size;
			out+=line;
		}
		out+=footer.format([total,files.length]);
		removeChildren(target); wikify(out,target); target.style.display="block";

		// make table sortable (code adapted from [[TableSortingPlugin]]
		var c = config.tableSorting; if (!c) return; // no sortable tables
		var table = target.getElementsByTagName("table")[0];
		var x=null, rev, thead=table.getElementsByTagName('thead')[0], headers=thead.rows[thead.rows.length-1].cells;
		for (var j=0; j<headers.length; j++){
			var h = headers[j];
			if (hasClass(h,"nosort")) continue;
			h.setAttribute("index",j);
			h.onclick = function(){c.sortTable(this); return false;};
			h.ondblclick = stopEvent;
			if(h.getElementsByTagName("span").length == 0) createTiddlyElement(h,"span",null,"hidden",c.uarrow); 
			if(!x && hasClass(h,"autosort")) { x = j; rev = hasClass(h,"reverse"); }
		}
		if(x) c.sortTable(headers[x],rev);		
	}

</script>{{hidden small{
<script label="select a folder...">
	var path=askForFolder(getCurrentFolder());
	if (path) window.renderDirectoryList(place.parentNode.nextSibling,path,"");
	return false;
</script> | <script label="use document location...">
	window.renderDirectoryList(place.parentNode.nextSibling,getCurrentFolder(),"");
	return false;
</script> | <script label="refresh list...">
	window.renderDirectoryList(place.parentNode.nextSibling,config.options.txtLocalDirectory,"");
	return false;
</script>
----
}}}@@display:none;/% content automatically replaced %/@@<script>
	var cwd=getCurrentFolder(); // default to current folder
	if ("$1"=="$"+"1") place.lastChild.previousSibling.style.display="block"; // show 'select a folder' command
	else if ("$1".toLowerCase()=="here") cwd=getCurrentFolder(); // "here" = use document directory
	else cwd="$1"; // use path param as specified
	window.renderDirectoryList(place.lastChild,cwd,"$2");
</script>
/%
!info
|Name|ShowPopup|
|Source|http://www.TiddlyTools.com/#ShowPopup|
|Version|1.1.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|transcluded html|
|Requires||
|Overrides||
|Description|display tiddler content in a TiddlyWiki popup panel|
Usage:
<<<
{{{
<<tiddler ShowPopup with: TiddlerName label tooltip buttonClass width popupClass>>
}}}
*{{{TiddlerName}}} is the title of the tiddler whose content is to be displayed
*{{{label}}} is the text of the popup command
*{{{tooltip}}} is the mouseover help text for the command
*{{{buttonClass}}} is a CSS classname applied to the command text (default=button)
*{{{width}}} is the width of the popup (using CSS measurements, default=auto)
*{{{popupClass}}} is a CSS classname applied to the popup panel (default=none).  Use 'sticky' for persistent popups (requires  StickyPopupPlugin)
<<<
Example:
<<<
{{{
<<tiddler ShowPopup with: ShowPopup [[Try this]] [[show this tiddler in a popup]]>>
}}}
<<tiddler ShowPopup with: ShowPopup [[Try this]] [[show this tiddler in a popup]]>>
<<<
!end

!show
<html><hide linebreaks>
<a href="javascript:;" class="$4" title="$3" onclick="
	var p=Popup.create(this);if(!p)return;p.className+=' $6';var t=store.getTiddlerText('$1','');
	var d=createTiddlyElement(p,'div');var s=d.style;s.whiteSpace='normal';s.width='$5';s.padding='2px';wikify(t,d);
	Popup.show();event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return(false);
">$2</a></html>
!end

%/<<tiddler {{'ShowPopup##'+('$1'=='$'+'1'?'info':'show')}} with: [[$1]] [[$2]] [[$3]] [[$4]] [[$5]] [[$6]]>>
/%
|Name|ShowTiddlerStatistics|
|Source|http://www.TiddlyTools.com/#ShowTiddlerStatistics|
|Version|1.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides||
|Description|display document summary / tiddler stats (newest, oldest, largest, smallest, etc.)|
%/<script>
	var tiddlers=store.getTiddlers("modified","excludeLists");
	var last=tiddlers[tiddlers.length-1];
	var total=0;
	for (var i=0; i<tiddlers.length; i++) {
		total+=tiddlers[i].text.length;
		if (!oldest || tiddlers[i].created<oldest)
			{ var oldest=tiddlers[i].created; var oldtid=tiddlers[i]; }
		if (!newest || tiddlers[i].created>newest)
			{ var newest=tiddlers[i].created; var newtid=tiddlers[i]; }
		if (!smallest || tiddlers[i].text.length<smallest)
			{ var smallest=tiddlers[i].text.length; var smalltid=tiddlers[i]; }
		if (!largest || tiddlers[i].text.length>largest)
			 { var largest=tiddlers[i].text.length; var largetid=tiddlers[i]; }
	}
	var out="{{nowrap{";
	out+="There are ''"+tiddlers.length+" tiddlers'', including";
	out+=" ''<<tag systemConfig [["+store.getTaggedTiddlers("systemConfig").length+" plugins]]>>''and";
	out+=" ''<<tag Scripts [["+store.getTaggedTiddlers("Scripts").length+" Scripts]]>>''";
	out+="{{fine{("+total+" bytes)}}}\n";
	out+="|borderless|k\n";
	out+="| last change:&nbsp;|[["+last.title+"]]";
	out+=" {{fine{(updated "+last.modified.formatString("MMM DDth YYYY, 0hh:0mm")+")}}}|\n";
	out+="| newest:&nbsp;|[["+newtid.title+"]]";
	out+=" {{fine{(created "+newtid.created.formatString("MMM DDth YYYY, 0hh:0mm")+")}}}|\n";
	out+="| oldest:&nbsp;|[["+oldtid.title+"]]";
	out+=" {{fine{(created "+oldtid.created.formatString("MMM DDth YYYY, 0hh:0mm")+")}}}|\n";
	out+="| smallest:&nbsp;|[["+smalltid.title+"]]";
	out+=" {{fine{("+smalltid.text.length+" bytes)}}}|\n";
	out+="| largest:&nbsp;|[["+largetid.title+"]]";
	out+=" {{fine{("+largetid.text.length+" bytes)}}}|\n";
	out+="}}}";
	return(out);
</script>
<<tabs txtMainTab
"Tags" "All tags" TabTags 
"No Tag" "All tiddlers with no tags" [[No Tag]]
"History" "Timeline" TabTimeline 
"More" "More lists" TabMore
>>
/***
|Name|StickyPopupPlugin|
|Source|http://www.TiddlyTools.com/#StickyPopupPlugin|
|Version|1.0.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|Popup.onDocumentClick|
|Options|##Configuration|
|Description|allow mouse interactions inside popups without automatically closing them|
Usually, when a TW popup is displayed, it is automatically closed whenever a click occurs //anywhere// in the document, either //inside// or //outside// the popup itself.  This plugin makes popups persistent (a.k.a, "sticky"), allowing you to perform multiple mouse interactions on content //inside// the popup (e.g., entering form fields, opening links, selecting text, etc.), remaining visible until you click //outside// the popup or perform an action that opens another popup (only one popup can be displayed at any given time).
!!!!!Configuration
<<<
You can cause popups to behave in a persistent ("sticky") manner simply by selecting the option checkbox below.  The selected popup display behavior will be applied to ALL popups in the document automatically.
><<option chkStickyPopups>> make all popups "sticky"
>{{{usage: <<option chkStickyPopups>>}}}
<<<
!!!!!Usage
<<<
If you are developing your own plugins or inline scripts that create popups programmatically using the core function:
{{{
Popup.create(this)
}}}
you can provide additional parameters that specify the desired CSS classname(s) to assign to the popup DOM element.  The default class when none is specified is simply "popup".  To create a //sticky// popup, simply enter a custom class combination like this:
{{{
Popup.create(this,null,"sticky popup")
}}}
<<<
!!!!!Revisions
<<<
2008.05.16 [1.0.1] added try..catch around addEvent/removeEvent calls to avoid error in Opera
2007.11.25 [1.0.0] initial release - moved from [[CoreTweaks]]
<<<
!!!!!Code
***/
//{{{
version.extensions.StickyPopupPlugin= {major: 1, minor: 0, revision: 1, date: new Date(2008,5,16)};

if (config.options.chkStickyPopups==undefined) config.options.chkStickyPopups=false;

Popup.stickyPopup_onDocumentClick = function(ev)
{
	// if click is in a sticky popup, ignore it so popup will remain visible
	var e = ev ? ev : window.event; var target = resolveTarget(e);
	var p=target; while (p) {
		if (hasClass(p,"popup") && (hasClass(p,"sticky")||config.options.chkStickyPopups)) break;
		else p=p.parentNode;
	}
	if (!p) // not in sticky popup (or sticky popups disabled)... use normal click handling
		Popup.onDocumentClick(ev);
	return true;
};
try{removeEvent(document,"click",Popup.onDocumentClick);}catch(e){};
try{addEvent(document,"click",Popup.stickyPopup_onDocumentClick);}catch(e){};
//}}}
/***
|Name|StyleSheetPrint|
|Version|09/30/08 MTP|
|~CoreVersion|2.1|
|Type|CSS|
|Description|adjustments for printing|
***/

/*{{{*/
@media print {

#mainMenu, #sidebar, #messageArea, #toolbar, #hoverMenu, .toolbar, .tagged, .tagging, #tiddlersBar .tab, .subtitle, .header, #backstageArea, #backstageButton, #topMenu, .siteTitle, .siteSubtitle, .tiddler .subtitle, .tiddler .tagging, .tiddler .tagged, .tiddler .toolbar, .hoverMenu, .hD, .tagglyTagged
	{display: none !important;}
#breadCrumbs, #siteMenu, #storyMenu
	{ display:none !important; }
#displayArea
	{ margin: 1em !important; }
noscript /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
	{ display:none; }

/* not sure if we need all the importants */
.tiddler {
	overflow:visible;
	border-style: none ! important;
	margin:0px ! important;
	padding:0px ! important;
	padding-bottom:2em ! important;
	page-break-after: auto;
	page-break-before: auto;
}
.tagglyTagging .button, .tagglyTagging .hidebutton {
	display: none ! important;
}
.headerShadow {
visibility: hidden ! important;
}
.tagglyTagged .quickopentag, .tagged .quickopentag, .hD, .fD {
	border-style: none ! important;
}
.quickopentag a.button, .miniTag {
	display: none ! important;
}
}
/*}}}*/
/***
|Name|StyleSheetShortcuts|
|Source|http://www.TiddlyTools.com/#StyleSheetShortcuts|
|Version||
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|CSS|
|Requires||
|Overrides||
|Description|'convenience' classes for common formatting, alignment, boxes, tables, etc.|

These 'style tweaks' can be easily included in other stylesheet tiddler so they can share a baseline look-and-feel that can then be customized to create a wide variety of 'flavors'.
***/
/*{{{*/

/* text alignments */
.left
	{ display:block;text-align:left; }
.center
	{ display:block;text-align:center; }
.center table
	{ margin:auto !important; }
.right	
	{ display:block;text-align:right; }
.justify
	{ display:block;text-align:justify; }
.indent
	{ display:block;margin:0;padding:0;border:0;margin-left:2em; }
.floatleft
	{ float:left; }
.floatright
	{ float:right; }
.valignTop, .valignTop table, .valignTop tbody, .valignTop th, .valignTop tr, .valignTop td
	{ vertical-align:top; }
.valignBottom, .valignBottom table, .valignBottom tbody, .valignBottom th, .valignBottom tr, .valignBottom td
	{ vertical-align:bottom; }
.valignMiddle, .valignMiddle table, .valignMiddle tbody, .valignMiddle th, .valignMiddle tr, .valignMiddle td
	{ vertical-align:middle; }
.clear
	{ clear:both; }
.wrap
	{ white-space:normal; }
.nowrap
	{ white-space:nowrap; }
.hidden
	{ display:none; }
.show
	{ display:inline !important; }
.span
	{ display:span; }
.block
	{ display:block; }
.relative
	{ position:relative; }
.absolute
	{ position:absolute; }

/* font sizes */
.big
	{ font-size:14pt;line-height:120% }
.medium
	{ font-size:12pt;line-height:120% }
.normal
	{ font-size:9pt;line-height:120% }
.small
	{ font-size:8pt;line-height:120% }
.fine
	{ font-size:7pt;line-height:120% }
.tiny
	{ font-size:6pt;line-height:120% }
.larger
	{ font-size:120%; }
.smaller
	{ font-size:80%; }

/* font styles */
.bold
	{ font-weight:bold; }
.italic
	{ font-style:italic; }
.underline
	{ text-decoration:underline; }

/* plain list items (no bullets or indent) */
.nobullets li { list-style-type: none; margin-left:-2em; }

/* multi-column tiddler content (not supported in Internet Explorer) */
.twocolumns { display:block;
	-moz-column-count:2; -moz-column-gap:1em; -moz-column-width:50%; /* FireFox */
	-webkit-column-count:2; -webkit-column-gap:1em; -webkit-column-width:50%; /* Safari */
	column-count:2; column-gap:1em; column-width:50%; /* Opera */
}
.threecolumns { display:block;
	-moz-column-count:3; -moz-column-gap:1em; -moz-column-width:33%; /* FireFox */
	-webkit-column-count:3; -webkit-column-gap:1em; -webkit-column-width:33%; /* Safari */
	column-count:3; column-gap:1em; column-width:33%; /* Opera */
}
.fourcolumns { display:block;
	-moz-column-count:4; -moz-column-gap:1em; -moz-column-width:25%; /* FireFox */
	-webkit-column-count:4; -webkit-column-gap:1em; -webkit-column-width:25%; /* Safari */
	column-count:4; column-gap:1em; column-width:25%; /* Opera */
}

/* show/hide browser-specific content for InternetExplorer vs. non-IE ("moz") browsers */
*[class="ieOnly"]
	{ display:none; } /* hide in moz (uses CSS selector) */
* html .mozOnly, *:first-child+html .mozOnly
	{ display: none; } /* hide in IE (uses IE6/IE7 CSS hacks) */

/* borderless tables */
.borderless, .borderless table, .borderless td, .borderless tr, .borderless th, .borderless tbody
	{ border:0 !important; margin:0 !important; padding:0 !important; }
.widetable, .widetable table
	{ width:100%; }

/* thumbnail images (fixed-sized scaled images) */
.thumbnail img { height:5em !important; }

/* stretchable images (auto-size to fit tiddler) */
.stretch img { width:95%; }

/* grouped content */
.outline
	{ display:block; padding:1em; -moz-border-radius:1em;-webkit-border-radius:1em; border:1px solid; }
.menubox
	{ display:block; padding:1em; -moz-border-radius:1em;-webkit-border-radius:1em; border:1px solid; background:#fff; color:#000; }
.menubox .button, .menubox .tiddlyLinkExisting, .menubox .tiddlyLinkNonExisting
	{ color:#009 !important; }
.groupbox
	{ display:block; padding:1em; -moz-border-radius:1em;-webkit-border-radius:1em; border:1px solid; background:#ffe; color:#000; }
.groupbox a, .groupbox .button, .groupbox .tiddlyLinkExisting, .groupbox .tiddlyLinkNonExisting
	{ color:#009 !important; }
.groupbox code
	{ color:#333 !important; }
.borderleft
	{ margin:0;padding:0;border:0;margin-left:1em; border-left:1px dotted; padding-left:.5em; }
.borderright
	{ margin:0;padding:0;border:0;margin-right:1em; border-right:1px dotted; padding-right:.5em; }
.borderbottom
	{ margin:0;padding:1px 0;border:0;border-bottom:1px dotted; margin-bottom:1px; padding-bottom:1px; }
.bordertop
	{ margin:0;padding:0;border:0;border-top:1px dotted; margin-top:1px; padding-top:1px; }

/* scrolled content */
.scrollbars { overflow:auto; }
.height10em { height:10em; }
.height15em { height:15em; }
.height20em { height:20em; }
.height25em { height:25em; }
.height30em { height:30em; }
.height35em { height:35em; }
.height40em { height:40em; }

/* compact form */
.smallform
	{ white-space:nowrap; }
.smallform input, .smallform textarea, .smallform button, .smallform checkbox, .smallform radio, .smallform select
	{ font-size:8pt; }

/* stretchable edit fields and textareas (auto-size to fit tiddler) */
.stretch input { width:99%; }
.stretch textarea { width:99%; }

/* compact input fields (limited to a few characters for entering percentages and other small values) */
.onechar input   { width:1em; }
.twochar input   { width:2em; }
.threechar input { width:3em; }
.fourchar input  { width:4em; }
.fivechar input  { width:5em; }

/* text colors */
.white { color:#fff !important }
.gray  { color:#999 !important }
.black { color:#000 !important }
.red   { color:#f66 !important }
.green { color:#0c0 !important }
.blue  { color:#99f !important }

/* rollover highlighting */
.mouseover 
	{color:[[ColorPalette::TertiaryLight]] !important;}
.mouseover a
	{color:[[ColorPalette::TertiaryLight]] !important;}
.selected .mouseover
	{color:[[ColorPalette::Foreground]] !important;}
.selected .mouseover .button, .selected .mouseover a
	{color:[[ColorPalette::PrimaryDark]] !important;}

/* rollover zoom text */
.zoomover
	{ font-size:80% !important; }
.selected .zoomover
	{ font-size:100% !important; }

/* [[ColorPalette]] text colors */
.Background	{ color:[[ColorPalette::Background]];	 }
.Foreground	{ color:[[ColorPalette::Foreground]];	 }
.PrimaryPale	{ color:[[ColorPalette::PrimaryPale]];	 }
.PrimaryLight	{ color:[[ColorPalette::PrimaryLight]];	 }
.PrimaryMid	{ color:[[ColorPalette::PrimaryMid]];	 }
.PrimaryDark	{ color:[[ColorPalette::PrimaryDark]];	 }
.SecondaryPale	{ color:[[ColorPalette::SecondaryPale]]; }
.SecondaryLight	{ color:[[ColorPalette::SecondaryLight]];}
.SecondaryMid	{ color:[[ColorPalette::SecondaryMid]];	 }
.SecondaryDark	{ color:[[ColorPalette::SecondaryDark]]; }
.TertiaryPale	{ color:[[ColorPalette::TertiaryPale]];	 }
.TertiaryLight	{ color:[[ColorPalette::TertiaryLight]]; }
.TertiaryMid	{ color:[[ColorPalette::TertiaryMid]];	 }
.TertiaryDark	{ color:[[ColorPalette::TertiaryDark]];	 }
.Error		{ color:[[ColorPalette::Error]];	 }

/* [[ColorPalette]] background colors */
.BGBackground	  { background-color:[[ColorPalette::Background]];	}
.BGForeground	  { background-color:[[ColorPalette::Foreground]];	}
.BGPrimaryPale	  { background-color:[[ColorPalette::PrimaryPale]];	}
.BGPrimaryLight	  { background-color:[[ColorPalette::PrimaryLight]];	}
.BGPrimaryMid	  { background-color:[[ColorPalette::PrimaryMid]];	}
.BGPrimaryDark	  { background-color:[[ColorPalette::PrimaryDark]];	}
.BGSecondaryPale  { background-color:[[ColorPalette::SecondaryPale]]; 	}
.BGSecondaryLight { background-color:[[ColorPalette::SecondaryLight]];	}
.BGSecondaryMid	  { background-color:[[ColorPalette::SecondaryMid]];	}
.BGSecondaryDark  { background-color:[[ColorPalette::SecondaryDark]]; 	}
.BGTertiaryPale	  { background-color:[[ColorPalette::TertiaryPale]];	}
.BGTertiaryLight  { background-color:[[ColorPalette::TertiaryLight]]; 	}
.BGTertiaryMid	  { background-color:[[ColorPalette::TertiaryMid]];	}
.BGTertiaryDark	  { background-color:[[ColorPalette::TertiaryDark]];	}
.BGError	  { background-color:[[ColorPalette::Error]];	 	}
/*}}}*/
/*{{{*/
#tiddlersBar .button {border:0}
#tiddlersBar .tab {white-space:nowrap}
#tiddlersBar {padding : 0em 0.5em 2px 0.5em}
.tabUnselected .tabButton, .tabSelected .tabButton {padding : 0 2px 0 2px; margin: 0 0 0 4px;}

/*}}}*/
<<tabs txtMoreTab 
"All" "All tiddlers" TabAll 
"Missing" "Missing tiddlers" TabMoreMissing
"Orphan" "Orphaned tiddlers" TabMoreOrphans 
"Shadow" "Shadowed tiddlers" TabMoreShadowed
>>
/%
Table Highlighting for Sortable & TW Tables Version 08.14.2009
ELS simplified code structure
StyleSheet Changes: (add the following)
.evenRow {background-color: #333;} //alternating table row color//
.highlight, .marked {background:[[ColorPalette::SecondaryLight]] !important;} //row color + forced highlight//
%/<script>
jQuery('table.sortable tbody tr').mouseover(function(){
	jQuery(this).addClass('highlight');
	});
jQuery('table.sortable tbody tr').mouseout(function(){
	jQuery(this).removeClass('highlight');
	});
jQuery('table.twtable tbody tr').mouseover(function(){
	jQuery(this).addClass('highlight');
	});
jQuery('table.twtable tbody tr').mouseout(function(){
	jQuery(this).removeClass('highlight');
	});
</script>
/***
|''Name:''|TableSortingPlugin|
|''Description:''|Dynamically sort tables by clicking on column headers|
|''Author:''|Saq Imtiaz ( lewcid@gmail.com )|
|''Source:''|http://tw.lewcid.org/#TableSortingPlugin|
|''Code Repository:''|http://tw.lewcid.org/svn/plugins|
|''Version:''|2.02|
|''Date:''|25-01-2008|
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.2.3|
!!Usage:
* Make sure your table has a header row
** {{{|Name|Phone Number|Address|h}}}<br> Note the /h/ that denote a header row 
* Give the table a class of 'sortable'
** {{{
|sortable|k
|Name|Phone Number|Address|h
}}}<br>Note the /k/ that denotes a class name being assigned to the table.
* To disallow sorting by a column, place {{{<<nosort>>}}} in it's header
* To automatically sort a table by a column, place {{{<<autosort>>}}} in the header for that column
** Or to sort automatically but in reverse order, use {{{<<autosort reverse>>}}}

!!Example:
|sortable|k
|Name |Salary |Extension |Performance |File Size |Start date |h
|ZBloggs, Fred |$12000.00 |1353 |+1.2 |74.2Kb |Aug 19, 2003 21:34:00 |
|ABloggs, Fred |$12000.00 |1353 |1.2 |3350b |09/18/2003 |
|CBloggs, Fred |$12000 |1353 |1.200 |55.2Kb |August 18, 2003 |
|DBloggs, Fred |$12000.00 |1353 |1.2 |2100b |07/18/2003 |
|Bloggs, Fred |$12000.00 |1353 |01.20 |6.156Mb |08/17/2003 05:43 |
|Turvey, Kevin |$191200.00 |2342 |-33 |1b |02/05/1979 |
|Mbogo, Arnold |$32010.12 |2755 |-21.673 |1.2Gb |09/08/1998 |
|Shakespeare, Bill |£122000.00|3211 |6 |33.22Gb |12/11/1961 |
|Shakespeare, Hamlet |£9000 |9005 |-8 |3Gb |01/01/2002 |
|Fitz, Marvin |€3300.30 |5554 |+5 |4Kb |05/22/1995 |

***/
// /%
//!BEGIN-PLUGIN-CODE
config.tableSorting = {
	
	darrow: "\u2193",
	
	uarrow: "\u2191",
	
	getText : function (o) {
		var p = o.cells[SORT_INDEX];
		return p.innerText || p.textContent || '';
	},
	
	sortTable : function (o,rev) {
		SORT_INDEX = o.getAttribute("index");
		var c = config.tableSorting;
		var T = findRelated(o.parentNode,"TABLE");
		if(T.tBodies[0].rows.length<=1) 
			return;
		var itm = "";
		var i = 0;
		while (itm == "" && i < T.tBodies[0].rows.length) {
			itm = c.getText(T.tBodies[0].rows[i]).trim();
			i++;
		}
		if (itm == "") 
			return; 	
		var r = [];
		var S = o.getElementsByTagName("span")[0];		
		c.fn = c.sortAlpha; 
		if(!isNaN(Date.parse(itm)))
			c.fn = c.sortDate; 
		else if(itm.match(/^[$|£|€|\+|\-]{0,1}\d*\.{0,1}\d+$/)) 
			c.fn = c.sortNumber; 
		else if(itm.match(/^\d*\.{0,1}\d+[K|M|G]{0,1}b$/)) 
			c.fn = c.sortFile; 
		for(i=0; i<T.tBodies[0].rows.length; i++) {
			 r[i]=T.tBodies[0].rows[i]; 
		} 
		r.sort(c.reSort);
		if(S.firstChild.nodeValue==c.darrow || rev) {
			r.reverse();
			S.firstChild.nodeValue=c.uarrow;
		} 
		else 
			S.firstChild.nodeValue=c.darrow;
		var thead = T.getElementsByTagName('thead')[0]; 
		var headers = thead.rows[thead.rows.length-1].cells;
		for(var k=0; k<headers.length; k++) {
			if(!hasClass(headers[k],"nosort"))
				addClass(headers[k].getElementsByTagName("span")[0],"hidden");
		}
		removeClass(S,"hidden");
		for(i=0; i<r.length; i++) { 
			T.tBodies[0].appendChild(r[i]);
			c.stripe(r[i],i);
			for(var j=0; j<r[i].cells.length;j++){
				removeClass(r[i].cells[j],"sortedCol");
			}
			addClass(r[i].cells[SORT_INDEX],"sortedCol");
		}
	},
	
	stripe : function (e,i){
		var cl = ["oddRow","evenRow"];
		i&1? cl.reverse() : cl;
		removeClass(e,cl[1]);
		addClass(e,cl[0]);
	},
	
	sortNumber : function(v) {
		var x = parseFloat(this.getText(v).replace(/[^0-9.-]/g,''));
		return isNaN(x)? 0: x;
	},
	
	sortDate : function(v) {
		return Date.parse(this.getText(v));
	},

	sortAlpha : function(v) {
		return this.getText(v).toLowerCase();
	},
	
	sortFile : function(v) { 		
		var j, q = config.messages.sizeTemplates, s = this.getText(v);
		for (var i=0; i<q.length; i++) {
			if ((j = s.toLowerCase().indexOf(q[i].template.replace("%0\u00a0","").toLowerCase())) != -1)
				return q[i].unit * s.substr(0,j);
		}
		return parseFloat(s);
	},
	
	reSort : function(a,b){
		var c = config.tableSorting;
		var aa = c.fn(a);
		var bb = c.fn(b);
		return ((aa==bb)? 0 : ((aa<bb)? -1:1));
	}
};

Story.prototype.tSort_refreshTiddler = Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function(title,template,force,customFields,defaultText){
	var elem = this.tSort_refreshTiddler.apply(this,arguments);
	if(elem){
		var tables = elem.getElementsByTagName("TABLE");
		var c = config.tableSorting;
		for(var i=0; i<tables.length; i++){
			if(hasClass(tables[i],"sortable")){
				var x = null, rev, table = tables[i], thead = table.getElementsByTagName('thead')[0], headers = thead.rows[thead.rows.length-1].cells;
				for (var j=0; j<headers.length; j++){
					var h = headers[j];
					if (hasClass(h,"nosort"))
						continue;
					h.setAttribute("index",j);
					h.onclick = function(){c.sortTable(this); return false;};
					h.ondblclick = stopEvent;
					if(h.getElementsByTagName("span").length == 0)
						createTiddlyElement(h,"span",null,"hidden",c.uarrow); 
					if(!x && hasClass(h,"autosort")) {
						x = j;
						rev = hasClass(h,"reverse");
					}
				}
				if(x)
					c.sortTable(headers[x],rev);		
			}
		}
	}
	return elem; 
};

setStylesheet("table.sortable span.hidden {visibility:hidden;}\n"+
	"table.sortable thead {cursor:pointer;}\n"+
	"table.sortable .nosort {cursor:default;}\n"+
	"table.sortable td.sortedCol {background:#ffc;}","TableSortingPluginStyles");

function stopEvent(e){
	var ev = e? e : window.event;
	ev.cancelBubble = true;
	if (ev.stopPropagation) ev.stopPropagation();
	return false;	
}	

config.macros.nosort={
	handler : function(place){
		addClass(place,"nosort");
	}	
};

config.macros.autosort={
	handler : function(place,m,p,w,pS){
		addClass(place,"autosort"+" "+pS);		
	}	
};
//!END-PLUGIN-CODE
// %/
/***
|Name:|TagglyTaggingPlugin|
|Description:|tagglyTagging macro is a replacement for the builtin tagging macro in your ViewTemplate|
|Version:|3.3.1 ($Rev: 6100 $)|
|Date:|$Date: 2008-07-27 01:42:07 +1000 (Sun, 27 Jul 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
06.20.09 Modified Default {{{listMode:   ["normal","group","sitemap","commas"],}}} to make sitemap first
***/
//{{{

merge(String.prototype,{

	parseTagExpr: function(debug) {

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

		var anyLogicOp = /(!|&&|\|\||\(|\))/g;
		var singleLogicOp = /^(!|&&|\|\||\(|\))$/;

		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(anyLogicOp," $1 ");

		var expr = "";

		var tokens = spaced.readBracketedList(false); // false means don't uniq the list. nice one JR!

		for (var i=0;i<tokens.length;i++)
			if (tokens[i].match(singleLogicOp))
				expr += tokens[i];
			else
				expr += "tiddler.tags.contains('%0')".format([tokens[i].replace(/'/,"\\'")]); // fix single quote bug. still have round bracket bug i think

		if (debug)
			alert(expr);

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

});

merge(TiddlyWiki.prototype,{
	getTiddlersByTagExpr: function(tagExpr,sortField) {

		var result = [];

		var expr = tagExpr.parseTagExpr();

		store.forEachTiddler(function(title,tiddler) {
			if (eval(expr))
				result.push(tiddler);
		});

		if(!sortField)
			sortField = "title";

		result.sort(function(a,b) {return a[sortField] < b[sortField] ? -1 : (a[sortField] == b[sortField] ? 0 : +1);});
		
		return result;
	}
});

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':",
			exprLabel:  "Matching tag expression '%0':",
			excerpts:   "excerpts",
			descr:      "descr",
			slices:     "slices",
			contents:   "contents",
			sliders:    "sliders",
			noexcerpts: "title only",
			noneFound:  "(none)"
		},

		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"
		},

		tooDeepMessage: "* //sitemap too deep...//"
	},

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

	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(),"");
		// 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.getTiddlersByTagExpr(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,isTagExpr) {
		switch(this.getTagglyOpt(title,"listMode")) {
			case "group":  return this.createTagglyListGrouped(place,title,isTagExpr); break;
			case "normal": return this.createTagglyListNormal(place,title,false,isTagExpr); break;
			case "commas": return this.createTagglyListNormal(place,title,true,isTagExpr); break;
			case "sitemap":return this.createTagglyListSiteMap(place,title,isTagExpr); break;
		}
	},

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

	getTiddlers: function(titleOrExpr,sortBy,isTagExpr) {
		return isTagExpr ? store.getTiddlersByTagExpr(titleOrExpr,sortBy) : store.getTaggedTiddlers(titleOrExpr,sortBy);
	},

	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|<nowiki>%1</nowiki>|\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,isTagExpr) {

		var list = config.taggly.getTiddlers(title,this.getTagglyOpt(title,"sortBy"),isTagExpr);

		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,isTagExpr) {
		var sortBy = this.getTagglyOpt(title,"sortBy");
		var sortOrder = this.getTagglyOpt(title,"sortOrder");

		var list = config.taggly.getTiddlers(title,sortBy,isTagExpr);

		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,isTagExpr) {

		var list = config.taggly.getTiddlers(title,sortBy,isTagExpr);

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

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

		var childOutput = "";

		if (depth > this.config.siteMapDepthLimit)
			childOutput += indent + this.lingo.tooDeepMessage;
		else
			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,false);

		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,isTagExpr) {
		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"),isTagExpr);
		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 parsedParams = paramString.parseParams("tag",null,true);
				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);

				var tag = getParam(parsedParams,"tag");
				var expr = getParam(parsedParams,"expr");

				if (expr) {
					refreshContainer.setAttribute("isTagExpr","true");
					refreshContainer.setAttribute("title",expr);
					refreshContainer.setAttribute("showEmpty","true");
				}
				else {
					refreshContainer.setAttribute("isTagExpr","false");
					if (tag) {
        				refreshContainer.setAttribute("title",tag);
						refreshContainer.setAttribute("showEmpty","true");
					}
					else {
        				refreshContainer.setAttribute("title",tiddler.title);
						refreshContainer.setAttribute("showEmpty","false");
					}
				}
				this.refresh(refreshContainer);
			},

			refresh: function(place) {
				var title = place.getAttribute("title");
				var isTagExpr = place.getAttribute("isTagExpr") == "true";
				var showEmpty = place.getAttribute("showEmpty") == "true";
				removeChildren(place);
				addClass(place,"tagglyTagging");
				var countFound = config.taggly.getTiddlers(title,'title',isTagExpr).length
				if (countFound > 0 || showEmpty) {
					var lingo = config.taggly.lingo;
					config.taggly.createListControl(place,title,"hideState");
					if (config.taggly.getTagglyOpt(title,"hideState") == "show") {
						createTiddlyElement(place,"span",null,"tagglyLabel",
								isTagExpr ? lingo.labels.exprLabel.format([title]) : 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,isTagExpr);
						if (countFound == 0 && showEmpty)
							createTiddlyElement(place,"div",null,"tagglyNoneFound",lingo.labels.noneFound);
					}
				}
			}
		}
	},

	// 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; }",
".tagglyNoneFound { margin-left:2em; color:[[ColorPalette::TertiaryMid]]; font-size:90%; font-style:italic; }",
"/*}}}*/",
		""].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;
	}
});

//}}}
Import everything tagged with TaskManagerPackage to use this in your TiddlyWiki document
I recommend using http://www.TiddlyTools.com/index.html#ImportTiddlersPlugin
/***
|Name|TaskManagerPlugin|
|Documentation|see: [[TaskManagerPackage]]|
|Version|2.1.3|
|Author|Mike Praeuner|
|~CoreVersion|2.5.0|
|Type|plugin|
|Requires|see below|
|Description|**Experimental** [[InlineJavascriptPlugin]] based Task Manager|

!!!About
''Task Manager v<<tiddler "TaskManagerPlugin::Version">>''
Concept:
*Task Organizer similar to TaskOrganizerPlugin
*Based on InlineJavascriptPlugin
*Learning experience for TW and Javascript (+IJS)
*Highly customizable
*Added automation to delete completed items
Plugins Required: (<script>
return store.getMatchingTiddlers("TaskManagerPackage && systemConfig && ! Optional").length.toString();</script>)
<script>
  var out=[];
  var tids=store.getMatchingTiddlers("TaskManagerPackage && systemConfig && ! Optional",'modified').reverse();
  for (var t=0; t<tids.length; t++)
out.push('*[['+tids[t].title+']]');
  return out.join("\n");</script>
Plugins Optional: (<script>
return store.getMatchingTiddlers("TaskManagerPackage && systemConfig && Optional").length.toString();</script>)
<script>
  var out=[];
  var tids=store.getMatchingTiddlers("TaskManagerPackage && systemConfig && Optional",'modified').reverse();
  for (var t=0; t<tids.length; t++)
out.push('*[['+tids[t].title+']]');
  return out.join("\n");</script>
Tiddlers Created by Plugins: (<script>
return store.getMatchingTiddlers("TaskManagerPackage && ! systemConfig").length.toString();</script>)
<script>
  var out=[];
  var tids=store.getMatchingTiddlers("TaskManagerPackage && ! systemConfig",'modified').reverse();
  for (var t=0; t<tids.length; t++)
out.push('*[['+tids[t].title+']]');
  return out.join("\n");</script>
!!!Usage
Transclude TaskTabs in a tiddler {{{<<tiddler TaskTabs>>}}} for example see: [[Task Manager]]
!!!Customization
See the following Tiddlers: (basic Javascript understanding needed)
[[TaskTabs]] - Defines: Project Tabs, Status, New Project Button, and Delete Completed button
[[ProjectTemplate]] -  Defines: Project sub Tabs, New Task Button, and Delete Project button
If you make a mistake or wish to revert to the original just delete [[TaskTabs]] or [[ProjectTemplate]] and they will be re-created on startup
Note: If using [[TrashPlugin]] make sure to empty trash before reloading
!!!Removal
Delete all Task Manager Tiddlers Including: <<tag [[Task]]>> <<tag TaskTabs>> <<tag TaskManagerPackage>>
Note: Script will bypass [[TrashPlugin]]
{{button{<script label="Delete all TaskManager tiddlers" title="Use with Caution">
if(window.version && window.version.title == 'TiddlyWiki'){
	store.suspendNotifications();
	var t = store.getMatchingTiddlers("Task || TaskTabs || TaskManagerPackage")
	for(var i=0;
i<t.length;
i++)
		store.removeTiddler(t[i].title);
	store.resumeNotifications();
//	refreshDisplay();	
	story.closeAllTiddlers();refreshDisplay();	
}
return false; // ELS: added
</script>}}}
Finally save & reload your document (F5)

!!!Idea Based on Work by:
Paulo Soares ~TaskOrganizerPlugin @ http://www.math.ist.utl.pt/~psoares/addons.html
Jim @ http://tiddlywikitips.com/TiddlyWikiTasks.html
~TiddlyWiki Google Group @ http://groups.google.com/group/TiddlyWiki (specifically: FND & ELS)
{{hide{
!!!TaskTabs
<script>
	var tag=store.getMatchingTiddlers("TaskTabs && !Trash","modified").reverse();
//	var tag=store.getMatchingTiddlers("TaskTabs && !Trash","title");
	var fmt="[[%0]] 'view %0' [[%0]]";
	var out="";
	for (var i=0; i<tag.length; i++)
		out+=(fmt.format([tag[i].title]));
//	alert(out);
	if (out.length) return "<<tabs tabTabsForTags "+out+">>";
		return "There are no tiddlers tagged with <<tag TaskTabs>>";
</script>@@text-align:left;~~&nbsp;<script>
	var projects= store.getTaggedTiddlers("TaskTabs").length.toString();
	var tasks= store.getTaggedTiddlers("Task").length.toString();
	var urgent= store.getMatchingTiddlers("Urgent && !Completed").length.toString();
	var pending= store.getMatchingTiddlers("Task && !Urgent && !Completed").length.toString();
	var completed= store.getTaggedTiddlers("Completed").length.toString();
return ("Status: " + projects + " Projects, " + tasks + " Tasks (" + urgent + " Urgent, " + pending + " Pending, " + completed + " Completed) ");
</script>~~@@

{{button{<script label="New Project">
   var title=prompt("Enter Project Tag (No Spaces or special characters)");
   var txt=store.getTiddlerText("ProjectTemplate", "").replace(/Project1/g, title);
   var who=config.options.txtUserName;
   var when=new Date();
   var tags='"TaskTabs" "excludeLists"';
   var fields={};
   store.saveTiddler(title,title,txt,who,when,tags,fields);
   story.refreshTiddler(story.findContainingTiddler(place).getAttribute("tiddler"),null,true);
</script>}}} <<deleteCompleted daysOld:30 title:'Delete Completed Tasks'>>
!!!Project
<<tabs txtProject1
'Urgent Project1' 'Urgent Project1 Tab' Project1##Urgent
'Pending Project1' 'Pending Project1 Tab' Project1##Pending
'Completed Project1' 'Completed Project1 Tab' Project1##Completed
>>
{{button{<script label="New Task">
 var newTiddler = new Tiddler();
 newTiddler.title = prompt('Enter a new task title','New Project Task');
 newTiddler.tags[0] = "Project1";
 newTiddler.tags[1] = "Task";
 newTiddler.tags[2] = "excludeLists";
 newTiddler.modifier = config.options.txtUserName;
 if(config.macros.reminders){
 newTiddler.text = "Task:\nReminder: <<newReminder>>\n!!!Items\n#\n#\n!!!Notes\n\n!!!Due";
 } else {newTiddler.text = "Task:\n!!!Items\n#\n#\n!!!Notes\n\n!!!Due";}
 store.addTiddler(newTiddler);
 story.displayTiddler(null,newTiddler.title,DEFAULT_EDIT_TEMPLATE);
 story.focusTiddler(newTiddler.title,"title");
</script>}}} <<deleteAllTagged "Delete this Project" delete>>
@@display:none;"
!!!Urgent
~~Urgent Items~~
<script>
//	var tag=store.getMatchingTiddlers("Project1 && Urgent && ! Completed && ! Trash","+title");
	var tag=store.getMatchingTiddlers("Project1 && Urgent && ! Completed && ! Trash","modified").reverse();
	var hdr="|sortable|k\n| !Title | !Task | !Reminders | !Urgent? | !Complete? |h";
	var fmt="| [[%0|%0]] | %1 | ~~<<tiddler [[%0##Due]]>>~~ | [X(%0:Urgent)] | [X(%0:Completed)] |";
	var out=[hdr];
		if (!tag.length) out=["No Tiddlers found"];
	for (var i=0; i<tag.length; i++)
		out.push(fmt.format([tag[i].title,store.getTiddlerSlice(tag[i].title, "Task") ]));
	return out.join('\n');
</script>
!!!Pending
~~Pending Items~~
<script>
//	var tag=store.getMatchingTiddlers("Project1 && ! Urgent && ! Completed && ! Trash","+title");
	var tag=store.getMatchingTiddlers("Project1 && ! Urgent && ! Completed && ! Trash","modified").reverse();
	var hdr="|sortable|k\n| !Title | !Task | !Reminders | !Urgent? | !Complete? |h";
	var fmt="| [[%0|%0]] | %1 | ~~<<tiddler [[%0##Due]]>>~~ | [X(%0:Urgent)] | [X(%0:Completed)] |";
	var out=[hdr];
		if (!tag.length) out=["No Tiddlers found"];
	for (var i=0; i<tag.length; i++)
		out.push(fmt.format([tag[i].title,store.getTiddlerSlice(tag[i].title, "Task") ]));
	return out.join('\n');
</script>
!!!Completed
~~Completed Items~~
<script>
//	var tag=store.getMatchingTiddlers("Project1 && Completed && ! Trash","+title");
	var tag=store.getMatchingTiddlers("Project1 && Completed && ! Trash","modified").reverse();
	var hdr="|sortable|k\n| !Title | !Task | !Urgent? | !Complete? |h";
	var fmt="| [[%0|%0]] | %1 | [X(%0:Urgent)] | [X(%0:Completed)] |";
	var out=[hdr];
		if (!tag.length) out=["No Tiddlers found"];
	for (var i=0; i<tag.length; i++)
		out.push(fmt.format([tag[i].title,store.getTiddlerSlice(tag[i].title, "Task") ]));
	return out.join('\n');
</script>
@@
!!!End
}}}
!!!!!Code Create ProjectTemplate Tiddler
***/
{{{
var title= "ProjectTemplate";
var project = store.getTiddlerText("TaskManagerPlugin##Project", "");
var urgent = store.getTiddlerText("TaskManagerPlugin##Urgent", "");
var pending = store.getTiddlerText("TaskManagerPlugin##Pending", "");
var completed = store.getTiddlerText("TaskManagerPlugin##Completed", "");
var combined = (project +"\n"+"!!!Urgent" +"\n"+ urgent +"\n"+ "!!!Pending" +"\n"+ pending +"\n"+ "!!!Completed" +"\n"+ completed);
var txt= combined;
var who=config.options.txtUserName;
var when=new Date();
var tags='"TaskManagerPackage" "excludeLists"';
var fields={};
	if(store.tiddlerExists(title)){
	// displayMessage(title +' has already been created');
	} else {
	store.saveTiddler(title,title,txt,who,when,tags,fields);
	// displayMessage(title +' has been created');
	}
}}}
/***
!!!!!Code Create TaskTabs Tiddler
***/
{{{
var title= "TaskTabs";
var txt = store.getTiddlerText("TaskManagerPlugin##TaskTabs", "");
var who=config.options.txtUserName;
var when=new Date();
var tags='"TaskManagerPackage" "excludeLists"';
var fields={};
	if(store.tiddlerExists(title)){
	// displayMessage(title +' has already been created');
	} else {
	store.saveTiddler(title,title,txt,who,when,tags,fields);
	// displayMessage(title +' has been created');
	}
}}}
/***
!!!!!Code Create Completed Tiddler
***/
{{{
var title= "Completed";
var txt = "<<deleteCompleted daysOld:0 title:'Delete All Completed Items'>>";
var who=config.options.txtUserName;
var when=new Date();
var tags='"TaskManagerPackage" ""';
var fields={};
	if(store.tiddlerExists(title)){
	// displayMessage(title +' has already been created');
	} else {
	store.saveTiddler(title,title,txt,who,when,tags,fields);
	// displayMessage(title +' has been created');
	}
}}}
<script>
	var tag=store.getMatchingTiddlers("TaskTabs && !Trash","modified").reverse();
//	var tag=store.getMatchingTiddlers("TaskTabs && !Trash","title");
	var fmt="[[%0]] 'view %0' [[%0]]";
	var out="";
	for (var i=0; i<tag.length; i++)
		out+=(fmt.format([tag[i].title]));
//	alert(out);
	if (out.length) return "<<tabs tabTabsForTags "+out+">>";
		return "There are no tiddlers tagged with <<tag TaskTabs>>";
</script>@@text-align:left;~~&nbsp;<script>
	var projects= store.getTaggedTiddlers("TaskTabs").length.toString();
	var tasks= store.getTaggedTiddlers("Task").length.toString();
	var urgent= store.getMatchingTiddlers("Urgent && !Completed").length.toString();
	var pending= store.getMatchingTiddlers("Task && !Urgent && !Completed").length.toString();
	var completed= store.getTaggedTiddlers("Completed").length.toString();
return ("Status: " + projects + " Projects, " + tasks + " Tasks (" + urgent + " Urgent, " + pending + " Pending, " + completed + " Completed) ");
</script>~~@@

{{button{<script label="New Project">
   var title=prompt("Enter Project Tag (No Spaces or special characters)");
   var txt=store.getTiddlerText("ProjectTemplate", "").replace(/Project1/g, title);
   var who=config.options.txtUserName;
   var when=new Date();
   var tags='"TaskTabs" "excludeLists"';
   var fields={};
   store.saveTiddler(title,title,txt,who,when,tags,fields);
   story.refreshTiddler(story.findContainingTiddler(place).getAttribute("tiddler"),null,true);
</script>}}} <<deleteCompleted daysOld:30 title:'Delete Completed Tasks'>>
!!!Core Commands
<<newTiddler>>
<<newJournal "0MM.0DD.YYYY" Journal>>
<<saveChanges>>
<<closeAll>>
<<permaview>>
!!!Plugin Commands
<<tiddler TiddlerCommands##PluginInclude>>
!!!Scripts
''<html><a href="javascript:;" onclick="story.closeAllTiddlers();restart();">Restart</a></html>''
''<html><a href="javascript:;"onclick="saveChanges();window.location.reload( false );">Save & Reload</a></html>''
!!!Projects
[[SandBox|TestWiki.htm]]
[[[STRM]|../Website/STRM.htm]]
[[Task Manager|Examples_TWGG/IJSTaskManager.html]]
[[HighlightScript|Examples_TWGG/highlightscriptexample.html]]
[[XOM Contacts|NotesProject/ContactsProject.htm]]
[[XOM Notes|NotesProject/NotesProject.htm]]
[[MM Javascript|MM_JS/JS+JQ_TW.html]]
@@display:none;
!!!PluginInclude
<script>if(config.macros.collapseAll){	return ("<<collapseAll>>"+"\n")}</script><script>if(config.macros.expandAll){	return ("<<expandAll>>"+"\n")}</script><script>if(config.macros.saveAndReload){return ("<<saveAndReload>>"+"\n")}</script><script>if(config.macros.emptyTrash){	return ("<<emptyTrash>>")}</script>
!!!End@@
/***
|Name|TiddlerEncryptionPlugin|
|Author|Lyall Pearce|
|Source|http://www.Remotely-Helpful.com/TiddlyWiki/TiddlerEncryptionPlugin.html|
|License|[[Creative Commons Attribution-Share Alike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|Version|3.2.0|
|~CoreVersion|2.4.0|
|Requires|None|
|Overrides|store.getSaver().externalizeTiddler(), store.getTiddler() and store.getTiddlerText()|
|Description|Encrypt/Decrypt Tiddlers with a Password key|

!!!!!Usage
<<<
* Tag a tiddler with Encrypt(prompt)
** Consider the 'prompt' something to help you remember the password with. If multiple tiddlers can be encrypted with the same 'prompt' and you will only be asked for the password once.
* Upon save, the Tiddler will be encrypted and the tag replaced with Decrypt(prompt).
** Failure to encrypt (by not entering a password) will leave the tiddler unencrypted and will leave the Encrypt(prompt) tag in place. This means that the next time you save, you will be asked for the password again.
** To have multiple tiddlers use the same password - simply use the same 'prompt'.
** Tiddlers that are encrypted may be automatically tagged 'excludeSearch' as there is no point in searching encrypted data - this is configurable by an option - you still may want to search the titles of encrypted tiddlers
** Tiddlers that are encrypted may be automatically tagged 'excludeLists', if you have them encrypted, you may also want to keep them 'hidden' - this is configurable by an option.
** Automatic removal of excludeLists and excludeSearch tags is performed, if the above two options are set, only if these two tags are the last 2 tags for a tiddler, if they are positioned somewhere else in the tags list, they will be left in place, meaning that the decrypted tiddler will not be searchable and/or will not appear in lists.
** Encrypted tiddlers are stored as displayable hex, to keep things visibly tidy, should you display an encrypted tiddler. There is nothing worse than seeing a pile of gobbledy gook on your screen. Additionally, the encrypted data is easily cut/paste/emailed if displayed in hex form.
* Tiddlers are decrypted only if you click the decrypt button or the decryptAll button, not when you load the TiddlyWiki
** If you don't display a tiddler, you won't have the option to decrypt it (unless you use the {{{<<EncryptionDecryptAll>>}}} macro)
** Tiddlers will re-encrypt automatically on save.
** Decryption of Tiddlers does not make your TiddlyWiki 'dirty' - you will not be asked to save if you leave the page.
* Errors are reported via diagnostic messages.
** Empty passwords, on save, will result in the tiddler being saved unencrypted - this should only occur with new tiddlers, decrypted tiddlers or with tiddlers who have had their 'prompt' tag changed.
** Encrypted tiddlers know if they are decrypted successfully - failure to decrypt a tiddler will ''not'' lose your data.
** Editing of an encrypted (that has not been unencrypted) tiddler will result in loss of that tiddler as the SHA1 checksums will no longer match, upon decryption. To this end, it is best that you do not check the option. You can, however edit an encrypted tiddler tag list - just do ''not'' change the tiddler contents.
** To change the password on a Tiddler, change the Encrypt('prompt') tag to a new prompt value, after decrypting the tiddler.
** You can edit the tags of an encrypted tiddler, so long as you do not edit the text.
** To change the password for all tiddlers of a particular prompt, use the {{{<<EncryptionChangePassword ["button text" ["tooltip text" ["prompt string" ["accessKey"]]]]>>}}} macro.
** To decrypt all tiddlers of a particular "prompt string", use the {{{<<EncryptionDecryptAll ["button text" ["tooltip text" ["prompt string" ["accessKey"]]]]>>}}} macro - this will make tiddlers encrypted with "prompt string" searchable - or prompt for all 'prompt strings', if none is supplied.
<<<
!!!!!Configuration
<<<
Useful Buttons: 
<<EncryptionChangePassword>> - Change passwords of encrypted tiddlers.
<<EncryptionDecryptAll>> - Decrypt ALL tiddlers - enables searching contents of encrypted tiddlers.
<<option chkExcludeEncryptedFromSearch>> - If set, Encrypted Tiddlers are excluded from searching by tagging with excludeSearch. If Clear, excludeSearch is not added and it is also removed from existing Encrypted Tiddlers only if it is the last Tag. Searching of Encrypted Tiddlers is only meaningful for the Title and Tags.
<<option chkExcludeEncryptedFromLists>> - If set, Encrypted Tiddlers are excluded from lists by tagging with excludeLists. If Clear, excludeLists is not added and it is also removed from existing Encrypted Tiddlers only if it is the last Tag. Preventing encrypted tiddlers from appearing in lists effectively hides them.
<<<
!!!!!Revision History
<<<
* 3.2.0 - Ditched the 'Decrypt' button showing up in the tiddler contents if the tiddler is encrypted. It caused too much pain if you edit the tiddler without decrypting it - you lost your data as it was replaced by a Decrypt Macro call!  Additionally, a 'decrypt' button will now appear in the toolbar, just before the edit button, if the tiddler is encrypted. This button only appears if using core TiddlyWiki version 2.4 or above.
* 3.1.1 - Obscure bug whereby if an encrypted tiddler was a certain length, it would refuse to decrypt.
* 3.1.0 - When creating a new Encrypt(prompt) tiddler and you have not previously decrypted a tiddler with the same prompt, on save, you will be prompted for the password to encrypt the tiddler. Prior to encrypting, an attempt to decrypt all other tiddlers with the same prompt, is performed. If any tiddler fails to decrypt, the save is aborted - this is so you don't accidentally have 2 (or more!) passwords for the same prompt. Either you enter the correct password, change the prompt string and try re-saving or you cancel (and the tiddler is saved unencrypted).
* 3.0.1 - Allow Enter to be used for password entry, rather than having to press the OK button.
* 3.0.0 - Major revamp internally to support entry of passwords using forms such that passwords are no longer visible on entry. Completely backward compatible with old encrypted tiddlers. No more using the javascript prompt() function.
<<<
!!!!!Additional work

***/
//{{{
version.extensions.TiddlerEncryptionPlugin = {major: 3, minor: 2, revision: 0, date: new Date(2008,10,6)};

// where I cache the passwords - for want of a better place.
config.encryptionPasswords = new Array();
config.encryptionReEnterPasswords = false;

if(config.options.chkExcludeEncryptedFromSearch == undefined) config.options.chkExcludeEncryptedFromSearch = false;
if(config.options.chkExcludeEncryptedFromLists == undefined) config.options.chkExcludeEncryptedFromLists = false;

config.macros.EncryptionChangePassword = {};
config.macros.EncryptionChangePassword.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
    var theButton = createTiddlyButton(place,
				       (params[0] && params[0].length > 0) ? params[0] : "Change Passwords", 
				       (params[1] && params[1].length > 0) ? params[1] : "Change Passwords" + (params[2] ? " for prompt "+params[2] : ""), 
				       onClickEncryptionChangePassword,
				       null,
				       null,
				       params[3]);
    if(params[2] && params[2].length > 0) {
	theButton.setAttribute("promptString", params[2]);
    }
};

config.macros.EncryptionDecryptAll = {};
config.macros.EncryptionDecryptAll.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
    var theButton = createTiddlyButton(place,
				       (params[0] && params[0].length > 0) ? params[0] : "Decrypt All", 
				       (params[1] && params[1].length > 0) ? params[1] : "Decrypt All Tiddlers" + ((params[2] && params[2].length > 0) ? " for prompt "+params[2] : " for a given 'prompt string'"), 
				       onClickEncryptionDecryptAll,
				       null,
				       null,
				       params[3]);
    if(params[2] && params[2].length > 0) {
	theButton.setAttribute("promptString", params[2]);
    }
};

config.macros.EncryptionDecryptThis = {};
config.macros.EncryptionDecryptThis.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
    var theButton = createTiddlyButton(place,
				       (params[0] && params[0].length > 0) ? params[0] : "Decrypt", 
				       (params[1] && params[1].length > 0) ? params[1] : "Decrypt this Tiddler", 
				       onClickEncryptionDecryptThis,
				       null,
				       null,
				       params[3]);
    if(params[2] && params[2].length > 0) {
	theButton.setAttribute("theTiddler", params[2]);
    }
};
// toolbar button to decrypt tiddlers.
config.commands.decryptThis = {
  text: "decrypt",
  tooltip: "Decrypt this tiddler",
  isEnabled : function(tiddler) {
	// Only show decrypt button if tiddler is tagged as Decrypt(
	if(tiddler.tags.join().indexOf('Decrypt(') == -1)  {
	    return false;
	} else {
	    return true;
	}
    },	
  handler: function(event, src, title) {
	encryptionGetAndDecryptTiddler(title);
	return false; 
    }
};
// core version 2.4 or above get a 'decrypt' button in the toolbar.
if(config.shadowTiddlers && config.shadowTiddlers.ToolbarCommands  && config.shadowTiddlers.ToolbarCommands.indexOf('decryptThis') == -1) {
    // put our toolbar button in before the edit button.
    // won't work if editTiddler is not the default item (prefixed with plus)
    config.shadowTiddlers.ToolbarCommands.replace(/\+editTiddler/,'decryptThis +editTiddler');
}


// Called by the EncryptionChangePassword macro/button
// Also invoked by the callback for password entry
function onClickEncryptionChangePassword(eventObject) {
    var promptString;
    if(!promptString && this.getAttribute) {
	promptString = this.getAttribute("promptString");
    }
    // I do call this function directly
    if(!promptString && typeof(eventObject) == "string") {
	promptString = eventObject;
    }
    if(!promptString) {
	promptString = prompt("Enter 'prompt string' to change password for:","");
    }
    if(!promptString) {
	return;
    }
    if(! config.encryptionPasswords[promptString]) {
	var changePasswordContext = {changePasswordPromptString: promptString,
				     callbackFunction: MyChangePasswordPromptCallback_TiddlerEncryptionPlugin};
	MyPrompt_TiddlerEncryptionPlugin(promptString,"",changePasswordContext);
	return;
	// Callback function will re-invoke this function
    }

    // Decrypt ALL tiddlers for that prompt
    onClickEncryptionDecryptAll(promptString);
    // Now ditch the cached password, this will force the re-request for the new password, on save.
    displayMessage("Save TiddlyWiki to set new password for '"+promptString+"'");
    config.encryptionPasswords[promptString] = null;
    // mark store as dirty so a save will be requrested.
    store.setDirty(true);
    autoSaveChanges(); 
    return;
};
// Called by the password entry form when the user clicks 'OK' button.
function MyChangePasswordPromptCallback_TiddlerEncryptionPlugin(context) {
    config.encryptionPasswords[context.passwordPrompt] = context.password;
    onClickEncryptionChangePassword(context.changePasswordPromptString);
    return;
}
// Called by the EncryptionDecryptThis macro/button
function onClickEncryptionDecryptThis() {
    var theTiddler = this.getAttribute("theTiddler");
    if(!theTiddler) {
	return;
    }
    encryptionGetAndDecryptTiddler(theTiddler);
    return;
};

function encryptionGetAndDecryptTiddler(title) {
    config.encryptionReEnterPasswords = true;
    try {
	theTiddler = store.getTiddler(title);
	config.encryptionReEnterPasswords = false;
	story.refreshAllTiddlers();
    } catch (e) {
	if(e == "DecryptionFailed") {
	    displayMessage("Decryption failed");
	    return;
	}
    } // catch
    return;
};

// called by the EncryptionDecryptAlll macro/button
// Also called by the callback after the user clicks 'OK' button on the password entry form
function onClickEncryptionDecryptAll(eventObject) {
    var promptString;
    if(!promptString && this.getAttribute) {
	promptString = this.getAttribute("promptString");
    }
    // I do call this function directly
    if(!promptString && typeof(eventObject) == "string") {
	promptString = eventObject;
    }
    if(!promptString) {
	promptString = "";
    }

    // Loop through all tiddlers, looking to see if there are any Decrypt(promptString) tagged tiddlers
    // If there are, check to see if their password has been cached.
    // If not, ask for the first one that is missing, that we find
    // the call back function will store that password then invoke this function again, 
    // which will repeat the whole process. If we find all passwords have been cached
    // then we will finally do the decryptAll functionality, which will then
    // be able to decrypt all the required tiddlers, without prompting.
    // We have to do this whole rigmarole because we are using a 'form' to enter the password
    // rather than the 'prompt()' function - which shows the value of the password.
    var tagToSearchFor="Decrypt("+promptString;
    config.encryptionReEnterPasswords = true; 
    var promptGenerated = false;
    store.forEachTiddler(function(store,tiddler) {
	    // Note, there is no way to stop the forEachTiddler iterations
	    if(!promptGenerated && tiddler && tiddler.tags) {
		for(var ix=0; ix<tiddler.tags.length && !promptGenerated; ix++) {
		    if(tiddler.tags[ix].indexOf(tagToSearchFor) == 0) {
			var tag = tiddler.tags[ix];
			var lastBracket=tag.lastIndexOf(")");
			if(lastBracket >= 0) {
			    // Ok, tagged with Encrypt(passwordPrompt)
			    // extract the passwordPrompt name
			    var passwordPromptString=tag.substring(8,lastBracket);
			    if(!config.encryptionPasswords[passwordPromptString]) {
				// no password cached, prompt and cache it, rather than decryptAll
				// callback from prompting form will resume decryptAll attempt.
				var decryptAllContext = {decryptAllPromptString: promptString,
							 callbackFunction: MyDecryptAllPromptCallback_TiddlerEncryptionPlugin};
				MyPrompt_TiddlerEncryptionPlugin(passwordPromptString,"",decryptAllContext);
				promptGenerated = true;
			    } // if(!config.encryptionPasswords
			} // if(lastBracket
		    } // if(tiddler.tags[ix]..
		} // for
	    } // if
	}); // store.forEachTiddler
    // If we get here, all passwords have been cached.
    if(!promptGenerated) {
	config.encryptionReEnterPasswords = false;
	// Now do the decrypt all functionality
	try {
	    store.forEachTiddler(function(store,tiddler) {
		    // Note, there is no way to stop the forEachTiddler iterations
		    if(tiddler && tiddler.tags) {
			for(var ix=0; ix<tiddler.tags.length; ix++) {
			    if(tiddler.tags[ix].indexOf(tagToSearchFor) == 0) {
				try {
				    CheckTiddlerForDecryption_TiddlerEncryptionPlugin(tiddler);
				} catch (e) {
				    displayMessage("Decryption of '"+tiddler.title+"' failed.");
				    // throw e;
				}
			    } // if(tiddler.tags
			} // for
		    } // if
		}); // store.forEachTiddler
	    displayMessage("All tiddlers" + (promptString != "" ? " for '"+promptString+"'" : "") + " have been decrypted");
	} catch (e) {
	    if(e == "DecryptionFailed") {
		return;
	    }
	} // catch
    }
    return;
};

function MyDecryptAllPromptCallback_TiddlerEncryptionPlugin(context) {
    config.encryptionPasswords[context.passwordPrompt] = context.password;
    // restart the decryptAll process again after the user has entered a password.
    onClickEncryptionDecryptAll(context.decryptAllPromptString);
    return;
}

saveChanges_TiddlerEncryptionPlugin = saveChanges;
saveChanges = function(onlyIfDirty,tiddlers) {
    // Loop through all tiddlers, looking to see if there are any Encrypt(string) tagged tiddlers
    // If there are, check to see if their password has been cached.
    // If not, ask for the first one that is missing, that we find
    // the call back function will store that password then invoke this function again, 
    // which will repeat the whole process. If we find all passwords have been cached
    // then we will finally call the original saveChanges() function, which will then
    // be able to save the tiddlers.
    // We have to do this whole rigmarole because we are using a 'form' to enter the password
    // rather than the 'prompt()' function - which shows the value of the password.
    config.encryptionReEnterPasswords = true; 
    var promptGenerated = false;
    store.forEachTiddler(function(store,tiddler) {
	    if(!promptGenerated && tiddler && tiddler.tags) {
		for(var ix=0; ix<tiddler.tags.length && !promptGenerated; ix++) {
		    if(tiddler.tags[ix].indexOf("Encrypt(") == 0) {
			var tag = tiddler.tags[ix];
			var lastBracket=tag.lastIndexOf(")");
			if(lastBracket >= 0) {
			    // Ok, tagged with Encrypt(passwordPrompt)
			    // extract the passwordPrompt name
			    var passwordPrompt=tag.substring(8,lastBracket);
			    if(!config.encryptionPasswords[passwordPrompt]) {
				// no password cached, prompt and cache it, rather than save
				var saveContext = {onlyIfDirty: onlyIfDirty, 
						   tiddlers: tiddlers, 
				                   callbackFunction: MySavePromptCallback_TiddlerEncryptionPlugin};
				MyPrompt_TiddlerEncryptionPlugin(passwordPrompt,"",saveContext);
				promptGenerated = true;
			    } // if(!config.encryptionPasswords
			} // if(lastBracket
		    } // if(tiddler.tags[ix]..
		} // for
	    } // if
	}); // store.forEachTiddler
    // If we get here, all passwords have been cached.
    if(!promptGenerated) {
	config.encryptionReEnterPasswords = false;
	saveChanges_TiddlerEncryptionPlugin(onlyIfDirty,tiddlers);
    }
    return;
}

function MySavePromptCallback_TiddlerEncryptionPlugin(context) {
    config.encryptionPasswords[context.passwordPrompt] = context.password;
    // validate the password entered by attempting to decrypt all tiddlers
    // with the same encryption prompt string.
    onClickEncryptionDecryptAll(context.passwordPrompt);

    // restart the save process again
    saveChanges(context.onlyIfDirty, context.tiddlers);
    return;
}

store.getSaver().externalizeTiddler_TiddlerEncryptionPlugin = store.getSaver().externalizeTiddler;
store.getSaver().externalizeTiddler = function(store, tiddler) {
    // Ok, got the tiddler, track down the passwordPrompt in the tags.
    // track down the Encrypt(passwordPrompt) tag
    if(tiddler && tiddler.tags) {
	for(var g=0; g<tiddler.tags.length; g++) {
	    var tag = tiddler.tags[g];
	    if(tag.indexOf("Encrypt(") == 0) {
		var lastBracket=tag.lastIndexOf(")");
		if(lastBracket >= 0) {
		    // Ok, tagged with Encrypt(passwordPrompt)
		    // extract the passwordPrompt name
		    var passwordPrompt=tag.substring(8,lastBracket);
		    // Ok, Encrypt this tiddler!
		    var decryptedSHA1 = Crypto.hexSha1Str(tiddler.text);
		    var password =  GetAndSetPasswordForPrompt_TiddlerEncryptionPlugin(passwordPrompt);
		    if(password) {
			var encryptedText = TEAencrypt(tiddler.text, password);
			encryptedText = StringToHext_TiddlerEncryptionPlugin(encryptedText);
			tiddler.text = "Encrypted("+decryptedSHA1+")\n"+encryptedText;
			// Replace the Tag with the Decrypt() tag
			tiddler.tags[g]="Decrypt("+passwordPrompt+")";
			// let the store know it's dirty
			store.setDirty(tiddler.title, true);
			// prevent searches on encrypted tiddlers, still nice to search on title though.
			if(config.options.chkExcludeEncryptedFromSearch == true) {
			    tiddler.tags.push("excludeSearch");
			}
			// prevent lists of encrypted tiddlers
			if(config.options.chkExcludeEncryptedFromLists == true) {
			    tiddler.tags.push("excludeLists");
			}
		    } else {
			// do not encrypt - no password entered
		    }
		    break;
		} // if (lastBracket...
	    } // if(tag.indexOf(...
	} // for(var g=0;...
    } // if(tiddler.tags...
    
    // Then, finally, do the save by calling the function we override.

    return store.getSaver().externalizeTiddler_TiddlerEncryptionPlugin(store, tiddler);
};

function CheckTiddlerForDecryption_TiddlerEncryptionPlugin(tiddler) {
    if(tiddler && tiddler.tags) {
	for(var g=0; g<tiddler.tags.length; g++) {
	    var tag = tiddler.tags[g];
	    if(tag.indexOf("Decrypt(") == 0) {
		var lastBracket=tag.lastIndexOf(")");
		if(lastBracket >= 0) {
		    if(tiddler.text.substr(0,10) == "Encrypted(") {
			var closingSHA1Bracket = tiddler.text.indexOf(")");
			var decryptedSHA1 = tiddler.text.substring(10, closingSHA1Bracket);
			// Ok, tagged with Decrypt(passwordPrompt)
			// extract the passwordPrompt name
			var passwordPrompt=tag.substring(8,lastBracket);
			// Ok, Decrypt this tiddler!
			var decryptedText = tiddler.text.substr(closingSHA1Bracket+2);
			decryptedText = HexToString_TiddlerEncryptionPlugin(decryptedText);
                        // prompt("Decryption request for Tiddler '"+tiddler.title+"'");
			var password = GetAndSetPasswordForPromptToDecrypt_TiddlerEncryptionPlugin(passwordPrompt);
			if(password) {
			    decryptedText = TEAdecrypt(decryptedText, password );
			    var thisDecryptedSHA1 = Crypto.hexSha1Str(decryptedText);
			    if(decryptedSHA1 == thisDecryptedSHA1) {
				tiddler.text = decryptedText;
				// Replace the Tag with the Encrypt() tag
				tiddler.tags[g]="Encrypt("+passwordPrompt+")";
				if(tiddler.tags[tiddler.tags.length-1] == 'excludeLists') {
				    // Remove exclude lists only if it's the last entry
				    // as it's automatically put there by encryption
				    tiddler.tags.length--;
				}
				if(tiddler.tags[tiddler.tags.length-1] == 'excludeSearch') {
				    // Remove exclude search only if it's the last entry
				    // as it's automatically put there by encryption
				    tiddler.tags.length--;
				}
			    } else {
				// Did not decrypt, discard the password from the cache
				config.encryptionPasswords[passwordPrompt] = null;
				config.encryptionReEnterPasswords = false;
				throw "DecryptionFailed";
			    }
			} else {
			    // no password supplied, dont bother trying to decrypt
			    config.encryptionReEnterPasswords = false;
			    throw "DecryptionFailed";
			}
		    } else {
			// Tagged as encrypted but not expected format, just leave it unchanged
		    }
		    break; // out of for loop
		} // if (lastBracket...
	    } // if(tag.indexOf(...
	} // for(var g=0;...
    } // if (tiddler && tags)
    return tiddler;
};

store.getTiddler_TiddlerEncryptionPlugin = store.getTiddler;
store.getTiddler = function(title) {
    var tiddler = store.getTiddler_TiddlerEncryptionPlugin(title);
    if(tiddler) { // shadow tiddlers are not expected to be encrypted.
	try {
	    return CheckTiddlerForDecryption_TiddlerEncryptionPlugin(tiddler);
	} catch (e) {
	    return(tiddler);
	    // if(e == "DecryptionFailed") {
	    // 	var tiddler = store.getTiddler("DecryptionFailed");
	    // 	if(!tiddler) {
	    // 	    tiddler = new Tiddler();
	    // 	    tiddler.set(title,
	    // 			"<<EncryptionDecryptThis \"Decrypt\" \"Decrypt this tiddler\" \""+title+"\">>",
	    // 			config.views.wikified.shadowModifier,
	    // 			version.date,[],version.date);
	    // 	} 
	    // 	return tiddler;
	    // } // if(e)
	} // catch
    } // if(tiddler) {
    return null;
};

store.getTiddlerText_TiddlerEncryptionPlugin = store.getTiddlerText;
store.getTiddlerText = function(title,defaultText) {
    // Simply retrieve the tiddler, normally, if it requires decryption, it will be decrypted
    var decryptedTiddler = store.getTiddler(title);
    if(decryptedTiddler) {
	return decryptedTiddler.text;
    }
    //Ok, rather than duplicate all the core code, the above code should fail if we reach here
    // let the core code take over.
    return  store.getTiddlerText_TiddlerEncryptionPlugin(title,defaultText);
};

// Given a prompt, search our cache to see if we have already entered the password.
// Can return null if the user enters nothing.
function MyPrompt_TiddlerEncryptionPlugin(promptString,defaultValue,context) {
    if(!context) {
	context = {};
    }
    context.passwordPrompt = promptString;
    PasswordPrompt.prompt(MyPromptCallback_TiddlerEncryptionPlugin, context);
    return;
}

function MyPromptCallback_TiddlerEncryptionPlugin(context) {
    if(context.callbackFunction) {
	context.callbackFunction(context);
    } else {
	config.encryptionPasswords[context.passwordPrompt] = context.password;
	story.refreshAllTiddlers(true);
    }
    return;
}

function GetAndSetPasswordForPrompt_TiddlerEncryptionPlugin(promptString) {
    if(!config.encryptionPasswords[promptString]) {
	config.encryptionPasswords[promptString] = MyPrompt_TiddlerEncryptionPlugin(promptString, "");
    }
    return config.encryptionPasswords[promptString]; // may be null, prompt can be cancelled.
}

function GetAndSetPasswordForPromptToDecrypt_TiddlerEncryptionPlugin(promptString) {
    if(config.encryptionReEnterPasswords) {
	return GetAndSetPasswordForPrompt_TiddlerEncryptionPlugin(promptString);
    } else {
	return config.encryptionPasswords[promptString];
    }
}

// Make the encrypted tiddlies look a little more presentable.
function StringToHext_TiddlerEncryptionPlugin(theString) {
    var theResult = "";
    for(var i=0; i<theString.length; i++) {
	var theHex = theString.charCodeAt(i).toString(16);
	if(theHex.length<2) {
	    theResult += "0"+theHex;
	} else {
	    theResult += theHex;
	}
	if(i && i % 32 == 0)
	    theResult += "\n";
    }
    return theResult;
}

function HexToString_TiddlerEncryptionPlugin(theString) {
    var theResult = "";
    for(var i=0; i<theString.length; i+=2) {
	if(theString.charAt(i) == "\n") {
	    i--;	// cause us to skip over the newline and resume
	    continue;
	}
	theResult += String.fromCharCode(parseInt(theString.substr(i, 2),16));
    }
    return theResult;
}
//
// Heavily leveraged from http://trac.tiddlywiki.org/browser/Trunk/contributors/SaqImtiaz/verticals/Hesperian/PasswordPromptPlugin.js  Revision 5635
//
PasswordPrompt ={
  prompt : function(callback,context){
	if (!context) {
	    context = {};
	}
	var box = createTiddlyElement(document.getElementById("contentWrapper"),'div','passwordPromptBox');
	box.innerHTML = store.getTiddlerText('PasswordPromptTemplate');
	box.style.position = 'absolute';
	this.center(box);
	document.getElementById('promptDisplayField').value = context.passwordPrompt;
	var passwordInputField = document.getElementById('passwordInputField');
	passwordInputField.onkeyup = function(ev) {
	    var e = ev || window.event;
	    if(e.keyCode == 10 || e.keyCode == 13) { // Enter
		PasswordPrompt.submit(callback, context);
	    }
	};
	passwordInputField.focus();
	document.getElementById('passwordPromptSubmitBtn').onclick = function(){PasswordPrompt.submit(callback,context);};
	document.getElementById('passwordPromptCancelBtn').onclick = function(){PasswordPrompt.cancel(callback,context);};
    },     
 	       
  center : function(el){
	var size = this.getsize(el);
	el.style.left = (Math.round(findWindowWidth()/2) - (size.width /2) + findScrollX())+'px';
	el.style.top = (Math.round(findWindowHeight()/2) - (size.height /2) + findScrollY())+'px';
    },
 	       
  getsize : function (el){
	var x = {};
	x.width = el.offsetWidth || el.style.pixelWidth;
	x.height = el.offsetHeight || el.style.pixelHeight;
	return x;
    },
 	       
  submit : function(cb,context){
	context.passwordPrompt = document.getElementById('promptDisplayField').value;
	context.password = document.getElementById('passwordInputField').value;
	var box = document.getElementById('passwordPromptBox');
	box.parentNode.removeChild(box);
	cb(context);
	return false;
    },

  cancel : function(cb,context){
	var box = document.getElementById('passwordPromptBox');
	box.parentNode.removeChild(box);
	return false;
    },
 	       
  setStyles : function(){
	setStylesheet(
	    "#passwordPromptBox dd.submit {margin-left:0; font-weight: bold; margin-top:1em;}\n"+
	    "#passwordPromptBox dd.submit .button {padding:0.5em 1em; border:1px solid #ccc;}\n"+
	    "#passwordPromptBox dt.heading {margin-bottom:0.5em; font-size:1.2em;}\n"+
	    "#passwordPromptBox {border:1px solid #ccc;background-color: #eee;padding:1em 2em;}",'passwordPromptStyles');
    },
 	       
  template : '<form action="" onsubmit="return false;" id="passwordPromptForm">\n'+
  '    <dl>\n'+
  '        <dt class="heading">Please enter the password:</dt>\n'+
  '        <dt>Prompt:</dt>\n'+
  '        <dd><input type="text" readonly id="promptDisplayField" class="display"/></dd>\n'+
  '        <dt>Password:</dt>\n'+
  '        <dd><input type="password" tabindex="1" class="input" id="passwordInputField"/></dd>\n'+
  '        <dd class="submit">\n'+
  '            <a tabindex="2" href="javascript:;" class="button" id="passwordPromptSubmitBtn">OK</a>\n'+
  '            <a tabindex="3" href="javascript:;" class="button" id="passwordPromptCancelBtn">Cancel</a>\n'+
  '        </dd>\n'+
  '    </dl>\n'+
  '</form>',
 	                         
  init : function(){
	config.shadowTiddlers.PasswordPromptTemplate = this.template;
	this.setStyles();
    }
};
 	
PasswordPrompt.init();

// http://www.movable-type.co.uk/scripts/tea-block.html
//
// TEAencrypt: Use Corrected Block TEA to encrypt plaintext using password
//             (note plaintext & password must be strings not string objects)
//
// Return encrypted text as string
//
function TEAencrypt(plaintext, password)
{
    if (plaintext.length == 0) return('');  // nothing to encrypt
    // 'escape' plaintext so chars outside ISO-8859-1 work in single-byte packing, but keep
    // spaces as spaces (not '%20') so encrypted text doesn't grow too long (quick & dirty)
    var asciitext = escape(plaintext).replace(/%20/g,' ');
    var v = strToLongs(asciitext);  // convert string to array of longs
    if (v.length <= 1) v[1] = 0;  // algorithm doesn't work for n<2 so fudge by adding a null
    var k = strToLongs(password.slice(0,16));  // simply convert first 16 chars of password as key
    var n = v.length;

    var z = v[n-1], y = v[0], delta = 0x9E3779B9;
    var mx, e, q = Math.floor(6 + 52/n), sum = 0;

    while (q-- > 0) {  // 6 + 52/n operations gives between 6 & 32 mixes on each word
        sum += delta;
        e = sum>>>2 & 3;
        for (var p = 0; p < n; p++) {
            y = v[(p+1)%n];
            mx = (z>>>5 ^ y<<2) + (y>>>3 ^ z<<4) ^ (sum^y) + (k[p&3 ^ e] ^ z);
            z = v[p] += mx;
        }
    }

    var ciphertext = longsToStr(v);

    return escCtrlCh(ciphertext);
}

//
// TEAdecrypt: Use Corrected Block TEA to decrypt ciphertext using password
//
function TEAdecrypt(ciphertext, password)
{
    if (ciphertext.length == 0) return('');
    var v = strToLongs(unescCtrlCh(ciphertext));
    var k = strToLongs(password.slice(0,16)); 
    var n = v.length;

    var z = v[n-1], y = v[0], delta = 0x9E3779B9;
    var mx, e, q = Math.floor(6 + 52/n), sum = q*delta;

    while (sum != 0) {
        e = sum>>>2 & 3;
        for (var p = n-1; p >= 0; p--) {
            z = v[p>0 ? p-1 : n-1];
            mx = (z>>>5 ^ y<<2) + (y>>>3 ^ z<<4) ^ (sum^y) + (k[p&3 ^ e] ^ z);
            y = v[p] -= mx;
        }
        sum -= delta;
    }

    var plaintext = longsToStr(v);

    // strip trailing null chars resulting from filling 4-char blocks:
    plaintext = plaintext.replace(/\0+$/,'');

    return unescape(plaintext);
}


// supporting functions

function strToLongs(s) {  // convert string to array of longs, each containing 4 chars
    // note chars must be within ISO-8859-1 (with Unicode code-point < 256) to fit 4/long
    var l = new Array(Math.ceil(s.length/4));
    for (var i=0; i<l.length; i++) {
        // note little-endian encoding - endianness is irrelevant as long as 
        // it is the same in longsToStr() 
        l[i] = s.charCodeAt(i*4) + (s.charCodeAt(i*4+1)<<8) + 
               (s.charCodeAt(i*4+2)<<16) + (s.charCodeAt(i*4+3)<<24);
    }
    return l;  // note running off the end of the string generates nulls since 
}              // bitwise operators treat NaN as 0

function longsToStr(l) {  // convert array of longs back to string
    var a = new Array(l.length);
    for (var i=0; i<l.length; i++) {
        a[i] = String.fromCharCode(l[i] & 0xFF, l[i]>>>8 & 0xFF, 
                                   l[i]>>>16 & 0xFF, l[i]>>>24 & 0xFF);
    }
    return a.join('');  // use Array.join() rather than repeated string appends for efficiency
}

function escCtrlCh(str) {  // escape control chars etc which might cause problems with encrypted texts
    return str.replace(/[\0\t\n\v\f\r\xa0'"!]/g, function(c) { return '!' + c.charCodeAt(0) + '!'; });
}

function unescCtrlCh(str) {  // unescape potentially problematic nulls and control characters
    return str.replace(/!\d\d?\d?!/g, function(c) { return String.fromCharCode(c.slice(1,-1)); });
}

//}}}
/***
|''Name:''|TiddlersBarPlugin|
|''Description:''|A bar to switch between tiddlers through tabs (like browser tabs bar).|
|''Version:''|1.2.5|
|''Date:''|Jan 18,2008|
|''Source:''|http://visualtw.ouvaton.org/VisualTW.html|
|''Author:''|Pascal Collin|
|''License:''|[[BSD open source license|License]]|
|''~CoreVersion:''|2.1.0|
|''Browser:''|Firefox 2.0; InternetExplorer 6.0, others|
!Demos
On [[homepage|http://visualtw.ouvaton.org/VisualTW.html]], open several tiddlers to use the tabs bar.
!Installation
#import this tiddler from [[homepage|http://visualtw.ouvaton.org/VisualTW.html]] (tagged as systemConfig)
#save and reload
#''if you're using a custom [[PageTemplate]]'', add {{{<div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'></div>}}} before {{{<div id='tiddlerDisplay'></div>}}}
#optionally, adjust StyleSheetTiddlersBar
!Tips
*Doubleclick on the tiddlers bar (where there is no tab) create a new tiddler.
*Tabs include a button to close {{{x}}} or save {{{!}}} their tiddler.
*By default, click on the current tab close all others tiddlers.
!Configuration options 
<<option chkDisableTabsBar>> Disable the tabs bar (to print, by example).
<<option chkHideTabsBarWhenSingleTab >> Automatically hide the tabs bar when only one tiddler is displayed. 
<<option txtSelectedTiddlerTabButton>> ''selected'' tab command button.
<<option txtPreviousTabKey>> previous tab access key.
<<option txtNextTabKey>> next tab access key.
!Code
***/
//{{{
config.options.chkDisableTabsBar = config.options.chkDisableTabsBar ? config.options.chkDisableTabsBar : false;
config.options.chkHideTabsBarWhenSingleTab  = config.options.chkHideTabsBarWhenSingleTab  ? config.options.chkHideTabsBarWhenSingleTab  : false;
config.options.txtSelectedTiddlerTabButton = config.options.txtSelectedTiddlerTabButton ? config.options.txtSelectedTiddlerTabButton : "closeOthers";
config.options.txtPreviousTabKey = config.options.txtPreviousTabKey ? config.options.txtPreviousTabKey : "";
config.options.txtNextTabKey = config.options.txtNextTabKey ? config.options.txtNextTabKey : "";
config.macros.tiddlersBar = {
	tooltip : "see ",
	tooltipClose : "click here to close this tab",
	tooltipSave : "click here to save this tab",
	promptRename : "Enter tiddler new name",
	currentTiddler : "",
	previousState : false,
	previousKey : config.options.txtPreviousTabKey,
	nextKey : config.options.txtNextTabKey,	
	tabsAnimationSource : null, //use document.getElementById("tiddlerDisplay") if you need animation on tab switching.
	handler: function(place,macroName,params) {
		var previous = null;
		if (config.macros.tiddlersBar.isShown())
			story.forEachTiddler(function(title,e){
				if (title==config.macros.tiddlersBar.currentTiddler){
					var d = createTiddlyElement(null,"span",null,"tab tabSelected");
					config.macros.tiddlersBar.createActiveTabButton(d,title);
					if (previous && config.macros.tiddlersBar.previousKey) previous.setAttribute("accessKey",config.macros.tiddlersBar.nextKey);
					previous = "active";
				}
				else {
					var d = createTiddlyElement(place,"span",null,"tab tabUnselected");
					var btn = createTiddlyButton(d,title,config.macros.tiddlersBar.tooltip + title,config.macros.tiddlersBar.onSelectTab);
					btn.setAttribute("tiddler", title);
					if (previous=="active" && config.macros.tiddlersBar.nextKey) btn.setAttribute("accessKey",config.macros.tiddlersBar.previousKey);
					previous=btn;
				}
				var isDirty =story.isDirty(title);
				var c = createTiddlyButton(d,isDirty ?"!":"x",isDirty?config.macros.tiddlersBar.tooltipSave:config.macros.tiddlersBar.tooltipClose, isDirty ? config.macros.tiddlersBar.onTabSave : config.macros.tiddlersBar.onTabClose,"tabButton");
				c.setAttribute("tiddler", title);
				if (place.childNodes) {
					place.insertBefore(document.createTextNode(" "),place.firstChild); // to allow break line here when many tiddlers are open
					place.insertBefore(d,place.firstChild); 
				}
				else place.appendChild(d);
			})
	}, 
	refresh: function(place,params){
		removeChildren(place);
		config.macros.tiddlersBar.handler(place,"tiddlersBar",params);
		if (config.macros.tiddlersBar.previousState!=config.macros.tiddlersBar.isShown()) {
			story.refreshAllTiddlers();
			if (config.macros.tiddlersBar.previousState) story.forEachTiddler(function(t,e){e.style.display="";});
			config.macros.tiddlersBar.previousState = !config.macros.tiddlersBar.previousState;
		}
	},
	isShown : function(){
		if (config.options.chkDisableTabsBar) return false;
		if (!config.options.chkHideTabsBarWhenSingleTab) return true;
		var cpt=0;
		story.forEachTiddler(function(){cpt++});
		return (cpt>1);
	},
	selectNextTab : function(){  //used when the current tab is closed (to select another tab)
		var previous="";
		story.forEachTiddler(function(title){
			if (!config.macros.tiddlersBar.currentTiddler) {
				story.displayTiddler(null,title);
				return;
			}
			if (title==config.macros.tiddlersBar.currentTiddler) {
				if (previous) {
					story.displayTiddler(null,previous);
					return;
				}
				else config.macros.tiddlersBar.currentTiddler=""; 	// so next tab will be selected
			}
			else previous=title;
			});		
	},
	onSelectTab : function(e){
		var t = this.getAttribute("tiddler");
		if (t) story.displayTiddler(null,t);
		return false;
	},
	onTabClose : function(e){
		var t = this.getAttribute("tiddler");
		if (t) {
			if(story.hasChanges(t) && !readOnly) {
				if(!confirm(config.commands.cancelTiddler.warning.format([t])))
				return false;
			}
			story.closeTiddler(t);
		}
		return false;
	},
	onTabSave : function(e) {
		var t = this.getAttribute("tiddler");
		if (!e) e=window.event;
		if (t) config.commands.saveTiddler.handler(e,null,t);
		return false;
	},
	onSelectedTabButtonClick : function(event,src,title) {
		var t = this.getAttribute("tiddler");
		if (!event) event=window.event;
		if (t && config.options.txtSelectedTiddlerTabButton && config.commands[config.options.txtSelectedTiddlerTabButton])
			config.commands[config.options.txtSelectedTiddlerTabButton].handler(event, src, t);
		return false;
	},
	onTiddlersBarAction: function(event) {
		var source = event.target ? event.target.id : event.srcElement.id; // FF uses target and IE uses srcElement;
		if (source=="tiddlersBar") story.displayTiddler(null,'New Tiddler',DEFAULT_EDIT_TEMPLATE,false,null,null);
	},
	createActiveTabButton : function(place,title) {
		if (config.options.txtSelectedTiddlerTabButton && config.commands[config.options.txtSelectedTiddlerTabButton]) {
			var btn = createTiddlyButton(place, title, config.commands[config.options.txtSelectedTiddlerTabButton].tooltip ,config.macros.tiddlersBar.onSelectedTabButtonClick);
			btn.setAttribute("tiddler", title);
		}
		else
			createTiddlyText(place,title);
	}
}

story.coreCloseTiddler = story.coreCloseTiddler? story.coreCloseTiddler : story.closeTiddler;
story.coreDisplayTiddler = story.coreDisplayTiddler ? story.coreDisplayTiddler : story.displayTiddler;

story.closeTiddler = function(title,animate,unused) {
	if (title==config.macros.tiddlersBar.currentTiddler)
		config.macros.tiddlersBar.selectNextTab();
	story.coreCloseTiddler(title,false,unused); //disable animation to get it closed before calling tiddlersBar.refresh
	var e=document.getElementById("tiddlersBar");
	if (e) config.macros.tiddlersBar.refresh(e,null);
}

story.displayTiddler = function(srcElement,tiddler,template,animate,unused,customFields,toggle){
	story.coreDisplayTiddler(config.macros.tiddlersBar.tabsAnimationSource,tiddler,template,animate,unused,customFields,toggle);
	var title = (tiddler instanceof Tiddler)? tiddler.title : tiddler;  
	if (config.macros.tiddlersBar.isShown()) {
		story.forEachTiddler(function(t,e){
			if (t!=title) e.style.display="none";
			else e.style.display="";
		})
		config.macros.tiddlersBar.currentTiddler=title;
	}
	var e=document.getElementById("tiddlersBar");
	if (e) config.macros.tiddlersBar.refresh(e,null);
}

var coreRefreshPageTemplate = coreRefreshPageTemplate ? coreRefreshPageTemplate : refreshPageTemplate;
refreshPageTemplate = function(title) {
	coreRefreshPageTemplate(title);
	if (config.macros.tiddlersBar) config.macros.tiddlersBar.refresh(document.getElementById("tiddlersBar"));
}

ensureVisible=function (e) {return 0} //disable bottom scrolling (not useful now)

config.shadowTiddlers.StyleSheetTiddlersBar = "/*{{{*/\n";
config.shadowTiddlers.StyleSheetTiddlersBar += "#tiddlersBar .button {border:0}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += "#tiddlersBar .tab {white-space:nowrap}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += "#tiddlersBar {padding : 1em 0.5em 2px 0.5em}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += ".tabUnselected .tabButton, .tabSelected .tabButton {padding : 0 2px 0 2px; margin: 0 0 0 4px;}\n";
config.shadowTiddlers.StyleSheetTiddlersBar += ".tiddler, .tabContents {border:1px [[ColorPalette::TertiaryPale]] solid;}\n";
config.shadowTiddlers.StyleSheetTiddlersBar +="/*}}}*/";
store.addNotification("StyleSheetTiddlersBar", refreshStyles);

config.refreshers.none = function(){return true;}
config.shadowTiddlers.PageTemplate=config.shadowTiddlers.PageTemplate.replace(/<div id='tiddlerDisplay'><\/div>/m,"<div id='tiddlersBar' refresh='none' ondblclick='config.macros.tiddlersBar.onTiddlersBarAction(event)'></div>\n<div id='tiddlerDisplay'></div>");

//}}}
/%
|Name|ToggleLeftSidebar|
|Source|http://www.TiddlyTools.com/#ToggleLeftSidebar|
|Version|2.0.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides||
|Description|show/hide left sidebar (MainMenu)|

Usage: <<tiddler ToggleLeftSidebar with: "label">>

Config settings:
	config.options.chkShowLeftSidebar (true)
	config.options.txtToggleLeftSideBarLabelShow (►)
	config.options.txtToggleLeftSideBarLabelHide (◄)

%/<script label="$1" title="show/hide MainMenu content">
	var co=config.options;
	if (co.chkShowLeftSidebar=='undefined') co.chkShowLeftSidebar=true;
	co.chkShowLeftSidebar=!co.chkShowLeftSidebar;
	var mm=document.getElementById('mainMenu'); if (!mm) return;
	mm.style.display=co.chkShowLeftSidebar?'block':'none';
	document.getElementById('displayArea').style.marginLeft=co.chkShowLeftSidebar?'':'1em';
	saveOptionCookie('chkShowLeftSidebar');
	var labelShow=co.txtToggleLeftSideBarLabelShow||'&#x25BA;';
	var labelHide=co.txtToggleLeftSideBarLabelHide||'&#x25C4;';
	if (typeof(place)!='undefined' && '$1'=='$'+'1') {
		place.innerHTML=co.chkShowLeftSidebar?labelHide:labelShow;
		place.title=(co.chkShowLeftSidebar?'hide':'show')+' left sidebar';
	}
	var sm=document.getElementById('storyMenu'); if (sm) config.refreshers.content(sm);
</script><script>
	var co=config.options;
	if (co.chkShowLeftSidebar=='undefined') co.chkShowLeftSidebar=true;
	var mm=document.getElementById('mainMenu'); if (!mm) return;
	mm.style.display=co.chkShowLeftSidebar?'block':'none';
	document.getElementById('displayArea').style.marginLeft=co.chkShowLeftSidebar?'':'1em';
	if ('$1'=='$'+'1') {
		var labelShow=co.txtToggleLeftSideBarLabelShow||'&#x25BA;';
		var labelHide=co.txtToggleLeftSideBarLabelHide||'&#x25C4;';
		place.lastChild.innerHTML=co.chkShowLeftSidebar?labelHide:labelShow;
		place.lastChild.title=(co.chkShowLeftSidebar?'hide':'show')+' left sidebar';
	}
</script>
/%
|Name|ToggleRightSidebar|
|Source|http://www.TiddlyTools.com/#ToggleRightSidebar|
|Version|2.0.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides||
|Description|show/hide right sidebar (MainMenu)|

Usage: <<tiddler ToggleRightSidebar with: "label">>

Config settings:
	config.options.chkShowRightSidebar (true)
	config.options.txtToggleRightSideBarLabelShow (◄)
	config.options.txtToggleRightSideBarLabelHide (►)

%/<script label="$1" title="show/hide right sidebar content">
	var co=config.options;
	if (co.chkShowRightSidebar=='undefined') co.chkShowRightSidebar=true;
	co.chkShowRightSidebar=!co.chkShowRightSidebar;
	var sb=document.getElementById('sidebar'); if (!sb) return;
	sb.style.display=co.chkShowRightSidebar?'block':'none';
	document.getElementById('displayArea').style.marginRight=co.chkShowRightSidebar?'':'1em';
	saveOptionCookie('chkShowRightSidebar');
	var labelShow=co.txtToggleRightSideBarLabelShow||'&#x25C4;';
	var labelHide=co.txtToggleRightSideBarLabelHide||'&#x25BA;';
	if (typeof(place)!='undefined' && '$1'=='$'+'1') {
		place.innerHTML=co.chkShowRightSidebar?labelHide:labelShow;
		place.title=(co.chkShowRightSidebar?'hide':'show')+' right sidebar';
	}
	var sm=document.getElementById('storyMenu'); if (sm) config.refreshers.content(sm);
</script><script>
	var co=config.options;
	if (co.chkShowRightSidebar=='undefined') co.chkShowRightSidebar=true;
	var sb=document.getElementById('sidebar'); if (!sb) return;
	sb.style.display=co.chkShowRightSidebar?'block':'none';
	document.getElementById('displayArea').style.marginRight=co.chkShowRightSidebar?'':'1em';
	if ('$1'=='$'+'1') {
		var labelShow=co.txtToggleRightSideBarLabelShow||'&#x25C4;';
		var labelHide=co.txtToggleRightSideBarLabelHide||'&#x25BA;';
		place.lastChild.innerHTML=co.chkShowRightSidebar?labelHide:labelShow;
		place.lastChild.title=(co.chkShowRightSidebar?'hide':'show')+' right sidebar';
	}
</script>
!!!!!Toolbar definitions for templates:
ViewTemplate, EditTemplate & CollapsedTemplate Example:
{{{
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
}}}
!!!!!Removed following toolbar commands: syncing permalink
!!!!!Special Symbols
{{{
Symbol 	Purpose
+ 	marks the default action (invoked when double-clicking a tiddler)
- 	marks the cancel action (invoked when the ESC key is pressed)
> 	creates the More button; any items following this definition will only show up after clicking on the More button in the toolbar 
}}}
<<<
Uses CoreTweaks (#609/#610) for extended "!" and 'toolbar include' syntax
|~ViewToolbar|~ToolbarCommands##spacer +decryptThis ~ToolbarCommands##systemConfig ~ToolbarCommands##search closeTiddler closeOthers editTiddler ~ToolbarCommands##newHere * ~ToolbarCommands##refreshTiddler ~ToolbarCommands##Sidebar ~ToolbarCommands##Custom ~ToolbarCommands##Commands > ! ~ToolbarCommands##Toggle ~ToolbarCommands##Options fields references jump deleteTiddler ! < |
|~ViewToolbarReadOnly|~ToolbarCommands##spacer +decryptThis ~ToolbarCommands##refreshTiddler collapseTiddler closeTiddler closeOthers * >  ~ToolbarCommands##search fullscreen collapseOthers references jump < |
|~EditToolbar|~ToolbarCommands##spacer +saveTiddler saveCloseTiddler closeOthers -cancelTiddler cancelCloseTiddler deleteTiddler toggleQuickEdit autosizeEditor|
|~EditToolbarReadOnly|~ToolbarCommands##spacer ~ToolbarCommands##cancelTiddler ! references jump|
|~CollapsedToolbar|~ToolbarCommands##spacer +expandTiddler collapseOthers closeTiddler closeOthers editTiddler references jump|
<<<
!!!!!wiki-syntax toolbar commands
<<<
!!!!!spacer
{{{
/% force whitespace separation and baseline alignment of toolbar with tiddler title %/@@font-size:12pt;&nbsp;&nbsp;@@
}}}
!!!!!refreshTiddler
{{{
<script label="refresh" title="redisplay the contents of this tiddler">
	story.refreshTiddler(story.findContainingTiddler(place).getAttribute("tiddler"),null,true);
</script><script>
	place.lastChild.style.fontWeight="normal";
</script>
}}}
!!!!!tagger
{{{
<html>
<span macro='tagger source:TagDB'></span>
<span style="padding:1.5em;"></span>
</html>
}}}
!!!!!palette
{{{
<html>
<span macro="showWhenTagged palette">
<span macro="setPalette"></span></span>
<span style="padding:.5em;"></span>
</html>
}}}
!!!!!systemConfig
{{{
<html>
<span macro="showWhenTagged systemConfig">
<span macro="checkbox systemConfigDisable"></span><span class=subtitle>Disable</span>
</span><span style="padding:1.5em;"></span>
</html>
}}}
!!!!!newHere
{{{
<<newTiddler label:"new here" tag:{{story.findContainingTiddler(place).getAttribute('tiddler')}}>><<tiddler {{place.lastChild.title='new tiddler with current title as a tag';''}}>>
}}}
!!!!!newHereMacro
{{{
<html>
<span macro='newHere label:"new here"'></span>
</html>
}}}
!!!!!newJournalHereMacro
{{{
<html>
<span macro='newJournalHere label:"new Journal Here"'></span>
</html>
}}}
!!!!!search
{{{
@@position:static;+++^15em^*[search|find tiddlers that match search text]...
{{small{<<search>>
	+++{{fine{[options|set search options]}}}#sidebarSearchOptions:
	Search in:
	<<option chkSearchTitles>> titles <<option chkSearchText>> text <<option chkSearchTags>> tags
	<<option chkSearchFields>> fields <<option chkSearchShadows>> shadows
	<<option chkSearchHighlight>> highlight matches
	<<option chkSearchList>> show results in a list
	<<option chkSearchListTiddler>> show results in a tiddler
	<<option chkSearchTitlesFirst>> show title matches first
	<<option chkSearchByDate>> sort by modification date
	<<option chkRegExpSearch>> use text patterns (regexp)
	<<option chkCaseSensitiveSearch>> case sensitive matches
	<<option chkIncrementalSearch>> key-by-key search:
	{{threechar input {<<option txtIncrementalSearchMin>>}}} or more characters	
	{{threechar input {<<option txtIncrementalSearchDelay>>}}} msec delay
	<<option chkSearchOpenTiddlers>> search open tiddlers only
	<<option chkSearchExcludeTags>> exclude tiddlers tagged with:
	<<option txtSearchExcludeTags>>
	===}}}===@@
}}}
!!!!!~ToolOptions
{{{
<<tiddler ToolOptions>>
}}}
!!!!!Toggle
{{{
 <<tiddler ToggleLeftSidebar>> <<tiddler ToggleRightSidebar>> 
}}}
!!!!!Sidebar
{{{
 <<tiddler ShowPopup with: SideBarTabs "index" "Index" "" "">> 
}}}
!!!!!Options
{{{
 <<tiddler ShowPopup with: OptionsPanel "options" "TiddlyWiki Options">> 
}}}
!!!!!Commands
{{{
 <<tiddler ShowPopup with: TiddlerCommands "commands" "Tiddler Commands">> 
}}}
!!!!!Custom
{{{
 <<tiddler ShowPopup with: CustomCommands "create" "Create New Content">> 
}}}
!!!!!end of extra commands
<<<
/***
|Name:|TrashPlugin|
|Version:|1.2.0|
|Source:|http://www.TiddlyTools.com/#TrashPlugin|
|Author:|Eric Shulman|
|OriginalSource:|http://ido-xp.tiddlyspot.com/#TrashPlugin|
|OriginalAuthor:|Ido Magal (idoXatXidomagalXdotXcom)|
|License:|[[BSD open source license]]|
|CoreVersion:|2.1.0|
|Description|add 'Trash' tag to tiddlers instead of deleting them|
!!!!!Documentation
<<<
When TrashPlugin is installed and you click on the 'delete' command in the tiddler toolbar, rather than directly removing the tiddler from the system, it will be tagged with the following tags:
{{{
Trash excludeLists excludeMissing excludeSearch systemConfigDisable
}}}
As a result, although the tiddler still exists within the document, it is ''hidden from view and will not be searched or invoked as a plugin.''
*{{block{
To view a list of all tiddlers tagged with {{{Trash}}}, simply open the [[Trash]] tiddler (aka, the "trash can").}}}
*{{block{
To reclaim a tiddler from the [[Trash]], click on a title in the trash can to open that tiddler.  Then, edit it to remove the Trash tag (as well as the other tags noted above).}}}
*{{block{
To empty the trash can (i.e. actually //delete// the tiddlers), click on the ''//"empty trash"//'' button that appears in the [[Trash]] tiddler.  You can also add this button to your [[SideBarOptions]] or any other desired location by using the following macro:
{{{
<<emptyTrash>>
}}}
}}}
*{{block{
To ''bypass the trash can'' and use the normal delete handling (with the usual confirmation messages, if chkConfirmDelete is enabled), hold CTRL while clicking 'delete'}}}
*{{block{
To ''bypass both the trash can //and// the confirmation message'' and //immediately delete// the tiddler without any further interaction, hold CTRL+SHIFT while clicking 'delete'}}}
<<<
!!!!!Revisions
<<<
2009.05.20 [1.2.0] documentation rewrite and code cleanup/reduction
2009.05.12 [1.1.0.5] refactored code to add entry point: {{{config.commands.deleteTiddler.sendToTrash(title)}}}
2008.11.14 [1.1.0.4] added SHIFT-CLICK = bypass trash and delete immediately WITHOUT CONFIRMATION
2008.10.14 [1.1.0.3] return FALSE from emptyTrash() handler (fixes IE page transition error)
2008.05.18 [1.1.0.2] when creating the Trash tiddler, pass an empty tags array [] instead of a null value, so other plugins (e.g., InstantTimestampPlugin) won't fail
2006.12.21 [1.1.0.1] only call setDirty() when actually removing tiddlers from trash
2006.12.12 [1.1.0.0] added movedMsg (feedback when tiddler is tagged as Trash).   Make sure tiddler actually exists before tagging it with 'Trash'.  Fetch correct tiddler before checking for 'systemConfig' tag
2006.12.11 [1.0.3.1] Don't create Trash tiddler until needed. Remove Trash tiddler when no trash remains. Don't tag Trash tiddler with 'TrashPlugin'. Moved all user-visible strings to variables so they can be translated by 'lingo' plugins. Use displayMessage() instead of alert()
2006.12.11 [1.0.3] Fixed broken reference to core deleteTiddler. Now storing reference to core deleteTiddler in emptyTrash macro. Reduced deleteTiddler hijacking to only the handler.
2006.12.11 [1.0.2] EmptyTrash now uses removeTiddler instead of deleteTiddler. Supports trashing systemConfig tiddlers (adds systemConfigDisable tag).
2006.12.10 [1.0.1] Replaced TW version with proper Core reference. Now properly hijacking deleteTiddler command.
2006.12.10 [1.0.0] First draft.
<<<
!!!!!Code
***/
//{{{
version.extensions.TrashPlugin= {major: 1, minor: 2, revision: 0, date: new Date(2009,5,20)};
//}}}
//{{{
config.macros.emptyTrash = {
	tag: 'Trash',
	movedMsg: "'%0' has been tagged as %1",
	label: 'empty trash',
	tooltip: 'Delete all items tagged as %0',
	tooltipOlder: 'Delete items tagged as %0 that are older than %1 days old',
	emptyMsg: 'The trash is empty',
	noneToDeleteMsg: 'There are no items in the trash older than %0 days',
	confirmMsg: "The following tiddlers will be deleted:\n\n'%0'\n\nOK to proceed?",
	deletedMsg: "Deleted '%0'",
	handler: function ( place,macroName,params,wikifier,paramString,tiddler ) {
		var namedParams = (paramString.parseParams(daysOld))[0];
		var daysOld = namedParams['daysOld'] ? namedParams['daysOld'][0] : 0; // default
		var buttonTitle = namedParams['title'] ? namedParams['title'][0] : this.label;
		var buttonTip=this.tooltip.format([this.tag])
		if (daysOld) buttonTip=this.tooltipOlder.format([this.tag,daysOld])
		var b=createTiddlyButton(place,buttonTitle,buttonTip,this.emptyTrash);
		b.setAttribute('daysOld',daysOld);
	},
	emptyTrash: function() {
		var cme=config.macros.emptyTrash; // abbrev
		var daysOld=this.getAttribute('daysOld');
		var compareDate=new Date(); compareDate.setDate(compareDate.getDate()-daysOld);
		var collected=[];
		store.forEachTiddler(function(title,tiddler) {
			if (tiddler.isTagged(cme.tag) && tiddler.modified<compareDate)
				collected.push(title);
		});
		if (!collected.length)
			displayMessage(daysOld ? cme.noneToDeleteMsg.format([daysOld]) : cme.emptyMsg);
		else if (confirm(cme.confirmMsg.format([collected.join("', '")]))) {
			for (var i=0;i<collected.length;i++) {
				store.removeTiddler(collected[i]);
				store.setDirty(true);
				displayMessage(cme.deletedMsg.format([collected[i]]));
			}
		}
		if (!store.getTaggedTiddlers(cme.tag).length) // remove Trash if empty
			{ story.closeTiddler(cme.tag,true,false); store.removeTiddler(cme.tag); }
		else
			story.refreshTiddler(cme.tag,false,true); // refresh Trash if visible
		return false;
	}
}
//}}}
// // hijack delete command
//{{{
config.commands.deleteTiddler.orig_handler=config.commands.deleteTiddler.handler;
config.commands.deleteTiddler.handler=function(event,src,title) {
	// BYPASS TRASH: CTRL=normal delete, CTRL+SHIFT=without confirmation
	if (event.ctrlKey) {
		if (event.shiftKey) { var temp=config.options.chkConfirmDelete; config.options.chkConfirmDelete=false; }
		config.commands.deleteTiddler.orig_handler.apply(this,arguments);
		if (event.shiftKey) config.options.chkConfirmDelete=temp;
		story.refreshTiddler(config.macros.emptyTrash.tag,false,true);
		return false;
	}
	config.commands.deleteTiddler.sendToTrash(title);
	return false;
};

config.commands.deleteTiddler.sendToTrash = function(title) {
	var cme=config.macros.emptyTrash; // abbrev
	if (!store.tiddlerExists(title)) return; // make sure tiddler actually exists
	if (!store.tiddlerExists(cme.tag)) // make sure Trash tiddler exists
		store.saveTiddler(cme.tag,cme.tag,'<<emptyTrash>>','TrashPlugin',new Date(),[],{});
	store.setTiddlerTag(title,1,cme.tag);
	store.setTiddlerTag(title,1,'excludeLists');
	store.setTiddlerTag(title,1,'excludeMissing');
	store.setTiddlerTag(title,1,'excludeSearch');
	if (store.getTiddler(title).isTagged('systemConfig'))
		store.setTiddlerTag(title,1,'systemConfigDisable');
	story.closeTiddler(title,true);
	if(config.options.chkAutoSave) saveChanges();
	displayMessage(cme.movedMsg.format([title,cme.tag]));
	story.refreshTiddler(cme.tag,false,true);
};
//}}}


{{center{{{tiddler{<<tiddler "CustomCommands::NewWine">>+++^[Ratings Scale]<<tiddler [[Wine Ratings System]]>>===}}}

{{small{
<script>
   var out=[];
   var tids=store.getMatchingTiddlers("Wine && ! excludeLists && ! Trash","created");
   var wine=tids.length.toString();

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") != "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
	out.push([val1]);
   }
   var NR= out.length.toString();

return ("__" + wine + " Wine(s) found __" + "\n"+ NR + " Wine(s) [[not Rated|WineNR]]");
</script><script>
   var out=[];
   var tids=store.getMatchingTiddlers("Wine && ! excludeLists && ! Trash","created");

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") != "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "No") continue;
	out.push([val1]);
   }
   var RC= out.length.toString();

return (" & "+ RC + " Wine(s) [[Recommended |WineRec]] ");
</script>
}}}
{{centeredTable{
<script>
   var out=[];
   var fmt='| %0 | %1 | %2 | %3 | %4 | %5 | {{fine{[[%6|%6]]}}} |';
   var tids=store.getMatchingTiddlers("Wine && ! excludeLists && ! Trash","modified").reverse();
   var hdr="|sortable|k\n| !Name | !Grape  | !Year | !Country | !Personal Rank | !Professional Rank ||h"

   out.push(hdr);
	if (!tids.length) out=["No Wines found"];

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") < 9) continue;
	if (store.getTiddlerSlice(val1,"PersonalRank") == "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
	var val2=store.getTiddlerSlice(val1,'Name')
	var val3=store.getTiddlerSlice(val1,'Grape')
	var val4=store.getTiddlerSlice(val1,'Year')
	var val5=store.getTiddlerSlice(val1,'Country')
	var val6=store.getTiddlerSlice(val1,'PersonalRank')
	var val7=store.getTiddlerSlice(val1,'ProfessionalRank')
	out.push(fmt.format([val2,val3,val4,val5,val6,val7,val1]));
   }
   return out.join('\n');
</script>
}}}
+++[Ranked Below 9]
{{centeredTable{
<script>
   var out=[];
   var fmt='| %0 | %1 | %2 | %3 | %4 | %5 | {{fine{[[%6|%6]]}}} |';
   var tids=store.getMatchingTiddlers("Wine && ! excludeLists && ! Trash","modified").reverse();
   var hdr="|sortable|k\n| !Name | !Grape  | !Year | !Country | !Personal Rank | !Professional Rank ||h"

   out.push(hdr);
	if (!tids.length) out=["No Wines found"];

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") >=9 ) continue;
	if (store.getTiddlerSlice(val1,"PersonalRank") <8 ) continue;
	if (store.getTiddlerSlice(val1,"PersonalRank") == "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
	var val2=store.getTiddlerSlice(val1,'Name')
	var val3=store.getTiddlerSlice(val1,'Grape')
	var val4=store.getTiddlerSlice(val1,'Year')
	var val5=store.getTiddlerSlice(val1,'Country')
	var val6=store.getTiddlerSlice(val1,'PersonalRank')
	var val7=store.getTiddlerSlice(val1,'ProfessionalRank')
	out.push(fmt.format([val2,val3,val4,val5,val6,val7,val1]));
   }
   return out.join('\n');
</script>
}}}===
+++[Ranked Below 8]
{{centeredTable{
<script>
   var out=[];
   var fmt='| %0 | %1 | %2 | %3 | %4 | %5 | {{fine{[[%6|%6]]}}} |';
   var tids=store.getMatchingTiddlers("Wine && ! excludeLists && ! Trash","modified").reverse();
   var hdr="|sortable|k\n| !Name | !Grape  | !Year | !Country | !Personal Rank | !Professional Rank ||h"

   out.push(hdr);
	if (!tids.length) out=["No Wines found"];

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") >=8 ) continue;
	if (store.getTiddlerSlice(val1,"PersonalRank") == "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
	var val2=store.getTiddlerSlice(val1,'Name')
	var val3=store.getTiddlerSlice(val1,'Grape')
	var val4=store.getTiddlerSlice(val1,'Year')
	var val5=store.getTiddlerSlice(val1,'Country')
	var val6=store.getTiddlerSlice(val1,'PersonalRank')
	var val7=store.getTiddlerSlice(val1,'ProfessionalRank')
	out.push(fmt.format([val2,val3,val4,val5,val6,val7,val1]));
   }
   return out.join('\n');
</script>
}}}===}}}
| Personal | Professional | Reference Information |h
| 10 | 95-100 | Extraordinary wine in an exceptional vintage |
| 9 | 90-94 | Exceptional wine |
| 8 | 85-89 | Outstanding wine |
| 7 | 80-84 | Good wine |
| 6 | 75-79 | Below Average wine |
| 5 | <74 | Not a good wine |
{{centeredTable{
<script>
   var out=[];
   var fmt='| %0 | %1 | %2 | %3 | %4 | {{fine{[[%5|%5]]}}} |';
   var tids=store.getMatchingTiddlers("Wine && ! excludeLists && ! Trash","created");
   var hdr="|sortable|k\n| !Name | !Grape | !Year | !Recommended By | !Purchased ||h"

   out.push(hdr);
	if (!tids.length) out=["No Wines found"];

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") != "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
	var val2=store.getTiddlerSlice(val1,'Name')
	var val3=store.getTiddlerSlice(val1,'Grape')
	var val4=store.getTiddlerSlice(val1,'Year')
	var val5=store.getTiddlerSlice(val1,'RecommendedBy')
	var val6=store.getTiddlerSlice(val1,'Purchased')
	out.push(fmt.format([val2,val3,val4,val5,val6,val1]));
   }
   return out.join('\n');
</script>
}}}
{{centeredTable{
<script>
   var out=[];
   var fmt='| %0 | %1 | %2 | %3 | %4 | {{fine{[[%5|%5]]}}} |';
   var tids=store.getMatchingTiddlers("Wine && ! excludeLists && ! Trash","created");
   var hdr="|sortable|k\n| !Name | !Grape | !Year | !Recommended By | !Purchased ||h"

   out.push(hdr);
	if (!tids.length) out=["No Wines found"];

   for (var i=0; i<tids.length; i++) {
	var val1=tids[i].title;
	if (store.getTiddlerSlice(val1,"PersonalRank") != "Not Rated") continue;
	if (store.getTiddlerSlice(val1,"Purchased") != "No") continue;
	var val2=store.getTiddlerSlice(val1,'Name')
	var val3=store.getTiddlerSlice(val1,'Grape')
	var val4=store.getTiddlerSlice(val1,'Year')
	var val5=store.getTiddlerSlice(val1,'RecommendedBy')
	var val6=store.getTiddlerSlice(val1,'Purchased')
	out.push(fmt.format([val2,val3,val4,val5,val6,val1]));
   }
   return out.join('\n');
</script>
}}}
Name: 
Grape: 
Year: 
Country: ?
~PersonalRank: Not Rated
~ProfessionalRank: N/A
~RecommendedBy: N/A
Purchased: No
!!!Notes:


<<newReminder>>
!!!&nbsp;"do what you have to do now, so you can do what you want to do later" {{floatright{+++^[Statistics]<<tiddler ShowTiddlerStatistics>>===+++^65em^[Reminders]{{small{<<tiddler Reminders>>}}}===}}}
[>img(400px+,auto)[Work Picture|Images/yourpicturehere.JPG]]<<tiddler WorkMenu>>
| <<tiddler "CustomCommands::WorkContact">> | <<tiddler "CustomCommands::NewBJSA">> | <<tiddler "CustomCommands::EncryptWork">> |
| <<tag [[Work Directory|WDir]]>> | <<tag BJSA>> | <<tag [[Encrypted Work]]>> |
<script label="$1">
	var who=prompt("Please set your $1",config.options.txt$1);
	if (!who||!who.trim().length) return false;
	config.options.txt$1=who;
	saveOptionCookie("txt$1");
	var tid=story.findContainingTiddler(place);
	if (tid) story.refreshTiddler(tid.getAttribute("tiddler"),null,true); // sync containing tiddler
	var nodes = document.getElementsByTagName("input");
	for(var t=0; t<nodes.length; t++) // sync any input fields that show $1
		if(nodes[t].getAttribute("option")=="txt$1") nodes[t].value=who;
	return false;
</script><script>
	place.lastChild.title="click to change your $1";
	place.lastChild.innerHTML=config.options.txt$1;
</script>
__''Random Quotes and Thoughts''__
<<QOTD Quotations 50000>>
<<tiddler DateTime>>
__''Reminders''__ {{floatright{<html><a href="javascript:;" onclick="story.closeAllTiddlers();restart();" title="Restart Display" class="tiddler" style="border: none;">&Omega;</a></html>}}}
<<showReminders leadtime:2 tag:"!Completed">><script>
   setTimeout("config.refreshers.content(document.getElementById('hD'))",3600000);
</script>
/***
|Name:|deleteAllTaggedPlugin|
|Version:|1.8|
|Source:|http://www.STRM.us/Private/IJSTaskManager.htm#deleteAllTaggedPlugin|
|Author:|Mike Praeuner|
|OriginalSource:|http://ido-xp.tiddlyspot.com/#DeleteAllTaggedPlugin|
|OriginalAuthor:|Ido Magal (mailto:ido@idomagal.com)|
|CoreVersion:|2.4.3|
|Description|**Experimental** Delete Tiddler(s) tagged with Tiddler title + source tiddler |

!Revisions
*06.08.09 MTP v1.8
** change Refresh from story.refreshTiddler(story.findContainingTiddler(place).getAttribute("tiddler"),null,true); to refreshDisplay();
*05.21.09 MTP v1.7
**Clean up formatting, add TrashPluginCompatibility, disable autosave during operation, remove refresh until code fixed
*03.26.09 MTP v1.6
**Added tiddler refresh at end to remove deleted items from display
*01.29.09 MTP v1.5
**Does not match Source website, maintaining as a variant with delete source function
Original Concept (DeleteDoneTasks) by Simon Baird (mailto:simon.baird@gmail.com)
!Example
To use this insert {{{<<deleteAllTagged>>}}} into the desired tiddler.

Example usage:
{{{<<deleteAllTagged>>}}}
<<deleteAllTagged>>
Example + Delete Source Tiddler
{{{<<deleteAllTagged "delete these actions" delete>>}}}
<<deleteAllTagged "delete these actions" delete>>
!Code
***/
//{{{
config.macros.deleteAllTagged = {
	handler: function ( place,macroName,params,wikifier,paramString,tiddler ) {
		var buttonTitle = params[0] ? params[0] : "Delete Tagged w/ '"+tiddler.title+"'"; // simon's tweak
		var alsoDeleteThisTiddler = params[1] ? params[1] : "";
		createTiddlyButton( place, buttonTitle, "Delete every tiddler tagged with '"+tiddler.title+"'", this.deleteAllTagged( tiddler.title, alsoDeleteThisTiddler == "delete" ));
		config.options.chkAutosave=false;
	}, //end handler

	deleteAllTagged: function(tag,deleteMe) {
		return function() {
			var collected = [];
			store.forEachTiddler( function ( title,tiddler ) {
				if ( tiddler.tags.contains( tag )){
 					collected.push( title );
				} //end if
 			}); //end forEach

		if ( collected.length == 0 ){
			alert( "No tiddlers found tagged with '"+tag+"'." );
			} else {
			if ( confirm( "These tiddlers are tagged with '"+tag+"'\n'"
			+ collected.join( "', '" ) + "'\n\n\n"
			+ "Are you sure you want to delete these?" )){
				for ( var i=0;i<collected.length;i++ ){
					if (config.commands.deleteTiddler.sendToTrash){
						config.commands.deleteTiddler.sendToTrash(collected[i]);
						} else {
						store.deleteTiddler(collected[i]);
						displayMessage( "Deleted '"+collected[i]+"'" );
					} //end if else
				story.closeTiddler( collected[i], true );
				} //end for loop
			} //??
		} //end if collected

		if (deleteMe) {
			if ( confirm( "Also delete this tiddler ('"+tag+"')?" ) ) {
				if (config.commands.deleteTiddler.sendToTrash){
					config.commands.deleteTiddler.sendToTrash( tag );
					} else {
					store.deleteTiddler( tag );
					displayMessage( "Deleted '"+tag+"'" );
					story.refreshTiddler(story.findContainingTiddler(place).getAttribute("tiddler"),null,true);
				} //end if else
				story.closeTiddler( collected[i], true );
				story.closeTiddler( tag, true );
			} //end if confirm
		} //end if deleteMe
		config.options.chkAutosave=true;
		autoSaveChanges();
		refreshDisplay();
		} //end anonymous return function
	} //end deleteAllTagged function
}; //end deleteAllTagged macro
//}}}
/***
|Name:|deleteCompletedPlugin|
|Version:|1.8|
|Source:|http://www.STRM.us/Private/IJSTaskManager.htm#deleteCompletedPlugin|
|Author:|Mike Praeuner|
|OriginalSource:|http://ido-xp.tiddlyspot.com/#DeleteAllTaggedPlugin|
|OriginalAuthor:|Ido Magal (mailto:ido@idomagal.com)|
|CoreVersion:|2.4.3|
|Description|**Experimental** Delete Completed Tiddlers based on date modified and tag|

!Revisions
*06.08.09 MTP v1.8
** change Refresh from story.refreshTiddler(story.findContainingTiddler(place).getAttribute("tiddler"),null,true); to refreshDisplay();
*05.21.09 MTP v1.7
**Clean up formatting, add TrashPluginCompatibility, disable autosave during operation, remove refresh until code fixed
*03.26.09 MTP v1.6
**Added tiddler refresh at end to remove deleted items from display
*01.29.09 MTP v1.5
**Does not match Source website, maintaining as a variant with delete source function
Original Concept (DeleteDoneTasks) by Simon Baird (mailto:simon.baird@gmail.com)
!Example
Example usage: (For Items tagged Completed & Task)
{{{<<deleteCompleted>>}}}
<<deleteCompleted>>
{{{<<deleteCompleted daysOld:5 title:'Delete 5d'>>}}}
<<deleteCompleted daysOld:5 title:'Delete 5d'>>
{{{<<deleteCompleted daysOld:0 title:'Delete 0d'>>}}}
<<deleteCompleted daysOld:0 title:'Delete 0d'>>
!Code
***/
//{{{
config.macros.deleteCompleted = {
	handler: function (place,macroName,params,wikifier,paramString,tiddler) {
		var namedParams = (paramString.parseParams('daysOld'))[0];
		var daysOld = namedParams['daysOld'] ? namedParams['daysOld'][0] : 30; // default
		var buttonTitle = namedParams['title'] ? namedParams['title'][0] : "Delete Completed Actions";
		createTiddlyButton(place,buttonTitle,"Delete Completed actions older than "+daysOld+" days old",this.deleteCompleted(daysOld));
		config.options.chkAutosave=false;
	}, //end handler

	deleteCompleted: function(daysOld) {
		return function() {
 			var collected = [];
 			var compareDate = new Date();
 			compareDate.setDate(compareDate.getDate() - daysOld);
	 		store.forEachTiddler(function (title,tiddler) {
 				if (tiddler.tags.containsAll(["Completed" , "Task"]) && tiddler.modified < compareDate) {
 					collected.push(title);
 				} //end if
			}); //end forEach

	if (collected.length == 0) {
		alert("No Completed actions found older than "+daysOld+" days");
		} else {
		if (confirm("Completed actions older than "+daysOld+" days:\n'"
		+ collected.join("', '") + "'\n\n\n"
		+ "Are you sure you want to delete these actions?")) {
			for (var i=0;i<collected.length;i++) {
				if (config.commands.deleteTiddler.sendToTrash) {
					config.commands.deleteTiddler.sendToTrash(collected[i]);
					} else {
					store.deleteTiddler(collected[i]);
					displayMessage("Deleted '"+collected[i]+"'");
				} //end if else
			story.closeTiddler( collected[i], true );;
			} //end for loop
			config.options.chkAutosave=true;
			autoSaveChanges()
			refreshDisplay();
			} //??
		} //end collected else
		} //end anonymous return function
	}  //end deleteCompleted function

}; //end deleteCompleted Macro
//}}}
/***
|''Name:''|extendRenameTag|
|''Version:''|1.0|
|''Author:''|Mike Praeuner|
|''Description:''|Provides rename tag function for tag drop down|
|''~TiddlyWiki:''|Version 2.0.8 or better|
|''Original Author:''|SaqImtiaz|
|''Original Source:''|http://tw.lewcid.org//#TaggerPlugin|
Note this plugin has been customized for this document and is a variant of the original source.
Please refer to the original plugin http://tw.lewcid.org//#TaggerPlugin for extended use.
DO NOT USE in the same document with TaggerPlugin (use one or the other)
***/
//{{{

window.lewcidTiddlerSwapTag =  function (tiddler, oldTag, newTag){
                    for (var i = 0; i < tiddler.tags.length; i++)
			  if (tiddler.tags[i] == oldTag) {
				  tiddler.tags[i] = newTag;
				  return true;}
                         return false;
}

window.lewcidRenameTag = function(e) {
                    var tag=this.getAttribute("tag");
                    var newtag=prompt("Rename tag '"+tag+"' to:",tag);

                    if ((newtag==tag)||(newtag==null)) {return false;}

                    if(store.tiddlerExists(newtag))
                               {if(confirm(config.messages.overwriteWarning.format([newtag.toString()])))
                                             story.closeTiddler(newtag,false,false);
                               else
                                             return null;}

                    tagged=store.getTaggedTiddlers(tag);
                    if (tagged.length!=0){
                          for (var j = 0; j < tagged.length; j++)
                              lewcidTiddlerSwapTag(tagged[j],tag,newtag);}

                    if (store.tiddlerExists(tag))
                       {store.saveTiddler(tag,newtag);}
                    if (document.getElementById("tiddler"+tag))
                       {var oldTagTiddler =  document.getElementById(story.idPrefix + tag);
                       var before= story.positionTiddler(oldTagTiddler);
                       var place = document.getElementById(story.container);
                       story.closeTiddler(tag,false,false);
                       story.createTiddler(place,before,newtag,null);
                       story.saveTiddler(newtag);}
                    if(config.options.chkAutoSave)
                                                      saveChanges();
                    return false;
}

window.onClickTag=function(e)
{
	if (!e) var e = window.event;
	var theTarget = resolveTarget(e);

        var nested = (!isNested(theTarget));
        if ((Popup.stack.length > 1)&&(nested==true)) {Popup.removeFrom(1);}
        else if(Popup.stack.length > 0 && nested==false) {Popup.removeFrom(0);};

        var theId = (nested==false)? "popup" : "nestedtagger";
        var popup = createTiddlyElement(document.body,"ol",theId,"popup",null);
        Popup.stack.push({root: this, popup: popup});

	var tag = this.getAttribute("tag");
	var title = this.getAttribute("tiddler");
	if(popup && tag)
		{
		var tagged = store.getTaggedTiddlers(tag); 
		var titles = [];
		var li,r;
		for(r=0;r<tagged.length;r++)
			if(tagged[r].title != title)
				titles.push(tagged[r].title);
		var lingo = config.views.wikified.tag;
		if(titles.length > 0)
			{
			var openAll = createTiddlyButton(createTiddlyElement(popup,"li"),lingo.openAllText.format([tag]),lingo.openAllTooltip,onClickTagOpenAll);
			openAll.setAttribute("tag",tag);
			createTiddlyElement(createTiddlyElement(popup,"li"),"hr");
			for(r=0; r<titles.length; r++)
				{
				createTiddlyLink(createTiddlyElement(popup,"li"),titles[r],true);
				}
			}
		else
			createTiddlyText(createTiddlyElement(popup,"li",null,"disabled"),lingo.popupNone.format([tag]));
		createTiddlyElement(createTiddlyElement(popup,"li"),"hr");
		var h = createTiddlyLink(createTiddlyElement(popup,"li"),tag,false);
		createTiddlyText(h,lingo.openTag.format([tag]));

		createTiddlyElement(createTiddlyElement(popup,"li"),"hr");

		var renameTagButton = createTiddlyButton(createTiddlyElement(popup,"li"),("Rename tag '"+tag+"'"),null,lewcidRenameTag);
		renameTagButton.setAttribute("tag",tag)
		}
	Popup.show(popup,false);
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	return(false);
}

if (!window.isNested)
   window.isNested = function(e) {
        while (e != null) {
                var contentWrapper = document.getElementById("contentWrapper");
                if (contentWrapper == e) return true;
                e = e.parentNode;
                }
        return false;
   };

//}}}
/***
|Name:|ExtendTagButtonPlugin|
|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;
}

//}}}
<<selectPalette>><script>place.lastChild.style.width="10em";place.lastChild.style.fontSize="8pt";</script>{{floatright{<<paletteView [[ColorPalette]]>>}}} After Changing palette select refresh on the toolbar to update the paletteView Macro

!!!Theme / Palette Test
TiddlyWiki is a wiki-modeled client-side single-page application written by Jeremy Ruston that is designed to be used as a personal notebook. It is a single self-contained HTML file that includes CSS and JavaScript code. When the user downloads it to their PC, TiddlyWiki can save the entered information by overwriting itself on the user's disk, at the user's request. Following TiddlyWiki conventions, users can make a new entry, called a tiddler, in their local copy of the TiddlyWiki file and save it for future reference. Existing tiddlers can also be modified or deleted in the same way. Because it runs under most browsers and requires no installation, it can be easily used as a portable personal wiki.


[<IMG[images/fire.png]]
[>IMG[images/fire2.png]]
!!!Test Text for Fun
I love to play with my Wiki <<EncryptionDecryptAll>>


!heading 1
!!heading 2
!!!heading3
----
Existing Tag <<tag palette>> Code={{{<<tag palette>>}}}
non-Existing Tag <<tag paletteOld>> Code={{{<<tag paletteOld>>}}}
Existing Link= [[palette]] Code={{{[[palette]]}}}
non-Existing Link= [[paletteOld]] Code={{{[[paletteOld]]}}}
<hr>
> This is a blockquote
> This is a blockquote
>> This is a blockquote
>> This is a blockquote
>>> This is a blockquote
> This is a blockquote

!!!~TableExamples
@@display:block;width:400px;{{twocolumns{
| sortable |k
|column1|column2<<autosort>>|column3|h
| 1 | row1 | 31 |
| 2 | row4 | 41 |
| 3 | row2 | 96 |
| 4 | row5 | 12 |
| [[5]] | [[row3]] | [[14]] |

|column1|column2<<autosort>>|column3|h
| 1 | row1 | 31 |
| 2 | row4 | 41 |
| 3 | row2 | 96 |
| 4 | row5 | 12 |
| [[5]] | [[row3]] | [[14]] |
}}}@@
!!!Sortable Table w/ Tabs
@@display:block;width:415px;<<tabs palettetabs
"Tab 1" "Tab 1 mouseover" palette##~TableExamples
"Tab 2" "Tab 2 mouseover" palette##~TableExamples
"Tab 3" "Tab 3 mouseover" palette##~TableExamples
>>@@
!!!Code View
/***
My Code Here
***/
/*{{{*/
window.oldDisplayMessage = displayMessage;
displayMessage = function (text,linkText)
{ oldDisplayMessage(text,linkText);
setTimeout( 'clearMessage()', 7000 );}
/*}}}*/
<<tabs txttest
'Urgent test' 'Urgent test Tab' test##Urgent
'Pending test' 'Pending test Tab' test##Pending
'Completed test' 'Completed test Tab' test##Completed
>>
{{button{<script label="New Task">
 var newTiddler = new Tiddler();
 newTiddler.title = prompt('Enter a new task title','New Project Task');
 newTiddler.tags[0] = "test";
 newTiddler.tags[1] = "Task";
 newTiddler.tags[2] = "excludeLists";
 newTiddler.modifier = config.options.txtUserName;
 if(config.macros.reminders){
 newTiddler.text = "Task:\nReminder: <<newReminder>>\n!!!Items\n#\n#\n!!!Notes\n\n!!!Due";
 } else {newTiddler.text = "Task:\n!!!Items\n#\n#\n!!!Notes\n\n!!!Due";}
 store.addTiddler(newTiddler);
 story.displayTiddler(null,newTiddler.title,DEFAULT_EDIT_TEMPLATE);
 story.focusTiddler(newTiddler.title,"title");
</script>}}} <<deleteAllTagged "Delete this Project" delete>>
@@display:none;"
!!!Urgent
~~Urgent Items~~
<script>
//	var tag=store.getMatchingTiddlers("test && Urgent && ! Completed && ! Trash","+title");
	var tag=store.getMatchingTiddlers("test && Urgent && ! Completed && ! Trash","modified").reverse();
	var hdr="|sortable|k\n| !Title | !Task | !Reminders | !Urgent? | !Complete? |h";
	var fmt="| [[%0|%0]] | %1 | ~~<<tiddler [[%0##Due]]>>~~ | [X(%0:Urgent)] | [X(%0:Completed)] |";
	var out=[hdr];
		if (!tag.length) out=["No Tiddlers found"];
	for (var i=0; i<tag.length; i++)
		out.push(fmt.format([tag[i].title,store.getTiddlerSlice(tag[i].title, "Task") ]));
	return out.join('\n');
</script>
!!!Pending
~~Pending Items~~
<script>
//	var tag=store.getMatchingTiddlers("test && ! Urgent && ! Completed && ! Trash","+title");
	var tag=store.getMatchingTiddlers("test && ! Urgent && ! Completed && ! Trash","modified").reverse();
	var hdr="|sortable|k\n| !Title | !Task | !Reminders | !Urgent? | !Complete? |h";
	var fmt="| [[%0|%0]] | %1 | ~~<<tiddler [[%0##Due]]>>~~ | [X(%0:Urgent)] | [X(%0:Completed)] |";
	var out=[hdr];
		if (!tag.length) out=["No Tiddlers found"];
	for (var i=0; i<tag.length; i++)
		out.push(fmt.format([tag[i].title,store.getTiddlerSlice(tag[i].title, "Task") ]));
	return out.join('\n');
</script>
!!!Completed
~~Completed Items~~
<script>
//	var tag=store.getMatchingTiddlers("test && Completed && ! Trash","+title");
	var tag=store.getMatchingTiddlers("test && Completed && ! Trash","modified").reverse();
	var hdr="|sortable|k\n| !Title | !Task | !Urgent? | !Complete? |h";
	var fmt="| [[%0|%0]] | %1 | [X(%0:Urgent)] | [X(%0:Completed)] |";
	var out=[hdr];
		if (!tag.length) out=["No Tiddlers found"];
	for (var i=0; i<tag.length; i++)
		out.push(fmt.format([tag[i].title,store.getTiddlerSlice(tag[i].title, "Task") ]));
	return out.join('\n');
</script>
@@
Task:
!!!Items
#
#
!!!Notes

!!!Due
Task:
!!!Items
#
#
!!!Notes

!!!Due
Task:
!!!Items
#
#
!!!Notes

!!!Due
Task:
Reminder: <<newReminder>>
!!!Items
#
#
!!!Notes

!!!Due
/***
|Name:|zConfig|
|Version:|1.0|
|Author:|Mike Praeuner|
|CoreVersion:|2.4.3|
|Description|Hard code cookies & modify shadow tiddlers|
***/
{{{
// Hard Code Core
config.options.txtUserName="Mike P.";
config.options.txtBackupFolder="Backup";
config.options.chkAnimate=false;
config.options.chkSaveBackups=true;
config.options.chkAutoSave=true;
config.options.txtTheme = "NewLayoutTheme";
readOnly = false; // Always editable
config.options.chkHttpReadOnly = false; // means web visitors can experiment with your site by clicking edit
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.options.chkGenerateAnRssFeed   = false;         // default false
// Hard Code Plugin
config.options.chkShowQuickEdit=true;  //QuickEditPlugin - show edit bar
config.options.chkSearchListTiddler=true;
config.options.chkScrollSidebars=false;
config.options.chkStickyPopups=true;
config.options.chkShowRightSidebar=false;
config.options.chkShowLeftSidebar=false;
// Modify Shadow Tiddler Site Information
merge(config.shadowTiddlers,{
	SiteTitle: "New Layout Experiment",
	SiteSubtitle: "~TiddlyWiki v<<version>>",
	SiteUrl: "",
	DefaultTiddlers: "GettingStarted",
	WindowTitle: "<script>return config.options.txtUserName</script>'s New Layout Experiment - a reusable [[Encryptable|Encrypted]] <html><a href='javascript:;' onclick='story.closeAllTiddlers();restart();'>Notebook</a></html> v<<version>> - Last Modified: <script>document.write(document.lastModified);</script>"
	});
}}}