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
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
<!--}}}-->
To get started with this blank [[TiddlyWiki]], you'll need to modify the following tiddlers:
* [[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* [[MainMenu]]: The menu (usually on the left)
* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
<<importTiddlers>>
<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
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]]
<!--{{{-->
<div class='header' role='banner' 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' role='navigation' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' role='navigation' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' role='complementary' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea' role='main'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
/*{{{*/
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]];}

.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]];}
.readOnly {background:[[ColorPalette::TertiaryPale]];}

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

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

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

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

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

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none !important;}
#displayArea {margin: 1em 1em 0em;}
noscript {display:none;} /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
}
/*}}}*/
<!--{{{-->
<div class='toolbar' role='navigation' 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>
<!--}}}-->
Nothing is solidly known about the ''Age of Legend'', which stretched from millions to hundreds of thousands years ago. It is known for a fact, though, that magical cataclysms raged on planetary scale then, shattering the world's continents into thousands of islands. 

''The Primordial Era'', known only from the scarce mentions from the avatars of the deities, was an incredibly long period of time (as much as such term applied to the half-created world at all) when the gods did battle on their own. There is no established canon as to whom it was they battled: the prevalent opinion since the age of the [[First Empire]] holds that they struggled against the Primordial Evil, the Enemy, but ever since the [[Era of Iconoclasts|Iconoclasm]] alternative opinions have been popular, for instance that the gods battled among themselves (and the Primordial Evil was indeed just a name for a single or a group of gods), or even that the whole process was a dialectic process in which the thesis (static forces of creation) clashed with the antithesis (dynamic forces of change) to produce synthesis (the world of Okoem). Very little direct evidence remains of the Primordial Era and its battles, save for the [[Burning Trail]] - a line of burning steps that trace from the North Pole to the equator, where the walker is said to have ascended: there's a column of fire reaching into the skies there.

It was in the next era, ''the Era of the Battles for the Gods'', that the mortals appeared on the scene. It is said that the gods brought them into Okoem from another world, or perhaps created them as their soldiers. According to the legend, the mortals formed an army led by avatars of the gods, to fight a war against the darkness that lasted hundreds of years, with each race of mortals assigned their place in the ranks by the gods (this legend is especially popular among the elves who subscribe to the ideology of the [[Special Path]] because it legitimizes their claim to superiority as god-given right). No economy existed as such since whatever resources the army possessed were distributed directly by the high command. The Enemy threw his servants against them: vile sentient beasts, monsters that defy description in their vileness, and even traitors from their own ranks, - but they stood firm, and little by little, large battles grew ever less frequent, then the fighting was reduced to skirmishes, and then, by all accounts, the mortals and their godly leaders won.

''The Era of the Founding'' began, as the unified army scattered across the world to taste the fruits of their victory. The world still bore the scars of the war, and the stragglers from the Enemy's forces were commonly encountered, so the Elf central command created a task force from their own numbers to put the world in order, and this began the history of the [[Forest Elves]]. As for the remaining elven commanders, each a great spellcaster, warrior or commander, who could honestly claim they learned from the gods themselves, they turned overnight into nobility, as the units assigned to their leadership settled for peaceful life. Thus was the First Empire founded by the elves of the generation that came to be known as the Progenitors, and who beget the [[High Elf]] culture.

It is said that the most powerful mage among their number became the first Emperor, named Ivan. Others dispute this claim, saying that surely no actual person could be named I-One. Whatever the case, according to the Progenitors, peace didn't last between mortals: the new nobility vied for privilege, status, and profit, and a large share of the formerly unified army left the fledgling Empire to seek their fortunes elsewhere. As hostilities flared into open warfare, time and time again, a Progenitor philosopher (and the progenitor of Okoem philosophers) named Lyubomir posed his famous [Lyubomir question|question]: "If our rulers are objectively good, why do we fight each other?" He reasoned that spells that detect alignment should allow only good people to gain positions of power, and yet the very same people he knew fought side by side against the Enemy were now at each other's throats. By his reasoning, then, the Progenitor generation must have been cursed by their dealings with the Enemy, and was obliged to pass their responsibilities to the younger, unspoiled generations as soon as at all possible. 

Emperor Ivan took this reasoning to heart. By then, he grew increasingly unstable, haunted by visions of slaughter he had to participate in; his noble elven peers and advisors from the Progenitor generation especially drew his suspicion and ire, which earned him a nickname Ivan the Terrible. He took to divination, penning a tome of doomsaying prophesies known simply as The Lamentations of Ivan, which High Elves have claimed to be finally coming to fruition each time their society met with serious trouble. Ivan himself is said to have lost all desire to rule when increasingly devious attempts at his life became a common occurance, so he retired from the throne to grow cabbages, passing the fledgling empire to his son, Vsevolod.

Iconoclast order
The Dark Elves value knowledge above all else. To ensure they are not disturbed by the lesser mortals, they've retreated to isolated, well-protected hideouts, mostly under the ground, where there's more mana to burn, but also in the most inhospitable wilderness, or with the [[Cloud|Cloud Elves]] and [[Sea Elves]]. 

[[Koschei the Deathless]] is known as the First Dark Elf.
[[Okoem]]
Love for order

A clan that handles imperial bureaucracy

Best chainmail for tunnel fighting, collapsible shields, crossbows with heavy bolts for short-range encounters with poisonous creatures
Elves are physically unaging; but not mentally. Their memories are about as good as those of a human - they might remember their last half a century vividly, but beyond that they can normally only recall the more striking events.The mnemonic imperfection means old friends and loved ones often forgotten; loss is thus a major theme in elven art. 

The longer-living elves lose their taste for life, and often go to experiment with all kinds of weird stuff. This is seen as a "phase" by the older elves; there's a multitude small elven enclaves dedicated to practicing their own weird ideas, and it could be argued the four major elven lines, [[High Elves]], [[Dark Elves]], [[Forest Elves]] and [[Orks]], all began as such. The relative latecomers, [[Cloud Elves]] and [[Sea Elves]], are also solidifying from multiple enclaves that share interests and cultural mores.

Elven communities are somewhat insular and tend to accumulate thousands of years of in-jokes, which makes them largely incomprehensible to outsiders.

The elven immortality was the reason for Cult of Death's appearance, a church that argues that the circle of life and birth can never be complete without death. The church worships death and, indeed, its adherents have a tradition of making a Vow of Death and drinking poison for the thousandth birthday. 

An elf might seem like both a miser and a squander to a mortal. To a mortal, an item worth ten or twenty years of his time is his most prized possession; quite likely an heirloom. An elf might spend longer working on the lamp in his outhouse.

This also means that in the Empire, a lot of the old-money ultrarich are elves, and so is a fair share of the other elite. If only for their cultural insularity, elves are more likely to promote other elves; this often makes them a target of hostility and attacks from the mortals. On the other hand, when slavery was legal in the Empire (and wherever it still is de facto or de jure), most of the large slaveowners were elves. The idea of racial superiority over mortals comes naturally to them.

Most elves are expectedly risk-averse (with the exception of those bored out of their minds, of course). They like to come prepared, like having contingency plans and prefer to play the long game. (This means there are few spontaneous casters among them, and they see those as rushing into an inferior shortcut to magical power rather than waking the proper path). 

Elves often have trouble bonding with mortals. To begin with, even for the elves who stick to their Vow of Death, a mortal's lifetime forms a lesser part of theirs than a dog's does for a human. Since elves have much longer to know each other well, they frequently seem cold or aloof to their mortal companions. However, the most tragic relationships develop when an elf starts caring properly for a shorter-lived comrade; this was the chief driver for developing the [Undeath|Undead] rituals. Otherwise, elves can spend decades in mourning for their comrades or loved ones, since falling into this pitfall is especially common for relatively young elves, one to two hundred years old, elves have the highest young adult suicide rates among the races. 
The Forest Elves split from the larger elven civilization in [[prehistoric times|Age of Legend]], before the First Empire was formally founded. Okoem was ill fit for habitation back then, shattered by the warring deities and filled with creations of the Enemy. The Forest Elves took it upon themselves to make it habitable - and more than that, hospitable. With a large number of powerful mages in their ranks, they engaged in environmental engineering, as well as full-scale military campaigns to wipe out whatever creatures or vegetation they deemed hazardous for the mortals in their care. As they created stable biomes, keepers were assigned to ensure their stability, and thus the druidic worship of Nature was born. 

