'<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>'+