Jump to content

User:Odie5533/SnipManager.user.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// <pre><nowiki>
// ==UserScript==
// @name            SnipManager
// @id              snipmanager
// @author          odie5533
// @description     SnipManager is a script for Wikipedia which adds a toolbar to the top of the edit box for holding complex signatures, templates, or other pieces of text. It is compatible with wikEd (and TW/HW).
// @homepage        http://en.wikipedia.org/wiki/User:Odie5533/SnipManager
// @screenshot      http://upload.wikimedia.org/wikipedia/commons/2/29/SnipManager.png
// @namespace       http://en.wikipedia.org/*
// @include         http://*.wikipedia.org/*
// @include         https://*.wikipedia.org/*
// @include         https://secure.wikimedia.org/*
// @updateURL       http://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Odie5533/SnipManager.user.js
// @grant			none
// ==/UserScript==
//
// This script is based off of [[User:Mr.Z-man/refToolbar.js]]
// It would have been a lot harder without the work he did
//
// Credit also to wikiEd for coding examples
// 
// Changelog:
// 2014-06-13 - Updated some of the citation templates
// 2014-05-23 - Fix insertions not working with wikEd (insertTags); added Cite press release
// 2012-11-09 - Cleanup code; fix bug in insertTags when using wikiEd
// 2012-11-07 - Updated {{cite web}}