After the large-scale transformation was mostly completed, the Forest Elves did not rest on their laurels. They moved to establish settlement enclaves with environment fully optimized for their denizens' ideology; the vast majority of these forest or jungle groves with the settlers intent on harmonious, non-violent life. Sedative herbs and recreational drugs were not only freely cultivated but specifically targeted for breeding in those enclaves, and as time went by, those retreats of the forest elves increasingly filled with philosophers, pacifists, war veterans from the larger world suffering from postcombat trauma, seekers of tranquility, and other assorted hangers-on. Some enclaves grew insular and xenophobic, seeing newcomers as purveyors of violence from the wider world, others remained relatively welcoming. This moderately xenophobic tranquility became the popular perception of forest elf communities, despite the continued presence of ceaselessly active mages, druids and warriors subjected to them among the forest elf numbers.

[[Forest elf politics]]

[[Forest elf architecture]]

[[Forest elf culture]]

[[Forest elf military]]

[[Forest elf religion]]
Forest elves prefer to grow their buildings from local vegetation rather than build them from more traditional materials. They enchant and transmute the chosen tree until it become what they call a mallorn (a word with no clear etymology, perhaps coming rom some arcane texts). 

A mallorn, while based on a single local tree (usually the hardiest one), is in fact a complex biological entity that is closer to a garden than a single organism. Multiple species of plants are grafted onto it, planted near it, or twined around its brunches - forest elves are known to wear a box with seeds and pods for a mallorn around their neck when traveling.

A mallorn well tended for provides for most of its inhabitant's needs. It provides not only shelter, but also several kinds of berries and edible fruit throughout the year, sweet sap that can be fermented, fiber that can be used in ropes or spun into fabric, thick leaves and bark that can be fashioned into shields and armour, strengthened wood that can be made into [[forest elven weaponry|Forest elf military]], and glowing lichen. A mallorn has at least one room - the winter bedroom, usually placed at the base of the trunk or hidden among the roots, and it is surprisingly warm, as if the tree itself warms it - however, most forest elves aren't fanatics and gladly burn dead branches for warmth. Still, it can get chilly and dank in a mallorn, so forest elves place high value on carpets and tapestries, turning its rooms into a series of cozy nests. There's usually more than one room in a mallorn, depending on its dweller's needs and family size, additional rooms storied along the mallorn's height, or open platforms hidden among its branches. Furthermore, depending on the elf's needs, a tree can be specialized to produce more materials needed for his line of work.

A forest elf outpost can be as small as a single mallorn with a handful of rangers who see each other once in a couple of months, and talk even less frequently; but forest elf enclaves are much more elaborate structures where dozens or hundreds of trees intertwine, their trunks weaved into complex patters to form rooms and branches shaped into bridges between the trees, turning the settlement into a single super-organism. 

The forest elves use vegetation for fortification, as well. Those can be as simple as denser forest patches meant to dissuade intruders or herd them into the designated killing zones, or as complex as living abates and fortress-like walls weaved from thick-barked trees. 
Relatively cosmopolitan, less than High but more than Dark

Contemplative, pacifist. Large number of historians.

Floral patterns, both natural (fluid, elegant, unworked style preferred) or elaborately complex.

Little care for glory or honour, but concerned with inner peace and feeling of self-worth. Military victory normally cause for purification rituals rather than celebration.
Generally, forest elves try to avoid large-scale engagements if at all possible. They have highly qualified druidic agents across the Okoem, and they can gather a small strike force of mages, rangers and warriors at a whim if the need arises, be it to prevent a raid from their neighbors, rebalance the controlled biome by striking down a predator, or protect it from an invading monstrous creature. However, with the bulk of their population pacifists or non-combatants, the forest elves rarely fight from the position of brute strength, and rarely have to thanks to their political neutrality and insularity of their retreats. Even rarer still is large-scale offensive action; the forest elves much more commonly fight on defensive. With the benefit of own terrain, they build their defense around fortifications, prepared ambush sites, rapid guerilla strikes, and traps. The numbers of their soldiers are always supplemented by trained animals, and more often than not by treants and other sylvan creatures summoned or created for aid. 

Devoid of their own metallurgy, the forest elves are overwhelmingly lightly armed and armoured. Their armour is made from magically altered bark and leaves, and their weaponry is mostly bows and spears. Thanks to the changes that druidic magic does to wood, their bows do not need to be overly large to surpass human longbows in effectiveness and range, and their arrows and spears are often single-piece elegant creations. No matter the enchantment, however, wood's too brittle to allow the forest elves to create long blades, the longest wooden bladed weapons of their make being short daggers. Any longer bladed weapons have to be imported, which makes them rare on forest elf ranks. Most weapons in forest elf arsenal are poisoned before battle, including axes and even the blades on shestopyors.

The favourite tactic of forest elven infantry is peppering the invaders with arrows from well-concealed fortifications, preferably with the benefit of surprise. When no fortifications and cover are available or the elves are on an offensive, their first ranks form a wall of shields and spears, rarely more than three or four ranks deep, and those further in the rear still employ their bows. 

A large share of a forest elf force goes into battle mounted, and not just on herbivores or land-dwellers, either. These make for great light cavalry, capable of rapid strike where the enemy least expects. Their main weapons are several light spears that can be used both for charge attacks and as javelins; as a secondary weapon they normally carry a mace or an axe, and sometimes a short bow. Even when charging, however, their cavalrymen seek to break contact immediately rather than stay and fight in close quarters, to either soften the opposition with projectiles or gain momentum for another charge. 

The forest elven mounted archers are considered to be the best in Okoem, and they use hit'n'run tactics to bleed enemy forces dry. A combination of bows made from enchanted wood and using their steeds' speed to supplement that of the arrow ensure that they enjoy superiority in range over the vast majority of opponents.

Mounted duels are the only dueling form accepted among forest elves, and they allow both ranged and melee weapons. On the other hand, the more militant-minded forest elf enclaves normally have a number of assassins who use their magical affinity with nature to covertly deliver decapitating strikes, poison provisions, or disrupt logistics.
The Forest Elves are a relatively cosmopolitan and welcoming community. They certainly don't have the metropolitan sociability of the [[High Elves]], but they aren't insular and boorish like the [[Dark Elves]] or worse yet [[Orks]] can be. Generally speaking, a forest elf enclave welcomes anyone who's able to contribute to the community in some way, regardless of race or social strata.

That is not to say that the forest elves aren't politically divided, because they are, and the schism is only getting worse as time goes by. The ideological question at its core has to do with the obviously ruinous influence that sentients have on nature; based on their opinions on the proper reaction, the forest elves are split into three large parties.

The first (if not chronologically) and the largest one is the preservationists. The preservationists love nature in its current state, and it is their belief that sentients must be kept in check to ensure that the existing balance of natural biomes remains unchanged. The preservationists are mostly latecomers to the forest elf cause or denizens of the more populated areas where the damage done by careless treatment of nature is especially evident, while the struggle against nature itself is not. Since the preservationists outnumber the other factions, in the forest elf enclaves where decision-making is communal, they typically hold sway.

The second faction is known as "zealots", while they call themselves true forest elves, the knights of the green, or simply the engineers. The zealots stick to the original idea behind the forest elf movement, that is, the need for the world of Okoem to be made as welcoming for humanoids as at all possible. Their favourite slogan is "Nature's not a temple, but a workshop", and they advocate for continued large-scale environmental adaptation projects to ensure better habitability of Okoem. Their ranks are mostly formed of the forest elf old guard, as well as those who used to dwell on the less hospitable natural frontiers. Where forest elven enclaves are ruled by nobility, especially ancient elves who were there at the forest elf movement's beginnings, the knights of the green tend to dominate.

The third and thankfully the smallest party are the eradicators, or, as they prefer to be known, the disappointed. They agree with the engineers that the existing humanoid cultures cannot coexist peacefully with the nature of Okoem as it currently is, but like the preservationists, they don't think it's the nature that should be changing. The more moderate disappointed argue for changing the cultural mores, more or less radically, while the more fanatical ones call for outright extermination of the communities they see as "harmful" towards the existing biomes. The moderates are generally accepted among the wider forest elven kind and tend to block with the preservationists, perhaps finding compromise in demand for mutual concessions from the humanoids and the established natural order; but the radicals are typically shunned. Since most eradicators come from the older ranks, who've got copious chances to see the devastation the humanoids are capable of unleashing, they often fall from grace from positions of influence, corrupting and persuading numerous followers by the time they're ousted. This results in creation of druidic cults hostile to most things that walk upright, and they're not above acts of murderous terrorism or open genocide if they believe that prevents destruction of nature.
Nature, Tranquility, Predestination

Sylvan creatures and nature spirits worshipped
The ''quick'' brown ~~flea~~ fox //jumps// over the `lazy` dog

