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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

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

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

----
Also see [[AdvancedOptions]]
<<importTiddlers>>

[[Introduction]] 

<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]] wikibar'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='wikibar' macro='wikibar'></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>
@@bgcolor(#ff9900):Evaluation Criteria for Talks.@@

 

@@bgcolor(#33ff33):''Presenter'':                @@                                  

*       Clarity of talk:
*       Organization of talk:
*       Motivation: 
*       Technical Contributions:
*       Good use of time/staying within time:
*       Critique/Analysis/Creativity:
*       Handling Questions:
*       Quality of slides:

@@bgcolor(#3399ff):''Discussion Leader'':
@@
*       Steering discussion:
*       Handling questions:
*       Correlating/linking questions:
*       Managing time:
*       Quality of summary notes emailed: 
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 edit''s: <<option txtUserName>>

----

$\sum_{i=1}^{\infty} a_i < \frac{p}{q}$ 

blah 
Here are some bullets that you should find helpful in understanding the ''role of the discussion leader (DL) and the difference between a DL and a presenter.'' 
* Please keep in mind, one of the key goals in giving presentations of papers is to make them analytically as evaluative and critical as possible. 
* Each speaker gets ''20 minutes'' for their talk. Plan your presentation into sub-sections and budget times for each sub-section. Giving an effective talk is an art and planning can often make a big difference. 
* In planning your talk, figure ''20 minutes'' for your presentation plus ''15 minutes'' for Q&A/discussion. 
* Be aware that there might be questions along the way. 

The main ''distinction between a presenter and a DL'' is this:
* Think of DL acting as a "session chair" at a conference, so there is a bit of administrative work such as managing time, deciding whether to admit the next question, how many questions to admit based on time, when to close the session, etc. The DL will also clock the speaker and make sure the speaker doesn’t run over his/her allotted time. 
* ''The total time for a talk is 20 minutes for the presentation plus 15 minutes for Q&A + Discussion. ''
* In addition to posted questions from the audience, there will be ''impromptu questions'' from me. 
* Unlike conference session chair, however, a DL can answer questions and/or rephrase answers from the presenter to an audience question that the asker may not understand. So, the presenter gets the first shot at answering every question, after which it falls on the DL to elaborate if needed, etc. 
* The DL should also ''keep notes ''(I'd strongly advise this) on questions and answers during the session.
* S/he should identify related questions regardless of whether they are chronologically next to each other and point that out to the audience. Additionally, they should point out what is common and/or how things are related. 
* S/he should mediate between the presenter and the asker if need be to resolve unresolved issues.
* Finally, the ''DL should email me a summary of the questions/answers'' during the session they DL'ed. This is where the notes mentioned earlier would come in handy. The summary can be in bullet form.
* How many questions should you send me on the papers you read and prepare questions on? 
** I wouldn’t put a hard lower/upper bound on the #questions I want people to send me. It can vary between papers. Something like 2-3 sounds appropriate, depending on the depth, detail of the questions and the anticipated effort involved in answering them. 
*       Any tips on giving good presentations? 
** Remember, giving good (technical) talks is an art and takes time and much practice. While a few general tips are available from many resources (here is [[one|http://cse.unl.edu/~sscott/presentation-tips/]], thanks to Stephen Scott, which includes a collection of pointers to a few other resources). ''This also includes resources for tips on good technical writing, which will come in handy to you later.''  Whatever tips you pick up – from the above resource or elsewhere – you must make sure to adapt it to the specific context. E.g., tips for job talks should not be applied “as is” when giving a presentation of someone else’s paper, and instead must be adjusted appropriately. 
*       Any tips on writing good reports/papers? 
** You don’t need this just yet, but when the time comes, do check in on the above resource. It does cover good technical writing as much as it covers giving good talks. 

 

 

 
A paper presentation will have three parties driving it: the //presenter//, the //discussion leader//, and the rest, acting as //audience//. //''Everyone should present paper(s) and should lead the discussion on paper(s) presented by someone else.''// //Thus, for different papers, your roles may change.// 

Everyone must read every paper, ahead of its presentation. The audience for a paper presentation should email the presenter and the discussion leader a list of key questions on the paper, ''NO LATER THAN 5 PM'' the day before the presentation. The discussion leader will consolidate the questions into a google document and share it with the presenter and with me, ahead of the presentation. The idea is for the presenter and the discussion leader prepare careful answers to those questions. 

As the names suggest, the presenter will present the paper and discussion leader will manage and steer the discussion, including Q&A, on the paper. 

What follow are some instructions and tips on what to look for when reading papers, how to give effective talks, and links to related resources. 

The presenter has to summarize the problem(s) studied in the paper, the motivation, the contributions, and highlight the methodology/techniques developed/used to solve the problem. In addition, they should make a case for why the paper has merit and articulate value of the contributions. What was missed by the authors or wasn’t addressed well by them? 
*      Not a “straight” linear presentation.
*      Should be a critique.
*      Should get people excited/thinking about the paper.
*      Not too superficial and not too dragging through the mud. 
Some guidelines for preparing for paper presentations and for leading discussions may be found at [[Guidelines for Speakers and Discussion Leaders]]. 
In recent years, various networks including online social networks, information networks, networks of resources etc and recommender systems have gained tremendous popularity. There is talk of social networks, supposedly an integral part of the so-called Web 2.0, revolutionizing the way we use the web to get information, discover resources and to get work done. And Web 3.0 (with its social and semantic components) is supposed to make the web far more intelligent, that by comparison, today's web may look lame. There is also increasing noise about recommendations being a competitive alternative to search as a preferred way of finding information of interest. It is believed an integrated paradigm that combines search with recommendations will significantly boost the quality of resource discovery. 

In this course, we will take a step back from all the hype, even from the specifics of the technologies and focus on the underlying principles, with a special emphasis on Social Networks and Recommender Systems. We will focus on the technical aspects of modeling, searching, and mining motivated by challenging research problems that arise in their context and on designing and analyzing algorithms for solving those problems. 

Here is an [[Outline]] of the course, the place to go to for all lecture slides. 

For the course schedule, see [[Schedule]]. 
Click [[here |http://www.cs.ubc.ca/~laks/534l/cpsc534lIntro.pptx]] for the Intro slides. 
[[Introduction]]
------
[[Schedule]]
------
[[Outline]] 
------
[[Student Talks]]
------
[[Marking Scheme]]
------
[[Instructions and Tips on Paper Presentations]] 
------
[[Guidelines for Speakers and Discussion Leaders]] 
------
[[Evaluation of Presentations and Discussion Leadership]] 
------
[[Project Topics]] 
------
[[Project Deadlines and Deliverables]] 
------
[[Assignments]] 
------
[[Project Talk Scheule]] 
*Homework Assignments: 20%. 
*Class Participation: 5% 
*Paper Presentation/Discussion: 30% 
*Course Project: 45% 
/***
|''Name:''|MathSVGPlugin|
|''Description:''|This plugin translates a subset of the LaTeX math notation to MathML with a customisable  image fallback when MathML is not supported. It also provides an easy way to produce mathematical SVG graphics with dynamical features and animation.|
|''Version:''|1.2.2|
|''Date:''|2009-06-25|
|''Source:''|http://www.math.ist.utl.pt/~psoares/mathsvg.html|
|''Author:''|Paulo Soares|
|''License:''|[[GNU Lesser General Public License|http://www.gnu.org/licences/lgpl.html]]|
|''~CoreVersion:''|2.5.0|
!Original copyright notice
{{{
ASCIIMathML.js
==============
Version 2.1 Oct 8, 2008, (c) Peter Jipsen http://www.chapman.edu/~jipsen
This version extends ASCIIMathML.js with LaTeXMathML.js and ASCIIsvg.js.
Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js
If you use it on a webpage, please send the URL to jipsen@chapman.edu

The LaTeXMathML modifications were made by Douglas Woodall, June 2006.
(for details see header on the LaTeXMathML part in middle of file)
Extensive clean-up and improvements by Paulo Soares, Oct 2007.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 
(at http://www.gnu.org/licences/lgpl.html) for more details.
}}}
!~MathSVG code (minified)
***/
//{{{
Math.sec=function(a){return 1/Math.cos(a)};Math.csc=function(a){return 1/Math.sin(a)};Math.cot=function(a){return 1/Math.tan(a)};Math.asec=function(a){return Math.acos(1/a)};Math.acsc=function(a){return Math.asin(1/a)};Math.acot=function(a){return Math.atan(1/a)};Math.sinh=function(a){return(Math.exp(a)-Math.exp(-a))/2};Math.cosh=function(a){return(Math.exp(a)+Math.exp(-a))/2};Math.tanh=function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};Math.sech=function(a){return 1/Math.cosh(a)};Math.csch=function(a){return 1/Math.sinh(a)};Math.coth=function(a){return 1/Math.tanh(a)};Math.asinh=function(a){return Math.log(a+Math.sqrt(a*a+1))};Math.acosh=function(a){return Math.log(a+Math.sqrt(a*a-1))};Math.atanh=function(a){return Math.log((1+a)/(1-a))/2};Math.sech=function(a){return 1/Math.cosh(a)};Math.csch=function(a){return 1/Math.sinh(a)};Math.coth=function(a){return 1/Math.tanh(a)};Math.asech=function(a){return Math.acosh(1/a)};Math.acsch=function(a){return Math.asinh(1/a)};Math.acoth=function(a){return Math.atanh(1/a)};Math.sign=function(a){return(a===0?0:(a<0?-1:1))};Math.step=function(a,c,b){return(a<0?(b?b:0):(c?c:1))};Math.root=function(a,b){return Math.pow(a,1/b)};Math.factorial=function(b){if(b===0){return 1}if(b<0){if((b%1)===0){return}if(b>-1){return Math.factorial(b+1)/(b+1)}return -Math.PI/(Math.factorial(-1-b)*Math.sin(Math.PI*b))}var a=b;if((b%1)===0){while(b>1){b=b-1;a=a*b}}else{a=Math.exp((b+0.5)*Math.log(b+1)-b-b*(0.1121105+b*0.08106103)/(1.452342+b*(2.410858+b)))}return a};Math.Gamma=function(a){return Math.factorial(a-1)};Math.Beta=function(a,b){return Math.Gamma(a)*Math.Gamma(b)/Math.Gamma(a+b)};Math.C=function(a,b){var c=1/((a+1)*Math.Beta(b+1,a-b+1));return c};Math.truncate=function(a,c){var b=c||0;return Math.floor(a*Math.pow(10,b))/Math.pow(10,b)};Math.randomString=function(a,g){var f=(g||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").split("");var e=[],c=Math.random;var d=f.length;for(var b=0;b<a;b++){e[b]=f[0|c()*d]}return e.join("")};Math.runif=function(d,c,f){var e=f||0;return Math.truncate((c+Math.pow(10,-e)-d)*Math.random()+d,e)};Math.rnormal=function(a,b){a=a||0;b=b||1;var d=0,c=0;while(d*c===0){d=Math.random();c=Math.random()}return b*(Math.sqrt(-2*Math.log(d))*Math.cos(2*Math.PI*c))+a};var MSVG=function(j){var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";var q=["\uD835\uDC9C","\u212C","\uD835\uDC9E","\uD835\uDC9F","\u2130","\u2131","\uD835\uDCA2","\u210B","\u2110","\uD835\uDCA5","\uD835\uDCA6","\u2112","\u2133","\uD835\uDCA9","\uD835\uDCAA","\uD835\uDCAB","\uD835\uDCAC","\u211B","\uD835\uDCAE","\uD835\uDCAF","\uD835\uDCB0","\uD835\uDCB1","\uD835\uDCB2","\uD835\uDCB3","\uD835\uDCB4","\uD835\uDCB5","\uD835\uDCB6","\uD835\uDCB7","\uD835\uDCB8","\uD835\uDCB9","\u212F","\uD835\uDCBB","\u210A","\uD835\uDCBD","\uD835\uDCBE","\uD835\uDCBF","\uD835\uDCC0","\uD835\uDCC1","\uD835\uDCC2","\uD835\uDCC3","\u2134","\uD835\uDCC5","\uD835\uDCC6","\uD835\uDCC7","\uD835\uDCC8","\uD835\uDCC9","\uD835\uDCCA","\uD835\uDCCB","\uD835\uDCCC","\uD835\uDCCD","\uD835\uDCCE","\uD835\uDCCF"];var B=["\uD835\uDD04","\uD835\uDD05","\u212D","\uD835\uDD07","\uD835\uDD08","\uD835\uDD09","\uD835\uDD0A","\u210C","\u2111","\uD835\uDD0D","\uD835\uDD0E","\uD835\uDD0F","\uD835\uDD10","\uD835\uDD11","\uD835\uDD12","\uD835\uDD13","\uD835\uDD14","\u211C","\uD835\uDD16","\uD835\uDD17","\uD835\uDD18","\uD835\uDD19","\uD835\uDD1A","\uD835\uDD1B","\uD835\uDD1C","\u2128","\uD835\uDD1E","\uD835\uDD1F","\uD835\uDD20","\uD835\uDD21","\uD835\uDD22","\uD835\uDD23","\uD835\uDD24","\uD835\uDD25","\uD835\uDD26","\uD835\uDD27","\uD835\uDD28","\uD835\uDD29","\uD835\uDD2A","\uD835\uDD2B","\uD835\uDD2C","\uD835\uDD2D","\uD835\uDD2E","\uD835\uDD2F","\uD835\uDD30","\uD835\uDD31","\uD835\uDD32","\uD835\uDD33","\uD835\uDD34","\uD835\uDD35","\uD835\uDD36","\uD835\uDD37"];var p=["\uD835\uDD38","\uD835\uDD39","\u2102","\uD835\uDD3B","\uD835\uDD3C","\uD835\uDD3D","\uD835\uDD3E","\u210D","\uD835\uDD40","\uD835\uDD41","\uD835\uDD42","\uD835\uDD43","\uD835\uDD44","\u2115","\uD835\uDD46","\u2119","\u211A","\u211D","\uD835\uDD4A","\uD835\uDD4B","\uD835\uDD4C","\uD835\uDD4D","\uD835\uDD4E","\uD835\uDD4F","\uD835\uDD50","\u2124","\uD835\uDD52","\uD835\uDD53","\uD835\uDD54","\uD835\uDD55","\uD835\uDD56","\uD835\uDD57","\uD835\uDD58","\uD835\uDD59","\uD835\uDD5A","\uD835\uDD5B","\uD835\uDD5C","\uD835\uDD5D","\uD835\uDD5E","\uD835\uDD5F","\uD835\uDD60","\uD835\uDD61","\uD835\uDD62","\uD835\uDD63","\uD835\uDD64","\uD835\uDD65","\uD835\uDD66","\uD835\uDD67","\uD835\uDD68","\uD835\uDD69","\uD835\uDD6A","\uD835\uDD6B"];var x=0,b=1,c=2,m=3,v=4,d=5,n=6,o=7,l=8,e=9,z=10,y=11,g=13,i=14;var a=[{input:"\\varepsilon",tag:"mi",output:"\u025B",ttype:x},{input:"\\varsigma",tag:"mi",output:"\u03C2",ttype:x},{input:"\\vartheta",tag:"mi",output:"\u03D1",ttype:x},{input:"\\varphi",tag:"mi",output:"\u03D5",ttype:x},{input:"\\varpi",tag:"mi",output:"\u03D6",ttype:x},{input:"\\varrho",tag:"mi",output:"\u03F1",ttype:x},{input:"\\alpha",tag:"mi",output:"\u03B1",ttype:x},{input:"\\beta",tag:"mi",output:"\u03B2",ttype:x},{input:"\\gamma",tag:"mi",output:"\u03B3",ttype:x},{input:"\\delta",tag:"mi",output:"\u03B4",ttype:x},{input:"\\epsilon",tag:"mi",output:"\u03B5",ttype:x},{input:"\\zeta",tag:"mi",output:"\u03B6",ttype:x},{input:"\\eta",tag:"mi",output:"\u03B7",ttype:x},{input:"\\theta",tag:"mi",output:"\u03B8",ttype:x},{input:"\\iota",tag:"mi",output:"\u03B9",ttype:x},{input:"\\kappa",tag:"mi",output:"\u03BA",ttype:x},{input:"\\lambda",tag:"mi",output:"\u03BB",ttype:x},{input:"\\mu",tag:"mi",output:"\u03BC",ttype:x},{input:"\\nu",tag:"mi",output:"\u03BD",ttype:x},{input:"\\xi",tag:"mi",output:"\u03BE",ttype:x},{input:"\\omicron",tag:"mi",output:"\u03BF",ttype:x},{input:"\\pi",tag:"mi",output:"\u03C0",ttype:x},{input:"\\rho",tag:"mi",output:"\u03C1",ttype:x},{input:"\\sigma",tag:"mi",output:"\u03C3",ttype:x},{input:"\\tau",tag:"mi",output:"\u03C4",ttype:x},{input:"\\upsilon",tag:"mi",output:"\u03C5",ttype:x},{input:"\\phi",tag:"mi",output:"\u03C6",ttype:x},{input:"\\chi",tag:"mi",output:"\u03C7",ttype:x},{input:"\\psi",tag:"mi",output:"\u03C8",ttype:x},{input:"\\omega",tag:"mi",output:"\u03C9",ttype:x},{input:"\\Alpha",tag:"mo",output:"\u0391",ttype:x},{input:"\\Beta",tag:"mo",output:"\u0392",ttype:x},{input:"\\Gamma",tag:"mo",output:"\u0393",ttype:x},{input:"\\Delta",tag:"mo",output:"\u0394",ttype:x},{input:"\\Epsilon",tag:"mo",output:"\u0395",ttype:x},{input:"\\Zeta",tag:"mo",output:"\u0396",ttype:x},{input:"\\Eta",tag:"mo",output:"\u0397",ttype:x},{input:"\\Theta",tag:"mo",output:"\u0398",ttype:x},{input:"\\Iota",tag:"mo",output:"\u0399",ttype:x},{input:"\\Kappa",tag:"mo",output:"\u039A",ttype:x},{input:"\\Lambda",tag:"mo",output:"\u039B",ttype:x},{input:"\\Mu",tag:"mo",output:"\u039C",ttype:x},{input:"\\Nu",tag:"mo",output:"\u039D",ttype:x},{input:"\\Xi",tag:"mo",output:"\u039E",ttype:x},{input:"\\Omicron",tag:"mo",output:"\u039F",ttype:x},{input:"\\Pi",tag:"mo",output:"\u03A0",ttype:x},{input:"\\Rho",tag:"mo",output:"\u03A1",ttype:x},{input:"\\Sigma",tag:"mo",output:"\u03A3",ttype:x},{input:"\\Tau",tag:"mo",output:"\u03A4",ttype:x},{input:"\\Upsilon",tag:"mo",output:"\u03A5",ttype:x},{input:"\\Phi",tag:"mo",output:"\u03A6",ttype:x},{input:"\\Chi",tag:"mo",output:"\u03A7",ttype:x},{input:"\\Psi",tag:"mo",output:"\u03A8",ttype:x},{input:"\\Omega",tag:"mo",output:"\u03A9",ttype:x},{input:"\\frac12",tag:"mo",output:"\u00BD",ttype:x},{input:"\\frac14",tag:"mo",output:"\u00BC",ttype:x},{input:"\\frac34",tag:"mo",output:"\u00BE",ttype:x},{input:"\\frac13",tag:"mo",output:"\u2153",ttype:x},{input:"\\frac23",tag:"mo",output:"\u2154",ttype:x},{input:"\\frac15",tag:"mo",output:"\u2155",ttype:x},{input:"\\frac25",tag:"mo",output:"\u2156",ttype:x},{input:"\\frac35",tag:"mo",output:"\u2157",ttype:x},{input:"\\frac45",tag:"mo",output:"\u2158",ttype:x},{input:"\\frac16",tag:"mo",output:"\u2159",ttype:x},{input:"\\frac56",tag:"mo",output:"\u215A",ttype:x},{input:"\\frac18",tag:"mo",output:"\u215B",ttype:x},{input:"\\frac38",tag:"mo",output:"\u215C",ttype:x},{input:"\\frac58",tag:"mo",output:"\u215D",ttype:x},{input:"\\frac78",tag:"mo",output:"\u215E",ttype:x},{input:"\\pm",tag:"mo",output:"\u00B1",ttype:x},{input:"\\mp",tag:"mo",output:"\u2213",ttype:x},{input:"\\triangleleft",tag:"mo",output:"\u22B2",ttype:x},{input:"\\triangleright",tag:"mo",output:"\u22B3",ttype:x},{input:"\\cdot",tag:"mo",output:"\u22C5",ttype:x},{input:"\\star",tag:"mo",output:"\u22C6",ttype:x},{input:"\\ast",tag:"mo",output:"\u002A",ttype:x},{input:"\\times",tag:"mo",output:"\u00D7",ttype:x},{input:"\\div",tag:"mo",output:"\u00F7",ttype:x},{input:"\\circ",tag:"mo",output:"\u2218",ttype:x},{input:"\\bullet",tag:"mo",output:"\u2022",ttype:x},{input:"\\oplus",tag:"mo",output:"\u2295",ttype:x},{input:"\\ominus",tag:"mo",output:"\u2296",ttype:x},{input:"\\otimes",tag:"mo",output:"\u2297",ttype:x},{input:"\\bigcirc",tag:"mo",output:"\u25CB",ttype:x},{input:"\\oslash",tag:"mo",output:"\u2298",ttype:x},{input:"\\odot",tag:"mo",output:"\u2299",ttype:x},{input:"\\land",tag:"mo",output:"\u2227",ttype:x},{input:"\\wedge",tag:"mo",output:"\u2227",ttype:x},{input:"\\lor",tag:"mo",output:"\u2228",ttype:x},{input:"\\vee",tag:"mo",output:"\u2228",ttype:x},{input:"\\cap",tag:"mo",output:"\u2229",ttype:x},{input:"\\cup",tag:"mo",output:"\u222A",ttype:x},{input:"\\sqcap",tag:"mo",output:"\u2293",ttype:x},{input:"\\sqcup",tag:"mo",output:"\u2294",ttype:x},{input:"\\uplus",tag:"mo",output:"\u228E",ttype:x},{input:"\\amalg",tag:"mo",output:"\u2210",ttype:x},{input:"\\bigtriangleup",tag:"mo",output:"\u25B3",ttype:x},{input:"\\bigtriangledown",tag:"mo",output:"\u25BD",ttype:x},{input:"\\dag",tag:"mo",output:"\u2020",ttype:x},{input:"\\dagger",tag:"mo",output:"\u2020",ttype:x},{input:"\\ddag",tag:"mo",output:"\u2021",ttype:x},{input:"\\ddagger",tag:"mo",output:"\u2021",ttype:x},{input:"\\lhd",tag:"mo",output:"\u22B2",ttype:x},{input:"\\rhd",tag:"mo",output:"\u22B3",ttype:x},{input:"\\unlhd",tag:"mo",output:"\u22B4",ttype:x},{input:"\\unrhd",tag:"mo",output:"\u22B5",ttype:x},{input:"\\sum",tag:"mo",output:"\u2211",ttype:o},{input:"\\prod",tag:"mo",output:"\u220F",ttype:o},{input:"\\bigcap",tag:"mo",output:"\u22C2",ttype:o},{input:"\\bigcup",tag:"mo",output:"\u22C3",ttype:o},{input:"\\bigwedge",tag:"mo",output:"\u22C0",ttype:o},{input:"\\bigvee",tag:"mo",output:"\u22C1",ttype:o},{input:"\\bigsqcap",tag:"mo",output:"\u2A05",ttype:o},{input:"\\bigsqcup",tag:"mo",output:"\u2A06",ttype:o},{input:"\\coprod",tag:"mo",output:"\u2210",ttype:o},{input:"\\bigoplus",tag:"mo",output:"\u2A01",ttype:o},{input:"\\bigotimes",tag:"mo",output:"\u2A02",ttype:o},{input:"\\bigodot",tag:"mo",output:"\u2A00",ttype:o},{input:"\\biguplus",tag:"mo",output:"\u2A04",ttype:o},{input:"\\int",tag:"mo",output:"\u222B",ttype:x},{input:"\\oint",tag:"mo",output:"\u222E",ttype:x},{input:":=",tag:"mo",output:":=",ttype:x},{input:"\\lt",tag:"mo",output:"<",ttype:x},{input:"\\gt",tag:"mo",output:">",ttype:x},{input:"\\ne",tag:"mo",output:"\u2260",ttype:x},{input:"\\neq",tag:"mo",output:"\u2260",ttype:x},{input:"\\le",tag:"mo",output:"\u2264",ttype:x},{input:"\\leq",tag:"mo",output:"\u2264",ttype:x},{input:"\\leqslant",tag:"mo",output:"\u2264",ttype:x},{input:"\\ge",tag:"mo",output:"\u2265",ttype:x},{input:"\\geq",tag:"mo",output:"\u2265",ttype:x},{input:"\\geqslant",tag:"mo",output:"\u2265",ttype:x},{input:"\\equiv",tag:"mo",output:"\u2261",ttype:x},{input:"\\ll",tag:"mo",output:"\u226A",ttype:x},{input:"\\gg",tag:"mo",output:"\u226B",ttype:x},{input:"\\doteq",tag:"mo",output:"\u2250",ttype:x},{input:"\\prec",tag:"mo",output:"\u227A",ttype:x},{input:"\\succ",tag:"mo",output:"\u227B",ttype:x},{input:"\\preceq",tag:"mo",output:"\u227C",ttype:x},{input:"\\succeq",tag:"mo",output:"\u227D",ttype:x},{input:"\\subset",tag:"mo",output:"\u2282",ttype:x},{input:"\\supset",tag:"mo",output:"\u2283",ttype:x},{input:"\\subseteq",tag:"mo",output:"\u2286",ttype:x},{input:"\\supseteq",tag:"mo",output:"\u2287",ttype:x},{input:"\\sqsubset",tag:"mo",output:"\u228F",ttype:x},{input:"\\sqsupset",tag:"mo",output:"\u2290",ttype:x},{input:"\\sqsubseteq",tag:"mo",output:"\u2291",ttype:x},{input:"\\sqsupseteq",tag:"mo",output:"\u2292",ttype:x},{input:"\\sim",tag:"mo",output:"\u223C",ttype:x},{input:"\\simeq",tag:"mo",output:"\u2243",ttype:x},{input:"\\approx",tag:"mo",output:"\u2248",ttype:x},{input:"\\cong",tag:"mo",output:"\u2245",ttype:x},{input:"\\Join",tag:"mo",output:"\u22C8",ttype:x},{input:"\\bowtie",tag:"mo",output:"\u22C8",ttype:x},{input:"\\in",tag:"mo",output:"\u2208",ttype:x},{input:"\\ni",tag:"mo",output:"\u220B",ttype:x},{input:"\\owns",tag:"mo",output:"\u220B",ttype:x},{input:"\\propto",tag:"mo",output:"\u221D",ttype:x},{input:"\\vdash",tag:"mo",output:"\u22A2",ttype:x},{input:"\\dashv",tag:"mo",output:"\u22A3",ttype:x},{input:"\\models",tag:"mo",output:"\u22A8",ttype:x},{input:"\\perp",tag:"mo",output:"\u22A5",ttype:x},{input:"\\smile",tag:"mo",output:"\u2323",ttype:x},{input:"\\frown",tag:"mo",output:"\u2322",ttype:x},{input:"\\asymp",tag:"mo",output:"\u224D",ttype:x},{input:"\\notin",tag:"mo",output:"\u2209",ttype:x},{input:"\\begin{eqnarray}",output:"X",ttype:i,invisible:true},{input:"\\begin{array}",output:"X",ttype:i,invisible:true},{input:"\\\\",output:"}&{",ttype:l},{input:"\\end{eqnarray}",output:"}}",ttype:l},{input:"\\end{array}",output:"}}",ttype:l},{input:"\\big",tag:"mo",output:"X",atval:"1.2",ttype:y},{input:"\\Big",tag:"mo",output:"X",atval:"1.8",ttype:y},{input:"\\bigg",tag:"mo",output:"X",atval:"2.3",ttype:y},{input:"\\Bigg",tag:"mo",output:"X",atval:"2.9",ttype:y},{input:"\\left",tag:"mo",output:"X",ttype:v},{input:"\\right",tag:"mo",output:"X",ttype:d},{input:"{",output:"{",ttype:v,invisible:true},{input:"}",output:"}",ttype:d,invisible:true},{input:"(",tag:"mo",output:"(",atval:"1",ttype:g},{input:"[",tag:"mo",output:"[",atval:"1",ttype:g},{input:"\\lbrack",tag:"mo",output:"[",atval:"1",ttype:g},{input:"\\{",tag:"mo",output:"{",atval:"1",ttype:g},{input:"\\lbrace",tag:"mo",output:"{",atval:"1",ttype:g},{input:"\\langle",tag:"mo",output:"\u2329",atval:"1",ttype:g},{input:"\\lfloor",tag:"mo",output:"\u230A",atval:"1",ttype:g},{input:"\\lceil",tag:"mo",output:"\u2308",atval:"1",ttype:g},{input:")",tag:"mo",output:")",rtag:"mi",atval:"1",ttype:g},{input:"]",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:g},{input:"\\rbrack",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:g},{input:"\\}",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:g},{input:"\\rbrace",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:g},{input:"\\rangle",tag:"mo",output:"\u232A",rtag:"mi",atval:"1",ttype:g},{input:"\\rfloor",tag:"mo",output:"\u230B",rtag:"mi",atval:"1",ttype:g},{input:"\\rceil",tag:"mo",output:"\u2309",rtag:"mi",atval:"1",ttype:g},{input:"|",tag:"mo",output:"\u2223",atval:"1",ttype:g},{input:"\\|",tag:"mo",output:"\u2225",atval:"1",ttype:g},{input:"\\vert",tag:"mo",output:"\u2223",atval:"1",ttype:g},{input:"\\Vert",tag:"mo",output:"\u2225",atval:"1",ttype:g},{input:"\\mid",tag:"mo",output:"\u2223",atval:"1",ttype:g},{input:"\\parallel",tag:"mo",output:"\u2225",atval:"1",ttype:g},{input:"/",tag:"mo",output:"/",atval:"1.01",ttype:g},{input:"\\backslash",tag:"mo",output:"\u2216",atval:"1",ttype:g},{input:"\\setminus",tag:"mo",output:"\\",ttype:x},{input:"\\!",tag:"mspace",atname:"width",atval:"-0.167em",ttype:n},{input:"\\,",tag:"mspace",atname:"width",atval:"0.167em",ttype:n},{input:"\\>",tag:"mspace",atname:"width",atval:"0.222em",ttype:n},{input:"\\:",tag:"mspace",atname:"width",atval:"0.222em",ttype:n},{input:"\\;",tag:"mspace",atname:"width",atval:"0.278em",ttype:n},{input:"~",tag:"mspace",atname:"width",atval:"0.333em",ttype:n},{input:"\\quad",tag:"mspace",atname:"width",atval:"1em",ttype:n},{input:"\\qquad",tag:"mspace",atname:"width",atval:"2em",ttype:n},{input:"\\prime",tag:"mo",output:"\u2032",ttype:x},{input:"'",tag:"mo",output:"\u02B9",ttype:x},{input:"''",tag:"mo",output:"\u02BA",ttype:x},{input:"'''",tag:"mo",output:"\u2034",ttype:x},{input:"''''",tag:"mo",output:"\u2057",ttype:x},{input:"\\ldots",tag:"mo",output:"\u2026",ttype:x},{input:"\\cdots",tag:"mo",output:"\u22EF",ttype:x},{input:"\\vdots",tag:"mo",output:"\u22EE",ttype:x},{input:"\\ddots",tag:"mo",output:"\u22F1",ttype:x},{input:"\\forall",tag:"mo",output:"\u2200",ttype:x},{input:"\\exists",tag:"mo",output:"\u2203",ttype:x},{input:"\\Re",tag:"mo",output:"\u211C",ttype:x},{input:"\\Im",tag:"mo",output:"\u2111",ttype:x},{input:"\\aleph",tag:"mo",output:"\u2135",ttype:x},{input:"\\hbar",tag:"mo",output:"\u210F",ttype:x},{input:"\\ell",tag:"mo",output:"\u2113",ttype:x},{input:"\\wp",tag:"mo",output:"\u2118",ttype:x},{input:"\\emptyset",tag:"mo",output:"\u2205",ttype:x},{input:"\\infty",tag:"mo",output:"\u221E",ttype:x},{input:"\\surd",tag:"mo",output:"\\sqrt{}",ttype:l},{input:"\\partial",tag:"mo",output:"\u2202",ttype:x},{input:"\\nabla",tag:"mo",output:"\u2207",ttype:x},{input:"\\triangle",tag:"mo",output:"\u25B3",ttype:x},{input:"\\therefore",tag:"mo",output:"\u2234",ttype:x},{input:"\\angle",tag:"mo",output:"\u2220",ttype:x},{input:"\\diamond",tag:"mo",output:"\u22C4",ttype:x},{input:"\\Diamond",tag:"mo",output:"\u25C7",ttype:x},{input:"\\neg",tag:"mo",output:"\u00AC",ttype:x},{input:"\\lnot",tag:"mo",output:"\u00AC",ttype:x},{input:"\\bot",tag:"mo",output:"\u22A5",ttype:x},{input:"\\top",tag:"mo",output:"\u22A4",ttype:x},{input:"\\square",tag:"mo",output:"\u25AB",ttype:x},{input:"\\Box",tag:"mo",output:"\u25A1",ttype:x},{input:"\\wr",tag:"mo",output:"\u2240",ttype:x},{input:"\\arccos",tag:"mi",output:"arccos",ttype:b,func:true},{input:"\\arcsin",tag:"mi",output:"arcsin",ttype:b,func:true},{input:"\\arctan",tag:"mi",output:"arctan",ttype:b,func:true},{input:"\\arg",tag:"mi",output:"arg",ttype:b,func:true},{input:"\\cos",tag:"mi",output:"cos",ttype:b,func:true},{input:"\\cosh",tag:"mi",output:"cosh",ttype:b,func:true},{input:"\\cot",tag:"mi",output:"cot",ttype:b,func:true},{input:"\\coth",tag:"mi",output:"coth",ttype:b,func:true},{input:"\\csc",tag:"mi",output:"csc",ttype:b,func:true},{input:"\\deg",tag:"mi",output:"deg",ttype:b,func:true},{input:"\\det",tag:"mi",output:"det",ttype:b,func:true},{input:"\\dim",tag:"mi",output:"dim",ttype:b,func:true},{input:"\\exp",tag:"mi",output:"exp",ttype:b,func:true},{input:"\\gcd",tag:"mi",output:"gcd",ttype:b,func:true},{input:"\\hom",tag:"mi",output:"hom",ttype:b,func:true},{input:"\\inf",tag:"mo",output:"inf",ttype:o},{input:"\\ker",tag:"mi",output:"ker",ttype:b,func:true},{input:"\\lg",tag:"mi",output:"lg",ttype:b,func:true},{input:"\\lim",tag:"mo",output:"lim",ttype:o},{input:"\\liminf",tag:"mo",output:"liminf",ttype:o},{input:"\\limsup",tag:"mo",output:"limsup",ttype:o},{input:"\\ln",tag:"mi",output:"ln",ttype:b,func:true},{input:"\\log",tag:"mi",output:"log",ttype:b,func:true},{input:"\\max",tag:"mo",output:"max",ttype:o},{input:"\\min",tag:"mo",output:"min",ttype:o},{input:"\\Pr",tag:"mi",output:"Pr",ttype:b,func:true},{input:"\\sec",tag:"mi",output:"sec",ttype:b,func:true},{input:"\\sin",tag:"mi",output:"sin",ttype:b,func:true},{input:"\\sinh",tag:"mi",output:"sinh",ttype:b,func:true},{input:"\\sup",tag:"mo",output:"sup",ttype:o},{input:"\\tan",tag:"mi",output:"tan",ttype:b,func:true},{input:"\\tanh",tag:"mi",output:"tanh",ttype:b,func:true},{input:"\\gets",tag:"mo",output:"\u2190",ttype:x},{input:"\\leftarrow",tag:"mo",output:"\u2190",ttype:x},{input:"\\to",tag:"mo",output:"\u2192",ttype:x},{input:"\\rightarrow",tag:"mo",output:"\u2192",ttype:x},{input:"\\leftrightarrow",tag:"mo",output:"\u2194",ttype:x},{input:"\\uparrow",tag:"mo",output:"\u2191",ttype:x},{input:"\\downarrow",tag:"mo",output:"\u2193",ttype:x},{input:"\\updownarrow",tag:"mo",output:"\u2195",ttype:x},{input:"\\Leftarrow",tag:"mo",output:"\u21D0",ttype:x},{input:"\\Rightarrow",tag:"mo",output:"\u21D2",ttype:x},{input:"\\Leftrightarrow",tag:"mo",output:"\u21D4",ttype:x},{input:"\\iff",tag:"mo",output:"~\\Longleftrightarrow~",ttype:l},{input:"\\Uparrow",tag:"mo",output:"\u21D1",ttype:x},{input:"\\Downarrow",tag:"mo",output:"\u21D3",ttype:x},{input:"\\Updownarrow",tag:"mo",output:"\u21D5",ttype:x},{input:"\\mapsto",tag:"mo",output:"\u21A6",ttype:x},{input:"\\longleftarrow",tag:"mo",output:"\u27F5",ttype:x},{input:"\\longrightarrow",tag:"mo",output:"\u27F6",ttype:x},{input:"\\longleftrightarrow",tag:"mo",output:"\u27F7",ttype:x},{input:"\\Longleftarrow",tag:"mo",output:"\u27F8",ttype:x},{input:"\\Longrightarrow",tag:"mo",output:"\u27F9",ttype:x},{input:"\\Longleftrightarrow",tag:"mo",output:"\u27FA",ttype:x},{input:"\\longmapsto",tag:"mo",output:"\u27FC",ttype:x},{input:"\\sqrt",tag:"msqrt",output:"sqrt",ttype:b},{input:"\\root",tag:"mroot",output:"root",ttype:c},{input:"\\frac",tag:"mfrac",output:"/",ttype:c},{input:"\\stackrel",tag:"mover",output:"stackrel",ttype:c},{input:"\\atop",tag:"mfrac",output:"",ttype:m},{input:"\\choose",tag:"mfrac",output:"",ttype:m},{input:"_",tag:"msub",output:"_",ttype:m},{input:"^",tag:"msup",output:"^",ttype:m},{input:"\\mbox",tag:"mtext",output:"mbox",ttype:z},{input:"\\acute",tag:"mover",output:"\u00B4",ttype:b,acc:true},{input:"\\grave",tag:"mover",output:"\u0060",ttype:b,acc:true},{input:"\\breve",tag:"mover",output:"\u02D8",ttype:b,acc:true},{input:"\\check",tag:"mover",output:"\u02C7",ttype:b,acc:true},{input:"\\dot",tag:"mover",output:".",ttype:b,acc:true},{input:"\\ddot",tag:"mover",output:"..",ttype:b,acc:true},{input:"\\mathring",tag:"mover",output:"\u00B0",ttype:b,acc:true},{input:"\\vec",tag:"mover",output:"\u20D7",ttype:b,acc:true},{input:"\\overrightarrow",tag:"mover",output:"\u20D7",ttype:b,acc:true},{input:"\\overleftarrow",tag:"mover",output:"\u20D6",ttype:b,acc:true},{input:"\\hat",tag:"mover",output:"\u005E",ttype:b,acc:true},{input:"\\widehat",tag:"mover",output:"\u0302",ttype:b,acc:true},{input:"\\tilde",tag:"mover",output:"~",ttype:b,acc:true},{input:"\\widetilde",tag:"mover",output:"\u02DC",ttype:b,acc:true},{input:"\\bar",tag:"mover",output:"\u203E",ttype:b,acc:true},{input:"\\overbrace",tag:"mover",output:"\u23B4",ttype:b,acc:true},{input:"\\overline",tag:"mover",output:"\u00AF",ttype:b,acc:true},{input:"\\underbrace",tag:"munder",output:"\u23B5",ttype:b,acc:true},{input:"\\underline",tag:"munder",output:"\u00AF",ttype:b,acc:true},{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true",ttype:b},{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false",ttype:b},{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1",ttype:b},{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2",ttype:b},{input:"\\mathrm",tag:"mtext",output:"text",ttype:z},{input:"\\textrm",tag:"mtext",output:"text",ttype:z},{input:"\\mathbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:b,codes:s},{input:"\\textbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:b,codes:s},{input:"\\mathit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:b},{input:"\\textit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:b},{input:"\\mathtt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:b,codes:s},{input:"\\texttt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:b,codes:s},{input:"\\mathsf",tag:"mstyle",atname:"mathvariant",atval:"sans-serif",ttype:b,codes:s},{input:"\\mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",ttype:b,codes:p},{input:"\\mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",ttype:b,codes:q},{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",ttype:b,codes:B}];var r=[];function k(){return(j.browser.mozilla||j.browser.opera)}function E(F,G){if(F.input>G.input){return 1}else{return -1}}function u(){var F=a.length;a.sort(E);for(var G=0;G<F;G++){r[G]=a[G].input}}function w(F,G){return j.trim(F.slice(G))}function C(G,I){var H=r.indexOf(G,I);if(H<0){var F=r.concat([G]);F.sort();H=F.indexOf(G,I)}return H}function t(M){var F=0;var G=0;var I;var O;var N;var J="";var L=true;var K=M.length;for(var H=1;H<=K&&L;H++){O=M.slice(0,H);G=F;F=C(O,G);if(F<r.length&&M.slice(0,r[F].length)==r[F]){J=r[F];I=F;H=J.length}L=F<r.length&&M.slice(0,r[F].length)>=r[F]}if(J!==""){return a[I]}F=1;O=M.slice(0,1);if("0"<=O&&O<="9"){N="mn"}else{N=(("A">O||O>"Z")&&("a">O||O>"z")?"mo":"mi")}return{input:O,tag:N,output:O,ttype:x}}function f(N){var I,G,S,H,K,Q,M=document.createDocumentFragment();N=j.trim(N);I=t(N);if(I===null||I.ttype==d){return[null,N,null]}if(I.ttype==l){N=I.output+w(N,I.input.length);I=t(N);if(I===null||I.ttype==d){return[null,N,null]}}N=w(N,I.input.length);switch(I.ttype){case n:G=A(I.tag);G.setAttribute(I.atname,I.atval);return[G,N,I.tag];case o:return[A(I.tag,document.createTextNode(I.output)),N,I.tag];case x:G=A(I.tag,document.createTextNode(I.output));return[G,N,I.tag];case g:G=A(I.tag,document.createTextNode(I.output));if(I.input=="|"||I.input=="\\vert"||I.input=="\\|"||I.input=="\\Vert"){G.setAttribute("lspace","0em");G.setAttribute("rspace","0em")}G.setAttribute("maxsize",I.atval);if(I.rtag!==null){return[G,N,I.rtag]}else{return[G,N,I.tag]}case y:var L=I.atval;I=t(N);if(I===null){return[null,N,null]}N=w(N,I.input.length);G=A(I.tag,document.createTextNode(I.output));G.setAttribute("minsize",L);G.setAttribute("maxsize",L);return[G,N,I.tag];case v:if(I.input=="\\left"){I=t(N);if(I!==null){if(I.input=="."){I.invisible=true}N=w(N,I.input.length)}}S=h(N,true,false);if(I===null||(typeof I.invisible=="boolean"&&I.invisible)){G=A("mrow",S[0])}else{G=A("mo",document.createTextNode(I.output));G=A("mrow",G);G.appendChild(S[0])}return[G,S[1],S[2]];case i:if(I.input=="\\begin{array}"){var R="";I=t(N);N=j.trim(N);if(I===null){R="l"}else{N=w(N,I.input.length);if(I.input!="{"){R="l"}else{do{I=t(N);if(I!==null){N=w(N,I.input.length);if(I.input!="}"){R=R+I.input}}}while(I!==null&&I.input!==""&&I.input!="}")}}S=h("{"+N,true,true);G=A("mtable",S[0]);R=R.replace(/l/g,"left ");R=R.replace(/r/g,"right ");R=R.replace(/c/g,"center ");G.setAttribute("columnalign",R);G.setAttribute("displaystyle","false");return[G,S[1],null]}else{S=h("{"+N,true,true);G=A("mtable",S[0]);G.setAttribute("columnspacing","0.167em");G.setAttribute("columnalign","right center left");G.setAttribute("displaystyle","true");G=A("mrow",G);return[G,S[1],null]}case z:if(N.charAt(0)=="{"){K=N.indexOf("}")}else{K=0}if(K==-1){K=N.length}Q=N.slice(1,K);M.appendChild(A(I.tag,document.createTextNode(Q)));N=w(N,K+1);return[A("mrow",M),N,null];case b:S=f(N);if(S[0]===null){return[A(I.tag,document.createTextNode(I.output)),N]}if(typeof I.func=="boolean"&&I.func){Q=N.charAt(0);if(Q=="^"||Q=="_"||Q==","){return[A(I.tag,document.createTextNode(I.output)),N,I.tag]}else{G=A("mrow",A(I.tag,document.createTextNode(I.output)));G.appendChild(S[0]);return[G,S[1],I.tag]}}if(I.input=="\\sqrt"){return[A(I.tag,S[0]),S[1],I.tag]}else{if(typeof I.acc=="boolean"&&I.acc){G=A(I.tag,S[0]);var F=I.output;var P=A("mo",document.createTextNode(F));if(I.input=="\\vec"||I.input=="\\check"){P.setAttribute("maxsize","1.2")}if(I.input=="\\underbrace"||I.input=="\\underline"){P.setAttribute("accentunder","true")}else{P.setAttribute("accent","true")}G.appendChild(P);if(I.input=="\\overbrace"||I.input=="\\underbrace"){G.ttype=o}return[G,S[1],I.tag]}else{if(typeof I.codes!="undefined"){for(K=0;K<S[0].childNodes.length;K++){if(S[0].childNodes[K].nodeName=="mi"||S[0].nodeName=="mi"){Q=(S[0].nodeName=="mi"?S[0].firstChild.nodeValue:S[0].childNodes[K].firstChild.nodeValue);var O=[];for(var J=0;J<Q.length;J++){if(Q.charCodeAt(J)>64&&Q.charCodeAt(J)<91){O=O+I.codes[Q.charCodeAt(J)-65]}else{if(Q.charCodeAt(J)>96&&Q.charCodeAt(J)<123){O=O+I.codes[Q.charCodeAt(J)-71]}}}if(S[0].nodeName=="mi"){S[0]=A("mo").appendChild(document.createTextNode(O))}else{S[0].replaceChild(A("mo").appendChild(document.createTextNode(O)),S[0].childNodes[K])}}}}G=A(I.tag,S[0]);G.setAttribute(I.atname,I.atval);if(I.input=="\\scriptstyle"||I.input=="\\scriptscriptstyle"){G.setAttribute("displaystyle","false")}return[G,S[1],I.tag]}}case c:S=f(N);if(S[0]===null){return[A("mo",document.createTextNode(I.input)),N,null]}H=f(S[1]);if(H[0]===null){return[A("mo",document.createTextNode(I.input)),N,null]}if(I.input=="\\root"||I.input=="\\stackrel"){M.appendChild(H[0])}M.appendChild(S[0]);if(I.input=="\\frac"){M.appendChild(H[0])}return[A(I.tag,M),H[1],I.tag];case m:N=w(N,I.input.length);return[A("mo",document.createTextNode(I.output)),N,I.tag];default:return[A(I.tag,document.createTextNode(I.output)),N,I.tag]}}function D(K){var J,H,G,I,M,N,L;H=t(K);M=f(K);I=M[0];K=M[1];N=M[2];J=t(K);if(J.ttype==m){K=w(K,J.input.length);M=f(K);if(M[0]===null){M[0]=A("mo",document.createTextNode("\u25A1"))}K=M[1];N=M[2];if(J.input=="_"||J.input=="^"){G=t(K);N=null;L=((H.ttype==o)||(I.ttype==o));if(J.input=="_"&&G.input=="^"){K=w(K,G.input.length);var F=f(K);K=F[1];N=F[2];I=A((L?"munderover":"msubsup"),I);I.appendChild(M[0]);I.appendChild(F[0])}else{if(J.input=="_"){I=A((L?"munder":"msub"),I);I.appendChild(M[0])}else{I=A((L?"mover":"msup"),I);I.appendChild(M[0])}}I=A("mrow",I)}else{I=A(J.tag,I);if(J.input=="\\atop"||J.input=="\\choose"){I.setAttribute("linethickness","0ex")}I.appendChild(M[0]);if(J.input=="\\choose"){I=A("mfenced",I)}}}return[I,K,N]}function h(M,L,R){var Q,N,I,T,X,J=document.createDocumentFragment();do{M=j.trim(M);I=D(M);N=I[0];M=I[1];X=I[2];Q=t(M);if(N!=undefined){if((X=="mn"||X=="mi")&&Q!==null&&typeof Q.func=="boolean"&&Q.func){var W=A("mspace");W.setAttribute("width","0.167em");N=A("mrow",N);N.appendChild(W)}J.appendChild(N)}}while((Q.ttype!=d)&&Q!==null&&Q.output!="");X=null;if(Q.ttype==d){if(Q.input=="\\right"){M=w(M,Q.input.length);Q=t(M);if(Q!==null&&Q.input=="."){Q.invisible=true}if(Q!==null){X=Q.rtag}}if(Q!==null){M=w(M,Q.input.length)}var U=J.childNodes.length;if(R&&U>0&&J.childNodes[U-1].nodeName=="mrow"&&U>1&&J.childNodes[U-2].nodeName=="mo"&&J.childNodes[U-2].firstChild.nodeValue=="&"){var G=[];var O=J.childNodes.length;for(T=0;R&&T<O;T=T+2){G[T]=[];N=J.childNodes[T];for(var S=0;S<N.childNodes.length;S++){if(N.childNodes[S].firstChild.nodeValue=="&"){G[T][G[T].length]=S}}}var H,F,K,P,V=document.createDocumentFragment();for(T=0;T<O;T=T+2){H=document.createDocumentFragment();F=document.createDocumentFragment();N=J.firstChild;K=N.childNodes.length;P=0;for(S=0;S<K;S++){if(typeof G[T][P]!="undefined"&&S==G[T][P]){N.removeChild(N.firstChild);H.appendChild(A("mtd",F));P++}else{F.appendChild(N.firstChild)}}H.appendChild(A("mtd",F));if(J.childNodes.length>2){J.removeChild(J.firstChild);J.removeChild(J.firstChild)}V.appendChild(A("mtr",H))}return[V,M]}if(typeof Q.invisible!="boolean"||!Q.invisible){N=A("mo",document.createTextNode(Q.output));J.appendChild(N)}}return[J,M,X]}if(!document.createElementNS){document.createElementNS=function(G,F){return this.createElement(F)}}function A(F,H){var G=document.createElementNS("http://www.w3.org/1998/Math/MathML",F);if(H){j(G).append(H)}return G}return{showFormulaOnMouseOver:false,latexImages:false,latexConverter:"http://www.forkosh.dreamhost.com/mimetex.cgi?",mathColor:"black",mathFontSize:"",mathFontFamily:"",createElementXHTML:function(F,G,I){var H=document.createElementNS("http://www.w3.org/1999/xhtml",F);if(G){H.id=G}if(I){H.className=I}return H},define:function(H,I){if(MSVG.latexImages){return}if((typeof H)=="string"){H=[H];I=[I]}var G,F=H.length;if(F!=I.length){return}for(G=0;G<F;G++){a=a.concat([{input:"\\"+H[G],tag:"mo",output:I[G],ttype:l}])}u()},parseMath:function(J,I,G,F){if(J===null){return null}var K=h(J.replace(/^\s+/g,""),false,false)[0];var H=A("mstyle",K);if(I){j(H).attr({displaystyle:"true"})}j(H).attr({mathcolor:F||MSVG.mathColor,fontsize:G||MSVG.mathFontSize,fontfamily:MSVG.mathFontFamily});H=A("math",H);if(MSVG.showFormulaOnMouseOver){j(H).attr({title:J.replace(/\s+/g," ")})}return H},parseMathExternal:function(K,J,G,F){if(K===null){return null}var I=MSVG.createElementXHTML("img");var H=MSVG.latexConverter+K;j(I).attr({src:H});if(MSVG.showFormulaOnMouseOver){j(I).attr({title:K.replace(/\s+/g," ")})}return I},generic:function(){if(MSVG.latexImages||!k()){MSVG.parseMath=MSVG.parseMathExternal}else{u()}if(!(window.SVGElement||j.browser.opera||j.browser.safari)){ASVG.drawPictures=ASVG.removePictures}}}}(jQuery);var ASVG=function($){var SVG;var collection=[];var markerChars="o*sSx+<>|";function createSVGElement(elType){return document.createElementNS("http://www.w3.org/2000/svg",elType)}function getSVGElement(id,el){var node,res={node:null,newEl:false};if(id){id=SVG.id+"_"+id;res.node=$("#"+id)[0]}if(!res.node){res.node=createSVGElement(el);if(id){res.node.id=id}res.newEl=true}return res}function appendSVG(elmt){if(elmt.newEl){$(SVG.canvas).append(elmt.node)}}function setButton(text,title,func){var node=MSVG.createElementXHTML("span",null,"svgButton");node.title=title;node.onclick=func;$(node).append(text);$(node).css({paddingRight:"0.5em",paddingLeft:"0.5em",fontSize:"1em",fontFamily:"monospace",background:"blue",color:"yellow",cursor:"pointer"});$(node).mouseover(function(){$(this).css({background:"yellow",color:"blue"})});$(node).mouseout(function(){$(this).css({background:"blue",color:"yellow"})});node.setAttribute("owner",SVG.id);return node}function pictureAttributes(){this.id=null;this.stroke="blue";this.strokewidth=1;this.strokeopacity=1;this.strokedasharray="none";this.fill="none";this.fillopacity=1;this.fontstyle="normal";this.fontfamily="serif";this.fontweight="normal";this.fontsize=12;this.fontstroke="none";this.fontstrokewidth=1;this.fontstrokeopacity=1;this.fontstrokedasharray="none";this.fontfill="black";this.fontfillopacity=1;this.sector=false;this.largearc=0;this.marker="o";this.size=8;this.orient="auto";this.units="userSpaceOnUse";this.markerstroke="blue";this.markerstrokewidth=1;this.markerstrokeopacity=1;this.markerstrokedasharray="none";this.markerfill="none";this.markerfillopacity=1;this.sweep=0;this.rx=0;this.ry=0;this.closed=false;this.curve="";this.direction=[1,0];this.ticklabels="";this.pos="";this.points=200;this.backgroundcolor="none";this.backgroundopacity=1}function pictureObject(){this.id=null;this.pos=null;this.src="";this.canvas=null;this.border=0;this.width=300;this.height=200;this.factor=1;this.xmin=-5;this.xmax=5;this.ymin=null;this.ymax=null;this.xunitlength=null;this.yunitlength=null;this.origin=[0,0];this.coords="cartesian";this.mouse=[null,null];this.drag=null;this.pan=true;this.locked=false;this.attr=new pictureAttributes()}function refresh(){translateAndEval(SVG.id)}function translateAndEval(id){var errstr;var src=SVG.src;$("#"+SVG.id+" .svgMarker").remove();$("#"+SVG.id+"Canvas").empty();$("#"+SVG.id+"mml").empty();ASVG.dynamic[id]={};src=src.replace(/dynamic\./g,"ASVG.dynamic."+id+".");SVG.attr=new pictureAttributes();try{with(Math){eval(src)}}catch(err){if(typeof err=="object"){errstr=err.name+" "+err.message+" "+err.number+" "+err.description}else{errstr=err}alert(errstr+"\n"+src)}collection[SVG.id]=SVG}function setOptions(atr){for(var i in atr){SVG.attr[i]=atr[i]}}function getOptions(attr,options,prefix){var pref=prefix||"";if(typeof attr=="string"){return(options[pref+attr]==undefined?SVG.attr[pref+attr]:options[pref+attr])}else{var i,newAttr={},len=attr.length,item;for(i=0;i<len;i++){item=attr[i];newAttr[item]=options[pref+item]==undefined?SVG.attr[pref+item]:options[pref+item]}return newAttr}}function setAction(evt,fn,id){if(!$.isFunction(fn)){return}var node=id?$("#"+SVG.id+"_"+id):$("#"+SVG.id);$(node).bind(evt,fn)}function getPosition(evt){var off=$(evt.currentTarget.parentNode).offset();var posX=(evt.pageX-off.left-SVG.origin[0]-SVG.border)/SVG.xunitlength;var posY=(SVG.height-SVG.origin[1]-evt.pageY+off.top+SVG.border)/SVG.yunitlength;return[posX,posY]}function getAngle(p){p=p||[0,0];var res=Math.atan2(SVG.mouse[1]-p[1],SVG.mouse[0]-p[0]);res=(res<0)?res+2*Math.PI:res;return res}function getDistance(p){p=p||[0,0];return Math.sqrt(Math.pow(SVG.mouse[0]-p[0],2)+Math.pow(SVG.mouse[1]-p[1],2))}function updateButton(obj){var id=$(obj).attr("owner");var node=$("#"+id+"src");if(obj.firstChild.nodeValue=="Edit"){obj.firstChild.nodeValue="Update";obj.title="Update picture";node.val(SVG.src).css("display","block")}else{SVG.src=node.val();translateAndEval(id)}}function switchTo(evt){var name=evt.currentTarget.id;if(SVG.id==name||SVG.locked){return}SVG=collection[name]}function onWheel(evt){if(SVG.locked){return false}evt=evt||window.event;var factor=1;if(evt.wheelDelta){factor=(evt.wheelDelta>0)?0.8:1.25}else{if(evt.detail){factor=(evt.detail<0)?0.8:1.25}}if(evt.shiftKey){changeSize(factor)}else{changeScales(factor)}evt.preventDefault();evt.stopPropagation();return false}function onClick(evt){if(evt.button===0){if(evt.shiftKey){$("#"+SVG.id+"toolbar").slideToggle();$("#"+SVG.id+"src").val(SVG.src);SVG.locked=!SVG.locked;evt.stopImmediatePropagation()}else{if(SVG.pan&&!SVG.locked){SVG.drag=[evt.clientX,evt.clientY]}}}return false}function onDrop(evt){if(SVG.drag==null){return false}var xlen=(SVG.drag[0]-evt.clientX)/SVG.xunitlength;var ylen=(-SVG.drag[1]+evt.clientY)/SVG.yunitlength;SVG.drag=null;if(xlen==0&&ylen==0){return false}changeScales(1,[SVG.xmin+xlen,SVG.xmax+xlen,SVG.ymin+ylen,SVG.ymax+ylen]);return false}function setScales(){SVG.xunitlength=SVG.width/(SVG.xmax-SVG.xmin);SVG.yunitlength=SVG.height/(SVG.ymax-SVG.ymin);SVG.origin=[-SVG.xmin*SVG.xunitlength,-SVG.ymin*SVG.yunitlength]}function getScales(scales){scales=scales||[];var res=[null,null,null,null];switch(scales.length){case 0:res[0]=SVG.xmin;res[1]=SVG.xmax;break;case 2:res[0]=scales[0];res[1]=scales[1];break;case 4:res=scales}return res}function setSize(){var picture=$("#"+SVG.id)[0];picture.setAttribute("width",SVG.width);picture.setAttribute("height",SVG.height);picture.parentNode.style.width=SVG.width+"px";picture.parentNode.style.height=SVG.height+"px";var node=$("#"+SVG.id+"ClipPath")[0];node.firstChild.setAttribute("d","M0,0 "+SVG.width+",0 "+SVG.width+","+SVG.height+" 0,"+SVG.height);node=$("#"+SVG.id+"Coords")[0];if(node){node.setAttribute("x",SVG.width);node.setAttribute("y",SVG.height-2)}}function changeSize(factor){SVG.factor*=factor;SVG.width/=factor;SVG.height/=factor;setSize();setScales();translateAndEval(SVG.id)}function changeScales(factor,trans){trans=trans||[SVG.xmin,SVG.xmax,SVG.ymin,SVG.ymax];SVG.factor*=factor;var dx=(SVG.xmax-SVG.xmin)*(1-factor)*0.5;var dy=(SVG.ymax-SVG.ymin)*(1-factor)*0.5;SVG.xmin=trans[0]+dx;SVG.xmax=trans[1]-dx;SVG.ymin=trans[2]+dy;SVG.ymax=trans[3]-dy;setScales();translateAndEval(SVG.id)}function updateCoord(evt){if(SVG.locked){return false}if($.browser.opera){switchTo(evt)}SVG.mouse=getPosition(evt);if(SVG.coords!="none"){var coords;if(SVG.coords=="cartesian"){coords="C: ("+SVG.mouse[0].toFixed(2)+", "+SVG.mouse[1].toFixed(2)+")"}else{coords="P: ("+getDistance().toFixed(2)+", "+getAngle().toFixed(2)+")"}$("#"+SVG.id+"Coords").text(coords)}return false}function removeCoord(){$("#"+SVG.id+"Coords").text("")}function exportSVG(obj){var name=$(obj).attr("owner");var pic=$("#"+name)[0].parentNode.innerHTML;var pos=pic.indexOf("</svg")+6;pic=pic.substr(0,pos);var svg="<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";if(pic.indexOf("svgCoords")>-1){pos=pic.lastIndexOf("<text");svg+=pic.substr(0,pos);pos=pic.lastIndexOf("</text")+7;svg+=pic.substr(pos)}else{svg+=pic}svg=svg.replace(/&nbsp;/g,"");svg=svg.replace(/><(?!\/)/g,">\n<");obj.previousSibling.firstChild.nodeValue="Edit";$("#"+name+"src").val(svg).css("display","block")}function toSVG(p){var x=p[0]*SVG.xunitlength+SVG.origin[0];var y=SVG.height-p[1]*SVG.yunitlength-SVG.origin[1];return[x,y]}function toSVGPair(p){var q=toSVG(p);return q[0]+" "+q[1]}function setStrokeAndFill(node,options,prefix){var attributes=["stroke","strokewidth","strokedasharray","strokeopacity","fill","fillopacity"];var attr=getOptions(attributes,options,prefix);node.setAttribute("stroke",attr.stroke);node.setAttribute("stroke-width",attr.strokewidth/SVG.factor);node.setAttribute("stroke-dasharray",attr.strokedasharray);node.setAttribute("stroke-opacity",attr.strokeopacity);node.setAttribute("fill",attr.fill);node.setAttribute("fill-opacity",attr.fillopacity)}function button(p,q,txt,action,options){options=options||{};options.id=(options.id||Math.randomString(8));rect(p,q,options);setAction("click",action,options.id);options.fill=null;options.fillopacity=1;options.id+="_t";text([(p[0]+q[0])*0.5,(p[1]+q[1])*0.5],txt,options);setAction("click",action,options.id)}function setMarkers(obj,options){var attributes=["marker","size","units","orient","markerstroke","markerstrokeopacity"];var attr=getOptions(attributes,options);var node,node2,i,id,pos=["marker-start","marker-mid","marker-end"];var lim=attr.marker.length;for(i=0;i<lim;i++){var type=attr.marker.charAt(i);if(type=="-"||markerChars.indexOf(type)<0){continue}id=(options.id||Math.randomString(8))+"Marker_"+markerChars.indexOf(type);node=$("#"+SVG.id+"_"+id)[0];if(!node){node=getSVGElement(id,"marker").node;node.setAttribute("class","svgMarker");node.setAttribute("viewBox","0 0 10 10");node.setAttribute("refX",5);node.setAttribute("refY",5);node.setAttribute("orient",attr.orient);node.setAttribute("markerUnits",attr.units);switch(type){case"*":case"o":node2=createSVGElement("circle");node2.setAttribute("cx",5);node2.setAttribute("cy",5);node2.setAttribute("r",4);break;case">":node2=createSVGElement("path");node2.setAttribute("d","M0 0 L10 5 L0 10 z");node.setAttribute("refX",10);break;case"<":node2=createSVGElement("path");node2.setAttribute("d","M10 0 L10 10 L0 5 z");node.setAttribute("refX",0);break;case"x":node2=createSVGElement("path");node2.setAttribute("d","M0 0 L10 10 M0 10 L10 0");break;case"+":node2=createSVGElement("path");node2.setAttribute("d","M5 0 L5 10 M0 5 L10 5");break;case"|":node2=createSVGElement("path");node2.setAttribute("d","M5 0 L5 10");break;case"S":case"s":node2=createSVGElement("rect");node2.setAttribute("x",0);node2.setAttribute("y",0);node2.setAttribute("width",10);node2.setAttribute("height",10)}setStrokeAndFill(node2,options,"marker");if("*<>S".indexOf(type)>-1){node2.setAttribute("fill",attr.markerstroke);node2.setAttribute("fill-opacity",attr.markerstrokeopacity)}$(node).append(node2);$("#"+SVG.id+"_Defs:first").append(node)}node.setAttribute("markerWidth",attr.size/SVG.factor);node.setAttribute("markerHeight",attr.size/SVG.factor);obj.setAttribute(pos[i],"url(#"+SVG.id+"_"+id+")")}}function setLabels(p,options){var i,point,pos;var label=(typeof options.label=="string")?[options.label]:options.label;var labelpos=getOptions("pos",options);labelpos=(typeof labelpos=="string")?[labelpos]:labelpos;var poslen=labelpos.length;var size=options.size||SVG.attr.size;var dx=(0.5*size/SVG.xunitlength)/SVG.factor;var dy=(0.5*size/SVG.yunitlength)/SVG.factor;for(i=0;i<label.length;i++){options.isLabel="_label"+i;point=p[i];pos=(poslen>i)?labelpos[i].toUpperCase():pos;if(/E/.test(pos)){point[0]+=dx}if(/W/.test(pos)){point[0]-=dx}if(/N/.test(pos)){point[1]+=dy}if(/S/.test(pos)){point[1]-=dy}options.pos=pos;text(point,label[i],options)}}function line(p,q,options){options=options||{};options.closed=false;options.curve="";path([p,q],options)}function dot(p,options){options=options||{};var direction=getOptions("direction",options);var q=[p[0]+direction[0]/SVG.xunitlength,p[1]+direction[1]/SVG.yunitlength];var elmt=getSVGElement(options.id,"path");var st="M"+toSVGPair(p)+" "+toSVGPair(q);elmt.node.setAttribute("d",st);elmt.node.setAttribute("stroke","none");setMarkers(elmt.node,options);if(options.label){setLabels([p,q],options)}appendSVG(elmt)}function path(list,options){options=options||{};var st,i,elmt=getSVGElement(options.id,"path");var attr=getOptions(["curve","closed"],options);var len=list.length;if(len===0){return}st="M"+toSVGPair(list[0])+" "+attr.curve;for(i=1;i<len;i++){st+=toSVGPair(list[i])+" "}if(attr.closed){st+="Z"}elmt.node.setAttribute("d",st);setStrokeAndFill(elmt.node,options);if(options.marker){setMarkers(elmt.node,options)}if(options.label){setLabels(list,options)}appendSVG(elmt)}function rotate(id,angle,options){if(!id||!angle){return}var node=$("#"+SVG.id+"_"+id)[0];if(node){options=options||{};var center=options.center?toSVG(options.center):SVG.origin;angle=-angle*180/Math.PI;var transform=node.getAttribute("transform")||"";transform="rotate("+angle+" "+center+") "+(options.replace?"":transform);node.setAttribute("transform",transform)}}function translate(id,delta,options){if(!id||!delta){return}var node=$("#"+SVG.id+"_"+id)[0];if(node){options=options||{};delta=toSVG(delta);var transform=node.getAttribute("transform")||"";transform="translate("+(delta[0]-SVG.origin[0])+"  "+(SVG.origin[1]+delta[1]-SVG.height)+") "+(options.replace?"":transform);node.setAttribute("transform",transform)}}function curve(list,options){options=options||{};options.curve=options.curve||"T";path(list,options)}function circle(center,radius,options){ellipse(center,radius,radius,options)}function loop(p,options){options=options||{};var d=options.direction||[1,0];options.curve="C";options.closed=false;path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],options)}function arc(options){options=options||{};var start=options.start;var end=options.end;var center=options.center;var startangle=options.startangle;var endangle=options.endangle;var st="M",elmt=getSVGElement(options.id,"path");var attr=getOptions(["largearc","sweep","closed","sector"],options);var radius=options.radius;if(center!=null&&startangle!=null&&endangle!=null&&radius!=null){start=[radius*Math.cos(startangle)+center[0],radius*Math.sin(startangle)+center[1]];end=[radius*Math.cos(endangle)+center[0],radius*Math.sin(endangle)+center[1]]}if(start==null||end==null){return}if(!radius){var v=[end[0]-start[0],end[1]-start[1]];radius=Math.sqrt(v[0]*v[0]+v[1]*v[1])}if(attr.sector){st+=toSVGPair(center)+" "}st+=toSVGPair(start)+" A"+radius*SVG.xunitlength+","+radius*SVG.yunitlength+" 0 "+attr.largearc+","+attr.sweep+" "+toSVGPair(end);if(attr.sector||attr.closed){st+=" z"}elmt.node.setAttribute("d",st);setStrokeAndFill(elmt.node,options);if(options.marker){setMarkers(elmt.node,options)}if(options.label){setLabels([start,end],options)}appendSVG(elmt)}function sector(options){if(!options.center||!options.startangle||!options.endangle||!options.radius){return}options.sector=true;arc(options)}function ellipse(center,rx,ry,options){options=options||{};var elmt=getSVGElement(options.id,"ellipse");center=toSVG(center);elmt.node.setAttribute("cx",center[0]);elmt.node.setAttribute("cy",center[1]);elmt.node.setAttribute("rx",rx*SVG.xunitlength);elmt.node.setAttribute("ry",ry*SVG.yunitlength);setStrokeAndFill(elmt.node,options);appendSVG(elmt)}function polygon(list,options){options=options||{};options.closed=true;path(list,options)}function rect(p,q,options){options=options||{};var elmt=getSVGElement(options.id,"rect");var attr=getOptions(["rx","ry"],options);elmt.node.setAttribute("x",toSVG(p)[0]);elmt.node.setAttribute("y",toSVG(q)[1]);elmt.node.setAttribute("width",(q[0]-p[0])*SVG.xunitlength);elmt.node.setAttribute("height",(q[1]-p[1])*SVG.yunitlength);elmt.node.setAttribute("rx",attr.rx*SVG.xunitlength);elmt.node.setAttribute("ry",attr.ry*SVG.yunitlength);setStrokeAndFill(elmt.node,options);appendSVG(elmt)}function text(p,st,options){options=options||{};var id=options.id;var fill=getOptions("fontfill",options);if(id&&options.isLabel){id+=options.isLabel}var pos=getOptions("pos",options).toUpperCase();var fontsize=getOptions("fontsize",options)/SVG.factor;var node,dx=0,dy=0,str=st.toString();var q=toSVG(p);if(/\$/.test(str)){if(p[0]>SVG.xmax||p[0]<SVG.xmin||p[1]>SVG.ymax||p[1]<SVG.ymin){return}var dnode=$("#"+SVG.id+"mml:first");if(id){node=$("#"+id)[0]}if(!node){node=MSVG.createElementXHTML("div",id);node.style.position="absolute";dnode.append(node)}else{$(node).empty()}str=$.trim(str);str=str.substr(1,str.length-2);$(node).append(MSVG.parseMath(str,true,fontsize+"px",fill));dx=-node.offsetWidth/2;dy=-node.offsetHeight/2;if(/N/.test(pos)){dy=-node.offsetHeight}if(/S/.test(pos)){dy=0}if(/E/.test(pos)){dx=0}if(/W/.test(pos)){dx=-node.offsetWidth}node.style.left=(q[0]+dx)+"px";node.style.top=(q[1]+dy)+"px"}else{var baseline="middle",textanchor="middle";if(/E/.test(pos)){textanchor="start"}if(/W/.test(pos)){textanchor="end"}if(/N/.test(pos)){baseline="text-after-edge"}if(/S/.test(pos)){baseline="text-before-edge"}var attr=getOptions(["fontstyle","fontfamily","fontweight"],options);var elmt=getSVGElement(id,"text");$(elmt.node).empty().text(str);elmt.node.setAttribute("x",q[0]);elmt.node.setAttribute("y",q[1]);elmt.node.setAttribute("font-style",attr.fontstyle);elmt.node.setAttribute("font-family",attr.fontfamily);elmt.node.setAttribute("font-weight",attr.fontweight);elmt.node.setAttribute("font-size",fontsize);elmt.node.setAttribute("text-anchor",textanchor);elmt.node.setAttribute("dominant-baseline",baseline);setStrokeAndFill(elmt.node,options,"font");appendSVG(elmt)}}function image(url,options){options=options||{};var elmt=getSVGElement(options.id,"image");var height=options.height||SVG.height;var width=options.width||SVG.width;var point=toSVG(options.point||[SVG.xmin,SVG.ymin]);var pos=(options.pos||"").toUpperCase();var x=point[0]-width*0.5;var y=point[1]-height*0.5;if(/N/.test(pos)){y-=height*0.5}if(/S/.test(pos)){y+=height*0.5}if(/E/.test(pos)){x+=width*0.5}if(/W/.test(pos)){x-=width*0.5}elmt.node.setAttribute("x",x);elmt.node.setAttribute("y",y);elmt.node.setAttribute("width",width);elmt.node.setAttribute("height",height);elmt.node.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",url);appendSVG(elmt)}function grid(options){options=options||{};var dx,dy,x,y,k;var orig=options.origin||[0,0];options.stroke=options.stroke||"grey";options.strokewidth=(options.strokewidth||SVG.attr.strokewidth*0.25)/SVG.factor;var lim=getScales(options.scales);lim[2]=lim[2]||SVG.ymin;lim[3]=lim[3]||SVG.ymax;var group=getSVGElement("Grid","g");$(group.node).empty();var tempNode=SVG.canvas;SVG.canvas=group.node;if(SVG.coords=="polar"){dx=options.dx||1;dy=options.dy||3;var limit=Math.max(Math.abs(lim[0]),Math.abs(lim[1]),Math.abs(lim[2]),Math.abs(lim[3]));for(x=dx;x<limit;x+=dx){circle(orig,x,options)}if(dy>1){for(y=1;y<dy;y++){k=Math.tan(y*Math.PI/(2*dy));line([lim[0],(lim[0]-orig[0])*k+orig[1]],[SVG.xmax,(lim[1]-orig[0])*k+orig[1]],options);line([lim[0],-(lim[0]-orig[0])*k+orig[1]],[SVG.xmax,-(lim[1]-orig[0])*k+orig[1]],options)}}}else{dx=options.dx||1;dy=options.dy||dx;for(x=orig[0];x<lim[1];x+=dx){line([x,lim[2]],[x,lim[3]],options)}for(x=orig[0]-dx;x>lim[0];x-=dx){line([x,lim[2]],[x,lim[3]],options)}for(y=orig[1];y<lim[3];y+=dy){line([lim[0],y],[lim[1],y],options)}for(y=orig[1]-dy;y>lim[2];y-=dy){line([lim[0],y],[lim[1],y],options)}}SVG.canvas=tempNode;appendSVG(group)}function axes(options){options=options||{};options.marker="-|"+(options.marker?options.marker.charAt(0):"-");var x,y,start,stop;var orig=options.origin||[0,0];var origin=toSVG(orig);var dx=options.dx||1;var dy=options.dy||dx;var fontsize=getOptions("fontsize",options);var ddx=Math.max(0,Math.floor(-Math.log(dx+1e-9)/Math.log(10))+1);var ddy=Math.max(0,Math.floor(-Math.log(dy+1e-9)/Math.log(10))+1);options.stroke=options.stroke||"black";options.strokewidth=options.strokewidth||SVG.attr.strokewidth*0.5;options.markerstroke=options.stroke;options.markerstrokewidth=2*options.strokewidth;options.units="strokeWidth";options.size=fontsize*SVG.factor;var lim=getScales(options.scales);lim[2]=lim[2]||SVG.ymin;lim[3]=lim[3]||SVG.ymax;var list1=[],label1=[];start=orig[0]+dx;stop=lim[1]-0.25*dx;for(x=start;x<stop;x+=dx){list1.push([x,orig[1]]);label1.push(String(x.toFixed(ddx)))}list1.push([lim[1],orig[1]]);label1.push("");var list2=[],label2=[];start=orig[0]-dx;stop=lim[0]+0.25*dx;for(x=start;x>stop;x-=dx){list2.push([x,orig[1]]);label2.push(String(x.toFixed(ddx)))}list2.push([lim[0],orig[1]]);label2.push("");list2.reverse();list2=list2.concat(list1);if(options.ticklabels!=false){label2.reverse();options.label=label2.concat(label1);options.pos=(SVG.height-origin[1]>2*fontsize)?"S":"N"}var group=getSVGElement("Axes","g");$(group.node).empty();var tempNode=SVG.canvas;SVG.canvas=group.node;path(list2,options);list1=[],label1=[];start=orig[1]+dy;stop=lim[3]-0.25*dy;for(y=start;y<stop;y+=dy){list1.push([orig[0],y]);label1.push(String(y.toFixed(ddy)))}list1.push([orig[0],lim[3]]);label1.push("");list2=[];label2=[];start=orig[1]-dy;stop=lim[2]+0.25*dy;for(y=start;y>stop;y-=dy){list2.push([orig[0],y]);label2.push(String(y.toFixed(ddy)))}list2.push([orig[0],lim[2]]);label2.push("");list2.reverse();list2=list2.concat(list1);if(options.ticklabels!=false){label2.reverse();options.label=label2.concat(label1);options.pos=(origin[0]>2*fontsize)?"W":"E"}options.stroke=options.markerstroke;path(list2,options);SVG.canvas=tempNode;appendSVG(group)}function list(fun,tmin,tmax,options){var inc=(tmax-tmin)/getOptions("points",options);if(inc<=0||fun.length==0){return}var t,pth,g=[],xt,yt;for(t=1;t>=0;t--){if($.isFunction(fun[t])){g[t]=fun[t]}else{if(typeof fun[t]=="string"){with(Math){eval("g["+t+"] = function(x){return "+fun[t]+"}")}}else{return}}}if(g.length<2){return}pth=[];for(t=tmin;t<=tmax;t+=inc){xt=g[0](t);yt=g[1](t);if(isFinite(xt)&&isFinite(yt)){pth[pth.length]=[xt,yt]}}return pth}function plot(fun,options){options=options||{};var i,steps=options.steps||[];if(steps.length===0){plotter(fun,options)}else{var leftMarkers=options.leftMarkers||"-";var rightMarkers=options.rightMarkers||"-";var n_steps=steps.length-1;options.max=steps[0];options.marker="--"+leftMarkers.charAt(0);plotter(fun,options);for(i=0;i<n_steps;i++){options.max=steps[i+1];options.min=steps[i];options.marker=rightMarkers.charAt((rightMarkers.length>i)?i:0)+"-"+leftMarkers.charAt((leftMarkers.length>i+1)?i+1:0);plotter(fun,options)}options.max=null;options.min=steps[n_steps];options.marker=rightMarkers.charAt((rightMarkers.length==n_steps)?n_steps-1:0)+"--";plotter(fun,options)}}function plotter(fun,options){options=options||{};options.closed=false;options.curve="";var xmin=(options.min==null)?SVG.xmin:options.min;var xmax=(options.max==null)?SVG.xmax:options.max;var pth=list(["x",fun],xmin,xmax,options);if(pth){path(pth,options)}}function area(fun1,fun2,options){options=options||{};options.curve="";options.closed=true;var xmin=(options.min==null)?SVG.xmin:options.min;var xmax=(options.max==null)?SVG.xmax:options.max;var pth1=list(["x",fun1],xmin,xmax,options);var pth2=list(["x",fun2],xmin,xmax,options);if(pth1&&pth2){pth2.reverse();pth1=pth1.concat(pth2);path(pth1,options)}}function polarPlot(fun,options){var g1,g2;if(typeof fun=="string"){with(Math){eval("g1 = function(x){return ("+fun+")*cos(x)}");eval("g2 = function(x){return ("+fun+")*sin(x)}")}}else{if($.isFunction(fun)){with(Math){eval("g1 = function(x){return fun(x)*cos(x)}");eval("g2 = function(x){return fun(x)*sin(x)}")}}}parametricPlot(g1,g2,options)}function parametricPlot(fun1,fun2,options){options=options||{};options.closed=false;options.curve="";var xmin=(options.min==null)?0:options.min;var xmax=(options.max==null)?2*Math.PI:options.max;var pth=list([fun1,fun2],xmin,xmax,options);if(pth){path(pth,options)}}function slopeField(fun,options){options=options||{};var g=fun;if(typeof fun=="string"){with(Math){eval("g = function(x,y){return "+fun+"}")}}var gxy,x,y,u,v,dz;var dx=(options.dx==null)?1:options.dx;var dy=(options.dy==null)?1:options.dy;dz=Math.sqrt(dx*dx+dy*dy)/6;var xmin=Math.ceil(SVG.xmin/dx);var ymin=Math.ceil(SVG.ymin/dy);for(x=xmin;x<=SVG.xmax;x+=dx){for(y=ymin;y<=SVG.ymax;y+=dy){gxy=g(x,y);if(!isNaN(gxy)){if(Math.abs(gxy)=="Infinity"){u=0;v=dz}else{u=dz/Math.sqrt(1+gxy*gxy);v=gxy*u}line([x-u,y-v],[x+u,y+v],options)}}}}return{dynamic:{},removePictures:function(obj){var pictures=obj?[obj]:$(".svgGraph");$(pictures).each(function(){var target=this.parentNode;$(this).remove();$(target).css({color:"red",background:"yellow"});$(target).text("Missing picture: your  browser does not support inline SVG");window.setTimeout(function(){$(target).remove()},10000)})},drawPictures:function(obj){var options,xmin,xmax,ymin,ymax;var pictures=obj?[obj]:$(".svgGraph");$(pictures).each(function(){SVG=new pictureObject();options=this.getAttribute("options");if(options!=""){with(Math){eval("options="+options)}setOptions(options)}else{options={}}SVG.pos=options.pos||SVG.pos;if(SVG.pos=="inline"){$(this).wrap("<span></span>")}else{$(this).wrap("<div></div>")}SVG.width=options.width||SVG.width;SVG.height=options.height||SVG.height;SVG.coords=options.coords||SVG.coords;SVG.border=options.borderwidth||SVG.border;var borderstroke=options.borderstroke||"black";var borderstyle=options.borderstyle||"solid";if(options.pan==false){SVG.pan=false}SVG.src=this.getAttribute("script");var container=this.parentNode;switch(SVG.pos){case"left":$(container).css("float","left");break;case"right":$(container).css("float","right");break;case"center":$(container).css("margin","auto auto")}$(container).css("border",SVG.border+"px "+borderstyle+" "+borderstroke);container.removeChild(this);var scales=getScales(options.scales);SVG.xmin=scales[0];SVG.xmax=scales[1];SVG.ymin=scales[2];SVG.ymax=scales[3];if(SVG.xmin>=SVG.xmax){throw"Incorrect values: xmax<=xmin."}var xunitlength=SVG.width/(SVG.xmax-SVG.xmin);if(typeof SVG.ymin!="number"){SVG.ymin=-SVG.height/(2*xunitlength);SVG.ymax=-SVG.ymin}else{if(SVG.ymin>=SVG.ymax){throw"Incorrect values: ymax<=ymin."}}setScales();SVG.id=Math.randomString(16);var qnode=createSVGElement("svg");qnode.id=SVG.id;qnode.setAttribute("xmlns","http://www.w3.org/2000/svg");var node=createSVGElement("clipPath");node.id=SVG.id+"ClipPath";var node2=createSVGElement("path");$(node).append(node2);node2=createSVGElement("defs");node2.id=SVG.id+"_Defs";$(node2).append(node);$(qnode).append(node2);node=createSVGElement("rect");node.setAttribute("class","svgBackground");node.setAttribute("x","0");node.setAttribute("y","0");node.setAttribute("width","100%");node.setAttribute("height","100%");node.setAttribute("fill",SVG.attr.backgroundcolor);node.setAttribute("fill-opacity",SVG.attr.backgroundopacity);$(qnode).append(node);node=createSVGElement("g");node.id=SVG.id+"Canvas";node.setAttribute("clip-path","url(#"+SVG.id+"ClipPath)");SVG.canvas=node;$(qnode).append(node);if(SVG.coords!="none"&&SVG.pos!="inline"){node=createSVGElement("text");node.id=SVG.id+"Coords";node.setAttribute("class","svgCoords");node.setAttribute("text-anchor","end");node.setAttribute("font-size",(SVG.attr.fontsize*0.8));$(qnode).append(node)}$(container).append(qnode);container.style.position="relative";node=MSVG.createElementXHTML("span",SVG.id+"mml");$(container).append(node);if(SVG.pos!="inline"){node=MSVG.createElementXHTML("span",SVG.id+"toolbar");node.style.position="absolute";node.style.textAlign="left";node.style.zIndex=10;node2=setButton("Update","Edit script",function(){updateButton(this)});$(node).append(node2);node2=setButton("SVG","View SVG code",function(){exportSVG(this)});$(node).append(node2);node2=setButton("-","Zoom out",function(){changeScales(1.25)});$(node).append(node2);node2=setButton("+","Zoom in",function(){changeScales(0.8)});$(node).append(node2);node2=setButton("\u2191","Enlarge picture",function(){changeSize(0.8)});$(node).append(node2);node2=setButton("\u2193","Reduce picture",function(){changeSize(1.25)});$(node).append(node2);$(node).append("<br />");node2=MSVG.createElementXHTML("textarea",SVG.id+"src");$(node2).attr({rows:8,cols:80});$(node).append(node2);$(node).hide();$(container).append(node);setAction("mousemove",updateCoord);setAction("mouseout",removeCoord);setAction("mousedown",onClick);if(SVG.pan){setAction("mouseup",onDrop)}if(window.addEventListener){var evt=$.browser.mozilla?"DOMMouseScroll":"mousewheel";qnode.addEventListener(evt,onWheel,false)}}setAction("mouseover",switchTo);setSize();translateAndEval(SVG.id)})}}}(jQuery);
//}}}
/***
!~TiddlyWiki formatters
***/
//{{{
if(!version.extensions.MathSVGPlugin) { //# ensure that the plugin is only installed once
version.extensions.MathSVGPlugin = {installed: true};
MSVG.generic();

config.formatterHelpers.MathSVGHelper = function(w) {
  this.lookaheadRegExp.lastIndex = w.matchStart;
  var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
  if(lookaheadMatch){
    var eq = MSVG.parseMath(lookaheadMatch[1],this.displaystyle);
    if(this.displaystyle){
      var node = createTiddlyElement(w.output,"div");
      node.style.textAlign='center';
      node.appendChild(eq);
      w.output.appendChild(node);
    } else {w.output.appendChild(eq);}
    w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
  }
}

config.formatters.push( {
  name: "clatex",
  match: "\\$\\$",
  lookaheadRegExp: /\$\$((?:.|\n)*?)\$\$/mg,
  displaystyle: true,
  handler: config.formatterHelpers.MathSVGHelper
})

config.formatters.push( {
  name: "clatex2",
  match: "\\\\\\\[",
  lookaheadRegExp: /\\\[\s*(.*?)\s*\\\]/mg,
  displaystyle: true,
  handler: config.formatterHelpers.MathSVGHelper
})

config.formatters.push( {
  name: "latex",
  match: "\\$",
  lookaheadRegExp: /\$((?:.|\n)*?)\$/mg,
  displaystyle: false,
  handler: config.formatterHelpers.MathSVGHelper
})

config.formatters.push( {
  name: "graph",
  match: "\\(:graph",
  lookaheadRegExp: /\(:graph(?:\((\{.+?\})?\))?[\s]+((?:.|\n)*?)[\s]+:\)/mg,
  handler: function(w){
  this.lookaheadRegExp.lastIndex = w.matchStart;
  var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
  if(lookaheadMatch){
    var svg = createTiddlyElement(w.output,"embed");
    svg.className="svgGraph";
    svg.setAttribute('options',lookaheadMatch[1]||"");
    svg.setAttribute('script',lookaheadMatch[2]);
    ASVG.drawPictures(svg);
    w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
  }
  }
})
}
//}}}
|CssClass|k
| |>|!Topic|!Description|h
| 1 |>| [[''Introduction''|http://www.cs.ubc.ca/~laks/534l/cpsc534lIntro.pptx]] |Origins, early history, sociologist’s perspective, social capital, centrality, social web, web 2.0 and web 3.0, focus of  this course.|
| 2 | ''Structural Analysis of Networks'' |[[Link Analysis|http://www.cs.ubc.ca/~laks/534l/Link Analysis.pptx]] & [[Prediction|http://www.cs.ubc.ca/~laks/534l/Link Prediction.pptx]] |What do links say about importance of pages? How can we predict evolution of the network? |
|~|~|[[Community Detection|http://www.cs.ubc.ca/~laks/534l/Community Detection.pptx]] |Can we divide up the n/w along lines of "interest"? |
|~|~|[[Social Search|http://www.cs.ubc.ca/~laks/534l/Social Search.pptx]] |What difference can and should the social dimension make to search?|
| 3 |>| ''[[Discovering Social Networks|http://www.cs.ubc.ca/~laks/534l/Discovering Social Networks from Enterprise Data.pptx]]'' |Can we induce SN from actions of a crowd?|
| 4 | ''Viral Marketing'' |[[Influence Propagation|http://www.cs.ubc.ca/~laks/534l/viralMarketingNotes.pdf]] |Whether, when and how does influence propagate in a n/w? |
|~|~|[[Graph Mining|http://www.cs.ubc.ca/~laks/534l/Graph Mining.pptx]] |Discovering patterns from graphs. |
| 6 |>| ''Trust & Reputation'' |How much and for what dojavascript:; you trust your network?|
| 7 | ''Recommender Systems'' |[[Content-based vs.Collaborative Filtering|http://www.cs.ubc.ca/~laks/534l/collaborativeFiltering.pdf]]|Recommend items based on their intrinsic properties or on the "wisdom" of the crowd?|
|~|~|Memory-based vs. Model-based |Use memory of past user behavior as is or build models?|
|~|~|Social Networks & Recommender Systems |Can we get the best of both worlds?|
| 8 |>| ''[[Top-k Query/Search|http://www.cs.ubc.ca/~laks/534l/TopKSearch.ppt]]'' |Social content sites and social search revisited.|
| 9 |>| ''Opinion Mining & Social Networks'' |OM basics and interplay with SN|
| 10 |>| Student Talks |  |


''Note'': Schedule is tentative and may dynamically change as we adjust to pace. E.g., student talks may be interleaved with lectures and some topics may be rearranged. 
1. The deliverables include a presentation of the project for approx. 30 minutes. Think of this as your opportunity to show off to the audience what is exciting, non-trivial, and cool about your project. The presentation should explain the general background needed to follow the technical development, a short discussion of previous work to set the stage for your work as needed, followed by a motivation for the work performed. Why is the problem you worked on interesting? What is challenging about it? This should be followed with a list of contributions. Now you have set the stage for diving into the key technical details such as algorithms, theorems, proof sketches, and the like, followed by an experimental analysis as applicable. Not all talks will follow this sequence exactly. For example, in some projects more emphasis may be placed on experimental analysis while in others more on analytical results. Some others may strike the middle ground. No matter which template your project falls into, it'd be helpful to have an "Organization" slide up front so it keeps the audience informed what to expect and where we are in the talk. After the technical sections, you may want to talk about any difficulties or issues faced. I'd like to hear the limitations of your work just as much as I'd love to hear your accomplishments. You should highlight any pieces of the project which are unfinished, let's label them "work in progress". In addition, if there are some far flung objectives that may be worth pursuing in the future, you should discuss them under future work. There should be a clear "Conclusions" segment to the talk. If you have any questions, please feel free to ask me. The slides should be submitted by the time your talk is scheduled. 

2. In some project talks, a demo may be an integral component. 

3. Your final project report will be due NO LATER THAN Friday, April 22, 2010. The structure of the report can essentially follow that of your talk. Some important differences to keep in mind. In your talk, you will only have time to motivate your project and sketch out key ideas. The report is the one that will have to close the loop by providing the details necessary to complete the argument or description or proof or analysis ... . Depending on the material you have, it may happen that you don't have time to present all aspects of your project in your talk. As a hypothetical example, you have, in your project, developed algorithms for detecting topi-wise influential bloggers in twitter. The work may have sections corresponding to topic discovery, behavior analysis for detecting influence, and say verification of patterns of influential bloggers found from the analysis. You may not be able to cover all of this in 30 min. The trick is to *advertise* ALL your contributions in your talk, but say that you will focus on one or two of those. In the report, however, you need to fill in the details for all sections. 

In terms of length of the report, writing style, and rigor, think of "typical" top tier conference submissions, e.g., SIGMOD, VLDB, ICDE, PODS, AAAI, IJCAI, ICML, KDD, ECML, ... Of course, they don't all have the same length and the styles and rigor differ to some extent. But you get the idea. I'd suggest 12 pages in a two-column single-spaced format. For your convenience, you may use ACM SIG Proceedings style, available from 
http://www.acm.org/sigs/publications/proceedings-templates (choose Option 1 OR Option 2). 

Your report will contain most standard sections (e.g., Introduction, Motivation, Related Work, Background Notions (or Preliminaries), Technical Sections, Conclusions and Future Work + Bibliography. Your emphasis should be on discussing and critiquing prior art and establishing the novelty as well as advantages of whatever ideas/algorithms you propose or whatever results you establish. In other words, you need to position your work properly in the context of prior art. As mentioned above, work in progress is fine, but you should clearly identify which parts of the work are settled and are therefore solid, and which parts you are stuck in, or given more time you would have solved, what ideas you have for solving those parts, etc. Use your imagination and creativity for structuring this part. 
|''Speaker(s)''|''Title''|''Time''|
||||
Here are some ideas for possible course projects. Keep in mind that we are not interested in merely understanding a specific paper, implementing the presented algorithms and demonstrating that you understand their contributions well enough to reproduce it yourself. The watchwords are @@bgcolor(#33ff00):innovation@@, @@bgcolor(#33ff66):creativity@@, and @@bgcolor(#33ff33):novelty@@. As always, @@bgcolor(#00ccff):depth @@will always bring its rewards (just as it does in paper presentations, in discussions led, and in the subsequent summaries prepared).

In addition to these suggestions, I am happy to listen to other ideas for projects, if you have any of your own. I am also happy to work with you on creating other project ideas. No matter which project you choose, I will be available to discuss with you any technical issues related to your project.

Each project can either take the shape of a paper or an implementation. It’s your choice. ''Each team may contain up to two people.''  //(If the course enrollment changes significantly, we will revisit this rule.) // Regardless of whether you do a project alone or as a team of two, my expectation will be that ''every individual does the same amount of work. '' @@bgcolor(#00ccff):Teams must be formed by Friday, January 15. Project choices should be made by Wednesday, January 20. @@ Here, then are the project ideas. (More details on the project schedule and milestones will be posted soon.) 

@@bgcolor(#ff33ff):1. Social Network Computing: @@Social nets such as @@bgcolor(#ffcc00):facebook @@and @@bgcolor(#ff6600):del.ico.us @@have facilitated massive data, resource and opinion sharing, and in general online discourse. The resources can range from online resources like videos, photos, and blogs to material objects like lawnmowers and bikes. (If you are wondering about what material objects are doing in a social net, talk to me!) The opinions range from political opinions to impressions about the job done by the recently hired handyman. Additionally, the @@bgcolor(#ccff00):blogosphere @@is awash with information. On the one hand, the information in social nets is mostly free text and is thus largely unstructured. Thus, traditional IR techniques as well as techniques based on centrality notions such as @@bgcolor(#cccc66):pagerank @@can be effectively used to facilitate search over social nets. On the other hand, though, social nets have their own structure, bringing the notion of a seeker’s social neighborhood to the context of search. Just focusing on search alone, there are interesting questions that need to be studied:
*        What is the right @@bgcolor(#3399ff):granularity @@of search? One could be searching for blogs, photos, resources, etc., or simply for opinions. Or one could be @@bgcolor(#6666cc):analyzing @@opinions.
*       Suppose we call the granules above “infons”. What techniques can we employ for effectively searching such a collection of infons? What kind of analyses are enabled by the combination of text data and the @@bgcolor(#00ccff):social net structure@@, together with @@bgcolor(#3333ff):chronology of opinions@@?
*        How can we carry out these tasks efficiently?
''Note'': This is not one project. By focusing on different angles, more than one project can be formulated around the above description. 

@@bgcolor(#00ffff):2. Link Prediction and Network Evolution: @@ Substantial work has been done on link prediction in social networks and on modeling the evolution of the network. Two possible project ideas follow: 
@@bgcolor(#ff33cc):(a) Monitoring and Tracking of underlying network in newsgroups and/or blogs:@@ Analyze the communication structure in newsgroups or blogs and discover the underlying social network present there. The framework should be parameterizable (e.g., strength of links, period of activity, etc.) and should be queriable (e.g., topic of conversation, who started a particular discussion, etc.). Visualize the network in creative and interactive ways. 
@@bgcolor(#99ff66):(b) Predict links and build models of network evolution:@@ Given a social network together with properties of nodes and/or edges (in the form of keywords or more structured attributes), what is the state of the art in link prediction that takes all available information into account? How can we go beyond it? Can we incorporate time in modeling? 

 3. Viral Marketing: 

4. Trust & Reputation: 

5. Recommender Systems: 

6. Top-k Query/Search: 

7. Opinion Mining & Social Networks: 
We meet Mondays and Wednesdays 3:30-5:00 pm, in ICICS 206. 
Laks V.S. Lakshmanan 
CPSC 534L: Topics in Data Management & Mining -- Social Networks 
@@color(#ff0000):''Al Hasan et al. Link prediction using supervised learning.  SDM 2006 Workshop''@@. -- ''@@color(#003300): Presenter: Peyman Talebifard; Discussion Leader: Elizeu Santos - Neto.@@''

@@color(#ff0000):''A. Popescul and L. Ungar. Statistical relational learning for link prediction. In Workshop on Learning Statistical Models from Relational Data at IJCAI, 2003.''@@ -- ''Presenter: Dibesh Shakya; Discussion Leader: ''

 @@color(#ff0000):''Kurt C. Foster, Stephen Q. Muth, John J. Potterat, and Richard B. Rothenberg. A faster katz status score algorithm. Computational & Mathematical Organization Theory, 7(4):275­285, 2001.''@@ -- 

@@color(#ff0000):''Purnamrita Sarkar, Andrew W. Moore, and Amit Prakash. Fast incremental proximity search in large graphs. In Proceedings of the 25th International Conference on Machine Learning (ICML'08).
''@@ -- 

@@color(#ff0000):''Dmitry Lizorkin et al. Accuracy estimate and optimization techniques for Sim Rank computation. VLDB Journal, 2008. 
''@@ -- ''Presenter: Elizeu Santos - Neto; Discussion Leader: Min Xie. ''
|!No|!Paper |!Presenter|!Discussion Leader|!Time.|
|1|Jure Leskovec, Lars Backstrom, Ravi Kumar, and Andrew Tomkins. Microscopic evolution of social networks. In Proceedings of the 14th ACM International Conference on Knowledge Discovery and Data Mining (KDD'08).|Yanjing|Andrew, hung_yao AT <this dept.>|Monday, Jan. 17, 3:30-4:10 pm.|
|2|Peixiang Zhao, Jiawei Han, and Yizhou Sun. P-Rank: a comprehensive structural similarity measure over information networks. CIKM 2009.|Naresh|Manu, kyadav.manu AT <gmail>|Monday, Jan. 17, 4:15-4:55 pm.|
|3|J. Leskovec, A. Krause, C. Guestrin, C. Faloutsos, J. VanBriesen, and N. S. Glance. Cost-effective outbreak detection in networks. In Proceedings of the 13th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pages 420-429, 2007.|Andrew|Naresh, knares AT <gmail>|Wednesday, Feb. 9, 4:10-4:50 pm.|
|4|S Bao, G Xue, X Wu, Y Yu, B Fei. Optimizing web search using social annotations. WWW 2007. |Manu|Pei, peil AT <this dept>|Monday, Feb. 14, 3:30-4:10 pm.|
|5|Wei Chen, Yifei Yuan, and Li Zhang. Scalable influence maximization in social networks under the linear threshold model. In Proceedings of the 10th IEEE International Conference on Data Mining (ICDM’2010), Sydney, Australia, Dec. 2010.|Wei|Gary, yataopei AT <hotmail>|Monday, Feb. 21, 3:30-4:10 pm.|
|6|Takeshi Sakaki, Makoto Okazaki, and Yutaka Matsuo. Earthquake shakes Twitter users: real-time event detection by social sensors. WWW 2010. pp. 851-860.|Pei|Wei, jimlu526 AT <gmail>|Monday, Feb. 21, 4:15-4:55 pm.|
|7|Cuiping Li and Jiawei Han and Guoming He and Xin Jin and Yizhou Sun and Yintao Yu and Tianyi Wu. Fast computation of SimRank for static and dynamic information networks. EDBT 2010.|Gary|Yanjing, yanjingcanada AT <gmail>|Monday, Feb. 28, 3:30-4:10 pm.|
|8|Y. Koren, Factorization Meets the Neighborhood: A Multifaceted Collaborative Filtering Model. KDD 2008.|Wei|Andrew, hung_yao AT <this dept.>|Monday, March 14, 3:30-4:10 pm.|
|9|Y.F. Hu, Y. Koren, and C. Volinsky, Collaborative Filtering for Implicit Feedback Datasets, Proc. IEEE Intl Conf. Data Mining (ICDM 08), IEEE CS Press, 2008, pp. 263-272.|Andrew|Wei, jimlu526 AT <gmail>|Monday, March 14, 4:15-4:55 pm.|
|10|Aditya Parameswaran, Georgia Koutrika, Benjamin Bercovitz, and Hector Garcia-Molina. Recsplorer: Recommendation Algorithms Based on Precedence Mining. SIGMOD 2010.|Naresh|Pei, peil AT <this dept>|Wednesday, March 16, 3:30-4:10 pm.|
|11|Sihem Amer-Yahia, Senjuti Basu Roy, Ashish Chawla, Gautam Das, Cong Yu: Group Recommendation: Semantics and Efficiency. PVLDB 2(1): 754-765 (2009).|Pei|Naresh, knares AT <gmail>|Wednesday, March 16, 4:15-4:55 pm.|
|12|Shaojie Tang et al. Relationship Classification in Large Scale Online Social Networks and Its Impact on Information Propagation. IEEE INFOCOMM. 2011.|Manu|Manu, kyadav.manu AT <gmail>|Wednesday, March 30, 3:30-4:10 pm.|
|13|Y. Zhou et al., Large-Scale Parallel Collaborative Filtering for the Netflix Prize, Proc. 4th Intl Conf. Algorithmic Aspects in Information and Management, LNCS 5034, Springer, 2008, pp. 337-348.|Gary|Yanjing, yanjingcanada AT <gmail>|Wednesday, March 30, 4:15-4:55 pm.|
|14|G. Koutrika, B. Bercovitz, H. Garcia-Molina. FlexRecs: Expressing and Combining Flexible Recommendations. SIGMOD 2009.|Yanjing|Gary, yataopei AT <hotmail>|Wednesday, March 30, 4:55-5:35 pm.|
/*{{{*/
* html .tiddler {height:1%;}

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

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

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

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

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

//}}}
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<!--<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>--> 
<div class='tagging' macro='tagging'></div>
<!--<div class='tagged' macro='tags'></div>-->
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
/***
|''Name:''|WikiBar|
|''Version:''|2.0.0 beta3|
|''Source:''|[[AiddlyWiki|http://aiddlywiki.sourceforge.net]]|
|''Author:''|[[Arphen Lin|mailto:arphenlin@gmail.com]]|
|''Type:''|toolbar macro command extension|
|''Required:''|TiddlyWiki 2.0.0 beta6|
!Description
WikiBar is a toolbar that gives access to most of TiddlyWiki's formatting features with a few clicks. It's a handy tool for people who are not familiar with TiddlyWiki syntax.
Besides, with WikiBar-addons, users can extend the power of WikiBar.
!Support browser
*Firefox 1.5
!Revision history
*v2.0.0 beta3 (2005/12/30)
** remove macros (replaced by TWMacro addon)
** add wikibar command in toolbar automatically
** rename DOIT to HANDLER
** rename TIP to TOOLTIP
*v2.0.0 beta2 (2005/12/21)
** re-design Wikibar addon framework
*v2.0.0 beta1 (2005/12/14)
** Note:
*** WikiBarPlugin is renamed to WikiBar
** New Features:
*** support TiddlyWiki 2.0.0 template mechanism
*** new wikibar data structure
*** new wikibar-addon framework for developers
**** support dynamic popup menu generator
*** support most new macros added in TiddlyWiki 2.0.0
*** multi-level popup menu
*** fix wikibar tab stop
*** remove paletteSelector
** Known Bugs:
*** popup-menu and color-picker can't be closed correctly
*** some macros can't be displayed correctly in previewer
*** text in previewer will be displayed italic
*v1.2.0 (2005/11/21)
**New Features:
***User defined color palettes supported
####Get color palettes from [[ColorZilla Palettes|http://www.iosart.com/firefox/colorzilla/palettes.html]].
####Save the palette file(*.gpl) as a new tiddler and tag it with 'ColorPalettes', then you can use it in WikiBar.
***WikiBar style sheet supported
***Click on document to close current colorPicker, paletteSelector or aboutWikibar
*v1.1.1 (2005/11/03)
**Bugs fixed:
***'Not enough parameters!' message is displayed when the parameter includes '%+number', ex: 'hello%20world!'
*v1.1.0 (2005/11/01)
**Bugs fixed:
***WikiBar overruns (reported by by GeoffS <gslocock@yahoo.co.uk>)
**New features:
***Insert a color code at the cursor. (Thanks to RunningUtes <RunningUtes@gmail.com>)
***Enable gradient macro. (Thanks to RunningUtes <RunningUtes@gmail.com>)
***Insert tiddler comment tags {{{/% ... %/}}}. (new feature supported by TiddlyWiki 1.2.37)
***Insert DateFormatString for {{{<<today>>}}} macro. (new feature supported by TiddlyWiki 1.2.37)
**Enhanced:
***Allow optional parameters in syntax.
**Bugs:
***'Not enough parameters!' message is displayed when the parameter includes '%+number', ex: 'hello%20world!'
*v1.0.0 (2005/10/30)
**Initial release
!Code
***/
//{{{
config.macros.wikibar = {major: 2, minor: 0, revision: 0, beta: 3, date: new Date(2005,12,30)};
config.macros.wikibar.handler = function(place,macroName,params,wikifier,paramString,tiddler){
  if(!(tiddler instanceof Tiddler))  {return;}
	story.setDirty(tiddler.title,true);
  place.id = 'wikibar'+tiddler.title;
  place.className = 'toolbar wikibar';
};
function wikibar_install(){
  config.commands.wikibar = {
  	text: 'wikibar',
  	tooltip: 'wikibar on/off',
  	handler: function(e,src,title) {
      if(!e){ e = window.event; }
      var theButton = resolveTarget(e);
      theButton.id = 'wikibarButton'+title;
      wikibarPopup.remove();
      wikibar_installAddons(theButton, title);
      wikibar_createWikibar(title);
      return(false);
    }
  };
  config.shadowTiddlers['EditTemplate'] = wikibar_addWikibarCommand(config.shadowTiddlers['EditTemplate']);
  var tiddler = store.getTiddler('EditTemplate');
  if(tiddler){
    tiddler.text = wikibar_addWikibarCommand(tiddler.text);
  }
}
function wikibar_installAddons(theButton, title){
 	var tiddlers = store.getTaggedTiddlers('wikibarAddons');
	if(!tiddlers)	  { return; }
	theButton.addons=[];
  for(var i=0; i<tiddlers.length; i++){
    try{
      eval(tiddlers[i].text);
      try{
        wikibar_addonInstall(title);
        wikibar_addonInstall = null;
        theButton.addons.push({ok:true, name:tiddlers[i].title});
      }catch(ex){
        theButton.addons.push({ok:false, name:tiddlers[i].title, error:ex});
      }
    }catch(ex){
      theButton.addons.push({ok:false, name:tiddlers[i].title, error:ex});
    }
  }
}
function wikibar_addWikibarCommand(tiddlerText){
  var div = document.createElement('div');
  div.style.display = 'none';
  div.innerHTML = tiddlerText;
  for(var i=0; i<div.childNodes.length; i++){
    var o=div.childNodes[i];
    if(o.tagName==='DIV'){
      if(o.className=='toolbar'){
        var macroText = o.getAttribute('macro').trim();
        if(macroText.search('wikibar')<=0){
          macroText += ' wikibar';
          o.setAttribute('macro', macroText);
        }
        break;
      }
    }
  }
  return div.innerHTML.replace(/\"/g, "\'");
}
function wikibar_processSyntaxParams(theSyntax, params){
  try{
    var pcr = 'AplWikibarPcr';
    var rx=null;
    var allParams=null;
    if(params){
      if(typeof(params)=='object'){
        for(var i=0; i<params.length; i++){
          if(params[i]){
            params[i] = params[i].replace(new RegExp('%','g'), pcr).trim();
            rx = '(\\[%'+(i+1)+'\\])' + '|' + '(%'+(i+1)+')';
            theSyntax = theSyntax.replace(new RegExp(rx,'g'), params[i] );
          }
        }
        allParams = params.join(' ').trim();
      }else{
        allParams = params.replace(new RegExp('%','g'), pcr).trim();
        rx = /(\[%1{1}\])|(%1{1})/g;
        theSyntax = theSyntax.replace(rx, allParams);
      }
    }
    if(allParams){
      theSyntax = theSyntax.replace(new RegExp('%N{1}','g'), allParams);
    }
    rx=/\[%(([1-9]{1,}[0-9]{0,})|(N{1}))\]/g;
    theSyntax = theSyntax.replace(rx, '');
    rx=/%(([1-9]{1,}[0-9]{0,})|(N{1}))/g;
    if( theSyntax.match(rx) ){
      throw 'Not enough parameters! ' + theSyntax;
    }
    theSyntax=theSyntax.replace(new RegExp(pcr,'g'), '%');
    return theSyntax;
  } catch(ex){
    return null;
  }
}
function wikibar_resolveEditItem(tiddlerWrapper, itemName){
  if(tiddlerWrapper.hasChildNodes()){
    var c=tiddlerWrapper.childNodes;
    for(var i=0; i<c.length; i++){
      var txt=wikibar_resolveEditItem(c[i], itemName);
      if(!txt){
        continue;
      }else{
        return txt;
      }
    }
  }
  return ((tiddlerWrapper.getAttribute && tiddlerWrapper.getAttribute('edit')==itemName)? tiddlerWrapper : null);
}
function wikibar_resolveEditItemValue(tiddlerWrapper, itemName){
  var o = wikibar_resolveEditItem(tiddlerWrapper, itemName);
  return (o? o.value.replace(/\r/mg,'') : null);
}
function wikibar_resolveTiddlerEditorWrapper(obj){
  if(obj.id=='tiddlerDisplay'){return null;}
  if((obj.getAttribute && obj.getAttribute('macro')=='edit text')){return obj;}
  return wikibar_resolveTiddlerEditorWrapper(obj.parentNode);
}
function wikibar_resolveTiddlerEditor(obj){
  if(obj.hasChildNodes()){
    var c = obj.childNodes;
    for(var i=0; i<c.length; i++){
      var o=wikibar_resolveTiddlerEditor(c[i]);
      if(o){ return o;}
    }
  }
  return ((obj.getAttribute && obj.getAttribute('edit')=='text')? obj : null);
}
function wikibar_resolveTargetButton(obj){
  if(obj.id && obj.id.substring(0,7)=='wikibar'){ return null; }
  if(obj.tiddlerTitle){
    return obj;
  }else{
    return wikibar_resolveTargetButton(obj.parentNode);
  }
}
function wikibar_isValidMenuItem(tool){
  if(!tool){  return false; }
  if(tool.TYPE=='MENU' || tool.TYPE=='MAIN_MENU'){
    for(var key in tool){
      if(key.substring(0,8)=='DYNAITEM'){ return true; }
      if(wikibar_isValidMenuItem(tool[key])){ return true; }
    }
    return false;
  }else{
    return (tool.HANDLER? true : false);
  }
}
function wikibar_editFormat(param){
  var editor = param.button.editor;
  var params = param.params;
  clearMessage();
  if(!editor){ return; }
  var repText = wikibar_processSyntaxParams(this.syntax, params);
  if(repText===null){ return; }
	var st = editor.scrollTop;
	var ss = editor.selectionStart;
	var se = editor.selectionEnd;
	var frontText= '';
	var endText  = '';
	var fullText = editor.value;
	if(se>ss && ss>=0){
	  frontText  = fullText.substring(0, ss);
	  endText    = fullText.substring(se, fullText.length);
	}
	else if(ss===0 && (se===0 || se == fullText.length) ){
    endText    = fullText;
	}
	else if(se==ss && ss>0){
    frontText  = fullText.substring(0, ss);
    endText    = fullText.substring(se, fullText.length);
	}
	if(repText.indexOf('user_text')>=0 && this.hint){
		repText = repText.replace('user_text', this.hint);
	}
	editor.value = frontText + repText + endText;
	editor.selectionStart = ss;
	editor.selectionEnd   = ss + repText.length;
	editor.scrollTop      = st;
	editor.focus();
}
function wikibar_editFormatByWord(param){
  var editor = param.button.editor;
  var params = param.params;
  clearMessage();
  if(!editor){return;}
  var repText = wikibar_processSyntaxParams(this.syntax, params);
  if(repText===null){ return; }
	var st = editor.scrollTop;
	var ss = editor.selectionStart;
	var se = editor.selectionEnd;
	var frontText= '';
	var selText  = '';
	var endText  = '';
	var fullText = editor.value;
	if(se>ss && ss>=0){
	  frontText  = fullText.substring(0, ss);
	  selText	   = fullText.substring(ss,se);
	  endText    = fullText.substring(se, fullText.length);
	}
	else if(ss===0 && (se===0 || se == fullText.length) ){
    endText    = fullText;
	}
	else if(se==ss && ss>0){
    frontText  = fullText.substring(0, ss);
    endText    = fullText.substring(se, fullText.length);
	  if(!( fullText.charAt(ss-1).match(/\W/gi) || fullText.charAt(ss).match(/\W/gi) )){
      var m = frontText.match(/\W/gi);
      if(m){
        ss = frontText.lastIndexOf(m[m.length-1])+1;
      }
      else{
        ss = 0;
      }
      m = endText.match(/\W/gi);
      if(m){
        se += endText.indexOf(m[0]);
      }
      else{
        se = fullText.length;
      }
      frontText = fullText.substring(0, ss);
  	  endText   = fullText.substring(se, fullText.length);
  	  selText   = fullText.substring(ss,se);
	  }
	}
	if(selText.length>0){
		repText = repText.replace('user_text', selText);
	}
	if(repText.indexOf('user_text')>=0 && this.hint){
		repText = repText.replace('user_text', this.hint);
	}
	editor.value = frontText + repText + endText;
	editor.selectionStart = ss;
	editor.selectionEnd   = ss + repText.length;
	editor.scrollTop      = st;
	editor.focus();
}
function wikibar_editFormatByCursor(param){
  var editor = param.button.editor;
  var params = param.params;
  clearMessage();
  if(!editor){ return; }
  var repText = wikibar_processSyntaxParams(this.syntax, params);
  if(repText===null){ return; }
	var st = editor.scrollTop;
	var ss = editor.selectionStart;
	var se = editor.selectionEnd;
	var frontText= '';
	var endText  = '';
	var fullText = editor.value;
	if(se>ss && ss>=0){
	  frontText  = fullText.substring(0, ss);
	  endText    = fullText.substring(se, fullText.length);
	}
	else if(ss===0 && (se===0 || se == fullText.length) ){
    endText    = fullText;
	}
	else if(se==ss && ss>0){
    frontText  = fullText.substring(0, ss);
    endText    = fullText.substring(se, fullText.length);
	}
	if(repText.indexOf('user_text')>=0 && this.hint){
		repText = repText.replace('user_text', this.hint);
	}
	editor.value = frontText + repText + endText;
	editor.selectionStart = ss;
	editor.selectionEnd   = ss + repText.length;
	editor.scrollTop      = st;
	editor.focus();
}
function wikibar_editFormatByLine(param){
  var editor = param.button.editor;
  var params = param.params;
  clearMessage();
  if(!editor){ return; }
  var repText = wikibar_processSyntaxParams(this.syntax, params);
  if(repText===null){ return; }
	var st = editor.scrollTop;
	var ss = editor.selectionStart;
	var se = editor.selectionEnd;
	var frontText= '';
	var selText  = '';
	var endText  = '';
	var fullText = editor.value;
	if(se>ss && ss>=0){
		if(this.byBlock){
	    frontText  = fullText.substring(0, ss);
	    selText		 = fullText.substring(ss,se);
	    endText    = fullText.substring(se, fullText.length);
		}
		else{
	  	se = ss;
		}
	}
  if(ss===0 && (se===0 || se == fullText.length) ){
    var m=fullText.match(/(\n|\r)/g);
    if(m){
      se = fullText.indexOf(m[0]);
    }else{
      se = fullText.length;
    }
    selText    = fullText.substring(0, se);
    endText    = fullText.substring(se, fullText.length);
	}
	else if(se==ss && ss>0){
    frontText  = fullText.substring(0, ss);
    endText    = fullText.substring(se, fullText.length);
    m = frontText.match(/(\n|\r)/g);
    if(m){
      ss = frontText.lastIndexOf(m[m.length-1])+1;
    }
    else{
      ss = 0;
    }
    m = endText.match(/(\n|\r)/g);
    if(m){
      se += endText.indexOf(m[0]);
    }
    else{
      se = fullText.length;
    }
    frontText = fullText.substring(0, ss);
	  selText   = fullText.substring(ss,se);
	  endText   = fullText.substring(se, fullText.length);
	}
	if(selText.length>0){
		repText = repText.replace('user_text', selText);
	}
	if(repText.indexOf('user_text')>=0 && this.hint){
		repText = repText.replace('user_text', this.hint);
	}
	if(this.byBlock){
    if( (frontText.charAt(frontText.length-1)!='\n') && ss>0 ){
    	repText = '\n' + repText;
    }
    if( (endText.charAt(0)!='\n') || se==fullText.length){
    	repText += '\n';
    }
	}
	editor.value = frontText + repText + endText;
	editor.selectionStart = ss;
	editor.selectionEnd   = ss + repText.length;
	editor.scrollTop      = st;
	editor.focus();
}
function wikibar_editFormatByTableCell(param){
  var editor = param.button.editor;
  var params = param.params;
  clearMessage();
  if(!editor){ return; }
  var repText = wikibar_processSyntaxParams(this.syntax, params);
  if(repText===null){ return; }
	var st = editor.scrollTop;
	var ss = editor.selectionStart;
	var se = editor.selectionEnd;
	var frontText= '';
	var selText  = '';
	var endText  = '';
	var fullText = editor.value;
	if(ss===0 || ss==fullText.length){
		throw 'not valid cell!';
	}
	se=ss;
  frontText  = fullText.substring(0, ss);
  endText    = fullText.substring(se, fullText.length);
  i=frontText.lastIndexOf('\n');
  j=frontText.lastIndexOf('|');
  if(i>j || j<0){
  	throw 'not valid cell!';
  }
	ss = j+1;
  i=endText.indexOf('\n');
  j=endText.indexOf('|');
  if(i<j || j<0){
  	throw 'not valid cell!';
  }
  se += j;
  frontText = fullText.substring(0, ss-1);
  selText   = fullText.substring(ss,se);
  endText   = fullText.substring(se+1, fullText.length);
	if(this.key.substring(0,5)=='align'){
		selText = selText.trim();
		if(	selText=='>' || selText=='~' ||	selText.substring(0,8)=='bgcolor(')	{return; }
	}
	if(selText.length>0){
		repText = repText.replace('user_text', selText);
	}
	if(repText.indexOf('user_text')>=0 && this.hint){
		repText = repText.replace('user_text', this.hint);
	}
	editor.value = frontText + repText + endText;
	editor.selectionStart = ss;
	editor.selectionEnd   = ss + repText.length - 2;
	editor.scrollTop      = st;
	editor.focus();
}
function wikibar_editSelectAll(param){
  var editor = param.button.editor;
	editor.selectionStart = 0;
	editor.selectionEnd   = editor.value.length;
	editor.scrollTop      = 0;
	editor.focus();
}
function wikibar_doPreview(param){
  var theButton = param.button;
  var editor = param.button.editor;
  var wikibar = theButton.parentNode;
  if(!wikibar)  { return; }
  title = theButton.tiddlerTitle;
  var editorWrapper = wikibar_resolveTiddlerEditorWrapper(editor);
  var tiddlerWrapper = editorWrapper.parentNode;
  var previewer = document.getElementById('previewer'+title);
  if(previewer){
    previewer.parentNode.removeChild(previewer);
    editorWrapper.style.display = 'block';
    visible=true;
  }else{
    previewer = document.createElement('div');
    previewer.id = 'previewer'+title;
    previewer.className = 'viewer previewer';
    previewer.style.height = (editor.offsetHeight) + 'px';
    wikify(editor.value, previewer);
    tiddlerWrapper.insertBefore(previewer, editorWrapper);
    editorWrapper.style.display = 'none';
    visible=false;
  }
  var pv=null;
  for(var i=0; i<wikibar.childNodes.length; i++){
    try{
      var btn = wikibar.childNodes[i];
      if(btn.toolItem.key == 'preview'){ pv=btn; }
      if(btn.toolItem.key != 'preview'){
        btn.style.display = visible ? '': 'none';
      }
    }catch(ex){}
  }
  if(!pv) { return; }
  if(visible){
    pv.innerHTML = '<font face=\"verdana\">&infin;</font>';
    pv.title = 'preview current tiddler';
  }
  else{
    pv.innerHTML = '<font face=\"verdana\">&larr;</font>';
    pv.title = 'back to editor';
  }
}
function wikibar_doListAddons(param){
  clearMessage();
  var title = param.button.tiddlerTitle;
  var wikibarButton = document.getElementById('wikibarButton'+title);
  var ok=0, fail=0;
  for(var i=0; i<wikibarButton.addons.length; i++){
    var addon=wikibarButton.addons[i];
    if(addon.ok){
      displayMessage('[ o ] '+addon.name);
      ok++;
    }
    else{
      displayMessage('[ x ] '+addon.name + ': ' + addon.error);
      fail++;
    }
  }
  displayMessage('---------------------------------');
  displayMessage(ok + ' ok ; ' + fail + ' failed');
}
function wikibar_getColorCode(param){
  var cbOnPickColor = function(colorCode, param){
    param.params = colorCode;
    param.button.toolItem.doMore(param);
  };
  wikibarColorTool.openColorPicker(param.button, cbOnPickColor, param);
}
function wikibar_getLinkUrl(param){
  var url= prompt('Please enter the link target', (this.param? this.param : ''));
  if (url && url.trim().length>0){
    param.params = url;
    this.doMore(param);
  }
}
function wikibar_getTableRowCol(param){
  var rc= prompt('Please enter (rows x cols) of the table', '2 x 3');
  if (!rc || (rc.trim()).length<=0){ return; }
  var arr = rc.toUpperCase().split('X');
  if(arr.length != 2)   { return; }
  for(var i=0; i<arr.length; i++){
    if(isNaN(arr[i].trim()))  { return; }
  }
  var rows = parseInt(arr[0].trim(), 10);
  var cols = parseInt(arr[1].trim(), 10);
  var txtTable='';
  for(var r=0; r<rows; r++){
    for(var c=0; c<=cols; c++){
      if(c===0){
        txtTable += '|';
      }else{
        txtTable += ' |';
      }
    }
    txtTable += '\n';
  }
  if(txtTable.trim().length>0){
    param.params = txtTable.trim();
    this.doMore(param);
  }
}
function wikibar_getMacroParam(param){
  var p = prompt('Please enter the parameters of macro \"' + this.key + '\":' +
                 '\nSyntax: ' + this.syntax +
                 '\n\nNote: '+
                 '\n%1,%2,... - parameter needed'+
                 '\n[%1] - optional parameter'+
                 '\n%N   - more than one parameter(1~n)'+
                 '\n[%N] - any number of parameters(0~n)'+
                 '\n\nPS:'+
                 '\n1. Parameters should be seperated with space character'+
                 '\n2. Use \" to wrap the parameter that includes space character, ex: \"hello world\"'+
                 '\n3. Input the word(null) for the optional parameter ignored',
                 (this.param? this.param : '') );
  if(!p)  { return; }
  p=p.readMacroParams();
  for(var i=0; i<p.length; i++){
    var s=p[i].trim();
    if(s.indexOf(' ')>0){ p[i]="'"+s+"'"; }
    if(s.toLowerCase()=='null'){ p[i]=null; }
  }
  param.params = p;
  this.doMore(param);
}
function wikibar_getMorePalette(unused){
  clearMessage();
  displayMessage('Get more color palettes(*.gpl) from ColorZilla Palettes site', 'http:\/\/www.iosart.com/firefox/colorzilla/palettes.html');
  displayMessage('Save it as a new tiddler with \"ColorPalettes\" tag');
}
function wikibar_createWikibar(title){
  var theWikibar = document.getElementById('wikibar' + title);
  if(theWikibar){
    if(theWikibar.hasChildNodes()){
      theWikibar.style.display = (theWikibar.style.display=='block'? 'none':'block');
      return;
    }
  }
  var tiddlerWrapper = document.getElementById('tiddler'+title);
  var theTextarea = wikibar_resolveTiddlerEditor(tiddlerWrapper);
  if(!theTextarea){
    clearMessage();
    displayMessage('WikiBar only works in tiddler edit mode now');
    return;
  }else{
    if(!theTextarea.id){ theTextarea.id = 'editor'+title; }
    if(!theTextarea.parentNode.id){ theTextarea.parentNode.id='editorWrapper'+title;  }
  }
  if(theWikibar){
    theWikibar = document.getElementById('wikibar'+title);
  }else{
    var editorWrapper = wikibar_resolveTiddlerEditorWrapper(theTextarea);
    theWikibar = createTiddlyElement(tiddlerWrapper, 'div', 'wikibar'+title, 'toolbar');
    addClass(theWikibar, 'wikibar');
    var previewer = document.getElementById('previewer'+title);
    if(previewer){
      tiddlerWrapper.insertBefore(theWikibar, previewer);
    }else{
      tiddlerWrapper.insertBefore(theWikibar, editorWrapper);
    }
  }
  wikibar_createMenu(theWikibar,wikibarStore,title,theTextarea);
  if(config.options['chkWikibarSetEditorHeight'] && config.options['txtWikibarEditorRows']){
    theTextarea.rows = config.options['txtWikibarEditorRows'];
  }
  setStylesheet(
    '.wikibar{text-align:left;visibility:visible;margin:2px;padding:1px;}.previewer{overflow:auto;display:block;border:1px solid;}#colorPicker{position:absolute;display:none;z-index:10;margin:0px;padding:0px;}#colorPicker table{margin:0px;padding:0px;border:2px solid #000;border-spacing:0px;border-collapse:collapse;}#colorPicker td{margin:0px;padding:0px;border:1px solid;font-size:11px;text-align:center;cursor:auto;}#colorPicker .header{background-color:#fff;}#colorPicker .button{background-color:#fff;cursor:pointer;cursor:hand;}#colorPicker .button:hover{padding-top:3px;padding-bottom:3px;color:#fff;background-color:#136;}#colorPicker .cell{padding:4px;font-size:7px;cursor:crosshair;}#colorPicker .cell:hover{padding:10px;}.wikibarPopup{position:absolute;z-index:10;border:1px solid #014;color:#014;background-color:#cef;}.wikibarPopup table{margin:0;padding:0;border:0;border-spacing:0;border-collapse:collapse;}.wikibarPopup .button:hover{color:#eee;background-color:#014;}.wikibarPopup .disabled{color:#888;}.wikibarPopup .disabled:hover{color:#888;background-color:#cef;}.wikibarPopup tr .seperator hr{margin:0;padding:0;background-color:#cef;width:100%;border:0;border-top:1px dashed #014;}.wikibarPopup tr .icon{font-family:verdana;font-weight:bolder;}.wikibarPopup tr .marker{font-family:verdana;font-weight:bolder;}.wikibarPopup td{font-size:0.9em;padding:2px;}.wikibarPopup input{border:0;border-bottom:1px solid #014;margin:0;padding:0;font-family:arial;font-size:100%;background-color:#fff;}',
  	'WikiBarStyleSheet');
}
function wikibar_createMenu(place,toolset,title,editor){
  if(!wikibar_isValidMenuItem(toolset)){return;}
  if(!(toolset.TYPE=='MAIN_MENU' || toolset.TYPE=='MENU')){ return; }
    for(var key in toolset){
      if(key.substring(0,9)=='SEPERATOR'){
        wikibar_createMenuSeperator(place);
        continue;
      }
      if(key.substring(0,8)=='DYNAITEM'){
        var dynaTools = toolset[key](title,editor);
        if(dynaTools.TYPE && dynaTools.TYPE=='MENU'){
          wikibar_createMenuItem(place,dynaTools,null,editor,title);
        }else{
          dynaTools.TYPE = 'MENU';
          wikibar_createMenu(place, dynaTools, title, editor);
        }
        continue;
      }
      if((toolset[key].TYPE!='MENU' && toolset[key].TYPE!='MAIN_MENU') && !toolset[key].HANDLER){continue;}
      wikibar_createMenuItem(place,toolset,key,editor,title);
    }
}
function wikibar_createMenuItem(place,toolset,key,editor,title){
  if(!key){
    var tool = toolset;
  }else{
    tool = toolset[key];
    tool.key = key;
  }
  if(!wikibar_isValidMenuItem(tool)){return;}
  var toolIsOnMainMenu = (toolset.TYPE=='MAIN_MENU');
  var toolIsMenu = (tool.TYPE=='MENU');
  var theButton;
  if(toolIsOnMainMenu){
    theButton = createTiddlyButton(
                  place,
                  '',
                  (tool.TOOLTIP? tool.TOOLTIP : ''),
                  (toolIsMenu? wikibar_onClickMenuItem : wikibar_onClickItem),
                  'button');
    theButton.innerHTML = (tool.CAPTION? tool.CAPTION : key);
    theButton.isOnMainMenu = true;
    addClass(theButton, (toolIsMenu? 'menu' : 'item'));
  	place.appendChild( document.createTextNode('\n') );
    if(!toolIsMenu){
      if(config.options['chkWikibarPopmenuOnMouseOver']){
        theButton.onmouseover = function(e){ wikibarPopup.remove(); };
      }
    }
  }else{
    theButton=createTiddlyElement(place, 'tr',key,'button');
    theButton.title = (tool.TOOLTIP? tool.TOOLTIP : '');
    theButton.onclick = (toolIsMenu? wikibar_onClickMenuItem : wikibar_onClickItem);
    var tdL = createTiddlyElement(theButton, 'td','','marker');
    var td = createTiddlyElement(theButton, 'td');
    var tdR = createTiddlyElement(theButton, 'td','','marker');
    td.innerHTML = (tool.CAPTION? tool.CAPTION : key);
    if(toolIsMenu){
      tdR.innerHTML='&nbsp;&nbsp;&rsaquo;';
    }
    if(tool.SELECTED){
      tdL.innerHTML = '&radic; ';
      addClass(theButton, 'selected');
    }
    if(tool.DISABLED){
      addClass(theButton, 'disabled');
    }
  }
  theButton.tiddlerTitle = title;
  theButton.toolItem = tool;
  theButton.editor = editor;
  theButton.tabIndex = 999;
  if(toolIsMenu){
    if(config.options['chkWikibarPopmenuOnMouseOver']){
      theButton.onmouseover = wikibar_onClickMenuItem;
    }
  }
}
function wikibar_createMenuSeperator(place){
  if(place.id.substring(0,7)=='wikibar')  { return; }
  var onclickSeperator=function(e){
  	if(!e){ e = window.event; }
  	e.cancelBubble = true;
    if (e.stopPropagation){ e.stopPropagation();  }
  	return(false);
  };
  var theButton=createTiddlyElement(place,'tr','','seperator');
  var td = createTiddlyElement(theButton, 'td','','seperator');
  td.colSpan=3;
  theButton.onclick=onclickSeperator;
	td.innerHTML = '<hr>';
}
function wikibar_genWikibarAbout(){
  var toolset={};
  toolset.version = {
    CAPTION: '<center>WikiBar ' +
              config.macros.wikibar.major + '.' +
              config.macros.wikibar.minor + '.' +
              config.macros.wikibar.revision +
              (config.macros.wikibar.beta? ' beta '+config.macros.wikibar.beta : '') +
              '</center>',
    HANDLER: function(){}
  };
  toolset.SEPERATOR = {};
  toolset.author = {
    CAPTION: '<center>Arphen Lin<br>arphenlin@gmail.com</center>',
    TOOLTIP: 'send mail to the author',
    HANDLER: function(){ window.open('mailto:arphenlin@gmail.com'); }
  };
  toolset.website = {
    CAPTION: '<center>aiddlywiki.sourceforge.net</center>',
    TOOLTIP: 'go to the web site of WikiBar',
    HANDLER: function(){ window.open('http:\/\/aiddlywiki.sourceforge.net/'); }
  };
  return toolset;
}
function wikibar_genWikibarOptions(title, editor){
  var toolset={};
  toolset.popOnMouseOver = {
    CAPTION:'popup menu on mouse over',
    SELECTED: config.options['chkWikibarPopmenuOnMouseOver'],
    HANDLER: function(param){
      config.options['chkWikibarPopmenuOnMouseOver'] = !config.options['chkWikibarPopmenuOnMouseOver'];
      saveOptionCookie('chkWikibarPopmenuOnMouseOver');
      var title = param.button.tiddlerTitle;
      var wikibar = document.getElementById('wikibar'+title);
      if(wikibar){ wikibar.parentNode.removeChild(wikibar); }
      wikibar_createWikibar(title);
    }
  };
  toolset.setEditorSize = {
    CAPTION:'set editor height: <input id=\"txtWikibarEditorRows\" type=text size=1 MAXLENGTH=3 value=\"' +
            (config.options['txtWikibarEditorRows']? config.options['txtWikibarEditorRows']:editor.rows) + '\"> ok',
    HANDLER: function(param){
      var input = document.getElementById('txtWikibarEditorRows');
      if(input){
        var rows = parseInt(input.value, 10);
        if(!isNaN(rows)){
          var editor = param.button.editor;
          editor.rows = rows;
        }else{
          rows=config.maxEditRows;
        }
        config.options['txtWikibarEditorRows'] = rows;
        saveOptionCookie('txtWikibarEditorRows');
        config.maxEditRows = rows;
      }
    }
  };
  toolset.setEditorSizeOnLoadingWikibar = {
    CAPTION:'set editor height on loading wikibar',
    SELECTED: config.options['chkWikibarSetEditorHeight'],
    HANDLER: function(param){
      config.options['chkWikibarSetEditorHeight'] = !config.options['chkWikibarSetEditorHeight'];
      saveOptionCookie('chkWikibarSetEditorHeight');
      if(config.options['chkWikibarSetEditorHeight']){
        var rows = config.options['txtWikibarEditorRows'];
        if(!isNaN(rows)){ rows = 15; }
        var editor = param.button.editor;
        editor.rows = rows;
        config.options['txtWikibarEditorRows'] = rows;
        saveOptionCookie('txtWikibarEditorRows');
      }
    }
  };
  toolset.SEPERATOR = {};
  toolset.update = {
    CAPTION: 'check for updates',
    DISABLED: true,
    HANDLER: function(){}
  };
  return toolset;
}
function wikibar_genPaletteSelector(){
  try{
  	var cpTiddlers = store.getTaggedTiddlers('ColorPalettes');
  	if(!cpTiddlers) { return; }
  	var palettes=[];
  	palettes.push(wikibarColorTool.defaultPaletteName);
  	for(var i=0; i<cpTiddlers.length; i++){
  		palettes.push(cpTiddlers[i].title.trim());
  	}
    var toolset={};
    for(i=0; i<palettes.length; i++){
      toolset[palettes[i]] = {
        TOOLTIP: palettes[i],
        SELECTED: (palettes[i]==wikibarColorTool.paletteName),
        HANDLER: wikibar_doSelectPalette
      };
    }
    return toolset;
  }catch(ex){ return null; }
}
function wikibar_onClickItem(e){
	if(!e){ e = window.event; }
	var theTarget = resolveTarget(e);
	if(theTarget.tagName=='INPUT'){
    e.cancelBubble = true;
    if (e.stopPropagation){ e.stopPropagation(); }
    return;
	}
	var theButton = wikibar_resolveTargetButton(theTarget);
	if(!theButton){ return(false);  }
  	var o = theButton.toolItem;
    if(!o) { return; }
    var param = {
      event: e,
      button: theButton
    };
    if(o.HANDLER){ o.HANDLER(param);  }
  if(o.DISABLED){
    e.cancelBubble = true;
    if (e.stopPropagation){ e.stopPropagation(); }
  }
	return(false);
}
function wikibar_onClickMenuItem(e){
	if(!e){ e = window.event; }
	var theButton = wikibar_resolveTargetButton(resolveTarget(e));
	if(!theButton){ return(false);  }
	e.cancelBubble = true;
	if (e.stopPropagation){ e.stopPropagation(); }
    var title = theButton.tiddlerTitle;
    var editor = theButton.editor;
    var tool = theButton.toolItem;
    if(!tool) { return; }
    var popup = wikibarPopup.create(this);
  	if(popup){
      wikibar_createMenu(popup,tool,title,editor);
      if(!popup.hasChildNodes()){
        wikibarPopup.remove();
      }else{
        wikibarPopup.show(popup, false);
      }
    }
	return(false);
}
var wikibarColorTool = {
  defaultPaletteName : 'default',
  defaultColumns : 16,
  defaultPalette : [
    '#FFF','#DDD','#CCC','#BBB','#AAA','#999','#666','#333','#111','#000','#FC0','#F90','#F60','#F30','#C30','#C03',
    '#9C0','#9D0','#9E0','#E90','#D90','#C90','#FC3','#FC6','#F96','#F63','#600','#900','#C00','#F00','#F36','#F03',
    '#CF0','#CF3','#330','#660','#990','#CC0','#FF0','#C93','#C63','#300','#933','#C33','#F33','#C36','#F69','#F06',
    '#9F0','#CF6','#9C3','#663','#993','#CC3','#FF3','#960','#930','#633','#C66','#F66','#903','#C39','#F6C','#F09',
    '#6F0','#9F6','#6C3','#690','#996','#CC6','#FF6','#963','#630','#966','#F99','#F39','#C06','#906','#F3C','#F0C',
    '#3F0','#6F3','#390','#6C0','#9F3','#CC9','#FF9','#C96','#C60','#C99','#F9C','#C69','#936','#603','#C09','#303',
    '#0C0','#3C0','#360','#693','#9C6','#CF9','#FFC','#FC9','#F93','#FCC','#C9C','#969','#939','#909','#636','#606',
    '#060','#3C3','#6C6','#0F0','#3F3','#6F6','#9F9','#CFC','#9CF','#FCF','#F9F','#F6F','#F3F','#F0F','#C6C','#C3C',
    '#030','#363','#090','#393','#696','#9C9','#CFF','#39F','#69C','#CCF','#C9F','#96C','#639','#306','#90C','#C0C',
    '#0F3','#0C3','#063','#396','#6C9','#9FC','#9CC','#06C','#369','#99F','#99C','#93F','#60C','#609','#C3F','#C0F',
    '#0F6','#3F6','#093','#0C6','#3F9','#9FF','#699','#036','#039','#66F','#66C','#669','#309','#93C','#C6F','#90F',
    '#0F9','#6F9','#3C6','#096','#6FF','#6CC','#366','#069','#36C','#33F','#33C','#339','#336','#63C','#96F','#60F',
    '#0FC','#6FC','#3C9','#3FF','#3CC','#399','#033','#39C','#69F','#00F','#00C','#009','#006','#003','#63F','#30F',
    '#0C9','#3FC','#0FF','#0CC','#099','#066','#3CF','#6CF','#09C','#36F','#0CF','#09F','#06F','#03F','#03C','#30C'
  ],
	colorPicker : null,
  pickColorHandler: null,
  userData: null
};
wikibarColorTool.paletteName = wikibarColorTool.defaultPaletteName;
wikibarColorTool.columns = wikibarColorTool.defaultColumns;
wikibarColorTool.palette = wikibarColorTool.defaultPalette;
wikibarColorTool.onPickColor = function(e){
	if (!e){ e = window.event; }
	var theCell = resolveTarget(e);
	if(!theCell){ return(false); }
    color = theCell.bgColor.toLowerCase();
    if(!color)  { return; }
    wikibarColorTool.displayColorPicker(false);
    if(wikibarColorTool.pickColorHandler){
      wikibarColorTool.pickColorHandler(color, wikibarColorTool.userData);
    }
	return(false);
};
wikibarColorTool.onMouseOver = function(e){
	if (!e){ e = window.event; }
	var theButton = resolveTarget(e);
	if(!theButton){ return(false);  }
  	if(!wikibarColorTool)  { return; }
    color = theButton.bgColor.toUpperCase();
    if(!color)  { return; }
    td=document.getElementById('colorPickerInfo');
  	if(!td) { return; }
  	td.bgColor = color;
  	td.innerHTML = '<span style=\"color:#000;\">'+color+'</span>&nbsp;&nbsp;&nbsp;' +
  	               '<span style=\"color:#fff;\">'+color+'</span>';
	e.cancelBubble = true;
	if (e.stopPropagation){ e.stopPropagation(); }
	return(false);
};
wikibarColorTool.openColorPicker = function(theTarget, pickColorHandler, userData){
  wikibarColorTool.skipClickDocumentEvent = true;
  wikibarColorTool.pickColorHandler = pickColorHandler;
  wikibarColorTool.userData = userData;
  wikibarColorTool.moveColorPicker(theTarget);
};
wikibarColorTool.convert3to6HexColor = function(c){
  c=c.trim();
  var rx=/^\#(\d|[a-f])(\d|[a-f])(\d|[a-f])$/gi;
  return (rx.test(c)? c.replace(rx, '#$1$1$2$2$3$3') : c);
};
wikibarColorTool.numToHexColor = function (n){
  if(typeof(n)=='number' && (n>=0 && n<=255)) {
  		s = n.toString(16).toLowerCase();
  		return ((s.length==1)? '0'+s : s);
  }else{
	 return null;
	}
};
wikibarColorTool.renderColorPalette = function(){
	if(wikibarColorTool.paletteName==wikibarColorTool.defaultPaletteName){
		wikibarColorTool.palette=wikibarColorTool.defaultPalette;
		wikibarColorTool.columns=wikibarColorTool.defaultColumns;
		return;
	}
	tiddlerText = (store.getTiddlerText(wikibarColorTool.paletteName, '')).trim();
	if(tiddlerText.length<=0) { return; }
	var cpContents = tiddlerText.split('\n');
	var colors=[];
	columns = wikibarColorTool.defaultColumns;
	var tmpArray=null;
	errCount=0;
	for(var i=0; i<cpContents.length; i++){
		cpLine=cpContents[i].trim();
    if( (!cpLine) || (cpLine.length<=0) || (cpLine.charAt(0) == '#') ){ continue; }
		if(cpLine.substring(0,8).toLowerCase()=='columns:'){
			tmpArray = cpLine.split(':');
			try{
				columns = parseInt(tmpArray[1],10);
			}catch(ex){
				columns = wikibarColorTool.defaultColumns;
			}
		}else{
			tmpArray = cpLine.replace('\t', ' ').split(/[ ]{1,}/);
			try{
				color='';
				for(var j=0; j<3; j++){
          c=parseInt(tmpArray[j].trim(), 10);
          if(isNaN(c)){
						break;
          }else{
						c=wikibarColorTool.numToHexColor(c);
						if(!c) {break;}
            color+=c;
					}
				}
				if(color.length==6){
					colors.push('#'+color);
				}	else {
					throw 'error';
				}
			}catch(ex){
			}
		}
	}
	if(colors.length>0){
		wikibarColorTool.palette = colors;
		wikibarColorTool.columns = columns;
	}else{
		throw 'renderColorPalette(): No color defined in the palette.';
	}
};
wikibarColorTool.displayColorPicker = function(visible){
  if(wikibarColorTool.colorPicker){
    wikibarColorTool.colorPicker.style.display = (visible? 'block' : 'none');
  }
};
wikibarColorTool.moveColorPicker = function(theTarget){
  if(!wikibarColorTool.colorPicker){
  	wikibarColorTool.createColorPicker();
  }
	var cp = wikibarColorTool.colorPicker;
	var rootLeft = findPosX(theTarget);
  var rootTop = findPosY(theTarget);
  var popupLeft = rootLeft;
  var popupTop = rootTop;
  var popupWidth = cp.offsetWidth;
  var winWidth = findWindowWidth();
  if(popupLeft + popupWidth > winWidth){
	  popupLeft = winWidth - popupWidth;
	}
  cp.style.left = popupLeft + 'px';
  cp.style.top = popupTop + 'px';
  wikibarColorTool.displayColorPicker(true);
};
wikibarColorTool.createColorPicker = function(unused, palette){
  if(palette){	wikibarColorTool.paletteName=palette; }
	wikibarColorTool.renderColorPalette();
	wikibarColorTool.colorPicker = document.createElement('div');
	wikibarColorTool.colorPicker.id = 'colorPicker';
	document.body.appendChild(wikibarColorTool.colorPicker);
  var theTable = document.createElement('table');
  wikibarColorTool.colorPicker.appendChild(theTable);
  var theTR = document.createElement('tr');
	theTable.appendChild(theTR);
	var theTD = document.createElement('td');
	theTD.className = 'header';
	theTD.colSpan = wikibarColorTool.columns;
	theTD.innerHTML = wikibarColorTool.paletteName;
  theTR.appendChild(theTD);
  for(var i=0; i<wikibarColorTool.palette.length; i++){
    if((i%wikibarColorTool.columns)===0){
      theTR = document.createElement('tr');
      theTable.appendChild(theTR);
    }
    theTD = document.createElement('td');
    theTD.className = 'cell';
    theTD.bgColor = wikibarColorTool.convert3to6HexColor(wikibarColorTool.palette[i]);
    theTD.onclick = wikibarColorTool.onPickColor;
    theTD.onmouseover = wikibarColorTool.onMouseOver;
    theTR.appendChild(theTD);
  }
  rest = wikibarColorTool.palette.length % wikibarColorTool.columns;
  if(rest>0){
    theTD = document.createElement('td');
		theTD.colSpan = wikibarColorTool.columns-rest;
    theTD.bgColor = '#000000';
    theTR.appendChild(theTD);
  }
  theTR = document.createElement('tr');
	theTable.appendChild(theTR);
	theTD = document.createElement('td');
	theTD.colSpan = wikibarColorTool.columns;
	theTD.id = 'colorPickerInfo';
  theTR.appendChild(theTD);
};
wikibarColorTool.onDocumentClick = function(e){
	if (!e){ e = window.event; }
	if(wikibarColorTool.skipClickDocumentEvent) {
	  wikibarColorTool.skipClickDocumentEvent = false;
    return true;
	}
	if((!e.eventPhase) || e.eventPhase == Event.BUBBLING_PHASE || e.eventPhase == Event.AT_TARGET){
    wikibarColorTool.displayColorPicker(false);
  }
	return true;
};
function wikibar_doSelectPalette(param){
	clearMessage();
	var theButton = param.button;
	if(!theButton.toolItem.key)  { return; }
	var palette = theButton.toolItem.key;
	var oldPaletteName = wikibarColorTool.paletteName;
	if(oldPaletteName != palette){
		try{
			wikibarColorTool.createColorPicker(theButton, palette);
			displayMessage('Palette \"'+palette+'\" ('+ wikibarColorTool.palette.length +' colors) is selected');
		}catch(ex){
			errMsg = ex;
			if(errMsg.substring(0,18)=='renderColorPalette'){
				displayMessage('Invalid palette \"' + palette + '\", please check it out!');
				wikibarColorTool.createColorPicker(theButton, oldPaletteName);
			}
		}
	}
}
var wikibarPopup = {
  skipClickDocumentEvent: false,
	stack: []
};
wikibarPopup.resolveRootPopup = function(o){
  if(o.isOnMainMenu){  return null; }
  if(o.className.substring(0,12)=='wikibarPopup'){  return o;}
  return wikibarPopup.resolveRootPopup(o.parentNode);
};
wikibarPopup.create = function(root){
  for(var i=0; i<wikibarPopup.stack.length; i++){
    var p=wikibarPopup.stack[i];
    if(p.root==root){
      wikibarPopup.removeFrom(i+1);
      return null;
    }
  }
  var rootPopup = wikibarPopup.resolveRootPopup(root);
  if(!rootPopup){
    wikibarPopup.remove();
  }else{
    wikibarPopup.removeFromRootPopup(rootPopup);
  }
	var popup = createTiddlyElement(document.body,'div','wikibarPopup'+root.toolItem.key,'wikibarPopup');
	var pop = createTiddlyElement(popup,'table','','');
	wikibarPopup.stack.push({rootPopup: rootPopup, root: root, popup: popup});
	return pop;
};
wikibarPopup.show = function(unused,slowly){
	var curr = wikibarPopup.stack[wikibarPopup.stack.length-1];
	var overlayWidth = 1;
  var rootLeft, rootTop, rootWidth, rootHeight, popupLeft, popupTop, popupWidth;
  if(curr.rootPopup){
  	rootLeft = findPosX(curr.rootPopup);
  	rootTop = findPosY(curr.root);
  	rootWidth = curr.rootPopup.offsetWidth;
  	popupLeft = rootLeft + rootWidth - overlayWidth;
  	popupTop = rootTop;
  }else{
  	rootLeft = findPosX(curr.root);
  	rootTop = findPosY(curr.root);
  	rootHeight = curr.root.offsetHeight;
  	popupLeft = rootLeft;
  	popupTop = rootTop + rootHeight;
  }
	var winWidth = findWindowWidth();
	popupWidth = curr.popup.offsetWidth;
	if(popupLeft + popupWidth > winWidth){
		popupLeft = rootLeft - popupWidth + overlayWidth;
	}
	curr.popup.style.left = popupLeft + 'px';
	curr.popup.style.top = popupTop + 'px';
	curr.popup.style.display = 'block';
	addClass(curr.root, 'highlight');
	if(config.options.chkAnimate){
		anim.startAnimating(new Scroller(curr.popup,slowly));
	}else{
		window.scrollTo(0,ensureVisible(curr.popup));
	}
};
wikibarPopup.remove = function(){
	if(wikibarPopup.stack.length > 0){
		wikibarPopup.removeFrom(0);
  }
};
wikibarPopup.removeFrom = function(from){
	for(var t=wikibarPopup.stack.length-1; t>=from; t--){
		var p = wikibarPopup.stack[t];
		removeClass(p.root,'highlight');
		p.popup.parentNode.removeChild(p.popup);
  }
	wikibarPopup.stack = wikibarPopup.stack.slice(0,from);
};
wikibarPopup.removeFromRootPopup = function(from){
  for(var t=0; t<wikibarPopup.stack.length; t++){
    var p = wikibarPopup.stack[t];
    if(p.rootPopup==from){
      wikibarPopup.removeFrom(t);
      break;
    }
  }
};
wikibarPopup.onDocumentClick = function(e){
	if (!e){ e = window.event; }
	if(wikibarPopup.skipClickDocumentEvent){
	 wikibarPopup.skipClickDocumentEvent=false;
	 return true;
	}
	if((!e.eventPhase) || e.eventPhase == Event.BUBBLING_PHASE || e.eventPhase == Event.AT_TARGET){
		wikibarPopup.remove();
	}
	return true;
};
var wikibarStore = {
  TYPE: 'MAIN_MENU',
  help:{
    TYPE:'MENU',
    CAPTION: '<font face=\"verdana\">?</font>',
    TOOLTIP:     'about WikiBar',
    options:{
      TYPE:'MENU',
      DYNAITEM: wikibar_genWikibarOptions
    },
    about:{
      TYPE:'MENU',
      DYNAITEM: wikibar_genWikibarAbout
    }
  },
  preview:{
    TOOLTIP:     'preview this tiddler',
    CAPTION: '<font face=\"verdana\">&infin;</font>',
    HANDLER: wikibar_doPreview
  },
	line:{
		TOOLTIP:    'horizontal line',
		CAPTION: '<font face=\"verdana\">&mdash;</font>',
		syntax: '\n----\n',
		HANDLER: wikibar_editFormatByCursor
	},
	crlf:{
		TOOLTIP:    'new line',
		CAPTION: '<font face=\"verdana\">&para;</font>',
		syntax: '\n',
		HANDLER: wikibar_editFormatByCursor
	},
	selectAll:{
		TOOLTIP:    'select all',
		CAPTION: '<font face=\"verdana\">&sect;</font>',
		HANDLER: wikibar_editSelectAll
	},
	deleteSelected:{
		TOOLTIP:    'delete selected',
		CAPTION: '<font face=\"verdana\">&times;</font>',
		syntax: '',
		HANDLER: wikibar_editFormat
	},
  textFormat:{
    TYPE: 'MENU',
    CAPTION: 'text',
    TOOLTIP: 'text formatters',
    ignore:{
			TOOLTIP:     'ignore wiki word',
			CAPTION: 'ignore wikiWord',
			syntax:  '~user_text',
			hint:    'wiki_word',
			HANDLER:    wikibar_editFormatByWord
		},
		bolder:{
			TOOLTIP:     'bolder text',
			CAPTION: '<strong>bolder</strong>',
			syntax:  "''user_text''",
			hint:		 'bold_text',
			HANDLER:    wikibar_editFormatByWord
		},
		italic:{
			TOOLTIP:    'italic text',
			CAPTION: '<em>italic</em>',
			syntax: '\/\/user_text\/\/',
			hint:		'italic_text',
			HANDLER: wikibar_editFormatByWord
		},
		underline:{
			TOOLTIP:    'underline text',
			CAPTION: '<u>underline</u>',
			syntax: '__user_text__',
			hint:		'underline_text',
			HANDLER: wikibar_editFormatByWord
		},
		strikethrough:{
			TOOLTIP:    'strikethrough text',
			CAPTION: '<strike>strikethrough</strike>',
			syntax: '==user_text==',
			hint:		'strikethrough_text',
			HANDLER: wikibar_editFormatByWord
		},
		superscript:{
			TOOLTIP:    'superscript text',
			CAPTION: 'X<sup>superscript</sup>',
			syntax: '^^user_text^^',
			hint:		'superscript_text',
			HANDLER: wikibar_editFormatByWord
		},
		subscript:{
			TOOLTIP:    'subscript text',
			CAPTION: 'X<sub>subscript</sub>',
			syntax: '~~user_text~~',
			hint:		'subscript_text',
			HANDLER: wikibar_editFormatByWord
		},
		comment:{
			TOOLTIP:    'comment text',
			CAPTION: 'comment text',
			syntax: '/%user_text%/',
			hint:		'comment_text',
			HANDLER: wikibar_editFormatByWord
		},
		monospaced:{
			TOOLTIP:    'monospaced text',
			CAPTION: '<code>monospaced</code>',
			syntax: '{{{user_text}}}',
			hint:		'monospaced_text',
			HANDLER: wikibar_editFormatByWord
		}
  },
  paragraph:{
    TYPE: 'MENU',
    TOOLTIP: 'paragarph formatters',
    list:{
      TYPE: 'MENU',
      TOOLTIP: 'list tools',
      bullet:{
  			TOOLTIP:    'bullet point',
  			syntax: '*user_text',
  			hint:		'bullet_text',
  			HANDLER: wikibar_editFormatByLine
  		},
  		numbered:{
  			TOOLTIP:    'numbered list',
  			syntax: '#user_text',
  			hint:		'numbered_text',
  			HANDLER: wikibar_editFormatByLine
  		}
    },
    heading:{
      TYPE: 'MENU',
      heading1:{
  		  CAPTION:'<h1>Heading 1</h1>',
  			TOOLTIP:    'Heading 1',
  			syntax: '!user_text',
  			hint:		'heading_1',
  			HANDLER: wikibar_editFormatByLine
  		},
  		heading2:{
  		  CAPTION:'<h2>Heading 2<h2>',
  			TOOLTIP:    'Heading 2',
  			syntax: '!!user_text',
  			hint:		'heading_2',
  			HANDLER: wikibar_editFormatByLine
  		},
  		heading3:{
  		  CAPTION:'<h3>Heading 3</h3>',
  			TOOLTIP:    'Heading 3',
  			syntax: '!!!user_text',
  			hint:		'heading_3',
  			HANDLER: wikibar_editFormatByLine
  		},
  		heading4:{
  		  CAPTION:'<h4>Heading 4</h4>',
  			TOOLTIP:    'Heading 4',
  			syntax: '!!!!user_text',
  			hint:		'heading_4',
  			HANDLER: wikibar_editFormatByLine
  		},
  		heading5:{
  		  CAPTION:'<h5>Heading 5</h5>',
  			TOOLTIP:    'Heading 5',
  			syntax: '!!!!!user_text',
  			hint:		'heading_5',
  			HANDLER: wikibar_editFormatByLine
  		}
    },
    comment:{
      TYPE: 'MENU',
      commentByLine:{
  			CAPTION:'comment by line',
  			TOOLTIP:    'line comment',
  			syntax: '/%user_text%/',
  			hint:		'comment_text',
  			HANDLER: wikibar_editFormatByLine
  		},
  		commentByBlock:{
  			CAPTION:'comment by block',
  			TOOLTIP:    'block comment',
  			syntax: '/%\nuser_text\n%/',
  			hint:		'comment_text',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		}
    },
    monospaced:{
      TYPE: 'MENU',
  		monosByLine:{
  			CAPTION: 	'monospaced by line',
  			TOOLTIP:    'line monospaced',
  			syntax: '{{{\nuser_text\n}}}',
  			hint:		'monospaced_text',
  			HANDLER: wikibar_editFormatByLine
  		},
  		monosByBlock:{
  			CAPTION: 	'monospaced by block',
  			TOOLTIP:    'block monospaced',
  			syntax: '{{{\nuser_text\n}}}',
  			hint:		'monospaced_text',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		}
    },
    quote:{
      TYPE: 'MENU',
  		quoteByLine:{
  			CAPTION: 	'quote by line',
  			TOOLTIP:    'line quote',
  			syntax: '>user_text',
  			hint:		'quote_text',
  			HANDLER: wikibar_editFormatByLine
  		},
  		quoteByBlcok:{
  			CAPTION: 	'quote by block',
  			TOOLTIP:    'block quote',
  			syntax: '<<<\nuser_text\n<<<',
  			hint:		'quote_text',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		}
    },
    plugin:{
      TYPE: 'MENU',
      code:{
  			CAPTION: 	'code area',
  			TOOLTIP:    'block monospaced for plugin',
  			syntax: '\n\/\/{{{\nuser_text\n\/\/}}}\n',
  			hint:		'monospaced_plugin_code',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		},
  		commentByLine:{
  			CAPTION: 	'comment by line',
  			TOOLTIP:    'line comment',
  			syntax: '\/\/user_text',
  			hint:		'plugin_comment',
  			HANDLER: wikibar_editFormatByLine
  		},
  		commentByBlock:{
  			CAPTION: 	'comment by block',
  			TOOLTIP:    'block comment',
  			syntax: '\/\***\nuser_text\n***\/',
  			hint:		'plugin_comment',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		}
    },
    css:{
      TYPE: 'MENU',
      code:{
  			CAPTION: 	'code area',
  			TOOLTIP:    'block monospaced for css',
  			syntax: '\n\nuser_text\n\n',
  			hint:		'monospaced_css_code',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		},
  		commentByLine:{
  			CAPTION: 	'comment by line',
  			TOOLTIP:    'line comment',
  			syntax: '',
  			hint:		'css_comment',
  			HANDLER: wikibar_editFormatByLine
  		},
  		commentByBlock:{
  			CAPTION: 	'comment by block',
  			TOOLTIP:    'block comment',
  			syntax: '',
  			hint:		'css_comment',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		}
    }
  },
  color:{
    TYPE: 'MENU',
    TOOLTIP: 'color tools',
    highlight:{
		  CAPTION:'highlight text',
			TOOLTIP:    'highlight text',
			syntax: '@@user_text@@',
			hint:		'highlight_text',
			HANDLER: wikibar_editFormatByWord
		},
		color:{
		  CAPTION:'text color',
			TOOLTIP:    'text color',
			hint:		'your_text',
			syntax: '@@color(%1):user_text@@',
			HANDLER:   wikibar_getColorCode,
			doMore: wikibar_editFormatByWord
		},
		bgcolor:{
		  CAPTION:'background color',
			TOOLTIP:    'background color',
			hint:		'your_text',
			syntax: '@@bgcolor(%1):user_text@@',
			HANDLER: wikibar_getColorCode,
			doMore: wikibar_editFormatByWord
		},
		colorcode:{
      CAPTION:'color code',
      TOOLTIP:    'insert color code',
      syntax: '%1',
      HANDLER: wikibar_getColorCode,
      doMore: wikibar_editFormatByCursor
    },
    'color palette':{
      TYPE:'MENU',
      DYNAITEM: wikibar_genPaletteSelector,
  		SEPERATOR:{},
  		morePalette:{
  		  CAPTION:'more palettes',
  		  TOOLTIP:'get more palettes',
  		  HANDLER: wikibar_getMorePalette
  		}
    }
  },
  link:{
    TYPE: 'MENU',
    TOOLTIP: 'insert link',
    wiki:{
		  CAPTION:'wiki link',
			TOOLTIP:    'wiki link',
			syntax: '[[user_text]]',
			hint:		'wiki_word',
			HANDLER: wikibar_editFormatByWord
		},
		pretty:{
			CAPTION: 	'pretty link',
			TOOLTIP:    'pretty link',
			syntax: '[[user_text|%1]]',
			hint:		'pretty_word',
			param:	'PrettyLink Target',
			HANDLER:   wikibar_getLinkUrl,
			doMore: wikibar_editFormatByWord
		},
		url:{
			TOOLTIP:    'url link',
			syntax: '[[user_text|%1]]',
			hint:		'your_text',
			param:	'http:\/\/...',
			HANDLER:   wikibar_getLinkUrl,
			doMore: wikibar_editFormatByWord
		},
		image:{
			TOOLTIP:    'image link',
			syntax: '[img[user_text|%1]]',
			hint:		'alt_text',
			param:	'image/icon.jpg',
			HANDLER:   wikibar_getLinkUrl,
			doMore: wikibar_editFormatByWord
		}
  },
  macro:{},
  more:{
    TYPE: 'MENU',
    TOOLTIP: 'more tools',
    table:{
      TYPE: 'MENU',
      TOOLTIP: 'table',
      table:{
  		  CAPTION:'create table',
  			TOOLTIP:    'create a new table',
  			syntax: '\n%1\n',
  			HANDLER: wikibar_getTableRowCol,
  			doMore: wikibar_editFormatByWord
  		},
  		header:{
  			TOOLTIP:    'table header text',
  			syntax: '|user_text|c',
  			hint:		'table_header',
  			HANDLER: wikibar_editFormatByWord
  		},
  		cell:{
  			TOOLTIP:    'create a tabel cell',
  			syntax: '|user_text|',
  			hint:		'your_text',
  			HANDLER: wikibar_editFormatByWord
  		},
  		columnHeader:{
  		  CAPTION:'column header',
  			TOOLTIP:    'create a column header cell',
  			syntax: '|!user_text|',
  			hint:		'column_header',
  			HANDLER: wikibar_editFormatByWord
  		},
  	  cell:{
  	    TYPE: 'MENU',
        CAPTION: 'cell options',
    		bgcolor:{
    			CAPTION: 	'background color',
    			TOOLTIP:    'cell bgcolor',
    			syntax: '|bgcolor(%1):user_text|',
    			hint:		'your_text',
    			HANDLER: wikibar_getColorCode,
    			doMore: wikibar_editFormatByTableCell
    		},
    		alignLeft:{
    			CAPTION: 	'align left',
    			TOOLTIP:    'left align cell text',
    			syntax: '|user_text|',
    			hint:		'your_text',
    			HANDLER: wikibar_editFormatByTableCell
    		},
    		alignCenter:{
    			CAPTION: 	'align center',
    			TOOLTIP:    'center align cell text',
    			syntax: '| user_text |',
    			hint:		'your_text',
    			HANDLER: wikibar_editFormatByTableCell
    		},
    		alignRight:{
    			CAPTION: 	'align right',
    			TOOLTIP:    'right align cell text',
    			syntax: '| user_text|',
    			hint:		'your_text',
    			HANDLER: wikibar_editFormatByTableCell
    		}
    	}
    },
    html:{
      TYPE: 'MENU',
      html:{
  			CAPTION: 	'&lt;html&gt;',
  			TOOLTIP:    'html tag',
  			syntax: '<html>\nuser_text\n</html>',
  			hint:		'html_content',
  			byBlock: true,
  			HANDLER: wikibar_editFormatByLine
  		}
    }
  },
  addon:{
    TYPE: 'MENU',
    TOOLTIP:'3rd party tools',
    'about addons':{
      TOOLTIP: 'list loaded addons',
      HANDLER: wikibar_doListAddons
    },
    SEPERATOR:{}
  }
};
addEvent(document, 'click', wikibarColorTool.onDocumentClick);
addEvent(document, 'click', wikibarPopup.onDocumentClick);
wikibar_install();
//}}}sys