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 0em 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0em 1em 1em; left:0px; top:0px;}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none ! important;}
#displayArea {margin: 1em 1em 0em 1em;}
/* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
noscript {display:none;}
}
/*}}}*/
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>

<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>

<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
<!--{{{-->
<div class='toolbar' macro='toolbar [[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'></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>>
/*{{{*/

window.saveChanges = function(){};

setStylesheet(
	"label {width:8em; float:left; text-align:right; width:9em; font-size:1.1em; padding:3px;  height:1.5em: top:-20px; margin: 0px -2px 0 0;}"+ 
//	"div.wizardFooter {padding-left:0em}"+ 
	"div.wizardStep > input {display:fixed; padding:3px; margin-bottom:5px; margin-top:0px; margin-right:0px}",
'labelStyles');

merge(config.macros.importTiddlers, {
	wizardTitle: "Import tiddlers",
	step1Title: "Step 1: Locate the server or TiddlyWiki file",
	step1Html: "Specify the type of the server: <select name='selTypes'><option value=''>Choose...</option></select><br>Enter the URL here: <input type='text' size=50 name='txtPath'><br><input type='hidden' size=50 name='txtBrowse'><br><hr>...or select a pre-defined feed: <select name='selFeeds'><option value=''>Choose...</option></select>"
});

merge(config.optionsDesc,{
	txtUserName: "",
	chkRegExpSearch: "Enable regular expressions for searches",
	chkCaseSensitiveSearch: "Case-sensitive searching",
	chkIncrementalSearch: "Incremental key-by-key searching",
	chkAnimate: "Enable animations",
	chkSaveBackups: "",
	chkAutoSave: "",
	txtTheme: "Change the TiddlyWiki theme being used",
	chkGenerateAnRssFeed: "",
	chkSaveEmptyTemplate: "",
	chkOpenInNewWindow: "Open external links in a new window",
	chkToggleLinks: "Clicking on links to open tiddlers causes them to close",
	chkHttpReadOnly: "",
	chkForceMinorUpdate: "",
	chkConfirmDelete: "Require confirmation before deleting tiddlers",
	chkInsertTabs: "Use the tab key to insert tab characters instead of moving between fields",
	txtBackupFolder: "",
	txtMaxEditRows: "Maximum number of rows in edit boxes",
	txtFileSystemCharSet: "Default character set for saving changes (Firefox/Mozilla only)"});

merge(config.macros.options,{
	wizardTitle: "Change Settings",
	step1Title: "",
	step1Html: '
These options are saved in a cookie.' }); merge(config.macros.options,{ wizardTitle:"Advanced settings", step1Title:null, unknownDescription: "//(unknown)//", listViewTemplate: { columns: [ {name: 'Option', field: 'option', title: "", type: 'String'}, {name: 'Description', field: 'description', title: "", type: 'WikiText'} ], rowClasses: [ {className: 'lowlight', field: 'lowlight'} ] } }); window.ccTiddlyVersion = '1.7.6'; window.workspacePermission= {}; window.url = "http://mollycat.ucdavis.edu/cctiddly"; window.url= 'http://mollycat.ucdavis.edu/cctiddly/'; window.workspace = ""; window.fullUrl = window.url; if (config.options.txtTheme == "") config.options.txtTheme = 'purpleTheme'; workspacePermission.upload = 1;workspacePermission.anonC = 1 ; workspacePermission.anonR = 1; workspacePermission.anonU = 0; workspacePermission.anonD = 0; workspacePermission.userC = 1 ; workspacePermission.userR = 1; workspacePermission.userU = 1; workspacePermission.userD = 0; workspacePermission.canCreateWorkspace = 1; window.workspace_delete = "D"; window.workspace_udate = "D"; var serverside={ url:"http://mollycat.ucdavis.edu/cctiddly", //server url, for use in local TW or TW hosted elsewhere workspace:"", queryString:"", debug:0, //debug mode, display alert box for each action passwordTime:0, //defines how long password variable store in cookie. 0 = indefinite messageDuration:5000, //displayMessage autoclose duration (in milliseconds), 0=leave open loggedIn:0, can_create_account:"1", openId:"1" }; config.defaultCustomFields = {"server.host":window.url, "server.type":"cctiddly", "server.workspace":window.workspace}; config.shadowTiddlers.OptionsPanel = "[[help|Help]] <br />[[settings|AdvancedOptions]]<br /><<ccOptions>>"; readOnly =false; config.options.chkHttpReadOnly = false; //make it HTTP writable by default config.options.chkSaveBackups = false; //disable save backup //config.options.chkAutoSave = false; //disable autosave config.options.chkUsePreForStorage = false; /*}}}*/
|''Description:''|LocalccTiddly|
|''Type:''|cctiddly|
|''URL:''|http://127.0.0.1/Trunk/|
|''Workspace:''|martin|
|''Description:''|Getting Things Done GTD|
|''Type:''|tiddlywiki|
|''URL:''|http://nathanbowers.com/gtdtw/|
|''Workspace:''|Main|
|''Description:''|MonkeyPirate|
|''Type:''|tiddlywiki|
|''URL:''|http://mptw.tiddlyspot.com/empty.html|
|''Workspace:''|Main|
|''Description:''|TeamTasks |
|''Type:''|tiddlywiki|
|''URL:''|http://getteamtasks.com/teamtasks.html|
|''Workspace:''|Main|
|''Description:''|TiddlyThemes |
|''Type:''|tiddlywiki|
|''URL:''|http://tiddlythemes.com|
|''Workspace:''|Main|
|''Description:''|TiddlyTools |
|''Type:''|TiddlyWiki|
|''URL:''|http://tiddlytools.com|
|''Workspace:''|Main|
|''Description:''|TiddlyVault |
|''Type:''|TiddlyWiki|
|''URL:''|http://tiddlyvault.tiddlyspot.com/|
|''Workspace:''|Main|
|''Description:''|Visual TW |
|''Type:''|tiddlywiki|
|''URL:''|http://visualtw.ouvaton.org/VisualTW.html|
|''Workspace:''|Main|
(this content is a work in progress)

!!!ccTiddly Tiddlers 

[[AnonDefaultTiddlers]]

Allows you to specify a different set of tiddlers to be loaded for anonymous users. Logged in users will be shown the [[DefaultTiddlers]].

[[ccAssignments]]

!!! Predefined ccTiddly Tags 

!!!!wizard
Displays the tiddler without showing the date editor tags or title. 

!!!!private
Only administrators of a workspace can read tiddlers tagged private.

!!! Working Offline : 
To take a copy of a ccTiddly workspace offline add &standalone=1 to the end of the URI and you will be prompted to download an offline file.


!!!{{{<<ccUpload>>}}}
If enabled on the server users can upload files to the ccTiddly server

!!!{{{<<ccLogin>>}}}
Displays the login box if the users is not logged in, if the user is logged in they are shown a logout button

!!!{{{<<ccLoginStatus>>}}}
As with {{{<<ccLogin>>}}} except this displays a link to the login tiddler so can be used where space is tight. 

!!!{{{<<ccCreateWorkspace>>}}}
Allows users with permission to create a workspace and define its permissions.

!!!{{{<<ccEditWorkspace>>}}}
Allows admin users to change the permission of a workspace.

!!!{{{<<ccAdmin>>}}}
Allows admin users to add and remove admin users for a workspace.

!!!{{{<<ccVersion>>}}}
Allows users to confirm which version of ccTiddly they are using.
~TiddlyWiki is a single html file containing all the characteristics of a wiki - all the content, all the functionality (including editing, saving, tagging and searching) and the style sheet. Because it's a single file, it's very portable - you can email it, put it on a web server or share it via a USB stick. ccTiddly provides a serverside backend to ~TiddlyWiki so you can store your content on the web and access it from anywhere. 

Together the two provide a powerful combination which allows you to collaborate with your colleages online, you can then tear a copy of all the work to take on a plane or train journey.  When you have found an internet connection again you can sync your changes with the online copy and you will be notified of any conflicts. 

Some things you could do with ccTiddly workspace include: 

	* A team/public Website
	* A Blog
    * A personal notebook
    * A GTD ("Getting Things Done") productivity tool
    * A collaboration/communication tool
	* A TeamTasks implementation
    * For building websites (this site is a TiddlyWiki file!)
    * For rapid prototyping
    * ...and much more!

You can import and export data to and from all sorts of places. Check out the backstage > import options. There's a more detailed list of features here.

<<slider cctHelpIntro [[ccTiddly Introduction]] "ccTiddly Introduction »" "A introduction to the basics of TiddlyWiki.">>
<<slider cctHelpFormatting [[TiddlyWiki Formatting Guide]] "Tiddly Wiki Formatting Guide »" "A basic guide to TiddlyWiki formatting.">>
<<slider cctHelpccTiddlyMacros [[ccTiddly Macros]] "ccTiddly Macros »" "A Guide to all the ccTiddly Macros">>
<<slider cctHelpTiddlyWikiMacros [[TiddlyWiki Macros]] "TiddlyWiki Macros »" "A Guide to all the TiddlyWiki Macros">>

<<ccAdmin>>
More info on Osmosoft can be found at [[osmosoft.com|http://osmosoft.com/]]


Please see the TiddlyWiki community wiki documentation : http://tiddlywiki.org/wiki/TiddlyWiki_Markup

!!!{{{<<today>>}}}
Shows current date.

!!!{{{<<version>>}}} 
This macro shows the version number of the current TiddlyWiki document.

!!!{{{<<Alltags>>}}}
Lists all tags. Clicking on a tag lists all the tiddlers assigned that tag. 

!!!{{{<<List [type]>>}}} 
Parameters : (all (default), missing, orphans, shadowed, touched, filter)

!!!{{{<<Timeline [date] [length] [format]>>}}} 
 The timeline macro creates a list of tiddlers sorted by a date specified.

Example : 
{{{<<timeline "modified" "0" "ddd, YYYY-0MM-0DD">>}}}

Produces : 
<<timeline "modified" "0" "ddd, YYYY-0MM-0DD">>
!!!{{{<<Slider cookie tiddler label tooltip>>}}}
The slider macro allows embedding tiddlers within another tiddler, with the option to toggle the visibility of the transcluded contents.

    * cookie: variable to save the state of the slider
    * tiddler: name of the tiddler to include in the slider
    * label: title text of the slider
    * tooltip: tooltip text of the slider 

 Example
{{{<<slider chkTestSlider [[OptionsPanel]] "Options" "Open advanced options">>}}}

Produces : 
<<slider chkTestSlider [[OptionsPanel]] "Options" "Open advanced options">>
!!!{{{<<Tabs>>}}}
The tabs macro creates an area where it displays one of several tiddlers alternately, as the user clicks on the tab labels at the top.

It is used like this:

{{{<<tabs ID Label1 Tip1 Tiddler1 Label2 Tip2 Tiddler2 [Label3 ...]>>}}}

produces :
<<tabs ID Label1 Tip1 Tiddler1 Label2 Tip2 Tiddler2 [Label3 ...]>>

    * ID: specifies the name of a cookie used to save the information about which tab was displayed last.
    * Label1, Label2, ... define the labels that are displayed at the top of the area for each tab
    * Tip1, Tip2, ... define tooltips that explain, somewhat more verbosely than the labels, what you can expect to find on each tab.
    * Tiddler1, Tiddler2, ... name the tiddlers that are displayed on each tab. 

Obviously, there must be exactly three strings for each tab.

The syntax for the tabs macro looks like this:

{{{<<tabs txt[cookieName]
	"[label]" "[title]" [[tiddler]]
	"[label]" "[title]" [[tiddler]]
	...
     >>}}}

produces :

<<tabs txt[cookieName]
	"[label]" "[title]" [[tiddler]]
	"[label]" "[title]" [[tiddler]]
	...
     >>

!!!{{{<<Tagging [tag]>>}}}
This macro generates a list of tiddlers that carry the specified tag.

<<tagging [tag]>>

If the tag parameter is not specified, the current tiddler's name will be used instead.
!!!{{{<<Tagchooser>>}}}
!!!{{{<<NewJournal>>}}}
This macro generates a button to create a journal tiddler, using the current time and date as title.

It is otherwise identical to the NewTiddler macro.

Example : 
{{{<<newJournal [date format]>>}}}

Produces : 
<<newJournal [date format]>>

The optional parameter can be used to specify a custom date format.

In addition, all of the NewTiddler macro's parameters are valid.

!!!{{{<<NewTiddler>>}}}

 Usage

<<newTiddler [parameters]>>

Parameters

This macro uses named parameters. All parameters are optional.
|Parameter|Description|
|label |button label|
|prompt|button tooltip|
|title|title for the new tiddler (defaults to "New Tiddler")|
|text|contents for the new tiddler|
|tag|tag to be applied to the new tiddler (parameter can be used repeatedly to specify multiple tags)|
|accessKey|single letter to use as access key to trigger the button|
|focus|which of the editable fields to default the focus to (e.g. "title", "text", "tags")|
|template|template tiddler to use to display the new tiddler (defaults to EditTemplate)|
|fields|custom fields to be assigned to the new tiddler, in name:value;name:value; format|

Only fields contained as input fields in the specified template can be primed with an initial value.
[edit] Example

<<newTiddler
	label:"New Tiddler"
	text:"Hello world."
	tag:"test"
	tag:"an example"
	accessKey:"1"
	focus:"tags"
>>



!!!{{{<<Savechanges>>}}}



!!!{{{<<Search>>}}}

This macro creates an input field to perform full-text searches on a TiddlyWiki document's tiddler contents.
[edit] Usage

Example : 
{{{<<search [value]>>}}}

Produces : 

<<search [value]>>

By specifiying the value parameter, the search form can be "preloaded" with the desired term.
[edit] Options
This section is still incomplete. You can help by contributing to its expansion.
Please improve the article, or discuss the issue on the talk page.

    * case-sensitive
    * regular expressions 


!!!{{{<<Gradient>>}}}

The Gradient macro allows simple horizontal and vertical coloured gradients. They are constructed from coloured HTML elements, and don't require any images to work.
The Gradient macro is an extended macro that processes the text after it up until the next '

>>

' sequence. It looks like this:
Example : 
{{{<<gradient vert #ffffff #ffdddd #ff8888>>gradient fill>>}}}

Produces : 
<<gradient vert #ffffff #ffdddd #ff8888>>gradient fill>>

The first parameter can be vert or horiz to indicate the direction of the gradient. The following parameters are two or more colours (CSS RGB(r,g,b) format is also acceptable). The macro constructs a smooth linear gradient between each of the colours in turn.

Inline CSS definitions can be added to gradient fills like this:


Example : 
{{{<<gradient vert #000000 #660000 #aa2222>>color:#ffffff;font-size:12pt;Darkness>>}}}

Produces : 
<<gradient vert #000000 #660000 #aa2222>>color:#ffffff;font-size:12pt;Darkness>>

!!!{{{<<Closeall>>}}}
!!!{{{<<Permaview>>}}}
Changes the browser address bar to a permalink to the current Tiddler or the set of open tiddlers. It is used with the ToolbarMacro like this:

Example : 
{{{<<toolbar permalink>>}}}
Produces : 
<<toolbar permalink>>

!!!{{{<<Toolbar>>}}}
The ToolbarMacro is used in the TemplateMechanism to define the toolbar that appearthat appear either in EditMode or in ViewMode. The arguments to the ToolbarMacro is a list of command names, as discussed in the CommandMechanism..

You can precede a command name with a "+" to specify a default command that is automatically chosen when a tiddler is double-clicked, or the ctrl-Enter key combination pressed. Similarly, precede it with "-" to specify a command to be chosen when the Escape key is pressed.
!!!{{{<<Annotations>>}}}

!!!{{{<<Edit>>}}}
The command <<edit>> switches from ViewMode to EditMode. The EditMacro is either a double mouse click inside the tiddler or the entry 'edit' in the tiddler's Toolbar. It is used in ViewTemplate as ToolbarMacro like this:
Example : 
{{{<<toolbar +editTiddler>>}}}
Produces : 
<<toolbar +editTiddler>>

!!!{{{<<Message>>}}}
!!!{{{<<Refreshdisplay>>}}}
!!!{{{<<View fieldname how...>>}}}
Retrieves a specified field (given by fieldname) from the tiddler to be displayed and outputs its value in one of the following ways (the optional //how// parameter):

    * (unspecified): render as is (without formatting)
    * link: format as a link (using createTiddlyLink)
    * wikified: format using all the normal rendering rules
    * date: expects a value of the form YYYYMMDDHHMM and outputs it using either a specified format (...) or config.views.wikified.dateFormat 

The standard field names are:

    * title - the tiddler title
    * tiddler - the tiddler title (as well)
    * text - the text of the tiddler
    * modifier - the person who last modified it
    * modified - date&time of last modification
    * created - when it was created
    * tags - the tiddler tags 

If your tiddlers contain custom fields, they could be specified as well.

The view macro is used extensively in the standard tiddler rendering templates (ViewTemplate and EditTemplate).



[[Login]]
<<ccLogin>>
<<ccCreateWorkspace>>
<<ccFile>>
<<taggedTabs loginBox>>
<<ccLoginStatus>>
<<ccChangePassword>>
<<ccEditWorkspace>>
handle/proxy.php?feed=
<<ccStats>>
|~ViewToolbar|closeTiddler closeOthers +editTiddler > fields syncing permalink revisions references jump|
|~EditToolbar|+saveTiddlerHosted1 -cancelTiddler deleteTiddlerHosted|
<<ccUpload>>
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler > fields syncing permalink references jump'></div>
<div class='viewer' macro='view text wikified'></div>
config.macros.ccAbout={};
merge(config.macros.ccAbout,{
	buttonBackstageText:"about",
	buttonBackstageTooltip:"Find out more about ccTiddly ",
	stepAboutTitle:"About",
	stepAboutTextStart:"You are running ccTiddly ",
	stepAboutTextEnd:"More info about ccTiddly can be found  at <a  target=new href=http://www.tiddlywiki.org/wiki/CcTiddly>http://www.tiddlywiki.org/wiki/CcTiddly</a><br/><br/>  More information about TiddlyWiki can be found at <a target=new href=http://www.tiddlywiki.com>http://www.tiddlywiki.com</a><br/>"
});

config.macros.ccChangePassword={};
merge(config.macros.ccChangePassword,{
	title:"Change Password", 
	subTitle : "for user ", 
	step1Html: " <label for='old'>Old Password </label><input name='old' type='password'/><br/> <label for='new1'>New Password </label> <input  name='new1' type='password' /><br /><label for='new2'>Repeat Password</label> <input  name='new2' type='password' /> ",   
	buttonChangeText:"Change Password",
	buttonChangeToolTip:"Click to change your password", 
	buttonCancelText:"Cancel",
	buttonCancelToolTip:"Click to cancel",
	noticePasswordsNoMatch : "Your new passwords do not match", 
	noticePasswordWrong : "Your password is incorrect.",
	noticePasswordUpdated : "Your Password has been updated", 
	noticePasswordUpdateFailed : "Your Password was NOT updated." 
});

config.macros.ccAdmin = {}
merge(config.macros.ccAdmin,{
	stepAddTitle:"Add a new Workspace Administrator",
	WizardTitleText:"Workspace Administration.",
	buttonDeleteText:"Delete Users",
	buttonDeleteTooltip:"Click to delete users.",
	buttonAddText:"Add User",
	buttonAddTooltip:"Click to add user.",
	buttonCancelText:"Cancel",
	buttonCalcelTooltip:"Calcel adding user.",
	buttonCreateText:"Make User Admin",
	buttonCreateTooltip:"Click to make user admin.",
	labelWorkspace:"Workspace: ",
	labelUsername:"Username  : ",
	stepErrorTitle:"You need to be an administrator of this workspace.",
	stepErrorText:"Permission Denied to edit workspace : ",
	stepNoAdminTitle:"There are no admins of this workspace.",
	stepManageWorkspaceTitle:"",
	listAdminTemplate: {
	columns: [	
		{name: 'Selected', field: 'Selected', rowName: 'name', type: 'Selector'},
		{name: 'Name', field: 'name', title: "Username", type: 'String'},	
		{name: 'Last Visit', field: 'lastVisit', title: "Last Login", type: 'String'}
	],
	rowClasses: [
		{className: 'lowlight', field: 'lowlight'}
	]}
});

function ccTiddlyAutoSave(){return this;}
merge(ccTiddlyAutoSave,{
	msgSaved:"Saved ",
	msgError:"There was an error saving "
});

config.macros.ccCreateWorkspace = {}
merge(config.macros.ccCreateWorkspace, {
	wizardTitle:"Create Workspace",
	buttonCreateText:"create",
	buttonCreateWorkspaceText:"Create Workspace",
	buttonCreateTooltip:'Create new workspace',
	errorPermissions:"You do not have permissions to create a workspace.  You may need to log in.",
	msgPleaseWait:"Please wait, your workspace is being created.",
	msgWorkspaceAvailable:"Workspace name is available.",
	errorWorkspaceNameInUse:"Workspace name is already in use.",
	stepTitle:"Please enter workspace name",
	stepCreateHtml:"<input class='input' id='workspace_name' name='workspace_name' value='"+workspace+"' tabindex='1' /><span></span><input type='hidden' name='workspace_error'></input><h2></h2><input type='hidden' name='workspace_url'></input>"
});

config.macros.ccEditWorkspace={};	
merge(config.macros.ccEditWorkspace,{
	WizardTitleText:"Edit Workspace Permissions",
	stepEditTitle:null,
	stepLabelCreate:'Create',
	stepLabelRead:'Read',
	stepLabelUpdate:'Edit',
	stepLabelDelete:'Delete',
	stepLabelPermission:'',
	stepLabelAnon:'  Anonymous   ',
	stepLabelUser:' Authenticated   ',
	stepLabelAdmin:' Admin  ',
	buttonSubmitCaption:"Update Workspace Permissions",
	buttonSubmitToolTip:"Update workspace permissions",
	button1SubmitCaption:"ok",
	button1SubmitToolTip:"review permissions",
	step2Error:"Error", 
	errorTextPermissionDenied:"You do not have permissions to edit this workspace permissions.  You may need to log in.",
	errorUpdateFailed:"Permissions Not changed"
});

config.macros.ccFile = {};
merge(config.macros.ccFile,{
	wizardTitleText:"Manage Files",
	wizardStepText:"Manage files in workspace ",
	buttonDeleteText:"Delete Files",
	buttonDeleteTooltip:"Click to Delete files.",
	buttonUploadText:"Upload File",
	buttonUploadTooltip:"Click to Upload files.",
	buttonCancelText:"Cancel",
	buttonCancelTooltip:"Click to cancel.",
	labelFiles:"Existing Files ",
	errorPermissionDeniedTitle:"Permission Denied",
	errorPermissionDeniedUpload:"You do not have permissions to create a file on this server. ",
	errorPermissionDeniedView:"You do not have permissions to view files in this workspace. ",
	listAdminTemplate: {
	columns: [	
	{name: 'wiki text', field: 'wikiText', title: "", type: 'WikiText'},
	{name: 'Selected', field: 'Selected', rowName: 'name', type: 'Selector'},
	{name: 'Name', field: 'name', title: "File", type: 'WikiText'},
	{name: 'Size', field: 'fileSize', title: "size", type: 'String'}
	],
	rowClasses: [
	{className: 'lowlight', field: 'lowlight'}
	]}
});

config.macros.ccLogin={sha1:true};
merge(config.macros.ccLogin,{
	WizardTitleText:null,
	usernameRequest:"Username",
	passwordRequest:"Password",
	stepLoginTitle:null,
	stepLoginIntroTextHtml:"<label>username</label><input name=username id=username tabindex='1'><br /><label>password</label><input type='password' tabindex='2' class='txtPassword'><input   name='password'>",
	stepDoLoginTitle:"Logging you in",
	stepDoLoginIntroText:"we are currently trying to log you in.... ",
	stepForgotPasswordTitle:"Password Request",
	stepForgotPasswordIntroText:"Please contact your system administrator or register for a new account.  <br /><input id='forgottenPassword' type='hidden' name='forgottenPassword'/>",
	stepLogoutTitle:"Logout",
	stepLogoutText:"You are currently logged in as ",
	buttonLogout:"logout",
	buttonLogoutToolTip:"Click here to logout.",
	buttonLogin:"Login",
	buttonlogin:"login",
	buttonLoginToolTip:"Click to Login.",	
	buttonCancel:"Cancel",
	buttonCancelToolTip:"Cancel transaction ",
	buttonForgottenPassword:"Forgotten Password",	
	buttonSendForgottenPassword:"Mail me a New Password",
	buttonSendForgottenPasswordToolTip:"Click here if you have forgotten your password",
	buttonForgottenPasswordToolTip:"Click to be reminded of your password",
	msgNoUsername:"Please enter a username", 
	msgNoPassword:"Please enter a password",
	msgLoginFailed:"Login Failed, please try again. ", 
	configURL:url+"/handle/login.php", 
	configUsernameInputName:"cctuser",
	configPasswordInputName:"cctpass",
	configPasswordCookieName:"cctPass"
});

config.macros.ccLoginStatus={};
merge(config.macros.ccLoginStatus,{
	textDefaultWorkspaceLoggedIn:"Viewing default workspace",
	textViewingWorkspace:"Viewing Workspace : ",
	textLoggedInAs:"Logged in as ",
	textNotLoggedIn:"You are not logged in.",
	textAdmin:"You are an Administrator."
});

config.macros.ccOptions={};	
merge(config.macros.ccOptions, {
	linkManageUsers:"users",
	linkPermissions:"permissions",
	linkFiles:"files",
	linkPassword:"password",
	linkCreate:"create",
	linkOffline:"offline",
	linkStats:"statistics"	
});

config.macros.register={};	
merge(config.macros.register,{
	usernameRequest:"username",
	passwordRequest:"password",
	passwordConfirmationRequest:"confirm password",
	emailRequest:"email",
	stepRegisterTitle:"Register for an account.",
	stepRegisterIntroText:"Hi, please register below.... ",
	stepRegisterHtml:"<label> username</label><input class='input' id='reg_username' name='reg_username' tabindex='1'/><span></span><input type='hidden'  name='username_error'></input><br /><label>email</label><input class='input' name=reg_mail id='reg_mail' tabindex='2'/><span> </span><input type='hidden' name='mail_error'></input><br/><label>password</label><input type='password' class='input' id='password1' name='reg_password1' tabindex='3'/><span> </span><input type='hidden'  name='pass1_error'></input><br/><label>confirm password</label><input type='password' class='input' id='password2' name='reg_password2' tabindex='4'/><span> </span><input type='hidden'  name='pass2_error'></input>",
	buttonCancel:"Cancel",
	buttonCancelToolTip:"Cancel transaction ",
	buttonRegister:"Register",	
	buttonRegisterToolTip:"click to register",
	msgCreatingAccount:"Attempting to create the account for you.", 
	msgNoUsername:"No username entered", 
	msgEmailOk:"Email address is OK.",
	msgNoPassword:"no password entered.",
	msgDifferentPasswords:"Your Passwords do not match.",
	msgUsernameTaken:"The username requested has been taken.",
	msgUsernameAvailable:"The username is available.",
	step2Title:"",
	step2Html:"Please wait while we create you an account...",
	errorRegisterTitle:"Error",
	errorRegister:"User not created, please try again with a different username."
});

config.macros.ccStats={};
merge(config.macros.ccStats,{
	graph24HourTitle:"Last 24 hours",
	graph24HourDesc:"The number of views of this workspace in the past 24 hours",
	graph20MinsTitle:"Last 20 Minutes",
	graph20MinsDesc:"The number of views of this workspace in the last 20 minutes",
	graph7DaysTitle:"Last 7 days",
	graph7DaysDesc:"The number of views of this workspace in the last 7 days.",
	graph5MonthsTitle:"Last 5 months",
	graph5MonthsDesc:"The number of views of this workspace in the past 30 days.",
	errorPermissionDenied:"Permissions Denied to data for %0 You need to be an administrator on the %1 workspace.",
	stepTitle:"Workspace Statistics"
});
/***
|''Name:''|ccLoadRemoteFileThroughProxy (previous LoadRemoteFileHijack)|
|''Description:''|When the TiddlyWiki file is located on the web (view over http) the content of [[SiteProxy]] tiddler is added in front of the file url. If [[SiteProxy]] does not exist "/proxy/" is added. |
|''Version:''|1.1.0|
|''Date:''|mar 17, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#LoadRemoteFileHijack|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]] |
|''~CoreVersion:''|2.2.0|
|''Date:''|Nov 6, 2008|
|''Version:''|0.1|
***/

//{{{
	
version.extensions.LoadRemoteFileThroughProxy={
major:1,minor:1,revision: 0, 
date:new Date("mar 17, 2007"), 
source:"http://tiddlywiki.bidix.info/#LoadRemoteFileThroughProxy"};

if(!window.bidix)window.bidix={}; // bidix namespace
if(!bidix.core)bidix.core={};

bidix.core.loadRemoteFile=loadRemoteFile;
loadRemoteFile=function(url,callback,params){
	var urlStart = window.url;
	if((document.location.toString().substr(0,4)=="http")&&(url.substr(0,4)=="http")){ 
		url=urlStart+"/"+store.getTiddlerText("SiteProxy","/proxy")+url;
		displayMessage(url);
	}
	var a = bidix.core.loadRemoteFile(url,callback,params);
	return a;
}
//}}}
// ccAdaptorCommandsPlugin //
function ccTiddlyAdaptor(){}
merge(ccTiddlyAdaptor,{ 
	errorTitleNotSaved:"<h1>Your changes were NOT saved.</h1>", 
	errorTextSessionExpired:"Your Session has expired. <br /> You will need to log into the new window and then copy your changes from this window into the new window. ", 
	errorTextConfig:"There was a conflict when saving. <br /> Please open the page in a new window to see the changes.",
	errorTextUnknown:"An unknown error occured.",
	errorClose:"close",
	buttonOpenNewWindow:"Open a Window where I can save my changes	.... ",
	buttonHideThisMessage:"Hide this message", 
	msgErrorCode:"Error Code : "
});


//{{{
	
	config.commands.revisions = {};
	merge(config.commands.revisions,{
		text: "revisions",
		tooltip: "View another revision of this tiddler",
		loading: "loading...",
		done: "Revision downloaded",
		revisionTooltip: "View this revision",
		popupNone: "No revisions",
		revisionTemplate: "%0 r:%1 m:%2",
		dateFormat:"YYYY mmm 0DD 0hh:0mm"	
	});

	config.commands.deleteTiddlerHosted = {};
	merge(config.commands.deleteTiddlerHosted,{
		text: "delete",
		tooltip: "Delete this tiddler",
		warning: "Are you sure you want to delete '%0'?",
		hideReadOnly: true,
		done: "Deleted "
	});
	
	
// Ensure that the plugin is only installed once.
if(!version.extensions.AdaptorCommandsPlugin) {
	version.extensions.AdaptorCommandsPlugin = {installed:true};
config.commands.saveTiddlerHosted1 = {};
merge(config.commands.saveTiddlerHosted1, config.commands.saveTiddler);

config.commands.saveTiddlerHosted1.handler = function(event,src,title)
{
	var tiddlerElem = story.getTiddler(title);
	var fields = {};
	story.gatherSaveFields(tiddlerElem,fields);
	var newTitle = fields.title || title;
	if(!store.tiddlerExists(newTitle))
		newTitle = newTitle.trim();
	if(newTitle==title){  // we are not renaming the tiddler 
		var newTitle = story.saveTiddler(title,event.shiftKey);
		if(newTitle)
			story.displayTiddler(null,newTitle);		 
	} else { // the tiddler is being renamed 
		var tiddler = store.fetchTiddler(title);
		if(store.tiddlerExists(newTitle) && newTitle != title) {
			if(!confirm(config.messages.overwriteWarning.format([newTitle.toString()])))
				return false;
		}
		var adaptor = new ccTiddlyAdaptor();
		var userParams = {minorUpdate:event.shiftKey};
		var context = {title:title, newTitle:newTitle, workspace:window.workspace};
		adaptor.rename(context, userParams, config.commands.saveTiddlerHosted1.callback);
	}
	return false;
};

// implementing closeTiddler without the clearMessage();
Story.prototype.closeTiddler = function(title,animate,unused)
{
	var tiddlerElem = this.getTiddler(title);
	if(tiddlerElem) {
		this.scrubTiddler(tiddlerElem);
		if(config.options.chkAnimate && animate && anim && typeof Slider == "function")
			anim.startAnimating(new Slider(tiddlerElem,false,null,"all"));
		else {
			removeNode(tiddlerElem);
			forceReflow();
		}
	}
};

config.commands.saveTiddlerHosted1.callback = function(context, userParams) {
	var tiddler = store.fetchTiddler(context.title);
	if(tiddler) { // if tiddler exists with the old title. (we are renaming)
		story.closeTiddler(context.title,false);
		store.deleteTiddler(tiddler.title);
		tiddler.title = context.newTitle;
		store.addTiddler(tiddler);
		story.displayTiddler(null,tiddler.title);
		story.refreshTiddler(tiddler.title,null,true);
		store.notify(tiddler.title,true);
		displayMessage("Tiddler Renamed");
	} else {   //tiddler does not exist so this is a new tiddler. 
		var newTitle = story.saveTiddler(context.title,userParams.minorUpdate);
		if(newTitle)
			story.displayTiddler(null,newTitle);
		story.closeTiddler(context.title,false);

	}
}

function getServerType(fields)
{
	if(!fields)
		return null;
	var serverType = fields['server.type'];
	if(!serverType)
		serverType = fields['wikiformat'];
	if(!serverType)
		serverType = config.defaultCustomFields['server.type'];
	if(!serverType && typeof RevisionAdaptor != 'undefined' && fields.uuid)
		serverType = RevisionAdaptor.serverType;
	return serverType;
}

function invokeAdaptor(fnName,param1,param2,context,userParams,callback,fields)
{
	var serverType = getServerType(fields);
	if(!serverType)
		return null;
	var adaptor = new config.adaptors[serverType];
	if(!adaptor)
		return false;
	if(!config.adaptors[serverType].prototype[fnName])
		return false;
	adaptor.openHost(fields['server.host']);
	adaptor.openWorkspace(fields['server.workspace']);
	var ret = false;
	if(param1)
		ret = param2 ? adaptor[fnName](param1,param2,context,userParams,callback) : adaptor[fnName](param1,context,userParams,callback);
	else
		ret = adaptor[fnName](context,userParams,callback);
	return ret;
}

//# Returns true if function fnName is available for the serverType specified in fields
//# Used by (eg): config.commands.download.isEnabled
function isAdaptorFunctionSupported(fnName,fields)
{
	var serverType = getServerType(fields);
	if(!serverType || !config.adaptors[serverType])
		return false;
	if(!config.adaptors[serverType].isLocal && !fields['server.host'])
		return false;
	var fn = config.adaptors[serverType].prototype[fnName];
	return fn ? true : false;
}

config.commands.revisions.isEnabled = function(tiddler)
{
	return isAdaptorFunctionSupported('getTiddlerRevisionList',tiddler.fields);
};

config.commands.revisions.handler = function(event,src,title)
{
	var tiddler = store.fetchTiddler(title);
	userParams = {};
	userParams.tiddler = tiddler;
	userParams.src = src;
	userParams.dateFormat = config.commands.revisions.dateFormat;
	var revisionLimit = 10;
	if(!invokeAdaptor('getTiddlerRevisionList',title,revisionLimit,null,userParams,config.commands.revisions.callback,tiddler.fields))
		return false;
	event.cancelBubble = true;
	if(event.stopPropagation)
		event.stopPropagation();
	return true;
};

config.commands.revisions.callback = function(context,userParams)
// The revisions are returned as tiddlers in the context.revisions array
{
	var revisions = context.revisions;
//#displayMessage("config.commands.revisions.callback:"+revisions.length);
	popup = Popup.create(userParams.src);
	Popup.show(popup,false);
	if(revisions.length==0) {
		createTiddlyText(createTiddlyElement(popup,'li',null,'disabled'),config.commands.revisions.popupNone);
	} else {
		revisions.sort(function(a,b) {return a.modified < b.modified ? +1 : -1;});
		for(var i=0; i<revisions.length; i++) {
			var tiddler = revisions[i];
			var modified = tiddler.modified.formatString(context.dateFormat||config.commands.revisions.dateFormat);
			var revision = tiddler.fields['server.page.revision'];
			var btn = createTiddlyButton(createTiddlyElement(popup,'li'),
					config.commands.revisions.revisionTemplate.format([modified,revision,tiddler.modifier]),
					tiddler.text||config.commands.revisions.revisionTooltip,
					function() {
						config.commands.revisions.getTiddlerRevision(this.getAttribute('tiddlerTitle'),this.getAttribute('tiddlerModified'),this.getAttribute('tiddlerRevision'),this);
						return false;
						},
					'tiddlyLinkExisting tiddlyLink');
			btn.setAttribute('tiddlerTitle',userParams.tiddler.title);
			btn.setAttribute('tiddlerRevision',revision);
			btn.setAttribute('tiddlerModified',tiddler.modified.convertToYYYYMMDDHHMM());
			if(userParams.tiddler.fields['server.page.revision'] == revision || (!userParams.tiddler.fields['server.page.revision'] && i==0))
				btn.className = 'revisionCurrent';
		}
	}
};

config.commands.revisions.getTiddlerRevision = function(title,modified,revision)
{
	var tiddler = store.fetchTiddler(title);
	var context = {modified:modified};
	return invokeAdaptor('getTiddlerRevision',title,revision,context,null,config.commands.revisions.getTiddlerRevisionCallback,tiddler.fields);
};

config.commands.revisions.getTiddlerRevisionCallback = function(context,userParams)
{
	if(context.status) {
		var tiddler = context.tiddler;
		store.addTiddler(tiddler);
		store.notify(tiddler.title, true);
		story.refreshTiddler(tiddler.title,1,true);
		displayMessage(config.commands.revisions.done);
	} else {
		displayMessage(context.statusText);
	}
};

config.commands.deleteTiddlerHosted.handler = function(event,src,title)
{
	var tiddler = store.fetchTiddler(title);
		if(!tiddler)
			return false;
		var deleteIt = true;
		if(config.options.chkConfirmDelete)
		        deleteIt = confirm(this.warning.format([title]));
		if(deleteIt) {
			var ret = invokeAdaptor('deleteTiddler',title,null,null,null,config.commands.deleteTiddlerHosted.callback,tiddler.fields);
			if(ret){
			store.removeTiddler(title);
			story.closeTiddler(title,true);
			autoSaveChanges();
			store.setDirty(false);
			}
		}
		return false;

};

config.commands.deleteTiddlerHosted.callback = function(context,userParams)
{
	if(context.status) {
		displayMessage(config.commands.deleteTiddlerHosted.done + context.title);
	} else {
		if (context.statusText.indexOf("Not Found") == -1)
			displayMessage(context.statusText);
	}
};

}//# end of 'install only once'
//}}}


// ccAdaptor //

//{{{

	function isLoggedIn(){
		return (window.loggedIn == '1') 
	}

	ccTiddlyAdaptor.prototype = new AdaptorBase();

	ccTiddlyAdaptor.mimeType = 'application/json';
	ccTiddlyAdaptor.serverType = 'cctiddly'; // MUST BE LOWER CASE
	ccTiddlyAdaptor.serverParsingErrorMessage = "Error parsing result from server";
	ccTiddlyAdaptor.errorInFunctionMessage = "Error in function ccTiddlyAdaptor.%0";

	ccTiddlyAdaptor.minHostName = function(host){
		return host ? host.replace(/^http:\/\//,'').replace(/\/$/,'') : '';
	};

	// Convert a page title to the normalized form used in uris
	ccTiddlyAdaptor.normalizedTitle = function(title){
		return title;
	};

	// Convert a date in YYYY-MM-DD hh:mm format into a JavaScript Date object
	ccTiddlyAdaptor.dateFromEditTime = function(editTime){
		var dt = editTime;
		return new Date(Date.UTC(dt.substr(0,4),dt.substr(5,2)-1,dt.substr(8,2),dt.substr(11,2),dt.substr(14,2)));
	};

	ccTiddlyAdaptor.prototype.login = function(context,userParams,callback){
		context = this.setContext(context,userParams,callback);
		var uriTemplate = '%0/handle/loginFile.php?cctuser=%1&cctpass=%2';
		var uri = uriTemplate.format([context.host,context.username,context.password]);
		var req = httpReq('GET',uri,ccTiddlyAdaptor.loginCallback,context);
		return typeof req == 'string' ? req : true;
	};

	ccTiddlyAdaptor.loginCallback = function(status,context,responseText,uri,xhr){
		if(xhr.status==401){
			context.status = false;
		}else{
			context.status = true;
			var c='sessionToken'+"="+responseText;
				c+="; expires=Fri, 1 Jan 2811 12:00:00 UTC; host=*";
				document.cookie=c;
		}
		if(context.callback)
			context.callback(context,context.userParams);
	};

	ccTiddlyAdaptor.prototype.register = function(context,userParams,callback){
		context = this.setContext(context,userParams,callback);
		var uriTemplate = '%0/handle/register.php';
		var uri = uriTemplate.format([context.host,context.username,Crypto.hexSha1Str(context.password)]);
		var dataTemplate = 'username=&0&reg_mail=%1&password=%2&password2=%3';
		var data = dataTemplate.format([context.username,context.password1,context.password2]);
		var req = httpReq('POST', uri,ccTiddlyAdaptor.registerCallback,context,null,data);
		return typeof req == 'string' ? req : true;
	};

	ccTiddlyAdaptor.prototype.rename = function(context, userParams, callback){
		context = this.setContext(context,userParams,callback);
		var uri = window.url+"handle/renameTiddler.php?otitle="+context.title+"&ntitle="+context.newTitle+"&workspace="+window.workspace;
		httpReq('POST', uri,ccTiddlyAdaptor.renameCallback,context,null,null);
	};

	ccTiddlyAdaptor.renameCallback = function(status,context,responseText,uri,xhr){
		if(context.callback)
			context.callback(context,context.userParams);
	};

	ccTiddlyAdaptor.registerCallback = function(status,context,responseText,uri,xhr){
		if(status){
			context.status = true;
		}else{
			context.status = false;
		}
		if(context.callback)
			context.callback(context,context.userParams);
	};

	ccTiddlyAdaptor.prototype.getWorkspaceList = function(context,userParams,callback){
	 	context = this.setContext(context,userParams,callback);
		var uriTemplate = '%0/handle/listWorkspaces.php';
		var uri = uriTemplate.format([context.host]);
		var req = httpReq('GET', uri,ccTiddlyAdaptor.getWorkspaceListCallback,context,{'accept':'application/json'});
		return typeof req == 'string' ? req : true;
	};

	ccTiddlyAdaptor.getWorkspaceListCallback = function(status,context,responseText,uri,xhr){
		context.status = false;
		context.workspaces = [];
		context.statusText = ccTiddlyAdaptor.errorInFunctionMessage.format(['getWorkspaceListCallback']);
		if(status){
		try{
			eval('var workspaces=' + responseText);
		}catch (ex){
			context.statusText = exceptionText(ex,ccTiddlyAdaptor.serverParsingErrorMessage);
			if(context.callback)
				context.callback(context,context.userParams);
				return;
			}
			for (var i=0; i < workspaces.length; i++){
				context.workspaces.push({title:workspaces[i]})
			}
			context.status = true;
		}else{
				context.statusText = xhr.statusText;
		}
		if(context.callback)
			context.callback(context,context.userParams);
	};

	ccTiddlyAdaptor.prototype.getTiddlerList = function(context,userParams,callback){
		context = this.setContext(context,userParams,callback);
		var uriTemplate = '%0/handle/listTiddlers.php?workspace=%1';
		var uri = uriTemplate.format([context.host,context.workspace]);
		var req = httpReq('GET', uri,ccTiddlyAdaptor.getTiddlerListCallback,context,{'accept':'application/json'});
		return typeof req == 'string' ? req : true;
	};

	ccTiddlyAdaptor.getTiddlerListCallback = function(status,context,responseText,uri,xhr){
		context.status = false;
		context.statusText = ccTiddlyAdaptor.errorInFunctionMessage.format(['getTiddlerListCallback']);
		if(status){
			try{
				eval('var tiddlers=' + responseText);
			}catch (ex){
				context.statusText = exceptionText(ex,ccTiddlyAdaptor.serverParsingErrorMessage);
				if(context.callback)
					context.callback(context,context.userParams);
				return;
			}
			var list = [];
			for(var i=0; i < tiddlers.length; i++){
				var tiddler = new Tiddler(tiddlers[i]['title']);
				tiddler.fields['server.page.revision'] = tiddlers[i]['revision'];
				list.push(tiddler);
			}
			context.tiddlers = list;
			context.status = true;
		}else{
			context.statusText = xhr.statusText;
		}
		if(context.callback)
			context.callback(context,context.userParams);
	};

	ccTiddlyAdaptor.prototype.generateTiddlerInfo = function(tiddler){
		var info ={};
		var host = this && this.host ? this.host : this.fullHostName(tiddler.fields['server.host']);
		var bag = tiddler.fields['server.bag']
		var workspace = tiddler.fields['server.workspace']
		var uriTemplate = '%0/%1/#%2';
		info.uri = uriTemplate.format([host,workspace,tiddler.title]);
		return info;
	};

	ccTiddlyAdaptor.prototype.getTiddlerRevision = function(title,revision,context,userParams,callback){
		context = this.setContext(context,userParams,callback);
		if(revision)
			context.revision = revision;
		return this.getTiddler(title,context,userParams,callback);
	};

	ccTiddlyAdaptor.prototype.getTiddler = function(title,context,userParams,callback){
		context = this.setContext(context,userParams,callback);
		if(title)
			context.title = title;
		   if(context.revision){
		         var uriTemplate = '%0/handle/revisionDisplay.php?title=%2&workspace=%1&revision=%3';
		  }else{
				var uriTemplate = '%0/handle/getTiddler.php?title=%2&workspace=%1';
		  }

		uri = uriTemplate.format([context.host,context.workspace,ccTiddlyAdaptor.normalizedTitle(title),context.revision]);
		context.tiddler = new Tiddler(title);
		context.tiddler.fields['server.type'] = ccTiddlyAdaptor.serverType;
		context.tiddler.fields['server.host'] = ccTiddlyAdaptor.minHostName(context.host);
		context.tiddler.fields['server.workspace'] = context.workspace;
		var req = httpReq('GET', uri,ccTiddlyAdaptor.getTiddlerCallback,context,{'accept':'application/json'});
		return typeof req == 'string' ? req : true;
	};

	ccTiddlyAdaptor.getTiddlerCallback = function(status,context,responseText,uri,xhr){
	        context.status = false;
	        context.statusText = ccTiddlyAdaptor.errorInFunctionMessage.format(['getTiddlerCallback']);
	        if(status){
	                var info=[]
	                try{
	                    eval('info=' + responseText);
	                }catch (ex){
	                        context.statusText = exceptionText(ex,ccTiddlyAdaptor.serverParsingErrorMessage);
	                        if(context.callback)
	                                context.callback(context,context.userParams);
	                        return;
	                }
	                context.tiddler.text = info['text'];
					context.tiddler.tags = info['tags'].split(" ");
	                context.tiddler.fields['server.page.revision'] = info['revision'];
				    context.tiddler.modifier = info['modifier'];
	                context.tiddler.modified = Date.convertFromYYYYMMDDHHMM(info['modified']);
	                context.tiddler.created = Date.convertFromYYYYMMDDHHMM(info['created']);
	                context.status = true;
	        }else{
	                context.statusText = xhr.statusText;
	                if(context.callback)
	                        context.callback(context,context.userParams);
	                return;
	        }
	        if(context.callback)
			context.callback(context,context.userParams);
	};

	ccTiddlyAdaptor.prototype.getTiddlerRevisionList = function(title,limit,context,userParams,callback){
		context = this.setContext(context,userParams,callback);
		context.title = title;
		context.revisions = [];
		var tiddler = store.fetchTiddler(title);
		var encodedTitle = encodeURIComponent(title);
		var uriTemplate = '%0/handle/revisionList.php?workspace=%1&title=%2';
		var host = this.fullHostName(this.host);
		var workspace = context.workspace ? context.workspace : tiddler.fields['server.workspace'];
		var uri = uriTemplate.format([host,workspace,encodedTitle]);
		var req = httpReq('GET', uri,ccTiddlyAdaptor.getTiddlerRevisionListCallback,context);
	};

	ccTiddlyAdaptor.getTiddlerRevisionListCallback = function(status,context,responseText,uri,xhr){
		if(responseText.indexOf('<!DOCTYPE html')==1)
			status = false;
		if(xhr.status=="204")
			status = false;
		context.status = false;
		if(status){
			var r =  responseText;
			if(r != '-' && r.trim() != 'revision not found'){
				var revs = r.split('\n');
				for(var i=0; i<revs.length; i++){
					var parts = revs[i].split(' ');
					if(parts.length>1){
						var tiddler = new Tiddler(context.title);
						tiddler.modified = Date.convertFromYYYYMMDDHHMM(parts[0]);
						tiddler.fields['server.page.revision'] = String(parts[1]);
						tiddler.modifier = String(parts[2]);
						tiddler.fields['server.host'] = ccTiddlyAdaptor.minHostName(context.host);
						tiddler.fields['server.type'] = ccTiddlyAdaptor.serverType;
						context.revisions.push(tiddler);
					}
				}
			}
			context.revisions.sort(function(a,b){return a.modified<b.modified?+1:-1;});
			context.status = true;
		}else{
			context.statusText = xhr.statusText;
		}
		if(context.callback)
			context.callback(context,context.userParams);
	};

	ccTiddlyAdaptor.prototype.putTiddler = function(tiddler,context,userParams,callback){

		context = this.setContext(context,userParams,callback);
		context.title = tiddler.title;
		var recipeuriTemplate = '%0/handle/save.php';
		var host = context.host ? context.host : this.fullHostName(tiddler.fields['server.host']);
		var uri = recipeuriTemplate.format([host,context.workspace,tiddler.title]);
		var d = new Date();
		d.setTime(Date.parse(tiddler['modified']));
		d = d.convertToYYYYMMDDHHMM();
		var fieldString = "";
		for (var name in tiddler.fields){
			if (String(tiddler.fields[name]))
				fieldString += name +"='"+tiddler.fields[name]+"' ";
		}

		// Freds SEO Code 
		if(workspace)
		 	var breaker = "/";
		else
			var breaker = "";
		var el = createTiddlyElement(document.body, "div", "ccTiddlyTMP", null, null, { "style.display": "none" });
		var formatter = new Formatter(config.formatters);
		var wikifier = new Wikifier(tiddler.text,formatter,null,tiddler);
			wikifier.isStatic = true;
			wikifier.subWikify(el);
		delete formatter;
		var links = el.getElementsByTagName("a");
		for(var i = 0; i < links.length; i++) {
			var tiddlyLink = links[i].getAttribute("tiddlyLink");
		    if(tiddlyLink) {
		        if(hasClass(links[i], "tiddlyLinkNonExisting")) { // target tiddler does not exist
		            links[i].href = "#";
		        } else {
		            links[i].href = url+ workspace + breaker +tiddlyLink + ".html";
		        }
		    }
		}	
		// End Freds SEO Code 
		if(tiddler.fields['server.page.revision']==1)
			tiddler.fields['server.page.revision'] = 10000;
		else
			tiddler.fields['server.page.revision'] = parseInt(tiddler.fields['server.page.revision'],10)+1;
		if(!context.otitle)
			var otitle = tiddler.title;
		else
			var otitle = context.otitle;
		var payload = "workspace="+window.workspace+"&otitle="+encodeURIComponent(otitle)+"&title="+encodeURIComponent(tiddler.title) + "&modified="+tiddler.modified.convertToYYYYMMDDHHMM()+"&modifier="+tiddler.modifier + "&tags="+tiddler.getTags()+"&revision="+encodeURIComponent(tiddler.fields['server.page.revision']) + "&fields="+encodeURIComponent(fieldString)+
	"&body="+encodeURIComponent(tiddler.text)+"&wikifiedBody="+encodeURIComponent(el.innerHTML)+"";
		var req = httpReq('POST', uri,ccTiddlyAdaptor.putTiddlerCallback,context,{'Content-type':'application/x-www-form-urlencoded', "Content-length": payload.length},payload,"application/x-www-form-urlencoded");
		removeNode(el);
		return typeof req == 'string' ? req : true;
	};


	ccTiddlyAdaptor.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';
	}

	ccTiddlyAdaptor.getsize = function (el){
		var x ={};
		x.width = el.offsetWidth || el.style.pixelWidth;
		x.height = el.offsetHeight || el.style.pixelHeight;
		return x;
	}

	ccTiddlyAdaptor.showCloak = function(){
		var cloak = document.getElementById('backstageCloak');
		if (config.browser.isIE){
			cloak.style.height = Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight);
			cloak.style.width = document.documentElement.scrollWidth;
		}
		cloak.style.display = "block";
	}

	ccTiddlyAdaptor.hideError = function(){
		var box = document.getElementById('errorBox');
		box.parentNode.removeChild(box);
		document.getElementById('backstageCloak').style.display = "";
	}

	ccTiddlyAdaptor.handleError = function(error_code){
		setStylesheet(
		"#errorBox .button{padding:0.5em 1em; border:1px solid #222; background-color:#ccc; color:black; margin-right:1em;}\n"+
		"html > body > #backstageCloak{height:100%;}"+
		"#errorBox{border:1px solid #ccc;background-color: #eee; color:#111;padding:1em 2em; z-index:9999;}",'errorBoxStyles');
		var box = document.getElementById('errorBox') || createTiddlyElement(document.body,'div','errorBox');
		var error = ccTiddlyAdaptor.errorTitleNotSaved;
		switch(error_code){
			case 401:
				error += ccTiddlyAdaptor.errorTextSessionExpired;
				break;
			case 409:
				error += ccTiddlyAdaptor.errorTextConflict;
				break;
			default:
				error += ccTiddlyAdaptor.errorTextUnknown+"<br />"+ccTiddlyAdaptor.msgErrorCode+error_code;
		}
		box.innerHTML = " <a style='float:right' href='javascript:onclick=ccTiddlyAdaptor.hideError()'>"+ccTiddlyAdaptor.errorClose+"</a><p>"+error+"</p><br/><br/>";
		createTiddlyButton(box,ccTiddlyAdaptor.buttonOpenNewWindow,null,function(e){ window.open (window.location,"mywindow");	 return false;});
		createTiddlyElement(box,"br");
		createTiddlyElement(box,"br");
		createTiddlyButton(box,ccTiddlyAdaptor.buttonHideThisMessage,null,function(){ccTiddlyAdaptor.hideError();});
		box.style.position = 'absolute';
		ccTiddlyAdaptor.center(box);
		ccTiddlyAdaptor.showCloak();
	}

	ccTiddlyAdaptor.putTiddlerCallback = function(status,context,responseText,uri,xhr){
		context.status = false;
		if(status){
			context.status = true;
		}else{
			context.status = false;
			if(xhr.status == 401 || xhr.status==409){
				ccTiddlyAdaptor.handleError(xhr.status);
			}else{
				ccTiddlyAdaptor.handleError(xhr.status);
				context.statusText = xhr.statusText;
			}
		}
		if(context.callback){
			context.callback(context,context.userParams);
		}
	};

	ccTiddlyAdaptor.prototype.deleteTiddler = function(title,context,userParams,callback){	
		context = this.setContext(context,userParams,callback);
		context.title = title;
		title = encodeURIComponent(title);
		var host = this && this.host ? this.host : this.fullHostName(tiddler.fields['server.host']);
		var uriTemplate = '%0/handle/delete.php?workspace=%1&title=%2';
		var uri = uriTemplate.format([host,context.workspace,title]);
		var req = httpReq('POST', uri,ccTiddlyAdaptor.deleteTiddlerCallback,context);
		return typeof req == 'string' ? req : true;
	};

	ccTiddlyAdaptor.deleteTiddlerCallback = function(status,context,responseText,uri,xhr){
		if(status){
			context.status = true;
		}else{
			context.status = false;
			context.statusText = xhr.statusText;
		}
		if(context.callback)
			context.callback(context,context.userParams);
	};

	config.adaptors[ccTiddlyAdaptor.serverType] = ccTiddlyAdaptor;
//}}}


//}}}

/***
|''Namelog''|ccTiddlyPlugin|
|''Description''|The ccTiddlyPlugin macro contains all the macros necessary to run ccTiddly.|
|''Author''|Simon McManus|
|''Contributors''|Simon McManus, James Lelyveld|
|''Source''|http://svn.tiddlywiki.org/Trunk/association/serversides/cctiddly/tiddlers/plugins/ccTiddlyPlugins.js|
|''CodeRepository''|http://svn.tiddlywiki.org/Trunk/association/serversides/cctiddly/tiddlers/plugins/ccTiddlyPlugins.js|
|''Feedback''|http://groups.google.com/group/ccTiddly|
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]] |
|''~CoreVersion:''|2.2.0|
|''Date:''|Nov 6, 2008|
|''Version:''|0.1|


!Usage
{{{
<<ccAbout>>
<<ccAdmin>>
<<ccCreateWorkspace>>
<<ccEditWorkspace>>
<<ccFile>>
<<ccLogin>>
<<ccLoginStatus>>
<<ccRegister>>
<<ccStats>>

}}}

***/
//{{{


config.backstageTasks.remove("upgrade");
config.backstageTasks.remove("save");
config.backstageTasks.remove("sync");

//  ccAbout //

config.backstageTasks.push(config.macros.ccAbout.buttonBackstageText);
merge(config.tasks,{about:{text: config.macros.ccAbout.buttonBackstageText,tooltip: config.macros.ccAbout.buttonBackstageTooltip,content: '<<ccAbout>>'}});
config.macros.ccAbout.handler=function(place,macroName,params,wikifier,paramString,tiddler,errorMsg){
	var w = new Wizard();
	var me = config.macros.ccAbout;
	w.createWizard(place,me.stepAboutTitle);
	w.addStep(null, me.stepAboutTextStart + window.ccTiddlyVersion + "<br /><br />" + me.stepAboutTextEnd);
};
//}}}



// ccAdmin //


//{{{

config.macros.ccAdmin.handler = function(place,macroName,params,wikifier,paramString,tiddler, errorMsg){
	var w = new Wizard();
	w.createWizard(place,config.macros.ccAdmin.WizardTitleText);
	config.macros.ccAdmin.refresh(w);
};

config.macros.ccAdmin.refresh= function(w){
	params = {};
	params.w = w;
	params.e = this;
	me = config.macros.ccAdmin;
	doHttp('POST',url+'/handle/workspaceAdmin.php','action=LISTALL&workspace='+workspace,null,null,null,config.macros.ccAdmin.listAllCallback,params);
	w.setButtons([
		{caption: me.buttonDeleteText, tooltip: me.buttonDeleteTooltip, onClick: function(w){ 
			config.macros.ccAdmin.delAdminSubmit(null, params);
		 	return false;
		}}, 
		{caption: me.buttonAddText, tooltip: me.buttonAddTooltip, onClick: function(w){
			config.macros.ccAdmin.addAdminDisplay(null, params); return false } }]);
};

config.macros.ccAdmin.delAdminSubmit = function(e, params){
	var listView = params.w.getValue("listView");
	var rowNames = ListView.getSelectedRows(listView);
	var delUsers = "";
	for(var e=0; e < rowNames.length; e++) 
		delUsers += rowNames[e]+",";
	doHttp('POST',url+'/handle/workspaceAdmin.php','action=DELETEADMIN&username='+delUsers+'&workspace='+workspace,null,null,null,config.macros.ccAdmin.addAdminCallback,params);
	return false; 
};

config.macros.ccAdmin.addAdminDisplay = function(e, params){
	doHttp('POST',url+'/handle/workspaceAdmin.php','action=LISTWORKSPACES',null,null,null,config.macros.ccAdmin.listWorkspaces,params);
};

config.macros.ccAdmin.listWorkspaces = function(status,params,responseText,uri,xhr){
	var frm = createTiddlyElement(null,'form',null,null);
	var me = config.macros.ccAdmin;
	frm.onsubmit = config.macros.ccAdmin.addAdminSubmit;	
	params.w.addStep(me.stepAddTitle,"<input type='hidden' name='admin_placeholder'/>"+me.labelUsername+"<input name=adminUsername><br />"+me.labelWorkspace+"<select name=workspaceName />");
	var workspaces = eval('[ '+responseText+' ]');
	for(var t=0; t<workspaces.length; t++) {
		var o = createTiddlyElement(params.w.formElem.workspaceName, "option", null, null, workspaces[t]);
		o.value=workspaces[t];
		if(workspaces[t] == workspace)
			o.selected = true;
	}
	params.w.formElem.admin_placeholder.parentNode.appendChild(frm);
	params.w.setButtons([
		{caption: me.buttonCancelText, tooltip: me.buttonCancelTooltip, onClick: function(w){ config.macros.ccAdmin.refresh(params.w) } },
		{caption: me.buttonCreateText, tooltip: me.buttonCreateTooltip, onClick: function(){config.macros.ccAdmin.addAdminSubmit(null, params);  } }
	]);
};

config.macros.ccAdmin.addAdminSubmit = function(e, params){
	doHttp('POST',url+'/handle/workspaceAdmin.php','&add_username='+params.w.formElem.adminUsername.value+'&action=addNew&workspace='+params.w.formElem.workspaceName[params.w.formElem.workspaceName.selectedIndex].value,null,null,null,config.macros.ccAdmin.addAdminCallback,params);
	return false; 
};

config.macros.ccAdmin.listAllCallback = function(status,params,responseText,uri,xhr) {
	var me = config.macros.ccAdmin;
	var out = "";
	var adminUsers = [];
	if(xhr.status == 403){
		var html ='';
		params.w.addStep(me.stepErrorText+workspace, me.stepErrorTitle);
		params.w.setButtons([]);
		return false;
	}
	try{
		var a = eval(responseText);
		for(var e=0; e < a.length; e++){
			out += a[e].username;
			adminUsers.push({
			name: a[e].username,
			lastVisit:a[e].lastVisit});
		}
	}catch(ex){
			params.w.addStep(" "+workspace, me.stepNoAdminTitle);
			params.w.setButtons([
				{caption: me.buttonCreateText, tooltip: me.buttonCreateTooltip, onClick: function(){ config.macros.ccAdmin.addAdminDisplay(null, params)}}]);
			return false;
	}
	var html ='<input type="hidden" name="markList"></input>';
	params.w.addStep(me.stepManageWorkspaceTitle+workspace, html);
	var markList = params.w.getElement("markList");
	var listWrapper = document.createElement("div");
	markList.parentNode.insertBefore(listWrapper,markList);
	var listView = ListView.create(listWrapper,adminUsers,config.macros.ccAdmin.listAdminTemplate);
	params.w.setValue("listView",listView);
};

config.macros.ccAdmin.addAdminCallback = function(status,params,responseText,uri,xhr) {
	config.macros.ccAdmin.refresh(params.w);
};

//  ccAutoSave //

//{{{
	
//# Ensure that the plugin is only installed once.
if(!version.extensions.ccTiddlyAutoSavePlugin) {
	version.extensions.ccTiddlyAutoSavePlugin = {installed:true};

ccTiddlyAutoSave.putCallback = function(context, userParams){
	tiddler = context.tiddler;
	if (context.status){
		if (context.otitle != tiddler.title){
			var ret = invokeAdaptor('deleteTiddler',context.otitle,null,null,null,config.commands.deleteTiddlerHosted.callback,tiddler.fields);
		}
		displayMessage(ccTiddlyAutoSave.msgSaved + tiddler.title);
		tiddler.clearChangeCount();
	}else{
		displayMessage(ccTiddlyAutoSave.msgError + tiddler.title + ' ' + context.statusText);
		tiddler.incChangeCount();
	}
};

TiddlyWiki.prototype.orig_saveTiddler = TiddlyWiki.prototype.saveTiddler;	//hijack
TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created){
   var tiddler = this.orig_saveTiddler(title,newTitle,newBody,modifier,modified,tags,fields,false,created); //
 //   var tiddler = this.fetchTiddler(title); //And then I get it
	var adaptor = new config.adaptors['cctiddly'];
	// put the tiddler and deal with callback
	tiddler.fields['server.host'] = window.url;
	tiddler.fields['server.type'] = config.defaultCustomFields['server.type'];
	tiddler.fields['server.workspace'] = window.workspace;
	tiddler.clearChangeCount();
	context = {};
	context.tiddler = tiddler;
	context.otitle = title;
	context.workspace = window.workspace;
	context.host = window.url;
	req = adaptor.putTiddler(tiddler, context, {}, ccTiddlyAutoSave.putCallback);
	if(req)
		store.setDirty(false);
	return req ? tiddler : false;
};
} //# end of 'install only once'
//}}}

// ccCreateWorkspace //

//{{{

	if(isLoggedIn()){
	config.backstageTasks.push(config.macros.ccCreateWorkspace.buttonCreateText);
	merge(config.tasks,{create: {text: config.macros.ccCreateWorkspace.buttonCreateText, tooltip: config.macros.ccCreateWorkspace.buttonCreateTooltip, content:'<<ccCreateWorkspace>>'}});
}

config.macros.ccCreateWorkspace.setStatus=function(w,element,text){
	var label_var = w.getElement(element);
	removeChildren(label_var.previousSibling);
	var label = document.createTextNode(text);
	label_var.previousSibling.insertBefore(label,null);
}

config.macros.ccCreateWorkspace.workspaceNameKeyPress=function(w){
	params={};
	params.w = w;
	doHttp('POST',url+'/handle/lookupWorkspaceName.php',"ccWorkspaceLookup="+w.formElem["workspace_name"].value+"&free=1",null,null,null,config.macros.ccCreateWorkspace.workspaceNameCallback,params);	
	return false;
};
 	
config.macros.ccCreateWorkspace.workspaceNameCallback=function(status,params,responseText,uri,xhr){
	var me = config.macros.ccCreateWorkspace;
	if(responseText > 0){{
			config.macros.register.setStatus(params.w, "workspace_error", me.errorWorkspaceNameInUse);
			config.macros.register.setStatus(params.w, "workspace_url", "");
	}}else{
		config.macros.register.setStatus(params.w, "workspace_error", me.msgWorkspaceAvailable);
		if (window.useModRewrite == 1)
			config.macros.register.setStatus(params.w, "workspace_url", url+''+params.w.formElem["workspace_name"].value);			 
		else
			config.macros.register.setStatus(params.w, "workspace_url", url+'?workspace='+params.w.formElem["workspace_name"].value);
	}
};

config.macros.ccCreateWorkspace.handler =  function(place,macroName,params,wikifier,paramString,tiddler, errorMsg){
	if (window.workspacePermission.canCreateWorkspace!=1) {
		createTiddlyElement(place,'div', null, "annotation",  config.macros.ccCreateWorkspace.errorPermissions);
		return null;
	}
	var me = config.macros.ccCreateWorkspace;
	var w = new Wizard();
	w.createWizard(place,me.wizardTitle);
	w.addStep(me.stepTitle, me.stepCreateHtml);
	w.formElem["workspace_name"].onkeyup=function() {me.workspaceNameKeyPress(w);};
	w.setButtons([
		{caption: me.buttonCreateWorkspaceText, tooltip: me.buttonCreateWorkspaceTooltip, onClick:function(){config.macros.ccCreateWorkspace.createWorkspaceOnSubmit(w);}
	}]);
};

config.macros.ccCreateWorkspace.createWorkspaceOnSubmit = function(w){
	var params = {}; 
	if(window.useModRewrite == 1)
		params.url = url+w.formElem["workspace_name"].value; 
	else
		params.url = url+'?workspace='+w.formElem["workspace_name"].value;
	var loginResp = doHttp('POST',url+'?&workspace='+w.formElem["workspace_name"].value+"/",'&ccCreateWorkspace=' + encodeURIComponent(w.formElem["workspace_name"].value)+'&amp;ccAnonPerm='+encodeURIComponent("AADD"),null,null,null,config.macros.ccCreateWorkspace.createWorkspaceCallback,params);
	return false; 
};

config.macros.ccCreateWorkspace.createWorkspaceCallback = function(status,params,responseText,uri,xhr) {
	if(xhr.status==201){
		window.location = params.url;
	}else if(xhr.status == 200){
		displayMessage(config.macros.ccCreateWorkspace.errorWorkspaceNameInUse);
	}else if(xhr.status == 403){
		displayMessage(config.macros.ccCreateWorkspace.errorPermissions);	
	}else{
		displayMessage(responseText);	
	}
};
//}}}

// ccEditWorkspace //


//{{{
		
config.macros.ccEditWorkspace.handler = function(place, macroName, params, wikifier, paramString, tiddler){
	var me = config.macros.ccEditWorkspace;
	if(workspacePermission.owner !=1){
		createTiddlyElement(place,'div', null, "annotation",  me.errorTextPermissionDenied);
		return null;
	}
	var w = new Wizard();
	w.createWizard(place, this.WizardTitleText);
	var booAdmin = false;
	var booUser = false;
	var booAnon = false;
	// Check which colums to display
	for(i = 0; i <= params.length - 1; i++){
		switch (params[i].toLowerCase()) {
			case 'admin':
				booAdmin = true;
				break;
			case 'user':
				booUser = true;
				break;
			case 'anon':
				booAnon = true;
				break;
		}
	}
	// if nothing passed show all
	if(!booAdmin && !booUser && !booAnon){
		booAdmin = true;
		booUser = true;
		booAnon = true;
	}
	var tableBodyBuffer = new Array();
	tableBodyBuffer.push('<table border=0px class="listView twtable">');
	tableBodyBuffer.push('<tr">');
	tableBodyBuffer.push('<th>' + this.stepLabelPermission + '</th>');
	if(booAnon){
		tableBodyBuffer.push('<th>' + this.stepLabelAnon + '</th>');
	}
	if(booUser){
		tableBodyBuffer.push('<th>' + this.stepLabelUser + '</th>');
	}
	if(booAdmin){
		tableBodyBuffer.push('<th>' + this.stepLabelAdmin + '</th>');
	}
	tableBodyBuffer.push('</tr>');
	tableBodyBuffer.push('<tr>')
	tableBodyBuffer.push('<th align="right">'+this.stepLabelRead+'</th>');
	if(booAnon){
		tableBodyBuffer.push('<td><input name="anR" class="checkInput" type="checkbox" ');
		tableBodyBuffer.push(workspacePermission.anonR == 1 ? 'checked' : '');
		tableBodyBuffer.push(' ></input></td>');
	}
	if(booUser){
		tableBodyBuffer.push('<td><input name="usR" class="checkInput" type="checkbox" ');
		tableBodyBuffer.push(workspacePermission.userR == 1 ? 'checked' : '');
		tableBodyBuffer.push('></input></td>');
	}
	if(booAdmin){
		tableBodyBuffer.push('<td><input name="adR" class="checkInput" type="checkbox" checked disabled></input></td>');
	}
	tableBodyBuffer.push('</tr>');
	tableBodyBuffer.push('<tr>');
	tableBodyBuffer.push('<th  align="right">' + this.stepLabelCreate + '</th>');
	if(booAnon){
		tableBodyBuffer.push('<td><input name="anC" class="checkInput" type="checkbox" ');
		tableBodyBuffer.push(workspacePermission.anonC == 1 ? 'checked' : '');
		tableBodyBuffer.push(' ></input></td>');
	}
	if(booUser){
		tableBodyBuffer.push('<td><input name="usC" class="checkInput" type="checkbox" ');
		tableBodyBuffer.push(workspacePermission.userC == 1 ? 'checked' : '');
		tableBodyBuffer.push(' ></input></td>');
	}
	if(booAdmin){
		tableBodyBuffer.push('<td><input name="adC" class="checkInput" type="checkbox" checked disabled></input></td>');
	}
	tableBodyBuffer.push('</tr>');
	tableBodyBuffer.push('<tr>');
	tableBodyBuffer.push('<th  align="right">' + this.stepLabelUpdate + '</th>');
	if(booAnon){
		tableBodyBuffer.push('<td><input name="anU" class="checkInput" type="checkbox" ');
		tableBodyBuffer.push(workspacePermission.anonU == 1 ? 'checked' : '');
		tableBodyBuffer.push(' ></input></td>');
	}
	if(booUser){
		tableBodyBuffer.push('<td><input name="usU" class="checkInput" type="checkbox" ');
		tableBodyBuffer.push(workspacePermission.userU == 1 ? 'checked' : '');
		tableBodyBuffer.push(' ></input></td>');
	}
	if(booAdmin){
		tableBodyBuffer.push('<td><input name="adU" class="checkInput" type="checkbox" checked disabled></input></td>');
	}
	tableBodyBuffer.push('</tr>');
	tableBodyBuffer.push('<tr>');
	tableBodyBuffer.push('<th  align="right">' + this.stepLabelDelete + '</th>');
	if(booAnon){
		tableBodyBuffer.push('<td><input name="anD" class="checkInput" type="checkbox" ');
		tableBodyBuffer.push(workspacePermission.anonD == 1 ? 'checked' : '');
		tableBodyBuffer.push(' ></input></td>');
	}
	if(booUser){
		tableBodyBuffer.push('<td><input name="usD" class="checkInput" type="checkbox" ');
		tableBodyBuffer.push(workspacePermission.userD == 1 ? 'checked' : '');
		tableBodyBuffer.push(' ></input></td>');
	}
	if(booAdmin){
		tableBodyBuffer.push('<td><input name="adD" class="checkInput" type="checkbox" checked disabled></input></td>');
	}
	tableBodyBuffer.push('</tr>');
	tableBodyBuffer.push('</table>');
	var stepHTML = tableBodyBuffer.join('');
	w.addStep(this.stepEditTitle,stepHTML);
	w.setButtons([
		{caption: this.buttonSubmitCaption, tooltip: this.buttonSubmitToolTip, onClick: function() {me.ewSubmit(place, macroName, params, wikifier, paramString, tiddler,w,booAnon,booUser);}
	}]);

};

config.macros.ccEditWorkspace.ewSubmit = function(place, macroName, params2, wikifier, paramString, tiddler,w, booAnon, booUser){
	var trueStr = "A";
	var falseStr = "U";
	var anon = '';
	var user = '';
	if(booAnon){
		var anonBuffer = new Array();
		anonBuffer.push(w.formElem['anR'].checked ? trueStr : falseStr);
		anonBuffer.push(w.formElem['anC'].checked ? trueStr : falseStr);
		anonBuffer.push(w.formElem['anU'].checked ? trueStr : falseStr);
		anonBuffer.push(w.formElem['anD'].checked ? trueStr : falseStr);
		anon = anonBuffer.join('');
	}
	if(booUser){
		var userBuffer = new Array();
		userBuffer.push(w.formElem['usR'].checked ? trueStr : falseStr);
		userBuffer.push(w.formElem['usC'].checked ? trueStr : falseStr);
		userBuffer.push(w.formElem['usU'].checked ? trueStr : falseStr);
		userBuffer.push(w.formElem['usD'].checked ? trueStr : falseStr);
		user = userBuffer.join('');
	}
	var params = new Array();
	params.w = w;
	params.u = user;
	params.a = anon;
	params.p = place;
	params.m =  macroName;
	params.pr = params2;
	params.wi = wikifier;
	params.ps = paramString;
	params.t = tiddler;
	doHttp('POST', url + '/handle/updateWorkspace.php', 'ccCreateWorkspace=' + encodeURIComponent(workspace) + '&ccAnonPerm=' + encodeURIComponent(anon) + '&ccUserPerm=' + encodeURIComponent(user), null, null, null, config.macros.ccEditWorkspace.editWorkspaceCallback, params);
	return false;
}
config.macros.ccEditWorkspace.editWorkspaceCallback = function(status,params,responseText,uri,xhr){
	var w = params.w;
	var me = config.macros.ccEditWorkspace;
	if(xhr.status == 200){
		// use the incoming parameters to set the workspace permission variables.
		if (params.a != ''){
			workspacePermission.anonR = (params.a.substr(0,1)=='A'?1:0);
			workspacePermission.anonC = (params.a.substr(1,1)=='A'?1:0);
			workspacePermission.anonU = (params.a.substr(2,1)=='A'?1:0);
			workspacePermission.anonD = (params.a.substr(3,1)=='A'?1:0);
		}
		if (params.u != ''){
			workspacePermission.userR = (params.u.substr(0,1)=='A'?1:0);
			workspacePermission.userC = (params.u.substr(1,1)=='A'?1:0);
			workspacePermission.userU = (params.u.substr(2,1)=='A'?1:0);
			workspacePermission.userD = (params.u.substr(3,1)=='A'?1:0);
		}
		w.addStep('',responseText);
		// want to set a back button here
		w.setButtons([
			{caption: me.button1SubmitCaption, tooltip: me.button1SubmitToolTip, onClick: function() {config.macros.ccEditWorkspace.refresh(params.p,	params.m,	params.pr,	params.wi,	params.ps,	params.t);}}
		]);
	}else{
		w.addStep(me.step2Error+': ' + xhr.status,config.macros.ccEditWorkspace.errorUpdateFailed);
	}
	return false;
};
config.macros.ccEditWorkspace.refresh = function(place, macroName, params, wikifier, paramString, tiddler){
	removeChildren(place);
	config.macros.ccEditWorkspace.handler(place, macroName, params, wikifier, paramString, tiddler);
}
//}}}

// ccFile //


//{{{
	
var iFrameLoad=function(w){
	var uploadIframe = document.getElementById('uploadIframe');
	var a = createTiddlyElement(null, "div");
	a.innerHTML = uploadIframe.contentDocument.body.innerHTML;
	removeChildren(w.formElem.placeholder);
	w.formElem.placeholder.parentNode.appendChild(a);
	var statusArea = w.formElem.placeholder;
	document.getElementById("ccfile").value=""; 
};

config.macros.ccFile.handler=function(place,macroName,params,wikifier,paramString,tiddler, errorMsg){
	var w = new Wizard();
	w.createWizard(place,config.macros.ccFile.wizardTitleText);
	config.macros.ccFile.refresh(w);
};

config.macros.ccFile.refresh=function(w){
	params = {};
	params.w = w;
	params.e = this;
	var me = config.macros.ccFile;
	doHttp('GET',url+'/handle/listFiles.php?workspace='+workspace,'',null,null,null,config.macros.ccFile.listAllCallback,params);
	w.setButtons([
		{caption: me.buttonDeleteText, tooltip: me.buttonDeleteTooltip, onClick: function(w){ 
			config.macros.ccFile.delFileSubmit(null, params);
			 return false;
		}}, 
		{caption: me.buttonUploadText, tooltip: me.buttonUploadTooltip, onClick: function(e){ 
			config.macros.ccFile.addFileDisplay(null, params); return false 
			} }
	]);
};

config.macros.ccFile.delFileSubmit=function(e, params) {
	var listView = params.w.getValue("listView");
	var rowNames = ListView.getSelectedRows(listView);
	for(var e=0; e < rowNames.length; e++) 
	doHttp('POST',url+'/handle/listFiles.php','action=DELETEFILE&file='+rowNames[e]+'&workspace='+workspace,null,null,null,config.macros.ccFile.delFileCallback,params);
	return false; 
};

config.macros.ccFile.delFileCallback=function(status,params,responseText,uri,xhr){
	config.macros.ccFile.refresh(params.w);
};

config.macros.ccFile.addFileDisplay = function(e, params){
	var frm = params.w.formElem;
	if(navigator.appName=="Microsoft Internet Explorer"){
		encType = frm.getAttributeNode("enctype");
	    encType.value = "multipart/form-data";
	}
	frm.setAttribute("enctype","multipart/form-data");
	frm.setAttribute("method","POST");
	frm.action=window.url+"/handle/upload.php"; 
	frm.id="ccUpload";
	frm.target="uploadIframe";
	frm.name = "uploadForm";
	frm.parentNode.appendChild(frm);
	params.w.addStep("ss", "<input id='ccfile' class='input' type='file' name='userFile'/>"+"<input type='hidden' name='placeholder'/>");
	var workspaceName=createTiddlyElement(null,'input','workspaceName','workspaceName');				
	workspaceName .setAttribute('name','workspace');
	workspaceName.type="HIDDEN";
	workspaceName.value=workspace;
	frm.appendChild(workspaceName);
	createTiddlyElement(frm,'br');
	var saveTo=createTiddlyElement(null,"input","saveTo","saveTo");	
	var iframe=document.createElement("iframe");
	iframe.style.display="none";
	iframe.id='uploadIframe';
	iframe.name='uploadIframe';
	iframe.onload = function() {
		iFrameLoad(params.w);
	}	
	frm.appendChild(iframe);
	createTiddlyElement(frm,"div",'uploadStatus');
	params.w.setButtons([
	{caption: config.macros.ccFile.buttonCancelText, tooltip: config.macros.ccFile.buttonCancelTooltip, onClick: function(){config.macros.ccFile.refresh(params.w);}
	},
	{caption: config.macros.ccFile.buttonUploadText, tooltip: config.macros.ccFile.buttonUploadTooltip, onClick: function(){params.w.formElem.submit();}
	}]);
};

function addOption(selectbox,text,value ){
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;
	selectbox.options.add(optn);
}

config.macros.ccFileImageBox = function(image){
	var full = image.src;
	setStylesheet(
	"#errorBox .button {padding:0.5em 1em; border:1px solid #222; background-color:#ccc; color:black; margin-right:1em;}\n"+
	"html > body > #backstageCloak {height:"+window.innerHeight*2+"px;}"+
	"#errorBox {border:1px solid #ccc;background-color: #fff; color:#111;padding:1em 2em; z-index:9999;}",'errorBoxStyles');
	var box = document.getElementById('errorBox') || createTiddlyElement(document.body,'div','errorBox');
	box.innerHTML =  "<a style='float:right' href='javascript:onclick=ccTiddlyAdaptor.hideError()'>"+ccTiddlyAdaptor.errorClose+"</a><h3>"+image.src+"</h3><br />";
	box.style.position = 'absolute';
	box.style.width= "800px";
	var img = createTiddlyElement(box, "img");
	img.src = full;
	ccTiddlyAdaptor.center(box);
	ccTiddlyAdaptor.showCloak();
}

config.macros.ccFile.listAllCallback = function(status,params,responseText,uri,xhr){
	var me = config.macros.ccFile;
	var out = "";
	var adminUsers = [];
	if(xhr.status!=200){
		params.w.addStep(me.errorPermissionDeniedTitle, me.errorPermissionDeniedView);
		return true;
	}
	try{
		var a = eval(responseText);
		for(var e=0; e < a.length; e++){ 		
		out += a[e].username;	
			adminUsers.push({
				htmlName: "<html><a href='"+a[e].url+"' target='new'>"+a[e].filename+"</a></html>",
				name: a[e].filename,
				wikiText:'<html><img onclick="config.macros.ccFileImageBox(this)"; src="'+a[e].url+'" style="width: 70px; "/></html>',
				lastVisit:a[e].lastVisit,
				fileSize:a[e].fileSize
			});
		}
	}catch (ex){
		params.w.setButtons([
			{caption: me.buttonUploadText, tooltip: me.buttonUploadTooltip, onClick: function(w){				
				config.macros.ccFile.addFileDisplay(e, params);
			} }]);
	}
	params.w.addStep(me.wizardStepText+workspace, "<input type='hidden' name='markList'></input>");
	var markList = params.w.getElement("markList");
	var listWrapper = document.createElement("div");
	markList.parentNode.insertBefore(listWrapper,markList);
	var listView = ListView.create(listWrapper,adminUsers,config.macros.ccFile.listAdminTemplate);
	//params.w.setValue("listAdminView",listAdminView);
	params.w.setValue("listView",listView);
};

config.macros.ccFile.addFileCallback = function(status,params,responseText,uri,xhr){	
	config.macros.ccFile.refresh(params.w);
};

//}}}

// ccChangePassword //

// {{{
	
	config.macros.ccChangePassword.handler=function(place,macroName,params,wikifier,paramString,tiddler,errorMsg){
		var w = new Wizard();
		var me = config.macros.ccChangePassword;
		w.createWizard(place,me.title);
		w.addStep(me.subTitle+cookieString(document.cookie).txtUserName,me.step1Html);
		w.setButtons([
			{caption: me.buttonChangeText, tooltip: me.buttonChangeToolTip, onClick: function(){config.macros.ccChangePassword.doPost(w);  } }
		]);
	};

	config.macros.ccChangePassword.doPost = function (w) {
		me = config.macros.ccChangePassword;
		if(!w.formElem.new1.value || !w.formElem.new2.value || !w.formElem.old.value) {
			displayMessage(me.noticePasswordUpdateFailed);
			return false;
		}
		if(w.formElem.new1.value != w.formElem.new2.value){
			displayMessage(me.noticePasswordsNoMatch);
			return false;
		}
		doHttp("POST", url+"handle/changePassword.php", "&new1="+Crypto.hexSha1Str(w.formElem.new1.value)+"&new2="+Crypto.hexSha1Str(w.formElem.new2.value)+"&old1="+Crypto.hexSha1Str(w.formElem.old.value),null,null,null,config.macros.ccChangePassword.callback);	
	}

	config.macros.ccChangePassword.callback = function(status,context,responseText,uri,xhr) {
		if(xhr.status == 304)
			displayMessage(me.noticePasswordUpdateFailed);
		else
			displayMessage(me.noticePasswordUpdated);
	}

	//}}}
// ccLogin //

//{{{
	
function isLoggedIn() {
	if(window.loggedIn)
	 	return true;
	else 
	        return false;
}

config.macros.saveChanges.handler=function(place,macroName,params,wikifier,paramString,tiddler){
	if(isLoggedIn()){
		createTiddlyButton(place, config.macros.ccLogin.buttonLogout, config.macros.ccLogin.buttonLogoutToolTip, function(){
				if (window.fullUrl.indexOf("?") >0)
					window.location = window.fullUrl+"&logout=1";
				else
					window.location = window.fullUrl+"?logout=1";
			return false;
		},null,null,this.accessKey);
	}else{
		createTiddlyButton(place,config.macros.ccLogin.buttonlogin, config.macros.ccLogin.buttonLoginToolTip, function() {
			story.displayTiddler(null, "Login");
		},null,null,this.accessKey);
	}
};
	
if (isLoggedIn()){
	config.backstageTasks.push("logout");
	merge(config.tasks,{logout:{text: "logout",tooltip: config.macros.ccLogin.buttonLogoutToolTip,content: '<<ccLogin>>'}});
}else{
	config.backstageTasks.push("login");
	merge(config.tasks,{login:{text: "login",tooltip: config.macros.ccLogin.buttonLoginToolTip,content: '\r\n\r\n<<tiddler Login>>'}});	
}

var loginState=null;
var registerState=null;

config.macros.ccLogin.handler=function(place,macroName,params,wikifier,paramString,tiddler){
	config.macros.ccLogin.refresh(place);
};
 
config.macros.ccLogin.refresh=function(place, error){
	removeChildren(place);
	var w = new Wizard();
	if (isLoggedIn()){
		w.createWizard(place,this.stepLogoutTitle);
		w.addStep(null, this.stepLogoutText+decodeURIComponent(cookieString(document.cookie).txtUserName)+"<br /><br />");
		w.setButtons([
			{caption: this.buttonLogout, tooltip: this.buttonLogoutToolTip, onClick: function() {window.location=fullUrl+"?&logout=1"}
		}]);
		return true;
	}
	w.createWizard(place,this.WizardTitleText);
	var me=config.macros.ccLogin;
	var oldForm = w.formElem.innerHTML;
	var form = w.formElem;
	if (error!==undefined)
		this.stepLoginTitle=error;	
	w.addStep(this.stepLoginTitle,me.stepLoginIntroTextHtml);
	txtPassword = findRelated(w.formElem.password,"txtPassword","className","previousSibling");
	w.formElem.password.style.display="none";
	txtPassword.onkeyup = function() {
		if(me.sha1 == true)
			w.formElem.password.value = Crypto.hexSha1Str(txtPassword.value);
		else 
			w.formElem.password.value = txtPassword.value;
	};

	txtPassword.onchange = txtPassword.onkeyup;
	w.formElem.method ="POST";
	w.formElem.onsubmit = function() {config.macros.ccLogin.doLogin(w.formElem["username"].value, w.formElem["password"].value, this, place); return false;};
	var submit = createTiddlyElement(null, "input");
	submit.type="submit";
	submit.style.display="none";
	w.formElem.appendChild(submit);
	var cookieValues=findToken(document.cookie);
	if (cookieValues.txtUserName!==undefined){
		w.formElem["username"].value=decodeURIComponent(cookieValues.txtUserName) ;
	}
	var footer = findRelated(form,"wizardFooter","className");
	createTiddlyButton(w.footer,this.buttonLogin,this.buttonLoginToolTip,function() {
		if (w.formElem["username"].value==""){
			displayMessage(me.msgNoUsername);
			return false;
		}
		if (w.formElem["password"].value==""){
			displayMessage(me.msgNoPassword);
			return false;
		}
		config.macros.ccLogin.doLogin(w.formElem["username"].value, w.formElem["password"].value, this, place);

	});
	
	var li_register = createTiddlyElement(w.footElem, "label");
	createTiddlyButton(w.footElem,this.buttonLogin,this.buttonLoginToolTip,function() {
		config.macros.ccLogin.doLogin(w.formElem["username"].value, w.formElem["password"].value, this, place);
	},null, null, null,  {tabindex:'3'});
	
	if(config.macros.register!==undefined){		
		var li_register = createTiddlyElement(w.footElem, "li");
		createTiddlyButton(li_register,config.macros.register.buttonRegister,config.macros.register.buttonRegisterToolTip,function() {
				config.macros.register.displayRegister(place, w, this);
		},"nobox", null, null,  {tabindex:4});
	}
	var li_forgotten = createTiddlyElement(w.footElem, "li");
	createTiddlyButton(li_forgotten,this.buttonForgottenPassword,this.buttonForgottenPasswordToolTip,function() {
		config.macros.ccLogin.displayForgottenPassword(this, place);
	},"nobox", null, null,  {tabindex:5});

};

config.macros.ccLogin.doLogin=function(username, password, item, place){
	var w = new Wizard(item);
	var me = config.macros.ccLogin;
	var userParams = {};
	console.log(config.adaptors);
	userParams.place = place;
	var adaptor = new config.adaptors[config.defaultCustomFields['server.type']];
	var context = {};
	context.host = window.url;
	context.username = username;
	context.password = password;
	adaptor.login(context,userParams,config.macros.ccLogin.loginCallback)
	var html = me.stepDoLoginIntroText; 
	w.addStep(me.stepDoLoginTitle,html);
	w.setButtons([
		{caption: this.buttonCancel, tooltip: this.buttonCancelToolTip, onClick: function() {config.macros.ccLogin.refresh(place);}
	}]);
}

config.macros.ccLogin.loginCallback=function(context,userParams){
	if(context.status){
		window.location.reload();
	}else{
		config.macros.ccLogin.refresh(userParams.place, config.macros.ccLogin.msgLoginFailed);
	} 
};

config.macros.ccLogin.displayForgottenPassword=function(item, place){	
	var w = new Wizard(item);
	var me = config.macros.ccLogin;
	w.addStep(me.stepForgotPasswordTitle,me.stepForgotPasswordIntroText);
	w.setButtons([
		{caption: this.buttonCancel, tooltip: this.buttonCancelToolTip, onClick: function() {me.refresh(place);}}
	]);
};

//config.macros.ccLogin.sendForgottenPassword=function(item, place){	
//	var w = new Wizard(item);
//	var me = config.macros.ccLogin;
//}

config.macros.toolbar.isCommandEnabled=function(command,tiddler){	
	var title=tiddler.title;
	if (workspace_delete=="D"){
		// REMOVE OPTION TO DELETE TIDDLERS 
		if (command.text=='delete')
			return false;
	}
	if (workspace_udate=="D"){
		// REMOVE EDIT LINK FROM TIDDLERS 
		if (command.text=='edit')
			return false;
	}
	var ro=tiddler.isReadOnly();
	var shadow=store.isShadowTiddler(title) && !store.tiddlerExists(title);
	return (!ro || (ro && !command.hideReadOnly)) && !(shadow && command.hideShadow);
};

// Returns output var with output.txtUsername and output.sessionToken
function findToken(cookieStash){
	var output={};
	if (!cookieStash)
		return false;	
	//  THIS IS VERY HACKY AND SHOULD BE REFACTORED WHEN TESTS ARE IN PLACE
	var cookies=cookieStash.split('path=/');
	for(var c=0; c < cookies.length ; c++){
		var cl =cookies[c].split(";");
		for(var e=0; e < cl.length; e++){ 
			var p=cl[e].indexOf("=");
			if(p!=-1){
				var name=cl[e].substr(0,p).trim();
				var value=cl[e].substr(p+1).trim();       
				if (name=='txtUserName'){
					output.txtUserName=value;
				}
				if (name=='sessionToken'){
					output.sessionToken=value;
				}
			}
		}
	}	
	return output;
};

function cookieString(str){	
	var cookies = str.split(";");
	var output = {};
	for(var c=0; c < cookies.length; c++){
		var p = cookies[c].indexOf("=");
		if(p != -1) {
			var name = cookies[c].substr(0,p).trim();
			var value = cookies[c].substr(p+1).trim();
			if (name=='txtUserName'){
				output.txtUserName=value;
			}
			if (name=='sessionToken'){
				output.sessionToken=value;
			}
		}
	}
	return output;
}

Story.prototype.displayDefaultTiddlers = function(){
 	var tiddlers="";
	if(isLoggedIn()){        
		var url = window.location;        
		url = url.toString();        
		var bits = url.split('#');        
		if(bits.length == 1){            
			tiddlers = store.filterTiddlers(store.getTiddlerText("DefaultTiddlers"));            
			story.displayTiddlers(null, tiddlers);
		}
	}else{
	    /***
            Changed the following to prevent the login tiddler from appearing
            at startup. ECK, 9/1/2011
            ***/
		tiddlers=store.filterTiddlers(store.getTiddlerText("DefaultTiddlers"));
		//tiddlers=store.filterTiddlers(store.getTiddlerText("AnonDefaultTiddlers"));        
		story.displayTiddlers(null, tiddlers);   
	}    
};

window.restart = function(){
	story.displayDefaultTiddlers();
	invokeParamifier(params,"onstart");
	window.scrollTo(0,0); 
};
//}}}

// ccLoginStatus //

//{{{

config.macros.ccLoginStatus.handler=function(place,macroName,params,wikifier,paramString,tiddler){
	var loginDiv=createTiddlyElement(place,"div",null,"loginDiv",null);
	this.refresh(loginDiv);
};
	
config.macros.ccLoginStatus.refresh=function(place,errorMsg){
       var me = config.macros.ccLoginStatus;
       var loginDivRef=document.getElementById ("LoginDiv");
       removeChildren(loginDivRef);
       var wrapper=createTiddlyElement(place,"div");
       var str = (workspace == "" ? me.textDefaultWorkspaceLoggedIn :(me.textViewingWorkspace+workspace))+"\r\n\r\n";
       if (isLoggedIn()){
			name = cookieString(document.cookie).txtUserName;
			str += me.textLoggedInAs+decodeURIComponent(name)+".\r\n\r\n";
			if (workspacePermission.owner==1){
				str += me.textAdmin;
			}
       }else{
               str += me.textNotLoggedIn;
       }
       wikify(str,wrapper);
};
//}}}

// ccOptions //

//{{{
	
config.macros.ccOptions.handler=function(place,macroName,params,wikifier,paramString,tiddler){
	var me = config.macros.ccOptions;
	if(workspacePermission.owner==1)
		wikify("[["+me.linkManageUsers+"|Manage Users]]<br />[["+me.linkPermissions+"|Permissions]]<br />[["+me.linkStats+"|Statistics]]<br />", place);
	if (isLoggedIn())
		wikify("[["+me.linkFiles+"|files]]<br />", place);
		if (isLoggedIn()){
			if (workspacePermission.canCreateWorkspace==1)
				wikify("[["+me.linkCreate+"|CreateWorkspace]]<br />", place);
			// append url function required 
			wikify("[["+me.linkPassword+"|Password]]<br />", place);
			if (window.fullUrl.indexOf("?") >0)
				wikify("[["+me.linkOffline+"|"+fullUrl+"&standalone=1]]<br />", place);
			else 
				wikify("[["+me.linkOffline+"|"+fullUrl+"?standalone=1]]<br />", place);	
		}
};

//}}}

// ccRegister //

//{{{
	
config.macros.register.handler=function(place,macroName,params,wikifier,paramString,tiddler){
	//config.macros.login.refresh(place);
};

config.macros.register.displayRegister=function(place, w, item){
	var me = config.macros.register;
	var w = new Wizard(item);
	w.addStep(me.stepRegisterTitle, me.stepRegisterHtml);
	w.formElem["reg_username"].onkeyup=function() {me.isUsernameAvailable(w);};
	w.setButtons([
		{caption: me.buttonRegister, tooltip: me.buttonRegisterToolTip, onClick:function() { me.doRegister(place, w)}},
		{caption: me.buttonCancel, tooltip: me.buttonCancelToolTip, onClick: function() { config.macros.ccLogin.refresh(place)}}
	]);
	var h1 = createTiddlyElement(null, "h1", null, null, "hahahaha");
	//	w.footElem.appendChild(h1, w.footElem);
	w.footElem.firstChild.parentNode.appendChild(h1, w.footElem);
	//w.footElem.firstChild.insertBefore(h1, w.footElem);
}

config.macros.register.setStatus=function(w, element, text){
	var label_var = w.getElement(element);
	removeChildren(label_var.previousSibling);
	var label = document.createTextNode(text);
	label_var.previousSibling.insertBefore(label,null);
}

config.macros.register.doRegister=function(place, w){
	var me = config.macros.register;
	if(w.formElem["reg_username"].value==''){
		me.setStatus(w, "username_error", me.msgNoUsername);
	}else {
		me.setStatus(w, "username_error", "");
	}
	if(me.emailValid(w.formElem["reg_mail"].value)){
		me.setStatus(w, "mail_error", me.msgEmailOk);
	}else{
		me.setStatus(w, "mail_error", "invalid email address");
		return false;
	}
	if(w.formElem["reg_password1"].value==''){
		me.setStatus(w, "pass1_error", me.msgNoPassword);
		return false;
	}else{
		me.setStatus(w, "pass1_error", "");
	}
	if(w.formElem["reg_password2"].value==''){
		me.setStatus(w, "pass2_error", me.msgNoPassword);
		return false;
	}
	if(w.formElem["reg_password1"].value != w.formElem["reg_password2"].value ){
		me.setStatus(w, "pass1_error", me.msgDifferentPasswords);
		me.setStatus(w, "pass2_error", me.msgDifferentPasswords);
		return false;
	}
 	var params ={};
	params.p = Crypto.hexSha1Str(w.formElem['reg_password1'].value);
	params.u = w.formElem['reg_username'].value;
	params.place = place;
	params.w = w;
	var loginResp=doHttp('POST',url+'/handle/register.php',"username="+w.formElem['reg_username'].value+"&reg_mail="+w.formElem['reg_mail'].value+"&password="+Crypto.hexSha1Str(w.formElem['reg_password1'].value)+"&password2="+Crypto.hexSha1Str(w.formElem['reg_password2'].value),null,null,null,config.macros.register.registerCallback,params);
	w.addStep(me.step2Title, me.msgCreatingAccount);
	w.setButtons([
		{caption: me.buttonCancel, tooltip: me.buttonCancelToolTip, onClick: function() {config.macros.ccLogin.refresh(place);}
	}]);
}

config.macros.register.emailValid=function(str){
	if((str.indexOf(".") > 0) && (str.indexOf("@") > 0))
		return true;
	else
		return false;
};

config.macros.register.usernameValid=function(str){
	if((str.indexOf("_") > 0) && (str.indexOf("@") > 0))
		return false;
	else
		return true;
};

config.macros.register.registerCallback=function(status,params,responseText,uri,xhr){
	var userParams = {};
	userParams.place = params.place;
	if (xhr.status==304){
		params.w.addStep(config.macros.register.errorRegisterTitle, config.macros.register.errorRegister);
		return false;
	}	
	var adaptor = new config.adaptors[config.defaultCustomFields['server.type']];
	var context = {};
	context.host = window.url;
	context.username = params.u;
	context.password = params.p;
	adaptor.login(context,userParams,config.macros.ccLogin.loginCallback);
	return true;
}

config.macros.register.isUsernameAvailable=function(w){
	var params = {};
	params.w = w;
	doHttp('POST',url+'/handle/register.php',"username="+w.formElem["reg_username"].value+"&free=1",null,null,null,config.macros.register.isUsernameAvailabeCallback,params);
	return false;
};

config.macros.register.isUsernameAvailabeCallback=function(status,params,responseText,uri,xhr){
	var me = config.macros.register;
	var resp = (responseText > 0) ? me.msgUsernameTaken : me.msgUsernameAvailable;
	config.macros.register.setStatus(params.w, "username_error", resp);
};
//}}}

// ccStats //

//{{{
	
config.macros.ccStats.handler = function(place,macroName,params,wikifier,paramString,tiddler){
	var params;
	params.place = place;
	doHttp('POST',url+'/handle/workspaceAdmin.php','action=LISTWORKSPACES',null,null,null,config.macros.ccStats.listWorkspaces,params);
}

config.macros.ccStats.simpleEncode = function(valueArray,maxValue){
	var simpleEncoding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
	var chartData = ['s:'];
	  for (var i = 0; i < valueArray.length; i++){
	    var currentValue = valueArray[i];
	    if (!isNaN(currentValue) && currentValue >= 0){
	    	chartData.push(simpleEncoding.charAt(Math.round((simpleEncoding.length-1) * currentValue / maxValue)));
	    }else{
	      chartData.push('_');
	    }
	  }
	return chartData.join('');
}

config.macros.ccStats.max = function(array){
	return Math.max.apply(Math, array);
}

config.macros.ccStats.dataCallback = function(status,params,responseText,uri,xhr){
	me = config.macros.ccStats;
	if(xhr.status==401){
		createTiddlyElement(params.container, "h4", null, null, me.errorPermissionDenied.format([params.title], [workspace]));
		return false;
	}
	var res = eval("[" + responseText + "]");
	var d=[];
	var l="";
	for(var c=0; c<res.length; c++){
		d[c]= res[c].hits;
		l+=res[c].date+"|";
	}
	var maxValue = config.macros.ccStats.max(d);
 	params.gData = config.macros.ccStats.simpleEncode(d,maxValue);
	params.XLabel = l.substring(0, l.length -1);
	params.YLabel = "0|"+maxValue+"|";
	var image = 'http://chart.apis.google.com/chart?cht=lc&chs=100x75&chd='+params.gData+'&chxt=x,y&chxl=0:||1:|';
	var div = createTiddlyElement(params.container, "div", null, "div_button");
	setStylesheet(".div_button:hover{opacity:0.7; cursor: pointer} .div_button{ width:100%; padding:5px;color:#555;background-color:white;} ", "DivButton");
	div.onclick = function(){
		var full = "http://chart.apis.google.com/chart?cht=lc&chs=800x375&chd="+params.gData+"&chxt=x,y&chxl=1:|"+params.YLabel+"0:|"+params.XLabel+"&chf=c,lg,90,EEEEEE,0.5,ffffff,20|bg,s,FFFFFF&&chg=10.0,10.0&";
		setStylesheet(
		"#errorBox .button{padding:0.5em 1em; border:1px solid #222; background-color:#ccc; color:black; margin-right:1em;}\n"+
		"html > body > #backstageCloak{height:"+window.innerHeight*2+"px;}"+
		"#errorBox{border:1px solid #ccc;background-color: #fff; color:#111;padding:1em 2em; z-index:9999;}",'errorBoxStyles');
		var box = document.getElementById('errorBox') || createTiddlyElement(document.body,'div','errorBox');
		box.innerHTML =  "<a style='float:right' href='javascript:onclick=ccTiddlyAdaptor.hideError()'>"+ccTiddlyAdaptor.errorClose+"</a><h3>"+params.title+"</h3><br />";
		box.style.position = 'absolute';
		box.style.height= "460px";
		box.style.width= "800px";
		var img = createTiddlyElement(box, "img");
		img.src = full;
		ccTiddlyAdaptor.center(box);
		ccTiddlyAdaptor.showCloak();
	}
	var img = createTiddlyElement(div, "h2", null, null, params.title);
	var img = createTiddlyElement(div, "img");
	img.src = image;
	var span = createTiddlyElement(div, "div", null, "graph_label", params.desc);
	setStylesheet(".graph_label{  position:relative; width:300px; top:-80px; left:130px;}");
}

config.macros.ccStats.switchWorkspace = function(params){
	removeChildren(params.container);
	config.macros.ccStats.refresh(params);	
}

config.macros.ccStats.refresh = function(params){
	var me = config.macros.ccStats;
	var select = params.w.formElem.workspaces;
	if(select[select.selectedIndex].value!="")
		workspace = select[select.selectedIndex].value;
	params ={ container: params.container, url: window.url+"/handle/stats.php?graph=minute&workspace="+workspace,title:me.graph20MinsTitle, desc:me.graph20MinsDesc};
	doHttp('GET',params.url,null, null, null, null, config.macros.ccStats.dataCallback,params);
	params ={ container:params.container, url:  window.url+"/handle/stats.php?graph=hour&workspace="+workspace,title:me.graph24HourTitle, desc:me.graph24HourDesc};
	doHttp('GET',params.url,null, null, null, null, config.macros.ccStats.dataCallback,params);
	params ={ container: params.container, url:  window.url+"/handle/stats.php?graph=day&workspace="+workspace,title:me.graph7DaysTitle, desc:me.graph7DaysDesc};
	doHttp('GET',params.url,null, null, null, null, config.macros.ccStats.dataCallback,params);
	params ={ container: params.container, url:  window.url+"/handle/stats.php?graph=month&workspace="+workspace,title:me.graph5MonthsTitle, desc:me.graph5MonthsDesc};
	doHttp('GET',params.url,null, null, null, null, config.macros.ccStats.dataCallback,params);	
}

config.macros.ccStats.listWorkspaces = function(status,params,responseText,uri,xhr){
	params.container=createTiddlyElement(null, "div", "container");
	var me = config.macros.ccStats;
	var w = new Wizard();
	w.createWizard(params.place,me.stepTitle);
	w.addStep(null, "<select name='workspaces'></select><input name='stats_hol' type='hidden'></input>");
	var s = w.formElem.workspaces;	
	s.onchange = function(){config.macros.ccStats.switchWorkspace(params) ;};
	var workspaces = eval('[ '+responseText+' ]');
	for(var d=0; d < workspaces.length; d++){
		var i = createTiddlyElement(s,"option",null,null,workspaces[d]);
		i.value = workspaces[d];
		if (workspace == workspaces[d]){
			i.selected = true;
		}
	}
	params.w = w; 
	w.formElem.stats_hol.parentNode.appendChild(params.container);
	config.macros.ccStats.refresh(params);
}
//}}}
config.macros.taggedTabs={};

config.macros.taggedTabs.handler=function(place,macroName,params,wikifier,paramString,tiddler,errorMsg){
	var params = paramString.parseParams("taggedTabset",null,true,false,false);
	var tagged = store.getTaggedTiddlers(params[1].value,"title").reverse();
	var cookie = "taggedTabs";
	var wrapper = createTiddlyElement(null,"div",null,"tabsetWrapper taggedTabset" + cookie);
	var tabset = createTiddlyElement(wrapper,"div",null,"tabset");
	var validTab = false;
	tabset.setAttribute("cookie",cookie);
	for(var t=0; t<tagged.length; t++) {
		var label = tagged[t].title;
		if(label=='ccLogin') 
			tabLabel = "Login";
		else
			tabLabel = label;
		var prompt = tagged[t].title;
		var tab = createTiddlyButton(tabset,tabLabel,prompt,config.macros.tabs.onClickTab,"tab tabUnselected");
		tab.setAttribute("tab",label);
		tab.setAttribute("content",label);
		if(config.options[cookie] == label)
			validTab = true;
	}
	if(!validTab)
		config.options[cookie] = tagged[0].title;
	place.appendChild(wrapper);
	config.macros.tabs.switchTab(tabset, config.options[cookie]);
	
	setStylesheet("div.tiddler .tab {font-size:1.2em;  font-weight:bold;padding:5px;padding-bottom:2px; padding-left:2em; padding-right:2em; margin-left:0px; margin-right:1em;}"+
	"div.tiddler .wizard { margin:0px; }"+
	" div.tabContents .wizard { margin:0px; }"+
	".tabsetWrapper .wizard h1 {display:none}"+
	".tabsetWrapper .wizard h2 {padding:0.5em}"+
	".viewer {float:right; width:90%;}"+
	"a.tabUnselected{ background-color:#ddd;}"+
	"a.tabSelected:hover, a.tabUnselected:hover{ color:black}"+
"div.viewer  div.tabsetWrapper{width:90%}"+
	"a.tabSelected{ filter:'alpha(opacity:60)'; background-color:white;}"+
	"div.tabset {padding:0px}"+
	"div.tabContents {padding:0px; background:transparent}",
	 "taggedTabs");
	
};



//}}}
/***
|Name|TaggedTemplateTweak|
|Source|http://www.TiddlyTools.com/#TaggedTemplateTweak|
|Documentation|http://www.TiddlyTools.com/#TaggedTemplateTweakInfo|
|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|Story.prototype.chooseTemplateForTiddler()|
|Description|use alternative ViewTemplate/EditTemplate for tiddler's tagged with specific tag values|
This tweak extends story.chooseTemplateForTiddler() so that ''whenever a tiddler is marked with a specific tag value, it can be viewed and/or edited using alternatives to the standard tiddler templates.'' 
!!!!!Documentation
>see [[TaggedTemplateTweakInfo]]
!!!!!Revisions
<<<
2008.08.29 [1.4.1] corrected handling for tiddlers with no matching tagged template when non-default theme is in effect (e.g., use "MyTheme##ViewTemplate").
| please see [[TaggedTemplateTweakInfo]] for previous revision details |
2007.06.11 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
	
version.extensions.TaggedTemplateTweak= {major: 1, minor: 4, revision: 1, date: new Date(2008,8,29)};

Story.prototype.taggedTemplate_chooseTemplateForTiddler = Story.prototype.chooseTemplateForTiddler
Story.prototype.chooseTemplateForTiddler = function(title,template)
{
	// get default template from core
	var coreTemplate=this.taggedTemplate_chooseTemplateForTiddler.apply(this,arguments);

	// if the tiddler doesn't exist yet or is untagged, return core result
	var tiddler=store.getTiddler(title);
	if (!tiddler || !tiddler.tags.length)
		return coreTemplate;

	// split core template into theme prefix and template name
	var theme="";
	var template=coreTemplate;
	var parts=template.split(config.textPrimitives.sectionSeparator);
	if (parts[1]) { theme=parts[0]; template=parts[1]; }
	else theme=config.options.txtTheme||""; // fallback if theme is not specified
	theme+=config.textPrimitives.sectionSeparator;

	// look for template whose prefix matches a tag on this tiddler (if any)
	for (i=0; i<tiddler.tags.length; i++) {
		var t=tiddler.tags[i]+template; // add tag prefix to template
		var c=t.substr(0,1).toUpperCase()+t.substr(1); // capitalized for WikiWord title
		if (store.getTiddlerText(theme+t))	{ return theme+t; } // theme##tagTemplate
		if (store.getTiddlerText(theme+c))	{ return theme+c; } // theme##TagTemplate
		if (store.getTiddlerText(t)) 		{ return t; }	     // tagTemplate
		if (store.getTiddlerText(c))		{ return c; }	     // TagTemplate
	}
	return coreTemplate; // no matching tag, return core result
}


/***
|''Name:''|purpleTheme|
|''Description:''|A theme with lots of white space and a clean and elegant purple presentation|
|''Author:''|Saq Imtiaz and Simon McManus|
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]] |
|''Source''|http://svn.tiddlywiki.org/Trunk/association/serversides/cctiddly/Trunk/tiddlers/themes/purpleTheme.tiddler|
|''CodeRepository''|http://svn.tiddlywiki.org/Trunk/association/serversides/cctiddly/Trunk/tiddlers/themes/purpleTheme.tiddler|
|''~CoreVersion:''|2.4.1|
|''~PageTemplate:''|##PageTemplate|
|''~tabs:''|##tabs|
|''~OptionsPanel:''|##OptionsPanel|
|''~SideBarTabs:''|##SideBarTabs|
|''~StyleSheet:''|##StyleSheet|
|''~taskViewTemplate:''|##taskViewTemplate|
|''~taskEditTemplate:''|##taskEditTemplate|
|''~EditTemplate:''|##EditTemplate|
|''~ViewTemplate:''|##ViewTemplate|
***/
!PageTemplate
<!--{{{-->
<div id='bodywrapper'>
<div class='header' macro='gradient vert #ccc #eee'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
</div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' force='true' tiddler='purpleTheme##SideBarOptions'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<div id='contentFooter'  macro='gradient vert #eee #ccc'></div>
</div>
<!--}}}-->

!taskViewTemplate
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler > fields syncing permalink references jump'></div>
<div class='title' macro='view title'>Task : </div>
<div class='task'>
	<table>
	<tr>
		<td class='taskbody' width=100%><div class='viewer' macro='view text wikified'></div></td>
		<td class='taskControls' valign='top'><div class='taskControls' macro='tiddler TaskTiddlerControls'></td>
	</tr>
	</table>
</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='tagClear'></div>
<!--}}}-->

!taskEditTemplate
<!--{{{-->
<div class="editor">
<div class='toolbar' macro='toolbar[[ToolbarCommands::EditToolbar]]'></div>
<div class='task'>
	<table>
	<tr><td colspan=2><div class='title edit' macro='edit title'></div>
	</td></tr>
	<tr>
		<td class='taskbody' width=100% height=100%><div class='viewer edit' macro='edit text wikified'></div></div></td>
		<td class='taskControls' valign=top><div class='taskControls' macro='tiddler TaskTiddlerControls'></td>
	</tr>
	</table>
</div>
<div class='editor' macro='edit tags'></div>
<div class='subtitle'>Last edited by: <span macro='view modifier link'></span>, <span macro='view modified date'></span></div>
</div>
<!--}}}-->

!EditTemplate
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<!--}}}-->

!ViewTemplate
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='tagClear'></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>
<hr />
<!--}}}-->

!OptionsPanel
[[help|Help]] <br />[[settings|AdvancedOptions]]<br /><<ccOptions>>

!tabs
<<tabs txtMainTab "Timeline" "Timeline" TabTimeline "All" "All tiddlers" TabAll "Tags" "All tags" TabTags "More" "More lists" TabMore>>

!SideBarOptions
<<search "search...">><<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>><<slider chkSliderOptionsPanel smmTheme##OptionsPanel 'options »' 'change TiddlyWiki Options'>><<slider 'chkLoginStatus' 'LoginStatus' '  status »' 'Login to make changes'>><<slider chkSliderTabs smmTheme##tabs 'content »' 'View TiddlyWiki Tabs'>>

!StyleSheet
/***
General
***/
/*{{{*/

body, html{
	background-color: #999999;
	color:#333;
//	background:url(http://www.thefabricdeli.com/assets/images/qud21112-purple.jpg);
//	background:url(http://mr-pc.org/inc/paisleyTileSmall.png);
}

#backstageCloak {
	opacity:0.8; filter:'alpha(opacity:70)';
	background:black;
}
.tiddler .button {
	line-height:4;
	margin:5px;
	padding:8px;
}

body .chkOptionInput {
	width:auto;
	float:right;
}

#contentWrapper .wizard .txtOptionInput {
	width:7em;
}

.wizard  .txtOptionInput{
text-align:right;
	border:1px solid #ccc;
}

#contentWrapper .sliderPanel .tabsetWrapper .tabContents {
	border:0px;
	background-color:white;
}

.header {
	background-color:#eee;
}

#messageArea {
	border:1px solid white;
	background-color:#eee;
}

#messageArea .button {
	background:none;
}

h1 {
	color:black;
}

#contentWrapper {
	position:relative;
	margin: 2.5em auto;
	width:780px;
	line-height: 1.6em;
	border:1px solid #ccc;
	font-size: 11px;
	font-family: Lucida Grande, Tahoma, Arial, Helvetica, sans-serif;
	height:1%;
//	display:table;
	background-color:#eee;
}

.clearAll{
	clear:both;
}

.tagClear{
	clear:none;
}
/*}}}*/

/*{{{*/
.siteTitle {
	font-family: 'Trebuchet MS' sans-serif;
	font-weight: bold;
	position:relative;
	top:20px;
	left :20px;
	font-size: 32px;
	color:Purple;
}

.siteSubtitle {
	padding-top:15px;
	font-size: 1.0em;
	display:block;
	color: #999; margin-top:0.5em !important; margin-top:1em; margin-left:3em;
	padding-top:3em;
}

#displayArea {
	margin-left:1.35em;
	margin-right:16.3em;
	margin-top:0;
	padding-top:1em;
	padding-bottom:10px;
}

#sidebarOptions input {
	border:1px solid #ddd;
}


.tabUnselected {
	background:#eee none repeat scroll 0%;
	color:#999;
}

#sidebar {
	position:inherit;
	float:right;
	display:inline;
}

#tiddlerDisplay .tagging, #tiddlerDisplay .tagged {
	background-color:#eee;
	border:none;
	float:none;
}

.sliderPanel .tabsetWrapper .tabContents {
	border-right:none;
	border-color:#999;
	background-color:#999;
}

#sidebarOptions .sliderPanel a {
	padding:3px;
	margin:0px;
	border:2px;
	background-color:#999;
}

.tabsetWrapper {
	position :relative;
}

#sidebar{
	padding-left:0.5em;
	background-color:#eee;
	padding-top:1em;
}

#sidebarOptions a {
	margin:17px;
	display:block;
	margin:0.5em 0em;
	padding:0.3em 0.6em;
}

.popup li a {
	margin:0px;
	padding:0px;
	display:inline;
	color:black;
}

.popup {
	background-color:white;
	border:1px solid purple;
}

.popup li a:hover {
	display:inline;
	margin:0px;
	padding:0px;
	background-color:white;
	color:purple;
}

.popup li {
	margin:0px;
	padding:5px;
	background-color:#eee;
}
.popup li:hover {
	background-color:white;
}

#tiddlerDisplay .toolbar a.button, #sidebarOptions a, .toolbar .popup li a, #mainMenu a, .tiddler .button, #sidebarOptions .sliderPanel input {
	border:1px solid white;
	background-color:white;
	color:purple;
}

#tiddlerDisplay .toolbar a.button:hover, #sidebarOptions a:hover,  #mainMenu a:hover, .tiddler .button, #sidebarOptions .sliderPanel input:hover
{
	border:1px solid #ccc;
}

#sidebarOptions a:hover {
border-right:1px solid white;
}

.tagged ul {
	list-style: none;
}

.tagged li {
	display: inline;
}

.zoomer {
	background:none; color:#ddd;
	border:2px solid #ddd;
}

a:active{
	border:1px solid red;
	background-color:#eee;
	color:[[ColorPalette::smmLight1]]
}

a:hover {
	background-color:#eee;
	color:[[ColorPalette::smmLight1]]
}

#backstageArea,#backstageArea a {
	background:transparent;
	color:white;
}

#mainMenu a {
	padding:8px 15px 8px 15px;
	margin:10px;
	line-height:40px;
	border:1px solid #eee;
}

#contentWrapper #mainMenu{
	position:static;
	width:100%;
	float:left;
	text-align:left;
	padding-top:20px;
}

.editor textarea, .editor input, input, body select {
	border:1px solid #ccc;
	background-color:white;
	color:#999;
	padding:3px;
	margin:3px;
}

#sidebarOptions input {
	width:85%;
	margin-left:-0.1em;}

#sidebarTabs {
	margin:0px;
	padding:0px
}

#sidebarTabs .tabContents {
	color:[[ColorPalette::smmLight1]];
	background:#999;
}

#contentWrapper .tiddler .button {
margin:0.4em;
padding:0.4em 0.8em;
}

#sideBarOptions .searchButton{
	display:none;
}

#sidebar .sliderPanel {
	margin-left:5px;
	border:0px;
	padding:0em;
	border-right:1px solid #eee;
	margin-bottom:0.8em;
}

#sidebarOptions .searchButton {
	display:none;
}

.title {
	color:#C0C0C0;
}

.subtitle, .subtitle a {
	color: #999;
	font-size: 1em;margin:0.2em;
	font-variant: small-caps;
}

* html .viewer pre {
	margin-left: 0em;
}

* html .editor textarea, * html .editor input {
	width: 98%;
}

a,#sidebarOptions .sliderPanel a, #topMenu a, #topMenu .button {
	color:purple;
	background-color:transparent;
}

#sidebarOptions .sliderPanel a:hover, #topMenu a, #topMenu .button:hover {
	color:black;
	background-color:transparent;
	border:0px;
}

#sidebarOptions .sliderPanel a.tabSelected {
border:1px solid #ddd;
border-bottom:1px solid white;
}
 
#topMenu a, #topMenu .button {
	padding: 5px 15px;
	margin:9px;
	border:1px solid #999;
	font-weight:bold;
	line-height:40px;
	top:1em;
	color:[[ColorPalette::smmLight1]];
	background-color:#eee;
}

#topMenu br {
	display:none;
}

#topMenu a:hover, #topMenu .button:hover {
	background-color:#eee;
}

.tagging, .tagged {
	border: 0px dotted [[ColorPalette::smmLight1]];
}

.highlight, .marked {
	background:transparent;
	color:#999;
	border:none;
	text-decoration:underline;
}

.tagging .button:hover, .tagged .button:hover, .tagging .button:active, .tagged .button:active {
	border: none;
	background:transparent;
	text-decoration:underline;
	color:#eee;
}

.viewer th, thead td {
	background: #eee;
	border:none;
	color: #fff;
}

.viewer table {
	border:1px solid #eee;
}

table.twtable {
	border-collapse:seperate;
}

.viewer pre {
	background-color:white;
	border: 1px dotted #999;
}

hr {
	border: dotted 1px #ccc;
}

#sidebarOptions .sliderPanel .tabUnselected {
	background:#eee none repeat scroll 0%;
	border:0px solid #999;
	color:#999;
	padding:2px;
}

#sidebarOptions .sliderPanel .tabSelected {
	background:white none repeat scroll 0%;
	padding:2px;
	border:1px solid #999;
	border-bottom:1px solid black;
	color:#999;
	border-bottom:2px solid white;
}

.tabContents {
	background:#f7f7f7;
	border:0px;
}

.viewer code {
	background:##eee none repeat scroll 0%;
	color:#999;
}

h1,h2,h3,h4,h5 {
	color: #555; 
	border-color:#333; 
	background: transparent; 
	padding-bottom:2px; 
	font-family: Arial, Helvetica, sans-serif;
}

h1 {
	font-size:18px;
}

h2 {
	font-size:16px;
	border-bottom:1px solid #FFF;
}

h3 {
	font-size: 14px;
	border-bottom:1px solid #FFF;
}

.annotation {
	background-color:purple;
	border:1px solid white;
	color:white;
}

#contentFooter {
	background:#999;
	clear: both;
	padding: 0.5em 1em;
}

.button, .wizard .button:hover {
	border:0px;
}

.sliderPanel input  {
	border:1px solid #777;
	background-color:white;
	color:#777;	
}

#contentWrapper .tiddler .button:hover {
	border:1px solid;
}

table, .viewer td, .viewer tr, .twtable td, .twtable tr {
	border:0px solid #666666;
}

body .wizardFooter {
	padding :10px;
	margin:0px;
	padding-top:0px;
	background:white;
	font-weight:bold;
}

.wizardStep {
	padding:0px;
	border:none;
	background-color:none;
} 
	
.wizard  th{
	background:white;
	color:#888;
	padding:3px;
	margin:40px;
};

.wizard, listView twtable {
	border:0px; 
};

.wizard {
	color:#292929;
}

.viewer .wizard, body .wizard{
	background:white;
	margin:2em;
	border:1px solid #CCCCCC;
	color:#999;
}

.wizard h1 {
	color:#999;
	padding-top:10px;
	padding-bottom:10px;
}

.wizard h2 {
	color:black;
}

body .wizardStep {
	color:#999;
	border:0px;
	margin:0m;
	background:white;	
}

body select {
	border:0px;
	padding:3px;
	margin:4px;
}

#backstageArea a:hover {
	background-color:white;
}

#backstagePanel {
	background:none;
	width:60%;
	position:fixed
	padding:0px;
	margin:0px;
	margin-top:-36px;
}

#backstageToolbar a.backstageSelTab {
	background-color:white;
	border:1px solid white;
}

#sidebar .sliderPanel {
	background-color:#eee;
	font-size:1em;
}

.viewer .wizardStep table {
	border:0px;
}

.viewer th, .viewer td, .viewer tr, .viewer caption, .twtable th, .twtable td, .twtable tr, .twtable caption {
	border:0px;
	padding:0px;
	margin:0px;
}

.viewer .sortable td {
	padding:12px;
	margin:21px;
}

.title {
	color:#777;
	padding:0px;
}

.viewer table, table.twtable {
	border-collapse:seperated;
	border:0px;
}

.viewer th, .viewer thead td, .twtable th, .twtable thead td {
	border:0px;
	background-color:white;
	color:black;
}

.twtable th{
	background-color:#eee;
	padding:15px;
	margin:15px;
}

table.sortable td.sortedCol {
	background-color:white;
}
/*}}}*/

[[StyleSheet]]
/***
|''Name:''|smmTheme|
|''Author:''|Saq Imtiaz and Simon McManus|
|''Source''|http://svn.tiddlywiki.org/Trunk/association/serversides/cctiddly/Trunk/tiddlers/themes/smmTheme.tiddler|
|''~CodeRepository:''|http://svn.tiddlywiki.org/Trunk/association/serversides/cctiddly/Trunk/tiddlers/themes/smmTheme.tiddler|
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]] |
|''~CoreVersion:''|2.4.1|
|''~PageTemplate:''|##PageTemplate|
|''~tabs:''|##tabs|
|''~OptionsPanel:''|##OptionsPanel|
|''~StyleSheet:''|##StyleSheet|
|''~taskViewTemplate:''|##taskViewTemplate|
|''~taskEditTemplate:''|##taskEditTemplate|
|''~EditTemplate:''|##EditTemplate|
|''~ViewTemplate:''|##ViewTemplate|
***/


!PageTemplate
<!--{{{-->
<div class='header' macro='gradient vert #111 #222'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span><div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
</div>
<div id='bodywrapper'>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' force='true' tiddler='smmTheme##SideBarOptions'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<div id='contentFooter'  macro='gradient vert #222 #111'></div>
</div>
<!--}}}-->

!taskViewTemplate
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler > fields syncing permalink references jump'></div>
<div class='title' macro='view title'>Task : </div>
<div class='task'>
	<table>
	<tr>
		<td class='taskbody' width=100%><div class='viewer' macro='view text wikified'></div></td>
		<td class='taskControls' valign='top'><div class='taskControls' macro='tiddler TaskTiddlerControls'></td>
	</tr>
	</table>
</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='tagClear'></div>
<!--}}}-->

!taskEditTemplate
<!--{{{-->
<div class="editor">
<div class='toolbar' macro='toolbar[[ToolbarCommands::EditToolbar]]'></div>
<div class='title edit' macro='edit title'></div>
<div class='task'>
	<table>
	<tr>
		<td class='taskbody' width=100% height=100%><div class='viewer edit' macro='edit text wikified'></div></div></td>
		<td class='taskControls' valign=top><div class='taskControls' macro='tiddler TaskTiddlerControls'></td>
	</tr>
	</table>
</div>
<div class='subtitle'>Last edited by: <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='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<div class='tagClear'></div>
</div>
<!--}}}-->

!EditTemplate
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<!--}}}-->

!ViewTemplate
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='subtitle'>Last edited by: <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='tagClear'></div>
<!--}}}-->

!wizardViewTemplate
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
!OptionsPanel
[[help|Help]] <br />[[settings|AdvancedOptions]]<br /><<ccOptions>>

!tabs
<<tabs txtMainTab "Timeline" "Timeline" TabTimeline "All" "All tiddlers" TabAll "Tags" "All tags" TabTags "More" "More lists" TabMore>>

!SideBarOptions
<<search "search...">><<closeAll>><<newTiddler label:"new task" text:"New Task" title:"New Task" tag:"task">><<newTiddler>><<slider chkSliderOptionsPanel smmTheme##OptionsPanel 'options »' 'change TiddlyWiki Options'>><<saveChanges>><<slider 'chkLoginStatus' 'LoginStatus' '  status »' 'Login to make changes'>><<slider chkSliderTabs smmTheme##tabs 'contents »' 'View TiddlyWiki Tabs'>>

!StyleSheet
/***
General
***/
/*{{{*/
.tiddler .button:hover {
	background-color:#222;
}
.tiddler .button {
	border:1px solid black;
	line-height:2;
	margin:5px;
	padding:8px;
}

#contentWrapper .tiddler .button {
	margin-left:20px;
}
body .chkOptionInput {
	width:auto;
	float:right;
}

#contentWrapper .wizard .txtOptionInput {
	width:7em;
}

body{
	background: #111;
	color:white;
//	 background-image:url(http://friendster.bigoo.ws/content/layout/film-cartoon/film-cartoon_111.jpg);
//	 background-image:url(http://g.editingmyspace.com/shay773/halloweenbackgrounds/BG1.gif);
}

#backstageCloak {
	opacity:0.9; filter:'alpha(opacity:90)';
	background:#222;
}

#messageArea {
	border:0px;
	color:white;
	background-color:#222;
}

#messageArea .button{
	background:none;
}

#mainMenu br {
	display:none;
}

h1 {
	color:white;
}

#contentWrapper{
	position:relative;
	margin: 2.5em auto;
	width:780px;
	line-height: 1.6em;
	border:1px solid #111;
	font-size: 11px;
	font-family: Lucida Grande, Tahoma, Arial, Helvetica, sans-serif;
	height:1%;
	background-color:#222;
}

.clearAll{
	clear:both;
}

.tagClear{
	clear:none;
}
/*}}}*/

/*{{{*/

.siteTitle {
	font-family: 'Trebuchet MS' sans-serif;
	font-weight: bold;
	position:relative;
	top:20px;
	left :20px;
	font-size: 32px;
	color:#eee;
}

.siteSubtitle {
	padding-top:15px;
	font-size: 1.0em;
	display:block; 
	color: #999; margin-top:0.5em !important; margin-top:1em; margin-left:3em;
}

#displayArea {
	margin-left:1.35em;
	margin-right:16.3em;
	margin-top:0;
	padding-top:1em;
	padding-bottom:10px;
}

.tabUnselected {
	background:#222 none repeat scroll 0%;
	color:#999;
}

#sidebar {
	position:inherit;
	float:right;
	display:inline;
}

#tiddlerDisplay .tagging, #tiddlerDisplay .tagged {
	background-color:#222;
	border:none;
	float:none;
}

.sliderPanel .tabsetWrapper .tabContents {
	border-right:none;
	border-color:#999;
	background-color:#111;
}

#sidebarOptions .sliderPanel a{
	padding:3px;
	margin:0px;
	border:2px;
	background-color:#111;
}

.tabsetWrapper {
	position :relative;
}

#sidebar {
	padding-left:0.5em;
	background-color:#222;
	padding-top:1em;
}

#sidebarOptions a {
	margin:17px;
	display:block;
	margin:0.5em 0em;
	padding:0.3em 0.6em;
}

.popup li a {
	padding:12px;
}

#tiddlerDisplay .toolbar a.button, #sidebarOptions a, .toolbar .popup li a, #mainMenu a, #sidebarOptions .sliderPanel input {
	background-color:#111;
	color:#999;
	border:1px solid #111;
}

.wizard  .txtOptionInput {
	text-align:right;
}

a:hover {
	background-color:#222;
	color:#eee
}

#tiddlerDisplay .toolbar a.button:hover, #sidebarOptions a:hover, #mainMenu a:hover, #sidebarOptions .sliderPanel input:hover {
	border:1px dotted #000;
	background-color:#222;
	color:white;
}

#mainMenu a {
	padding:8px 15px 8px 15px;
	margin:10px;
	line-height:40px;
	border:0px solid #eee;
}

#contentWrapper #mainMenu { 
	position:static;
	width:100%;
	float:left;
	text-align:left;
	padding-top:20px;

}
.editor textarea, .editor input,  input, body select {
	border:1px solid #222;
	background-color:#333;
	color:#999;
	padding:3px;
	margin:3px;
}

#sidebarOptions input {
	border:1px solid #999;
	background-color:#00000;
	width:10em;
}

#sidebarTabs {
	margin:0px;
	padding:0px
}

#sidebarTabs .tabContents {
	color:#eee;
	background:#111;
}
.tagged li
{
	display: inline;
}

.tiddler .button {
	color:white;
	padding:0.4em 0.9em 0.4em 0.9em;
	margin:0px 0px 0px 7px;
}

#sideBarOptions .searchButton {
	display:none;
}

#sidebar .sliderPanel {
	border-color:-moz-use-text-color #222 -moz-use-text-color -moz-use-text-color;
	border-style:none solid none none;
	border-width:0 1px 0 0;
	margin-bottom:0.8em;
	margin-left:5px;
	padding:0;
	margin-left:0px;
}

#sidebarOptions .searchButton {
	display:none;
}

.title {
	color:#C0C0C0;
}

.subtitle, .subtitle a {
	color: #999;
	font-size: 1em;margin:0.2em;
	font-variant: small-caps;
}

.wizard .button:hover{
	background-color:#333;
	border:1px solid #444;
	color:white;
}
.selected .toolbar a {
	color:#999;
}

.selected .toolbar a:hover {
	color:#222;
	background:transparent;
	border:1px solid #fff;
}

.viewer pre {
	background:#111111 none repeat scroll 0 0;
	border:1px solid #FFEE88;
}

* html .viewer pre {
	margin-left: 0em;
}

* html .editor textarea, * html .editor input {
	width: 98%;
}

a,#sidebarOptions .sliderPanel a, #topMenu a, #topMenu .button {
	color:green;
	background-color:transparent;
}

#sidebarOptions .sliderPanel a:hover, #topMenu a, #topMenu .button:hover {
	color:white;
	background-color:transparent;
	border:0px;
}

#topMenu a, #topMenu .button, .wizard .button {
	padding: 5px 15px;
	margin:9px;
	border:1px solid #999;
	font-weight:bold;
	line-height:40px;
	top:1em;
	color:#eee;
	background-color:#222;
}

#topMenu br {
	display:none;
}

#topMenu a:hover, #topMenu .button:hover {
	background-color:#222;
}

.tagging, .tagged {
	border: 1px solid #eee;
}

.highlight, .marked {
	background:transparent;
	color:#111;
	border:none;
	text-decoration:underline;
}

.tagging .button:hover, .tagged .button:hover, .tagging .button:active, .tagged .button:active {
	border: none;
	background:transparent;
	text-decoration:underline;
	color:#222;
}

.tiddler {
	padding-bottom: 40px;
}

.viewer th, thead td {
	background: #222;
	border:none;
	color: #fff;
}

.viewer table {
	border:1px dotted #222;
}

table.twtable {
	border-collapse:seperate;
}

.viewer pre {
	border: 1px solid #999;
}

.viewer hr {
	border-top: dashed 1px #999;
}

.tabSelected {
	background:#111 none repeat scroll 0%;
	border:1px solid #111;
	border-bottom:1px solid black;
	color:#999;
}

.tabContents {
	background:#f7f7f7;
	border:0px;
}

.viewer code {
	background:##222 none repeat scroll 0%;
color:#999;
}

h1,h2,h3,h4,h5 {
	color: #555; border-color:#333; background: transparent; padding-bottom:2px; font-family: Arial, Helvetica, sans-serif;
}

h1 {
	font-size:18px;
}

h2 {
	font-size:16px;
}

h3 {
	font-size: 14px;
}

#contentFooter {
	background:#999;
	clear: both;
	padding: 0.5em 1em;
}

.wizard input {
	border:1px solid #333;
}
#sidebarOptions input {
	border: 1px solid #222;
}

.annotation {
	background-color:green;
	border:1px solid white;
	color:white;
}

.wizardFooter .button{
	background:#222;
	margin:3px;
	padding:0.5em;
	padding-left:1.5em;
	padding-right:1.5em;
	color:white;
	border:1px solid #333;
}
table, .viewer td, .viewer tr, .twtable td, .twtable tr {
	border:0px solid #666666;
}

.tagging .listTitle, .tagged .listTitle, .txtMainTab .tabContents li {
	color:white;
}

body .wizardFooter {
	background:none;
	font-weight:bold;}

.wizardStep {
	border:none;
	background-color:none;
}

body .wizard {
	width:80%;
	padding:10px;
	border:1px solid #EBE6F5;
}

.wizard  th{
	background:#222;
	color:#888;
	padding:3px;
	margin:40px;
};

.wizard, listView twtable {
	border:0px;
};

.wizard {
	padding : 4px 14px 4px 14px;
	font-weight:bold;
	color:#292929;
	border:solid 0px #292929;
	margin-top:1px;
}

.viewer .wizard, body .wizard{
	background:#111;
	margin:2em;
	border:0px;
	border:1px solid #333;
	color:#777;
}

.wizard h1{
	color:#999;
}

.wizard h2{
	padding:4px;
	color:white;
}

body .wizardStep{
	color:#999;
	border:0px;
	margin:0m;
	background:none;
}

body select {
	border:0px;
	padding:3px;
	margin:4px;
}

#backstagePanel {
	border:0px;
	background:none;
	width:60%;
	position:fixed
	padding:0px;
	margin:0px;
	margin-top:-36px;
}

#sidebar .sliderPanel {
	background-color:#222;
	font-size:1em;
}

.viewer .wizardStep table {
	border:0px;
}

.viewer th, .viewer td, .viewer tr, .viewer caption, .twtable th, .twtable td, .twtable tr, .twtable caption {
	border:0px;
	padding:0px;
	margin:0px;
}

.viewer .sortable td  {
	padding:12px;
	margin:21px;
}

.title {
	color:#C0C0C0;
	padding:10px;
}

.viewer table, table.twtable {
	border-collapse:seperated;
	border:0px;
}

.viewer th, .viewer thead td, .twtable th, .twtable thead td {
	border:0px;
	color:white;
}

.twtable th{
	background-color:#333;
	padding:15px;
	margin:15px;
}

table.sortable td.sortedCol {
	background-color:#333;
}

#backstageArea a:hover, #backstageArea a.backstageSelTab {
	background-color:#111;
	color:white;
}
/*}}}*/

[[StyleSheet]]
Welcome to our collaborative encyclopedia. It is a ~TiddlyWiki, in which every object (text entries, titles, buttons, search fields, etc.) is a &quot;tiddler&quot;. Tiddly Wikis are simpler and easier to use than standard wikis. If you are an Encyclopedia editor and have logged (see "login" link at the right), all you have to do is push the &quot;edit&quot; button floating above the entry to edit it. If you haven't logged in, this button will not be visible, but you can still read the site with impunity. 

You can create a new entry using the button in the sidebar called &quot;new tiddler&quot;. Be sure to add &quot;tags&quot; to the text box immediately below the edit rectangle. These can help when searching for posts, and in Tiddly Wiki are especially important as, by default, most entries are hidden when the site is first visited.

The "more" button above each article will reveal several new buttons, the most important of which is "revisions". This will show the history of changes to the article, allowing you to recall or inspect a previous version.

I have placed drop-down menus "Amplification", "Stress", "Evolution", "B12", "Illumina", "Ideas", "New Papers" and "All Papers" in the bar below the header. These display all tiddlers tagged with the corresponding category. This list is automatically updated. Many other categories can be created by tagging. The buttons aren't necessary -- they just refer to some major fields of interest in the lab. If you think another drop-down menu would be useful, ask me and I'll implement it.

Any one can read our wiki. However, editing will be confined to members, friends and colleagues of the John Roth Laboratory at UC Davis. You can request a username and password from the [[system administrator |mailto:eckofoid@ucdavis.edu]]. This enables tracking of edit changes according to users, allows you to search on your own edits, and enables other wiki users to contact you through your provided email address.

Remember that all text entries are editable by anybody logged in, regardless of who last added to them. Wikis are a tool for collaborative writing. They are terrible archives because they are in a constant state of flux, subject to whim, human error, and even spite! For opinions and data sharing, our [[blog |http://mollycat.ucdavis.edu/wordpress]] is probably the best medium, as posts can only be modified by the originator. For multiauthored work or articles which are essentially encyclopedia entries, this wiki is the better vehicle.

Enjoy!
[>img(120px,auto)[colony|../pics/roth_colony.png]]Roth Encyclopedia
A compendium of collaborative definitions, projects & ideas
//brought to you by TiddlyWiki - The Wiki with a silly name//
<<ccListMyWorkspaces>>
<<ccListWorkspaces>>
[img[ silly.txt | ../pics/blueheaven.gif]]
[img[ | ../pics/blueheaven.gif]]
<<tag 'amplification' 'Amplification' 'This button will bring up all tiddlers in the "Amplification" category.'>>
<<tag 'stress' 'Stress' 'This button will bring up all tiddlers in the "Stress" category.'>>
<<tag 'evolution' 'Evolution' 'This button will bring up all tiddlers in the "Evolution" category.'>>
<<tag 'b12' 'B12' 'This button will bring up all tiddlers in the "B12" category.'>>
<<tag 'illumina' 'Illumina' 'This button will bring up all tiddlers in the "Illumina" category.'>>
<<tag 'idea' 'Ideas' 'This button will bring up all tiddlers in the "idea" category.'>>
<<tag 'newpapers' 'New Papers' 'This button brings up tiddlers in the "newpaper" category.'>>
<<tag 'papers' 'All Papers' 'This button brings up tiddlers in the "papers" category.'>>
<<tiddler vbar>>
//[[About|GettingStarted]]
[[Format|AboutFormatting]]
[[Help]]//
[[EricKBlog | cctiddly/?workspace=EricKBlog]]


This is version <<version>> of ~TiddlyWiki.
[[Help Me|Help]]
[[My Blog|"http://mollycat.ucdavis.edu/cctiddly/"]]
[[Roth Blog|"http://mollycat.ucdavis.edu/wordpress/"]]
[[My Tiddly Blog|cctiddly/?workspace=EricNotebook]]

Block formatted equations may also use the 'equation' environment: \begin{equation} \int \tan x = -\ln \cos x \end{equation} 
Another easy integral: \[\int_a^b x = \frac{1}{2}(b^2-a^2)\]
Fractions are straightforward: \[\frac{32}{89}\]

What would I ever use this for?:
\<\<miniBrowser\>\> ==> <<miniBrowser>>

Push this at your own risk: <<closeAll>> !

Here is a page-by-page rendition of a pdf file:
{{stretch{[img[Walker Comments|cctiddly/DispatchWalkerNew1.pdf]]}}}
{{stretch{[img[Walker Comments|cctiddly/DispatchWalkerNew2.pdf]]}}}
{{stretch{[img[Walker Comments|cctiddly/DispatchWalkerNew3.pdf]]}}}
{{stretch{[img[Walker Comments|cctiddly/DispatchWalkerNew4.pdf]]}}}
{{stretch{[img[Walker Comments|cctiddly/DispatchWalkerNew5.pdf]]}}}
<<closeAll>><<permaview>><<newTiddler>><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel 'options »' 'Change TiddlyWiki advanced options'>>[[Roth blog | http://mollycat.ucdavis.edu/wordpress/]] [[Roth website | http://rothlab.ucdavis.edu/]]
<!--{{{-->
<div class='header'>
     <div class='gradient' macro='gradient vert #FF8614 #DA4A0D '>
<!--
     <div class='gradient' macro='gradient vert #469 #08d '>
-->
	<div class='titleLine' >
                <span class='searchBar' macro='search'></span>
		<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
		<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
	</div>
<div id='topMenu' refresh='content' tiddler='MainMenu'></div>
    </div>
</div>
<div id='bodywrapper'>
<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 id='contentFooter' refresh='content' tiddler='contentFooter'></div>
</div>

<!--}}}-->
/***
This CSS by DaveBirss.
***/
/*{{{*/


.tabSelected {
 background: #fff;
}

.tabUnselected {
 background: #eee;
}

#sidebar {
 color: #000;
 background: transparent; 
}

#sidebarOptions {
 background: #fff;
}

#sidebarOptions input {
	border: 1px solid #ccc;
}

#sidebarOptions input:hover, #sidebarOptions input:active,  #sidebarOptions input:focus {
	border: 1px solid #000;
}

#sidebarOptions .button {
 color: #999;
}

#sidebarOptions .button:hover {
 color: #000;
 background: #fff;
 border-color:white;
}

#sidebarOptions .button:active {
 color: #000;
 background: #fff;
}

#sidebarOptions .sliderPanel {
 background: transparent;
}

#sidebarOptions .sliderPanel A {
 color: #999;
}

#sidebarOptions .sliderPanel A:hover {
 color: #000;
 background: #fff;
}

#sidebarOptions .sliderPanel A:active {
 color: #000;
 background: #fff;
}

.sidebarSubHeading {
 color: #000;
}

#sidebarTabs {`
 background: #fff
}

#sidebarTabs .tabSelected {
 color: #000;
 background: #fff;
 border-top: solid 1px #ccc;
 border-left: solid 1px #ccc;
 border-right: solid 1px #ccc;
 border-bottom: none;
}

#sidebarTabs .tabUnselected {
 color: #999;
 background: #eee;
 border-top: solid 1px #ccc;
 border-left: solid 1px #ccc;
 border-right: solid 1px #ccc;
 border-bottom: none;
}

#sidebarTabs .tabContents {
 background: #fff;
}


#sidebarTabs .txtMoreTab .tabSelected {
 background: #fff;
}

#sidebarTabs .txtMoreTab .tabUnselected {
 background: #eee;
}

#sidebarTabs .txtMoreTab .tabContents {
 background: #fff;
}

#sidebarTabs .tabContents .tiddlyLink {
 color: #999;
 border:none;
}

#sidebarTabs .tabContents .tiddlyLink:hover {
 background: #fff;
 color: #000;
 border:none;
}

#sidebarTabs .tabContents {
 color: #000;
}

#sidebarTabs .button {
 color: #666;
}

#sidebarTabs .tabContents .button:hover {
 color: #000;
 background: #fff;
}

#sidebar {color:#999;}
/*}}}*/
~TiddlyWiki is a single html file containing all the characteristics of a wiki - all the content, all the functionality (including editing, saving, tagging and searching) and the style sheet. Because it's a single file, it's very portable - you can email it, put it on a web server or share it via a USB stick. ccTiddly provides a serverside backend to ~TiddlyWiki so you can store your content on the web and access it from anywhere. 

Together the two provide a powerful combination which allows you to collaborate with your colleages online, you can then tear a copy of all the work to take on a plane or train journey.  When you have found an internet connection again you can sync your changes with the online copy and you will be notified of any conflicts. 

Some things you could do with ccTiddly workspace include: 

	* A team/public Website
	* A Blog
    * A personal notebook
    * A GTD ("Getting Things Done") productivity tool
    * A collaboration/communication tool
	* A ~TeamTasks implementation
    * For building websites (this site is a ~TiddlyWiki file!)
    * For rapid prototyping
    * ...and much more!

You can import and export data to and from all sorts of places. Check out the backstage > import options. There's a more detailed list of features here.

<<slider cctHelpIntro [[ccTiddly Introduction]] "ccTiddly Introduction »" "A introduction to the basics of TiddlyWiki.">>
<<slider cctHelpFormatting [[TiddlyWiki Formatting Guide]] "Tiddly Wiki Formatting Guide »" "A basic guide to TiddlyWiki formatting.">>
<<slider cctHelpccTiddlyMacros [[ccTiddly Macros]] "ccTiddly Macros »" "A Guide to all the ccTiddly Macros">>
<<slider cctHelpTiddlyWikiMacros [[TiddlyWiki Macros]] "TiddlyWiki Macros »" "A Guide to all the TiddlyWiki Macros">>

<<options>>
<<ccChangePassword>>
[[Login]]
<div macro='showWhen tiddler.tags.contains("theme")'>
    [[ThemeEditTemplate]]
</div>
<div macro='hideWhenTagged theme'>
    [[StandardEditTemplate]]
</div>
<!--{{{-->
<div class='toolbar' >
<span style="padding-right:2.45em;" macro='tagger'></span>
<span macro='toolbar -closeTiddler closeOthers fullscreen +editTiddler permalink references jump'></span>
</div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date [[DD MMM YYYY]]'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date [[DD MMM YYYY]]'></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>
<!--}}}-->
/***
Place your custom CSS here
***/
/*{{{*/

[[IboxStyles]]
[[StyleSheetCommon]]
#contentWrapper .category input.chkOptionInput {display:inline;}
#contentWrapper .category .chkOptionInput  {display:inline; width:auto;}
/*}}}*/
|''Type:''|file|
|''URL:''|http://tiddlythemes.com/empties/LewcidOrangeBlog.html|
|''Workspace:''|(default)|

This tiddler was automatically created to record the details of this server
/***
|''Name:''|purpleTheme|
|''Description:''|A theme with lots of white space and a clean and elegant purple presentation|
|''Author:''|Saq Imtiaz and Simon McManus|
|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]] |
|''Source''|http://svn.tiddlywiki.org/Trunk/association/serversides/cctiddly/Trunk/tiddlers/themes/purpleTheme.tiddler|
|''CodeRepository''|http://svn.tiddlywiki.org/Trunk/association/serversides/cctiddly/Trunk/tiddlers/themes/purpleTheme.tiddler|
|''~CoreVersion:''|2.4.1|
|''~PageTemplate:''|##PageTemplate|
|''~tabs:''|##tabs|
|''~OptionsPanel:''|##OptionsPanel|
|''~SideBarTabs:''|##SideBarTabs|
|''~StyleSheet:''|##StyleSheet|
|''~taskViewTemplate:''|##taskViewTemplate|
|''~taskEditTemplate:''|##taskEditTemplate|
|''~EditTemplate:''|##EditTemplate|
|''~ViewTemplate:''|##ViewTemplate|
***/
!PageTemplate
<!--{{{-->
<div id='bodywrapper'>
<div class='header' macro='gradient vert #ccc #eee'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
</div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' force='true' tiddler='purpleTheme##SideBarOptions'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<div id='contentFooter'  macro='gradient vert #eee #ccc'></div>
</div>
<!--}}}-->

!taskViewTemplate
<!--{{{-->
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler > fields syncing permalink references jump'></div>
<div class='title' macro='view title'>Task : </div>
<div class='task'>
	<table>
	<tr>
		<td class='taskbody' width=100%><div class='viewer' macro='view text wikified'></div></td>
		<td class='taskControls' valign='top'><div class='taskControls' macro='tiddler TaskTiddlerControls'></td>
	</tr>
	</table>
</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='tagClear'></div>
<!--}}}-->

!taskEditTemplate
<!--{{{-->
<div class="editor">
<div class='toolbar' macro='toolbar[[ToolbarCommands::EditToolbar]]'></div>
<div class='task'>
	<table>
	<tr><td colspan=2><div class='title edit' macro='edit title'></div>
	</td></tr>
	<tr>
		<td class='taskbody' width=100% height=100%><div class='viewer edit' macro='edit text wikified'></div></div></td>
		<td class='taskControls' valign=top><div class='taskControls' macro='tiddler TaskTiddlerControls'></td>
	</tr>
	</table>
</div>
<div class='editor' macro='edit tags'></div>
<div class='subtitle'>Last edited by: <span macro='view modifier link'></span>, <span macro='view modified date'></span></div>
</div>
<!--}}}-->

!EditTemplate
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>
<!--}}}-->

!ViewTemplate
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='tagClear'></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>
<hr />
<!--}}}-->

!OptionsPanel
[[help|Help]] <br />[[settings|AdvancedOptions]]<br /><<ccOptions>>

!tabs
<<tabs txtMainTab "Timeline" "Timeline" TabTimeline "All" "All tiddlers" TabAll "Tags" "All tags" TabTags "More" "More lists" TabMore>>

!SideBarOptions
<<search "search...">><<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>><<slider chkSliderOptionsPanel smmTheme##OptionsPanel 'options »' 'change TiddlyWiki Options'>><<slider 'chkLoginStatus' 'LoginStatus' '  status »' 'Login to make changes'>><<slider chkSliderTabs smmTheme##tabs 'content »' 'View TiddlyWiki Tabs'>>

!StyleSheet
/***
General
***/
/*{{{*/

body, html{
	background-color: #999999;
	color:#333;
//	background:url(http://www.thefabricdeli.com/assets/images/qud21112-purple.jpg);
//	background:url(http://mr-pc.org/inc/paisleyTileSmall.png);
}

#backstageCloak {
	opacity:0.8; filter:'alpha(opacity:70)';
	background:black;
}
.tiddler .button {
	line-height:4;
	margin:5px;
	padding:8px;
}

body .chkOptionInput {
	width:auto;
	float:right;
}

#contentWrapper .wizard .txtOptionInput {
	width:7em;
}

.wizard  .txtOptionInput{
text-align:right;
	border:1px solid #ccc;
}

#contentWrapper .sliderPanel .tabsetWrapper .tabContents {
	border:0px;
	background-color:white;
}

.header {
	background-color:#eee;
}

#messageArea {
	border:1px solid white;
	background-color:#eee;
}

#messageArea .button {
	background:none;
}

h1 {
	color:black;
}

#contentWrapper {
	position:relative;
	margin: 2.5em auto;
	width:780px;
	line-height: 1.6em;
	border:1px solid #ccc;
	font-size: 11px;
	font-family: Lucida Grande, Tahoma, Arial, Helvetica, sans-serif;
	height:1%;
//	display:table;
	background-color:#eee;
}

.clearAll{
	clear:both;
}

.tagClear{
	clear:none;
}
/*}}}*/

/*{{{*/
.siteTitle {
	font-family: 'Trebuchet MS' sans-serif;
	font-weight: bold;
	position:relative;
	top:20px;
	left :20px;
	font-size: 32px;
	color:Purple;
}

.siteSubtitle {
	padding-top:15px;
	font-size: 1.0em;
	display:block;
	color: #999; margin-top:0.5em !important; margin-top:1em; margin-left:3em;
	padding-top:3em;
}

#displayArea {
	margin-left:1.35em;
	margin-right:16.3em;
	margin-top:0;
	padding-top:1em;
	padding-bottom:10px;
}

#sidebarOptions input {
	border:1px solid #ddd;
}


.tabUnselected {
	background:#eee none repeat scroll 0%;
	color:#999;
}

#sidebar {
	position:inherit;
	float:right;
	display:inline;
}

#tiddlerDisplay .tagging, #tiddlerDisplay .tagged {
	background-color:#eee;
	border:none;
	float:none;
}

.sliderPanel .tabsetWrapper .tabContents {
	border-right:none;
	border-color:#999;
	background-color:#999;
}

#sidebarOptions .sliderPanel a {
	padding:3px;
	margin:0px;
	border:2px;
	background-color:#999;
}

.tabsetWrapper {
	position :relative;
}

#sidebar{
	padding-left:0.5em;
	background-color:#eee;
	padding-top:1em;
}

#sidebarOptions a {
	margin:17px;
	display:block;
	margin:0.5em 0em;
	padding:0.3em 0.6em;
}

.popup li a {
	margin:0px;
	padding:0px;
	display:inline;
	color:black;
}

.popup {
	background-color:white;
	border:1px solid purple;
}

.popup li a:hover {
	display:inline;
	margin:0px;
	padding:0px;
	background-color:white;
	color:purple;
}

.popup li {
	margin:0px;
	padding:5px;
	background-color:#eee;
}
.popup li:hover {
	background-color:white;
}

#tiddlerDisplay .toolbar a.button, #sidebarOptions a, .toolbar .popup li a, #mainMenu a, .tiddler .button, #sidebarOptions .sliderPanel input {
	border:1px solid white;
	background-color:white;
	color:purple;
}

#tiddlerDisplay .toolbar a.button:hover, #sidebarOptions a:hover,  #mainMenu a:hover, .tiddler .button, #sidebarOptions .sliderPanel input:hover
{
	border:1px solid #ccc;
}

#sidebarOptions a:hover {
border-right:1px solid white;
}

.tagged ul {
	list-style: none;
}

.tagged li {
	display: inline;
}

.zoomer {
	background:none; color:#ddd;
	border:2px solid #ddd;
}

a:active{
	border:1px solid red;
	background-color:#eee;
	color:[[ColorPalette::smmLight1]]
}

a:hover {
	background-color:#eee;
	color:[[ColorPalette::smmLight1]]
}

#backstageArea,#backstageArea a {
	background:transparent;
	color:white;
}

#mainMenu a {
	padding:8px 15px 8px 15px;
	margin:10px;
	line-height:40px;
	border:1px solid #eee;
}

#contentWrapper #mainMenu{
	position:static;
	width:100%;
	float:left;
	text-align:left;
	padding-top:20px;
}

.editor textarea, .editor input, input, body select {
	border:1px solid #ccc;
	background-color:white;
	color:#999;
	padding:3px;
	margin:3px;
}

#sidebarOptions input {
	width:85%;
	margin-left:-0.1em;}

#sidebarTabs {
	margin:0px;
	padding:0px
}

#sidebarTabs .tabContents {
	color:[[ColorPalette::smmLight1]];
	background:#999;
}

#contentWrapper .tiddler .button {
margin:0.4em;
padding:0.4em 0.8em;
}

#sideBarOptions .searchButton{
	display:none;
}

#sidebar .sliderPanel {
	margin-left:5px;
	border:0px;
	padding:0em;
	border-right:1px solid #eee;
	margin-bottom:0.8em;
}

#sidebarOptions .searchButton {
	display:none;
}

.title {
	color:#C0C0C0;
}

.subtitle, .subtitle a {
	color: #999;
	font-size: 1em;margin:0.2em;
	font-variant: small-caps;
}

* html .viewer pre {
	margin-left: 0em;
}

* html .editor textarea, * html .editor input {
	width: 98%;
}

a,#sidebarOptions .sliderPanel a, #topMenu a, #topMenu .button {
	color:purple;
	background-color:transparent;
}

#sidebarOptions .sliderPanel a:hover, #topMenu a, #topMenu .button:hover {
	color:black;
	background-color:transparent;
	border:0px;
}

#sidebarOptions .sliderPanel a.tabSelected {
border:1px solid #ddd;
border-bottom:1px solid white;
}
 
#topMenu a, #topMenu .button {
	padding: 5px 15px;
	margin:9px;
	border:1px solid #999;
	font-weight:bold;
	line-height:40px;
	top:1em;
	color:[[ColorPalette::smmLight1]];
	background-color:#eee;
}

#topMenu br {
	display:none;
}

#topMenu a:hover, #topMenu .button:hover {
	background-color:#eee;
}

.tagging, .tagged {
	border: 0px dotted [[ColorPalette::smmLight1]];
}

.highlight, .marked {
	background:transparent;
	color:#999;
	border:none;
	text-decoration:underline;
}

.tagging .button:hover, .tagged .button:hover, .tagging .button:active, .tagged .button:active {
	border: none;
	background:transparent;
	text-decoration:underline;
	color:#eee;
}

.viewer th, thead td {
	background: #eee;
	border:none;
	color: #fff;
}

.viewer table {
	border:1px solid #eee;
}

table.twtable {
	border-collapse:seperate;
}

.viewer pre {
	background-color:white;
	border: 1px dotted #999;
}

hr {
	border: dotted 1px #ccc;
}

#sidebarOptions .sliderPanel .tabUnselected {
	background:#eee none repeat scroll 0%;
	border:0px solid #999;
	color:#999;
	padding:2px;
}

#sidebarOptions .sliderPanel .tabSelected {
	background:white none repeat scroll 0%;
	padding:2px;
	border:1px solid #999;
	border-bottom:1px solid black;
	color:#999;
	border-bottom:2px solid white;
}

.tabContents {
	background:#f7f7f7;
	border:0px;
}

.viewer code {
	background:##eee none repeat scroll 0%;
	color:#999;
}

h1,h2,h3,h4,h5 {
	color: #555; 
	border-color:#333; 
	background: transparent; 
	padding-bottom:2px; 
	font-family: Arial, Helvetica, sans-serif;
}

h1 {
	font-size:18px;
}

h2 {
	font-size:16px;
	border-bottom:1px solid #FFF;
}

h3 {
	font-size: 14px;
	border-bottom:1px solid #FFF;
}

.annotation {
	background-color:purple;
	border:1px solid white;
	color:white;
}

#contentFooter {
	background:#999;
	clear: both;
	padding: 0.5em 1em;
}

.button, .wizard .button:hover {
	border:0px;
}

.sliderPanel input  {
	border:1px solid #777;
	background-color:white;
	color:#777;	
}

#contentWrapper .tiddler .button:hover {
	border:1px solid;
}

table, .viewer td, .viewer tr, .twtable td, .twtable tr {
	border:0px solid #666666;
}

body .wizardFooter {
	padding :10px;
	margin:0px;
	padding-top:0px;
	background:white;
	font-weight:bold;
}

.wizardStep {
	padding:0px;
	border:none;
	background-color:none;
} 
	
.wizard  th{
	background:white;
	color:#888;
	padding:3px;
	margin:40px;
};

.wizard, listView twtable {
	border:0px; 
};

.wizard {
	color:#292929;
}

.viewer .wizard, body .wizard{
	background:white;
	margin:2em;
	border:1px solid #CCCCCC;
	color:#999;
}

.wizard h1 {
	color:#999;
	padding-top:10px;
	padding-bottom:10px;
}

.wizard h2 {
	color:black;
}

body .wizardStep {
	color:#999;
	border:0px;
	margin:0m;
	background:white;	
}

body select {
	border:0px;
	padding:3px;
	margin:4px;
}

#backstageArea a:hover {
	background-color:white;
}

#backstagePanel {
	background:none;
	width:60%;
	position:fixed
	padding:0px;
	margin:0px;
	margin-top:-36px;
}

#backstageToolbar a.backstageSelTab {
	background-color:white;
	border:1px solid white;
}

#sidebar .sliderPanel {
	background-color:#eee;
	font-size:1em;
}

.viewer .wizardStep table {
	border:0px;
}

.viewer th, .viewer td, .viewer tr, .viewer caption, .twtable th, .twtable td, .twtable tr, .twtable caption {
	border:0px;
	padding:0px;
	margin:0px;
}

.viewer .sortable td {
	padding:12px;
	margin:21px;
}

.title {
	color:#777;
	padding:0px;
}

.viewer table, table.twtable {
	border-collapse:seperated;
	border:0px;
}

.viewer th, .viewer thead td, .twtable th, .twtable thead td {
	border:0px;
	background-color:white;
	color:black;
}

.twtable th{
	background-color:#eee;
	padding:15px;
	margin:15px;
}

table.sortable td.sortedCol {
	background-color:white;
}
/*}}}*/

[[StyleSheet]]
[[E. Kugelberg, E.C. Kofoid, D.I. Andersson, Y. Lu, J. Mellor, F.P. Roth & J.R. Roth, "The tandem inversion-duplications in Salmonella enterica (TID): Selection drives unstable precursors to complete mutation types", Genetics 185 65-80 (2010)|http://rothlab.ucdavis.edu/publications/Kugelberg_2010.pdf]]

[[W. Paulander, D.I. Andersson & Sophie Maisnier-Patin, "Amplification of the gene for isoleucyl-tRNA synthetase facilitates adaptation to the fitness cost of mupirocin resistance in Salmonella enterica" Genetics 185 305-312 (2010)|http://mollycat.ucdavis.edu/wordpress/blinks/pdfs11-2-2009/paulander_2010.pdf]]

[[J.R. Roth, "The Joys and Terrors of Fast Adaptation: New findings elucidate antibiotic resistance and natural selection", J Antimicrob Chemother 65 (2010)|http://rothlab.ucdavis.edu/publications/Joys&Terrors.pdf]]

[[J.R. Roth, "Genetic Adaptation: A New Piece for a Very Old Puzzle", Current Biology 20 R15-R17 (2010)|http://rothlab.ucdavis.edu/publications/roth_2010.pdf]]

[[A.B. Reams, E.C. Kofoid, M. Savageau & J.R. Roth, "Duplication Frequency in a Population Rapidly Approaches Steady State with or without Recombination", Genetics 184 1077-1094 2010|http://rothlab.ucdavis.edu/publications/Reams_2010.pdf]]

[[S.E. Winter, P. Thiennimitr, M.G. Winter, B.P. Butler, D.L. Huseby, R.W. Crawford, J.M. Russell, C.L. Bevins, L.G. Adams, R.M. Tsolis, J.R. Roth & A.J. Baumler, "Gut inflammation provides a respiratory electron acceptor for Salmonella", Nature 467 426-429 (2010)|http://rothlab.ucdavis.edu/publications/huseby_2010.pdf]]

[[P. Thiennimitr, S.E. Winter, M.G. Winter, M.N. Xavier, V. Tolstikov, D.L. Huseby, T. Sterzenbach, R.M. Tsolis, J.R. Roth & A.J. Baumler (2011) Intestinal inflammation allows Salmonella to use ethanolamine to compete with the microbiota. PNAS 108 17480-17485 2011|http://rothlab.ucdavis.edu/publications/huseby_2011.pdf]]

[[S. Quinones-Soto & J.R. Roth (2011) Effect of growth under selection on appearance of chromosomal mutations in Salmonella enterica. Genetics 189:37-53.|http://rothlab.ucdavis.edu/publications/quinones_2011.pdf]]

[[D.I. Andersson, D. Hughes & John R. Roth (2011) The Origin of Mutants under Selection: Interactions of Mutation, Growth, and Selection, Chapter 5.6.6, EcoSal -- Escherichia coli and Salmonella: Cellular and Molecular Biology 10.1128, Section Ed. Steven Finkel, http://www.ecosal.org/, ASM Press, Washington, DC.|http://rothlab.ucdavis.edu/publications/OriginMutantASM.pdf]]

[[Quinones-Soto,S., Reams, A.B. and Roth, J.R. (2012) Pathways of genetic adaptation: Multistep origin of mutants under selection without induced mutagenesis in Salmonella enterica. Genetics 192:987-999. | http://rothlab.ucdavis.edu/publications/SemarhyTwo.pdf]]

[[Reams, A.B., Kofoid E., Kugelberg E., Roth J.R. (2012) Multiple pathways of duplication formation with and without recombination (RecA) in Salmonella enterica. Genetics 192:397-415. |http://rothlab.ucdavis.edu/publications/DrewTwo.pdf]]

[[Reams, A.B., Kofoid E., Kugelberg E., Roth J.R. (2012) Multiple pathways of duplication formation with and without recombination (RecA) in Salmonella enterica. Genetics 192:397-415. |http://rothlab.ucdavis.edu/publications/DrewTwo.pdf]]

[[Sano, E., S. Maisnier-Patin, J. P. Aboubechara, S. Quinones-Soto, John R. Roth (2014) Selected Lac+ revertants in the Cairns system are initiated by pre-existing cells with multiple copies of the F’lac plasmid, Genetics (in press). |http://rothlab.ucdavis.edu/publications/SanoRothMs.pdf]]

[[Reams, A. B. and J. R. Roth (2014) "Mechanisms of Gene Duplication and Amplification" In: Recombination Mechanisms (in press) Editors: Stephen Kowalczykowski, Neil Hunter and Wolf Heyer Cold Spring Harbor Laboratory Press, Cold Spring Harbor, NY. |http://rothlab.ucdavis.edu/publications/CSH-WolfLast.pdf]]

[[Maisnier-Patin, S. and John R. Roth (2014) The origin of mutants under selection: How natural selection mimics mutagenesis (adaptive mutation) In: Microbial Evolution (in press). ISBN13: 9781621820376, Editor: Howard Ochman. Cold Spring Harbor Laboratory Press, Cold Spring Harbor, NY. |http://rothlab.ucdavis.edu/publications/OchmanCSHRevLatest.pdf]]

[[Reams, A.B., Kofoid, E. Duleba, N. and J. R. Roth (2014) Recombination and annealing pathways compete for substrates in making rrn duplications in Salmonella enterica Genetics 196: 1–17. |http://rothlab.ucdavis.edu/publications/DrewThree.pdf]]
<!--{{{-->
<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>

<!--}}}-->
[[SideBarWG]]

/***
!Top Menu Styles
***/
/*{{{*/
#topMenu br {display:none; }
#topMenu { background: #000 ; color:#fff;padding: 1em 1em;}
/*}}}*/

/***
!General
***/
/*{{{*/
body {
 background: #444;
 margin: 0 auto;
}

 #contentWrapper{
 background: #fff;
 border: 0;
 margin: 0 1em;

 padding:0;
}
/*}}}*/

/***
!Header rules
***/
/*{{{*/
.titleLine{
 margin: 30px 3em 0em 0em;
margin-left:1.7em;
margin-bottom: 30px;
 padding: 0;
 text-align: left;
 color: #fff;
}

.siteTitle {
	font-family: futura;
	font-size: 3em;
 /*       font-weight: bold; */
}

.siteSubtitle {
	font-size: 1.1em;
        display: block;
        margin: .5em auto 1em;
        color: #000;
}

.gradient {margin: 0 auto;}



.header {
 background: #fff; 
 margin: 0 0em;
 padding:0 12px;

}
/*}}}*/

/***
!Display Area
***/
/*{{{*/
#bodywrapper {margin:0 12px; padding:0;background:#fff; height:1%}

#displayArea{
 margin: 0em 16em 0em 1em;
 text-align: left;
}

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

h1,h2,h3,h4,h5 { color: #000; background: transparent; padding-bottom:2px; border-bottom: 1px dotted #666; }
.title {color:black; font-size:1.8em; border-bottom:1px solid #333; padding-bottom:0.3px;}
.subtitle { font-size:90%; color:#ccc; padding-left:0.25em; margin-top:0.1em; }

.shadow .title {
	color: #aaa;
}

.tagClear{
	clear: none; 
}

* html .viewer pre {
	margin-left: 0em;
}

* html .editor textarea, * html .editor input {
	width: 98%;
}

.tiddler {margin-bottom:1em; padding-bottom:0em;}


.toolbar .button {color:#bbb; border:none;}
.toolbar .button:hover, .toolbar .highlight, .toolbar .marked, .toolbar a.button:active {background:transparent; color:#000; border:none; text-decoration:underline;}

#sidebar .highlight, #sidebar .marked {background:transparent;}

.tagging, .tagged {
	border: 1px solid #eee;
	background-color: #F7F7F7;
}

.selected .tagging, .selected .tagged {
	background-color: #eee;
	border: 1px solid #bbb;
}

 .tagging .listTitle, .tagged .listTitle {
	color: #bbb;
}

.selected .tagging .listTitle, .selected .tagged .listTitle {
	color: #222; 
}


.tagging .button:hover, .tagged .button:hover {
		border: none; background:transparent; text-decoration:underline; color:#000;
}

.tagging .button, .tagged .button {
		color:#aaa;
}

.selected .tagging .button, .selected .tagged .button {
		color:#000;
}

.viewer blockquote {
	border-left: 3px solid #000;
}

.viewer pre, .viewer code {
	border: 1px dashed #ccc;
	background: #eee;}

.viewer hr {
	border: 0;
	border-top: solid 1px #333;
 margin: 0 8em;
	color: #333;
}

.viewer {
  line-height: 125%;
  font-family: serif;
  font-size: 12pt;
}

.highlight, .marked {background:transparent; color:#111; border:none; text-decoration:underline;}

.viewer .highlight, .viewer .marked {text-decoration:none;}

#sidebarTabs .highlight, #sidebarTabs .marked {color:#000; text-decoration:none;}

.tabSelected {
 color: #000;
 background: #fff;
 border-top: solid 1px #ccc;
 border-left: solid 1px #ccc;
 border-right: solid 1px #ccc;
 border-bottom: none;
}

.viewer .tabSelected:hover{color:#000;}

.viewer .tabSelected {font-weight:bold;}

.tabUnselected {
 color: #999;
 background: #eee;
 border-top: solid 1px #ccc;
 border-left: solid 1px #ccc;
 border-right: solid 1px #ccc;
 border-bottom: solid 1px #ccc;
 padding-bottom:1px;
}

.tabContents {
 background: #fff;
  color: #000;
}
/*}}}*/
/***
!!!Tables
***/
/*{{{*/
.viewer table {
	border: 1px solid #000;
}

.viewer th, thead td {
	background: #000;
	border: 1px solid #000;
	color: #fff;
}

.viewer td, .viewer tr {
	border: 1px solid #111; padding:4px;
}
/*}}}*/


/***
!!!Editor area
***/
/*{{{*/
.editor input, .editor textarea {
	border: 1px solid #ccc;
}

.editor {padding-top:0.3em;}

.editor textarea:focus, .editor input:focus {
	border: 1px solid #333;
}
/*}}}*/

/***
!Sidebar
***/
/*{{{*/
#sidebar{
position:relative;
float:right;
margin-bottom:1em;
display:inline;
width: 16em;
}

#sidebarOptions .sliderPanel {
	background: #eee; border:1px solid #ccc;
}

/*}}}*/

/***
!Body Footer rules
***/
/*{{{*/
#contentFooter {
 text-align: center;
 clear: both;
 color:#fff;
 background: #000;
 padding: 1em 2em;
font-weight:bold;
}

/*}}}*/
/***
!Link Styles
***/
/*{{{*/
a{
	color: #0000FF;
}

a:hover{
        color: #FF6600;
        background:#fff;
}


.button {
	color: #000;
	border: 1px solid #fff;
}

.button:hover {
	color: #fff;
	background: #ff8614;
	border-color: #000;
}

.button:active {
	color: #fff;
	background: #ff8614;
	border: 1px solid #000;
}

.tiddlyLink {border-bottom: 1px dotted #000;}
.tiddlyLink:hover {border-bottom: 1px dotted #FF6600;} 

.titleLine a {border-bottom: 1px dotted #FF9900;}

.titleLine a:hover {border-bottom: 1px dotted #fff;}

.siteTitle a, .siteSubtitle a{
 color: #fff;
}

.viewer .button {border: 1px solid #ff8614; font-weight:bold;}
.viewer .button:hover, .viewer .marked, .viewer .highlight{background:#ff8614; color:#fff; font-weight:bold; border: 1px solid #000;}

#topMenu .button, #topMenu .tiddlyLink {
 margin-left:0.5em; margin-right:0.5em;
 padding-left:3px; padding-right:3px;
 color:white; font-weight:bold;
}
#topMenu .button:hover, #topMenu .tiddlyLink:hover { background:#000; color:#FF8814}

#topMenu a{border:none;}
/*}}}*/

/***
!Message Area /%=================================================%/
***/
/*{{{*/
#messageArea {
	border: 4px dotted #ff8614;
	background: #000;
	color: #fff;
        font-size:90%;
}

#messageArea .button {
	padding: 0.2em;
	color: #000;
	background: #fff;
        text-decoration:none;
        font-weight:bold;
        border:1px solid #000; 
}

#messageArea a {color:#fff;}

#messageArea a:hover {color:#ff8614; background:transparent;}

#messageArea .button:hover {background: #FF8614; color:#fff; border:1px solid #fff; }

/*}}}*/

/***
!Popup /%=================================================%/
***/
/*{{{*/
.popup {
	background: #ff8814;
	border: 1px solid #333;
}

.popup hr {
	color: #333;
	background: #333;
	border-bottom: 1px;
}

.popup li.disabled {
	color: #333;
}

.popup li a, .popup li a:visited {
	color: #000;
	border: none;
        text-decoration:bold;
}

.popup li a:hover {
	background: #ff8614;
	color: #000;
	border: none;
        text-decoration:underline;
}

.searchBar {float:right; font-size:1em;}
.searchBar .button {display:block; border:none; color:#ccc; }
.searchBar .button:hover{border:none; color:#eee;}

.searchBar input{
 border: 1px inset #000; background:#EFDFD1; width:10em; margin:0;
}

.searchBar input:focus {
 border: 1px inset #000; background:#fff;
}

*html .titleLine {margin-right:1.3em;}

*html .searchBar .button {margin-left:1.7em;}

 .HideSideBarButton {float:right;} 

/*}}}*/

/***
!Blog /%=================================================%/
***/
/*{{{*/
.blog h2, .blog h3, .blog h4{
  margin:0;
  padding:0;
border-bottom:none;
}
.blog {margin-left:1.5em;
}
.blog .excerpt {
  margin:0;
margin-top:0.3em;
  padding: 0;
  margin-left:1em;
  padding-left:1em;
  font-size:90%;
  border-left:1px solid #ddd;
}
#tiddlerWhatsNew h1, #tiddlerWhatsNew h2 {border-bottom:none;}
div[tags~=&quot;RecentUpdates&quot;], div[tags~=&quot;lewcidExtension&quot;] {margin-bottom: 2em;}

#hoverMenu  .button, #hoverMenu  .tiddlyLink {border:none; font-weight:bold; background:#f37211; color:#fff; padding:0 5px; float:right; margin-bottom:4px;}
#hoverMenu .button:hover, #hoverMenu .tiddlyLink:hover {font-weight:bold; border:none; color:#f37211; background:#000; padding:0 5px; float:right; margin-bottom:4px;}

#topMenu .fontResizer {float:right;}

#topMenu .fontResizer .button{border:1px solid #000;}
#topMenu .fontResizer .button:hover {border:1px solid #f37211; color:#fff;}
#sidebarTabs .txtMainTab .tiddlyLinkExisting {
 font-weight: normal;
 font-style: normal;
}

#sidebarTabs .txtMoreTab .tiddlyLinkExisting {
 font-weight: bold;
 font-style: normal;
}

.block a{display:block;}

.tiddlyLinkExisting { 
color:blue; 
} 

.externalLink { 
text-decoration:none; 
} 
/*}}}*/

/***
!Images /%=================================================%/
***/
/*{{{*/

.stretch img { 
width:100%; 
}
/*}}}*/

 
Type the text for '"http://mollycat.ucdavis.edu/wordpress"'

<html><a href="mollycat.ucdavis.edu/wordpress/">Blog</a></html>

|''Type:''|file|
|''URL:''|http://tiddlythemes.com/empties/LewcidOrange.html|
|''Workspace:''|(default)|

This tiddler was automatically created to record the details of this server
<!--{{{-->

<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'></span></div>
<!--
<div>Key Words: <span macro="edit mything"></span></div>
-->
<!--}}}-->
<<taggedTabs loginBox>>
/***
|Name|Plugin: jsMath|
|Created by|BobMcElrath|
|Email|my first name at my last name dot org|
|Location|http://bob.mcelrath.org/tiddlyjsmath.html|
|Version|1.5.1|
|Requires|[[TiddlyWiki|http://www.tiddlywiki.com]] &ge; 2.0.3, [[jsMath|http://www.math.union.edu/~dpvc/jsMath/]] &ge; 3.0|
!Description
LaTeX is the world standard for specifying, typesetting, and communicating mathematics among scientists, engineers, and mathematicians.  For more information about LaTeX itself, visit the [[LaTeX Project|http://www.latex-project.org/]].  This plugin typesets math using [[jsMath|http://www.math.union.edu/~dpvc/jsMath/]], which is an implementation of the TeX math rules and typesetting in javascript, for your browser.  Notice the small button in the lower right corner which opens its control panel.
!Installation
In addition to this plugin, you must also [[install jsMath|http://www.math.union.edu/~dpvc/jsMath/download/jsMath.html]] on the same server as your TiddlyWiki html file.  If you're using TiddlyWiki without a web server, then the jsMath directory must be placed in the same location as the TiddlyWiki html file.

I also recommend modifying your StyleSheet use serif fonts that are slightly larger than normal, so that the math matches surrounding text, and \\small fonts are not unreadable (as in exponents and subscripts).
{{{
.viewer {
  line-height: 125%;
  font-family: serif;
  font-size: 12pt;
}
}}}

If you had used a previous version of [[Plugin: jsMath]], it is no longer necessary to edit the main tiddlywiki.html file to add the jsMath <script> tag.  [[Plugin: jsMath]] now uses ajax to load jsMath.
!History
* 11-Nov-05, version 1.0, Initial release
* 22-Jan-06, version 1.1, updated for ~TW2.0, tested with jsMath 3.1, editing tiddlywiki.html by hand is no longer necessary.
* 24-Jan-06, version 1.2, fixes for Safari, Konqueror
* 27-Jan-06, version 1.3, improved error handling, detect if ajax was already defined (used by ZiddlyWiki)
* 12-Jul-06, version 1.4, fixed problem with not finding image fonts
* 26-Feb-07, version 1.5, fixed problem with Mozilla "unterminated character class".
* 27-Feb-07, version 1.5.1, Runs compatibly with TW 2.1.0+, by Bram Chen
!Examples
|!Source|!Output|h
|{{{The variable $x$ is real.}}}|The variable $x$ is real.|
|{{{The variable \(y\) is complex.}}}|The variable \(y\) is complex.|
|{{{This \[\int_a^b x = \frac{1}{2}(b^2-a^2)\] is an easy integral.}}}|This \[\int_a^b x = \frac{1}{2}(b^2-a^2)\] is an easy integral.|
|{{{This $$\int_a^b \sin x = -(\cos b - \cos a)$$ is another easy integral.}}}|This $$\int_a^b \sin x = -(\cos b - \cos a)$$ is another easy integral.|
|{{{Block formatted equations may also use the 'equation' environment \begin{equation}  \int \tan x = -\ln \cos x \end{equation} }}}|Block formatted equations may also use the 'equation' environment \begin{equation}  \int \tan x = -\ln \cos x \end{equation}|
|{{{Equation arrays are also supported \begin{eqnarray} a &=& b \\ c &=& d \end{eqnarray} }}}|Equation arrays are also supported \begin{eqnarray} a &=& b \\ c &=& d \end{eqnarray} |
|{{{I spent \$7.38 on lunch.}}}|I spent \$7.38 on lunch.|
|{{{I had to insert a backslash (\\) into my document}}}|I had to insert a backslash (\\) into my document|
!Code
***/
//{{{

// AJAX code adapted from http://timmorgan.org/mini
// This is already loaded by ziddlywiki...
if(typeof(window["ajax"]) == "undefined") {
  ajax = {
      x: function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest()}}},
      gets: function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x.responseText}
  }
}

// Load jsMath
jsMath = {
  Setup: {inited: 1},          // don't run jsMath.Setup.Body() yet
  Autoload: {root: new String(document.location).replace(/[^\/]*$/,'jsMath/')}  // URL to jsMath directory, change if necessary
};
var jsMathstr;
try {
  jsMathstr = ajax.gets(jsMath.Autoload.root+"jsMath.js");
} catch(e) {
  alert("jsMath was not found: you must place the 'jsMath' directory in the same place as this file.  "
       +"The error was:\n"+e.name+": "+e.message);
  throw(e);  // abort eval
}
try {
  window.eval(jsMathstr);
} catch(e) {
  alert("jsMath failed to load.  The error was:\n"+e.name + ": " + e.message + " on line " + e.lineNumber);
}
jsMath.Setup.inited=0;  //  allow jsMath.Setup.Body() to run again

// Define wikifers for latex
config.formatterHelpers.mathFormatHelper = function(w) {
    var e = document.createElement(this.element);
    e.className = this.className;
    var endRegExp = new RegExp(this.terminator, "mg");
    endRegExp.lastIndex = w.matchStart+w.matchLength;
    var matched = endRegExp.exec(w.source);
    if(matched) {
        var txt = w.source.substr(w.matchStart+w.matchLength, 
            matched.index-w.matchStart-w.matchLength);
        if(this.keepdelim) {
          txt = w.source.substr(w.matchStart, matched.index+matched[0].length-w.matchStart);
        }
        e.appendChild(document.createTextNode(txt));
        w.output.appendChild(e);
        w.nextMatch = endRegExp.lastIndex;
    }
}

config.formatters.push({
  name: "displayMath1",
  match: "\\\$\\\$",
  terminator: "\\\$\\\$\\n?", // 2.0 compatability
  termRegExp: "\\\$\\\$\\n?",
  element: "div",
  className: "math",
  handler: config.formatterHelpers.mathFormatHelper
});

config.formatters.push({
  name: "inlineMath1",
  match: "\\\$", 
  terminator: "\\\$", // 2.0 compatability
  termRegExp: "\\\$",
  element: "span",
  className: "math",
  handler: config.formatterHelpers.mathFormatHelper
});

var backslashformatters = new Array(0);

backslashformatters.push({
  name: "inlineMath2",
  match: "\\\\\\\(",
  terminator: "\\\\\\\)", // 2.0 compatability
  termRegExp: "\\\\\\\)",
  element: "span",
  className: "math",
  handler: config.formatterHelpers.mathFormatHelper
});

backslashformatters.push({
  name: "displayMath2",
  match: "\\\\\\\[",
  terminator: "\\\\\\\]\\n?", // 2.0 compatability
  termRegExp: "\\\\\\\]\\n?",
  element: "div",
  className: "math",
  handler: config.formatterHelpers.mathFormatHelper
});

backslashformatters.push({
  name: "displayMath3",
  match: "\\\\begin\\{equation\\}",
  terminator: "\\\\end\\{equation\\}\\n?", // 2.0 compatability
  termRegExp: "\\\\end\\{equation\\}\\n?",
  element: "div",
  className: "math",
  handler: config.formatterHelpers.mathFormatHelper
});

// These can be nested.  e.g. \begin{equation} \begin{array}{ccc} \begin{array}{ccc} ...
backslashformatters.push({
  name: "displayMath4",
  match: "\\\\begin\\{eqnarray\\}",
  terminator: "\\\\end\\{eqnarray\\}\\n?", // 2.0 compatability
  termRegExp: "\\\\end\\{eqnarray\\}\\n?",
  element: "div",
  className: "math",
  keepdelim: true,
  handler: config.formatterHelpers.mathFormatHelper
});

// The escape must come between backslash formatters and regular ones.
// So any latex-like \commands must be added to the beginning of
// backslashformatters here.
backslashformatters.push({
    name: "escape",
    match: "\\\\.",
    handler: function(w) {
        w.output.appendChild(document.createTextNode(w.source.substr(w.matchStart+1,1)));
        w.nextMatch = w.matchStart+2;
    }
});

config.formatters=backslashformatters.concat(config.formatters);

window.wikify = function(source,output,highlightRegExp,tiddler)
{
    if(source && source != "") {
        if(version.major == 2 && version.minor > 0) {
            var wikifier = new Wikifier(source,getParser(tiddler),highlightRegExp,tiddler);
            wikifier.subWikifyUnterm(output);
        } else {
            var wikifier = new Wikifier(source,formatter,highlightRegExp,tiddler);
            wikifier.subWikify(output,null);
        }
        jsMath.ProcessBeforeShowing();
    }
}
//}}}
|~ViewToolbar|closeTiddler closeOthers +editTiddler > fields syncing permalink revisions references jump|
|~EditToolbar|+saveTiddlerHosted1 -cancelTiddler deleteTiddlerHosted|
<<tabs txtMainTab "Timeline" "Timeline" TabTimeline "All" "All tiddlers" TabAll "Tags" "All tags" TabTags "More" "More lists" TabMore>>
/***
|Name|TaggedTemplateTweak|
|Source|http://www.TiddlyTools.com/#TaggedTemplateTweak|
|Documentation|http://www.TiddlyTools.com/#TaggedTemplateTweakInfo|
|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|Story.prototype.chooseTemplateForTiddler()|
|Description|use alternative ViewTemplate/EditTemplate for tiddler's tagged with specific tag values|
This tweak extends story.chooseTemplateForTiddler() so that ''whenever a tiddler is marked with a specific tag value, it can be viewed and/or edited using alternatives to the standard tiddler templates.'' 
!!!!!Documentation
>see [[TaggedTemplateTweakInfo]]
!!!!!Revisions
<<<
2008.08.29 [1.4.1] corrected handling for tiddlers with no matching tagged template when non-default theme is in effect (e.g., use "MyTheme##ViewTemplate").
| please see [[TaggedTemplateTweakInfo]] for previous revision details |
2007.06.11 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
	
version.extensions.TaggedTemplateTweak= {major: 1, minor: 4, revision: 1, date: new Date(2008,8,29)};

Story.prototype.taggedTemplate_chooseTemplateForTiddler = Story.prototype.chooseTemplateForTiddler
Story.prototype.chooseTemplateForTiddler = function(title,template)
{
	// get default template from core
	var coreTemplate=this.taggedTemplate_chooseTemplateForTiddler.apply(this,arguments);

	// if the tiddler doesn't exist yet or is untagged, return core result
	var tiddler=store.getTiddler(title);
	if (!tiddler || !tiddler.tags.length)
		return coreTemplate;

	// split core template into theme prefix and template name
	var theme="";
	var template=coreTemplate;
	var parts=template.split(config.textPrimitives.sectionSeparator);
	if (parts[1]) { theme=parts[0]; template=parts[1]; }
	else theme=config.options.txtTheme||""; // fallback if theme is not specified
	theme+=config.textPrimitives.sectionSeparator;

	// look for template whose prefix matches a tag on this tiddler (if any)
	for (i=0; i<tiddler.tags.length; i++) {
		var t=tiddler.tags[i]+template; // add tag prefix to template
		var c=t.substr(0,1).toUpperCase()+t.substr(1); // capitalized for WikiWord title
		if (store.getTiddlerText(theme+t))	{ return theme+t; } // theme##tagTemplate
		if (store.getTiddlerText(theme+c))	{ return theme+c; } // theme##TagTemplate
		if (store.getTiddlerText(t)) 		{ return t; }	     // tagTemplate
		if (store.getTiddlerText(c))		{ return c; }	     // TagTemplate
	}
	return coreTemplate; // no matching tag, return core result
}

<<ccAdmin>>
/***
|Name|MiniBrowserPlugin|
|Source|http://www.TiddlyTools.com/#MiniBrowserPlugin|
|Documentation|http://www.TiddlyTools.com/#MiniBrowserPluginInfo|
|Version|1.5.2|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.2|
|Type|plugin|
|Requires|PlayerPlugin (optional, recommended)|
|Description|embedded browser-in-browser with favorites lists and media support|
!!!!!Usage
<<<
{{{<<miniBrowser noplayer noedit expand hidecontrols URL TiddlerName TiddlerName TiddlerName...>>}}}
* ''noplayer'' (optional)<br>disables support for embedded media player (using [[PlayerPlugin]], if installed)
* ''noedit'' (optional)<br>hides bookmark //add//, //del//, and //edit// buttons
* ''expand'' (optional)<br>displays minibrowser controls on two lines instead of one for increased readability, especially when long titles or URLs are displayed.
* ''hidecontrols'' (optional)<br>hide initial display of minibrowser controls (except for 'show controls' checkbox)<br>//note: if no initial URL is specified, controls will be shown anyway//
* ''URL'' (optional)<br>specifies an initial URL to open when the mini browser is rendered
* ''TiddlerName'', ''TiddlerName''... (optional)<br>indicates one or more tiddlers containing 'HR-separated' lists of favorites.<br>//notes: if no tiddler is specified, [[MiniBrowserList]] is used by default.  In addition, when adding/deleting favorites, the plugin automatically updates [[MiniBrowserList]], regardless of any alternative lists of favorites stored in separate tiddlers.  After changes to [[MiniBrowserList]] are made, you can then use cut/paste to manually move entries from that tiddler into other tiddlers.//
<<<
!!!!!Configuration
>Default mini browser size:
>width: <<option txtMiniBrowserWidth>> height: <<option txtMiniBrowserHeight>>
!!!!!Examples
>{{{<<miniBrowser>>}}}<br>{{smallform small{<<miniBrowser>>}}}
>{{{<<miniBrowser noedit>>}}}<br>{{smallform small{<<miniBrowser noedit>>}}}
>{{{<<miniBrowser expand>>}}}<br>{{smallform small{<<miniBrowser expand>>}}}
>{{{<<miniBrowser noedit expand>>}}}<br>{{smallform small{<<miniBrowser noedit expand>>}}}
>{{{<<miniBrowser hidecontrols http://www.TiddlyWiki.com>>}}}<br>{{smallform small{<<miniBrowser hidecontrols http://www.TiddlyWiki.com>>}}}
!!!!!Revisions
<<<
2009.08.29 1.5.2 in load(), fixed 'noplayer' IFRAME output
2009.07.03 1.5.1 added onclick handling to 'n of m' button.  also, if noedit mode, add line numbers to bookmarks droplist items
2009.06.08 1.5.0 added optional 'noedit' mode to hide bookmark add/del/edit buttons.  Also, moved html def'n to section (saves space)
2008.09.30 1.4.0 removed hard-coded fontsize.  Added 'expand' option (wider controls, displayed on two lines)
2008.09.16 1.3.1 fixed getWikifiedData() when using IE (remove \r and multiple \n)
2008.08.12 1.3.0 added support for wikifying content from favorites lists to enable use of forEachTiddler or inline script output to generate lists on the fly.
2008.08.06 1.2.2 corrected size control buttons to use fixed width
2008.04.07 1.2.1 added txtMiniBrowserWidth and txtMiniBrowserHeight.  cleanup init handling (somewhat)
2008.04.06 1.2.0 added support for specifying initial URL to view (suggested by Richard Berg).  When opening a URL, select matching entry (if any) in bookmarks droplist.  Added support for hiding minibrowser controls.
2008.01.19 1.1.0 added support for optional extra favorites lists stored in separate tiddlers
2007.10.15 1.0.0 combined MiniBrowser and MediaCenter inline scripts and converted to true plugin
2006.03.01 0.0.0 inline script
<<<
/***
|Name|MiniBrowserPlugin|
|Source|http://www.TiddlyTools.com/#MiniBrowserPlugin|
|Documentation|http://www.TiddlyTools.com/#MiniBrowserPluginInfo|
|Version|1.5.2|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.2|
|Type|plugin|
|Requires|PlayerPlugin (optional, recommended)|
|Description|embedded browser-in-browser with favorites lists and media support|
!!!!!Documentation
>see [[MiniBrowserPluginInfo]]
!!!!!Configuration
>Default mini browser size:
>width: <<option txtMiniBrowserWidth>> height: <<option txtMiniBrowserHeight>>
!!!!!Revisions
<<<
2009.08.29 [1.5.2] in load(), fixed 'noplayer' IFRAME output
2009.07.03 [1.5.1] added onclick handling to 'n of m' button.  also, if noedit mode, add line numbers to bookmarks droplist items
2009.06.08 [1.5.0] added optional 'noedit' mode: replaces add/del/edit buttons with next/previous navigation.
|see [[MiniBrowserPluginInfo]] for additional revision details|
2007.10.15 [1.0.0] combined MiniBrowser and MediaCenter inline scripts and converted to true plugin
2006.03.01 [0.0.0] inline script
<<<
!!!!!Code
***/
//{{{
version.extensions.MiniBrowserPlugin={major: 1, minor: 5, revision: 2, date: new Date(2009,8,29)};

config.shadowTiddlers.MiniBrowser='<<miniBrowser>>';
config.options.txtMiniBrowserWidth=config.options.txtMiniBrowserWidth||'100%';
config.options.txtMiniBrowserHeight=config.options.txtMiniBrowserHeight||'480';
config.macros.miniBrowser= {
	favoritesList: 'MiniBrowserList',
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		var noPlayer=params[0]&&params[0].toLowerCase()=='noplayer'; if (noPlayer) params.shift();
		var noEdit  =params[0]&&params[0].toLowerCase()=='noedit';   if (noEdit)   params.shift();
		var expand  =params[0]&&params[0].toLowerCase()=='expand';   if (expand)   params.shift();
		var hideControls=params[0]&&params[0].toLowerCase()=='hidecontrols'; if (hideControls) params.shift();
		var url=(params[0]&&!store.tiddlerExists(params[0]))?params.shift():'';
		hideControls=hideControls&&url.length; // no initial URL, show controls anyway
		if (!config.macros.player) noPlayer=true; // PlayerPlugin not installed
		var w=config.options.txtMiniBrowserWidth;
		var h=config.options.txtMiniBrowserHeight;

		// create form
		var guid=new Date().getTime()+Math.random().toString(); // globally unique ID
		var html=store.getTiddlerText('MiniBrowserPlugin##html');
		html=html.replace(/%id%/g,guid)
			.replace(/%noplayer%/g,noPlayer?'true':'')
			.replace(/%noedit%/g,noEdit||readOnly?'none':'inline')
			.replace(/%shownav%/g,noEdit||readOnly?'inline':'none')
			.replace(/%hidecontrols%/g,hideControls?'none':'block')
			.replace(/%bookmarksize%/g,(expand?70:20)+'%')
			.replace(/%urlsize%/g,(expand?69.5:20)+'%')
			.replace(/%linebreak%/g,expand?'<br>':'')
			.replace(/%favorites%/g,params[0]||config.macros.miniBrowser.favoritesList);
		createTiddlyElement(place,'span').innerHTML=html;

		// init form
		function $(i){return document.getElementById(i)}; // abbrev
		$('minibrowser_controls_'+guid).style.display=hideControls?'none':'block';
		$('minibrowser_resize_'+guid).style.display=hideControls?'none':'block';
		$('minibrowser_togglecontrols_'+guid).checked=!hideControls;
		$('minibrowser_form_'+guid).url.value=url;
		$('minibrowser_form_'+guid).w.value=w;
		$('minibrowser_form_'+guid).h.value=h;
		if (noPlayer) { // hide type list no PlayerPlugin
			$('minibrowser_type_'+guid).style.display='none';
			$('minibrowser_url_'+guid).style.width=(expand?81.5:32)+'%';
		}

		// load bookmarks droplist from HR-separated tiddler contents
		var b=$('minibrowser_bookmarks_'+guid);
		while (b.options[1]) b.options[1]=null; // clear list but leave 'prompt' item
		var p; while (p=params.shift()) this.getFavorites(b,p,noEdit); // load custom bookmarks
		if (b.length<2) this.getFavorites(b,config.macros.miniBrowser.favoritesList,noEdit); // default list
		$('minibrowser_nav_'+guid).value='1 out of '+b.length;

		// load initial URL (if any)
		var place=$('minibrowser_player_'+guid);
		this.load(place,guid,'','',w,h,true,noPlayer);
		this.go($('minibrowser_form_'+guid));
	},
	getFavorites: function(list,tid,noEdit) {
		var txt=store.getTiddlerText(tid); if (!txt||!txt.trim().length) return;
		txt=this.getWikifiedData(txt);
		var parts=txt.split('\n----\n');
		for (var p=0; p<parts.length; p++) {
			var lines=parts[p].split('\n');
			var label=lines.shift()||''; // 1st line=display text
			var value=lines.shift()||''; // 2nd line=item value
			var indent=value&&value.length?'\xa0\xa0':'';
			var prefix=value.length&&noEdit?list.length+1+': ':'';
			list.options[list.length]=new Option(prefix+indent+label,value,false,false);
		}
	},
	getWikifiedData: // wikify content, then extract text WITH newlines and HRs included
	function(txt) {
		var e=createTiddlyElement(document.body,'div'); wikify(txt,e);
		var breaks=e.getElementsByTagName('br');
		for (var b=0; b<breaks.length; b++)
			breaks[b].parentNode.insertBefore(document.createTextNode('\n'),breaks[b]);
		var lines=e.getElementsByTagName('hr');
		for (var l=0; l<lines.length; l++)
			lines[l].parentNode.insertBefore(document.createTextNode('----\n'),lines[l]);
		var items=e.getElementsByTagName('li');
		for (var i=0; i<items.length; i++)
			items[i].parentNode.insertBefore(document.createTextNode('\n'),items[i]);
		var txt=getPlainText(e);
		removeNode(e);
		return txt.replace(/\r*/g,'').replace(/\n\n/g,'\n');
	},
	load: function(place,id,type,url,w,h,showcontrols,noPlayer) {
		if (!noPlayer)
			config.macros.player.loadURL(place,id,type,url,w,h,showcontrols);
		else { // force IFRAME-only display
			if (!place) place=document.getElementById(id).parentNode;
			var fmt="<iframe name='%0' id='%0' src='%1' width='%2' height='%3' \
				style='background:#fff;border:1px solid'></iframe>";
			place.innerHTML=fmt.format([id,url,w,h]);
		}
	},
	go: function(f) {
		var url=f.url.value.trim();
		if (!url.length) url=f.url.value=f.bookmarks.value.trim();
		if (!url.length) { this.done(f); return false; }
		var id=f.playerID.value;
		document.getElementById('minibrowser_player_'+id).style.display='block';
		document.getElementById('minibrowser_controls2_'+id).style.display='block';
		this.load(null,id,f.type.value,f.url.value,f.w.value,f.h.value,f.ctrls.checked,f.noPlayer.value=='true');
		var matched=false; for (var i=0; i<f.bookmarks.options.length; i++) // select matching bookmark
			if (f.bookmarks.options[i].value==url) { f.bookmarks.selectedIndex=i; matched=true; break; }
		if (!matched) f.bookmarks.selectedIndex=0;
		f.done.disabled=false;
		return false;
	},
	done: function(f) {
		var id=f.playerID.value;
		this.load(null,id,null,null,f.w.value,0,f.ctrls.checked,f.noPlayer.value=='true');
		document.getElementById('minibrowser_player_'+id).style.display='none';
		document.getElementById('minibrowser_controls2_'+id).style.display='none';
		f.done.disabled=true; 
		return false;
	},
	fit: function(place) {
		// fudge factor to account for the other controls + padding + borders.  ADJUST THIS VALUE TO FIT LAYOUT
		var trim=89;
		var t=story.findContainingTiddler(place);
		if (!t) { t=place; while (t && t.className!='floatingPanel') t=t.parentNode; } if (!t) return;
		var w='100%'; // horizontal stretching via CSS works, but vertical stretching doesn't... so:
		var h=t.offsetHeight-trim; // workaround: get containing panel/tiddler height and subtract trim height
		var f=place.form;
		this.load(null,f.playerID.value,f.type.value,f.url.value,w,h,f.ctrls.checked,f.noPlayer.value=='true');
		place.form.w.value=w; place.form.h.value=h; // update width/height input fields
	},
	add: function(place,title) {
		var v=place.value; if (!v.length) return;
		var d=prompt('Please enter a description for\n'+place.value); if (!d || !d.length) return;
		var who=config.options.txtUserName;
		var when=new Date();
		var tid=store.getTiddler(title);
		var txt='%0\n%1\n----\n%2'.format([d,v,tid?tid.text:'']);
		store.saveTiddler(title,title,txt,who,when,tid?tid.tags:[],tid?tid.fields:{});
		if (!tid) story.displayTiddler(story.findContainingTiddler(place),title);
		else story.refreshTiddler(title,1,true);
		var here=story.findContainingTiddler(place);
		if (here) story.refreshTiddler(here.getAttribute('tiddler'),1,true);
	},
	del: function(place,title) {
		var v=place.value; if (!v.length) return;
		var d=place.options[place.selectedIndex].text; if (!d.length) return;
		if (!confirm('Are you sure you want to remove this favorite?\n\n'+d+'\n'+v)) return;
		var tid=store.getTiddler(title); if (!tid) return;
		var who=config.options.txtUserName;
		var when=new Date();
		var pat='%0\n%1\n----\n'.format([d.replace(/\xa0/g,''),v]); var re=new RegExp(pat,'i');
		var txt=tid.text.replace(re,'');
		store.saveTiddler(title,title,txt,who,when,tid?tid.tags:[],tid?tid.fields:{});
		story.refreshTiddler(title,1,true);
		var here=story.findContainingTiddler(place);
		if (here) story.refreshTiddler(here.getAttribute('tiddler'),1,true);
	}
}
//}}}
/***
//{{{
!html
<form id='minibrowser_form_%id%' style='display:block;margin:0;padding:0' onsubmit='return config.macros.miniBrowser.go(this);'><!--
--><nobr><input type='hidden' name='playerID' value='%id%'><input type='hidden' name='noPlayer' value='%noplayer%'><!--
--><div id='minibrowser_controls_%id%' style='display:%hidecontrols%'><!--
--><input type='button' value='<' title='back' style='width:3%'
	onclick='try{window.frames["player_%id%"].history.go(-1)}catch(e){window.history.go(-1)}' ><!--
--><input type='button' value='>' title='forward' style='width:3%'
	onclick='try{window.frames["player_%id%"].history.go(+1)}catch(e){window.history.go(+1)}'><!--
--><input type='button' value='+' title='refresh'style='width:3%'
	onclick='try{window.frames["player_%id%"].location.reload()}catch(e){;}'><!--
--><input type='button' value='x' title='stop'style='width:3%'
	onclick='window.stop()'><!--
--><select name='bookmarks' id='minibrowser_bookmarks_%id%' size='1' style='width:%bookmarksize%'
	onchange='this.form.url.value=this.value;
		this.form.nav.value="%0 out of %1".format([this.selectedIndex+1,this.length]);
		this.form.nav.title="reload %0".format([this.options[this.selectedIndex].text]);
		return config.macros.miniBrowser.go(this.form);'><!--
--><option value=''>bookmarks...</option><!--
--></select><!--
--><span style='display:%noedit%'><!--
--><input type='button' value='add' title='add URL to the bookmarks' style='width:6%'
	favorites="%favorites%"
	onclick='config.macros.miniBrowser.add(this.form.url,this.getAttribute("favorites"));'><!--
--><input type='button' value='del' title='remove URL from the bookmarks' style='width:6%'
	favorites="%favorites%"
	onclick='config.macros.miniBrowser.del(this.form.bookmarks,this.getAttribute("favorites"));'><!--
--><input type='button' value='edit' title='edit the bookmarks list' style='width:6%'
	favorites="%favorites%"
	onclick='story.displayTiddler(null,this.getAttribute("favorites"),2)'><!--
--></span><!--
--><span style='display:%shownav%'><!--
--><input name=prev type='button' value='&#x25C4;' title='view previous bookmark' style='width:3%'
	onclick='var b=document.getElementById("minibrowser_bookmarks_%id%");
		b.selectedIndex=Math.max(b.selectedIndex-1,0); b.onchange();'><!--
--><input name='nav' id='minibrowser_nav_%id%'
	type='button' value='N out of MM' title='enter a bookmark number' style='width:12%'
	onclick='return this.form.next.click();
		var b=this.form.bookmarks;
		var i=prompt("Enter a bookmark number (1-"+b.length+")",b.selectedIndex+1);
		if (i && i<b.length) { b.selectedIndex=i-1; b.onchange(); }'><!--
--><input name=next type='button' value='&#x25BA;' title='view next bookmark' style='width:3%'
	onclick='var b=document.getElementById("minibrowser_bookmarks_%id%");
		b.selectedIndex=Math.min(b.selectedIndex+1,b.length); b.onchange();'><!--
--></span><!--
-->%linebreak%<!--
--><select name='type' id='minibrowser_type_%id%' size='1' style='width:12%'
	onchange='var opt=this.options; for (var i=0; i<opt.length; i++)
		if (i==this.selectedIndex) opt[i].text=opt[i].text.replace(/\xa0\xa0/,"&radic;");
		else opt[i].text=opt[i].text.replace(/&radic;/,"\xa0\xa0");
		if (this.selectedIndex==0) opt[1].text=opt[1].text.replace(/\xa0\xa0/,"&radic;");'><!--
--><option value=''>type...</option><!--
--><option value=''>&radic; auto-detect</option><!--
--><option value='iframe'>&nbsp;&nbsp; web page</option><!--
--><option value='windows'>&nbsp;&nbsp; windows media</option><!--
--><option value='realone'>&nbsp;&nbsp; real one</option><!--
--><option value='quicktime'>&nbsp;&nbsp; quicktime</option><!--
--><option value='flash'>&nbsp;&nbsp; flash</option><!--
--><option value='image'>&nbsp;&nbsp; jpg/gif/png</option><!--
--></select><!--
--><input type='text' name='url' id='minibrowser_url_%id%' size='60' value='' style='width:%urlsize%'
	onfocus='this.select()'><!--
--><input type='submit' value='go' title='view URL' style='width:6%'><!--
--><input type='button' value='open' title='open a separate tab/window' style='width:6%'
	onclick='if (this.form.url.value.length) window.open(this.form.url.value)'><!--
--><input type='button' value='done' name='done' disabled title='disconnect from URL' style='width:6%'
	onclick='return config.macros.miniBrowser.done(this.form);'><!--
--></div><!--
--><div id='minibrowser_player_%id%' style='display:none;text-align:center'></div><!--
--><span id='minibrowser_controls2_%id%' style='margin-top:2px;display:none;'><!--
--><div id='minibrowser_resize_%id%' style='display:%hidecontrols%;float:right'><!--
--> size: <input type='text' name='w' size='3' value='' style=''
	onfocus='this.select()'><!--
-->x<input type='text' name='h' size='3' value='' style=''
	onfocus='this.select()'><!--
--> <input type='submit' value='set' style='width:5em'
	onclick='var f=this.form;
		if(!f.w.value.trim().length) f.w.value=config.options.txtMiniBrowserWidth;
		if(!f.h.value.trim().length) f.h.value=config.options.txtMiniBrowserHeight;
		config.options.txtMiniBrowserWidth=f.w.value; config.options.txtMiniBrowserHeight=f.h.value;
		saveOptionCookie("txtMiniBrowserWidth"); saveOptionCookie("txtMiniBrowserHeight");'><!--
--><input type='submit' value='reset' style='width:5em'
	onclick='var f=this.form; f.ctrls.checked=true; f.w.value="100%"; f.h.value="480";
		config.options.txtMiniBrowserWidth=f.w.value; config.options.txtMiniBrowserHeight=f.h.value;
		saveOptionCookie("txtMiniBrowserWidth"); saveOptionCookie("txtMiniBrowserHeight");'><!--
--><input type='button' value='fit' title='resize player to fit containing window' style='width:5em'
	onclick='config.macros.miniBrowser.fit(this)'><!--
--></div><!--
--> <input type='checkbox' name='ctrls' id='minibrowser_togglecontrols_%id%' title='toggle minibrowser controls' CHECKED 
	onclick='document.getElementById("minibrowser_controls_%id%").style.display=this.checked?"block":"none";
		document.getElementById("minibrowser_resize_%id%").style.display=this.checked?"block":"none";'
><a href='' title='toggle minibrowser controls'
	onclick='this.previousSibling.click();return false;'>show controls</a><!--
--></span><!--
--></nobr></form>
!end
//}}}
***/
 
Formatting entries in this encyclopedia is quite easy. First, to edit you must sign in ("login", in sidebar).  To start a new post, click "new tiddler", give it a name, and enter your content where it says "Type the text...". Be sure to add a tag or two to make searching easier. Finally, use these instructions to format your article.

!Text
<nowiki>''Boldface''</nowiki> 
 @@color(red):becomes@@ ''Boldface'' (note: the surrounding quotes are two single-quotes, not double-quotes)
<nowiki>--Strikethrough--</nowiki> 
 @@color(red): becomes@@ --Strikethrough--
<nowiki>__Underline__</nowiki> 
 @@color(red): becomes@@ __Underline__
<nowiki>//Italic//</nowiki> 
 @@color(red): becomes@@ //Italic//
<nowiki>{{{Monospaced}}}</nowiki> 
 @@color(red): becomes@@ {{{Monospaced}}}
<nowiki>Superscript: 2^^3^^</nowiki> 
 @@color(red): becomes@@ 2^^3^^
<nowiki>Subscript: a~~ij~~=a~~ji~~</nowiki> 
 @@color(red): becomes@@ a~~ij~~=a~~ji~~
<nowiki>@@Highlight@@</nowiki> 
 @@color(red): becomes@@ @@Highlight@@
<nowiki> @@color(green): Green@@</nowiki> 
 @@color(red): becomes@@ @@color(green): Green@@ (and so forth for other colors)
Horizontal separator:
 Text A
<nowiki>----</nowiki>
Text B  
 @@color(red): becomes@@ 
Text A
----
Text B (note: the separator must be on its own line)

!Headers
<nowiki>!Header 1</nowiki>
<nowiki>!!Header 2</nowiki>
<nowiki>!!!Header 3</nowiki>

@@color(red): becomes@@
!Header 1
!!Header 2
!!!Header 3

!Links
<nowiki>AtLeastTwoCapitalsInOneWord</nowiki> @@color(red): becomes @@  AtLeastTwoCapitalsInOneWord This will try to take you to an entry of the same name. Words with more than one uppercase letter are called "~WikiWords", and are used to jump around in the wiki.
<nowiki>[[AtLeastTwoCapitalsInOneWord]]</nowiki> @@color(red): becomes@@  [[AtLeastTwoCapitalsInOneWord]] ...where do you think this will take you? The double braces don't change anything. However, see the next trick...
<nowiki>[[RothLab|http://rothlab.ucdavis.edu]]</nowiki> @@color(red): becomes@@ [[RothLab|http://rothlab.ucdavis.edu]]
<nowiki>[[Try me|AtLeastTwoCapitalsInOneWord]]</nowiki> @@color(red): becomes@@ [[Try me|AtLeastTwoCapitalsInOneWord]] ...well, try it! This is called an //internal link//
<nowiki>[img[Pretty Wiki Flower|cctiddly/pics/wiki.png]]</nowiki> @@color(red): becomes@@ 
[img[Pretty Wiki Flower|cctiddly/pics/wiki.png]] 
Our wiki directory is called "cctiddly", and the picture has been stored in it. This is called an //Image link//
<nowiki>[[RothLab|http://rothlab.ucdavis.edu]]</nowiki> @@color(red): becomes@@ [[RothLab|http://rothlab.ucdavis.edu]] ...remember this? It's called an //External link//
<nowiki>[[Walker comments|cctiddly/pics/DispatchWalkerNew.pdf]]</nowiki> @@color(red): becomes@@ [[Walker comments|cctiddly/pics/DispatchWalkerNew.pdf]] This is called a //File link//. Click on it to see what it does.

!Block Quotes
<nowiki><<<</nowiki>
Introduction to "Block Quotes" 
<nowiki><<<</nowiki>
<nowiki>></nowiki>First level
<nowiki>></nowiki>...still first level 
<nowiki>></nowiki>(Note: each line belonging to a level needs the appropriate level symbol).
<nowiki>>></nowiki>Level two 
<nowiki>>>></nowiki>Level three
<nowiki>>>>></nowiki>I have never tried level 4...
<nowiki>>>>>></nowiki>...and definitely never level 5!
@@color(red): becomes@@
<<<
Introduction to "Block Quotes" 
<<<
>First level
>...still first level
>(Note: each line belonging to a level needs the appropriate level symbol).
>>Level two 
>>>Level three
>>>>I have never tried level 4...
>>>>>...and definitely never level 5!

!Outline (Symbols)
<nowiki>*</nowiki>A line with level 1 symbol
<nowiki>**</nowiki>Another, with level 2 symbol
<nowiki>***</nowiki>This line has a level 3 symbol.
<nowiki>****</nowiki>This line has a level 4 symbol (if it exists).
@@color(red): becomes@@
*A line with level 1 symbol
**Another, with level 2 symbol
***This line has a level 3 symbol.
****This line has a level 4 symbol (Note the repeat -- not so useful!).

!Outline (~Alpha-Numeric)
<nowiki>#</nowiki>A line with level 1 indicator
<nowiki>##</nowiki>Another, with level 2 indicator
<nowiki>###</nowiki>This line has a level 3 indicator.
<nowiki>####</nowiki>This line has a level 4 indicator (if it exists).
@@color(red): becomes@@
#A line with level 1 indicator
##Another, with level 2 indicator
###This line has a level 3 indicator.
####This line has a level 4 indicator (Note the repeat).

!Tables
These are more complex, and a full description can be had at [[table syntax|http://tiddlywiki.tiddlyspace.com/Tables]].
Here is an example of a simple table:
{{{|@@color(blue):Phramoid Practice@@|c}}}
{{{|!column heading 0|!column heading 1|!column heading 2|}}}
{{{|!row heading 1|row 1, column 1|row 1, column 2|}}}
{{{|!row heading 2|row 2, column 1|row 2, column 2|}}}
{{{|!row heading 3|row 3, column 1|row 3, column 2|}}}
{{{|!column footer 0|!column footer 1|!column footer 2|}}}
{{{|@@color(green):A Simple Table@@|c}}}
@@color(red): becomes@@
|@@color(blue):Phramoid Practice@@|c
|!column heading 0|!column heading 1|!column heading 2|
|!row heading 1|row 1, column 1|row 1, column 2|
|!row heading 2|row 2, column 1|row 2, column 2|
|!row heading 3|row 3, column 1|row 3, column 2|
|!column footer 0|!column footer 1|!column footer 2|
|@@color(green):A Simple Table@@|c
As you can see, you ended up in an entry ("tiddler") of the same name. We call words with 2 or more capital letters "~WikiWords". If they aren't forced to point someplace else (for example, //<nowiki>[[TwoCaps | http://rothlab.ucdavis.edu]]</nowiki>// which makes [[TwoCaps | http://rothlab.ucdavis.edu]]), then they will try to point to an entry of the same name.
/***
|Name|ImageSizePlugin|
|Source|http://www.TiddlyTools.com/#ImageSizePlugin|
|Version|1.2.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|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;
	};
}
//}}}
<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler > fields syncing permalink references jump'></div>
<div class='viewer' macro='view text wikified'></div>
<<forEachTiddler 
    where 
        'tiddler.tags.contains("newpapers")'
    sortBy
        'tiddler.title'
>>
!info
|Name|OpenTaggedTiddlers|
|Source|http://www.TiddlyTools.com/#OpenTaggedTiddlers|
|Version|2.0.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|transclusion|
|Description|create a link to open a set of tagged tiddlers with a single click|
Usage:
<<<
{{{
<<tiddler OpenTaggedTiddlers with: label tagToMatch sortBy reverse close limit>>
}}}
*''label''<br>is the text of the link
*''tagToMatch''<br>is a single tag value to be matched.  Note: when MatchTagsPlugin is installed, you can also use a boolean tag expression, enclosed in "..."
*''sortBy'' (optional)<br>a tiddler fieldname, (default="title", use "modified" or "created" for tiddler dates)
*''reverse'' (optional)<br>display order for the tiddlers (i.e., descending vs. ascending)
*''close'' (optional)<br>closes all open tiddlers before opening the tagged tiddlers
*''limit'' (optional)<br>maximum number of tiddlers to be opened
Note: use "" as placeholders when omitting optional parameters
<<<
Example
<<<
{{{<<tiddler OpenTaggedTiddlers##show with: "click me..." stress title reverse "" 3>>}}}
<<tiddler OpenTaggedTiddlers##show with: "click me..." stress title reverse "" 3>>
<<<
!end
!show
<html><nowiki><a href='javascript:;' onclick="
	var list=[];
	var match='$2';
	var sortBy='$3'; if ((sortBy=='$'+'3')||(sortBy=='')) sortBy='title';
	var filter='[tag[%0]][sort[%1]]'.format([match,sortBy]);
	var tids=store.filterTiddlers(filter);
	if ('$4'=='reverse') tids=tids.reverse();
	if ('$5'=='close') story.closeAllTiddlers();
	var limit=('$6'!='$'+'6')?parseInt('$6'):tids.length;
	for (var t=0;t<tids.length && t<limit;t++) list.push(tids[t].title);
	if (confirm('Show %0 tiddlers tagged with \x27%1\x27?'.format([tids.length,match]))) {
		var here=story.findContainingTiddler(place);
		story.displayTiddlers(here,list);
		if (here && list.length) { // scroll to top of newly displayed tiddlers
			var cmd='window.scrollTo(0,'+(here.offsetTop+here.offsetHeight)+')';
			var delay=config.options.chkAnimate?config.animDuration+100:0;
			setTimeout(cmd,delay);
		}
	}
	return false;
">$1</a></html>
!end
<<tiddler {{var src='OpenTaggedTiddlers'; src+(tiddler&&tiddler.title==src?'##info':'##show')}}
	with: [[$1]] [[$2]] [[$3]] [[$4]] [[$5]] [[$6]]>>
config.options.txtTheme = 'lewcidOrangeTheme';

/***
|Name|NestedSlidersPluginInfo|
|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|
|~CoreVersion|2.1|
|Type|documentation|
|Description|documentation for NestedSlidersPlugin|
This plugin adds new wiki syntax for embedding 'slider' panels directly into tiddler content.
!!!!!Usage
<<<
//{{{
++++(cookiename)!!!!!^width^*@{{class{[label=key|tooltip][altlabel|alttooltip]}}}#panelID:>...
content goes here
===
//}}}
* ''"""+++""" (or """++++""") and """==="""''<br>marks the start and end of the slider definition, respectively.  When the extra {{{+}}} is used, the slider will be open when initially displayed.
* ''"""(cookiename)"""''<br>saves the slider opened/closed state, and restores this state whenever the slider is re-rendered.
* ''"""! through !!!!!"""''<br>displays the slider label using a formatted headline (Hn) style instead of a button/link style
* ''"""^width^ (or just ^)"""''<br>makes the slider 'float' on top of other content rather than shifting that content downward.  'width' must be a valid CSS value (e.g., "30em", "180px", "50%", etc.).  If omitted, the default width is "auto" (i.e., fit to content)
* ''"""*"""''<br>denotes "transient display": when a click occurs elsewhere in the document, the slider/floating panel will be automatically closed.  This is useful for creating 'pulldown menus' that automatically go away after they are used.  //Note: using SHIFT-click on a slider label will open/close that slider without triggering the automatic closing of any transient slider panels that are currently displayed, permitting ''temporary'' display of several transient panels at once.//
* ''"""@"""''<br>denotes "open on hover": the slider/floating panel will be automatically opened as soon as the mouse moves over the slider label, without requiring a click.
* ''"""{{class{[label=key|tooltip][altlabel|alttooltip]}}}"""''<br>uses label/tooltip/accesskey.  """{{class{...}}}""", """=key""", """|tooltip""" and """[altlabel|alttooltip]""" are optional.  'class' is any valid CSS class name, used to style the slider label text.  'key' must be a ''single letter only''.  altlabel/alttooltip specify alternative label/tooltip for use when slider/floating panel is displayed.  //Note: you can use HTML syntax within the label text to include HTML entities (e.g., {{{&raquo;}}} (&raquo;) or {{{&#x25ba;}}} (&#x25ba;), or even embedded images (e.g., {{{<img src="images/eric3.gif">}}}).//
* ''"""#panelID:"""''<br>defines a unique DOM element ID that is assigned to the panel element used to display the slider content.  This ID can then be used later to reposition the panel using the {{{<<DOM move id>>}}} macro (see [[DOMTweaksPlugin]]), or to access/modify the panel element through use of {{{document.getElementById(...)}}}) javascript code in a plugin or inline script.
* ''""">"""''<br>automatically adds blockquote formatting to slider content
* ''"""..."""''<br>defers rendering of closed sliders until the first time they are opened.
Notes:
*You can 'nest' sliders as deep as you like (see complex nesting example below), so that expandable 'tree-like' hierarchical displays can be created.
*Deferred rendering (...) can be used to offset processing overhead until actually needed. However, this may produce unexpected results in some cases.  Use with care.
* To make slider definitions easier to read and recognize when editing a tiddler, newlines immediately following the 'start slider' or preceding the 'end slider' sequences are automatically supressed so that excess whitespace is eliminated from the output.
<<<
!!!!!Examples
<<<
simple in-line slider: 
{{{
+++content===
}}}
+++content===
----
use a custom label and tooltip: 
{{{
+++[label|tooltip]content===
}}}
+++[label|tooltip]content===
----
content automatically blockquoted: 
{{{
+++>content===
}}}
+++>content===
----
all options (except cookie) //(default open, heading, sized floater, transient, open on hover, class, label/tooltip/key, blockquoted, deferred)//
{{{
++++!!!^30em^*@{{big{[label=Z|click or press Alt-Z to open]}}}>...
   content
===
}}}
++++!!!^30em^*@{{big{[label=Z|click or press Alt-Z to open]}}}>...
   content
===
----
complex nesting example:
{{{
+++[get info...=I|click for information or press Alt-I]
	put some general information here,
	plus a floating panel with more specific info:
	+++^10em^[view details...|click for details]
		put some detail here, which could in turn contain a transient panel,
		perhaps with a +++^25em^*[glossary definition]explaining technical terms===
	===
===
}}}
+++[get info...=I|click for information or press Alt-I]
	put some general information here,
	plus a floating panel with more specific info:
	+++^10em^[view details...|click for details]
		put some detail here, which could in turn contain a transient panel,
		perhaps with a +++^25em^*[glossary definition]explaining technical terms===
	===
===
----
embedded image as slider button
{{{
+++[<img src=images/eric3.gif>|click me!]>
	{{big{OUCH!}}}
===
}}}
+++[<img src=images/eric3.gif>|click me!]>
	{{big{OUCH!}}}
===
<<<
!!!!!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]])
2008.11.13 2.4.8 in document.onclick(), if transient panel is not a sliderPanel or floatingPanel, hide it via CSS
2008.10.05 2.4.7 in onClickNestedSlider(), added try/catch around focus() call to prevent IE error if input field being focused on is currently not visible.
2008.09.07 2.4.6 added removeCookie() function for compatibility with [[CookieManagerPlugin]]
2008.06.07 2.4.5 in 'onmouseover' handler for 'open on hover' slider buttons, use call() method when invoking document.onclick function (avoids error in IE)
2008.06.07 2.4.4 changed default for chkFloatingSlidersAnimate to FALSE to avoid clipping problem on some browsers (IE).  Updated Morpher hijack (again) to adjust regular sliderPanel styles as well as floatingPanel styles.
2008.05.07 2.4.3 updated Morpher hijack to adjust floatingPanel styles after animation without affecting other animated elements (i.e. popups).  Also, updated adjustSliderPos() to account for scrollwidth and use core findWindowWidth().
2008.04.02 2.4.2 in onClickNestedSlider, handle clicks on elements contained //within// slider buttons (e.g., when using HTML to display an image as a slider button).
2008.04.01 2.4.1 open on hover also triggers document.onclick to close other transient sliders
2008.04.01 2.4.0 re-introduced 'open on hover' feature using "@" symbol
2008.03.26 2.3.5 in document.onclick(), if click is in popup, don't dismiss transient panel (if any)
2008.01.08 [*.*.*] plugin size reduction: documentation moved to ...Info tiddler
2007.12.28 2.3.4 added hijack for Animator.prototype.startAnimating().  Previously, the plugin code simply set the overflow to "visible" after animation.  This code tweak corrects handling of elements that were styled with overflow=hidden/auto/scroll before animation by saving the overflow style and then restoring it after animation has completed.
2007.12.17 2.3.3 use hasClass() instead of direct comparison to test for "floatingPanel" class.  Allows floating panels to have additional classes assigned to them (i.e., by AnimationEffectsPlugin).
2007.11.14 2.3.2 in onClickNestedSlider(), prevent SHIFT-click events from opening a new, empty browser window by setting "cancelBubble=true" and calling "stopPropagation()".  Note: SHIFT-click is still processed as a normal click (i.e., it toggles the slider panel display).  Also, using SHIFT-click will prevent 'transient' sliders from being automatically closed when another slider is opened, allowing you to *temporarily* display several transient sliders at once.
2007.07.26 2.3.1 in document.onclick(), propagate return value from hijacked core click handler to consume OR bubble up click as needed.  Fixes "IE click disease", whereby nearly every mouse click causes a page transition.
2007.07.20 2.3.0 added syntax for setting panel ID (#panelID:).  This allows individual slider panels to be repositioned within tiddler content simply by giving them a unique ID and then moving them to the desired location using the {{{<<DOM move id>>}}} macro.
2007.07.19 2.2.0 added syntax for alttext and alttip (button label and tooltip to be displayed when panel is open)
2007.07.14 2.1.2 corrected use of 'transient' attribute in IE to prevent (non-recursive) infinite loop
2007.07.12 2.1.0 replaced use of "*" for 'open/close on rollover' (which didn't work too well).  "*" now indicates 'transient' panels that are automatically closed if a click occurs somewhere else in the document.  This permits use of nested sliders to create nested "pulldown menus" that automatically disappear after interaction with them has been completed.  Also, in onClickNestedSlider(), use "theTarget.sliderCookie", instead of "this.sliderCookie" to correct cookie state tracking when automatically dismissing transient panels.
2007.06.10 2.0.5 add check to ensure that window.adjustSliderPanel() is defined before calling it (prevents error on shutdown when mouse event handlers are still defined)
2007.05.31 2.0.4 add handling to invoke adjustSliderPanel() for onmouseover events on slider button and panel.  This allows the panel position to be re-synced when the button position shifts due to changes in unrelated content above it on the page.  (thanks to Harsha for bug report)
2007.03.30 2.0.3 added chkFloatingSlidersAnimate (default to FALSE), so that slider animation can be disabled independent of the overall document animation setting (avoids strange rendering and focus problems in floating panels)
2007.03.01 2.0.2 for TW2.2+, hijack Morpher.prototype.stop so that "overflow:hidden" can be reset to "overflow:visible" after animation ends
2007.03.01 2.0.1 in hijack for Slider.prototype.stop, use apply() to pass params to core function
2006.07.28 2.0.0 added custom class syntax around label/tip/key syntax: {{{{{classname{[label=key|tip]}}}}}}
2006.07.25 1.9.3 when parsing slider, save default open/closed state in button element, then in onClickNestedSlider(), if slider state matches saved default, instead of saving cookie, delete it.  Significantly reduces the 'cookie overhead' when default slider states are used.
2006.06.29 1.9.2 in onClickNestedSlider(), when setting focus to first control, skip over type="hidden"
2006.06.22 1.9.1 added panel.defaultPanelWidth to save requested panel width, even after resizing has changed the style value
2006.05.11 1.9.0 added optional '^width^' syntax for floating sliders and '=key' syntax for setting an access key on a slider label
2006.05.09 1.8.0 in onClickNestedSlider(), when showing panel, set focus to first child input/textarea/select element
2006.04.24 1.7.8 in adjustSliderPos(), if floating panel is contained inside another floating panel, subtract offset of containing panel to find correct position
2006.02.16 1.7.7 corrected deferred rendering to account for use-case where show/hide state is tracked in a cookie
2006.02.15 1.7.6 in adjustSliderPos(), ensure that floating panel is positioned completely within the browser window (i.e., does not go beyond the right edge of the browser window)
2006.02.04 1.7.5 add 'var' to unintended global variable declarations to avoid FireFox 1.5.0.1 crash bug when assigning to globals
2006.01.18 1.7.4 only define adjustSliderPos() function if it has not already been provided by another plugin.  This lets other plugins 'hijack' the function even when they are loaded first.
2006.01.16 1.7.3 added adjustSliderPos(place,btn,panel,panelClass) function to permit specialized logic for placement of floating panels.  While it provides improved placement for many uses of floating panels, it exhibits a relative offset positioning error when used within *nested* floating panels.  Short-term workaround is to only adjust the position for 'top-level' floaters.
2006.01.16 1.7.2 added button property to slider panel elements so that slider panel can tell which button it belongs to.  Also, re-activated and corrected animation handling so that nested sliders aren't clipped by hijacking Slider.prototype.stop so that "overflow:hidden" can be reset to "overflow:visible" after animation ends
2006.01.14 1.7.1 added optional "^" syntax for floating panels.  Defines new CSS class, ".floatingPanel", as an alternative for standard in-line ".sliderPanel" styles.
2006.01.14 1.7.0 added optional "*" syntax for rollover handling to show/hide slider without requiring a click (Based on a suggestion by tw4efl)
2006.01.03 1.6.2 When using optional "!" heading style, instead of creating a clickable "Hn" element, create an "A" element inside the "Hn" element.  (allows click-through in SlideShowPlugin, which captures nearly all click events, except for hyperlinks)
2005.12.15 1.6.1 added optional "..." syntax to invoke deferred ('lazy') rendering for initially hidden sliders
removed checkbox option for 'global' application of lazy sliders
2005.11.25 1.6.0 added optional handling for 'lazy sliders' (deferred rendering for initially hidden sliders)
2005.11.21 1.5.1 revised regular expressions: if present, a single newline //preceding// and/or //following// a slider definition will be suppressed so start/end syntax can be place on separate lines in the tiddler 'source' for improved readability.  Similarly, any whitespace (newlines, tabs, spaces, etc.) trailing the 'start slider' syntax or preceding the 'end slider' syntax is also suppressed.
2005.11.20 1.5.0 added (cookiename) syntax for optional tracking and restoring of slider open/close state
2005.11.11 1.4.0 added !!!!! syntax to render slider label as a header (Hn) style instead of a button/link style
2005.11.07 1.3.0 removed alternative syntax {{{(((}}} and {{{)))}}} (so they can be used by other formatting extensions) and simplified/improved regular expressions to trim multiple excess newlines
2005.11.05 1.2.1 changed name to NestedSlidersPlugin
2005.11.04 1.2.0 added alternative character-mode syntax {{{(((}}} and {{{)))}}}
tweaked "eat newlines" logic for line-mode {{{+++}}} and {{{===}}} syntax
2005.11.03 1.1.1 fixed toggling of default tooltips ("more..." and "less...") when a non-default button label is used.  code cleanup, added documentation
2005.11.03 1.1.0 changed delimiter syntax from {{{(((}}} and {{{)))}}} to {{{+++}}} and {{{===}}}.  changed name to EasySlidersPlugin
2005.11.03 1.0.0 initial public release
<<<
/%
!info
|Name|OpenTiddlers|
|Source|http://www.TiddlyTools.com/#OpenTiddlers|
|Version|2.0.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|transclusion|
|Description|command link to open multiple tiddlers with a single click|
Usage:
<<<
in tiddler content:
{{{
<<tiddler OpenTiddlers with: label
	"tiddler tiddler [[tiddler with spaces]] tiddler..." template>>
}}}
note: ''template'' is optional and defaults to ViewTemplate
<<<
!end

!show
<html><nowiki><a href='javascript:;' onclick='
	var tidlist="$2";
	if ("$3"!="$"+"3") var template="$3";
	story.displayTiddlers(story.findContainingTiddler(place),tidlist.readBracketedList(),template);
	return false;
'>$1</a></html>
!end
%/<<tiddler {{'OpenTiddlers##'+("$1"=='$'+'1'?'info':'show')}}
	with: [[$1]] {{"$2"}} [[$3]]>>
/%
!info
|Name|ShowImage|
|Source|http://www.TiddlyTools.com/#ShowImage|
|Version|1.0.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|transclusion|
|Description|display attached tiddler image without supporting plugin|
Usage:
<<<
# First, use [[AttachFilePlugin]] to create tiddlers containing base64-encoded image data with a fallback remote URL reference.
# You can then discard the plugin and associated supporting tiddlers ([[AttachFileMIMETypes]], [[AttachFilePluginFormatters]]), leaving only the attachment tiddlers (plus this tiddler, ShowImage, of course).
# Use the following syntax to display the attached images without any plugins:
{{{
<<tiddler ShowImage with: [[TiddlerName]] "tooltip" "width">>
}}}
where:
*''~TiddlerName''<br>title of the attachment tiddler to be displayed
*''tooltip'' //(optional)//<br>mouseover help text for the image (default=attachment title)
*''width'' //(optional)//<br>CSS width measurement - resizes image height proportionally (default=auto)
Note: the fallback remote URL will be used if encoded data is not attached or you are using InternetExplorer, which does not currently support the data:// URI. 
<<<
Example:
<<<
{{{
<<tiddler ShowImage with: [[AttachFileSample]] "meow!" "30px">>
}}}
<<tiddler ShowImage with: [[AttachFileSample]] "meow!" "30px">>
<<<
!end

!show
<html><img src="missing.jpg" title="$2" style="width:$3" /></html><<tiddler {{
	var src=store.getTiddlerText("$1##data");
	if (!src||config.browser.isIE)
		src=store.getTiddlerText("$1##url","missing.jpg");
	place.lastChild.firstChild.src=src;
}}>>
!end

%/
<<tiddler {{"ShowImage##"+("$1"=="$"+"1"?"info":"show")}} with:
	[[$1]]
	{{"$2"=="$"+"2"?"$1"  :"$2"}}
	{{"$3"=="$"+"3"?"auto":"$3"}}
>>
<html><a href="javascript:void(0)" onclick="story.closeAllTiddlers();story.displayTiddlers(null,store.getTiddlerText('MyTaggedTiddlers').readBracketedList())" title="" style="cursor:pointer">Open My Tags</a></html>
<<tiddler OpenMyTiddlersByTag##script with:'test'>>

/%
!script
<script>
var out="";
var done="MyTaggedTiddlers created...";
var title="MyTaggedTiddlers";
var tids=store.getTaggedTiddlers('$1');
for (var t=0; t<tids.length; t++)
out+="[["+tids[t].title+"]]\n";
store.saveTiddler(title,title,out);
return done;
</script>
!end
%/
/***
|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|
|~CoreVersion|2.1|
|Type|plugin|
|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(/^#/,'')); } }
//}}}
A "TID" is a "__T__andem __I__nversion-__D__uplication". It has two copies of a multi-gene parent sequence that flank a central inverse-order segment. The inverted segment often shares loci with the flanking elements, but this is not always the case. The following is a parental sequence (wt) and some  examples of ~TIDs:

[img[TID Examples|cctiddly/pics/tid_examples.png]]

In example 1, nothing in the flanking repeats occurs in the inverted segment; in 2,  all flanking plus some adjacent material is present; in 3, only a small portion of the flank has been inverted; and, in 4, the flanking element is exactly inverted as the central part. The first three are examples of a subset of ~TIDs called "aTIDs" for "__a__ssymetrical __T__andem __I__nversion-__D__uplications", and the fourth, an "sTID", for "__s__ymmetric __T__andem __I__nversion-__D__uplication", which are exceptionally rare.

~TIDs can be amplified by unequal exchanges between the flanking direct repeats to produce multiple copies of the central and flanking sequence.  They underlie an estimated 30% of //lac// amplifications formed during prolonged growth under selection for improved use of lactose, but are much rarer under unselected conditions. In 41 unselected //lac// duplications, we found only one.

To explain how selection contributes to TID formation, we propose that the observed asymmetric structures (aTIDs) arise by a multi-step process from a relatively easily formed symmetrical tandem inversion duplication (sTID).   The latter forms frequently at short palindromes in parent sequence, but is usually lost because of its inherent fitness cost and instability -- the extended symmetrical junctions are prone to hairpin formation and deletion.  Prolonged selection for more copies holds an sTID until assymetric deletions form a more favorable aTID structure. This reduces cost and allows higher amplification.  Selection favors such progressive improvement and drives the adaptation process to completion. 
//Salmonella enterica// can use ethanolamine as a sole source of carbon and nitrogen under aerobic and anaerobic conditions. Ethanolamine is degraded in two steps. The first enzyme (ethanolamine ammonia-lyase) requires the cofactor adenosyl cobalamin (~Ado-B~~12~~), which is synthesized by //S. enterica// under anaerobic conditions but must be imported under aerobic conditions. In this B~~12~~-dependent reaction, ethanolamine is cleaved to ammonia plus acetaldehyde, which is then converted to acetyl-coenzyme A (acetyl-~CoA) by an ~NAD-dependent oxidoreductase. 

Genetic screens revealed six genes required for the use of ethanolamine (//eutA//, -//B//, -//C//, -//D//, -//E//, and -//R//) all located within the 17-gene //eut// operon. All other //eut// genes showed no mutant phenotype under standard conditions but seemed likely to contribute to ethanolamine use, because the operon is induced by ethanolamine plus ~Ado-B~~12~~. In keeping with this expectation, several of these extra genes support use of ethanolamine under specific nonstandard conditions. The //eutT// gene encodes an adenosyl transferase that forms ~Ado-B~~12~~ (the lyase cofactor) from ~OH- or ~CN-B~~12~~. This provides more ~Ado-B~~12~~ during periods of high demand and is required in the absence of the general adenosyl-transferase, ~CobA. The ~EutH protein facilitates ethanolamine diffusion (see below) and is required only at very low levels of ethanolamine.

Five of the extra genes (//eutS//, -//M//, -//N//, -//L//, and -//K//) encode homologs of proteins that form the carboxysome, an organelle found in cyanobacteria and sulfur-oxidizing bacteria that concentrates CO~~2~~ for fixation by ribulose-bisphosphate carboxylase (~RuBisCO). We refer to the //Salmonella// organelles as carboxysomes, despite the lack of evidence that CO~~2~~ is concentrated or fixed. We suspect that //Salmonella// does both during growth on ethanolamine. These organelles have been referred to elsewhere as "metabolosomes", "enterosomes", "polyhedral bodies", or "bacterial microcompartments".
[img['Ethanolamine Metabolism'|cctiddly/pics/eut.png]]
<html>|</html>
We know of no compelling experimental evidence for stress-induced mutability in any system. Moreover, there are theoretical reasons to expect that temporary increases in mutation rate are unlikely to be of long-term benefit, due to their cost in deleterious mutations. Nevertheless, in some systems, selection does increase the yield of mutants. Under particular selective conditions, increases in general mutation rate can be shown experimentally and theoretically to be advantageous. We suggest that the apparent conflicts between these statements can be resolved without recourse to stress-induced mutability.
/***
|''Name:''|DropDownMenuPlugin|
|''Description:''|Create dropdown menus from unordered lists|
|''Author:''|Saq Imtiaz ( lewcid@gmail.com )|
|''Source:''|http://tw.lewcid.org/#DropDownMenuPlugin|
|''Code Repository:''|http://tw.lewcid.org/svn/plugins|
|''Version:''|2.1|
|''Date:''|11/04/2007|
|''License:''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.2.5|

!!Usage:
* create a two-level unordered list using wiki syntax, and place {{{<<dropMenu>>}}} on the line after it.
* to create a vertical menu use {{{<<dropMenu vertical>>}}} instead.
* to assign custom classes to the list, just pass them as parameters to the macro {{{<<dropMenu className1 className2 className3>>}}}

!!Features:
*Supports just a single level of drop-downs, as anything more usually provides a poor experience for the user.
* Very light weight, about 1.5kb of JavaScript and 4kb of CSS.
* Comes with two built in css 'themes', the default horizontal and vertical. 

!!Customizing:
* to customize the appearance of the menu's, you can either add a custom class as described above or, you can edit the CSS via the StyleSheetDropDownMenu shadow tiddler.

!!Examples:
* [[DropDownMenuDemo]]

***/
// /%
//!BEGIN-PLUGIN-CODE
config.macros.dropMenu={

	dropdownchar: "\u25bc",

	handler : function(place,macroName,params,wikifier,paramString,tiddler){
		list = findRelated(place.lastChild,"UL","tagName","previousSibling");
		if (!list)
			return;
		addClass(list,"suckerfish");
		if (params.length){
			addClass(list,paramString);
		}
		this.fixLinks(list);
	},
	
	fixLinks : function(el){
		var els = el.getElementsByTagName("li");
		for(var i = 0; i < els.length; i++) {
			if(els[i].getElementsByTagName("ul").length>0){
				var link = findRelated(els[i].firstChild,"A","tagName","nextSibling");
				if(!link){
					var ih = els[i].firstChild.data;
					els[i].removeChild(els[i].firstChild);
					var d = createTiddlyElement(null,"a",null,null,ih+this.dropdownchar,{href:"javascript:;"});
					els[i].insertBefore(d,els[i].firstChild);
				}
				else{
					link.firstChild.data = link.firstChild.data + this.dropdownchar;
					removeClass(link,"tiddlyLinkNonExisting");
				}
			}
			els[i].onmouseover = function() {
				addClass(this, "sfhover");
			};
			els[i].onmouseout = function() {
				removeClass(this, "sfhover");
			};
		}
	}	
};

config.shadowTiddlers["StyleSheetDropDownMenuPlugin"] = 
	 "/*{{{*/\n"+
	 "/***** LAYOUT STYLES -  DO NOT EDIT! *****/\n"+
	 "ul.suckerfish, ul.suckerfish ul {\n"+
	 "	margin: 0;\n"+
	 "	padding: 0;\n"+
	 "	list-style: none;\n"+
	 "	line-height:1.4em;\n"+
	 "}\n\n"+
	 "ul.suckerfish  li {\n"+
	 "	display: inline-block; \n"+
	 "	display: block;\n"+
	 "	float: left; \n"+
	 "}\n\n"+
	 "ul.suckerfish li ul {\n"+
	 "	position: absolute;\n"+
	 "	left: -999em;\n"+
	 "}\n\n"+
	 "ul.suckerfish li:hover ul, ul.suckerfish li.sfhover ul {\n"+
	 "	left: auto;\n"+
	 "}\n\n"+
	 "ul.suckerfish ul li {\n"+
	 "	float: none;\n"+
	 "	border-right: 0;\n"+
	 "	border-left:0;\n"+
	 "}\n\n"+
	 "ul.suckerfish a, ul.suckerfish a:hover {\n"+
	 "	display: block;\n"+
	 "}\n\n"+
	 "ul.suckerfish li a.tiddlyLink, ul.suckerfish li a, #mainMenu ul.suckerfish li a {font-weight:bold;}\n"+
	 "/**** END LAYOUT STYLES *****/\n"+
	 "\n\n"+
	 "/**** COLORS AND APPEARANCE - DEFAULT *****/\n"+
	 "ul.suckerfish li a {\n"+
	 "	padding: 0.5em 1.5em;\n"+
	 "	color: #FFF;\n"+
	 "	background: #0066aa;\n"+
	 "	border-bottom: 0;\n"+
	 "	font-weight:bold;\n"+
	 "}\n\n"+
	 "ul.suckerfish li:hover a, ul.suckerfish li.sfhover a{\n"+
	 "	background: #00558F;\n"+
	 "}\n\n"+
	 "ul.suckerfish li:hover ul a, ul.suckerfish li.sfhover ul a{\n"+
	 "	color: #000;\n"+
	 "	background: #eff3fa;\n"+
	 "	border-top:1px solid #FFF;\n"+
	 "}\n\n"+
	 "ul.suckerfish ul li a:hover {\n"+
	 "	background: #e0e8f5;\n"+
	 "}\n\n"+
	 "ul.suckerfish li a{\n"+
	 "	width:9em;\n"+
	 "}\n\n"+
	 "ul.suckerfish ul li a, ul.suckerfish ul li a:hover{\n"+
	 "	display:inline-block;\n"+
	 "	width:9em;\n"+
	 "}\n\n"+
	 "ul.suckerfish li {\n"+
	 "	border-left: 1px solid #00558F;\n"+
	 "}\n"+
	 "/***** END COLORS AND APPEARANCE - DEFAULT *****/\n"+
	 "\n\n"+
	 "/***** LAYOUT AND APPEARANCE: VERTICAL *****/\n"+
	 "ul.suckerfish.vertical li{\n"+
	 "	width:10em;\n"+
	 "	border-left: 0px solid #00558f;\n"+
	 "}\n\n"+
	 "ul.suckerfish.vertical ul li, ul.suckerfish.vertical li a, ul.suckerfish.vertical li:hover a, ul.suckerfish.vertical li.sfhover a {\n"+
	 "	border-left: 0.8em solid #00558f;\n"+
	 "}\n\n"+
	 "ul.suckerfish.vertical li a, ul.suckerfish.vertical li:hover a, ul.suckerfish.vertical li.sfhover a,  ul.suckerfish.vertical li.sfhover a:hover{\n"+
	 "	width:8em;\n"+
	 "}\n\n"+
	 "ul.suckerfish.vertical {\n"+
	 "	width:10em; text-align:left;\n"+
	 "	float:left;\n"+
	 "}\n\n"+
	 "ul.suckerfish.vertical li a {\n"+
	 "	padding: 0.5em 1em 0.5em 1em;\n"+
	 "	border-top:1px solid  #fff;\n"+
	 "}\n\n"+
	 "ul.suckerfish.vertical, ul.suckerfish.vertical ul {\n"+
	 "	line-height:1.4em;\n"+
	 "}\n\n"+
	 "ul.suckerfish.vertical li:hover ul, ul.suckerfish.vertical li.sfhover ul { \n"+
	 "	margin: -2.4em 0 0 10.9em;\n"+
	 "}\n\n"+
	 "ul.suckerfish.vertical li:hover ul li a, ul.suckerfish.vertical li.sfhover ul li a {\n"+
	 "	border: 0px solid #FFF;\n"+
	 "}\n\n"+
	 "ul.suckerfish.vertical li:hover a, ul.suckerfish.vertical li.sfhover a{\n"+
	 "	padding-right:1.1em;\n"+
	 "}\n\n"+
	 "ul.suckerfish.vertical li:hover ul li, ul.suckerfish.vertical li.sfhover ul li {\n"+
	 "	border-bottom:1px solid  #fff;\n"+
	 "}\n\n"+
	 "/***** END LAYOUT AND APPEARANCE: VERTICAL *****/\n"+
	 "/*}}}*/";
store.addNotification("StyleSheetDropDownMenuPlugin",refreshStyles);
//!END-PLUGIN-CODE
// %/
[[simple formatting guide|AboutFormatting]]
[[help|Help]] <br />[[settings|AdvancedOptions]]<br /><<ccOptions>>
Adaptive mutation: any process by which fitter mutations arise under selective conditions; may or may not require mutagenesis or growth. This definition assumes a mechanism that we think is unlikely to exist. In order to consider all explanations of the relevant phenomena, adaptive mutation is defined here as the process by which mutations arise under selective conditions, whether or not mutation rates increase or growth is required.
A system was developed by John Cairns to address the shortfalls of previous evidence for selection-independent mutability (13). In the new system, as modified by Cairns & Foster (11), Lac^^−^^ cells with a revertible lac mutation are plated on lactose medium and selection is made for mutants that regain a Lac^^+^^ phenotype. The selective conditions are not lethal and are adjusted to just barely prevent growth of the plated population. About 100 Lac^^+^^ colonies accumulate above the plated lawn of 10^^8^^ cells over 6 days. Thus, the conditions appear to eliminate natural selection (growth) and reveal revertants, which accumulate at a nearly linear rate with time. That is, fully Lac^^+^^ revertants seem to arise in a nongrowing parent population.
[img['Cairns Experiment'|cctiddly/pics/cairns.png]]
[img['Cairns Genotype'|cctiddly/pics/cairns_genotype.png]]
A model proposed by Hall^^*^^ suggests that stress induces a general (undirected, genome-wide) hypermutable state (HMS) in a subset (0.1%) of the nongrowing starved population. Cells in the subpopulation ultimately die of lethal mutations unless they first acquire a lac reversion event, which relieves the stress and terminates the HMS. Mutagenesis appears directed to lac because only Lac+ revertants survive hypermutagenesis. To explain 10^^2^^ revertants arising from 10^^5^^ cells, the model requires a 10^^5^^ -fold increase in mutation rate for cells in the HMS.

^^*^^Hall BG. 1990. Spontaneous point mutations that occur more often when advantageous than when neutral. Genetics 126:5–16
Here are some examples that show the usage of the write action in the ForEachTiddlerMacro.

//''Select and Sort Examples''//
* InClauseExamples
* WhereClauseExamples
* SortClauseExamples
* ScriptClauseExamples
//''Action Examples''//
* AddToListActionExamples
* WriteActionExamples


Of cause you may also combine the examples, e.g. taking the whereClause of one example, the sortClause of a second and the action of a third.
Tandem duplications are the most common mutations.  In an unselected culture of Salmonella enterica, about 10% of cells carry a duplication of some region.  Once formed, duplications are lost at about 10^^-2^^/cell/generation).  The high loss rate suggests that duplication frequencies might reflect steady states dictated by relative rates of formation (k~~F~~)  and loss (k~~L~~). Without homologous recombination (~RecA), duplication loss rate dropps essentially to zero, but formation rate decreases only slightly.  Steady-state duplication frequency is reached rapidly even when loss is eliminated.  Under all conditions, steady state is reached faster than predicted by k~~F~~  and k~~L~~ values alone.   A major factor in determining steady state is the fitness cost of duplications, which can exceed 40% for some genomic regions.  Depending on the region tested, duplication frequency can reach between 40% and 98% of steady-state value within 30 generations – approximately the growth required for a single cell to produce a saturated overnight 1mL culture or form a large colony on solid medium (10^^9^^ cells).   Long-term bacterial populations are stably polymorphic for duplications of every region of their genome.  These polymorphisms contribute to rapid genetic adaptation by providing frequent pre-existing beneficial mutations whenever imposed selection favors increases in some gene activity. 
[img(75%,auto)[Duplication Steady-State|cctiddly/pics/dup_steadystate.png]]
Natural selection underlies how pathogens adapt to host defenses and antibiotics, and how cancer cells evade theraputic treatments once growth has started.  Despite the power of natural selection, huge populations of human somatic cells resist sufficiently well the strong selection to grow, that 2/3 of the population remains cancer free for their entire lifetime.  How can natural selection work so well at the organismal level and how can it be essentially prevented at the somatic cell level?  We suggest that something important has been missed.  The most common mutations are those with small-effects, particularly duplications and amplifications.  In natural populations, selection detects small-effect mutations and causes exponential increases in the frequency of beneficial mutations. The field of laboratory genetics of bacterial is based on the ability (like that of somatic cells) to defeat natural selection.  This is accomplished by selective conditions so stringent that they prevent growth of both parent cells and the frequent small-effect mutations that speed natural selection.  The rules for laboratory selections were validated by classic experiments of Luria, Delbruck and Lederberg, but have been forgotten in the Cairns system which is used as evidence for stress-induced mutation. In this system, selection is so weak that even a 2-fold increase in activity allows small-effect mutations to enhance the yield of mutants.

There are many biological situations in which genetic adaptation occurs so rapidly that mutations appear to be induced by the stress involved in selection.  It was even suggested that selection might direct mutations to valuable sites^^1,2^^.  Later it was revealed that some Lac+ revertants in the Cairns system had experienced a period of genome-wide (undirected) mutagenesis^^3^^, which has been termed "Stress-induced mutagenesis. Those who support "stress-induced mutagenesis" propose that cells possess an evolved mechanism to increase their genome-wide mutation rate whenever stress blocks growth and chromosome replication.  We modeled this idea mathematically and concluded that the cost of such a mechanism (in deleterious mutations) would prevent it from providing a selective advantage under standard conditions^^4^^.  We proposed an alternative explanation for the phenomenology - selected gene amplification.  The key observation is that Cairns' weak selective conditions prevent growth of the parent //lac// population, but allow growth of cells with a duplication or amplification of the leaky mutant //lac// locus.  We propose that these cells initiate colonies within which growth improves due to higher amplification until the total number of //lac// alleles on the selection plate is sufficient to permit the observed reversion events to occur with no increase in mutation rate. 
<<<
[img(125%,auto)[Small Effects|cctiddly/pics/small_effects.png]]
"Small-effect mutations are common."   The several distinct types of mutations arise at very different rates.  Mutations with large phenotypic effects (functional loss or gain) are rare.  Those with small phenotypes (particularly duplications and amplifications) are astronomically common. Note the million-fold range in mutation rates in the figure.  The small phenotypes provided by copy number changes are detected by natural selection, but are not often considered in analytical genetics.  We suspect that selection has shaped replication and repair systems (and the code) so as to minimize the effects of deleterious mutation.  Duplications and amplifications may remain common because they have small effects on phenotype and because they are reversible.
<<<
<<<
[img(125%,auto)[Multiple Pathways|cctiddly/pics/mult_paths.png]]
"Selection in natural populations."  Selection in growing populations causes an exponential increase in the frequency of a beneficial mutation.  Adaptive responses are often realized by a series of small-effect mutations, which are already present in the population before selection and arise frequently and repeatedly in a new expanding clone.  Selection can detect even very small fitness changes and thus can take advantage of the most common mutations, which include copy number changes (see above). 
<<<
Experimental genetics uses selection in a very special way - it beats natural selection by using stringent conditions to eliminate the contribution of small-effect mutations.  Laboratory genetics of bacteria is based upon use of selection to detect pre-existing mutants without influencing their frequency.   This is achieved by extremely stringent selective conditions that (a) block growth of the parent (so no new mutations arise under selection) and  (b) block or severely impair growth of common small-effect mutants (so they can't improve during slow growth on the selective plate).  Only pre-existing, large-effect mutations grow and form colonies.  This laboratory method defeats natural selection and is essential to the genetics of bacteria.  The method was validated by Lederberg^^5^^ and by Luria and Delbruck^^6^^.  Thus lab selections and natural selection are vastly different.  The former allows no change in mutant frequency, because it ignores small-effect mutations; the latter allows exponential changes in mutant frequency by exploiting frequent small-effect mutants. 
<<<
[img(125%,auto)[Cairns Selection|cctiddly/pics/cairns_sel.png]]
"Selection in the Cairns system (a relaxed selection detects common small-effect mutations)." Selective conditions used in the Cairns system violate the main rule of laboratory genetics - selection is not stringent.  Conditions just barely prevent growth of parent //lac// mutant cells and allow growth of common pre-exisiting copy-number variants.These common variants have a partially Lac^^+^^ phenotype allowing them to grow under selection and "evolve" a fully Lac^^+^^ phenotype in the course of forming a visible colony. The higher number of revertant colonies seen under selection reflects that fact that the Cairns selection (unlike standard lab selections) detects not only rare large-effect mutants, but also the much more common small-effect mutations that are present in the pre-growth culture. The Cairns selection resembles natural selection and shows the breathtakingly rapid response that is possible when a sequence of common small-effect mutant clones expand sequentially.  Because of exponential frequency changes, the most improved mutant cells in any colony vastly out-number their less improved predecessors, making it look as if the whole colony is descended from one mutant that arose in the parent population.  That is, selection acts so rapidly (using standard variability), that it looks very much as if stress were mutagenic. Systems used to support stress-induced mutation are ones whose behavior is interpreted as if a standard laboratory selection is in place and only rare large- effect mutants are being detected, when in fact selection is relaxed and common small-effect mutants can grow and develop under selection^^7^^. 
<<<
<<<
[img(100%,auto)[Model of Cairns Revertants|cctiddly/pics/cairns_ori.png]]
"A basic model for the origin of revertants in the Cairns system." This is an early generic model^^8^^, in which about 10^^6^^ of the 10^^8^^ plated cells carry a duplication of //lac// and initiate clones in which copy number increases under selection.  The fitness cost of added copies limits the attainable amplification, but so many duplication cells are plated that even slight modest amplification and growth gives sufficient //lac// copies on the plate to account for reversion of the //lac// frameshift mutation without any required increase in mutation rate.  If 106 plated duplication cells grow to colonies containing 1000 cells with 10 //lac// copies, this could account for appearance of 100 Lac^^+^^ revertant colonies with the basal unselected mutation rate (10^^-8^^/cell/division). These colonies would be rich in stably Lac^^+^^ cells, because  there is ample time for segregation and exponential overgrowth by haploid Lac^^+^^ cells.
<<<
 In the Cairns experiment, about 10% of clones are composed primarily of unstable Lac^^+^^ cells. To explain these colonies, we have proposed a parallel pathway in which (instead of reversion) a deletion occurs that shortens the repeated //lac// unit.  This reduces fitness cost of extra copies and allows high amplification of //lac// and growth of cells that are unstably Lac+^^9^^. Both pathways diagrammed here share the same property - growth improves under selection by multiple steps each caused by a frequent small-effect mutation.   Both pathways would be eliminated by more stringent selection conditions.
<<<
[img(125%,auto)[Copy Number Polymorphism Model|cctiddly/pics/copy_num_polymorph.png]]
"Copy number polymorphisms in bacterial populations."  Our previous work shows that the frequency of high copy number variants in a population comes to a rather high steady state in the absence of any imposed selection.  In an unselected overnight culture, roughly 1 cell in a 1000 carries a duplication of any specified gene - higher copy number variants are present at lower steady state frequencies.  Such variants are found for every locus in a genome. These polymorphisms allow selection to act rapidly by providing potentially beneficial small-effect variants that pre-exist selection. In view of recent discoveries of common copy-number variants in humans, we expect that this sort of polymorphism is likely to arise in human genomes and in human somatic cell populations.
<<<
We would like to suggest a revised model for the Cairns system. Mathematical modeling of the gene copy number polymorphisms suggests that the unselected population plated in the Cairns experiment (10^^8^^ cells) includes 100 cells with 8 copies of the //lac// operon.  This is about the number of revertant colonies that arise during 6 days under selection, suggesting that all revertants are dictated prior to plating by the number of cells with a pre-existing //lac// amplification.  In the revised model, higher copy number variants initiate the same process described in the figures above.  We've tested this model and found that counter-selection of high copy number variants during pre-growth, causes a sharp reduction in the number of revertants appearing during the later selective period.  This demonstrates that the rate-limiting step in formation of revertants under selection occurs prior to selection.   Therefore the number of revertants is unlikely to be caused by stress-induced increases in point mutation rate.


1. Cairns, J., and P. L. Foster. 1991. Adaptive reversion of a frameshift mutation in //Escherichia coli//. Genetics 128:695-701.
2. Foster, P. L., and J. M. Trimarchi. 1994. Adaptive reversion of a frameshift mutation in //Escherichia coli// by simple base deletions in homopolymeric runs. Science 265:407-9.
3. Torkelson, J., R. S. Harris, M.-J. Lombardo, J. Nagendran, C. Thulin, and S. M. Rosenberg. 1997. Genome-wide hypermutation in a subpopulation of stationary-phase cells underlies recombination-dependent adaptive mutation. EMBO J 16:3303-3311.
4. Roth, J. R., E. Kofoid, F. P. Roth, O. G. Berg, J. Seger, and D. I. Andersson. 2003. Regulating general mutation rates: examination of the hypermutable state model for Cairnsian adaptive mutation. Genetics 163:1483-96.
5. Lederberg, J., and E. M. Lederberg. 1952. Replica plating and indirect selection of bacterial 
mutants. J. Bacteriol. 63:399-406.
6. Luria, S. E., and M. Delbruck. 1943. Mutations of bacteria from virus sensitivity to virus resistance. Genetics 28:491-511. 
7. Foster, P. L. 2007. Stress-induced mutagenesis in bacteria. Crit Rev Biochem Mol Biol 42:373-97.
8. Roth, J. R., E. Kugelberg, A. B. Reams, E. Kofoid, and D. I. Andersson. 2006. Origin of Mutations Under Selection: The Adaptive Mutation Controversy. Annu Rev Microbiol 60:477-501.
9. Kugelberg, E., E. Kofoid, A. B. Reams, D. I. Andersson, and J. R. Roth. 2006. Multiple pathways of selected gene amplification during adaptive mutation. Proc Natl Acad Sci U S A 103:17319-24.
<<ccLoginStatus>>
[[List all new papers|NewPapers]]
----
/***
|''Name:''|~PopupMacro|
|''Version:''|1.0.0 (2006-05-09)|
|''Source:''|http://tw.lewcid.org/#PopupMacro|
|''Author:''|Saq Imtiaz|
|''Description:''|Create popups with custom content|
|''Documentation:''|[[PopupMacro Documentation|PopupMacroDocs]]|
|''~Requires:''|TW Version 2.0.8 or better|
***/
// /%
{{{
config.macros.popup = {};
config.macros.popup.arrow = (document.all?"▼":"▾");
config.macros.popup.handler = function(place,macroName,params,wikifier,paramString,theTiddler) {

        if (!params[0] || !params[1]) 
             {createTiddlyError(place,'missing macro parameters','missing label or content parameter');
              return false;};
   
        var label = params[0];
        var source = (params[1]).replace(/\$\)\)/g,">>"); 
        var nestedId = params[2]? params[2]: 'nestedpopup';        

	var onclick = function(event) {
	        if(!event){var event = window.event;}
                var theTarget = resolveTarget(event);
                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" : nestedId; 
	        var popup = createTiddlyElement(document.body,"ol",theId,"popup",null);
	        Popup.stack.push({root: button, popup: popup});

                wikify(source,popup);
		Popup.show(popup,true);
	        event.cancelBubble = true;
		if (event.stopPropagation) event.stopPropagation();
		return false;
	}
	var button = createTiddlyButton(place, label+this.arrow,label, onclick, null);
};

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

setStylesheet(
".popup, .popup a, .popup a:visited {color: #fff;}\n"+
".popup  a:hover {background: #014; color: #fff; border: none;}\n"+
".popup li , .popup ul, .popup ol {list-style:none !important; margin-left:0.3em !important; margin-right:0.3em; font-size:100%; padding-top:0.5px !important; padding:0px !important;}\n"+
"#nestedpopup {background:#2E5ADF; border: 1px solid #0331BF; margin-left:1em; }\n"+
"",
"CustomPopupStyles");

config.shadowTiddlers.PopupMacroDocs="The documentation is available [[here.|http://tw.lewcid.org/#PopupMacroDocs]]";
}}}
//%/
''If you want this documentation available offline, you will need to copy this tiddler to your TW.''
!Description:
Using the popup macro you can create popups with any wiki text. The wiki text can be written in the macro call, can be generated using a different macro, or included from a tiddler.

!Usage:
*the button label is the first parameter
*the text to put in the popup is the second parameter
**embed macro output like forEachTiddler or tiddlerList
***start macro calls with {{{<<}}} like normal, but end with {{{$))}}}
**define popup content inline, or embed from a tidder using the core tiddler macro {{{<<tiddler$))}}}
*you can nest popups up to one level
**nested popups have an id of 'nestedpopup' for easier styling.
**specify unique id's for nested popups by passing the id as a third parameter.

----
!Example's

''Put a forEachTiddler macro generated list in a popup:''
{{{<<popup forEachTiddlerDemo [[<<forEachTiddler where 'tiddler.tags.contains("systemConfig")']]$))}}}
<<popup forEachTiddlerDemo [[<<forEachTiddler
where
'tiddler.tags.contains("systemConfig")'$))]]>>

''Use the core {{{<<tiddler>>}}} macro to put the contents of a tiddler into a popup:''
MainMenu popup:
{{{<<popup MainMenu [[<<tiddler MainMenu$))]]>>}}}
<<popup MainMenu [[<<tiddler MainMenu$))]]>>

''Or create a custom menu in a tiddler using various macro's and normal tiddlylinks.''
{{{<<popup CustomMenu '<<tiddler CustomMenu$))'>>}}}
<<popup CustomMenu '<<tiddler CustomMenu$))'>>
this menu was created with a combination of forEachTiddler and normal tiddlyLinks!
Note that the 'Plugins' button opens a second nested popup.
Source tiddler: CustomMenu

''Or define your custom menu inline.''
{{{<<popup 'Inline Custom Menu' [[Custom Menu
*MainMenu
----
<<forEachTiddler
 where
 'tiddler.tags.contains("systemConfig")']]$))]] 
>>}}}
<<popup 'Inline Custom Menu' [[Custom Menu
*MainMenu
----
<<forEachTiddler where 'tiddler.tags.contains("systemConfig")'$))]] 
>>

''Note: you can pass a third parameter and it will be set as the id of any nested popups''
By default, nested popups have an id of 'nestedpopup' to facilitate styling.

----
!Current Issues:
*better support for custom classes for popups and nestedpopups
----
!Code
PopupMacro

//~~(Part of the [[ForEachTiddlerPlugin]])~~//

Create customizable lists, tables etc. for your selections of tiddlers. Specify the tiddlers to include and their order through a powerful language.

''Syntax:'' 
|>|{{{<<}}}''forEachTiddler'' [''in'' //tiddlyWikiPath//] [''where'' //whereCondition//] [''sortBy'' //sortExpression// [''ascending'' //or// ''descending'']] [''script'' //scriptText//] [//action// [//actionParameters//]]{{{>>}}}|
|//tiddlyWikiPath//|The filepath to the TiddlyWiki the macro should work on. When missing the current TiddlyWiki is used.|
|//whereCondition//|(quoted) JavaScript boolean expression. May refer to the build-in variables {{{tiddler}}} and {{{context}}}.|
|//sortExpression//|(quoted) JavaScript expression returning "comparable" objects (using '{{{<}}}','{{{>}}}','{{{==}}}'. May refer to the build-in variables {{{tiddler}}} and {{{context}}}.|
|//scriptText//|(quoted) JavaScript text. Typically defines JavaScript functions that are called by the various JavaScript expressions (whereClause, sortClause, action arguments,...)|
|//action//|The action that should be performed on every selected tiddler, in the given order. By default the actions [[addToList|AddToListAction]] and [[write|WriteAction]] are supported. When no action is specified [[addToList|AddToListAction]] is used.|
|//actionParameters//|(action specific) parameters the action may refer while processing the tiddlers (see action descriptions for details). <<tiddler [[JavaScript in actionParameters]]>>|
|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|


''Using JavaScript''

To give you a lot of flexibility the [[ForEachTiddlerMacro]] uses JavaScript in its arguments. Even if you are not that familiar with JavaScript you may find forEachTiddler useful. Just have a look at the various ready-to-use [[ForEachTiddlerExamples]] and adapt them to your needs.

''The Elements of the Macro''

The arguments of the ForEachTiddlerMacro consist of multiple parts, each of them being optional.

<<slider chkFETInClause [[inClause]] "inClause" "inClause">>
<<slider chkFETWhereClause [[whereClause]] "whereClause" "whereClause">>
<<slider chkFETSortClause [[sortClause]] "sortClause" "sortClause">>
<<slider chkFETScriptClause [[scriptClause]] "scriptClause" "scriptClause">>
<<slider chkFETActions [[Action Specification]] "Action Specification" "Action Specification">>

''Using Macros and ">" inside the forEachTiddler Macro''

You may use other macro calls into the expression, especially in the actionParameters. To avoid that the {{{>>}}} of such a macro call is misinterpreted as the end of the {{{<<forEachTiddler...>>}}} macro you must escape the {{{>>}}} of the inner macro with {{{$))}}} E.g. if you want to use {{{<<tiddler ...>>}}} inside the {{{forEachTiddler}}} macro you have to write {{{<<tiddler ...$))}}}.

In addition it is necessary to escape single {{{>}}} with the text {{{$)}}}.

''Using {{{<<tiddler ... with: ...>>}}} to re-use ForEachTiddler definitions''

Sometimes you may want to use a certain ForEachTiddler definition in slight variations. E.g. you may want to list either the tiddlers tagged with "ToDo" and in the other case with "Done". To do so you may use "Tiddler parameters". Here an example:

Replace the variable part of the ForEachTiddler definition with $1 ($2,... $9 are supported). E.g. you may create the tiddler "ListTaggedTiddlers" like this
{{{
<<forEachTiddler 
 where 
 'tiddler.tags.contains("$1")'
>>
}}}

Now you can use the ListTaggedTiddlers for various specific tags, using the {{{<<tiddler ...>>}}} macro:
{{{
<<tiddler ListTaggedTiddlers with: "systemConfig">>
}}}
{{{
<<tiddler ListTaggedTiddlers with: "Plugin">>
}}}


See also [[ForEachTiddlerExamples]].
/***
|''Name:''|ForEachTiddlerPlugin|
|''Version:''|1.0.8 (2007-04-12)|
|''Source:''|http://tiddlywiki.abego-software.de/#ForEachTiddlerPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]|
|''Copyright:''|&copy; 2005-2007 [[abego Software|http://www.abego-software.de]]|
|''TiddlyWiki:''|1.2.38+, 2.0|
|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|
!Description

Create customizable lists, tables etc. for your selections of tiddlers. Specify the tiddlers to include and their order through a powerful language.

''Syntax:'' 
|>|{{{<<}}}''forEachTiddler'' [''in'' //tiddlyWikiPath//] [''where'' //whereCondition//] [''sortBy'' //sortExpression// [''ascending'' //or// ''descending'']] [''script'' //scriptText//] [//action// [//actionParameters//]]{{{>>}}}|
|//tiddlyWikiPath//|The filepath to the TiddlyWiki the macro should work on. When missing the current TiddlyWiki is used.|
|//whereCondition//|(quoted) JavaScript boolean expression. May refer to the build-in variables {{{tiddler}}} and  {{{context}}}.|
|//sortExpression//|(quoted) JavaScript expression returning "comparable" objects (using '{{{<}}}','{{{>}}}','{{{==}}}'. May refer to the build-in variables {{{tiddler}}} and  {{{context}}}.|
|//scriptText//|(quoted) JavaScript text. Typically defines JavaScript functions that are called by the various JavaScript expressions (whereClause, sortClause, action arguments,...)|
|//action//|The action that should be performed on every selected tiddler, in the given order. By default the actions [[addToList|AddToListAction]] and [[write|WriteAction]] are supported. When no action is specified [[addToList|AddToListAction]]  is used.|
|//actionParameters//|(action specific) parameters the action may refer while processing the tiddlers (see action descriptions for details). <<tiddler [[JavaScript in actionParameters]]>>|
|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|

See details see [[ForEachTiddlerMacro]] and [[ForEachTiddlerExamples]].

!Revision history
* v1.0.8 (2007-04-12)
** Adapted to latest TiddlyWiki 2.2 Beta importTiddlyWiki API (introduced with changeset 2004). TiddlyWiki 2.2 Beta builds prior to changeset 2004 are no longer supported (but TiddlyWiki 2.1 and earlier, of cause)
* v1.0.7 (2007-03-28)
** Also support "pre" formatted TiddlyWikis (introduced with TW 2.2) (when using "in" clause to work on external tiddlers)
* v1.0.6 (2006-09-16)
** Context provides "viewerTiddler", i.e. the tiddler used to view the macro. Most times this is equal to the "inTiddler", but when using the "tiddler" macro both may be different.
** Support "begin", "end" and "none" expressions in "write" action
* v1.0.5 (2006-02-05)
** Pass tiddler containing the macro with wikify, context object also holds reference to tiddler containing the macro ("inTiddler"). Thanks to SimonBaird.
** Support Firefox 1.5.0.1
** Internal
*** Make "JSLint" conform
*** "Only install once"
* v1.0.4 (2006-01-06)
** Support TiddlyWiki 2.0
* v1.0.3 (2005-12-22)
** Features: 
*** Write output to a file supports multi-byte environments (Thanks to Bram Chen) 
*** Provide API to access the forEachTiddler functionality directly through JavaScript (see getTiddlers and performMacro)
** Enhancements:
*** Improved error messages on InternetExplorer.
* v1.0.2 (2005-12-10)
** Features: 
*** context object also holds reference to store (TiddlyWiki)
** Fixed Bugs: 
*** ForEachTiddler 1.0.1 has broken support on win32 Opera 8.51 (Thanks to BrunoSabin for reporting)
* v1.0.1 (2005-12-08)
** Features: 
*** Access tiddlers stored in separated TiddlyWikis through the "in" option. I.e. you are no longer limited to only work on the "current TiddlyWiki".
*** Write output to an external file using the "toFile" option of the "write" action. With this option you may write your customized tiddler exports.
*** Use the "script" section to define "helper" JavaScript functions etc. to be used in the various JavaScript expressions (whereClause, sortClause, action arguments,...).
*** Access and store context information for the current forEachTiddler invocation (through the build-in "context" object) .
*** Improved script evaluation (for where/sort clause and write scripts).
* v1.0.0 (2005-11-20)
** initial version

!Code
***/
//{{{

	
//============================================================================
//============================================================================
//		   ForEachTiddlerPlugin
//============================================================================
//============================================================================

// Only install once
if (!version.extensions.ForEachTiddlerPlugin) {

if (!window.abego) window.abego = {};

version.extensions.ForEachTiddlerPlugin = {
	major: 1, minor: 0, revision: 8, 
	date: new Date(2007,3,12), 
	source: "http://tiddlywiki.abego-software.de/#ForEachTiddlerPlugin",
	licence: "[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]",
	copyright: "Copyright (c) abego Software GmbH, 2005-2007 (www.abego-software.de)"
};

// For backward compatibility with TW 1.2.x
//
if (!TiddlyWiki.prototype.forEachTiddler) {
	TiddlyWiki.prototype.forEachTiddler = function(callback) {
		for(var t in this.tiddlers) {
			callback.call(this,t,this.tiddlers[t]);
		}
	};
}

//============================================================================
// forEachTiddler Macro
//============================================================================

version.extensions.forEachTiddler = {
	major: 1, minor: 0, revision: 8, date: new Date(2007,3,12), provider: "http://tiddlywiki.abego-software.de"};

// ---------------------------------------------------------------------------
// Configurations and constants 
// ---------------------------------------------------------------------------

config.macros.forEachTiddler = {
	 // Standard Properties
	 label: "forEachTiddler",
	 prompt: "Perform actions on a (sorted) selection of tiddlers",

	 // actions
	 actions: {
		 addToList: {},
		 write: {}
	 }
};

// ---------------------------------------------------------------------------
//  The forEachTiddler Macro Handler 
// ---------------------------------------------------------------------------

config.macros.forEachTiddler.getContainingTiddler = function(e) {
	while(e && !hasClass(e,"tiddler"))
		e = e.parentNode;
	var title = e ? e.getAttribute("tiddler") : null; 
	return title ? store.getTiddler(title) : null;
};

config.macros.forEachTiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
	// config.macros.forEachTiddler.traceMacroCall(place,macroName,params,wikifier,paramString,tiddler);

	if (!tiddler) tiddler = config.macros.forEachTiddler.getContainingTiddler(place);
	// --- Parsing ------------------------------------------

	var i = 0; // index running over the params
	// Parse the "in" clause
	var tiddlyWikiPath = undefined;
	if ((i < params.length) && params[i] == "in") {
		i++;
		if (i >= params.length) {
			this.handleError(place, "TiddlyWiki path expected behind 'in'.");
			return;
		}
		tiddlyWikiPath = this.paramEncode((i < params.length) ? params[i] : "");
		i++;
	}

	// Parse the where clause
	var whereClause ="true";
	if ((i < params.length) && params[i] == "where") {
		i++;
		whereClause = this.paramEncode((i < params.length) ? params[i] : "");
		i++;
	}

	// Parse the sort stuff
	var sortClause = null;
	var sortAscending = true; 
	if ((i < params.length) && params[i] == "sortBy") {
		i++;
		if (i >= params.length) {
			this.handleError(place, "sortClause missing behind 'sortBy'.");
			return;
		}
		sortClause = this.paramEncode(params[i]);
		i++;

		if ((i < params.length) && (params[i] == "ascending" || params[i] == "descending")) {
			 sortAscending = params[i] == "ascending";
			 i++;
		}
	}

	// Parse the script
	var scriptText = null;
	if ((i < params.length) && params[i] == "script") {
		i++;
		scriptText = this.paramEncode((i < params.length) ? params[i] : "");
		i++;
	}

	// Parse the action. 
	// When we are already at the end use the default action
	var actionName = "addToList";
	if (i < params.length) {
	   if (!config.macros.forEachTiddler.actions[params[i]]) {
			this.handleError(place, "Unknown action '"+params[i]+"'.");
			return;
		} else {
			actionName = params[i]; 
			i++;
		}
	} 
	
	// Get the action parameter
	// (the parsing is done inside the individual action implementation.)
	var actionParameter = params.slice(i);


	// --- Processing ------------------------------------------
	try {
		this.performMacro({
				place: place, 
				inTiddler: tiddler,
				whereClause: whereClause, 
				sortClause: sortClause, 
				sortAscending: sortAscending, 
				actionName: actionName, 
				actionParameter: actionParameter, 
				scriptText: scriptText, 
				tiddlyWikiPath: tiddlyWikiPath});

	} catch (e) {
		this.handleError(place, e);
	}
};

// Returns an object with properties "tiddlers" and "context".
// tiddlers holds the (sorted) tiddlers selected by the parameter,
// context the context of the execution of the macro.
//
// The action is not yet performed.
//
// @parameter see performMacro
//
config.macros.forEachTiddler.getTiddlersAndContext = function(parameter) {

	var context = config.macros.forEachTiddler.createContext(parameter.place, parameter.whereClause, parameter.sortClause, parameter.sortAscending, parameter.actionName, parameter.actionParameter, parameter.scriptText, parameter.tiddlyWikiPath, parameter.inTiddler);

	var tiddlyWiki = parameter.tiddlyWikiPath ? this.loadTiddlyWiki(parameter.tiddlyWikiPath) : store;
	context["tiddlyWiki"] = tiddlyWiki;
	
	// Get the tiddlers, as defined by the whereClause
	var tiddlers = this.findTiddlers(parameter.whereClause, context, tiddlyWiki);
	context["tiddlers"] = tiddlers;

	// Sort the tiddlers, when sorting is required.
	if (parameter.sortClause) {
		this.sortTiddlers(tiddlers, parameter.sortClause, parameter.sortAscending, context);
	}

	return {tiddlers: tiddlers, context: context};
};

// Returns the (sorted) tiddlers selected by the parameter.
//
// The action is not yet performed.
//
// @parameter see performMacro
//
config.macros.forEachTiddler.getTiddlers = function(parameter) {
	return this.getTiddlersAndContext(parameter).tiddlers;
};

// Performs the macros with the given parameter.
//
// @param parameter holds the parameter of the macro as separate properties.
//				  The following properties are supported:
//
//						place
//						whereClause
//						sortClause
//						sortAscending
//						actionName
//						actionParameter
//						scriptText
//						tiddlyWikiPath
//
//					All properties are optional. 
//					For most actions the place property must be defined.
//
config.macros.forEachTiddler.performMacro = function(parameter) {
	var tiddlersAndContext = this.getTiddlersAndContext(parameter);

	// Perform the action
	var actionName = parameter.actionName ? parameter.actionName : "addToList";
	var action = config.macros.forEachTiddler.actions[actionName];
	if (!action) {
		this.handleError(parameter.place, "Unknown action '"+actionName+"'.");
		return;
	}

	var actionHandler = action.handler;
	actionHandler(parameter.place, tiddlersAndContext.tiddlers, parameter.actionParameter, tiddlersAndContext.context);
};

// ---------------------------------------------------------------------------
//  The actions 
// ---------------------------------------------------------------------------

// Internal.
//
// --- The addToList Action -----------------------------------------------
//
config.macros.forEachTiddler.actions.addToList.handler = function(place, tiddlers, parameter, context) {
	// Parse the parameter
	var p = 0;

	// Check for extra parameters
	if (parameter.length > p) {
		config.macros.forEachTiddler.createExtraParameterErrorElement(place, "addToList", parameter, p);
		return;
	}

	// Perform the action.
	var list = document.createElement("ul");
	place.appendChild(list);
	for (var i = 0; i < tiddlers.length; i++) {
		var tiddler = tiddlers[i];
		var listItem = document.createElement("li");
		list.appendChild(listItem);
		createTiddlyLink(listItem, tiddler.title, true);
	}
};

abego.parseNamedParameter = function(name, parameter, i) {
	var beginExpression = null;
	if ((i < parameter.length) && parameter[i] == name) {
		i++;
		if (i >= parameter.length) {
			throw "Missing text behind '%0'".format([name]);
		}
		
		return config.macros.forEachTiddler.paramEncode(parameter[i]);
	}
	return null;
}

// Internal.
//
// --- The write Action ---------------------------------------------------
//
config.macros.forEachTiddler.actions.write.handler = function(place, tiddlers, parameter, context) {
	// Parse the parameter
	var p = 0;
	if (p >= parameter.length) {
		this.handleError(place, "Missing expression behind 'write'.");
		return;
	}

	var textExpression = config.macros.forEachTiddler.paramEncode(parameter[p]);
	p++;

	// Parse the "begin" option
	var beginExpression = abego.parseNamedParameter("begin", parameter, p);
	if (beginExpression !== null) 
		p += 2;
	var endExpression = abego.parseNamedParameter("end", parameter, p);
	if (endExpression !== null) 
		p += 2;
	var noneExpression = abego.parseNamedParameter("none", parameter, p);
	if (noneExpression !== null) 
		p += 2;

	// Parse the "toFile" option
	var filename = null;
	var lineSeparator = undefined;
	if ((p < parameter.length) && parameter[p] == "toFile") {
		p++;
		if (p >= parameter.length) {
			this.handleError(place, "Filename expected behind 'toFile' of 'write' action.");
			return;
		}
		
		filename = config.macros.forEachTiddler.getLocalPath(config.macros.forEachTiddler.paramEncode(parameter[p]));
		p++;
		if ((p < parameter.length) && parameter[p] == "withLineSeparator") {
			p++;
			if (p >= parameter.length) {
				this.handleError(place, "Line separator text expected behind 'withLineSeparator' of 'write' action.");
				return;
			}
			lineSeparator = config.macros.forEachTiddler.paramEncode(parameter[p]);
			p++;
		}
	}
	
	// Check for extra parameters
	if (parameter.length > p) {
		config.macros.forEachTiddler.createExtraParameterErrorElement(place, "write", parameter, p);
		return;
	}

	// Perform the action.
	var func = config.macros.forEachTiddler.getEvalTiddlerFunction(textExpression, context);
	var count = tiddlers.length;
	var text = "";
	if (count > 0 && beginExpression)
		text += config.macros.forEachTiddler.getEvalTiddlerFunction(beginExpression, context)(undefined, context, count, undefined);
	
	for (var i = 0; i < count; i++) {
		var tiddler = tiddlers[i];
		text += func(tiddler, context, count, i);
	}
	
	if (count > 0 && endExpression)
		text += config.macros.forEachTiddler.getEvalTiddlerFunction(endExpression, context)(undefined, context, count, undefined);

	if (count == 0 && noneExpression) 
		text += config.macros.forEachTiddler.getEvalTiddlerFunction(noneExpression, context)(undefined, context, count, undefined);
		

	if (filename) {
		if (lineSeparator !== undefined) {
			lineSeparator = lineSeparator.replace(/\\n/mg, "\n").replace(/\\r/mg, "\r");
			text = text.replace(/\n/mg,lineSeparator);
		}
		saveFile(filename, convertUnicodeToUTF8(text));
	} else {
		var wrapper = createTiddlyElement(place, "span");
		wikify(text, wrapper, null/* highlightRegExp */, context.inTiddler);
	}
};


// ---------------------------------------------------------------------------
//  Helpers
// ---------------------------------------------------------------------------

// Internal.
//
config.macros.forEachTiddler.createContext = function(placeParam, whereClauseParam, sortClauseParam, sortAscendingParam, actionNameParam, actionParameterParam, scriptText, tiddlyWikiPathParam, inTiddlerParam) {
	return {
		place : placeParam, 
		whereClause : whereClauseParam, 
		sortClause : sortClauseParam, 
		sortAscending : sortAscendingParam, 
		script : scriptText,
		actionName : actionNameParam, 
		actionParameter : actionParameterParam,
		tiddlyWikiPath : tiddlyWikiPathParam,
		inTiddler : inTiddlerParam, // the tiddler containing the <<forEachTiddler ...>> macro call.
		viewerTiddler : config.macros.forEachTiddler.getContainingTiddler(placeParam) // the tiddler showing the forEachTiddler result
	};
};

// Internal.
//
// Returns a TiddlyWiki with the tiddlers loaded from the TiddlyWiki of 
// the given path.
//
config.macros.forEachTiddler.loadTiddlyWiki = function(path, idPrefix) {
	if (!idPrefix) {
		idPrefix = "store";
	}
	var lenPrefix = idPrefix.length;
	
	// Read the content of the given file
	var content = loadFile(this.getLocalPath(path));
	if(content === null) {
		throw "TiddlyWiki '"+path+"' not found.";
	}
	
	var tiddlyWiki = new TiddlyWiki();

	// Starting with TW 2.2 there is a helper function to import the tiddlers
	if (tiddlyWiki.importTiddlyWiki) {
		if (!tiddlyWiki.importTiddlyWiki(content))
			throw "File '"+path+"' is not a TiddlyWiki.";
		tiddlyWiki.dirty = false;
		return tiddlyWiki;
	}
	
	// The legacy code, for TW < 2.2
	
	// Locate the storeArea div's
	var posOpeningDiv = content.indexOf(startSaveArea);
	var posClosingDiv = content.lastIndexOf(endSaveArea);
	if((posOpeningDiv == -1) || (posClosingDiv == -1)) {
		throw "File '"+path+"' is not a TiddlyWiki.";
	}
	var storageText = content.substr(posOpeningDiv + startSaveArea.length, posClosingDiv);
	
	// Create a "div" element that contains the storage text
	var myStorageDiv = document.createElement("div");
	myStorageDiv.innerHTML = storageText;
	myStorageDiv.normalize();
	
	// Create all tiddlers in a new TiddlyWiki
	// (following code is modified copy of TiddlyWiki.prototype.loadFromDiv)
	var store = myStorageDiv.childNodes;
	for(var t = 0; t < store.length; t++) {
		var e = store[t];
		var title = null;
		if(e.getAttribute)
			title = e.getAttribute("tiddler");
		if(!title && e.id && e.id.substr(0,lenPrefix) == idPrefix)
			title = e.id.substr(lenPrefix);
		if(title && title !== "") {
			var tiddler = tiddlyWiki.createTiddler(title);
			tiddler.loadFromDiv(e,title);
		}
	}
	tiddlyWiki.dirty = false;

	return tiddlyWiki;
};


	
// Internal.
//
// Returns a function that has a function body returning the given javaScriptExpression.
// The function has the parameters:
// 
//	 (tiddler, context, count, index)
//
config.macros.forEachTiddler.getEvalTiddlerFunction = function (javaScriptExpression, context) {
	var script = context["script"];
	var functionText = "var theFunction = function(tiddler, context, count, index) { return "+javaScriptExpression+"}";
	var fullText = (script ? script+";" : "")+functionText+";theFunction;";
	return eval(fullText);
};

// Internal.
//
config.macros.forEachTiddler.findTiddlers = function(whereClause, context, tiddlyWiki) {
	var result = [];
	var func = config.macros.forEachTiddler.getEvalTiddlerFunction(whereClause, context);
	tiddlyWiki.forEachTiddler(function(title,tiddler) {
		if (func(tiddler, context, undefined, undefined)) {
			result.push(tiddler);
		}
	});
	return result;
};

// Internal.
//
config.macros.forEachTiddler.createExtraParameterErrorElement = function(place, actionName, parameter, firstUnusedIndex) {
	var message = "Extra parameter behind '"+actionName+"':";
	for (var i = firstUnusedIndex; i < parameter.length; i++) {
		message += " "+parameter[i];
	}
	this.handleError(place, message);
};

// Internal.
//
config.macros.forEachTiddler.sortAscending = function(tiddlerA, tiddlerB) {
	var result = 
		(tiddlerA.forEachTiddlerSortValue == tiddlerB.forEachTiddlerSortValue) 
			? 0
			: (tiddlerA.forEachTiddlerSortValue < tiddlerB.forEachTiddlerSortValue)
			   ? -1 
			   : +1; 
	return result;
};

// Internal.
//
config.macros.forEachTiddler.sortDescending = function(tiddlerA, tiddlerB) {
	var result = 
		(tiddlerA.forEachTiddlerSortValue == tiddlerB.forEachTiddlerSortValue) 
			? 0
			: (tiddlerA.forEachTiddlerSortValue < tiddlerB.forEachTiddlerSortValue)
			   ? +1 
			   : -1; 
	return result;
};

// Internal.
//
config.macros.forEachTiddler.sortTiddlers = function(tiddlers, sortClause, ascending, context) {
	// To avoid evaluating the sortClause whenever two items are compared 
	// we pre-calculate the sortValue for every item in the array and store it in a 
	// temporary property ("forEachTiddlerSortValue") of the tiddlers.
	var func = config.macros.forEachTiddler.getEvalTiddlerFunction(sortClause, context);
	var count = tiddlers.length;
	var i;
	for (i = 0; i < count; i++) {
		var tiddler = tiddlers[i];
		tiddler.forEachTiddlerSortValue = func(tiddler,context, undefined, undefined);
	}

	// Do the sorting
	tiddlers.sort(ascending ? this.sortAscending : this.sortDescending);

	// Delete the temporary property that holds the sortValue.	
	for (i = 0; i < tiddlers.length; i++) {
		delete tiddlers[i].forEachTiddlerSortValue;
	}
};


// Internal.
//
config.macros.forEachTiddler.trace = function(message) {
	displayMessage(message);
};

// Internal.
//
config.macros.forEachTiddler.traceMacroCall = function(place,macroName,params) {
	var message ="<<"+macroName;
	for (var i = 0; i < params.length; i++) {
		message += " "+params[i];
	}
	message += ">>";
	displayMessage(message);
};


// Internal.
//
// Creates an element that holds an error message
// 
config.macros.forEachTiddler.createErrorElement = function(place, exception) {
	var message = (exception.description) ? exception.description : exception.toString();
	return createTiddlyElement(place,"span",null,"forEachTiddlerError","<<forEachTiddler ...>>: "+message);
};

// Internal.
//
// @param place [may be null]
//
config.macros.forEachTiddler.handleError = function(place, exception) {
	if (place) {
		this.createErrorElement(place, exception);
	} else {
		throw exception;
	}
};

// Internal.
//
// Encodes the given string.
//
// Replaces 
//	 "$))" to ">>"
//	 "$)" to ">"
//
config.macros.forEachTiddler.paramEncode = function(s) {
	var reGTGT = new RegExp("\\$\\)\\)","mg");
	var reGT = new RegExp("\\$\\)","mg");
	return s.replace(reGTGT, ">>").replace(reGT, ">");
};

// Internal.
//
// Returns the given original path (that is a file path, starting with "file:")
// as a path to a local file, in the systems native file format.
//
// Location information in the originalPath (i.e. the "#" and stuff following)
// is stripped.
// 
config.macros.forEachTiddler.getLocalPath = function(originalPath) {
	// Remove any location part of the URL
	var hashPos = originalPath.indexOf("#");
	if(hashPos != -1)
		originalPath = originalPath.substr(0,hashPos);
	// Convert to a native file format assuming
	// "file:///x:/path/path/path..." - pc local file --> "x:\path\path\path..."
	// "file://///server/share/path/path/path..." - FireFox pc network file --> "\\server\share\path\path\path..."
	// "file:///path/path/path..." - mac/unix local file --> "/path/path/path..."
	// "file://server/share/path/path/path..." - pc network file --> "\\server\share\path\path\path..."
	var localPath;
	if(originalPath.charAt(9) == ":") // pc local file
		localPath = unescape(originalPath.substr(8)).replace(new RegExp("/","g"),"\\");
	else if(originalPath.indexOf("file://///") === 0) // FireFox pc network file
		localPath = "\\\\" + unescape(originalPath.substr(10)).replace(new RegExp("/","g"),"\\");
	else if(originalPath.indexOf("file:///") === 0) // mac/unix local file
		localPath = unescape(originalPath.substr(7));
	else if(originalPath.indexOf("file:/") === 0) // mac/unix local file
		localPath = unescape(originalPath.substr(5));
	else // pc network file
		localPath = "\\\\" + unescape(originalPath.substr(7)).replace(new RegExp("/","g"),"\\");	
	return localPath;
};

// ---------------------------------------------------------------------------
// Stylesheet Extensions (may be overridden by local StyleSheet)
// ---------------------------------------------------------------------------
//
setStylesheet(
	".forEachTiddlerError{color: #ffffff;background-color: #880000;}",
	"forEachTiddler");

//============================================================================
// End of forEachTiddler Macro
//============================================================================


//============================================================================
// String.startsWith Function
//============================================================================
//
// Returns true if the string starts with the given prefix, false otherwise.
//
version.extensions["String.startsWith"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
String.prototype.startsWith = function(prefix) {
	var n =  prefix.length;
	return (this.length >= n) && (this.slice(0, n) == prefix);
};



//============================================================================
// String.endsWith Function
//============================================================================
//
// Returns true if the string ends with the given suffix, false otherwise.
//
version.extensions["String.endsWith"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
String.prototype.endsWith = function(suffix) {
	var n = suffix.length;
	return (this.length >= n) && (this.right(n) == suffix);
};


//============================================================================
// String.contains Function
//============================================================================
//
// Returns true when the string contains the given substring, false otherwise.
//
version.extensions["String.contains"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
String.prototype.contains = function(substring) {
	return this.indexOf(substring) >= 0;
};

//============================================================================
// Array.indexOf Function
//============================================================================
//
// Returns the index of the first occurance of the given item in the array or 
// -1 when no such item exists.
//
// @param item [may be null]
//
version.extensions["Array.indexOf"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
Array.prototype.indexOf = function(item) {
	for (var i = 0; i < this.length; i++) {
		if (this[i] == item) {
			return i;
		}
	}
	return -1;
};

//============================================================================
// Array.contains Function
//============================================================================
//
// Returns true when the array contains the given item, otherwise false. 
//
// @param item [may be null]
//
version.extensions["Array.contains"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
Array.prototype.contains = function(item) {
	return (this.indexOf(item) >= 0);
};

//============================================================================
// Array.containsAny Function
//============================================================================
//
// Returns true when the array contains at least one of the elements 
// of the item. Otherwise (or when items contains no elements) false is returned.
//
version.extensions["Array.containsAny"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
Array.prototype.containsAny = function(items) {
	for(var i = 0; i < items.length; i++) {
		if (this.contains(items[i])) {
			return true;
		}
	}
	return false;
};


//============================================================================
// Array.containsAll Function
//============================================================================
//
// Returns true when the array contains all the items, otherwise false.
// 
// When items is null false is returned (even if the array contains a null).
//
// @param items [may be null] 
//
version.extensions["Array.containsAll"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
Array.prototype.containsAll = function(items) {
	for(var i = 0; i < items.length; i++) {
		if (!this.contains(items[i])) {
			return false;
		}
	}
	return true;
};


} // of "install only once"

// Used Globals (for JSLint) ==============
// ... DOM
/*global 	document */
// ... TiddlyWiki Core
/*global 	convertUnicodeToUTF8, createTiddlyElement, createTiddlyLink, 
			displayMessage, endSaveArea, hasClass, loadFile, saveFile, 
			startSaveArea, store, wikify */
//}}}


/***
!Licence and Copyright
Copyright (c) abego Software ~GmbH, 2005 ([[www.abego-software.de|http://www.abego-software.de]])

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.

Neither the name of abego Software nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
***/

[[J.R. Roth, "Genetic Adaptation: A New Piece for a Very Old Puzzle", Current Biology 20 R15-R17 (2010)|http://rothlab.ucdavis.edu/publications/roth_2010.pdf]]

Does stress create mutations or only serve as an agent of natural selection? New experiments reveal effects of transcription and temperature on the response to growth limitation and could help resolve a 150-year-old debate.
[[John R. Roth (2011) Predicting the Future: A Fish Story, Ch. 33, The Lure of Bacterial Genetics: a Tribute to John Roth, eds. S. Maloy, K.T.Hughes & J.Casadesus, ASM Press, Washington, DC, 343-348.|http://rothlab.ucdavis.edu/publications/FishStory.pdf]]

Prokaryotic genetics has an illustrious past. In its early days, it helped us learn how genetic information is stored, replicated, repaired and expressed. These questions were of importance to science and philosophy even beyond their importance to the general field of biology. “Could man understand his own inheritance?” The lessons learned from bacteria were applied everywhere and the tools that emerged were used to investigate of virtually every aspect of biology. Since those early days, work on prokaryotes became less central to biology as a whole. I think this situation is changing and a very exciting time is on the horizon for those working on the biology of prokaryotes. But first the fish story...

//Salmonella// is unusual among the enteric bacteria in its ability to make B12 (via the //cob// operon) and consume ethanolamine (via the //eut// operon). Both of these molecules are simultaneously required for positive feedback regulation of the //eut// operon. Tetrathionate can be used as an electron acceptor during anaerobic ethanolamine consumption. Although ethanolamine is not an especially good carbon or energy source, //Salmonella// is nevertheless able to make efficient use of it by first inducing gut inflammation, which initiates a chain of oxidation taking hydrogen sulfide to thiosulfate to tetrathionate. The inflammed host tissue also releases copious amounts of ethanolamine, providing a nourishing soup for //Salmonella// with no benefit to competing bacteria. (see [[Thiennimitr et al 2011|http://rothlab.ucdavis.edu/publications/huseby_2011.pdf]])
[[A.B. Reams, E.C. Kofoid, M. Savageau & J.R. Roth, "Duplication Frequency in a Population Rapidly Approaches Steady State with or without Recombination", Genetics 184 1077-1094 2010|http://rothlab.ucdavis.edu/publications/Reams_2010.pdf]]

Tandem duplications are among the most common mutation events.  The high loss rate of duplication suggested that the frequency of duplications in a bacterial population (1/1000) might reflect a steady state dictated by relative rates of formation (kF) and loss (kL).  This possibility was tested for three genetic loci.  Without homologous recombination (~RecA), duplication loss rate dropped essentially to zero, but formation rate decreased only slightly and a steady state was still reached rapidly.  Under all conditions, steady state was reached faster than predicted by formation and loss rates alone.   A major factor in determining steady state proved to be the fitness cost, which can exceed 40% for some genomic regions.  Depending on the region tested, duplications reached 40% to 98% of the steady-state frequency within 30 generations – approximately the growth required for a single cell to produce a saturated overnight culture or form a large colony on solid medium (109 cells).   Long-term bacterial populations are stably polymorphic for duplications of every region of their genome.  These polymorphisms contribute to rapid genetic adaptation by providing frequent pre-existing beneficial mutations whenever imposed selection favors increases in some gene activity.  While the reported results were obtained with the bacterium //S. enterica//, the genetic implications seem likely to of broader biological relevance.
[[E. Kugelberg, E.C. Kofoid, D.I. Andersson, Y. Lu, J. Mellor, F.P. Roth & J.R. Roth, "The tandem inversion-duplications in Salmonella enterica (TID):  Selection drives unstable precursors to complete mutation types", Genetics 185 65-80 (2010)|http://rothlab.ucdavis.edu/publications/Kugelberg_2010.pdf]]

During prolonged starvation under selection for improved growth, bacterial cultures give rise to mutations that are rarely encountered during standard laboratory experiments.  The novel types have been interpreted as reflecting either a) stress-induced new mutations that restore full growth ability or b) pre-existing mutations that allow slow growth and genetic improvement under selective conditions.  One type is the previously described SJ (short junction) duplication which has a short repeated sequence element at their join point AB*(CD)*(CD)*EF, where (* = few bases).  A second type, described here, is the tandem inversion-duplication (TID), in which two copies of a multi-gene parent sequence flank a larger central inverse-order segment -- example: AB(CD)(E’D’C’B’)(CD)F.  Both duplication types can be amplified by unequal exchanges between the flanking direct repeats (CD).  An SJ amplification is of the form AB*[(CD)*]n(CD)*EF and a TID amplification has the form – for example AB[(CD)(E’D’C’B’)]n(CD)EF.   Both were identified following prolonged selection for improved growth on lactose. 

Thirteen TID junction sequences are described -- twelve from selected lac amplifications and one from an unselected lac duplication.  The observed junctions are asymmetric (aTID) and are proposed to form when deletions modify a frequent symmetrical precursor (sTID) -- e.g. ABCD(D’C’B’A’)ABCD.  The proposed initial structure forms frequently but is usually lost due to its inherent instability and fitness cost (due stem-loop formation at the junctions).  Selection for increased lac expression maintains an sTID that includes lac and favors sequential deletions that render each junction asymmetric (aTID), thereby allowing higher lac amplification.  Removal of both junctions by a single deletion event can produce a simple tandem duplication (SJ), described in previous publications.  Each step in the formation of SJ and aTID amplifications provides some growth improvement, allowing selection to drive the rearrangement process to completion.  
[[W. Paulander, D.I. Andersson & Sophie Maisnier-Patin, "Amplification of the gene for isoleucyl-tRNA synthetase facilitates adaptation to the fitness cost of mupirocin resistance in Salmonella enteric" Genetics 185 305-312 (2010)|http://mollycat.ucdavis.edu/wordpress/blinks/pdfs11-2-2009/paulander_2010.pdf]]

Mutations that cause resistance to antibiotics in bacteria often reduce growth rate by impairing some essential cellular function.  This growth impairment is expected to counter-select resistant organisms from natural populations following discontinuation of antibiotic therapy.  Unfortunately (for disease control) bacteria adapt and improve their growth rate, often without losing antibiotic resistance.  This adaptation process was studied in mupirocin-resistant (~MupR) strains of //Salmonella enterica//.  Mupirocin (Mup) is an isoleucyl-adenylate analogue that inhibits the essential enzyme, isoleucyl-tRNA synthetase (~IleRS).   Mutations causing ~MupR alter ~IleRS and reduce growth rate.  Fitness is restored by any of 23 secondary ~IleS amino acid substitutions, sixty percent of which leave resistance unaffected.  Evidence is presented that increased expression of the original mutant //ileS// gene (~MupR) also improves fitness while maintaining resistance.  Expression can be increased by amplification of the //ileS// gene (more copies) or mutations that improve the //ileS// promoter (more transcription).   Some adapted strains show both //ileS// amplification and an improved promoter.   This suggests a process of adaptation initiated by common amplifications and followed by later acquisition of rare point mutations. Finally, a point mutation in one copy relaxes selection and allows loss of defective //ileS// copies.  This sequence of events is demonstrated experimentally.  A better understanding of adaptation can explain why antibiotic resistance persists in bacterial populations and may help identify drugs that are least subject to this problem. 
Reference sequence. The known primary structure of the parental DNA being analyzed by Illumina technology. Because the individual tracts (”reads“) determined by this methodology are so short, it is difficult to assemble a de novo genome sequence from them, but quite easy to position them along a previously determined sequence.

Read pair. The basic datum of Illumina sequencing, namely, the terminal 25 to 36 nucleotide tracts of a randomly sheared piece of DNA, typically 300 bp long. Tens of millions of such data are generated in a typical Illumina run.

Mated pair. Common synonym in the literature for read pair

Anomalous pairs. Read pairs which do not align properly with the reference sequence are often simply irrelevant artifacts. Those which are not artifactual are called anomalous and are by definition interesting. Since we never know the actual orientation of either read, we arbitrarily place the read with the smaller reference address on the left.

Anomalous types. Our collaborator, Yong Liu, has classified anomalous read pairs into four categories:

Type 1 (”Black”). As expected for “normal” read pairs — one maps to the positive strand and the other to the negative with correct relative order, but the separation on the reference sequence is greater the size of the sheared DNA (~300 bp). Predicts a deletion between the two reads.
Type 2 (”Green”). Again, one read maps to the positive strand and the other to the negative, but this time with reversed relative order. Predicts a tandem duplication joint.
Type 3 (”Red”). Both reads map to the positive strand. This predicts a convergent inversion point with the second read flipped.
Type 4 (”Blue”). Both reads map to the negative strand. This predicts a divergent inversion point with the first read flipped.
Clusters. A group of read pairs of one type in which all reads are distinguishable, with those on the left concentrated near each other, and those on the right similarly grouped. Such a cluster is not likely to be composed of artifacts. We infer from it a subpopulation of rearranged DNA. Because each read can have a reference address lying anywhere along the chromosome or plasmid (size L), read pairs can be mapped onto an L x L graph. A cluster appears as a localized congregation of points on such a graph.

Here are examples of blue and red clusters in the F’128(FC40) molecule of LT2 strain TT24815:
The known primary structure of the parental DNA being analyzed by Illumina technology. Because the individual tracts ("//[[reads|Read]]//") determined by this methodology are so short, it is difficult to assemble a //de novo// genome sequence from them, but quite easy to position the //[[reads|Read]]// along a previously determined @@color(blue)://reference sequence//@@.
A //[[read|Read]]// is the basic datum of Illumina sequencing, namely, the terminal 25 to 36 nucleotide tracts of a randomly sheared piece of DNA, typically 300 bp long. Tens of millions of such data are generated in a typical Illumina run.
<<tiddler [[Read pair]]>> 

A synonym of //[[read pair|Read pair]]//.
[[Read pairs|Read pair]] which do not align properly with the reference sequence are often simply irrelevant artifacts. Those which are not artifactual are called //[[anomalous|Anomalous types]]// and are by definition interesting. Since we never know the actual orientation of either //[[read|Read]]//, we arbitrarily place the //[[read|Read]]// with the smaller //[[reference|Reference sequence]]// address on the left.
Our collaborator, Yong Liu, has classified //[[anomalous read pairs|Anomalous pairs]]// into four categories:

    * //Type 1 ("Black")//. As expected for "normal" //[[read pairs|Read pair]]// — one //[[read|Read]]// maps to the positive strand and the other to the negative with correct relative order, but the separation on the //[[reference sequence|Reference sequence]]// is greater the size of the sheared DNA (~300 bp). Predicts a deletion between the two reads.
    * //Type 2 ("Green")//. Again, one //[[read|Read]]// maps to the positive strand and the other to the negative, but this time with reversed relative order. Predicts a tandem duplication joint.
    * //Type 3 ("Red")//. Both //[[reads|Read]]// map to the positive strand. This predicts a //[[convergent inversion join point|Convergent join]]// with the second //[[read|Read]]// flipped.
    * //Type 4 ("Blue")//. Both //[[reads|Read]]// map to the negative strand. This predicts a //[[divergent inversion join point|Divergent join]]// with the first //[[read|Read]]// flipped.
A group of //[[read pairs|Read pair]]// of one type in which all //[[reads|Read]]// are distinguishable, with those on the left concentrated near each other, and those on the right similarly grouped. Such a @@color(blue)://cluster//@@ is not likely to be composed of artifacts. We infer from it a subpopulation of rearranged DNA. Because each read can have a //[[reference|Reference sequence]]// address lying anywhere along the chromosome or plasmid (size L), //[[read pairs|Read pair]]// can be mapped onto an L x L graph. A @@color(blue)://cluster//@@ appears as a localized congregation of points on such a graph.
The difference between the left and right addresses of a read pair. This measurement is used in the analysis of a read-pair cluster to determine whether it results from a fixed join point. //Diff// has been discussed at length in the [[The Radio|http://mollycat.ucdavis.edu/wordpress/?p=538]]. Briefly, if //diff// graphs of the clustered data have slope -2, then the read pairs probably have randomly sheared ends and are characterized by a common join point.
<<tiddler [[Read pair]]>> 

A synonym of //[[read pair|Read pair]]//.
A set of two //[[reads|Read]]// corresponding to the sequences determined at opposite ends of the same piece of sheared DNA. This is the basic data set generated by Illumina sequencing. <<tiddler Read>>
The point of intersection of two inverted sequences whose addresses increase as the point is approached.


[img[Convergent Join|cctiddly/pics/convergent_joint.png]]
The point of intersection of two inverted sequences whose addresses decrease as the point is approached.


[img[Divergent Join|cctiddly/pics/divergent_joint.png]]
[[S.E. Winter, P. Thiennimitr, M.G. Winter, B.P. Butler, D.L. Huseby, R.W. Crawford, J.M. Russell, C.L. Bevins, L.G. Adams, R.M. Tsolis, J.R. Roth & A.J. Baumler, "Gut inflammation provides a respiratory electron acceptor for Salmonella", Nature 467 426-429 (2010)|http://rothlab.ucdavis.edu/publications/huseby_2010.pdf]]

//Salmonella enterica// serotype Typhimurium (//S. Typhimurium//) causes acute gut inflammation by using its virulence factors to invade the intestinal epithelium and survive in mucosal macrophages. The inflammatory response enhances the transmission success of //S. Typhimurium// by promoting its outgrowth in the gut lumen through unknown mechanisms. Here we show that reactive oxygen species generated during inflammation react with endogenous, luminal sulphur compounds (thiosulphate) to form a new respiratory electron acceptor, tetrathionate. The genes conferring the ability to use tetrathionate as an electron acceptor produce a growth advantage for //S. Typhimurium// over the competing microbiota in the lumen of the inflamed gut. We conclude that //S. Typhimurium// virulence factors induce host-driven production of a new electron acceptor that allows the pathogen to use respiration to compete with fermenting gut microbes. Thus the ability to trigger intestinal inflammation is crucial for the biology of this diarrhoeal pathogen. 
[[J.R. Roth, "The Joys and Terrors of Fast Adaptation:  New findings elucidate antibiotic resistance and natural selection", J Antimicrob Chemother 65 (2010)|http://rothlab.ucdavis.edu/publications/Joys&Terrors.pdf]]

Experiments of Pränting and Andersson demonstrate how bacteria adapt to the growth limitation caused by antibiotic resistance mutations.  The process of adaptation relies on gene copy number changes that arise at high rates, including duplications (10^^-4^^/cell/generation), amplifications (10^^-2^^/cell/generation) and mutant copy loss (10^^-2^^/cell/division).  Reversible increases in copy number improve growth by small steps and provide more targets for rare sequence alterations (10^^-9^^/cell/division) that can stably improve growth.  After sequence alteration, selection favors loss of the still mutant gene copies that accelerated adaptation.  The results strongly support the amplification-reversion model for fast adaptation and argue against the alternative notion of “stress-induced mutagenesis”.
[[P. Thiennimitr, S.E. Winter, M.G.  Winter, M.N.  Xavier, V. Tolstikov, D.L. Huseby, T. Sterzenbach, R.M. Tsolis, J.R. Roth & A.J. Baumler (2011) Intestinal inflammation allows Salmonella to use ethanolamine to compete with the microbiota. PNAS 108 17480-17485 2011|http://rothlab.ucdavis.edu/publications/huseby_2011.pdf]]

Conventional wisdom holds that microbes support their growth in vertebrate hosts by exploiting a large variety of nutrients. We show here that use of a specific nutrient (ethanolamine) confers a marked growth advantage on //Salmonella enterica// serovar Typhimurium (//S.// Typhimurium) in the lumen of the inflamed intestine. In the anaerobic environment of the gut, ethanolamine supports little or no growth by fermentation. However, //S.// Typhimurium is able to use this carbon source by inducing the gut to produce a respiratory electron acceptor (tetrathionate), which supports anaerobic growth on ethanolamine. The gut normally converts ambient hydrogen sulfide to thiosulfate, which it then oxidizes further to tetrathionate during inflammation. Evidence is provided that //S.// Typhimurium’s growth advantage in an inflamed gut is because of its ability to respire ethanolamine, which is released from host tissue, but is not utilizable by competing bacteria. By inducing intestinal inflammation, //S.// Typhimurium sidesteps nutritional competition and gains the ability to use an abundant simple substrate, ethanolamine, which is provided by the host.
This is version <<version>> of ~TiddlyWiki.
...and this is a little extra text added as part of a test!
[[Help Me|Help]]
[[My Blog|http://eck.mic.ucdavis.edu/wordpress]]
[[Roth Blog|http://mollycat.ucdavis.edu/wordpress]]
[[My Tiddly Blog|cctiddly/?workspace=EricNotebook]]

Block formatted equations may also use the 'equation' environment: \begin{equation} \int \tan x = -\ln \cos x \end{equation} 
Another easy integral: \[\int_a^b x = \frac{1}{2}(b^2-a^2)\]
Fractions are straightforward: \[\frac{32}{89}\]

What would I ever use this for?:
\<\<miniBrowser hidecontrols http://mollycat.ucdavis.edu/ReversionModels/pages/3.html\>\> ==> <<miniBrowser hidecontrols http://mollycat.ucdavis.edu/ReversionModels/pages/3.html>>

Push this at your own risk: <<closeAll>> !

Here is a page-by-page rendition of a pdf file:
{{stretch{[img[Walker Comments|cctiddly/pics/DispatchWalkerNew1.pdf]]}}}
{{stretch{[img[Walker Comments|cctiddly/pics/DispatchWalkerNew2.pdf]]}}}
{{stretch{[img[Walker Comments|cctiddly/pics/DispatchWalkerNew3.pdf]]}}}
{{stretch{[img[Walker Comments|cctiddly/pics/DispatchWalkerNew4.pdf]]}}}
{{stretch{[img[Walker Comments|cctiddly/pics/DispatchWalkerNew5.pdf]]}}}
[[D.I. Andersson, D. Hughes & John R. Roth (2011) The Origin of Mutants under Selection: Interactions of Mutation, Growth, and Selection, Chapter 5.6.6, EcoSal -- Escherichia coli and Salmonella: Cellular and Molecular Biology 10.1128, Section Ed. Steven Finkel, http://www.ecosal.org/, ASM Press, Washington, DC.|http://rothlab.ucdavis.edu/publications/OriginMutantASM.pdf]]

Mutation rates are kept low by multiple mechanisms evolved to protect genetic information and these rates are not regulated in response to the physiological needs of the cell. This broadly held consensus rests on classical bacterial experiments interpreted as evidence that selective stress does not alter the mutation process. This is not to say that all repair mechanisms are equally active at all times. For example, mutation-repair mechanisms with different substrate specificities, such as MMR and VSR, are differentially active under different conditions of bacterial growth, although both use the ~MutL protein. The interaction between mutation and selection is complex and has been central to the history of biology. Before publication of Darwin's theory of natural selection, induction of genetic change by environmental stress was a popular idea. Translated into microbiological terms, this idea posited that the stress imposed by growth limitation increases the rate at which new mutations arise (stress-induced mutagenesis). Darwin may have accepted the idea of stress-induced mutation to explain the origin of the variability required for natural selection. However, the lack of experimental evidence on this point contributed to the importance of the classic work of Luria and Delbrück and of the Lederbergs demonstrating that laboratory selections can detect mutant organisms without causing their formation. These experiments validated the use of positive selection, which is fundamental to the whole field of bacterial genetics. The experiments also provided a way to measure the formation rate of mutations during nonselective growth. Later, these classic experiments were more broadly interpreted as support for the current consensus that selective stress does not induce mutations in natural populations.
[[John R. Roth (2011) Giving a Seminar: Suggestions for Graduate Students, Ch. 2, The Lure of Bacterial Genetics: a Tribute to John Roth, eds. S. Maloy, K.T.Hughes & J.Casadesus, ASM Press, Washington, DC, 9-22.|http://rothlab.ucdavis.edu/publications/GivingATalkFinal.pdf]]

 Public speaking shares some features with making love.  There's no absolute standard of how 
to do it well, but there are universally accepted ways to do it badly.  What passes for excellence in 
one situation may be inappropriate in another context.  People who do it well won't tell you how and 
people who are eager to help are often failures in practice.  Even your best friends won’t tell you 
when you do it badly - they will just avoid coming back to repeat the experience.  (Don’t miss the 
metaphor here - this is deep.)

 Expert public speakers may not be able to tell you why they succeed and eager advisors may 
not know what they’re talking about (a caveat to the readers of this essay).   What follows below is 
one person's opinion, not the final answer.  It’s a collection of ideas to consider while developing a 
style of your own.   The opinions presented are strongly held, but change regularly.  This is intended 
for graduate students, but all are welcome.   I hope it works for someone. 
//{{{
config.options.txtFadeTimer = 2000; // ms ... 15 seconds 

function displayMessage(text,linkText,fadeTimer) { 
        var e = getMessageDiv(); 
        if(!e) { 
                alert(text); 
                return; 
        } 
        if(linkText) { 
                var link = createTiddlyElement(e,"a",null,null,text); 
                link.href = linkText; 
                link.target = "_blank"; 
        } else { 
                e.appendChild(document.createTextNode(text)); 
        } 
        if(config.options.txtFadeTimer > 0) { 
                setTimeout(clearMessage, config.options.txtFadeTimer); 
        } 
}
//}}}
frabjalous
[[GettingStarted]]
<<taggedTabs loginBox>>
<<ccUpload>>

[[Dr. Plaxco's paper|pdf/scienceWriting.pdf]]  encapsulates succinctly our philosophy of science writing.
[[S. Quinones-Soto & J.R. Roth (2011) Effect of growth under selection on appearance of chromosomal mutations in Salmonella enterica. Genetics 189:37-53.|http://rothlab.ucdavis.edu/publications/quinones_2011.pdf]]

Populations adapt physiologically using regulatory mechanisms and genetically by means of mutations that improve growth. During growth under selection, genetic adaptation can be rapid. In several genetic systems, the speed of adaptation has been attributed to cellular mechanisms that increase mutation rates in response to growth limitation. An alternative possibility is that growth limitation serves only as a selective agent but acts on small-effect mutations that are common under all growth conditions. The genetic systems that initially suggested stress-induced mutagenesis have been analyzed without regard for multistep adaptation and some include features that make such analysis difficult. To test the selection-only model, a simpler system is examined, whose behavior was originally attributed to stress-induced mutagenesis (Yang et al. 2001, 2006). A population with a silent chromosomal lac operon gives rise to Lac+ revertant colonies that accumulate over 6 days under selection. Each colony contains a mixture of singly and doubly mutant cells. Evidence is provided that the colonies are initiated by pre-existing single mutants with a weak Lac+ phenotype. Under selection, these cells initiate slow-growing clones, in which a second mutation arises and improves growth of the resulting double mutant. The system shows no evidence of general mutagenesis during selection. Selection alone may explain rapid adaptation in this and other systems that give the appearance of mutagenesis.






/*{{{*/
/***** LAYOUT STYLES -  DO NOT EDIT! *****/
ul.suckerfish, ul.suckerfish ul {
	margin: 0;
	padding: 0;
	list-style: none;
	line-height:1.4em;
}

ul.suckerfish  li {
	display: inline-block; 
	display: block;
	float: left; 
}

ul.suckerfish li ul {
	position: absolute;
	left: -999em;
}

ul.suckerfish li:hover ul, ul.suckerfish li.sfhover ul {
	left: auto;
}

ul.suckerfish ul li {
	float: none;
	border-right: 0;
	border-left:0;
}

ul.suckerfish a, ul.suckerfish a:hover {
	display: block;
}

ul.suckerfish li a.tiddlyLink, ul.suckerfish li a, #mainMenu ul.suckerfish li a {font-weight:bold;}
/**** END LAYOUT STYLES *****/


/**** COLORS AND APPEARANCE - DEFAULT *****/
ul.suckerfish li a {
	padding: 0.5em 1.5em;
	color: #FFF;
	background: #0066aa;
	border-bottom: 0;
	font-weight:bold;
}

ul.suckerfish li:hover a, ul.suckerfish li.sfhover a{
	background: #00558F;
}

ul.suckerfish li:hover ul a, ul.suckerfish li.sfhover ul a{
	color: #000;
	background: #eff3fa;
	border-top:1px solid #FFF;
}

ul.suckerfish ul li a:hover {
	background: #e0e8f5;
}

ul.suckerfish li a{
	width:9em;
}

ul.suckerfish ul li a, ul.suckerfish ul li a:hover{
	display:inline-block;
	width:9em;
}

ul.suckerfish li {
	border-left: 1px solid #00558F;
}
/***** END COLORS AND APPEARANCE - DEFAULT *****/


/***** LAYOUT AND APPEARANCE: VERTICAL *****/
ul.suckerfish.vertical li{
	width:10em;
	border-left: 0px solid #00558f;
}

ul.suckerfish.vertical ul li, ul.suckerfish.vertical li a, ul.suckerfish.vertical li:hover a, ul.suckerfish.vertical li.sfhover a {
	border-left: 0.8em solid #00558f;
}

ul.suckerfish.vertical li a, ul.suckerfish.vertical li:hover a, ul.suckerfish.vertical li.sfhover a,  ul.suckerfish.vertical li.sfhover a:hover{
	width:8em;
}

ul.suckerfish.vertical {
	width:10em; 
        text-align:left;
	float:left;
}

ul.suckerfish.vertical li a {
	padding: 0.5em 1em 0.5em 1em;
	border-top:1px solid  #fff;
}

ul.suckerfish.vertical, ul.suckerfish.vertical ul {
	line-height:1.4em;
}

ul.suckerfish.vertical li:hover ul, ul.suckerfish.vertical li.sfhover ul { 
	margin: -2.4em 0 0 10.9em;
}

ul.suckerfish.vertical li:hover ul li a, ul.suckerfish.vertical li.sfhover ul li a {
	border: 0px solid #FFF;
}

ul.suckerfish.vertical li:hover a, ul.suckerfish.vertical li.sfhover a{
	padding-right:1.1em;
}

ul.suckerfish.vertical li:hover ul li, ul.suckerfish.vertical li.sfhover ul li {
	border-bottom:1px solid  #fff;
}

/***** END LAYOUT AND APPEARANCE: VERTICAL *****/
/*}}}*/
* HelloThere
** [[Current|HelloThere]]
** [[Notes|NoteHelloThere]]
** [[Proposed|ProHelloThere]]
* Features
** [[Current|Features]]
** [[Notes|NoteFeatures]]
** [[Proposed|ProFeatures]]
* Downloads
** [[Current|Downloads]]
** [[Notes|NoteDownloads]]
** [[Proposed|ProDownloads]]
* Forum
** [[Current|Forum]]
** [[Notes|NoteForum]]
** [[Proposed|ProForum]]
* Get Involved
** [[Current|Get Involved]]
** [[Notes|NoteGet Involved]]
** [[Proposed|Get Involved]]
* Ideas
** [[Current|Ideas]]
** [[Notes|NoteIdeas]]
** [[Proposed|ProIdeas]]
* Add-ons
** [[Current|Add-ons]]
** [[Notes|NoteAdd-ons]]
** [[Proposed|ProAdd-ons]]
* Wiki
** [[Current|Wiki]]
** [[Notes|NoteWiki]]
** [[Proposed|ProWiki]]
* Blog
** [[Current|Blog]]
** [[Notes|NoteBlog]]
** [[Proposed|ProBlog]]
<<dropMenu>>
/% %/
/*{{{*/
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)';}
/*}}}*/
This is a testable model for TID formation involving snapback of a freed 3' end at a short inverted repeat, forming a stem-loop structure which initiates DNA synthesis using self as template. A subsequent strand switch event restores correct template decoding. These two events yield duplicated elements flanking an inverted element with nearly perfect palindromic sequences at the joints. 
[img(400px,auto)[TID Formation by Snapback|cctiddly/pics/snapback_model.jpg]]
"SJ" is an acronym for "Short Junction". These are joints of shared identity between inverted duplicated elements, and are typically from 0 to 35 bp long. They are predicted to result from asymmetric deletions across lengthy palindromes occurring in symmetric [[TIDs|TID]].
When a short inverted repeat occurs at the 3' end of single-stranded DNA, it can fold back on itself, forming a "snapback" which can then initiate DNA synthesis using self as a template. Snapbacks have been invoked as an initiating feature in the [[formation of TIDs|TID Formation by Snapback]].
[img(300px,auto)[Snapback Formation|cctiddly/pics/snapback.jpg]]
[[Bergthorsson, U., Andersson, D.I. and Roth, J.R.  (2007)  Ohno’s dilemma:  Evolution of new genes under continuous selection.  Proc. Natl Acad Sci 104: 17004-9. |http://rothlab.ucdavis.edu/publications/bergthorsson_2007.pdf]]

New genes with novel functions arise by duplication and divergence, but the process poses a problem. After duplication, an extra gene copy must rise to sufficiently high frequency in the population and remain free of common inactivating lesions long enough to acquire the rare mutations that provide a new selectable function. Maintaining a duplicated gene by selection for the original function would restrict the freedom to diverge. (We refer to this problem as Ohno’s dilemma). A model is described by which selection continuously favors both maintenance of the duplicate copy and divergence of that copy from the parent gene. Before duplication, the original gene has a trace side activity (the innovation) in addition to its original function. When an altered ecological niche makes the minor innovation valuable, selection favors increases in its level (the amplification), which is most frequently conferred by increased dosage of the parent gene. Selection for the amplified minor function maintains the extra copies and raises the frequency of the amplification in the population. The same selection favors mutational improvement of any of the extra copies, which are not constrained to maintain their original function (the divergence). The rate of mutations (per genome) that improve the new function is increased by the multiplicity of target copies within a genome. Improvement of some copies relaxes selection on others and allows their loss by mutation (becoming pseudogenes). Ultimately one of the extra copies is able to provide all of the new activity.
[[Wrande M, Roth J.R, Hughes D. (2008) Accumulation of mutants in "aging" bacterial colonies is due to growth under selection, not stress-induced mutagenesis. Proc Natl Acad Sci U S A. 105:11863–11868.|http://rothlab.ucdavis.edu/publications/wrande_2008.pdf]]

Several bacterial systems show behavior interpreted as evidence for stress-induced mutagenesis (adaptive mutation), a postulated process by which nongrowing cells temporarily increase their general mutation rate. Theoretical considerations suggest that periodic stress-induced general mutagenesis would not be advantageous in the long term, due to the high cost of deleterious mutations. Alternative explanations have been tested for very few of the systems used as evidence for stress-induced mutation. In one prominent system, mutants resistant to rifampicin (~RifR; rpoB; RNA polymerase) accumulate in cell populations that ‘‘age’’ on solid medium with little net growth. Mutant accumulation was initially attributed to stress-induced general mutagenesis in nongrowing cells. Evidence is presented that these ~RifR mutants accumulate because they grow faster than parent cells during the aging period. Direct tests revealed no increase in the frequency of other mutant types during the aging period.
[[Quinones-Soto,S., Reams, A.B. and Roth, J.R. (2012) Pathways of genetic adaptation: Multistep origin of mutants under selection without induced mutagenesis in Salmonella enterica. Genetics 192:987-999. | http://rothlab.ucdavis.edu/publications/SemarhyTwo.pdf]]

In several bacterial systems, mutant cell populations plated on growth-restricting medium give rise to revertant colonies that accumulate over several days. One model suggests that nongrowing parent cells mutagenize their own genome and thereby create beneficial mutations (stress-induced mutagenesis). By this model, the first-order induction of new mutations in a nongrowing parent cell population leads to the delayed accumulation of visible colonies. In an alternative model (selection only), selective conditions allow preexisting small-effect mutants to initiate clones that grow and give rise to faster-growing mutants. By the selection-only model, the delay in appearance of revertant colonies reflects (1) the time required for initial clones to reach a size sufficient to allow the second mutation plus (2) the time required for growth of the improved subclone. We previously characterized a system in which revertant colonies accumulate slowly and contain cells with two mutations, one formed before plating and one after. This left open the question of whether mutation rates increase under selection. Here we measure the unselected formation rate and the growth contribution of each mutant type. When these parameters are used in a graphic model of revertant colony development, they demonstrate that no increase in mutation rate is required to explain the number and delayed appearance of two of the revertant types.
[[Kofoid, E., Bergthorsson, U., Slechta, E. S., and Roth, J.R.2002) Formation of an F' plasmid by recombination between imperfectly repeated chromosomal Rep(BIME) sequence: A closer look at an old friend (F'128 pro lac). J. Bacteriol. 185:660-663. |http://rothlab.ucdavis.edu/publications/f128-2003.pdf]]

Plasmid F'128 was formed by an exchange between chromosomal Rep sequences that placed lac near dinB between many pairs of Rep sequences. Plasmid F'128 is critical for selection-enhanced lac reversion (adaptive mutation), which requires prior lac amplification. The structure of F'128 supports the idea that amplification is initiated by ~Rep-Rep recombination and that general mutagenesis requires coamplification of dinB (error-prone polymerase) with lac.
[[Kugelberg, E., Kofoid. E., Reams, A.B., Andersson, D.I. and J.R. Roth (2006) Multiple pathways of selected gene amplification during adaptive mutation. Proc Natl Acad Sci 103:17319-24. |http://rothlab.ucdavis.edu/publications/KugelbergPNAS.pdf]]

In a phenomenon referred to as "adaptive mutation," a population of bacterial cells with a mutation in the lac operon (lac^^-^^) accumulates Lac^^+^^ revertants during prolonged exposure to selective growth conditions (lactose). Evidence was provided that selective conditions do not increase the mutation rate but instead favor the growth of rare cells with a duplication of the leaky lac allele. A further increase in copy number (amplification) improves growth and increases the likelihood of a sequence change by adding more mutational targets to the clone (cells and lac copies per cell). These duplications and amplifications are described here. Before selection, cells with large (134-kb) lac duplications and long junction sequences (>1 kb) were common (0.2%). The same large repeats were found after selection in cells with a low-copy-number lac amplification. Surprisingly, smaller repeats (average, 34 kb) were found in high-copy-number amplifications. The small-repeat duplications form when deletions modify a preexisting large-repeat duplication. The shorter repeat size allowed higher lac amplification and better growth on lactose. Thus, selection favors a succession of gene-amplification types that make sequence changes more probable by adding targets. These findings are relevant to genetic adaptation in any biological systems in which fitness can be increased by adding gene copies (e.g., cancer and bacterial drug resistance).
[[Reams, A.B., Kofoid E., Kugelberg E., Roth J.R. (2012) Multiple pathways of duplication formation with and without recombination (RecA) in Salmonella enterica. Genetics 192:397-415. |http://rothlab.ucdavis.edu/publications/DrewTwo.pdf]]

Duplications are often attributed to “unequal recombination” between separated, directly repeated sequence elements (~100 bp), events that leave a recombinant element at the duplication junction. However, in the bacterial chromosome, duplications form at high rates (1023–1025/cell/division) even without recombination (~RecA). Here we describe 1800 spontaneous lac duplications trapped nonselectively on the low-copy F9128 plasmid, where lac is flanked by direct repeats of the transposable element ~IS3 (1258 bp) and by numerous quasipalindromic REP elements (30 bp). Duplications form at a high rate (1024/cell/division) that is reduced only about 11-fold in the absence of ~RecA. With and without ~RecA, most duplications arise by recombination between ~IS3 elements (97%). Formation of these duplications is stimulated by ~IS3 transposase (Tnp) and plasmid transfer functions (~TraI). Three duplication pathways are proposed. First, plasmid dimers form at a high rate stimulated by ~RecA and are then modified by deletions between ~IS3 elements (resolution) that leave a monomeric plasmid with an ~IS3-flanked lac duplication. Second, without ~RecA, duplications occur by singlestrand annealing of DNA ends generated in different sister chromosomes after transposase nicks DNA near participating ~IS3 elements. The absence of ~RecA may stimulate annealing by allowing chromosome breaks to persist. Third, a minority of lac duplications (3%) have short (0–36 bp) junction sequences (SJ), some of which are located within REP elements. These duplication types form without ~RecA, Tnp, or Tra by a pathway in which the palindromic junctions of a tandem inversion duplication (TID) may stimulate deletions that leave the final duplication.
[[Reams, A.B., Kofoid, E. Duleba, N. and J. R. Roth (2014) Recombination and annealing pathways compete for substrates in making rrn duplications in Salmonella enterica Genetics 196: 1–17. |http://rothlab.ucdavis.edu/publications/DrewThree.pdf]]

Tandem genetic duplications arise frequently between the seven directly repeated 5.5-kb rrn loci that encode ribosomal ~RNAs in Salmonella enterica. The closest rrn genes, rrnB and rrnE, flank a 40-kb region that includes the purHD operon. Duplications of purHD arise by exchanges between rrn loci and form at a high rate (1023/cell/division) that remains high in strains blocked for early steps in recombination (recA, recB, and/or recF), but drops 30-fold in mutants blocked for later Holliday junction resolution (ruvC recG). The duplication defect of a ruvC recG mutant was fully corrected by an added mutation in any one of the recA, recB, or recF genes. To explain these results, we propose that early recombination defects activate an alternative single-strand annealing pathway for duplication formation. In wild-type cells, rrn duplications form primarily by the action of ~RecFORA on single-strand gaps. Double-strand breaks cannot initiate rrn duplications because rrn loci lack Chi sites, which are essential for recombination between two separated rrn sequences. A recA or recF mutation allows unrepaired gaps to accumulate such that different rrn loci can provide single-strand rrn sequences that lack the ~RecA coating that normally inhibits annealing. A recB mutation activates annealing by allowing double-strand ends within rrn to avoid digestion by ~RecBCD and provide a new source of rrn ends for use in annealing. The equivalent high rates of rrn duplication by recombination and annealing pathways may reflect a limiting economy of gaps and breaks arising in heavily transcribed, palindrome-rich rrn sequences.
[[Reams, A. B. and J. R. Roth (2014) "Mechanisms of Gene Duplication and Amplification" In: Recombination Mechanisms (in press) Editors: Stephen Kowalczykowski, Neil Hunter and Wolf Heyer Cold Spring Harbor Laboratory Press, Spring Harbor, NY. |http://rothlab.ucdavis.edu/publications/CSH-WolfLast.pdf]]

Changes in gene copy number are among the most frequent mutational events in all genomes and were among the mutations for which a physical basis was first known. Yet mechanisms of gene duplication remain uncertain, because formation rates are difficult to measure and mechanisms may vary with position in a genome. Duplications are compared here to deletions, which seem formally similar, but can arise at very different rates by distinct mechanisms. Methods of assessing duplication rates and dependencies are described with several proposed formation mechanism. Emphasis is placed on duplications formed in extensively studied experimental situations. Duplications studied in microbes are compared to those observed in metazoan cells. Duplications and especially their derived amplifications are suggested to form by multi-step processes often under positive selection for increased copy number.
[[Sano, E., S. Maisnier-Patin, J. P. Aboubechara, S. Quinones-Soto, John R. Roth (2014) Plasmid copy number underlies adaptive mutability in bacteria, Genetics (in press). |http://rothlab.ucdavis.edu/publications/Sano_2014.pdf]]

The origin of mutations under selection has been intensively studied using the Cairns system, in which cells of an //E. coli// //lac// mutant are plated on lactose and give rise to 100 Lac^^+^^ revertants over several days. These revertants have been attributed variously to stress-induced mutagenesis of non-growing cells or to selective improvement of pre-existing weakly Lac^^+^^ cells with no mutagenesis. Most revertant colonies (90%) contain stably Lac^^+^^ cells, while others (10%) contain cells with an unstable amplification of the leaky mutant //lac// allele. Evidence is presented that both stable and unstable Lac^^+^^ revertant colonies are initiated by pre-existing cells with multiple copies of the F’//lac// plasmid, which carries the mutant //lac// allele. The tetracycline analogue ~AnTc inhibits growth of cells with multiple copies of the //tetA// gene. Populations with //tetA// on their F’//lac// plasmid include rare cells with an elevated plasmid copy number and multiple copies of both the //tetA// and //lac// genes. Pre-growth of such populations with ~AnTc reduces the number of cells with multiple F’//lac// copies and consequently the number of Lac^^+^^ colonies appearing under selection. Revertant yield is restored rapidly by a few generations of growth without ~AnTc. We suggest that pre-existing cells with multiple F’//lac// copies divide very little under selection but have enough energy to replicate their F’//lac// plasmids repeatedly until reversion initiates a stable Lac^^+^^ colony. Pre-existing cells whose high-copy plasmid includes an internal //lac// duplication grow under selection and produce an unstable Lac^^+^^ colony. In this model, all revertant colonies are initiated by pre-existing cells and cannot be stress-induced.
[[Maisnier-Patin, S. and John R. Roth (2014) The origin of mutants under selection: How natural selection mimics mutagenesis (adaptive mutation) In: Microbial Evolution (in press). ISBN13: 9781621820376, Editor: Howard Ochman. Cold Spring Harbor Laboratory Press, Cold Spring Harbor, NY. |http://rothlab.ucdavis.edu/publications/OchmanCSHRevLatest.pdf]]

Selection detects mutants but does not cause mutations. Contrary to this dictum, Cairns and Foster plated a leaky lac mutant of E. coli on lactose medium and saw revertant (Lac^^+^^) colonies accumulate with time above the non-growing lawn. This result suggested that bacteria mutagenize their own genome when growth is blocked. However, the conclusion is suspect in the light of recent evidence that revertant colonies are initiated by pre-existing cells with multiple copies the conjugative F’lac plasmid that carries the lac mutation. In some plated cells, the plasmid includes a tandem lac duplication and provides sufficient ~LacZ to support slow growth leading to an unstable Lac^^+^^ colony. Other plated cells have multiple copies of a simple F’lac and sufficient ~LacZ activity for plasmid replication but not cell division. Repeated plasmid replication in non-growing cells increases the likelihood of a reversion event. Reversion to lac^^+^^ triggers exponential cell growth leading to a stable Lac^^+^^ revertant colony. Cells with multiple copies of the F’lac plasmid have an increased mutation rate, because the plasmid encodes the error-prone (mutagenic) DNA polymerase, ~DinB. Without ~DinB, unstable and stable Lac^^+^^ revertant types form in equal numbers and arise with no mutagenesis. Amplification and selection are central to behavior of the ~Cairns-Foster system, while mutagenesis is a system-specific side-effect of dinB-lac co-amplification. Study this system has revealed several general principles: a) In all populations, gene duplications are frequent stable genetic polymorphisms. b) Common near-neutral mutant alleles can gain a positive phenotype when amplified and c) Natural selection can operate without cell division on variability generated by over-replication of local genome sub-regions.
<<forEachTiddler 
    where 
        'tiddler.tags.contains("inpress") || tiddler.tags.contains("submittedPapers")'
    sortBy 
        'tiddler.title'
 >>

<<forEachTiddler 
where 'tiddler.tags.contains("inpress")
>>
Type the text for 'InClauseExamples'
Type the text for 'WhereClauseExamples'
<<tiddler ListTaggedTiddlers with: "inpress">>
[[Sano, E., S. Maisnier-Patin, J. P. Aboubechara, S. Quinones-Soto, John R. Roth (2014) Selected Lac+ revertants in the Cairns system are initiated by pre-existing cells with multiple copies of the F’lac plasmid Genetics (in press). |http://rothlab.ucdavis.edu/publications/SanoRothMs.pdf]]

[[Reams, A. B. and J. R. Roth (2014) "Mechanisms of Gene Duplication and Amplification" In: Recombination Mechanisms (in press) Editors: Stephen Kowalczykowski, Neil Hunter and Wolf Heyer Cold Spring Harbor Laboratory Press, Cold Spring Harbor, NY. |http://rothlab.ucdavis.edu/publications/CSH-WolfLast.pdf]]

[[Maisnier-Patin, S. and John R. Roth (2014) The origin of mutants under selection: How natural selection mimics mutagenesis (adaptive mutation) In: Microbial Evolution (in press). ISBN13: 9781621820376, Editor: Howard Ochman. Cold Spring Harbor Laboratory Press, Cold Spring Harbor, NY. |http://rothlab.ucdavis.edu/publications/OchmanCSHRevLatest.pdf]]
[[Bergthorsson, U., Andersson, D.I. and Roth, J.R. (2007) Ohno’s dilemma: Evolution of new genes under continuous selection. Proc. Natl Acad Sci 104: 17004-9. |http://rothlab.ucdavis.edu/publications/bergthorsson_2007.pdf]]

New genes with novel functions arise by duplication and divergence, but the process poses a problem. After duplication, an extra gene copy must rise to sufficiently high frequency in the population and remain free of common inactivating lesions long enough to acquire the rare mutations that provide a new selectable function. Maintaining a duplicated gene by selection for the original function would restrict the freedom to diverge. (We refer to this problem as Ohno’s dilemma). A model is described by which selection continuously favors both maintenance of the duplicate copy and divergence of that copy from the parent gene. Before duplication, the original gene has a trace side activity (the innovation) in addition to its original function. When an altered ecological niche makes the minor innovation valuable, selection favors increases in its level (the amplification), which is most frequently conferred by increased dosage of the parent gene. Selection for the amplified minor function maintains the extra copies and raises the frequency of the amplification in the population. The same selection favors mutational improvement of any of the extra copies, which are not constrained to maintain their original function (the divergence). The rate of mutations (per genome) that improve the new function is increased by the multiplicity of target copies within a genome. Improvement of some copies relaxes selection on others and allows their loss by mutation (becoming pseudogenes). Ultimately one of the extra copies is able to provide all of the new activity.
<<forEachTiddler 
    where 
        'tiddler.tags.contains("papers")'
    sortBy 
        'tiddler.title'
 >>
<<tagsTree 
menu "" 3 4 index label
>>
/***
|''Name:''|TagsTreePlugin|
|''Description:''|Displays tags hierachy as a tree of tagged tiddlers.<br>Can be used to create dynamic outline navigation.|
|''Version:''|1.0.1|
|''Date:''|Jan 04,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|
!Demo
On the plugin [[homepage|http://visualtw.ouvaton.org/VisualTW.html]] :
*Try to tag some <<newTiddler>> with a tag displayed in the menu and edit MainMenu.
*Look at some tags like [[Plugins]] or [[menu]].
!Installation
#import the plugin,
#save and reload,
#optionally, edit TagsTreeStyleSheet.
! Usage
{{{<<tagsTree>>}}} macro accepts the following //optional// parameters.
|!#|!parameter|!description|!by default|
|1|{{{root}}}|Uses {{{root}}} tag as tree root|- In a //tiddler// content or template : uses the tiddler as root tag.<br>- In the //page// content or template (by ex MainMenu) : displays all untagged tags.|
|2|{{{excludeTag}}}|Excludes all such tagged tiddlers from the tree|Uses default excludeLists tag|
|3|{{{level}}}|Expands nodes until level {{{level}}}.<br>Value {{{0}}} hides expand/collapse buttons.|Nodes are collapsed on first level|
|4|{{{depth}}}|Hierachy depth|6 levels depth (H1 to H6 header styles)|
|5|{{{sortField}}}|Alternate sort field. By example : "index".|Sorts tags and tiddlers alphabetically (on their title)|
|6|{{{labelField}}}|Alertnate label field. By example : "label".|Displays tiddler's title|

!Useful addons
*[[FieldsEditorPlugin]] : //create//, //edit//, //view// and //delete// commands in toolbar <<toolbar fields>>.
*[[TaggerPlugin]] : Provides a drop down listing current tiddler tags, and allowing toggling of tags.
!Advanced Users
You can change the global defaults for TagsTreePlugin, like default {{{level}}} value or level styles, by editing or overriding the first config.macros.tagsTree attributes below.
!Code
***/
//{{{
config.macros.tagsTree = {
	expand : "+",
	collapse : "–",
	depth : 6,
	level : 1,
	sortField : "",	
	labelField : "",
	styles : ["h1","h2","h3","h4","h5","h6"],
	trees : {}
}

config.macros.tagsTree.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
	var root = params[0] ? params[0] : (tiddler ? tiddler.title : null);
	var excludeTag = params[1] ? params[1] : "excludeTagsTree";
	var level = params[2] ? params[2] : config.macros.tagsTree.level;
	var depth = params[3] ? params[3] : config.macros.tagsTree.depth;
	var sortField = params[4] ? params[4] : config.macros.tagsTree.sortField;
	var labelField = params[5] ? params[5] : config.macros.tagsTree.labelField;
	var showButtons = (level>0);
	var id = config.macros.tagsTree.getId(place);
	if (config.macros.tagsTree.trees[id]==undefined) config.macros.tagsTree.trees[id]={};
	config.macros.tagsTree.createSubTree(place,id,root,excludeTag,[],level>0 ? level : 1,depth, sortField, labelField,showButtons);
}

config.macros.tagsTree.createSubTree = function(place, id, root, excludeTag, ancestors, level, depth, sortField, labelField,showButtons){
	var childNodes = root ? this.getChildNodes(root, ancestors) : this.getRootTags(excludeTag);
	var isOpen = (level>0) || (!showButtons);
	if (root && this.trees[id][root]!=undefined) isOpen = this.trees[id][root]; 
	if (root && ancestors.length) {
		var t = store.getTiddler(root);
		if (childNodes.length && depth>0) {
			var wrapper = createTiddlyElement(place , this.styles[Math.min(Math.max(ancestors.length,1),6)-1],null,"branch");
			if (showButtons) {
				b = createTiddlyButton(wrapper, isOpen ? config.macros.tagsTree.collapse : config.macros.tagsTree.expand, null, config.macros.tagsTree.onClick);
				b.setAttribute("treeId",id);
				b.setAttribute("tiddler",root);					
			}
			createTiddlyText(createTiddlyLink(wrapper, root),t&&labelField ? t.fields[labelField] ? t.fields[labelField] : root : root);
		}
		else 
			createTiddlyText(createTiddlyLink(place, root,false,"leaf"),t&&labelField ? t.fields[labelField] ? t.fields[labelField] : root : root);
	}
	if (childNodes.length && depth) {
		var d = createTiddlyElement(place,"div",null,"subtree");
		d.style.display= isOpen ? "block" : "none";
		if (sortField)
			childNodes.sort(function(a, b){
				var fa=a.fields[sortField];
				var fb=b.fields[sortField];
				return (fa==undefined && fb==undefined) ? a.title < b.title ? -1 : a.title > b.title ? 1 : 0 : (fa==undefined && fb!=undefined) ? 1 :(fa!=undefined && fb==undefined) ? -1 : fa < fb ? -1 : fa > fb ? 1 : 0;
			})
		for (var cpt=0; cpt<childNodes.length; cpt++)
			this.createSubTree(d, id, childNodes[cpt].title, excludeTag, ancestors.concat(root), level-1, depth-1, sortField, labelField, showButtons);	
	}	
}

config.macros.tagsTree.onClick = function(e){
	var id = this.getAttribute("treeId");
	var tiddler = this.getAttribute("tiddler");	
	var n = this.parentNode.nextSibling;
	var isOpen = n.style.display != "none";
	if(config.options.chkAnimate && anim && typeof Slider == "function")
		anim.startAnimating(new Slider(n,!isOpen,null,"none"));
	else
		n.style.display = isOpen ? "none" : "block";
	this.firstChild.nodeValue = isOpen ? config.macros.tagsTree.expand : config.macros.tagsTree.collapse;
	config.macros.tagsTree.trees[id][tiddler]=!isOpen;
	return false;
}

config.macros.tagsTree.getChildNodes = function(root ,ancestors){
	var childs = store.getTaggedTiddlers(root);
	var result = new Array();
	for (var cpt=0; cpt<childs.length; cpt++)
		if (childs[cpt].title!=root && ancestors.indexOf(childs[cpt].title)==-1) result.push(childs[cpt]);
	return result;
}

config.macros.tagsTree.getRootTags = function(excludeTag){
	var tags = store.getTags(excludeTag);
	tags.sort(function(a,b) {return a[0].toLowerCase() < b[0].toLowerCase() ? -1 : (a[0].toLowerCase() == b[0].toLowerCase() ? 0 : +1);});
	var result = new Array();
	for (var cpt=0; cpt<tags.length; cpt++) {
		var t = store.getTiddler(tags[cpt][0]);
		if (!t || t.tags.length==0) result.push(t ? t : {title:tags[cpt][0],fields:{}});
	}
	return result;
}

config.macros.tagsTree.getId = function(element){
	while (!element.id && element.parentNode) element=element.parentNode;
	return element.id ? element.id : "<html>";
}

config.shadowTiddlers.TagsTreeStyleSheet = "/*{{{*/\n";
config.shadowTiddlers.TagsTreeStyleSheet +=".leaf, .subtree {display:block; margin-left : 0.5em}\n";
config.shadowTiddlers.TagsTreeStyleSheet +=".subtree {margin-bottom:0.5em}\n";
config.shadowTiddlers.TagsTreeStyleSheet +="#mainMenu {text-align:left}\n";
config.shadowTiddlers.TagsTreeStyleSheet +=".branch .button {border:1px solid #DDD; color:#AAA;font-size:9px;padding:0 2px;margin-right:0.3em;vertical-align:middle;text-align:center;}\n";
config.shadowTiddlers.TagsTreeStyleSheet +="/*}}}*/";

store.addNotification("TagsTreeStyleSheet", refreshStyles); 

config.shadowTiddlers.MainMenu="<<tagsTree>>"

config.shadowTiddlers.PageTemplate = config.shadowTiddlers.PageTemplate.replace(/id='mainMenu' refresh='content' /,"id='mainMenu' refresh='content' force='true' ")

//}}}
<<tagsTree
projects "" 3 4 index label
>>
<<tagsTree
amplification
>>
<<tagsTree
stress
>>
<<tag 'amplification' 'Amplification' ''>>
<<tag 'stress' 'Stress' ''>>
<<tag 'evolution' 'Evolution' ''>>
[[Näsvall, J, L., S. Sun, J. R. Roth, Dan I. Andersson (2012)  Real-time evolution of new genes by innovation, amplification, and divergence.   Science 338:384-387. |http://rothlab.ucdavis.edu/publications/NasvallSunRothAndersson_2102.pdf]]

Gene duplications allow evolution of genes with new functions. Here, we describe the innovation-amplification-divergence (IAD) model in which the new function appears before duplication and functionally distinct new genes evolve under continuous selection. One example fitting this model is a preexisting parental gene in //Salmonella enterica// that has low levels of two distinct activities. This gene is amplified to a high copy number, and the amplified gene copies accumulate mutations that provide enzymatic specialization of different copies and faster growth. Selection maintains the initial amplification and beneficial mutant alleles but is relaxed for other less improved gene copies, allowing their loss. This rapid process, completed in fewer than 3000 generations, shows the efficacy of the IAD model and allows the study of gene evolution in real time.
[[Maisnier-Patin, S. and J. R. Roth (2014) The origin of mutants under selection: The adaptive mutation puzzle In: Encyclopedia of Evolutionary Biology, Section 229. Adaptive Mutations Section, Editor: David Guttman, Elsevier. |http://rothlab.ucdavis.edu/publications/maisnier-patin_puzzle_2014.pdf]]

Classic experiments demonstrate that mutations arise at random with respect to their phenotypic consequences or selective value. More recent experiments has been interpreted as evidence that growth-limited bacteria up-regulate their genome-wide mutation rate and direct mutations preferentially to sites that improve growth (adaptive mutation), a challenge to the accepted dogma. However, natural selection can explain these striking results with no change in mutation rates or specificity if one considers the normal mutation spectrum. Common near-neutral mutant alleles are subject frequent duplication and selective amplification, which improves growth. These two very common mutation types, acting in concert, drive rapid adaptation and give the appearance of mutagenesis.