Okoem is a vast collection of islands, ranging in size from almost continental to barely large enough to stand upon. Supposedly, the islands are all united into a vast multicultural Empire, but factually the imperial bureaucracy hardly controls its core lands (which are, thus, reminiscent of the Middle Ages, especially China, the Holy Roman Empire and Italy). To the North lie isles covered in forests and tundras where the honorable orkish clans dwell (as well as the normally herbivore taiga giants lately turned to man-eating thanks to their magical metabolisms failing to gain sustenance from eating the trees), and further on, in the arctic tundra, only rare tribes of smaller goblinoids survive. On the Southern islands stretch the plains, which further on turn into savannahs. Giants shepherd their flocks there. Mountain ranges stretch across the archipelago, from one isle to another, as if shattered by a titanic hammer. Below Okoem, underground races dwell under the mountains, in vast realms that predate the known history.
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>>

Halflings are a race of [[Humans]] notable for their minuscule stature. While all Humans started out as nomadic hunter-gatherers, the Halflings proved the most devoted to this lifestyle, and have never abandoned their wandering ways. Alone or in caravans they travel, in some places greeted warmly by the locals eager for their song, dance, and divination, and in others yet chased away if not stoned for the fear of them stealing possessions, livestock, or even children.

Halflings are consummate riders, and a good steed is often the most valuable commodity a halfling might possess. They also have great sense of balance, which helps the both as performers and riders, especially when riding flying steeds. 

It is commonly believed that halflings were the ones to come up with the idea of theater: first their epics were performed by multiple bards, each telling the parts of the epic that pertain to their persona: male or female, young or old; but as halfling caravans grew, there were enough performers to take on the roles of individual characters. Historical plays thus were the first to appear, followed organically by religious mysteries as a few characters in the historical tales were deities to begin with. The halfling affinity for acting, as well as their nomadic lifestyle, sometimes lead the more paranoid to blanket accusations against them of being spies for hostile foreign powers - but it's a hard fact that halflings are overrepresented among the intelligence-gathering operatives of all sorts of organizations.

The other halfling contribution to the Okoem civilization is their nomad cuisine, which is built around animal-produced food with long storage life. Pemmican, kashk, hard tack and other soldiers' and adventurers' food are commonly said to originally belong to halfling cuisine.
[[The Age of Legend|Age of Legend]], also called the Primordial and the Prehistoric Age, was the first age of the world. Gods created Okoem and did battle in it for an age. Then mortals appeared, and participated in the battles of the gods, until the war was won. 

''The First Empire'' - elves built the First Empire on what is now known as the core islands or the Middle Empire. The elves were a unified race then, speaking a language that resembles the Slavic group; the First Empire was somewhat of a Rome, slavery included. They built the great cities of Polnotch and Pivden on the river Vlag, the two greatest metropolises of Okoem, and extended their empire across the land until impassable terrain or steadfast hostiles stopped them. 

The gods interfered in the affairs of the mortals relatively often in the days of the First Empire. When this resulted in a series of catastrophic Wars of Avatars, the iconoclast movement was born, which postulated that instead of personifications, the ideas of portfolios should be venerated directly, robbing gods of agency. An idea might grant spells and broadly affect the living, but not rain fire upon the battlefields as a walking embodiment. When the movement was endorsed by the highest echelons of the First Empire, gradually, the gods indeed did fade. To keep it that way, any idolatry was banned. Even the Grand Temple, a colossal building floating in the air with the equatorial column of fire in its middle, its structure made up of huge statues of the gods, was defaced, literally. The faces of the gods were removed, leaving tunnels through their heads and into the fire; and so were their attributes they held in their hands. 

Thousands of sapients learned magic during the First Empire days; being a mage or a cleric was prestigious and advantageous. 

As various elf groups with diverse interests isolated themselves, different subraces were born: high elves, the urbane arcane magic workers, artisans and politicians; wood elves, nature-worshippers in their sacred groves, with cities of bent trees and coloured glass; dark elves, underground schemers and rebels against the bounds of the natural; orks, explorers and warriors, who established their foothold in the North and perfected their forms until their very bodies became dangerous weapons; and the undead: greatest scholars, warriors and artisans bound to the mortal realm at great cost - each undeath cost a powerful mage dozens of years without access to magic, and almost his life itself. 

As various groups and polities of the First Empire distanced themselves, feudal fragmentation grew, until the empire was essentially nothing but a formality. In the uezds of the First Empire, the elves were always the elite, but other races lived aplenty, often starting out as slaves, but further on gaining full citizenship as freedmen. Soon, they outnumbered the slow-breeding elves significantly. Lacking unifying interests, their differences more and more evident, the uezds of the First Empire descended into a period of all versus all warfare; first they recognized the power of the Emperor in Pivden at least nominally, but then the ruler of Polnotch also declared himself the Emperor, the leaders of orks and dark elves followed suit, and chaos reigned for good. 

''The Age of the Everlit'' - while Pivden was always a center of trade and culture, Polnotch was an industrial powerhouse. It also happened to have very liberal magical regulations, common education (to produce the maximal possible number of magic-users for the constant wars) and virtually no religious oppression, making it a popular destination for mages and scholars of the realm on the run. Which in turn meant that the magitech revolution started in Polnotch, as its mages discovered a reliable way to increase the output of an everlit torch and harness its energy with steam to power mechanical devices. That provided a huge power multiplier to its armies: where previously a mage had to work for years to enchant, say, a golem, now the golem’s body was entirely mundane, except for a mass-produced everlit torch of fitting scale to power it and a brain to control it. Similarly, relatively cheap steam tanks and steam bikes were developed. The power of steam multiplied the productivity of Polnotch workshops, and soon its armies overwhelmed the nearby uezds, giving birth to the Second Empire. Rapid conquest of the old imperial uezds, culminating when Polnotch’s all-time rival Pivden fell to its mighty steam guns, sealed its status as the heir to the Empire of old. This time around, humans led the conquest; dynamic with their shorter lifespans. So hurried as to shorten even the names of the twin metropolises, making them just Poln and Peevd, and the denizens of the latter with their painful regional pride have since been known as just “the peeved”. The Emperor did not stop at the reconquest of the old imperial uezds: as the conquered lands saw steam technologies employed throughout their economies, the power of the Second Empire (think China at its best) grew exponentially, and soon its armies were seen advancing across the continent before the others could equal them in magitech development. Faced with such overwhelming power, most polities chose simply to surrender, and so hardly any suffered serious harm as the Second Empire snatched the continent. The newly acquired territories came to be known as sheng. Each sheng had a representative appointed from the Imperial bureaucracy, had to pay tribute, share knowledge and tech, but all in all was mostly left to its own devices. Thus, it was very soon that the Second Empire had nowhere to expand to: the lands from the frozen North to the sun-baked South and peoples from the goliaths of the highest mountains to the dark elves of the deepest city-states swore fealty to it.

''The Golden Age'' - under the benevolent rule of the Poln Emperors, Okoem flourished. With no wars and free trade throughout the known world, economy boomed, and so did magitech. Everlit power sources increased in energy density until diminishing returns made further research too costly for its returns; but just then a breakthrough was made, and bound spirits were established as an alternative power source. They were noticeably harder to summon and bind, but their capabilities were truly staggering, especially if time and effort were invested into binding them to perform complex tasks. Flying ships became commonplace, railroad steamers were replaced by levitating high-speed trains, whole cities were built with giant images of the Gods and places of worship levitating above them; an ambitious high elf mage launched a space elevator project...

''The Age of the Fall'' - it all ended with a catastrophe, of course. Not with a bang, mind you, but with a whimper, as mana levels started to drop, and more and more magitech started shutting down. After a while, the space elevator tore itself apart, falling upon the core uezds, high-speed rail system stopped, crystal balls stopped working for instant communication, and the Second Empire started coming apart at the seams. Formally, the scheng still recognize the central authority, and Imperial representatives are still appointed, but oftentimes they can’t even get to their intended post with the travel times and dangers of the failing state. 

The core uezds are the most controlled by the Poln bureaucracy, even with dissidence brewing full scale in Peevd. Essentially, core uezds are a mix of feudal holdings (“tequ”), free cities (“zhen”), religious orders (“simiao”) and even autonomous towns ruled by sorcerers still able to use magic (“wushi”), all swearing loyalty to the Emperor in Pold.
The forest elves, fascinated as they have always been with magic of nature, have isolated themselves in their holy groves. Brief incursions into these accursed demesnes reveal that their borders are still very much guarded by foul magic, giving rise to rumours that the forest elves resort to blood magic, or even breed other sapients like cattle to sacrifice and power their magical defenses. The elven isolationism becomes especially relevant when the Imperials try to restore Age of the Everlit machines to life using wood or coal as fuel, as these xenophobes firmly subscribe to “a bone broken for every twig snapped” doctrine. 

