# மீடியாவிக்கி:RefToolbarLegacy.js

var numforms = 0;  
var wikEdAutoUpdateUrl;  
var citeUserDateFormat;  
var refTagURL;  
var defaultRefTagURL = '//reftag.appspot.com/';  
var refToolDebug;  

String.prototype.trim = function {  
return this.replace(/^\s+|\s+$/g,"");  
};  

function refbuttons {  
if (mw.toolbar && document.getElementById('toolbar') ) {  
var button = document.createElement('a');  
button.href = "javascript:easyCiteMain";  
button.title = "Insert Citation";  
button.className = "mw-toolbar-editbutton";  
var buttonimage = document.createElement('img');  
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/e/ea/Button_easy_cite.png";  
buttonimage.alt = "Insert Citation";  
button.appendChild(buttonimage);  
var toolbar = document.getElementById('toolbar');  
if (navigator.userAgent.indexOf('MSIE') == -1) {  
toolbar.appendChild(button);  
var citemain = document.createElement('div');  
citemain.style.display = '';  
citemain.style.margin = '0 0 ';  
citemain.style.clear = 'both';  
citemain.style.;  
citemain.setAttribute('Id', 'citeselect');  
citemain.appendChild( addOption("citeWeb", "Web") );  
citemain.appendChild( addOption("citeNews", "News") );  
citemain.appendChild( addOption("citeBook", "Book") );  
citemain.appendChild( addOption("citeJournal", "Journal") );  
citemain.appendChild( addOption("citeNamedRef", "Named references") );  
citemain.appendChild( addOption("dispErrors", "Error check") );  
citemain.appendChild( addOption("showMore", "More") );  
citemain.appendChild( addOption("hideInitial", "Cancel") );  

var citemore = document.createElement('div');  
citemore.style.display = '';  
citemore.setAttribute('Id', 'citemore');  
citemore.appendChild( addOption("citeEncyclopedia", "Encyclopedia") );  
citemore.appendChild( addOption("citePressRelease", "Press release") );  
citemore.appendChild( addOption("citeMap", "Map") );  
citemore.appendChild( addOption("showRefSectionOptions", "Ref Section") );  
citemain.appendChild(citemore);  

$( citemain ).insertAfter( $( toolbar ) );  
}  
else {  
toolbar.appendChild(button);  
var citeselect = document.createElement('div');  
citeselect.id = 'citeselect';  
citeselect.style.display = "";  
citeselect.innerHTML = '<input type="button" value="Web" onclick="citeWeb" />'+  
'<input type="button" value="News" onclick="citeNews" />'+  
'<input type="button" value="Book" onclick="citeBook" />'+  
'<input type="button" value="Journal" onclick="citeJournal" />'+  
'<input type="button" value="Named references" onclick="citeNamedRef" />'+  
'<input type="button" value="Error check" onclick="dispErrors" />'+  
'<input type="button" value="More" onclick="showMore" />'+  
'<input type="button" value="Cancel" onclick="hideInitial" />'+  
'<div id="citemore">\  
<input type="button" value="Encyclopedia" onclick="citeEncyclopedia" />\  
<input type="button" value="Press release" onclick="citePressRelease" />\  
<input type="button" value="Map" onclick="citeMap" />\  
<input type="button" value="Ref Section" onclick="showRefSectionOptions" />\  
</div>';  
document.getElementById('editform').insertBefore(citeselect, document.getElementById('editform').firstChild ) ;  
}  
var reftoolformarea = document.createElement( 'span' );  
reftoolformarea.id = 'refToolFormArea';  
document.getElementById('citeselect').appendChild( reftoolformarea );  
}  
if (typeof EditTools == "object") {  
var placeholder = document.getElementById("editpage-specialchars");  
EditTools.createEditTools (placeholder);  
}  
}  

function addOption(script, text) {  
var option = document.createElement('input');  
option.setAttribute('type', 'button');  
option.setAttribute('onclick', script);  
option.setAttribute("value", text);  
return option;  
}  

function hideInitial {  
document.getElementById('citeselect').style.display = '';  
oldFormHide;  
}  