if (typeof(SnippetManagerWrapper) == 'undefined') { window.SnippetManagerWrapper = {}; }
window.SnippetManagerWrapper = function() {

if (typeof(smConfig) == 'undefined') { window.smConfig = new Object(); }
if (typeof(smConfig['smColumns']) == 'undefined') { window.smConfig['smColumns'] = 2; }
if (typeof(smConfig['smTextWidth']) == 'undefined') { window.smConfig['smTextWidth'] = '220px'; }
if (typeof(smConfig['smSingleForm']) == 'undefined') { window.smConfig['smSingleForm'] = true; }
if (typeof(smConfig['smTemplateurl']) == 'undefined') { window.smConfig['smTemplateurl'] = '//en.wikipedia.org/wiki/Template:'; }
if (typeof(smConfig['smForms']) == 'undefined') {
    window.smConfig['smForms'] = {
        'doicite' : [ { 'httpeval':[ 'http://tools.wikimedia.de/~verisimilus/Bot/DOI_bot/doibot.php?edit=false&slow=1&page=%s', "escape(mw.config.get('wgPageName')).replace('&', '%26');" ] } ],
        'cleanup' : [ { 'inserttext':'{{Cleanup}}' } ],
        'copyedit' : [ { 'inserttext':'{{Copyedit}}' } ],
        'intro-toolong' : [ { 'inserttext':'{{Intro-toolong}}' } ],
        'intro-tooshort' : [ { 'inserttext':'{{Intro-tooshort}}' } ],
        'intro-rewrite' : [ { 'inserttext':'{{Intro-rewrite}}' } ],
        'intro-missing' : [ { 'inserttext':'{{Intro-missing}}' } ],
        'No footnotes' : [ { 'inserttext':'{{No footnotes|{{subst:DATE}}}}' } ],
        'More footnotes' : [ { 'inserttext':'{{More footnotes|{{subst:DATE}}}}' } ],
        'Refimprove' : [ { 'inserttext':'{{Refimprove|{{subst:DATE}}}}' } ],
        'unreferenced' : [ { 'inserttext':'{{Unreferenced|{{subst:DATE}}}}' } ],
        'citecheck' : [ { 'inserttext':'{{Citecheck|article|{{subst:DATE}}}}' } ],
        'Review' : [ { 'inserttext':'{{Review|article|{{subst:DATE}}}}' } ],
        'Advert' : [ { 'inserttext':'{{Advert|article|{{subst:DATE}}}}' } ],
        'Howto' : [ { 'inserttext':'{{Howto|article|{{subst:DATE}}}}' } ],
        'Plot' : [ { 'inserttext':'{{Plot|article|{{subst:DATE}}}}' } ],
        'Crystal' : [ { 'inserttext':'{{Crystal|article|{{subst:DATE}}}}' } ],
        'fact' : [ { 'inserttext':'{{Fact|{{subst:DATE}}}}' } ],
        'weasel-inline' : [ { 'inserttext':'{{Weasel-inline|{{subst:DATE}}}}' } ],
        'Primarysources' : [ { 'inserttext':'{{Primary sources|{{subst:DATE}}}}' } ],
        'Notability' : [ { 'inserttext':'{{Notability|{{subst:DATE}}}}' } ],
        'One source' : [ { 'inserttext':'{{One source|{{subst:DATE}}}}' } ],
        'showrefs' : [ { 'evaluate':'easyCiteMain();citeNamedRef();' } ],
        'referrs' : [ { 'evaluate':'easyCiteMain();dispErrors();' } ],
        'uw-csd' : [ { 'prepend':'{{subst:uw-csd', 'append':'}}' },
                    {'title':'Page name', 'code':'1' },
                    {'title':'Criterion', 'code':'2' },
                    {'title':'Concern/reason', 'code':'3' },
                    {'title':'Additional text', 'code':'4' }
                    ],
        'Cite web' : [ { 'prepend':'<ref>{{Cite web', 'append':'}}</ref>', 'description':'This template is used to cite online sources in Wikipedia articles. {{<a href="/wiki/Template:Cite_news" title="Template:Cite news">Cite news</a>}} can also be used when citing a news source; for general information about citations in Wikipedia articles, see <a href="/wiki/Wikipedia:Citing%20sources" title="" class="mw-redirect">Wikipedia:Citing sources</a>.' },
                    {'title':'<strong>Title:</strong>', 'code':'title', 'help':'Title of web page. Displays in quotes'},
                    {'title':'URL:', 'code':'url', 'help':'URL of an online location where the text of the publication can be found. Cannot be used if title is wikilinked. If applicable, the link may point to the specific page(s) referenced. Do not link to any commercial booksellers such as Amazon.com; see WP:PAGELINKS.'},
                    {'title':'First name:', 'code':'first', 'help':'Given or first names of author, including title(s); for example: Firstname Middlename or Firstname M. or Dr. Firstname M., Sr. Do not wikilink—use authorlink instead. Aliases: first, first1.'},
                    {'title':'Last name:', 'code':'last', 'help':'Surname of author. Do not wikilink—use authorlink instead. Where the surname is usually written first—as in Chinese—or for corporate authors, simply use last to include the same format as the source. Aliases: last, author, authors, last1, author1'},
                    {'title':'Publication date:', 'code':'date', 'help':'Full date of source being referenced in the same format as other publication dates in the citations. Do not wikilink. Displays after the authors and enclosed in parentheses. If there is no author, then displays after publisher.'},
                    {'title':'Work:', 'code':'work', 'help':'Title of website; can be wikilinked to an existing Wikipedia article or url may be used to add an external link, but not both. Displays in italics.'},
                    {'title':'Publisher:', 'code':'publisher', 'help':'Name of publisher; may be wikilinked if relevant. Not normally included for periodicals. Corporate designations such as "Ltd", "Inc" or "GmbH" are not usually included. Displays after title.'},
                    {'title':'Year:', 'code':'year', 'help':'year of publication'},
					{'title':'Original year', 'code':'origyear', 'help':'Original publication year; displays after the date or year. For clarity, please supply specifics; example: |origyear=First published 1859 or |origyear=Composed 1904.'},
                    {'title':'Access date:', 'code':'accessdate', 'defeval':'smGetTime()', 'help':'Full date when URL was accessed; use the same format as other access and archive dates in the citations;[1] do not wikilink. Can be hidden by registered editors.'},
                    {'title':'Author link:', 'code':'authorlink', 'help':'Title of existing Wikipedia article about the author—not the author\'s website; do not wikilink. Aliases: authorlink, authorlink1, author-link, author1-link.'},
					{'title':'Others:', 'code':'others', 'help':'To record other contributors to the work, such as "Illustrated by John Smith" or "Translated by John Smith."'},
                    {'title':'Format:', 'code':'format', 'help':'e.g. PDF. HTML is implied'},
					{'title':'Series:', 'code':'series', 'help':'When the source is part of a series, such as a book series or a journal where the issue numbering has restarted.'},
					{'title':'Type:', 'code':'type', 'help':'Provides additional information about the media type of the source; format in sentence case. Displays in parentheses following the title. Examples: Thesis, Booklet, CD liner, Press release.'},
                    {'title':'Location:', 'code':'location', 'help':'Geographical place of publication; generally not wikilinked; omit when the name of the work includes the location; examples: The Boston Globe, The Times of India. Displays preceding publisher.'},
					{'title':'Page:', 'code':'page', 'help':'Page in the source that supports the content. Displays preceded with p. unless |nopp=y.'},
                    {'title':'Pages:', 'code':'pages', 'help':'Pages in the source that supports the content; separate page ranges with an en dash (–); separate non-sequential pages with a comma (,); do not use to indicate the total number of pages in the source. Displays preceded with pp. unless |nopp=y.'},
					{'title':'At:', 'code':'at', 'help':'For sources where a page number is inappropriate or insufficient. Overridden by |page= or |pages=. Examples: page (p.) or pages (pp.); section (sec.), column (col.), paragraph (para.); track; hours, minutes and seconds; act, scene, canto, book, part, folio, stanza, back cover, liner notes, indicia, colophon, dust jacket, verse.'},
                    {'title':'Language:', 'code':'language', 'help':'The language the source is written in, if not English. Displays in parentheses with "in" before the language name. Use the full language name; do not use icons or templates.'},
                    {'title':'DOI:', 'code':'doi', 'help':'A digital object identifier for the document, such as 10.1038/news070508-7'},
                    {'title':'Archive url:', 'code':'archiveurl', 'help':'The URL of an archived copy of a web page, if or in case the url becomes unavailable. Typically used to refer to services like WebCite and the Internet Archive; requires archivedate.'},
                    {'title':'Archive date:', 'code':'archivedate', 'help':'Date when the item was archived; use the same format as other access and archive dates in the citations; do not wikilink. Displays preceded by "archived from the original on".'},
					{'title':'Dead url?:', 'code':'deadurl', 'help':'When the URL is still live, but preemptively archived, then set |deadurl=no. This changes the display order with the title retaining the original link and the archive linked at the end.'},
                    {'title':'Quote:', 'code':'quote', 'help':'Relevant quote from online item.'},
                  ],
        'citenews' : [ { 'prepend':'<ref>{{cite news', 'append':'}}</ref>' },
                    {'title':'<strong>Title:</strong>', 'code':'title', 'help':'required, rest is optional. Note that title must be on one line in order for the hyperlink to display properly. Do not enclose it in quotations marks, italics or other formatting, though it may be wikilinked.'},
                    {'title':'URL:', 'code':'url', 'help':'Link to the news item if available online (note this is not for a link to the main web page of the work of publisher, but only to a copy of the item specified in title). Start the url with the communications protocol e.g. http://. '},
                    {'title':'First name:', 'code':'first', 'help':'First name of author'},
                    {'title':'Last name:', 'code':'last', 'help':'Last name of the author'},
                    {'title':'Publication date:', 'code':'date', 'help':'Date of publication. Use the same format as the main text of the article.'},
                    {'title':'Work:', 'code':'work', 'help':'The publication that ran the item, e.g. Newsweek. Can also be used for the name of a column or subpart of an issue. Do not italicize.'},
                    {'title':'Author link:', 'code':'authorlink', 'help':'works either with author or with last & first to link to the appropriate Wikipedia article. Does not work with URLs.'},
                    {'title':'Author:', 'code':'author', 'help':'Author'},
                    {'title':'Format:', 'code':'format', 'help':'e.g. PDF. HTML is implied. Specify as "fee required" if free access is no longer available. Specify as "Reprint" if you use a full original version but not hosted by the original publisher.'},
                    {'title':'Agency:', 'code':'agency', 'help':'The news agency (wire service) that provided the content, e.g. Associated Press, Reuters, etc. Spell out and link the full name.'},
                    {'title':'Location:', 'code':'location', 'help':'Place of the publication, e.g. Toronto for The Globe and Mail. For student newspapers, include the name of the school.'},
                    {'title':'Publisher:', 'code':'publisher', 'help':'The company or organization that publishes the news source. Not necessary for major publications like The New York Times, but may add credibility for local papers that are part of a family of publications like The McClatchy Company.'},
                    {'title':'Identifier:', 'code':'id', 'help':'A unique identifier, used if none of the above are applicable. In this case, you need to specify the kind of identifier you are using, preferably with a template like {{ASIN}} or {{ISSN}}. (Use one of the more specialized parameters if possible; they are linked automatically. In other words, don\'t use id = ISBN 1-111-22222-9 anymore. Use isbn = 1-111-22222-9.)'},
                    {'title':'Page:', 'code':'page', 'help':'The page(s) on which the article is found. page inserts the abbreviation "p." before the number; pages inserts "pp." Use only one of these parameters. If numbers are entered for both, pages overrides page.'},
                    {'title':'Pages:', 'code':'pages', 'help':'The page(s) on which the article is found. page inserts the abbreviation "p." before the number; pages inserts "pp." Use only one of these parameters. If numbers are entered for both, pages overrides page.'},
                    {'title':'Publication year:', 'code':'year', 'help':'year of publication'},
                    {'title':'Access date:', 'code':'accessdate', 'defeval':'smGetTime()', 'help':'Full date when item was accessed, in ISO 8601 YYYY-MM-DD format, for example "accessdate = 2009-03-13". Must not be wikilinked.'},
                    {'title':'Language:', 'code':'language', 'help':'The language in which the source is written. If English (the default) do not use this parameter.'},
                    {'title':'Quote:', 'code':'quote', 'help':'Relevant quotation. Adding a quotation can help locate online copies of the item using a text search, especially if the original link goes dead.'},
                    {'title':'Archive url:', 'code':'archiveurl', 'help':'URL of the archive location of the item; this is for archives (such archive.org and WebCite); for back-issues and the like that are on file at the publisher\'s site, use the "url" parameter (requires archivedate).'},
                    {'title':'Archive date:', 'code':'archivedate', 'help':'Date when the item was archived (requires archiveurl), in ISO 8601 YYYY-MM-DD format, e.g. 2006-02-17. Must not be wikilinked.'},
                  ],
        'citebook' : [ { 'prepend':'<ref>{{cite book', 'append':'}}</ref>' },
                    {'title':'Last name:', 'code':'last', 'help':'Surname of author. Don\'t wikilink (use authorlink instead).'},
                    {'title':'First name:', 'code':'first', 'help':'First name(s) of author, including title(s) (e.g. Firstname Middlename or Firstname M. or Dr. Firstname M., Snr.). Don\'t wikilink (use authorlink instead). '},
                    {'title':'Author link:', 'code':'authorlink', 'help':'Title of Wikipedia article about author. Article should already exist. Must not be wikilinked itself. Do not use this on its own, but along with "author" or "first" and "last".'},
                    {'title':'Editor:', 'code':'editor', 'help':'Name of editor/editors. Do not Wikilink any values in the editor field but use "editor-link" instead. The template automatically adds "ed." after the editor\'s name unless the "chapter" parameter is used in which case the template adds "in" before the editor\'s name which appears after the chapter and before the title.'},
                    {'title':'Other Contribs:', 'code':'others', 'help':'To record other contributors to the work, such as "illustrated by Smith" or "trans. Smith".'},
                    {'title':'title:', 'code':'title', 'help':'Title of book. This is the only required parameter. Can be wikilinked only to an existing Wikipedia article. Do not use italics.'},
                    {'title':'URL:', 'code':'url', 'help':'URL of an online location where the book can be found. Cannot be used if you wikilinked title. If applicable, can point to the specific page(s) referenced.'},
                    {'title':'Format:', 'code':'format', 'help':'Format, e.g. PDF. HTML implied if not specified.'},
                    {'title':'Access date:', 'code':'accessdate', 'defeval':'smGetTime()', 'help':'Full date when url was accessed. Required when url field is used. Must not be wikilinked.'},
                    {'title':'Edition:', 'code':'edition', 'help':'When the book has more than one edition. e.g.: "2nd." (note that " ed." is placed after this field, so edition=2nd produces "2nd ed.").'},
                    {'title':'Series:', 'code':'series', 'help':'When the book is part of a series of publications'},
                    {'title':'Volume:', 'code':'volume', 'help':'For one book published in several volumes. However, this template displays the text in this field in bold type after the "title" and "series" parameters. An alternative is to include the volume information in the "title" field after the main title (see example below). (NB: there is a separate {{Cite encyclopedia}} template).'},
                    {'title':'Publication date:', 'code':'date', 'help':'Full date of publication edition being referenced, in the same format as the main text of the article. Must not be wikilinked.'},
                    {'title':'Orig publication year:', 'code':'origyear', 'help':'Original publication year, for display alongside the date or year. For clarity, please specify as much information as possible, for instance "First published 1859" or "Composed 1904". This parameter only displays if a there is a value for "year" or "date".'},
                    {'title':'Publication year:', 'code':'year', 'help':'Year of publication edition being referenced, and month: Name of the month of publication. If you also have the day, use date instead. Must not be wikilinked.'},
                    {'title':'Publisher:', 'code':'publisher', 'help':'Publisher should not include corporate designation such as "Ltd" or "Inc". '},
                    {'title':'Location:', 'code':'location', 'help':'Geographical place of publication.'},
                    {'title':'Language:', 'code':'language', 'help':'The language the book is written in, if it is not English. The template automatically puts parentheses around the text and adds "in" before the language name.'},
                    {'title':'ISBN:', 'code':'isbn', 'help':'International Standard Book Number such as 1-111-22222-9. Note that "isbn", like all field names, must be in lowercase.'},
                    {'title':'OCLC:', 'code':'oclc', 'help':'Online Computer Library Center ID number, such as 3185581'},
                    {'title':'DOI:', 'code':'doi', 'help':'A digital object identifier such as 10.1016/j.coi.2004.08.001.'},
                    {'title':'Bibcode:', 'code':'bibcode', 'help':'A nineteen character Bibcode identifier.'},
                    {'title':'ID:', 'code':'id', 'help':'A unique identifier, used if none of the above are applicable. In this case, you need to specify the kind of identifier you are using, preferably with a template like {{ASIN}} or {{ISSN}}. (Use one of the more specialized parameters if possible; they are linked automatically. In other words, don\'t use id = ISBN 1-111-22222-9 anymore. Use isbn = 1-111-22222-9.)'},
                    {'title':'Page:', 'code':'page', 'help':'"|pages= 5–7" produces pp. 5–7, while "|page= 5" produces p. 5. The "pp." notation indicating multiple pages, and "p." notation indicating a single page, are placed automatically when you choose between the plural (pages) or singular (page) form of the parameter. These parameters are for listing the pages relevant to the citation, not the total number of pages in the book.'},
                    {'title':'Pages:', 'code':'pages', 'help':'"|pages= 5–7" produces pp. 5–7, while "|page= 5" produces p. 5. The "pp." notation indicating multiple pages, and "p." notation indicating a single page, are placed automatically when you choose between the plural (pages) or singular (page) form of the parameter. These parameters are for listing the pages relevant to the citation, not the total number of pages in the book.'},
                    {'title':'No PP.:', 'code':'nopp', 'help':'using "page" or "pages", automatically places the p. or pp. notations. If this is inappropriate—for instance, if page=Front cover, placing any value after nopp will hide the p. or pp. notation.'},
                    {'title':'Chapter:', 'code':'chapter', 'help':'The chapter of the book, written in full. Punctuation other than quotes should be included in the value passed to the parameter, e.g. chapter = Meet Dick and Jane. produces "Meet Dick and Jane." ahead of title.'},
                    {'title':'Chapter URL:', 'code':'chapterurl', 'help':'URL of an individual chapter of online book. Should be at the same site as url, if any.'},
                    {'title':'Quote:', 'code':'quote', 'help':'Relevant quote from the book.'},
                    {'title':'Link Ref:', 'code':'ref', 'help':'use this parameter to make the reference linkable. The variable is placed after the # in a hyperlink (the fragment identifier). Such a linkable reference can be made the target of wikilinks to full references, especially useful in short citations like shortened notes and author-date referencing. See an example for using ref field in citation templates below.'},
                    {'title':'Lay summary URL:', 'code':'laysummary', 'help':'Link to a non-technical summary (or review) of the book '},
                    {'title':'Lay summary date:', 'code':'laydate', 'help':'Date of summary'},
                    {'title':'Separator:', 'code':'separator', 'help':'The separator to use in lists of authors, editors, etc. Defaults to ".", but "," may be useful also.'}, 
                    {'title':'Postscript:', 'code':'postscript', 'help':'The closing punctuation for the citation. Defaults to ".", but "" may be useful also.'}, 
                    {'title':'Last Author Sep (&):', 'code':'lastauthoramp', 'help':'The separator to use between the last two names in lists of authors. Defaults to "", but "&" may be useful also.'}
                  ],
        'citejournal' : [ { 'prepend':'<ref>{{cite journal', 'append':'}}</ref>' },
                    {'title':'Last name:', 'code':'last', 'help':'last works with first to produce last, first'}, 
                    {'title':'First name:', 'code':'first', 'help':'last works with first to produce last, first'}, 
                    {'title':'Author Wikilink:', 'code':'authorlink', 'help':'authorlink works either with author or with last & first to link to the appropriate article (interwiki link)'}, 
                    {'title':'Publication date:', 'code':'date', 'help':'January 1, 2006. Full date of publication.'}, 
                    {'title':'Publication year:', 'code':'year', 'help':'2006. Year of publication (ignored if the date field is used).'},
                    {'title':'Title:', 'code':'title', 'help':'Title of article. This is the only required parameter. All other parameters are optional.'}, 
                    {'title':'Journal:', 'code':'journal', 'help':'Name of the journal or periodical.'}, 
                    {'title':'Volume:', 'code':'volume', 'help':'Volume number of the journal in which the article is found'}, 
                    {'title':'Issue:', 'code':'issue', 'help':'Journal\'s issue number, or issue name.'}, 
                    {'title':'Series:', 'code':'series', 'help':'According to the 14th edition of Chicago Manual of Style p. 576, "As in the case of book series, some journals have attained such longevity that they have begun a new series of volumes or issues. Identification of the series (n.s., 2d ser., 3d ser., ser. b) must be made in citations to these journals."'},
                    {'title':'Pages:', 'code':'pages', 'help':'45–47: first page, and optional last page (separated by an en dash –). Manually prepend with p. or pp. if desired.'}, 
                    {'title':'Publisher:', 'code':'publisher', 'help':'Publisher of journal or periodical; should not include corporate designation such as "Ltd" or "Inc". Only include if ISSN and DOI are unavailable.'}, 
                    {'title':'Location:', 'code':'location', 'help':'Place of publication for journal or periodical.'}, 
                    {'title':'ISSN:', 'code':'issn', 'help':'The publication\'s International Standard Serial Number such as 1111-2220. Only include if a DOI is unavailable.'}, 
                    {'title':'PMID:', 'code':'pmid', 'help':'The document\'s PubMed Unique Identifier, such as 15128012'}, 
                    {'title':'PMC:', 'code':'pmc', 'help':'The document\'s PubMed Central article number for full-text free repository of an article, such as 246835'}, 
                    {'title':'DOI:', 'code':'doi', 'help':'A digital object identifier for the document, such as 10.1130/0091-7613(1990)018<1153:TAFSIA>2.3.CO;2.'}, 
                    {'title':'Bibcode:', 'code':'bibcode', 'help':'The document\'s bibcode in the Astrophysics Data System, e.g., 1924MNRAS..84..308E'}, 
                    {'title':'OCLC:', 'code':'oclc', 'help':'The periodical\'s Online Computer Library Center ID number, such as 3185581'}, 
                    {'title':'Id:', 'code':'id', 'help':'A unique identifier, used if none of the above are applicable. In this case, you need to specify the kind of identifier you are using, preferably with a template like {{US patent}}, {{MR}} / {{MathSciNet}}, {{Zbl}}, {{arXiv}} or {{JFM}}. (Use one of the more specialized parameters if possible; they are linked automatically. In other words, don\'t use id = PMID 15128012 anymore. Use pmid = 15128012.)'}, 
                    {'title':'URL:', 'code':'url', 'help':'This should point to, in descending order of preference: 1. A free online version of the full text  2. An online version of the full text, for which subscription is required  3. An abstract or information page, if no DOI or PMID record is available. If a DOI or PMID is available, the URL should only be specified if it would point to a different page to that which a DOI or PMID would redirect to.'}, 
                    {'title':'Language:', 'code':'language', 'help':'Language, e.g. Finnish. (English is assumed and should not be specified.)'}, 
                    {'title':'Format:', 'code':'format', 'help':'Format, e.g. PDF. Don\'t specify for HTML (implied as default). Specify as "fee required" if free access no longer available. Specify as "Reprint" if a full original version but not hosted by the original publisher.'}, 
                    {'title':'Access date:', 'code':'accessdate', 'defeval':'smGetTime()', 'help':'Full date when URL was last checked.'}, 
                    {'title':'Lay summary URL:', 'code':'laysummary', 'help':'URL of a lay summary, which could be in a popular science magazine or newspaper. '}, 
                    {'title':'Lay source:', 'code':'laysource', 'help':'Name of the source, e.g. The Guardian (UK newspaper) or New Scientist.'}, 
                    {'title':'Lay summary date:', 'code':'laydate', 'help':'Date of publication or, where this is not available, date of retrieval of the lay summary.'}, 
                    {'title':'Quote:', 'code':'quote', 'help':'Relevant excerpt from the journal.'}
                ],
        'Cite video' : [ { 'prepend':'<ref>{{Cite video', 'append':'}}</ref>' },
                    {'title':'Title:', 'code':'title', 'help':'Title of the production. This is the only required field.'},
                    {'title':'Date:', 'code':'date', 'help':'Date of source being referenced. Can be full date (day, month, and year) or partial date (month and year, season and year, year). Use same format as other publication dates in the citations.'},
                    {'title':'Last:', 'code':'last', 'help':'Surname of author. Do not wikilink—use authorlink instead. Where the surname is usually written first—as in Chinese—or for corporate authors, simply use last to include the same format as the source.'},
                    {'title':'First:', 'code':'first', 'help':'Given or first names of author, including title(s); for example: Firstname Middlename or Firstname M. or Dr. Firstname M., Sr. Do not wikilink—use authorlink instead. Aliases: first1. Requires last; first name will not display if last is empty.'},
                    {'title':'Url:', 'code':'url', 'help':'Provides a link to either the production\'s website or to its entry at IMDb. May wikilink to an article rather than provide a URL.'},
                    {'title':'Format:', 'code':'format', 'help':'File format of the URL link if containing digital media. For example, "mov" or "avi".'},
                    {'title':'Medium:', 'code':'medium', 'help':'Type of production being sourced. (Motion picture, Television production, Documentary, Videotape, DVD, Trailer, Video game.)'},
                    {'title':'Publisher:', 'code':'publisher', 'help':'Name of the individual or group releasing the production, or airing the broadcast. For example, "Paramount Pictures" or "Disney" or "History Channel International". '},
                    {'title':'Location:', 'code':'location', 'help':'Physical location of the publisher, formatted as either "City, State" or "City, Country". For example, "New York, NY" or "London, England".'},
                    {'title':'Access date:', 'code':'accessdate', 'defeval':'smGetTime()', 'help':'Full date when url was accessed, in ISO 8601 YYYY-MM-DD format, eg. 2005-01-31 (January 01, 2005). Required when url field is used to link a url. (Must not be wikilinked.) '},
                    {'title':'Time:', 'code':'time', 'help':'Roughly what time, if accessible, a scene occurs with-in a production. Useful for citing specific scenes, quotations or data.'},
                    {'title':'Id:', 'code':'id', 'help':'A unique identifier, used if none of the above are applicable. In this case, you need to specify the kind of identifier you are using, preferably with a template like {{ISSN}}. (Use one of the more specialized parameters if possible; they are linked automatically. In other words, don\'t use id = ISBN 1-111-22222-9 anymore. Use isbn = 1-111-22222-9.)'},
                    {'title':'ISBN:', 'code':'isbn', 'help':'International Standard Book Number such as 1-111-22222-9.'},
                    {'title':'OCLC:', 'code':'oclc', 'help':'Online Computer Library Center ID number, such as 3185581.'},
                    {'title':'Quote:', 'code':'quote', 'help':'information source quotation of pertinent data like is the likely reason for citing the media in the first place!'},
                ],
        'Cite press release' : [ {'prepend':'<ref>{{Cite press release', 'append':'}}</ref>' },
                        {'title':'First', 'code':'first', 'help':'Given or first names of author, including title(s); for example: Firstname Middlename or Firstname M. or Dr. Firstname M., Sr. Do not wikilink—use authorlink instead. Aliases: first1. Requires last; first name will not display if last is empty.'},
                        {'title':'Last', 'code':'last', 'help':'Surname of author. Do not wikilink—use authorlink instead. Where the surname is usually written first—as in Chinese—or for corporate authors, simply use last to include the same format as the source.'},
                        {'title':'Title', 'code':'title', 'help':'Title of source. Can be wikilinked to an existing Wikipedia article or url may be used to add an external link, but not both. Displays in quotes.'},
                        {'title':'URL', 'code':'url', 'help':'URL of an online location where the text of the publication can be found. Cannot be used if title is wikilinked. If applicable, the link may point to the specific page(s) referenced. Remove spurious tracking parameters from URLs, e.g. #ixzz2rBr3aO94 or ?utm_source=google&utm_medium=...&utm_term=...&utm_campaign=.... Do not link to any commercial booksellers, such as Amazon.com. See: WP:PAGELINKS.'},
                        {'title':'Date', 'code':'date', 'help':'Date of source being referenced. Can be full date (day, month, and year) or partial date (month and year, season and year, year). Use same format as other publication dates in the citations. Required when year is used to disambiguate {{sfn}} links to multiple-work citations by the same author in the same year. Do not wikilink. Displays after the authors and is enclosed in parentheses. If there is no author, then displays after publisher.'},
                        {'title':'Place (location)', 'code':'place', 'help':'Geographical place of publication; generally not wikilinked; omit when the name of the work includes the location; examples: The Boston Globe, The Times of India. Displays after the title; if work is defined, then location is enclosed in parentheses. Alias: location'},
                        {'title':'Publisher', 'code':'publisher', 'help':'Name of publisher; may be wikilinked if relevant. The publisher is the company that publishes the work being cited. Do not use the publisher parameter for the name of a work (e.g., a book, encyclopedia, newspaper, magazine, journal, website). Not normally used for periodicals. Corporate designations such as "Ltd", "Inc" or "GmbH" are not usually included. Omit where the publisher\'s name is substantially the same as the name of the work (for example, The New York Times Co. publishes The New York Times newspaper, so there is no reason to name the publisher). Displays after title; if work is defined, then publisher is enclosed in parentheses.'},
                        {'title':'Agency', 'code':'agency', 'help':'The news agency (wire service) that provided the content; examples: Associated Press, Reuters, Agence France-Presse. May be wikilinked if relevant.'},
                        {'title':'Format', 'code':'format', 'help':'Format of the work referred to by url; for example: PDF, DOC, or XLS; displayed in parentheses after title. HTML is implied and should not be specified. Does not change the external link icon. Note: External link icons do not include alt text; thus, they do not add format information for the visually impaired.'},
                        {'title':'Trans. title', 'code':'trans_title', 'help':'English translation of the title if the source cited is in a foreign language. Displays in square brackets after title; if url is defined, then trans_title is included in the link. Use of the language parameter is recommended.'},
                        {'title':'Language', 'code':'language', 'help':'The language the source is written in, if not English. Displays in parentheses with "in" before the language name. Use the full language name or ISO 639-1 code; use of ISO 639-1 also adds appropriate language categorization; do not use icons or templates.'},
                        {'title':'Page', 'code':'page', 'help':'The number of a single page in the source that supports the content. Use either |page= or |pages=, but not both. Displays preceded by p. unless |nopp=y.'},
                        {'title':'Pages', 'code':'pages', 'help':'A range of pages in the source that supports the content. Use either |page= or |pages=, but not both. Separate using an en dash (–); separate non-sequential pages with a comma (,); do not use to indicate the total number of pages in the source. Displays preceded by pp. unless |nopp=y. Hyphens are automatically converted to en dashes; if hyphens are appropriate, for example: pp. 3-1–3-15, use |at=.'},
                        {'title':'Dead URL?', 'code':'deadurl', 'help':'When the URL is still live, but pre-emptively archived, then set |deadurl=no. This changes the display order with the title retaining the original link and the archive linked at the end.'},
                        {'title':'Archive url', 'code':'archiveurl', 'help':'The URL of an archived copy of a web page, if or in case the url becomes unavailable. Typically used to refer to services like WebCite (see: Wikipedia:Using WebCite) and Internet Archive (see: Wikipedia:Using the Wayback Machine); requires archivedate and url.'},
                        {'title':'Archive date', 'code':'archivedate', 'help':'Date when the original URL was archived; preceded by default text "archived from the original on". Use the same format as other access and archive dates in the citations. This does not necessarily have to be the same format that was used for citing publication dates. Do not wikilink.'},
                        {'title':'Access date', 'code':'accessdate', 'defeval':'smGetTime()', 'help':'Full date when original URL was accessed; use the same format as other access and archive dates in the citations; requires url. Do not wikilink. Not required for web pages or linked documents that do not change; mainly for use of web pages that change frequently or have no publication date. Can be hidden or styled by registered editors.'},
                        {'title':'Via', 'code':'via', 'help':'e.g. [[HighBeam Research]]'},
                        {'title':'Subscription', 'code':'subscription', 'help':'For online sources that require a subscription, set |subscription=yes; supersedes registration if both are set.'},
                        {'title':'Quote', 'code':'quote', 'help':'Relevant text quoted from the source. Displays enclosed in quotes. When supplied, the citation terminator (a period by default) is suppressed, so the quote needs to include terminating punctuation.'},
                        {'title':'First1', 'code':'first1', 'help':'for multiple authors, use last1, first1 through lastn, firstn where n is any consecutive number for an unlimited number of authors (each firstn requires a corresponding lastn). By default, if nine authors are defined, then only eight will show and "et al." will show in place of the last author.'},
                        {'title':'Last1', 'code':'last1', 'help':''},
                        {'title':'First2', 'code':'first2', 'help':''},
                        {'title':'Last2', 'code':'last2', 'help':''},
                ],
        'Infobox Military Conflict' : [ { 'prepend':'{{Infobox Military Conflict', 'append':'}}', 'description':'' },
                {'title':'<strong>Conflict:</strong>', 'code':'conflict', 'help':'the name of the conflict being described (e.g. "Battle of Lützen" or "World War I").'},
                {'title':'<strong>Place:</strong>', 'code':'place', 'help':'the location of the conflict.  For conflicts covering a wide area, a general description (e.g. "[[France]]", or "[[Europe]]", or "Worldwide") may be used.'},
                {'title':'Partof:', 'code':'partof', 'help':'the larger conflict containing the event described in the article.  For battles or campaigns, this should be the war during which the event takes place; for particularly large wars, this may include a theatre (e.g. "the Eastern Front of World War II").  For wars, the parameter may be used to link to a larger group of wars (e.g. the [[Italian War of 1521–26]] to the [[Italian Wars]]).  It may be necessary to insert "the" before the name of the war for proper grammar.'},
                {'title':'Image:', 'code':'image', 'help':'an image for the warbox.  The image must be given in the form [[Image:Example.jpg|300px]]; in particular, the thumb attribute must not be selected.'},
                {'title':'Caption:', 'code':'caption', 'help':'the text to be placed below the image.'},
                {'title':'Date:', 'code':'date', 'help':'the date of the conflict described.  Convention is to give the actual date for battles and the years for wars, but this does not always apply.'},
                {'title':'No-location-property:', 'code':'no-location-property', 'help':'"yes" if the "location" microformat property should not be set on the field above.'},
                {'title':'Coordinates:', 'code':'coordinates', 'help':'the location of the structure, given as a coordinate pair by using {{tl|coord}} with display=inline,title.'},
                {'title':'Status:', 'code':'status', 'help':'for ongoing conflicts, the current status of the conflict.  This should not be used if a final result (above) is provided.'},
                {'title':'Result:', 'code':'result', 'help':'this parameter may use one of several standard terms: "X victory", "Decisive X victory" or "Inconclusive". The choice of term should reflect what the sources say. In cases where the standard terms do not accurately describe the outcome, the preferred method is to enter a link to the section of the article where the result is discussed in detail (such as "See the \'Aftermath\' section").'},
                {'title':'Territory:', 'code':'territory', 'help':'any changes in territorial control as a result of the conflict; this should not be used for overly lengthy descriptions of the peace settlement.'},
                {'title':'Combatant1:', 'code':'combatant1', 'help':'the parties participating in the conflict.  This is most commonly the countries whose forces took part in the conflict; however, larger groups (such as alliances or international organizations) or smaller ones (such as particular units, formations, or groups) may be indicated if doing so improves reader understanding.  When there is a large number of participants, it may be better to list only the three or four major groups on each side of the conflict, and to describe the rest in the body of the article.  The combatant3 field may be used if a conflict has three distinct "sides", and should be left blank on other articles.  Combatants should be listed in order of importance to the conflict, be it in terms of military contribution, political clout, or a recognized chain of command.  If differing metrics can support alternative lists, then ordering is left to the editors of the particular article.'},
                {'title':'Combatant2:', 'code':'combatant2', 'help':''},
                {'title':'Combatant3:', 'code':'combatant3', 'help':''},
                {'title':'Commander1:', 'code':'commander1', 'help':''},
                {'title':'Commander2:', 'code':'commander2', 'help':''},
                {'title':'Commander3:', 'code':'commander3', 'help':'the commanders of the military forces involved.  For battles, this should include army commanders (and other officers as necessary).  For wars, only prominent or notable leaders  should be listed, with an upper limit of about seven per combatant column recommended.  Ranks and position titles should be omitted.  The {{tl|KIA}} and {{tl|POW}} templates may be included immediately after the names of commanders who were killed in action or surrendered and were taken prisoner, respectively.  The commander3 field can only be used if the combatant3 field is set.  '},
                {'title':'Strength1:', 'code':'strength1', 'help':''},
                {'title':'Strength2:', 'code':'strength2', 'help':''},
                {'title':'Strength3:', 'code':'strength3', 'help':'the numerical strength of the units involved.  It is generally not useful to provide unit names without giving an indication of numbers.  The strength3 field can only be used if the combatant3 field is set.'},
                {'title':'Casualties1:', 'code':'casualties1', 'help':''},
                {'title':'Casualties2:', 'code':'casualties2', 'help':'casualties suffered, including dead, wounded, missing, captured, and civilian deaths. Terms such as "dead" (or "killed"), "wounded", or "captured" should be used in place of abbreviations such as "KIA" or "POW". '},
                {'title':'Casualties3:', 'code':'casualties3', 'help':'if combatant3 is set, this is a third casualty field identical to the two above; if it is not set, this is an alternate combined field for use where only the total casualties of a conflict are known, or where civilian casualties cannot be directly attributed to either side.'},
                {'title':'Notes:', 'code':'notes', 'help':'field for further notes; this should only be used in exceptional circumstances.'},
                {'title':'Map_type:', 'code':'map_type', 'help':'the base map to be used for the location map, e.g. "Scotland"; see {{tl|location map}} for more details.'},
                {'title':'Latitude:', 'code':'latitude', 'help':'latitude for placing the marker on the location map, e.g. "56.81".'},
                {'title':'Longitude:', 'code':'longitude', 'help':'longitude for placing the marker on the location map, e.g. "-2.68".'},
                {'title':'Map_size:', 'code':'map_size', 'help':'width of the location map in pixels (px), e.g. "150"; defaults to: "220".  '},
                {'title':'Map_caption:', 'code':'map_caption', 'help':'caption displayed below the location map; defaults to "Location within {{{map_type}}}", e.g. "Location within Scotland".'}
            ],
        'Infobox Person' : [ { 'prepend':'{{Infobox Person', 'append':'}}', 'description':'' },
                {'title':'Name:', 'code':'name', 'help':'Common name of person (defaults to article name if left blank; provide birth_name (below) if different from name).'},
                {'title':'Image:', 'code':'image', 'help':'Image name: abc.jpg, xpz.png, 123.gif, etc. If an image is desired but not available, one may add "yes" to the "needs-photo" section of the Template:WPBiography on the talkpage. Do not use Image:Replace this image male.svg, Image:Replace this image female.svg or other placeholder images; the proposal to use such placeholders has been rejected by the community.'},
                {'title':'Image size:', 'code':'image_size', 'help':'Size to display image: 200px (set width), or 200x300px (max width & max height). This defaults to 225px if empty or omitted.'},
                {'title':'Caption:', 'code':'caption', 'help':'Caption for image, if needed. Try to include date of photo and the photographer.'},
                {'title':'Birth name:', 'code':'birth_name', 'help':'Name at birth, if different from name.'},
                {'title':'Birth date:', 'code':'birth_date', 'help':'Date of birth: {{birth date and age|1930|1|15}} (if living) or {{birth date|1930|1|15}} (if dead). See Template:Birth date for details.'},
                {'title':'Birth place:', 'code':'birth_place', 'help':'Place of birth: city, administrative region, sovereign state.'},
                {'title':'Death date:', 'code':'death_date', 'help':'Date of death: {{death date and age|1995|10|9|1930|1|15}} (if birth date is known) or {{death date|1995|10|9}} (if birth date unknown). See Template:Death date for details.'},
                {'title':'Death place:', 'code':'death_place', 'help':'Place of death: city, administrative region, sovereign state.'},
                {'title':'Death cause:', 'code':'death_cause', 'help':'Place where the body was discovered (If different from place of death).'},
                {'title':'Body discovered:', 'code':'body_discovered', 'help':'Cause of death.'},
                {'title':'Resting place:', 'code':'resting_place', 'help':'Place of burial, ash-scattering, etc.'},
                {'title':'Resting place coordinates:', 'code':'resting_place_coordinates', 'help':'Coordinates for place of burial, ash-scattering etc. Use {{coord}} template.'},
                {'title':'Residence:', 'code':'residence', 'help':'Location(s) where the person notably resides/resided, if different from birth place.'},
                {'title':'Nationality:', 'code':'nationality', 'help':'Nationality. May be used instead of citizenship (below) or vice versa in cases where any confusion could result. Should only be used with citizenship when they somehow differ.'},
                {'title':'Other names:', 'code':'other_names', 'help':'Other notable names for the person, if different from name and birth_name.'},
                {'title':'Ethnicity:', 'code':'ethnicity', 'help':'Ethnicity'},
                {'title':'Citizenship:', 'code':'citizenship', 'help':'Citizenship. See usage notes for nationality.'},
                {'title':'Education:', 'code':'education', 'help':''},
                {'title':'Alma_mater:', 'code':'alma_mater', 'help':'Alma mater'},
                {'title':'Occupation:', 'code':'occupation', 'help':'Occupation'},
                {'title':'Years active:', 'code':'years_active', 'help':''},
                {'title':'Employer:', 'code':'employer', 'help':'Employer'},
                {'title':'Home town:', 'code':'home_town', 'help':'The place where the person was raised and matured, if different from birth place and residence.'},
                {'title':'Salary:', 'code':'salary', 'help':'Annual salary or compensation.'},
                {'title':'Networth:', 'code':'networth', 'help':'Current estimated net worth.'},
                {'title':'Height:', 'code':'height', 'help':'If person was notable for their height.'},
                {'title':'Weight:', 'code':'weight', 'help':'If used, this should also include the date.'},
                {'title':'Known for:', 'code':'known_for', 'help':'A brief description of why the person is notable.'},
                {'title':'Title:', 'code':'title', 'help':'Formal title, such as First Lady of Japan for Akie Abe. Awarded title, such at Mr. Olympia for Arnold Schwarzenegger. Job title, such as President of Calvin College for Anthony Diekema. A combination of the above, such as Professor of Mathematics and Fellow of the Royal Society for Bill Parry'},
                {'title':'Term:', 'code':'term', 'help':'Years the person held the title listed above.'},
                {'title':'Predecessor:', 'code':'predecessor', 'help':'Person who previously held the title listed above.'},
                {'title':'Successor:', 'code':'successor', 'help':'Person who subsequently held the title listed above.'},
                {'title':'Party:', 'code':'party', 'help':'Field labeled Political party.'},
                {'title':'Opponents:', 'code':'opponents', 'help':''},
                {'title':'Boards:', 'code':'boards', 'help':'Field labeled Board member of.'},
                {'title':'Religion:', 'code':'religion', 'help':'Field labeled Religion.'},
                {'title':'Spouse:', 'code':'spouse', 'help':'Name of spouse(s), followed by years of marriage. Use the format Name (1950-present) for current spouse and Name (1970-1999) for former spouse(s). Separate entries with a line break (<br/>).'},
                {'title':'Partner:', 'code':'partner', 'help':'Use same format as spouse.'},
                {'title':'Children:', 'code':'children', 'help':'Number of children (i.e. 3), or list of names if notable. Separate entries with a line break (<br/>).'},
                {'title':'Parents:', 'code':'parents', 'help':'Names of parents, if notable. Separate entries with a line break (<br/>).'},
                {'title':'Relatives:', 'code':'relatives', 'help':'Names of siblings or other relatives, if notable. Include the relationship in parentheses after the name (sister, uncle, etc). Separate entries with a line break (<br/>).'},
                {'title':'Callsign:', 'code':'callsign', 'help':'Amateur radio call-sign.'},
                {'title':'Awards:', 'code':'awards', 'help':'Notable awards'},
                {'title':'Signature:', 'code':'signature', 'help':'An image of the person\'s signature. Image is displayed at a width of 128px, same format as {{Infobox Writer}}, {{Infobox Officeholder}} and {{Infobox Philosopher}}.'},
                {'title':'Website:', 'code':'website', 'help':'Official website only. Unofficial websites should be placed under ==External links== in the body of the article.'},
                {'title':'Footnotes:', 'code':'footnotes', 'help':'Notes about any of the infobox data.'},
                {'title':'Misc:', 'code':'misc', 'help':''},
                {'title':'Box width:', 'code':'box_width', 'help':'The infobox width, such as: box_width=220px (default: 22em). Space character between the number and the unit of measurement breaks the parameter.'}
            ],
        'Infobox Website' : [ { 'prepend':'{{Infobox Website', 'append':'}}', 'description':'' },
                {'title':'Name:', 'code':'name', 'help':'The website\'s most recognised name.'},
                {'title':'Logo:', 'code':'logo', 'help':'The website logo.'},
                {'title':'Screenshot:', 'code':'screenshot', 'help':'A screenshot of the entire homepage'},
                {'title':'Caption:', 'code':'caption', 'help':'Caption saying screenshot of <website> name as of <date>'},
                {'title':'Url:', 'code':'url', 'help':'The most used URL of the website, use Alexa to find the most used URL, e.g. http://www.wikipedia.org/ (required)'},
                {'title':'Alexa:', 'code':'alexa', 'help':'The website\'s current Alexa ranking (find on Alexa.com; make sure to cite Alexa\'s page for this info)'},
                {'title':'Type:', 'code':'type', 'help':'The type of website, search for similar sites for an idea. (required)'},
                {'title':'Language:', 'code':'language', 'help':'The language(s) the website is available in'},
                {'title':'Registration:', 'code':'registration', 'help':'Is there registration, none/optional/required?'},
                {'title':'Owner:', 'code':'owner', 'help':'The current owner, company name/persons name/alias etc (required)'},
                {'title':'Author:', 'code':'author', 'help':'The person or entity that originally created the website (required)'},
                {'title':'Launch date:', 'code':'launch date', 'help':'When the website was launched, consider using the WHOIS data as a last resort if you are unable to determine the launch date.'},
                {'title':'Current status:', 'code':'current status', 'help':'Is the site online/offline/sold etc'},
                {'title':'Revenue:', 'code':'revenue', 'help':'The approximate revenue of the site.'},
                {'title':'Slogan:', 'code':'slogan', 'help':'The slogan of the website, e.g. "the free encyclopedia that anyone can edit."'},
                {'title':'Content license:', 'code':'content license', 'help':'The license of the content of the site.'}
            ],
        'Infobox Book' : [ { 'prepend':'{{Infobox Book', 'append':'}}', 'description':'' },
                {'title':'Infoboxwidth:', 'code':'infoboxwidth', 'help':''},
                {'title':'Name:', 'code':'name', 'help':'Book name. If whole parameter is omitted, inherited from page title.'},
                {'title':'Title orig:', 'code':'title_orig', 'help':'Original title, if not in English'},
                {'title':'Translator:', 'code':'translator', 'help':'Translator(s), if original not in English'},
                {'title':'Image:', 'code':'image', 'help':'Image (prefer 1st edition - where permitted)'},
                {'title':'Image caption:', 'code':'image_caption', 'help':'Image caption (should describe the edition used)'},
                {'title':'<strong>Author:</strong>', 'code':'author', 'help':'Author(s)'},
                {'title':'Illustrator:', 'code':'illustrator', 'help':'Illustrator (where used throughout and a major feature)'},
                {'title':'Cover artist:', 'code':'cover_artist', 'help':'Cover artist'},
                {'title':'Country:', 'code':'country', 'help':'Country of original publication'},
                {'title':'Language:', 'code':'language', 'help':'Language of original book (see note)'},
                {'title':'Series:', 'code':'series', 'help':'Series (if any)'},
                {'title':'Subject:', 'code':'subject', 'help':'Subject or subjects (only use for non-fiction)'},
                {'title':'Genre:', 'code':'genre', 'help':'Genre or genres (only use for fiction)'},
                {'title':'Publisher:', 'code':'publisher', 'help':'Publisher of main publication (prefer 1st edition)'},
                {'title':'Pub date:', 'code':'pub_date', 'help':'Date published (1st edition)'},
                {'title':'English_pub_date:', 'code':'english_pub_date', 'help':'Published in English (1st English edition)'},
                {'title':'Media type:', 'code':'media_type', 'help':'Print / On-line (then binding types etc. if relevant)'},
                {'title':'Pages:', 'code':'pages', 'help':'Pages (prefer 1st edition)'},
                {'title':'Isbn:', 'code':'isbn', 'help':'Format: "ISBN 1234567890" (prefer 1st edition)'},
                {'title':'Oclc:', 'code':'oclc', 'help':'OCLC (prefer 1st edition)'},
                {'title':'Preceded by:', 'code':'preceded_by', 'help':'Title of prior book in series'},
                {'title':'Followed by:', 'code':'followed_by', 'help':'Title of subsequent book in series'}
            ],
        'CompactTOC8' : [ { 'prepend':'{{CompactTOC8', 'append':'}}', 'description':'' },
                {'title':'Name:', 'code':'name', 'help':'change the heading to an alternative name instead of "Contents", or hide it completely by entering "no"'},
                {'title':'Side:', 'code':'side', 'help':'yes: put the "Contents" heading on the left side with a colon, instead of the top without one'},
                {'title':'Right:', 'code':'right', 'help':'yes: align the ToC horizontally to the right of the page (may require <br style="clear:right;" /> after it, depending on page layout), instead of floated left (this parameter is mutually exclusive with the "center" option above, and should be used sparingly and with good reason)'},
                {'title':'Center:', 'code':'center', 'help':'yes: center to ToC in the horizontal middle of the page, instead of floated left'},
                {'title':'Align:', 'code':'align', 'help':'sets the alignment of the links inside the table; default is left; use center, right or left'},
                {'title':'Nobreak:', 'code':'nobreak', 'help':'yes: no linebreak between the A-B-C-etc. stuff and the See also/References/etc. stuff (note: does not affect the heading; use side= for that)'},
                {'title':'Top:', 'code':'top', 'help':'yes: enable the "Top" link; this is only useful if this copy of the ToC is a secondary ToC not at the top of the page, e.g. in the middle of a long glossary. (Every rendered page has a hidden <a name="top" id="top"></a> above the sitenotice which makes this link work without having to do anything but enable it in the template.)'},
                {'title':'Sym:', 'code':'sym', 'help':'yes: enable the "!$@" link for symbolic entries section'},
                {'title':'Num:', 'code':'num', 'help':'yes: enable the "0–9" link for numeric entries section (create a heading of ==0&ndash;9== for the link to work)'},
                {'title':'Symnum:', 'code':'symnum', 'help':'yes: enable the "!–9" link for combined symbolic and numeric entries section (create a heading of ==!&ndash;9== for the link to work)'},
                {'title':'Sep:', 'code':'sep', 'help':'set the separator-text between word-headers (not between "ABCDEF") to "·"; could also be a vertical-bar or &bull; (•), etc.'},
                {'title':'Pre1:', 'code':'pre1', 'help':'list up to 8 extra section headers before (pre-list) the "ABCDEF" list. These appear as [[#pre1|pre1]].'},
                {'title':'Pre1link:', 'code':'pre1link', 'help':'modifies the targets of the pre-list headers: [[pre1link|pre1]].'},
                {'title':'Pre1name:', 'code':'pre1name', 'help':'modifies the way the pre-list section headers appear: [[#pre1|pre1name]]'},
                {'title':'Prebreak:', 'code':'prebreak', 'help':'<br>: set break-line after all pre-list headers; can include text to introduce "ABCDEF".'},
                {'title':'Custom1:', 'code':'custom1', 'help':'add up to 8 extra "custom" sections after the "ABCDEF" list. These appear as [[#custom1|custom1]].'},
                {'title':'Custom1link:', 'code':'custom1link', 'help':'modifies the targets of the custom sections: [[custom1link|custom1]]. Use this only for linking to another page. Use sparingly! About the only legitimate use for this is connecting the sub-pages of multi-page articles, like long lists that have been broken up. Do not repurpose the ToC as a makeshift navbox.'},
                {'title':'Custom1name:', 'code':'custom1name', 'help':'modifies the way the custom section headers appear: [[#custom1|custom1name]]'},
                {'title':'Seealso:', 'code':'seealso', 'help':'yes: enable link to the "See also" section'},
                {'title':'Notesfirst:', 'code':'notesfirst', 'help':'yes: enable link to the "Notes" section, but placed before "References"; do not use with notes (and do observe that it is plural)'},
                {'title':'Refs:', 'code':'refs', 'help':'yes: enable link to the "References" section (observe that it is plural)'},
                {'title':'Notes:', 'code':'notes', 'help':'yes: enable link to the "Notes" section (observe that it is plural)'},
                {'title':'Extlinks:', 'code':'extlinks', 'help':'enable link to the "External links" section'}
            ]
    };
}

if (smConfig['smCustomForms'] != 'undefined') {
	for (key in smConfig['smCustomForms']) {
		smConfig['smForms'][key] = smConfig['smCustomForms'][key];
	}
}

window.smRibbon = new Ribbon('smRibbon',{
	"Rows":"2",
	"defaultItemImage":"//upload.wikimedia.org/wikipedia/commons/thumb/5/5a/Button_Icon_BlueSky.svg/10px-Button_Icon_BlueSky.svg.png",
	"MainClass":"HStrip",
	"GroupClass":"HStripB",
	"LeftClass":"HStripL",
	"CenterClass":"HStripP",
	"CenterImageClass":"HStripPC",
	"RightClass":"HStripR",
	"SingleClass":"HStripLR",
	"SelectedClass":"selected",
	"HoverClass":"hover",
	"ItemHoverClass":"hover",
	"GapClass":"HStripS",
	"MenuBarClass":"HMenuParent",
	"MenuClass":"HMenuItem",
	"onItem":"'smExecuteCode(\\'' + item.code + '\\',\\'' + item.value + '\\')'",
	"Menu":[
		{
			"Name":"References",
			"Groups":["Citations","References"],
			"show":"", "onShow":"", "onHide":"", "Default":"false"
		},
        {
            "Name":"Cleanup",
            "Groups":["Cleanup","Intro","Style"],
            "show":"", "onShow":"", "onHide":""
        },
        {
            "Name":"Infoboxes",
            "Groups":["Common"],
            "show":"", "onShow":"", "onHide":""
        },
        {
            "Name":"Lists",
            "Groups":["TOC"],
            "show":"", "onShow":"", "onHide":""
        }
		],
	"Groups":
		{
			"Citations": 
			{
				"Name":"Citations",
				"onClick":"",
				"Tabs": 
					[
						{
							"Image":"//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/35px-Question_book-new.svg.png",
							"Items":["Web","Book","News","Journal","Video","Press release", "DOI Bot"],
                            "ItemCodes":["Cite web","citebook","citenews","citejournal","Cite video","Cite press release", "doicite"]
						}
					]
			},
            "References":
            {
                "Name":"References",
                "onClick":"",
                "Tabs": [
                    {
                        "Items":["No refs","More refs","No notes","More notes","Cite check","Prim sources","Notability","One source"],
                        "ItemCodes":["unreferenced","Refimprove","No footnotes","More footnotes","citecheck","Primarysources","Notability","One source"]
                    }
                ]
            },
			"Cleanup": 
			{
				"Name":"Cleanup",
				"onClick":"",
				"Tabs": 
					[
						{
                            "Image":"//upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Broom_icon.svg/35px-Broom_icon.svg.png",
							"Items":["Cleanup","Copy Edit"],
                            "ItemCodes":["cleanup","copyedit"]
						}
					]
			},
			"Intro": 
			{
				"Name":"Intro",
				"onClick":"",
				"Tabs": 
					[
						{
							"Items":["Too long","Too short","Rewrite","Missing"],
                            "ItemCodes":["intro-toolong","intro-tooshort","intro-rewrite","intro-missing"]
						}
					]
			},
            "Style":{
                "Name":"Style",
                "Tabs":[{
                        "Items":["Review","Advert","Howto","Plot","Crystal"],
                        "ItemCodes":["Review","Advert","Howto","Plot","Crystal"]
                }]
            },
            "Common":{
                "Name":"Common",
                "Tabs":[{
                    "Items":["Military Conflict", "Person", "Website", "Book"],
                    "ItemCodes":["Infobox Military Conflict", "Infobox Person", "Infobox Website", "Infobox Book"]
                }]
            },
            "TOC":{
                "Name":"TOC",
                "Tabs":[{
                    "Items":["CompactTOC8"],
                    "ItemCodes":["CompactTOC8"]
                }]
            }
		}
},'');

// Taken from [[User:Mr.Z-man/refToolbar.js]]
// All credit for this function goes to him
/*window.smGetTime = function() {
    var time = new Date();
    var nowdate = time.getUTCDate();
    if (nowdate<10) { nowdate = "0"+ nowdate.toString(); }
    var nowmonth = time.getUTCMonth()+1;
    if (nowmonth<10) { nowmonth = "0"+ nowmonth.toString(); }
    var nowyear = time.getUTCFullYear();
    newtime =  nowyear + '-' + nowmonth + '-' + nowdate;
    return (newtime);
}*/

// Gets the current time in the format Sep 7, 2014
window.smGetTime = (function() {
    var m = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
    return function() {
        var t = new Date();
        return m[t.getUTCMonth()] + " " + t.getUTCDate() + ", " + t.getUTCFullYear();
    }
})();

window.smVisibleMenu = 0;

// Creates SnipManager's menu on the page
function createMenu() {
  // support wikiEd if it is installed
  var toolbar = document.getElementById('toolbar');
  if (!toolbar) {
	var toolbar = document.getElementById('wikiEditor-ui-toolbar');
  }
  if (toolbar) {
    // All output is added to the sm_panel div
    var sm_panel = document.createElement('div');
    sm_panel.id = 'snipmanager-panel';
    //toolbar.insertBefore(sm_panel, toolbar.childNodes[0]); // alt. insertion
    toolbar.appendChild(sm_panel); // added to the bottom of toolbar
    
	// the actual ribbon bar is constructed
    var ribbonStrip = document.createElement('div');
    ribbonStrip.className = 'HStrip';
    var ribbonMenu = document.createElement('div');
    ribbonMenu.className = 'HMenu';
	
	//a place to display forms to the user
	window.smFormPanel = document.createElement('div');
    smFormPanel.id = 'snipmanager-form-panel';
	smFormPanel.style.clear = 'both';
    
	// All these items are added to sm_panel
    sm_panel.appendChild(ribbonMenu);
    sm_panel.appendChild(ribbonStrip);
    sm_panel.appendChild(smFormPanel);    
    
    window.smRibbon.configuration.Menu[0].Default='true';
    window.smRibbon.Initialize(ribbonStrip,ribbonMenu);
    window.smRibbon.state = 'load';
    window.smRibbon.Render();
  }
}

// closes the form that calls it (called from the Close Form button)
window.smCloseForm = function(sender) {
    var formFieldSet = sender;
    while (formFieldSet.className != 'smForm')
        formFieldSet = formFieldSet.parentNode;
    formFieldSet.parentNode.removeChild(formFieldSet);
}

function smCompileTemplate(formFieldSet) {
    var templTable = formFieldSet.getElementsByTagName('table')[0];
    var inputs = templTable.getElementsByTagName('input');

    var formName = formFieldSet.formName;
    var form = smConfig['smForms'][formName];

    var insertText = new Array(form[0]['prepend']);
    for (var i in inputs) {
        var inp = inputs[i];
        if (inp.value && inp.value.length > 0) {
            if (inp.className == "%ref") {
                insertText[0] = insertText[0].replace(/<ref>/, '<ref name="' +
                                                      inp.value + '">');
                continue;
            }
            insertText.push('|' + inp.className + '=' + inp.value);
        }
    }
    insertText.push(form[0]['append']);
    return insertText.join('');
}

// Called whenever SnipManager needs to insert text into the edit area
function smInsertTags(insert_text) {
    insertTags(insert_text, '', '');
}

// Adds the template to the edit box using smInsertTags
// Called from the Add Template button on the form
window.smAddTemplate = function(sender) {
    var formFieldSet = sender;
    while (formFieldSet.className != 'smForm')
        formFieldSet = formFieldSet.parentNode;

    var insert_text = smCompileTemplate(formFieldSet);
    smInsertTags(insert_text);
}

// compiles a template and displays an html preview
// called from the preview button on a form
window.smPreviewTemplate = function(sender) {
    var formFieldSet = sender;
    while (formFieldSet.className != 'smForm')
        formFieldSet = formFieldSet.parentNode;
    var formDivs = formFieldSet.getElementsByTagName('div');
    var previewDiv;
    for (var i = 0; i < formDivs.length; i++) {
        if (formDivs[i].className == 'formPreview') {
            previewDiv = formDivs[i];
            break;
        }
    }
    if (!previewDiv) {
        alert('No preview div found');
        return;
    }
    var templateCode = smCompileTemplate(formFieldSet);
    if (templateCode.indexOf('</ref>') != -1)
        templateCode = templateCode.replace(/<\/?ref.*?>/g, '');
    smWikiPreview(templateCode, function(content) {
                      previewDiv.innerHTML = content; });
}

// Replaces %s tokens in a string with replacements
function sprintf(haystack, replacements) {
    for (var i = 1; i < replacements.length; i++) {
        var sub = eval(replacements[i]);
        haystack = haystack.replace('%s', sub);
    }
    return haystack;
}

// Called by the Ribbon when a Ribbon button is clicked.
// code refers to a form or function
// name is the name of the form displayed at the top of the form
window.smExecuteCode = function(code, name) {
    var form = smConfig['smForms'][code];
    if (!form || !form['length'] || form['length'] < 1) {
        return;
    }
    if (form[0]['inserttext']) {
        smInsertTags(form[0]['inserttext'], '', '');
    } else if (form[0]['inserteval']) {
        var text = sprintf(form[0]['inserteval'][0], form[0]['inserteval']);
        smInsertTags(text, '', '');
    } else if (form[0]['httplink']) {
        window.open(form[0]['httplink']);
    // httpeval is used to open websites with dynamically generated urls
    } else if (form[0]['httpeval']) {
        var url = sprintf(form[0]['httpeval'][0], form[0]['httpeval']);
        window.open(url);
    } else if (form[0]['evaluate']) {
        eval(form[0]['evaluate']);
    } else {
        smShowForm(code, name);
    }
}

// Display a template form in the div
window.smShowForm = function(formName, title) {
    // If the smSingleForm option is set, close all previously open forms
    if (smConfig['smSingleForm']) {
        for (var i = 0; i < smFormPanel.childNodes.length; i++) {
            smFormPanel.removeChild(smFormPanel.childNodes[i]);
        }
    }

    // Creates a fieldset and adds it to the form panel
    var form = smConfig['smForms'][formName];
    var formFields = smGetFormFields(form);

    var fieldSet = document.createElement('fieldset');
    fieldSet.formName = formName;
    smFormPanel.appendChild(fieldSet);
    var legend = document.createElement('legend');
    fieldSet.appendChild(legend);
    fieldSet.className = 'smForm'; //class is used to find the fieldset by
                                   // crawling up from a button node
    legend.innerHTML = '<a href="'+smConfig['smTemplateurl']+formName+'" target="_blank">'+title+'</a>';

    if (typeof(form[0]['description']) != 'undefined') {
        var formDesc = document.createElement('div');
        formDesc.innerHTML = form[0]['description'];
        fieldSet.appendChild(formDesc);
    }

    // Creates the table for all the text fields
    var table = document.createElement('table');
    table.cellspacing = 5;
    fieldSet.appendChild(table);

    var maxcols = smConfig['smColumns'];

    var col = 99;
    var currentTr = 0;

    // loop creates the table cells going from left to right maxcols
    // and then top to bottom
    for (var i = 0; i < formFields.length; i++) {
        if (col++ >= maxcols) {
            col = 1;
            currentTr = document.createElement('tr');
            table.appendChild(currentTr);
        }
        var td1 = document.createElement('td');
        td1.innerHTML = formFields[i]['title'];

        var td2 = document.createElement('td');
        var textField;
        if (formFields[i]['code']) {
            textField = createTextField(formFields[i]['code']);
        } else {
            textField = createTextField('ERROR: ' + formFields[i]['title'] + ' has no code field');
            continue;
        }
        // Allows for default values or functions to be passed and their
        // return value becomes the default value for the form field
        if (formFields[i]['defeval']) {
            textField.value = eval(formFields[i]['defeval']);
        } else if (formFields[i]['default']) {
            textField.value = formFields[i]['default'];
        }
        textField.title = formFields[i]['help'];
        td2.appendChild(textField);
        
        // each field has two TDs: one for the title and one for the text field
        currentTr.appendChild(td1);
        currentTr.appendChild(td2);
    }
    
    // buttons are added to the bottom of the fieldset as a table
    var buttonTable = document.createElement('table');
    buttonTable.style.width = "100%";
    fieldSet.appendChild(buttonTable);
    var buttonRow = document.createElement('tr');
    buttonTable.appendChild(buttonRow);

    var addTemplateButton = addOption("smAddTemplate(this)", "Add Template");
    buttonRow.appendChild(document.createElement('td').appendChild(addTemplateButton));

    var previewTemplateButton = addOption("smPreviewTemplate(this)", "Preview Template");
    buttonRow.appendChild(document.createElement('td').appendChild(previewTemplateButton));

    var closeButton = addOption("smCloseForm(this)", "Close Form");
    buttonRow.appendChild(document.createElement('td').appendChild(closeButton));

    var previewPanel = document.createElement('div');
    previewPanel.className = 'formPreview';
    fieldSet.appendChild(previewPanel);
}

// Takes a form template and
// returns an array of the fields which have values filled
// Called when showing a form
function smGetFormFields(form) {
    var formFields = new Array();
    for (var i in form) {
        if (!form[i]['title'] || !form[i]['code']) continue;
        formFields.push(form[i]);
    }
    return formFields;
}

// Creates a text field for display on the form
// Called while showing a form
function createTextField(id) {
	var inp = document.createElement('input');
	inp.type = 'text';
	inp.className = id;
	inp.tabIndex = 1;
	inp.style.width = smConfig['smTextWidth'];
	return inp;
}

// Creates a button for display on the form
// Called when showing a form
function addOption(script, text) {
    option = document.createElement('input');
    option.setAttribute('type', 'button');
    option.setAttribute('onclick', script);
    option.setAttribute('value', text);
    option.setAttribute('tabIndex', 1);
    return option;
}

// Simple wrapper function for wiki markup preview
// give it the markup and a function(content)
// and it will call the function with the returned preview's HTML content
// Note this function uses wgPageName and sajax_init_object, so must be called
//    from within the page's JS scope
window.smWikiPreview = function(wiki_markup, func) {
    var form = document.editform;
    var addr = mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + mw.config.get('wgPageName') +
               "&action=submit&wpPreview=true&live=true";
    var qwxmlhttp = sajax_init_object(null);
    qwxmlhttp.overrideMimeType('text/xml');
    qwxmlhttp.open('POST', addr, true);
    var boundary = '--(fR*3briuStOum6#v)--';
    qwxmlhttp.setRequestHeader('Content-type','multipart/form-data; boundary=' +
                               boundary);
    qwxmlhttp.onload = function(event) {
        var content = unescape(qwxmlhttp.responseText.replace(
                               /&gt;/g,">").replace(/&lt;/g,"<").replace(
                               /&amp;/g,"&").replace(/&quot;/g,'"'));
        var match = /<hr \/><\/div>([\w\W\n]*)<\/preview>/.exec(content);
        func(match[1]);
    };
    var postData = '--' + boundary +
                   '\nContent-Disposition: form-data; name="wpTextbox1"\n\n' +
                   wiki_markup + '\n--' + boundary;
    qwxmlhttp.send(postData);
}

// The following code is from http://code.google.com/p/jribbon/
// It is listed as GNU GPL, both on the Google Code page and on
// the author's website at http://www.openwebstudio.com/
// WebCite archive: http://www.webcitation.org/5gpjSnfj8
function Ribbon(callerobj,Config) {
	this.configuration = Config;
	this.caller = callerobj;
	this.target = null;
	this.menutarget = null;
	this.selected = null;
	this.state=null;
	this.Editors = new Array();
	
	function RibbonEditor(editor,helper)
	{
		this.cEditor = editor;
		this.cHelper = helper;
		this.RibbonTab = false;
		this.RibbonMenu = false;
	}
	
	this.Initialize = function (target,menutarget,editorIndex)
	{
		this.target = target;
		this.menutarget = menutarget;
		if (this.selected==null&&this.configuration.Menu!=undefined)
		{
			for (var i=0;i<this.configuration.Menu.length;i++)
			{
				if (this.configuration.Menu[i].Default != undefined && this.configuration.Menu[i].Default.toUpperCase() == 'TRUE')
				{
					this.selected = this.configuration.Menu[i];
					i = this.configuration.Menu.length+1;
				}
			}
		}
		this.Render(editorIndex);
	}
	this.Regenerate = function(txtobj) {
		this.Render(txtobj.EditorIndex);
	}
	this.Toggle = function(groupname,txtobj) {
		var canLoad = true;
		if (typeof this.Editors[groupname] != 'undefined')
		{
			if (txtobj.id == this.Editors[groupname].cEditor.id)
			{
				canLoad = false;
			}
			else
				this.Remove(this.Editors[groupname].cEditor);
		}
		if (canLoad) this.Editors[groupname]=this.Generate(txtobj);
	}
	this.Remove = function(txtobj) {
			if (typeof txtobj.EditorIndex != 'undefined' && txtobj.EditorIndex != null)
			{
				var rEditor = this.Editors[txtobj.EditorIndex];
				this.Editors[txtobj.EditorIndex]=null;
				txtobj.EditorIndex = null;
				txtobj.onkeydown=false;
				txtobj.setAttribute('isLoaded','false');
				txtobj.parentNode.removeChild(rEditor.RibbonTab);
				txtobj.parentNode.removeChild(rEditor.RibbonMenu);
				rEditor.RibbonTab = false;
				rEditor.RibbonMenu = false;
			}
	}
	this.Generate = function(txtobj) {
		var randomnumber=Math.floor(Math.random()*32767)
		//this.HelpTabID='RibbonHelp' + randomnumber;
		
		var editorIndex = 0;
		
		var rEditor = new RibbonEditor(txtobj,'RibbonHelp' + randomnumber);
		this.Editors.push(rEditor);
		editorIndex=this.Editors.length-1;
		txtobj.EditorIndex = editorIndex;
				
		var override=true;
		var rtext = true;
		var isLoadedObj = txtobj.getAttribute('isLoaded');
		if (typeof isLoadedObj=='undefined' || isLoadedObj==null)
			isLoadedObj = false;
		else
			if (isLoadedObj =='false')
				isLoaded=false;
			else
				isLoaded=true;
			
		if(isLoadedObj==true)
			rtext=false;
			
		if(rtext){
			txtobj.setAttribute('isLoaded','true');
			var dv=document.createElement('div');
			dv.className=this.configuration.MainClass;

			txtobj.parentNode.insertBefore(dv,txtobj);
			var dvm = document.createElement('div');
			
			this.Initialize(dv,dvm,editorIndex);
			
			txtobj.parentNode.insertBefore(dvm,dv);		
			
			rEditor.RibbonTab = dv;
			rEditor.RibbonMenu = dvm;
		}
		return rEditor;
	}
	this.onItemClick = function (input,group,tab,item)
	{
		if (!isNaN(input))
		input = this.Editors[input].Editor();
		
		tab = eval('this.configuration.Groups.' + group + '.Tabs[' + tab + ']');
		if (tab!=undefined && tab!=null)
		{
			item = tab.ItemEditor[item];
		}
		return false;
	}
	var txtClip = '';
	var txtPasteItem = null;
	this.onMenu = function (menuindex,editorIndex)
	{
		if (this.configuration.Menu!=undefined&&this.configuration.Menu.length > menuindex)
		{
			this.selected = this.configuration.Menu[menuindex];
			if (this.selected.onShow!=undefined && this.selected.onShow.length>0)
			{
				eval(this.selected.onShow);
			}
		}	
		this.Render(editorIndex);
	}
	this.onMenuHover = function (o)
	{
		o.xclassName = o.className;
		if (o.className!=this.configuration.SelectedClass)
			o.className= this.configuration.HoverClass;
	}
	this.onMenuBlur = function (o)
	{
	 o.className=o.xclassName;
	}	
	this.onItemHover = function (o,group,iindex,tindex,editorIndex)
	{
		o.xclassName = o.className;
		o.className=this.configuration.ItemHoverClass;
		if (group!=undefined && group!=null)
		{
			var helptxt = eval('this.configuration.Groups.' + group + '.Tabs[' + tindex + '].ItemHelp[' + iindex + ']');
			if (helptxt!=null && this.Editors[editorIndex]!=null && typeof this.Editors[editorIndex].Helper != 'undefined' && this.Editors[editorIndex].Helper !=null && this.Editors[editorIndex].Helper() != null)
				this.Editors[editorIndex].Helper().innerHTML = helptxt;
		}
	}
	this.onItemBlur = function (o,group,iindex,tindex)
	{
		o.className=o.xclassName;
	}
	this.Render = function (editorIndex)
	{
		arr = new Array();
		if (this.menutarget!=null && this.configuration!=null)
		{
			if (this.configuration.Menu!=null && this.configuration.Menu.length > 0)
				this.renderMenu(arr,editorIndex);
			this.menutarget.innerHTML = arr.join('');
		}
		arr = new Array();
		if (this.target!=null  && this.configuration!=null && this.selected!=null)
		{
			var groups = this.selected.Groups;
			arr.push('<table cellpadding=0 cellspacing=0>');
			if (groups!=null && groups.length > 0)
			{
				arr.push('<TR>');			
				for (var i=0;i<groups.length;i++)
				{
					//RENDER GROUP 
					var group = false;
					eval('group=this.configuration.Groups.' + groups[i]);
					this.renderGroup(this.configuration.Rows,group,arr,editorIndex);
					if (i<groups.length-1)
					{
						arr.push('<TD class="' + this.configuration.GapClass + '"></TD>');
					}
				}
				arr.push('</TR>');							
				arr.push('<TR>');			
				for (var i=0;i<groups.length;i++)
				{
					//RENDER FOOTER
					this.renderGroupFooter(this.configuration.Rows,eval('this.configuration.Groups.' + groups[i]),arr,editorIndex);
					if (i<groups.length-1)
					{
						arr.push('<TD class="' + this.configuration.GapClass + '"></TD>');
					}
				}
				arr.push('</TR>');							
			}
			arr.push('</table>');	
			this.target.innerHTML = arr.join('');
		}
	}
	this.renderGroupFooter = function (rows,group,arr,editorIndex)
	{
		colspan = 0;
		if (group.Tabs != null && group.Tabs.length > 0)
		{
			for (var tti = 0; tti < group.Tabs.length; tti++)
			{
				tabcolumns = 0;
				itemcounter = 0;			
				if (group.Tabs[tti].Columns!=undefined)
					tabcolumns=1;
				else
				{
					if (group.Tabs[tti].Image!=undefined && group.Tabs[tti].Image.length > 0)
					{	itemcounter++;itemcounter++; }
					if (group.Tabs[tti].ImageMap!=undefined && group.Tabs[tti].ImageMap.length > 0)
						itemcounter++;
					if (group.Tabs[tti].Items!=undefined)
						itemcounter = itemcounter + group.Tabs[tti].Items.length;
					tabcolumns = parseInt(itemcounter / rows);
					if (itemcounter / rows > tabcolumns)
						tabcolumns++;				
				}
				colspan = colspan + tabcolumns;
			}
		}		
		if (colspan > 0)
		{
			arr.push('<td class="' + this.configuration.GroupClass + '" colspan=' + colspan + '>' + group.Name + '</td>');
		}
	}
	this.renderMenu = function (arr,editorIndex)
	{
		if (this.configuration.Menu != null && this.configuration.Menu.length > 0)
		{
			arr.push('<div class="' + this.configuration.MenuBarClass + '">');
			for (var mnuI = 0; mnuI < this.configuration.Menu.length; mnuI++)
			{
				if (this.state!=null && this.configuration.Menu[mnuI].show==this.state || this.configuration.Menu[mnuI].show=='')
					this.renderMenuItem(this.configuration.Menu[mnuI],mnuI,arr,editorIndex);
			}
			arr.push('</div>');
		}	
	}
	this.renderMenuItem = function (group,index,arr,editorIndex)
	{
		arr.push('<div ' + (this.selected!=null&&group.Name==this.selected.Name?'class="' + this.configuration.SelectedClass+'"':'class=' + this.configuration.MenuClass + '"') + ' onclick="' + this.caller + '.onMenu(' + index + ',' + (editorIndex==null?'null':editorIndex)  + ');" onmouseover="' + this.caller + '.onMenuHover(this);" onmouseout="' + this.caller + '.onMenuBlur(this);">' + group.Name + '</div>');
	}
	this.renderGroup = function (rows,group,arr,editorIndex)
	{
		if (group.Tabs != null && group.Tabs.length > 0)
		{
			for (var tabI = 0; tabI < group.Tabs.length; tabI++)
			{
				group.Tabs[tabI].Index=tabI;
				this.renderTab(rows,group,group.Tabs[tabI],(tabI==0?true:false),(tabI==group.Tabs.length-1?true:false),arr,editorIndex,tabI);
			}
		}
	}
	this.renderTab = function (rows,group,tab,firsttab,lasttab,arr,editorIndex)
	{
		var thisEditorIndex = -1;
		var classname = '';
		var isLastTab = lasttab;
		var crow = 0;
		if (tab.Image!=undefined && tab.Image.length > 0)
		{ crow+=2; 
		  if (tab.ImageMap!=undefined && tab.ImageMap.length > 0)
			crow++;	
		}
		if ((tab.Columns==undefined && rows-crow < (tab.Items!=undefined?tab.Items.length:0)) || tab.Columns!=undefined && rows-crow < tab.Columns )
		{
			lasttab=false;
		}	
		crow = 0;
		if (editorIndex!=undefined)
			thisEditorIndex = editorIndex;	
		
		if (lasttab && firsttab)
			classname = this.configuration.SingleClass;
		else if (lasttab)
			classname = this.configuration.RightClass;
		else if (firsttab)
			classname = this.configuration.LeftClass;
		else
			classname = this.configuration.CenterClass;
		if (tab.Items==undefined || tab.Items.length == 0)
			classname = this.configuration.CenterImageClass;
			
		var tdc = '<div>';
		var tde = '</div>';
		var tc = 'div';
		if (tab!=null)
		{
			var style = '';
			if (tab.Style!=undefined)
				style = ' style="' + tab.Style + '" ';
				
			if (tab.Image!=undefined && tab.Image.length > 0)
			{
				arr.push('<td class="' + classname + '"' + style + '>' + tdc);
				crow = crow + 2;
				if (tab.ImageMap!=undefined && tab.ImageMap.length > 0)
				{
					arr.push('<img src="' + tab.Image + '" border=0 useMap="' + tab.ImageMap + '">');
					crow++;
				}
				else
				{
					arr.push('<img src="' + tab.Image + '">');
				}
				if (crow == rows)
				{ arr.push(tde + '</td>'); crow = 0; }
			}
			else
			{
				//tdc = '<UL>';
				//tde = '</UL>';
				//tc = 'li';
			}

			if (tab.Columns!=undefined)
			{
				arr.push('<td class="' + classname + '"' + style + '>');
				if (tab.Help==undefined || tab.Help.toUpperCase()!='TRUE')
				{
					arr.push('<div class="' + tab.ColumnClass + '">');
					arr.push('<table width=100% border=0 cellpadding=0 cellspacing=0>');
				}
				else
				{
					if (editorIndex!=undefined)
					{
						var chelper=this.Editors[editorIndex].cHelper;

						arr.push('<div class="' + tab.ColumnClass + '" id="' + chelper + '">');
						arr.push(tab.DefaultHelp);
					}
				}
			}
			if (tab.Items!=undefined && tab.Items.length > 0)
			{
				for (var ti = 0;tab.Items!=undefined && ti < tab.Items.length; ti++)
				{
					lasttab=false;
					if (tab.Columns==undefined && isLastTab && rows-crow > tab.Items.length-ti-1)
						lasttab=true;
					if (lasttab && firsttab)
						classname = this.configuration.SingleClass;
					else if (lasttab)
						classname = this.configuration.RightClass;
					else if (firsttab && tab.Columns==undefined)
						classname = this.configuration.LeftClass;
					else
						classname = this.configuration.CenterClass;
						
					if (tab.Columns!=undefined)
					{
						if (crow==0)
						{arr.push('<tr>');}
						if (crow >=0)
						{arr.push('<td class="' + classname + '">' + tdc); }
						classname = this.configuration.CenterClass;
					}
					else
					{
						if (crow==0)
						{arr.push('<td class="' + classname + '"' + style + '>' + tdc); }
					}
						
					var item = new function() {
                        this.value = tab.Items[ti];
                        this.code = tab.ItemCodes[ti];
                    }
					var onclick = '';
					var onclickparameters = '()';
					
					if (tab.onclick==undefined||tab.onclick==null||tab.onclick.length==0)
					{
						if (this.configuration.onItem!=undefined && this.configuration.onItem!=null)
						{
							onclick= eval(this.configuration.onItem);
							onclickparameters =	'(' + thisEditorIndex + ')';
						}
					}
					else
					{
						onclick=  eval(tab.onclick);
						onclickparameters = '(' + thisEditorIndex + ')';
					}
					//onclick = onclick.replace(' ','_').replace('-','_').replace('\'','_');
					
					if (editorIndex!=undefined && tab.ItemEditor!=undefined && tab.ItemEditor!=null && tab.ItemEditor.length == tab.Items.length)
					{
						if (tab.ItemEditor[ti]!=null && (tab.ItemEditor[ti].length != undefined || tab.ItemEditor[ti].Text != undefined))
						{
							onclick = this.caller + '.onItemClick';
							onclickparameters = '(' + editorIndex + ',\'' + group.Abbr + '\',' + tab.Index + ',' + ti + ')';
						}
					}
					/*else
					{
						if (eval('!window.' + onclick) && this.configuration.debug!=undefined)
							alert('The Ribbon control requires a definition for function: ' + onclick);
					}*/

					var image = null;
					if (this.configuration.defaultItemImage!=undefined)
						image = this.configuration.defaultItemImage;
					if (tab.ItemImages!=undefined && tab.ItemImages[ti].length > 0)
						image = tab.ItemImages[ti];
                    
                    onclickparameters = '';
					if (tab.ItemHelp==undefined)
						arr.push('<' + tc + ' onclick="' + onclick + onclickparameters + '" onmouseover="' + this.caller + '.onItemHover(this);" onmouseout="' + this.caller + '.onItemBlur(this);">' + (image!=null?'<img src=' + image + '>':'') + tab.Items[ti] + '</' + tc + '>');	
					else
						arr.push('<' + tc + ' onclick="' + onclick + onclickparameters + '" onmouseover="' + this.caller + '.onItemHover(this,\'' + group.Abbr + '\',' + ti + ',' + tab.Index + ',' + thisEditorIndex + ');" onmouseout="' + this.caller + '.onItemBlur(this,\'' + group.Name + '\',' + ti + ',' + tab.Index + ');">' + (image!=null?'<img src=' + image + '>':'') + tab.Items[ti] + '</' + tc + '>');	
					crow++;
					if (tab.Columns!=undefined)
					{ arr.push(tde + '</td>'); }
					
					if (crow == rows && tab.Columns==undefined)
					{ arr.push(tde + '</td>'); crow = 0; firsttab=false;}
					else if (tab.Columns!=undefined && crow==tab.Columns)
					{ arr.push('</tr>'); crow = 0; firsttab=false; }
				}
			}
			if (crow!=0 && tab.Columns==undefined)
				arr.push(tde + '</td>');
			else if (tab.Columns!=undefined)
			{	
				if (tab.Help==undefined || tab.Help.toUpperCase()!='TRUE')
				{
					var bcrow = false;
					while (crow != tab.Columns && crow > 0)
					{
						bcrow=true;
						arr.push('<td>&nbsp;</td>');
						crow++;
					}
					if (bcrow)
						arr.push('</tr>');
					arr.push('</table>');
				}
				arr.push('</div>');
				arr.push('</td>');
			}
		}
	}
}

mw.util.addCSS('div#snipmanager-panel{}\
div.HMenuParent{clear:both;font-size:8pt;width:100%;height:25px;border-bottom:1px solid #eee;}\
div.HMenuParent div{float:left;padding-top:4px;margin:3px 3px -3px 3px;text-align:center;width:94px;height:18px}\
div.HMenuParent div.selected{padding-top:3px;margin:3px 2px -3px 2px;background-color:#c3d6e1;border:1px solid black;border-bottom:0} /*the selected tab*/\
div.HMenuParent div.hover{padding-top:3px;margin:3px 2px -3px 2px;border:1px dashed black;border-bottom:0;background-color:#eee} /*hovering on a tab*/\
div.HStrip table tr td div{text-align:center}div.HStrip table tr td{vertical-align:middle}\
div.HStrip table tr td.HStripPC{vertical-align:middle}\
div.HStrip table tr td div div{height:18px;text-align:left;margin-bottom:1px;padding-left:5px;padding-right:8px;white-space:nowrap}\
div.HStrip table tr td div div img{margin-right:4px}\
div.HStrip table tr td div div.hover{text-decoration:underline;cursor:pointer;}/*hover on button*/\
div.HStrip {clear:both;border-top:0;margin-bottom:1px}\
div.HStrip table{background:#fafafa; margin:2px 0 2px 2px} /*just button area*/\
td.HStripS{width:2px}\
td.HStripP{padding:0 15px 0 5px;margin:0}\
td.HStripPC{padding:0 0 0 5px;margin:0}\
td.HStripLR{border-right:1px solid #c3d6e1;padding-left:5px;margin-left:8px}\
td.HStripL{ border-left:1px solid #c3d6e1;padding:0 5px 0 5px;margin:0}\
td.HStripR{border-right:1px solid #c3d6e1;padding:0 0 0 5px;margin:0}\
td.HStripB{font-size:0.8em; background:#c3d6e1;border-top:1px solid #c3d6e1;text-align:center;color:black}\
.HStripE td.HStripPC{vertical-align:middle; font-family:sans-serif;font-size:8pt; padding:0px 0px 0px 0px;margin:0px 0px 0px 0px}\
#snipmanager-form-panel{background:#fafafa;}');

//
// wrapper for addEventListener (http://ejohn.org/projects/flexible-javascript-events/)
//

var AddEventListener = function(domElement, eventType, eventHandler, useCapture) {

	if (domElement == null) {
		return;
	}
	if (typeof(domElement.addEventListener) == 'function') {
		domElement.addEventListener(eventType, eventHandler, useCapture);
	}
	else {
		domElement['wikEd' + eventType + eventHandler] = eventHandler;
		domElement[eventType + eventHandler] = function() {
			var eventRootElement = document;
			if (document.addEventListener == null) {
				eventRootElement = window;
			}
			domElement['wikEd' + eventType + eventHandler](eventRootElement.event);
		};
		domElement.attachEvent('on' + eventType, domElement[eventType + eventHandler] );
	}
	return;
};

AddEventListener(window, 'load', createMenu, false);
}

SnippetManagerWrapper.startup = function() {
	if (document.title == '')
		return;
	SnippetManagerWrapper();
}

SnippetManagerWrapper.startup();


// </nowiki></pre>