Orks independent, clans at war, taiga giants attacking for being unable to eat their trees, goblins attacking for no food without divine spells, resources fetching incredible prices now that conjuring is not available. With no magic to help their agriculture, no technology to support it, and neither to keep up the hunting animals’ numbers, orks face a real perspective of hunger, and their warrior societies increasingly turn to raiding.

Dwarves locked in their mountain halls between evil undead (produced by blood sacrifice, not like sentient undead), goblinoids coming from the deep, dark elf slavers, and orks on the surface. Food shortages, hill dwarf fields raided regularly by goblins and giants. Some of the dwarves turning to fire-worship, runes of pain and madness, moving to active volcanoes.
Dark elves independent again, experimenting with chaotic mana down below. High elves essentially assimilated and sharing the humanity’s fate. 

Southern giants independent, back to shepherding, except now with many more monsters in their savannahs. 

The undead going to long sleep: as magic fades, they first lose their sapience, becoming cunning killers; then their sentience, devolving to mindless predators; then deanimate. As such, the undead lock themselves up in their tomb complexes, unwilling to be disturbed, but adventurers naturally still do.

Lapot the floating city staying far above where mana can still be found; reduced to raids for slaves, mana stones (needed for teleportation back to the city), food and any other necessities.

Cult of predestination gaining ever-increasing spread, being the closest to a monotheistic alternative to the mainstream polytheist religions, splitting into subcults with wildly different agenda.. As a counterbalance, cult of nondestination spiringing up, denying the influence of fate, and just as its competitor, fragmenting to smaller faiths, some extremely egotistic and indulgent, others pushing for reason-maintained order. Preds and nons coming into conflict constantly, to the point of full-scale fighting.
Koschei was a great mage (some say: the greatest mage in recorded history) that lived at the end of the [[First Empire]] era. Born in the Western city of Prakh, he was obsessed with immortality, and in his obsession moved the bounds of magical research far beyond what was thought possible. In his quest, he first perfected the techniques for golem creation, seeking to replace the failing aging bodies. When golems proved incapable of hosting spirits of sapients, he moved to homunculi, and from those he got right to creating the techniques for raising undead, becoming the father of psychiatry in the process as he had to establish an asylum for his assistants driven mad by their research. 

Koschei became his own test subject, and was the first undead to gain eternal life. Sharing the technique that allowed the First Empire to make their leading minds immortal propelled Kashei into even more fame and fortune than he possessed prior, and he all but ruled the city as a benevolent knyaz. It all fell apart when his wife, Vasilisa, died: a priestess of Morana, the goddess of birth, growth and death, she refused all Koshei’s pleads to make her immortal. So he bound her soul by force, burning ever-increasing amounts of mana stones to chain her to this realm, driving Prakh’s economy into the ground, and leading to several popular riots he had to put down with magic. Koschei’s son, Ilya, finally freed the city from his father, and his mother’s ghost from the confines of his spells. Kashei was utterly crashed; he scuttled frantically to his tower to look for a way to bring Vasilisa’s spirit back; as his experiments grew ever more dangerous, he required more and more mana, forcing him to move ever deeper underground. Many of his students followed him underground, thus starting the [[Dark Elf]] civilization - a vague community of freethinkers, scholars, and academicians woven together into schools and roosting precariously close to any worthwhile underground magical anomaly.

Koschei’s research bore no fruit, however, forcing him to dig ever deeper, past the threshold of chaotic magic. There, most of the dark elves refused to follow; and thus he was last seen with a handful of most faithful apprentices venturing into the deepest primordial darkness, never to emerge again. The dwarves claim he was driven insane by the chaotic magic of the depths, and attribute the mindless undead rising from down under not to natural phenomena, but to his twisted will.

Meanwhile, Ilya ruled Prakh as long as his great elven lifespan permitted, turning it again into a bustling megapolis. The city kept the fame of its magic schools as the birthplace of [[undeath|Undead]], and so in Ilya’s lifetime Prakh was gradually transformed into the capital of this new strata.

I-One the first monk as he seeks to cleanse himself.

The shattering of the pantheon as different peoples worship different avatars or aspects of gods.

Wars of Avatars

Iconoclasm: ban on personified deities (enforced by iconoclast order); defaced statues of the temple hovering at the Column of Fire. Ratibog, the first Iconoclast, former avatar of a god of war. Twelve feats of Ratibog, including slaying the god he had been an avatar of (ten thousand avatars of him). A monastery in the mountains so entrenched the Iconoclast order couldn't take it and had to sign an agreement limiting the number of the monks to a hundred, forbidding them ecumenism, and forcing anyone who reaches their valley to stay for life.

Iconoclasts as a long-standing international secret order, abuses of power.

Other secret orders: mage-assassins with Silent and Still spells; anti-mages trained by humans to deal with the First Empire.

Dwarves: obsessed with order, heritage, repairability, and replaceability; strong clan ties; revolution as they moved from "a lot of weapons, good enough quality" approach towards "a few weapons and civilian tools of the best quality possible". Clans following ore veins, abandoning old fortresses. Series of conflicts with the First Empire as it's increasingly reliant on its own crafters, and so are the dwarves. Most affected by the Enemy leftovers. Magitech significantly increased the depth of their mines as delivering air from the surface became much easier. Steel reforged from old cables from the mines, making for cell-shaped ornaments on damascus steel.

Imperial Bureaucracy is one of the dwarven clans.

Junior officer corps in the First Empire's legions increasingly made out of humans, eventually leading to washing out of purely elven Imperial aristocracy.

Forest elves move from cleansers and preservationists either to druidic mystics or pot-smoking hippies. Some of them with outrageous ideas of the terramorphing goals contained to their own islands in the ocean where everything including gravity can be different. "Dark" sentients like worgs consider Forest Elves genocidal killers.Disproportionate number of dragons among the forest elves.

Cloud elves walk on clouds, then build themselves a floating city, Lapot. 

Elven smiths make superior steel by rusting it in a swamp or keeping in mineral water for decades. Halfling steel made from reforging pieces of cast iron with wire (but typically just from random shit). Elves prefer simple, elegant, silver items and amber; the dwarves like heavily adorned gold with gems. Orks mostly just make weapons and tools (which are mostly one and the same).

Dwarves produce most iron, copper, bronze and gold; humans produce most silver, coal (in open pit mines), some iron and diamonds.

Men invented porcelain, but elves make the best eggshell porcelain.

Dwarves make the best heavy armour, but they are mostly good at tunnel fighting. Their favourite weapons are klevez and chekan; they prefer tower shields and only use crossbows for ranged combat. Their light troops wear full-body chainmail, which is also quite useful in narrow underground passages.

The elves dislike melee fighting, and most elves are archers if not mages. The elves who go into melee prefer finesse-based styles, either skill-intensive like two-weapon fighting or go down the gish road. 

Orks are the most organized fighters, and they prefer heavy armour and large shields. Duels are common before the formations clash in earnest. They also kept the ancient javelin tradition.

Halflings prefer fighting mounted, with sabres and composite bows. Those who live in caravans can build wagenburgs. 

Knightly orders of the Empire; swear fealty directly to the Emperor rather than any of the feudals; mostly junior sons of aristocracy. Some orders are genuine forces for good; most are hardly more than collective feudal structures. Knightly orders are famous for breeding war animals, from dogs and horses to gryphons.

Dragons unlike elves never forget, but they dwell on memories, spending increasingly large shares of their lives in hibernation reliving them.
Okoem is a fantasy setting that's set in a world that had made spectacular advancement in magitech before plunging into a new dark age when the magic stopped working as it did before.

[[Geography]]

[[History]]

[[Races]]

[[Notes and ideas]]
Orks are a subrace of elves - and, indeed, the only true elves by their measure. Back in the days of the First Empire, they followed prophet Branislav, who led them into exile from the ever more decadent Imperial cities. The teachings of Branibor emphasized personal perfection, honour, martial skill over treacherous cunningness of magic, and practical knowledge and skill over bookish learning. Orks have clinged to these values ever since. Their society is formed of clans, loosely united into tribes, and those into a tribal alliance.