function oldFormHide {  
//if (numforms != 0) {  
// document.getElementById('citediv'+numforms).style.display = '';  
//}  
document.getElementById('refToolFormArea').innerHTML = '';  
if (document.getElementById('errorform') !== null) {  
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));  
}  
}  

function easyCiteMain {  
document.getElementById('citeselect').style.display = '';  
document.getElementById('citemore').style.display = '';  
}  

function showMore {  
document.getElementById('citemore').style.display = '';  
}  

var months = ['January', 'February', 'March', 'April', 'May', 'June',  
'July', 'August', 'September', 'October', 'November', 'December'];  
var citeGlobalDateFormat = "<date> <monthname> <year>";  
function getTime {  
var datestr = '';  
if (citeUserDateFormat) {  
datestr = citeUserDateFormat;  
} else {  
datestr = citeGlobalDateFormat;  
}  
var DT = new Date;  
var zmonth = '';  
var month = DT.getUTCMonth+1;  
if (month < 10) {  
zmonth = "0"+month.toString;  
} else {  
zmonth = month.toString;  
}  
month = month.toString;  
var zdate = '';  
var date = DT.getUTCDate;  
if (date < 10) {  
zdate = "0"+date.toString;  
} else {  
zdate = date.toString;  
}  
date = date.toString;  
datestr = datestr.replace('<date>', date);  
datestr = datestr.replace('<month>', month);  
datestr = datestr.replace('<zdate>', zdate);  
datestr = datestr.replace('<zmonth>', zmonth);  
datestr = datestr.replace('<monthname>', months[DT.getUTCMonth]);  
datestr = datestr.replace('<year>', DT.getUTCFullYear.toString);  
return (datestr);  
}  

function lastNameToRefname {  
//Note: This only works if field 'refname' comes after field 'last', but it always does  
var lastName;  
var fields = document.getElementById('citediv'+numforms).getElementsByTagName('input');  
for (var i=0; i<fields.length; i++) {  
if(fields[i].id == 'last') {  
lastName = fields[i].value;  
}  
else if(fields[i].id == 'refname') {  
fields[i].value = lastName.replace(/^\s*(.*?)\s*$/, "$1");  
return;  
}  
}  
}  