Other than the basic religious tenets, orkish clans share little in common, even their ideas of honour are radically different. For instance, all orks believe that might makes right, and as such, allow any dispute to be settled by a contest of martial skill. However, for the Southern tribes who live in contact with wider civilization, this contest is usually a formally arranged duel fought until one of the challengers yields or bleeds; further North those contests are more spontaneous and often fought to death; and in the far Arctic outskirts of the orkish space any violence, however treacherous, is deemed proof enough of superiority to settle a dispute. This gave birth to an orkish proverb: “Me against my brothers, my brothers and I against our clan, our clan against the tribe, the tribe against the orks, and the orks against the world”. Parts of the proverb are often recited both to call other orks into alliance against a shared threat, and to explain an attack against erstwhile allies once the threat has passed.

This attitude means orks live much shorter lives, on average, than other breeds of elf, but this is of little concern to them. According to prophet Branislav’s teachings, harsh surroundings breed harsh men, and over time, orks have evolved to match. Not only have they bred away the low fertility that plagues the baseline elvish stock, but they’ve forged their very bodies into weapons: an ork is always armed with his fangs and claws, and always armoured with his hide. An ork can march for days through a desert with nought but a handful of water daily to keep him going, sleep naked in the snow, shrug off wounds that’d be lethal to a lesser warrior, and forage reliably for himself and a few companions anywhere on the isles of Okoem.
Orks pride themselves in being superiour melee fighters, but their strength lies in individual fighting skill and prowess rather than the steel discipline like that of Imperial legions, as each warrior seeks to claim his own glory and forge his own legend. This ambition is the chief motivator for an ork warrior that often sends orkish young adults outside their clan’s lands as raiders or adventurers, and it’s the wellspring of orkish culture. As an ork ages, he may only lay claim to any position of authority if he’s covered himself in glory throughout his life - and in the harsher Northern tribes, even food in the winter is far from guaranteed for an aging warrior otherwise. It’s generally considered dishonourable to challenge those at an obvious disadvantage, - the elderly, kids and young teenagers, female warriors when they’re late-term pregnant, - but it’s not dishonourable to deny food and answer a challenge demanding it.

Orkish combat styles vary wildly: some orks prefer to put on as much heavy armour as their robust physique allows, while the others might instead fight naked to show off scars, ritual markings, and racial superiority. Orks usually fight on foot, because their environs do not avail themselves to horse husbandry, and attempts to use elks instead have met with limited success. Ork armies put heavy emphasis on skirmishers, as every warrior seeks to forge his own legend. This is also why orks are the most frequent users of two-handed weaponry, and why dense formations are only assumed at the direst necessity, such as at the sight of incoming cavalry. 

Orks are notorious pirates and coastal raiders, and the ranged weaponry they prefer reflects that: they usually employ composite bows that aren't too cumbersome to keep on a longship and allow them to utilize their strength to full benefit.

The lust for honour and glory colours most of orkish art, just as well. Orks disdain bookishness, so their folklore is overwhelmingly oral, and overwhelmingly focuses on heroic sagas. So do the elaborate carpets and tapestries decorating orkish dwellings, as well as the wooden sculpture that orks carve bare-handed. The two most famous tapestries hang one against the other in the Council of Chiefs building, where heads of tribes gather to settle issues that affect the entirety of the orkish nation. Those are The Deeds of Branislav, relaying the saga of the prophet, and The Deeds of the Elves, detailing the orkish history and the feats of their most outstanding heroes since the beginning of their self-imposed exile.

The robust orkish physique allows surviving most grievous of wounds, and bearing combat scars is seen as prestigious. As such, scarification is an art widely practiced among orks. Among the Southern clans, who have access to imported inks, tattooing in common, especially bright, elaborate tattoos depicting one’s martial achievements. Bearers of particularly impressive sets often prefer to fight their ritual challenges barechested - but otherwise showing  those tattoos off is considered disrespectful, the same as bragging. In contrast, while the Southerners prefer their weapons purely functional and undecorated, the ork warriors of the North like theirs adorned with furs and inlaid wooden or bone carvings. Further North, preserved trophies from particularly worthy foes are a common sight. Jewelry taken in battle is the only such personal decoration ork culture approves: it’s worn to showcase not the warrior’s own wealth, but the wealth and power of the foes she vanquished.

//Chernomor dwarf ork body sculpter, hobgoblins and ettins//
/***
|''Name:''|PasswordOptionPlugin|
|''Description:''|Extends TiddlyWiki options with non encrypted password option.|
|''Version:''|1.0.2|
|''Date:''|Apr 19, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#PasswordOptionPlugin|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0 (Beta 5)|
***/
//{{{
version.extensions.PasswordOptionPlugin = {
	major: 1, minor: 0, revision: 2, 
	date: new Date("Apr 19, 2007"),
	source: 'http://tiddlywiki.bidix.info/#PasswordOptionPlugin',
	author: 'BidiX (BidiX (at) bidix (dot) info',
	license: '[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D]]',
	coreVersion: '2.2.0 (Beta 5)'
};

config.macros.option.passwordCheckboxLabel = "Save this password on this computer";
config.macros.option.passwordInputType = "password"; // password | text
setStylesheet(".pasOptionInput {width: 11em;}\n","passwordInputTypeStyle");

merge(config.macros.option.types, {
	'pas': {
		elementType: "input",
		valueField: "value",
		eventName: "onkeyup",
		className: "pasOptionInput",
		typeValue: config.macros.option.passwordInputType,
		create: function(place,type,opt,className,desc) {
			// password field
			config.macros.option.genericCreate(place,'pas',opt,className,desc);
			// checkbox linked with this password "save this password on this computer"
			config.macros.option.genericCreate(place,'chk','chk'+opt,className,desc);			
			// text savePasswordCheckboxLabel
			place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));
		},
		onChange: config.macros.option.genericOnChange
	}
});

merge(config.optionHandlers['chk'], {
	get: function(name) {
		// is there an option linked with this chk ?
		var opt = name.substr(3);
		if (config.options[opt]) 
			saveOptionCookie(opt);
		return config.options[name] ? "true" : "false";
	}
});

merge(config.optionHandlers, {
	'pas': {
 		get: function(name) {
			if (config.options["chk"+name]) {
				return encodeCookie(config.options[name].toString());
			} else {
				return "";
			}
		},
		set: function(name,value) {config.options[name] = decodeCookie(value);}
	}
});

// need to reload options to load passwordOptions
loadOptionsCookie();

/*
if (!config.options['pasPassword'])
	config.options['pasPassword'] = '';

merge(config.optionsDesc,{
		pasPassword: "Test password"
	});
*/
//}}}
The principal races that inhabit Okoem are elves, humans, dwarves, ravens, dragons and the undead.

[[Elves]] are unaging, and this defines their culture. Several loosely defined elf cultures exist on Okoem: the city-dwelling [[High Elves]], the isolationist [[Dark Elves]], the neo-primitivist [[Forest Elves]], and the warlike [[Orks]]. 

Elves were the ones to found the [[First Empire]], but as time went by, humans became ever more prominent, until they came to dominate the world politics.

[[Humans]] are the most numerous race of humanoids in Okoem. From nomadic hunter-gatherers, they've moved on to create great states and organize communities as varied as they themselves are. 

The imperial scholars consider [[Gnomes]] and [[Halflings]] to be races of humans. But then again, they also think elves to be a race of men, too; and some of the more radical minds among them have their doubts about the dragons, too.

[[Dwarves]]

Sentient [[Ravens]] have never had a civilization of their own, instead surviving among the humanoids. This is the basis of the great schism in their culture.

[[Dragons]]

The [[Undead]] in Okoem is normally a term reserved for the sentient undying. This incredibly magically taxing practice was invented during the First Empire as a form of immortality.
Since Ravens, despite being sentient, have no prehensile limbs, the majority of them are non-posessors, or a sort of a poverty cult. "Grabber" and "grasper" are insults for them, while knowledge, skills and beauty are seen as the most important values. 

On the other end of the spectrum, extreme greed over every bauble, particularly tools and equipment fit for use by ravens. The Possessors derogatorily known as "magpies"; seek to build their own culture and society rather than living among humanoids. 

Cult of beauty a sort of middle ground between the extremes. 
the magical post-apocalypse setting
Okoem
''The Special Path'' is an ideology of racial superiority found among [[Elves]].

According to the tenets of the Special Path, the mortals were brought to Okoem or created by the gods in the [[Age of Legend]] as soldiers, each with specific combat role in mind. [[Humans]] were to be the soldiery, massed ranks of infantry and cavalry. [[Dwarves]] were the logistics and the military-industrial complex. And the [[Elves]] themselves, with their infinite lifespans, were meant to be the leaders of men, as well as the most powerful magic users of the gods' army. 

From the Special Path point of view, the Elves are special simply for the fact of being born Elves; that entitles them to dominion, since they are naturally and inherently the race of masters, superiour to other mortals and meant to lead them by the gods themselves.

The Special Path ideology was widely spread during the days of the [[First Empire]], but there are still numerous adherents among the elves, especially those of the higher social standing or coming from noble lineage.
The Undead in Okoem are normally sentient, the practice of raising the dead invented as a form of static immortality in the [[First Empire]], as opposed to the elves' own infinite lifespan that weighs heavily upon their consciousness. 

As the [[Humans]] gained prominence in the First Empire, an ever-growing share of the Undead was drafted from their number; but particularly numerous, especially in relative numbers, were the half-elves.

Those are the [[Dark Elves]] who achieved particular mastery of the technique, and for these subterranean academicians, undeath is little more than a tenure. However, the other humanoids also still enjoy this privilege, both the wealthiest, as a way to cheat their own mortality, and the best and brightest, to preserve their genius. The principal limitation that prevents raising more Undead is how extremely magically tasking that procedure is, leaving mages without their abilities for years. 

The Undead culture is as diverse as the Undead themselves, only the select few quirks that pertain to their peculiar condition being universally shared. 

First of all, most Undead take pains to make their condition as non-offensive to a casual mortal onlooker as possible. What constitutes fashion norm varies from one society to the other, but generally speaking, the sight and smell of rot and decay are considered a major faux pas. Clean, bleached bone, dry mummified flesh or fresh bandages are the generally accepted norm for an Undead body.

While the Undead usually start as the brightest minds around, as time marches on, they tend to fall behind the times. This means they either turn grognard conservatives or, in rare cases, rush into fringe experimentation that most of the living don’t have the luggage to appreciate. This makes it impolite for the undead to hold any positions of power or titles, other than honorary ones, so as not to stifle their descendants’ social advancement.

The equipment the Undead use tends to be fine and elaborate as befits their status, but more often than not they have trouble keeping up with the local fashions, sticking instead to the styles favoured in the days of their youth.