function setAccessDateToday {  
document.getElementById('accessdate').value = getTime;  
/* var fields = document.getElementById('citediv'+numforms).getElementsByTagName('input');  
for (var i=0; i<fields.length; i++) {  
if(fields[i].id == 'accessdate') {  
fields[i].value = getTime;  
return;  
}  
}  
- /
}  

function getLastName(authornum) {  
if (/\S/.test(document.getElementById('last'+authornum).value)) {  
return document.getElementById('last'+authornum).value;  
}  
else {  
var author = document.getElementById('author'+authornum).value;  
var match = /(\S+)\s*$/.exec(author);  
if (match) {  
return match[1];  
}  
else {  
return '';  
}  
}  
}  

function makeRefname {  
var refname;  
if (document.getElementById('last1')) {  
refname = document.getElementById('last1').value + document.getElementById('last2').value;  
}  
else{  
refname = document.getElementById('last').value;  
}  
if (/\S/.test(refname)) {  
var date = document.getElementById('date').value;  
var match = /[0-9]{4}/.exec(date);  
if (match) {  
refname += match[0];  
}  
}  
else {  
refname = document.getElementById('title').value;  
}  
document.getElementById('refname').value = refname;  
}  

function citeWeb {  
citeNewsWeb("cite web");  
}  
function citeNews {  
citeNewsWeb("cite news");  
}  

function citeNewsWeb(templatename) {  
oldFormHide;  
var template = templatename;  
var legend;  
if (template == "cite web") {  
legend = "Cite web source";  
} else {  
legend = "Cite news source";  
}  
var newtime = getTime;  
numforms++;  
var form = '<div id="citediv'+numforms+'">'+  
'<fieldset><legend>'+legend+'</legend>'+  
'<table cellspacing="5">'+  
'<input type="hidden" value="'+template+'" id="template">'+  
'<tr><td><label for="url">&nbsp;URL: </label></td>'+  
'<td><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="' + ((template == 'cite news') ? 'For a New York Times article URL, fetch article data and fill in the fields. For other URLs, fetch the page title.' : 'Fetch the page title. Irrelevant parts often have to be removed manually afterwards.') + '" onClick="pullURL; return false;"><span><input type="text" tabindex=1 id="url"></span></td>'+  
'<td><label for="title">&nbsp;Title: </label></td>'+  
'<td><input type="text" tabindex=1 id="title"></td></tr>'+  
'<tr><td><label for="last">&nbsp;Last name: </label></td>'+  
'<td><input type="text" tabindex=1 id="last"></td>'+  
'<td><label for="first">&nbsp;First name: </label></td>'+  
'<td><input type="text" tabindex=1 id="first"></td></tr>'+  
'<tr><td><label for="coauthors">&nbsp;Coauthors: </label></td>'+  
'<td><input type="text" tabindex=1 id="coauthors"></td>'+  
'<td><label for="date">&nbsp;Publication date: </label></td>'+  
'<td><input type="text" tabindex=1 id="date"></td></tr>'+  
'<tr><td><label for="work">&nbsp;' + ((template == 'cite news') ? 'Newspaper' : 'Work') + ': </label></td>'+  
'<td><input type="text" tabindex=1 id="work"></td>'+  
'<td><label for="publisher">&nbsp;Publisher: </label></td>'+  
'<td><input type="text" tabindex=1 id="publisher"></td></tr>'+  
'<tr><td><label for="pages">&nbsp;Pages: </label></td>'+  
'<td><input type="text" tabindex=1 id="pages"></td>'+  
'<td><label for="language">&nbsp;Language: </label></td>'+  
'<td><input type="text" tabindex=1 id="language"></td></tr>'+  
'<tr><td><label for="accessdate">&nbsp;Access date: </label></td>'+  
'<td><input type="text" tabindex=1 id="accessdate" value="'+ newtime +'"></td>'+  
'<td><label for="location">&nbsp;Location: </label></td>'+  
'<td><input type="text" tabindex=1 id="location"></td></tr>';  
if (template == 'cite web') {  
form += '<tr><td><label for="archiveurl">&nbsp;Archive URL: </label></td>'+  
'<td><input type="text" tabindex=1 id="archiveurl"></td>'+  
'<td><label for="archivedate">&nbsp;Archive date: </label></td>'+  
'<td><input type="text" tabindex=1 id="archivedate"></td></tr>';  
}  
form += '<tr><td><label for="refname">&nbsp;Reference name: </label></td>'+  
'<td><input type="text" tabindex=1 id="refname"><input type="button" value="<Last name" onClick="lastNameToRefname"></td></tr>'+  
'</table>'+  
' <input type="button" value="Add citation" onClick="addcites">'+  
' <input type="button" value="Preview citation" onClick="previewCitationDefault"> \  
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" />'+  
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+  
'<span><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+  
'</fieldset><span id="previewSpan"></span></div>';  
document.getElementById('refToolFormArea').innerHTML = form;  
}  

function citeBook {  
oldFormHide;  
var template = "cite book";  
numforms++;  
var form = '<div id="citediv'+numforms+'">'+  
'<fieldset><legend>Cite book source</legend>';  

form += '<table cellspacing="5"> \  
<tr><td><label for="title">Title: </label></td> \  
<td colspan=5><input type="text" tabindex=1 id="title"></td></tr>';  
for (var i=1;i<=3;i++) {  
var i_str = i == 1 ? '': ' '+i;  
form += '<tr> \  
<td><label for="last'+i+'">Author'+i_str+' last&nbsp;name: </label></td> \  
<td><input type="text" tabindex=1 id="last'+i+'"></td> \  
<td><label for="first'+i+'">&nbsp;first&nbsp;name: </label></td> \  
<td><input type="text" tabindex=1 id="first'+i+'"></td> \  
<td><label for="authorlink'+i+'">&nbsp;Authorlink: </label></td> \  
<td><input type="text" tabindex=1 id="authorlink'+i+'"> \  
\  
</td> \  
</tr>';  
}  
form += '<tr><td><label for="coauthors">Coauthors: </label></td> \  
<td><input type="text" tabindex=1 id="coauthors"></td> \  
<td><label for="editor">&nbsp;Editor: </label></td> \  
<td><input type="text" tabindex=1 id="editor"></td> \  
<td><label for="others">&nbsp;Others: </label></td> \  
<td><input type="text" tabindex=1 id="others"></td></tr> \  
</table> \  
<table cellspacing="5"> \  
<tr><td><label for="publisher">Publisher: </label></td> \  
<td><input type="text" tabindex=1 id="publisher"></td> \  
<td><label for="location">&nbsp;Location: </label></td> \  
<td><input type="text" tabindex=1 id="location"></td></tr> \  
\  
<tr><td><label for="date">Publication&nbsp;date or&nbsp;year: </label></td> \  
<td><input type="text" tabindex=1 id="date"> \  
<input id="dmy" name="dateformat" value="dmy" type="radio" tabindex=1 onclick="reformatDates"><label for="dmy">dmy</label> \  
<input id="mdy" name="dateformat" value="mdy" type="radio" tabindex=1 onclick="reformatDates"><label for="mdy">md, y</label> \  
<input id="ymd" name="dateformat" value="ymd" type="radio" tabindex=1 onclick="reformatDates"><label for="ymd">y-m-d</label> \  
</td> \  
<td><label for="edition">&nbsp;Edition: </label></td> \  
<td><input type="text" tabindex=1 id="edition"></td></tr> \  
\  
<tr><td><label for="series">Series: </label></td> \  
<td><input type="text" tabindex=1 id="series"></td> \  
<td><label for="volume">&nbsp;Volume: </label></td> \  
<td><input type="text" tabindex=1 id="volume"></td></tr> \  
\  
<tr><td><label for="pages">Page number(s):</label></td> \  
<td><input type="text" tabindex=1 id="pages" name="pages" onFocus="this.style.backgroundColor=\'\';"></td> \  
<td><label for="chapter">&nbsp;Chapter: </label></td> \  
<td><input type="text" tabindex=1 id="chapter"></td></tr> \  
\  
<tr><td><label for="isbn">ISBN: </label></td> \  
<td><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="Fill in citation data based on ISBN from Diberri\'s tool." onClick="pullISBN; return false;"><span><input type="text" tabindex=1 id="isbn"></span></td> \  
<td><label for="language">&nbsp;Language: </label></td> \  
<td><input type="text" tabindex=1 id="language"></td></tr> \  
\  
<tr><td><label for="url">URL: </label></td> \  
<td><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="Fill in citation data based on a Google Books URL." onClick="pullJs; return false;"><span><input type="text" tabindex=1 id="url"></span></td> \  
<td><label for="accessdate">&nbsp;Access&nbsp;date:</label></td> \  
<td><input type="text" tabindex=1 id="accessdate"></td></tr> \  
\  
<tr><td><label for="otherfields">Other&nbsp;fields:</label></td> \  
<td><input type="text" tabindex=1 id="otherfields"></td> \  
<td><label for="refname">&nbsp;Ref&nbsp;name: </label></td> \  
<td><input type="text" tabindex=1 id="refname"></td> \  
</tr> \  
</table> \  
\  
<input type="radio" tabindex=1 name="template" id="cite_book" value="cite_book" checked="1"><label for="cite_book">\{\{cite book}}</label> <sup><a href="//en.wikipedia.org/wiki/Template:Cite_book" target="_blank">[doc]</a></sup> \  
<input type="radio" tabindex=1 name="template" id="citation" value="citation"><label for="citation">\{\{citation}}</label> <sup><a href="//en.wikipedia.org/wiki/Template:Citation" target="_blank">[doc]</a></sup> \  
<input type="radio" tabindex=1 name="template" id="plain" value="plain"><label for="plain">plain wikicode (experimental)</label> \  
<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label> \  
<input type="checkbox" tabindex=1 name="extraparams" id="extraparams" value="extraparams"><label for="extraparams">Extra parameters</label> \  

<input type="button" value="Add citation" onClick="makeCiteBook"> \  
<input type="button" value="Preview citation" onClick="previewCitationBook"> \  
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" /> \  
\  
</fieldset><span id="previewSpan"></span></div>';  
document.getElementById('refToolFormArea').innerHTML = form;  
}  

function citeJournal {  
oldFormHide;  
var template = "cite journal";  
numforms++;  
var form = '<div id="citediv'+numforms+'">'+  
'<fieldset><legend>Cite journal</legend>'+  
'<table cellspacing="5">'+  
'<input type="hidden" value="'+template+'" id="template">'+  
'<tr><td><label for="last">&nbsp;Last name: </label></td>'+  
'<td><input type="text" tabindex=1 id="last"></td>'+  
'<td><label for="first">&nbsp;First name: </label></td>'+  
'<td><input type="text" tabindex=1 id="first"></td></tr>'+  
'<tr><td><label for="coauthors">&nbsp;Coauthors: </label></td>'+  
'<td><input type="text" tabindex=1 id="coauthors"></td>'+  
'<td><label for="date">&nbsp;Publication date: </label></td>'+  
'<td><input type="text" tabindex=1 id="date"></td></tr>'+  
'<tr><td><label for="title">&nbsp;Title: </label></td>'+  
'<td><input type="text" tabindex=1 id="title"></td>'+  
'<td><label for="journal">&nbsp;Journal: </label></td>'+  
'<td><input type="text" tabindex=1 id="journal"></td></tr>'+  
'<tr><td><label for="publisher">&nbsp;Publisher: </label></td>'+  
'<td><input type="text" tabindex=1 id="publisher"></td>'+  
'<td><label for="location">&nbsp;Location: </label></td>'+  
'<td><input type="text" tabindex=1 id="location"></td></tr>'+  
'<tr><td><label for="volume">&nbsp;Volume: </label></td>'+  
'<td><input type="text" tabindex=1 id="volume"></td>'+  
'<td><label for="issue">&nbsp;Issue: </label></td>'+  
'<td><input type="text" tabindex=1 id="issue"></td></tr>'+  
'<tr><td><label for="pages">&nbsp;Pages: </label></td>'+  
'<td><input type="text" tabindex=1 id="pages"></td>'+  
'<td><label for="issn">&nbsp;ISSN: </label></td>'+  
'<td><input type="text" tabindex=1 id="issn"></td></tr>'+  
'<tr><td><label for="oclc">&nbsp;OCLC: </label></td>'+  
'<td><input type="text" tabindex=1 id="oclc"></td>'+  
'<td><label for="doi">&nbsp;DOI: </label></td>'+  
'<td><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="Fetch citation data for a DOI from crossref.org and fill in the other fields." onClick="pullDOI; return false;"><span><input type="text" tabindex=1 id="doi"></span></td></tr>'+  
'<tr><td><label for="pmid">&nbsp;PMID: </label></td>'+  
'<td><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="Fetch citation data for a PMID" onClick="pullPMID; return false;"><span><input type="text" tabindex=1 id="pmid"></span></td>'+  
'<td><label for="quote">&nbsp;Quote: </label></td>'+  
'<td><input type="text" tabindex=1 id="quote"></td></tr>'+  
'<tr><td><label for="url">&nbsp;URL: </label></td>'+  
'<td><input type="text" tabindex=1 id="url"></td>'+  
'<td><label for="accessdate">&nbsp;Access date: </label></td>'+  
'<td><input type="text" tabindex=1 id="accessdate"></td></tr>'+  
'<tr><td><label for="language">&nbsp;Language: </label></td>'+  
'<td><input type="text" tabindex=1 id="language"></td>'+  
'<td><label for="refname">&nbsp;Reference name: </label></td>'+  
'<td><input type="text" tabindex=1 id="refname"><input type="button" value="<Last name" onClick="lastNameToRefname"></td></tr>'+  
'</table>'+  
'<input type="button" value="Add citation" onClick="addcites">'+  
' <input type="button" value="Preview citation" onClick="previewCitationDefault"> \  
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" />'+  
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+  
'<span><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+  
'</fieldset><span id="previewSpan"></span></div>';  
document.getElementById('refToolFormArea').innerHTML = form;  
}  

function citeEncyclopedia {  
oldFormHide;  
var template = "cite encyclopedia";  
numforms++;  
var form = '<div id="citediv'+numforms+'">'+  
'<fieldset><legend>Cite encyclopedia source</legend>'+  
'<table cellspacing="5">'+  
'<input type="hidden" value="'+template+'" id="template">'+  
'<tr><td><label for="last">&nbsp;Last name: </label></td>'+  
'<td><input type="text" tabindex=1 id="last"></td>'+  
'<td><label for="first">&nbsp;First name: </label></td>'+  
'<td><input type="text" tabindex=1 id="first"></td></tr>'+  
'<tr><td><label for="coauthors">&nbsp;Coauthors: </label></td>'+  
'<td><input type="text" tabindex=1 id="coauthors"></td>'+  
'<td><label for="editors">&nbsp;Editors: </label></td>'+  
'<td><input type="text" tabindex=1 id="editors"></td></tr>'+  
'<tr><td><label for="title">&nbsp;Entry title: </label></td>'+  
'<td><input type="text" tabindex=1 id="title"></td>'+  
'<td><label for="encyclopedia">&nbsp;Encyclopedia: </label></td>'+  
'<td><input type="text" tabindex=1 id="encyclopedia"></td></tr>'+  
'<tr><td><label for="publisher">&nbsp;Publisher: </label></td>'+  
'<td><input type="text" tabindex=1 id="publisher"></td>'+  
'<td><label for="location">&nbsp;Location: </label></td>'+  
'<td><input type="text" tabindex=1 id="location"></td></tr>'+  
'<tr><td><label for="year">&nbsp;Year: </label></td>'+  
'<td><input type="text" tabindex=1 id="year"></td>'+  
'<td><label for="volume">&nbsp;Volume: </label></td>'+  
'<td><input type="text" tabindex=1 id="volume"></td></tr>'+  
'<tr><td><label for="pages">&nbsp;Pages: </label></td>'+  
'<td><input type="text" tabindex=1 id="pages"></td>'+  
'<td><label for="isbn">&nbsp;ISBN: </label></td>'+  
'<td><input type="text" tabindex=1 id="isbn"></td></tr>'+  
'<tr><td><label for="url">&nbsp;URL: </label></td>'+  
'<td><input type="text" tabindex=1 id="url"></td>'+  
'<td><label for="accessdate">&nbsp;Access date: </label></td>'+  
'<td><input type="text" tabindex=1 id="accessdate"></td></tr>'+  
'<tr><td><label for="language">&nbsp;Language: </label></td>'+  
'<td><input type="text" tabindex=1 id="language"></td>'+  
'<td><label for="refname">&nbsp;Reference name: </label></td>'+  
'<td><input type="text" tabindex=1 id="refname"></td></tr>'+  
'</table>'+  
'<input type="button" value="Add citation" onClick="addcites">'+  
' <input type="button" value="Preview citation" onClick="previewCitationDefault"> \  
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" />'+  
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+  
'<span><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+  
'</fieldset><span id="previewSpan"></span></div>';  
document.getElementById('refToolFormArea').innerHTML = form;  
}  

function citePressRelease {  
oldFormHide;  
var template = "cite press release";  
numforms++;  
var form = '<div id="citediv'+numforms+'">'+  
'<fieldset><legend>Cite press release</legend>'+  
'<table cellspacing="5">'+  
'<input type="hidden" value="'+template+'" id="template">'+  
'<tr><td><label for="title">&nbsp;Title: </label></td>'+  
'<td><input type="text" tabindex=1 id="title"></td>'+  
'<td><label for="publisher">&nbsp;Publisher: </label></td>'+  
'<td><input type="text" tabindex=1 id="publisher"></td></tr>'+  
'<tr><td><label for="date">&nbsp;Date: </label></td>'+  
'<td><input type="text" tabindex=1 id="date"></td>'+  
'<td><label for="language">&nbsp;Language: </label></td>'+  
'<td><input type="text" tabindex=1 id="language"></td></tr>'+  
'<tr><td><label for="url">&nbsp;URL: </label></td>'+  
'<td><input type="text" tabindex=1 id="url"></td>'+  
'<td><label for="accessdate">&nbsp;Access date: </label></td>'+  
'<td><input type="text" tabindex=1 id="accessdate" value="'+ getTime +'"></td></tr>'+  
'<tr><td><label for="refname">&nbsp;Reference name: </label></td>'+  
'<td><input type="text" tabindex=1 id="refname"></td></tr>'+  
'</table>'+  
'<input type="button" value="Add citation" onClick="addcites">'+  
' <input type="button" value="Preview citation" onClick="previewCitationDefault"> \  
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" />'+  
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+  
'<span><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+  
'</fieldset><span id="previewSpan"></span></div>';  
document.getElementById('refToolFormArea').innerHTML = form;  
}  

function citeMap {  
oldFormHide;  
var template = "cite map";  
numforms++;  
var form = '<div id="citediv'+numforms+'">'+  
'<fieldset><legend>Cite map</legend>'+  
'<table cellspacing="5">'+  
'<input type="hidden" value="'+template+'" id="template">'+  
'<tr><td><label for="publisher">&nbsp;Publisher: </label></td>'+  
'<td><input type="text" tabindex=1 id="publisher"></td>'+  
'<td><label for="title">&nbsp;Title: </label></td>'+  
'<td><input type="text" tabindex=1 id="title"></td></tr>'+  
'<tr><td><label for="url">&nbsp;URL: </label></td>'+  
'<td><input type="text" tabindex=1 id="url"></td>'+  
'<td><label for="accessdate">&nbsp;Access date: </label></td>'+  
'<td><input type="text" tabindex=1 id="accessdate"></td></tr>'+  
'<tr><td><label for="edition">&nbsp;Edition: </label></td>'+  
'<td><input type="text" tabindex=1 id="edition"></td>'+  
'<td><label for="date">&nbsp;Date or year: </label></td>'+  
'<td><input type="text" tabindex=1 id="date"></td></tr>'+  
'<tr><td><label for="cartography">&nbsp;Cartography: </label></td>'+  
'<td><input type="text" tabindex=1 id="cartography"></td>'+  
'<td><label for="scale">&nbsp;Scale: </label></td>'+  
'<td><input type="text" tabindex=1 id="scale"></td></tr>'+  
'<tr><td><label for="series">&nbsp;Series: </label></td>'+  
'<td><input type="text" tabindex=1 id="series"></td>'+  
'<td><label for="page">&nbsp;Page: </label></td>'+  
'<td><input type="text" tabindex=1 id="page"></td></tr>'+  
'<tr><td><label for="section">&nbsp;Section: </label></td>'+  
'<td><input type="text" tabindex=1 id="section"></td>'+  
'<td><label for="inset">&nbsp;Inset: </label></td>'+  
'<td><input type="text" tabindex=1 id="inset"></td></tr>'+  
'<tr><td><label for="isbn">&nbsp;ISBN: </label></td>'+  
'<td><input type="text" tabindex=1 id="isbn"></td>'+  
'<td><label for="refname">&nbsp;Reference name: </label></td>'+  
'<td><input type="text" tabindex=1 id="refname"></td></tr>'+  
'</table>'+  
'<input type="button" value="Add citation" onClick="addcites">'+  
' <input type="button" value="Preview citation" onClick="previewCitationDefault"> \  
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" />'+  
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+  
'<span><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+  
'</fieldset><span id="previewSpan"></span></div>';  
document.getElementById('refToolFormArea').innerHTML = form;  
}  

function showRefSectionOptions {  
oldFormHide;  
var template = "cite encyclopedia";  
numforms++;  
var form = '<div id="citediv'+numforms+'">'+  
'<fieldset><legend>Add references section</legend>\  
Headline:  
\  
<input id="references" name="headline" type="radio" tabindex=1 checked="checked"><label for="references">