//Non-sentient undead as menial laborers//
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |
| 22/03/2019 06:20:58 | danvolodar | [[index.html|http://danvolodar.ru/files/Okoem/index.html]] | [[store.php|http://danvolodar.ru/files/Okoem/store.php]] | . | [[index.html | http://danvolodar.ru/files/Okoem/index.html]] |  |
| 22/03/2019 07:52:03 | danvolodar | [[index.html|http://danvolodar.ru/files/Okoem/index.html]] | [[store.php|http://danvolodar.ru/files/Okoem/store.php]] | . | [[index.html | http://danvolodar.ru/files/Okoem/index.html]] |  |
| 03/11/2019 00:01:46 | danvolodar | [[index.html|http://danvolodar.ru/files/Okoem/index.html]] | [[store.php|http://danvolodar.ru/files/Okoem/store.php]] | . | [[index.html | http://danvolodar.ru/files/Okoem/index.html]] |  | failed |
| 03/11/2019 00:02:00 | danvolodar | [[index.html|http://danvolodar.ru/files/Okoem/index.html]] | [[store.php|http://danvolodar.ru/files/Okoem/store.php]] | . | [[index.html | http://danvolodar.ru/files/Okoem/index.html]] |  | failed |
| 03/11/2019 00:02:12 | danvolodar | [[index.html|http://danvolodar.ru/files/Okoem/index.html]] | [[store.php|http://danvolodar.ru/files/Okoem/store.php]] | . | [[index.html | http://danvolodar.ru/files/Okoem/index.html]] |  |
| 03/11/2019 00:14:28 | danvolodar | [[index.html|http://danvolodar.ru/files/Okoem/index.html]] | [[store.php|http://danvolodar.ru/files/Okoem/store.php]] | . | [[index.html | http://danvolodar.ru/files/Okoem/index.html]] |  |
| 26/07/2020 02:28:47 | danvolodar | [[/|http://danvolodar.ru/files/Okoem/]] | [[store.php|http://danvolodar.ru/files/Okoem/store.php]] | . | [[index.html | http://danvolodar.ru/files/Okoem/index.html]] |  |
| 26/07/2020 02:34:34 | danvolodar | [[/|http://danvolodar.ru/files/Okoem/]] | [[store.php|http://danvolodar.ru/files/Okoem/store.php]] | . | [[index.html | http://danvolodar.ru/files/Okoem/index.html]] |  |
| 26/07/2020 02:40:42 | danvolodar | [[/|http://danvolodar.ru/files/Okoem/]] | [[store.php|http://danvolodar.ru/files/Okoem/store.php]] | . | [[index.html | http://danvolodar.ru/files/Okoem/index.html]] |  |
| 26/07/2020 02:42:09 | danvolodar | [[/|http://danvolodar.ru/files/Okoem/]] | [[store.php|http://danvolodar.ru/files/Okoem/store.php]] | . | [[index.html | http://danvolodar.ru/files/Okoem/index.html]] |  |
/***
|''Name:''|UploadPlugin|
|''Description:''|Save to web a TiddlyWiki|
|''Version:''|4.1.3|
|''Date:''|Feb 24, 2008|
|''Source:''|http://tiddlywiki.bidix.info/#UploadPlugin|
|''Documentation:''|http://tiddlywiki.bidix.info/#UploadPluginDoc|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0|
|''Requires:''|PasswordOptionPlugin|
***/
//{{{
version.extensions.UploadPlugin = {
	major: 4, minor: 1, revision: 3,
	date: new Date("Feb 24, 2008"),
	source: 'http://tiddlywiki.bidix.info/#UploadPlugin',
	author: 'BidiX (BidiX (at) bidix (dot) info',
	coreVersion: '2.2.0'
};

//
// Environment
//

if (!window.bidix) window.bidix = {}; // bidix namespace
bidix.debugMode = false;	// true to activate both in Plugin and UploadService
	
//
// Upload Macro
//

config.macros.upload = {
// default values
	defaultBackupDir: '',	//no backup
	defaultStoreScript: "store.php",
	defaultToFilename: "index.html",
	defaultUploadDir: ".",
	authenticateUser: true	// UploadService Authenticate User
};
	
config.macros.upload.label = {
	promptOption: "Save and Upload this TiddlyWiki with UploadOptions",
	promptParamMacro: "Save and Upload this TiddlyWiki in %0",
	saveLabel: "save to web", 
	saveToDisk: "save to disk",
	uploadLabel: "upload"	
};

config.macros.upload.messages = {
	noStoreUrl: "No store URL in parmeters or options",
	usernameOrPasswordMissing: "Username or password missing"
};

config.macros.upload.handler = function(place,macroName,params) {
	if (readOnly)
		return;
	var label;
	if (document.location.toString().substr(0,4) == "http") 
		label = this.label.saveLabel;
	else
		label = this.label.uploadLabel;
	var prompt;
	if (params[0]) {
		prompt = this.label.promptParamMacro.toString().format([this.destFile(params[0], 
			(params[1] ? params[1]:bidix.basename(window.location.toString())), params[3])]);
	} else {
		prompt = this.label.promptOption;
	}
	createTiddlyButton(place, label, prompt, function() {config.macros.upload.action(params);}, null, null, this.accessKey);
};

config.macros.upload.action = function(params)
{
		// for missing macro parameter set value from options
		if (!params) params = {};
		var storeUrl = params[0] ? params[0] : config.options.txtUploadStoreUrl;
		var toFilename = params[1] ? params[1] : config.options.txtUploadFilename;
		var backupDir = params[2] ? params[2] : config.options.txtUploadBackupDir;
		var uploadDir = params[3] ? params[3] : config.options.txtUploadDir;
		var username = params[4] ? params[4] : config.options.txtUploadUserName;
		var password = config.options.pasUploadPassword; // for security reason no password as macro parameter	
		// for still missing parameter set default value
		if ((!storeUrl) && (document.location.toString().substr(0,4) == "http")) 
			storeUrl = bidix.dirname(document.location.toString())+'/'+config.macros.upload.defaultStoreScript;
		if (storeUrl.substr(0,4) != "http")
			storeUrl = bidix.dirname(document.location.toString()) +'/'+ storeUrl;
		if (!toFilename)
			toFilename = bidix.basename(window.location.toString());
		if (!toFilename)
			toFilename = config.macros.upload.defaultToFilename;
		if (!uploadDir)
			uploadDir = config.macros.upload.defaultUploadDir;
		if (!backupDir)
			backupDir = config.macros.upload.defaultBackupDir;
		// report error if still missing
		if (!storeUrl) {
			alert(config.macros.upload.messages.noStoreUrl);
			clearMessage();
			return false;
		}
		if (config.macros.upload.authenticateUser && (!username || !password)) {
			alert(config.macros.upload.messages.usernameOrPasswordMissing);
			clearMessage();
			return false;
		}
		bidix.upload.uploadChanges(false,null,storeUrl, toFilename, uploadDir, backupDir, username, password); 
		return false; 
};

config.macros.upload.destFile = function(storeUrl, toFilename, uploadDir) 
{
	if (!storeUrl)
		return null;
		var dest = bidix.dirname(storeUrl);
		if (uploadDir && uploadDir != '.')
			dest = dest + '/' + uploadDir;
		dest = dest + '/' + toFilename;
	return dest;
};

//
// uploadOptions Macro
//

config.macros.uploadOptions = {
	handler: function(place,macroName,params) {
		var wizard = new Wizard();
		wizard.createWizard(place,this.wizardTitle);
		wizard.addStep(this.step1Title,this.step1Html);
		var markList = wizard.getElement("markList");
		var listWrapper = document.createElement("div");
		markList.parentNode.insertBefore(listWrapper,markList);
		wizard.setValue("listWrapper",listWrapper);
		this.refreshOptions(listWrapper,false);
		var uploadCaption;
		if (document.location.toString().substr(0,4) == "http") 
			uploadCaption = config.macros.upload.label.saveLabel;
		else
			uploadCaption = config.macros.upload.label.uploadLabel;
		
		wizard.setButtons([
				{caption: uploadCaption, tooltip: config.macros.upload.label.promptOption, 
					onClick: config.macros.upload.action},
				{caption: this.cancelButton, tooltip: this.cancelButtonPrompt, onClick: this.onCancel}
				
			]);
	},
	options: [
		"txtUploadUserName",
		"pasUploadPassword",
		"txtUploadStoreUrl",
		"txtUploadDir",
		"txtUploadFilename",
		"txtUploadBackupDir",
		"chkUploadLog",
		"txtUploadLogMaxLine"		
	],
	refreshOptions: function(listWrapper) {
		var opts = [];
		for(i=0; i<this.options.length; i++) {
			var opt = {};
			opts.push();
			opt.option = "";
			n = this.options[i];
			opt.name = n;
			opt.lowlight = !config.optionsDesc[n];
			opt.description = opt.lowlight ? this.unknownDescription : config.optionsDesc[n];
			opts.push(opt);
		}
		var listview = ListView.create(listWrapper,opts,this.listViewTemplate);
		for(n=0; n<opts.length; n++) {
			var type = opts[n].name.substr(0,3);
			var h = config.macros.option.types[type];
			if (h && h.create) {
				h.create(opts[n].colElements['option'],type,opts[n].name,opts[n].name,"no");
			}
		}
		
	},
	onCancel: function(e)
	{
		backstage.switchTab(null);
		return false;
	},
	
	wizardTitle: "Upload with options",
	step1Title: "These options are saved in cookies in your browser",
	step1Html: "<input type='hidden' name='markList'></input><br>",
	cancelButton: "Cancel",
	cancelButtonPrompt: "Cancel prompt",
	listViewTemplate: {
		columns: [
			{name: 'Description', field: 'description', title: "Description", type: 'WikiText'},
			{name: 'Option', field: 'option', title: "Option", type: 'String'},
			{name: 'Name', field: 'name', title: "Name", type: 'String'}
			],
		rowClasses: [
			{className: 'lowlight', field: 'lowlight'} 
			]}
};

//
// upload functions
//

if (!bidix.upload) bidix.upload = {};

if (!bidix.upload.messages) bidix.upload.messages = {
	//from saving
	invalidFileError: "The original file '%0' does not appear to be a valid TiddlyWiki",
	backupSaved: "Backup saved",
	backupFailed: "Failed to upload backup file",
	rssSaved: "RSS feed uploaded",
	rssFailed: "Failed to upload RSS feed file",
	emptySaved: "Empty template uploaded",
	emptyFailed: "Failed to upload empty template file",
	mainSaved: "Main TiddlyWiki file uploaded",
	mainFailed: "Failed to upload main TiddlyWiki file. Your changes have not been saved",
	//specific upload
	loadOriginalHttpPostError: "Can't get original file",
	aboutToSaveOnHttpPost: 'About to upload on %0 ...',
	storePhpNotFound: "The store script '%0' was not found."
};

bidix.upload.uploadChanges = function(onlyIfDirty,tiddlers,storeUrl,toFilename,uploadDir,backupDir,username,password)
{
	var callback = function(status,uploadParams,original,url,xhr) {
		if (!status) {
			displayMessage(bidix.upload.messages.loadOriginalHttpPostError);
			return;
		}
		if (bidix.debugMode) 
			alert(original.substr(0,500)+"\n...");
		// Locate the storeArea div's 
		var posDiv = locateStoreArea(original);
		if((posDiv[0] == -1) || (posDiv[1] == -1)) {
			alert(config.messages.invalidFileError.format([localPath]));
			return;
		}
		bidix.upload.uploadRss(uploadParams,original,posDiv);
	};
	
	if(onlyIfDirty && !store.isDirty())
		return;
	clearMessage();
	// save on localdisk ?
	if (document.location.toString().substr(0,4) == "file") {
		var path = document.location.toString();
		var localPath = getLocalPath(path);
		saveChanges();
	}
	// get original
	var uploadParams = new Array(storeUrl,toFilename,uploadDir,backupDir,username,password);
	var originalPath = document.location.toString();
	// If url is a directory : add index.html
	if (originalPath.charAt(originalPath.length-1) == "/")
		originalPath = originalPath + "index.html";
	var dest = config.macros.upload.destFile(storeUrl,toFilename,uploadDir);
	var log = new bidix.UploadLog();
	log.startUpload(storeUrl, dest, uploadDir,  backupDir);
	displayMessage(bidix.upload.messages.aboutToSaveOnHttpPost.format([dest]));
	if (bidix.debugMode) 
		alert("about to execute Http - GET on "+originalPath);
	var r = doHttp("GET",originalPath,null,null,username,password,callback,uploadParams,null);
	if (typeof r == "string")
		displayMessage(r);
	return r;
};

bidix.upload.uploadRss = function(uploadParams,original,posDiv) 
{
	var callback = function(status,params,responseText,url,xhr) {
		if(status) {
			var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
			displayMessage(bidix.upload.messages.rssSaved,bidix.dirname(url)+'/'+destfile);
			bidix.upload.uploadMain(params[0],params[1],params[2]);
		} else {
			displayMessage(bidix.upload.messages.rssFailed);			
		}
	};
	// do uploadRss
	if(config.options.chkGenerateAnRssFeed) {
		var rssPath = uploadParams[1].substr(0,uploadParams[1].lastIndexOf(".")) + ".xml";
		var rssUploadParams = new Array(uploadParams[0],rssPath,uploadParams[2],'',uploadParams[4],uploadParams[5]);
		var rssString = generateRss();
		// no UnicodeToUTF8 conversion needed when location is "file" !!!
		if (document.location.toString().substr(0,4) != "file")
			rssString = convertUnicodeToUTF8(rssString);	
		bidix.upload.httpUpload(rssUploadParams,rssString,callback,Array(uploadParams,original,posDiv));
	} else {
		bidix.upload.uploadMain(uploadParams,original,posDiv);
	}
};

bidix.upload.uploadMain = function(uploadParams,original,posDiv) 
{
	var callback = function(status,params,responseText,url,xhr) {
		var log = new bidix.UploadLog();
		if(status) {
			// if backupDir specified
			if ((params[3]) && (responseText.indexOf("backupfile:") > -1))  {
				var backupfile = responseText.substring(responseText.indexOf("backupfile:")+11,responseText.indexOf("\n", responseText.indexOf("backupfile:")));
				displayMessage(bidix.upload.messages.backupSaved,bidix.dirname(url)+'/'+backupfile);
			}
			var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
			displayMessage(bidix.upload.messages.mainSaved,bidix.dirname(url)+'/'+destfile);
			store.setDirty(false);
			log.endUpload("ok");
		} else {
			alert(bidix.upload.messages.mainFailed);
			displayMessage(bidix.upload.messages.mainFailed);
			log.endUpload("failed");			
		}
	};
	// do uploadMain
	var revised = bidix.upload.updateOriginal(original,posDiv);
	bidix.upload.httpUpload(uploadParams,revised,callback,uploadParams);
};

bidix.upload.httpUpload = function(uploadParams,data,callback,params)
{
	var localCallback = function(status,params,responseText,url,xhr) {
		url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
		if (xhr.status == 404)
			alert(bidix.upload.messages.storePhpNotFound.format([url]));
		if ((bidix.debugMode) || (responseText.indexOf("Debug mode") >= 0 )) {
			alert(responseText);
			if (responseText.indexOf("Debug mode") >= 0 )
				responseText = responseText.substring(responseText.indexOf("\n\n")+2);
		} else if (responseText.charAt(0) != '0') 
			alert(responseText);
		if (responseText.charAt(0) != '0')
			status = null;
		callback(status,params,responseText,url,xhr);
	};
	// do httpUpload
	var boundary = "---------------------------"+"AaB03x";	
	var uploadFormName = "UploadPlugin";
	// compose headers data
	var sheader = "";
	sheader += "--" + boundary + "\r\nContent-disposition: form-data; name=\"";
	sheader += uploadFormName +"\"\r\n\r\n";
	sheader += "backupDir="+uploadParams[3] +
				";user=" + uploadParams[4] +
				";password=" + uploadParams[5] +
				";uploaddir=" + uploadParams[2];
	if (bidix.debugMode)
		sheader += ";debug=1";
	sheader += ";;\r\n"; 
	sheader += "\r\n" + "--" + boundary + "\r\n";
	sheader += "Content-disposition: form-data; name=\"userfile\"; filename=\""+uploadParams[1]+"\"\r\n";
	sheader += "Content-Type: text/html;charset=UTF-8" + "\r\n";
	sheader += "Content-Length: " + data.length + "\r\n\r\n";
	// compose trailer data
	var strailer = new String();
	strailer = "\r\n--" + boundary + "--\r\n";
	data = sheader + data + strailer;
	if (bidix.debugMode) alert("about to execute Http - POST on "+uploadParams[0]+"\n with \n"+data.substr(0,500)+ " ... ");
	var r = doHttp("POST",uploadParams[0],data,"multipart/form-data; ;charset=UTF-8; boundary="+boundary,uploadParams[4],uploadParams[5],localCallback,params,null);
	if (typeof r == "string")
		displayMessage(r);
	return r;
};

// same as Saving's updateOriginal but without convertUnicodeToUTF8 calls
bidix.upload.updateOriginal = function(original, posDiv)
{
	if (!posDiv)
		posDiv = locateStoreArea(original);
	if((posDiv[0] == -1) || (posDiv[1] == -1)) {
		alert(config.messages.invalidFileError.format([localPath]));
		return;
	}
	var revised = original.substr(0,posDiv[0] + startSaveArea.length) + "\n" +
				store.allTiddlersAsHtml() + "\n" +
				original.substr(posDiv[1]);
	var newSiteTitle = getPageTitle().htmlEncode();
	revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");
	revised = updateMarkupBlock(revised,"PRE-HEAD","MarkupPreHead");
	revised = updateMarkupBlock(revised,"POST-HEAD","MarkupPostHead");
	revised = updateMarkupBlock(revised,"PRE-BODY","MarkupPreBody");
	revised = updateMarkupBlock(revised,"POST-SCRIPT","MarkupPostBody");
	return revised;
};

//
// UploadLog
// 
// config.options.chkUploadLog :
//		false : no logging
//		true : logging
// config.options.txtUploadLogMaxLine :
//		-1 : no limit
//      0 :  no Log lines but UploadLog is still in place
//		n :  the last n lines are only kept
//		NaN : no limit (-1)

bidix.UploadLog = function() {
	if (!config.options.chkUploadLog) 
		return; // this.tiddler = null
	this.tiddler = store.getTiddler("UploadLog");
	if (!this.tiddler) {
		this.tiddler = new Tiddler();
		this.tiddler.title = "UploadLog";
		this.tiddler.text = "| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |";
		this.tiddler.created = new Date();
		this.tiddler.modifier = config.options.txtUserName;
		this.tiddler.modified = new Date();
		store.addTiddler(this.tiddler);
	}
	return this;
};

bidix.UploadLog.prototype.addText = function(text) {
	if (!this.tiddler)
		return;
	// retrieve maxLine when we need it
	var maxLine = parseInt(config.options.txtUploadLogMaxLine,10);
	if (isNaN(maxLine))
		maxLine = -1;
	// add text
	if (maxLine != 0) 
		this.tiddler.text = this.tiddler.text + text;
	// Trunck to maxLine
	if (maxLine >= 0) {
		var textArray = this.tiddler.text.split('\n');
		if (textArray.length > maxLine + 1)
			textArray.splice(1,textArray.length-1-maxLine);
			this.tiddler.text = textArray.join('\n');		
	}
	// update tiddler fields
	this.tiddler.modifier = config.options.txtUserName;
	this.tiddler.modified = new Date();
	store.addTiddler(this.tiddler);
	// refresh and notifiy for immediate update
	story.refreshTiddler(this.tiddler.title);
	store.notify(this.tiddler.title, true);
};

bidix.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir,  backupDir) {
	if (!this.tiddler)
		return;
	var now = new Date();
	var text = "\n| ";
	var filename = bidix.basename(document.location.toString());
	if (!filename) filename = '/';
	text += now.formatString("0DD/0MM/YYYY 0hh:0mm:0ss") +" | ";
	text += config.options.txtUserName + " | ";
	text += "[["+filename+"|"+location + "]] |";
	text += " [[" + bidix.basename(storeUrl) + "|" + storeUrl + "]] | ";
	text += uploadDir + " | ";
	text += "[[" + bidix.basename(toFilename) + " | " +toFilename + "]] | ";
	text += backupDir + " |";
	this.addText(text);
};

bidix.UploadLog.prototype.endUpload = function(status) {
	if (!this.tiddler)
		return;
	this.addText(" "+status+" |");
};

//
// Utilities
// 

bidix.checkPlugin = function(plugin, major, minor, revision) {
	var ext = version.extensions[plugin];
	if (!
		(ext  && 
			((ext.major > major) || 
			((ext.major == major) && (ext.minor > minor))  ||
			((ext.major == major) && (ext.minor == minor) && (ext.revision >= revision))))) {
			// write error in PluginManager
			if (pluginInfo)
				pluginInfo.log.push("Requires " + plugin + " " + major + "." + minor + "." + revision);
			eval(plugin); // generate an error : "Error: ReferenceError: xxxx is not defined"
	}
};

bidix.dirname = function(filePath) {
	if (!filePath) 
		return;
	var lastpos;
	if ((lastpos = filePath.lastIndexOf("/")) != -1) {
		return filePath.substring(0, lastpos);
	} else {
		return filePath.substring(0, filePath.lastIndexOf("\\"));
	}
};

bidix.basename = function(filePath) {
	if (!filePath) 
		return;
	var lastpos;
	if ((lastpos = filePath.lastIndexOf("#")) != -1) 
		filePath = filePath.substring(0, lastpos);
	if ((lastpos = filePath.lastIndexOf("/")) != -1) {
		return filePath.substring(lastpos + 1);
	} else
		return filePath.substring(filePath.lastIndexOf("\\")+1);
};

bidix.initOption = function(name,value) {
	if (!config.options[name])
		config.options[name] = value;
};

//
// Initializations
//

// require PasswordOptionPlugin 1.0.1 or better
bidix.checkPlugin("PasswordOptionPlugin", 1, 0, 1);

// styleSheet
setStylesheet('.txtUploadStoreUrl, .txtUploadBackupDir, .txtUploadDir {width: 22em;}',"uploadPluginStyles");

//optionsDesc
merge(config.optionsDesc,{
	txtUploadStoreUrl: "Url of the UploadService script (default: store.php)",
	txtUploadFilename: "Filename of the uploaded file (default: in index.html)",
	txtUploadDir: "Relative Directory where to store the file (default: . (downloadService directory))",
	txtUploadBackupDir: "Relative Directory where to backup the file. If empty no backup. (default: ''(empty))",
	txtUploadUserName: "Upload Username",
	pasUploadPassword: "Upload Password",
	chkUploadLog: "do Logging in UploadLog (default: true)",
	txtUploadLogMaxLine: "Maximum of lines in UploadLog (default: 10)"
});

// Options Initializations
bidix.initOption('txtUploadStoreUrl','');
bidix.initOption('txtUploadFilename','');
bidix.initOption('txtUploadDir','');
bidix.initOption('txtUploadBackupDir','');
bidix.initOption('txtUploadUserName','');
bidix.initOption('pasUploadPassword','');
bidix.initOption('chkUploadLog',true);
bidix.initOption('txtUploadLogMaxLine','10');


// Backstage
merge(config.tasks,{
	uploadOptions: {text: "upload", tooltip: "Change UploadOptions and Upload", content: '<<uploadOptions>>'}
});
config.backstageTasks.push("uploadOptions");


//}}}