Misplaced Pages

User:Ohconfucius/script/MOSNUM dates.js: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< User:Ohconfucius | script Browse history interactively← Previous editNext edit →Content deleted Content added
Revision as of 04:33, 6 November 2010 view sourceOhconfucius (talk | contribs)Autopatrolled, Extended confirmed users, Pending changes reviewers328,947 edits tightening up date (day) code← Previous edit Revision as of 04:48, 6 November 2010 view source Ohconfucius (talk | contribs)Autopatrolled, Extended confirmed users, Pending changes reviewers328,947 edits tightening up date (day) codeNext edit →
Line 520: Line 520:


//month+day+year piped pseudo-ISO dates //month+day+year piped pseudo-ISO dates
txt.value=txt.value.replace(/\?\d)\|?\d-?\d\]\]-(?:\\d\d\d)(\|\d{2,4})?(?:\]\])?/gi, '$1$2, $3'); txt.value=txt.value.replace(/\?\d|30|31)\|?\d-?\d\]\]-(?:\\d\d\d)(\|\d{2,4})?(?:\]\])?/gi, '$1$2, $3');
txt.value=txt.value.replace(/\\d\s(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))\|?\d-?\d\]\]-(?:\\d{3})(\]\])?/gi, '$1 $2'); txt.value=txt.value.replace(/\\d\s(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))\|?\d-?\d\]\]-(?:\\d{3})(\]\])?/gi, '$1 $2');


Line 755: Line 755:


//'md, md,' to 'dm, dm,' //'md, md,' to 'dm, dm,'
txt.value=txt.value.replace(/()( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))( ?\d),( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))( ?\d)()/gi, '$1$3$2,$5$4,$6'); txt.value=txt.value.replace(/()( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))( ?\d|30|31),( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))( ?\d|30|31)()/gi, '$1$3$2,$5$4,$6');


//convert simple mdy dates to dmy //convert simple mdy dates to dmy
Line 808: Line 808:


//'dm, dm,' to 'md, md,' //'dm, dm,' to 'md, md,'
txt.value=txt.value.replace(/()( ?\d)( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))),( ?\d)( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))(?)/gi, '$1$3$2,$5$4,$6'); txt.value=txt.value.replace(/()( ?\d|30|31)( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))),( ?\d|30|31)( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))(?)/gi, '$1$3$2,$5$4,$6');


txt.value=txt.value.replace(/()(?\d|30|31)(?:th|st|nd|rd|){1,3}(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),?\s(\d{1,4}\s?(?:AD|BC|CE|BCE))/gi, '$1$3 $2, $4'); txt.value=txt.value.replace(/()(?\d|30|31)(?:th|st|nd|rd|){1,3}(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),?\s(\d{1,4}\s?(?:AD|BC|CE|BCE))/gi, '$1$3 $2, $4');

Revision as of 04:48, 6 November 2010

//NOTE TO SELF: Date parameters in {{dmy/mdy}} template need updating at the start of each month

// This script aligns dates into one of two formats allowed by ].
// PLEASE READ THE DOCUMENTATION at ] (click on the link above) before using.

// Feedback and constructive criticism are welcome... however, please don't tell me something I know already 

// Feedback and constructive criticism are welcome

function Ohc_unambiguous_dates(){
 var txt=document.editform.wpTextbox1;
// resolvable ambiguous date formats
//4-digit year universal
	txt.value=txt.value.replace(/()\s0?1\/0?1\/(\d{4})(?!)/g, '$1 1 January $2');
	txt.value=txt.value.replace(/()\s0?2\/0?2\/(\d{4})(?!)/g, '$1 2 February $2');
	txt.value=txt.value.replace(/()\s0?3\/0?3\/(\d{4})(?!)/g, '$1 3 March $2');
	txt.value=txt.value.replace(/()\s0?4\/0?4\/(\d{4})(?!)/g, '$1 4 April $2');
	txt.value=txt.value.replace(/()\s0?5\/0?5\/(\d{4})(?!)/g, '$1 5 May $2');
	txt.value=txt.value.replace(/()\s0?6\/0?6\/(\d{4})(?!)/g, '$1 6 June $2');
	txt.value=txt.value.replace(/()\s0?7\/0?7\/(\d{4})(?!)/g, '$1 7 July $2');
	txt.value=txt.value.replace(/()\s0?8\/0?8\/(\d{4})(?!)/g, '$1 8 August $2');
	txt.value=txt.value.replace(/()\s0?9\/0?9\/(\d{4})(?!)/g, '$1 9 September $2');
	txt.value=txt.value.replace(/()\s10\/10\/(\d{4})(?!)/g, '$1 10 October $2');
	txt.value=txt.value.replace(/()\s11\/11\/(\d{4})(?!)/g, '$1 11 November $2');
	txt.value=txt.value.replace(/()\s12\/12\/(\d{4})(?!)/g, '$1 12 December $2');

//4-digit year UK style
	txt.value=txt.value.replace(/(\d)\/0?1\/(\d{4})(?!)/g, '$1 January $2');
	txt.value=txt.value.replace(/(\d)\/0?2\/(\d{4})(?!)/g, '$1 February $2');
	txt.value=txt.value.replace(/(\d)\/0?3\/(\d{4})(?!)/g, '$1 March $2');
	txt.value=txt.value.replace(/(\d)\/0?4\/(\d{4})(?!)/g, '$1 April $2');
	txt.value=txt.value.replace(/(\d)\/0?5\/(\d{4})(?!)/g, '$1 May $2');
	txt.value=txt.value.replace(/(\d)\/0?6\/(\d{4})(?!)/g, '$1 June $2');
	txt.value=txt.value.replace(/(\d)\/0?7\/(\d{4})(?!)/g, '$1 July $2');
	txt.value=txt.value.replace(/(\d)\/0?8\/(\d{4})(?!)/g, '$1 August $2');
	txt.value=txt.value.replace(/(\d)\/0?9\/(\d{4})(?!)/g, '$1 September $2');
	txt.value=txt.value.replace(/(\d)\/10\/(\d{4})(?!)/g, '$1 October $2');
	txt.value=txt.value.replace(/(\d)\/11\/(\d{4})(?!)/g, '$1 November $2');
	txt.value=txt.value.replace(/(\d)\/12\/(\d{4})(?!)/g, '$1 December $2');
	txt.value=txt.value.replace(/(1)\/0?1\/(\d{4})(?!)/g, '$1 January $2');
	txt.value=txt.value.replace(/(1)\/0?2\/(\d{4})(?!)/g, '$1 February $2');
	txt.value=txt.value.replace(/(1)\/0?3\/(\d{4})(?!)/g, '$1 March $2');
	txt.value=txt.value.replace(/(1)\/0?4\/(\d{4})(?!)/g, '$1 April $2');
	txt.value=txt.value.replace(/(1)\/0?5\/(\d{4})(?!)/g, '$1 May $2');
	txt.value=txt.value.replace(/(1)\/0?6\/(\d{4})(?!)/g, '$1 June $2');
	txt.value=txt.value.replace(/(1)\/0?7\/(\d{4})(?!)/g, '$1 July $2');
	txt.value=txt.value.replace(/(1)\/0?8\/(\d{4})(?!)/g, '$1 August $2');
	txt.value=txt.value.replace(/(1)\/0?9\/(\d{4})(?!)/g, '$1 September $2');
 	txt.value=txt.value.replace(/(1)\/10\/(\d{4})(?!)/g, '$1 October $2');
	txt.value=txt.value.replace(/(1)\/11\/(\d{4})(?!)/g, '$1 November $2');
	txt.value=txt.value.replace(/(1)\/12\/(\d{4})(?!)/g, '$1 December $2');

//4-digit year US style
	txt.value=txt.value.replace(/()0?1\/(\d)\/(\d{4})(?!)/g, '$1 January $2, $3');
	txt.value=txt.value.replace(/()0?2\/(\d)\/(\d{4})(?!)/g, '$1 February $2, $3');
	txt.value=txt.value.replace(/()0?3\/(\d)\/(\d{4})(?!)/g, '$1 March $2, $3');
	txt.value=txt.value.replace(/()0?4\/(\d)\/(\d{4})(?!)/g, '$1 April $2, $3');
	txt.value=txt.value.replace(/()0?5\/(\d)\/(\d{4})(?!)/g, '$1 May $2, $3');
	txt.value=txt.value.replace(/()0?6\/(\d)\/(\d{4})(?!)/g, '$1 June $2, $3');
	txt.value=txt.value.replace(/()0?7\/(\d)\/(\d{4})(?!)/g, '$1 July $2, $3');
	txt.value=txt.value.replace(/()0?8\/(\d)\/(\d{4})(?!)/g, '$1 August $2, $3');
	txt.value=txt.value.replace(/()0?9\/(\d)\/(\d{4})(?!)/g, '$1 September $2, $3');
	txt.value=txt.value.replace(/()10\/(\d)\/(\d{4})(?!)/g, '$1 October $2, $3');
	txt.value=txt.value.replace(/()11\/(\d)\/(\d{4})(?!)/g, '$1 November $2, $3');
	txt.value=txt.value.replace(/()12\/(\d)\/(\d{4})(?!)/g, '$1 December $2, $3');
	txt.value=txt.value.replace(/()0?1\/(1)\/(\d{4})(?!)/g, '$1 January $2,\'$3');
	txt.value=txt.value.replace(/()0?2\/(1)\/(\d{4})(?!)/g, '$1 February $2, $3');
	txt.value=txt.value.replace(/()0?3\/(1)\/(\d{4})(?!)/g, '$1 March $2, $3');
	txt.value=txt.value.replace(/()0?4\/(1)\/(\d{4})(?!)/g, '$1 April $2, $3');
	txt.value=txt.value.replace(/()0?5\/(1)\/(\d{4})(?!)/g, '$1 May $2, $3');
	txt.value=txt.value.replace(/()0?6\/(1)\/(\d{4})(?!)/g, '$1 June $2, $3');
	txt.value=txt.value.replace(/()0?7\/(1)\/(\d{4})(?!)/g, '$1 July $2, $3');
	txt.value=txt.value.replace(/()0?8\/(1)\/(\d{4})(?!)/g, '$1 August $2, $3');
	txt.value=txt.value.replace(/()0?9\/(1)\/(\d{4})(?!)/g, '$1 September $2, $3');
	txt.value=txt.value.replace(/()10\/(1)\/(\d{4})(?!)/g, '$1 October $2, $3');
	txt.value=txt.value.replace(/()11\/(1)\/(\d{4})(?!)/g, '$1 November $2, $3');
	txt.value=txt.value.replace(/()12\/(1)\/(\d{4})(?!)/g, '$1 December $2, $3');

//2-digit year ('00-'19) universal
	txt.value=txt.value.replace(/()\s0?1\/0?1\/(\d)(?!)/g, '$1 1 January 20$2');
	txt.value=txt.value.replace(/()\s0?2\/0?2\/(\d)(?!)/g, '$1 2 February 20$2');
	txt.value=txt.value.replace(/()\s0?3\/0?3\/(\d)(?!)/g, '$1 3 March 20$2');
	txt.value=txt.value.replace(/()\s0?4\/0?4\/(\d)(?!)/g, '$1 4 April 20$2');
	txt.value=txt.value.replace(/()\s0?5\/0?5\/(\d)(?!)/g, '$1 5 May 20$2');
	txt.value=txt.value.replace(/()\s0?6\/0?6\/(\d)(?!)/g, '$1 6 June 20$2');
	txt.value=txt.value.replace(/()\s0?7\/0?7\/(\d)(?!)/g, '$1 7 July 20$2');
	txt.value=txt.value.replace(/()\s0?8\/0?8\/(\d)(?!)/g, '$1 8 August 20$2');
	txt.value=txt.value.replace(/()\s0?9\/0?9\/(\d)(?!)/g, '$1 9 September 20$2');
	txt.value=txt.value.replace(/()\s10\/10\/(\d)(?!)/g, '$1 10 October 20$2');
	txt.value=txt.value.replace(/()\s11\/11\/(\d)(?!)/g, '$1 11 November 20$2');
	txt.value=txt.value.replace(/()\s12\/12\/(\d)(?!)/g, '$1 12 December 20$2');

//2-digit year ('00-'19) UK style
	txt.value=txt.value.replace(/(\d)\/0?1\/(\d)(?!)/g, '$1 January 20$2');
	txt.value=txt.value.replace(/(\d)\/0?2\/(\d)(?!)/g, '$1 February 20$2');
	txt.value=txt.value.replace(/(\d)\/0?3\/(\d)(?!)/g, '$1 March 20$2');
	txt.value=txt.value.replace(/(\d)\/0?4\/(\d)(?!)/g, '$1 April 20$2');
	txt.value=txt.value.replace(/(\d)\/0?5\/(\d)(?!)/g, '$1 May 20$2');
	txt.value=txt.value.replace(/(\d)\/0?6\/(\d)(?!)/g, '$1 June 20$2');
	txt.value=txt.value.replace(/(\d)\/0?7\/(\d)(?!)/g, '$1 July 20$2');
	txt.value=txt.value.replace(/(\d)\/0?8\/(\d)(?!)/g, '$1 August 20$2');
	txt.value=txt.value.replace(/(\d)\/0?9\/(\d)(?!)/g, '$1 September 20$2');
	txt.value=txt.value.replace(/(\d)\/10\/(\d)(?!)/g, '$1 October 20$2');
	txt.value=txt.value.replace(/(\d)\/11\/(\d)(?!)/g, '$1 November 20$2');
	txt.value=txt.value.replace(/(\d)\/12\/(\d)(?!)/g, '$1 December 20$2');
	txt.value=txt.value.replace(/(1)\/0?1\/(\d)(?!)/g, '$1 January 20$2');
	txt.value=txt.value.replace(/(1)\/0?2\/(\d)(?!)/g, '$1 February 20$2');
	txt.value=txt.value.replace(/(1)\/0?3\/(\d)(?!)/g, '$1 March 20$2');
	txt.value=txt.value.replace(/(1)\/0?4\/(\d)(?!)/g, '$1 April 20$2');
	txt.value=txt.value.replace(/(1)\/0?5\/(\d)(?!)/g, '$1 May 20$2');
	txt.value=txt.value.replace(/(1)\/0?6\/(\d)(?!)/g, '$1 June 20$2');
	txt.value=txt.value.replace(/(1)\/0?7\/(\d)(?!)/g, '$1 July 20$2');
	txt.value=txt.value.replace(/(1)\/0?8\/(\d)(?!)/g, '$1 August 20$2');
	txt.value=txt.value.replace(/(1)\/0?9\/(\d)(?!)/g, '$1 September 20$2');
 	txt.value=txt.value.replace(/(1)\/10\/(\d)(?!)/g, '$1 October 20$2');
	txt.value=txt.value.replace(/(1)\/11\/(\d)(?!)/g, '$1 November 20$2');
	txt.value=txt.value.replace(/(1)\/12\/(\d)(?!)/g, '$1 December 20$2');

//2-digit year ('00-'19) US style
	txt.value=txt.value.replace(/()0?1\/(\d)\/(\d)(?!)/g, '$1 January $2, 20$3');
	txt.value=txt.value.replace(/()0?2\/(\d)\/(\d)(?!)/g, '$1 February $2, 20$3');
	txt.value=txt.value.replace(/()0?3\/(\d)\/(\d)(?!)/g, '$1 March $2, 20$3');
	txt.value=txt.value.replace(/()0?4\/(\d)\/(\d)(?!)/g, '$1 April $2, 20$3');
	txt.value=txt.value.replace(/()0?5\/(\d)\/(\d)(?!)/g, '$1 May $2, 20$3');
	txt.value=txt.value.replace(/()0?6\/(\d)\/(\d)(?!)/g, '$1 June $2, 20$3');
	txt.value=txt.value.replace(/()0?7\/(\d)\/(\d)(?!)/g, '$1 July $2, 20$3');
	txt.value=txt.value.replace(/()0?8\/(\d)\/(\d)(?!)/g, '$1 August $2, 20$3');
	txt.value=txt.value.replace(/()0?9\/(\d)\/(\d)(?!)/g, '$1 September $2, 20$3');
	txt.value=txt.value.replace(/()10\/(\d)\/(\d)(?!)/g, '$1 October $2, 20$3');
	txt.value=txt.value.replace(/()11\/(\d)\/(\d)(?!)/g, '$1 November $2, 20$3');
	txt.value=txt.value.replace(/()12\/(\d)\/(\d)(?!)/g, '$1 December $2, 20$3');
	txt.value=txt.value.replace(/()0?1\/(1)\/(\d)(?!)/g, '$1 January $2,20$3');
	txt.value=txt.value.replace(/()0?2\/(1)\/(\d)(?!)/g, '$1 February $2, 20$3');
	txt.value=txt.value.replace(/()0?3\/(1)\/(\d)(?!)/g, '$1 March $2, 20$3');
	txt.value=txt.value.replace(/()0?4\/(1)\/(\d)(?!)/g, '$1 April $2, 20$3');
	txt.value=txt.value.replace(/()0?5\/(1)\/(\d)(?!)/g, '$1 May $2, 20$3');
	txt.value=txt.value.replace(/()0?6\/(1)\/(\d)(?!)/g, '$1 June $2, 20$3');
	txt.value=txt.value.replace(/()0?7\/(1)\/(\d)(?!)/g, '$1 July $2, 20$3');
	txt.value=txt.value.replace(/()0?8\/(1)\/(\d)(?!)/g, '$1 August $2, 20$3');
	txt.value=txt.value.replace(/()0?9\/(1)\/(\d)(?!)/g, '$1 September $2, 20$3');
	txt.value=txt.value.replace(/()10\/(1)\/(\d)(?!)/g, '$1 October $2, 20$3');
	txt.value=txt.value.replace(/()11\/(1)\/(\d)(?!)/g, '$1 November $2, 20$3');
	txt.value=txt.value.replace(/()12\/(1)\/(\d)(?!)/g, '$1 December $2, 20$3');

//2-digit year ('60-'99) universal
	txt.value=txt.value.replace(/()\s0?1\/0?1\/(\d)(?!)/g, '$1 1 January 19$2');
	txt.value=txt.value.replace(/()\s0?2\/0?2\/(\d)(?!)/g, '$1 2 February 19$2');
	txt.value=txt.value.replace(/()\s0?3\/0?3\/(\d)(?!)/g, '$1 3 March 19$2');
	txt.value=txt.value.replace(/()\s0?4\/0?4\/(\d)(?!)/g, '$1 4 April 19$2');
	txt.value=txt.value.replace(/()\s0?5\/0?5\/(\d)(?!)/g, '$1 5 May 19$2');
	txt.value=txt.value.replace(/()\s0?6\/0?6\/(\d)(?!)/g, '$1 6 June 19$2');
	txt.value=txt.value.replace(/()\s0?7\/0?7\/(\d)(?!)/g, '$1 7 July 19$2');
	txt.value=txt.value.replace(/()\s0?8\/0?8\/(\d)(?!)/g, '$1 8 August 19$2');
	txt.value=txt.value.replace(/()\s0?9\/0?9\/(\d)(?!)/g, '$1 9 September 19$2');
	txt.value=txt.value.replace(/()\s10\/10\/(\d)(?!)/g, '$1 10 October 19$2');
	txt.value=txt.value.replace(/()\s11\/11\/(\d)(?!)/g, '$1 11 November 19$2');
	txt.value=txt.value.replace(/()\s12\/12\/(\d)(?!)/g, '$1 12 December 19$2');

//2-digit year ('60-'99) UK style
	txt.value=txt.value.replace(/(\d)\/0?1\/(\d)(?!)/g, '$1 January 19$2');
	txt.value=txt.value.replace(/(\d)\/0?2\/(\d)(?!)/g, '$1 February 19$2');
	txt.value=txt.value.replace(/(\d)\/0?3\/(\d)(?!)/g, '$1 March 19$2');
	txt.value=txt.value.replace(/(\d)\/0?4\/(\d)(?!)/g, '$1 April 19$2');
	txt.value=txt.value.replace(/(\d)\/0?5\/(\d)(?!)/g, '$1 May 19$2');
	txt.value=txt.value.replace(/(\d)\/0?6\/(\d)(?!)/g, '$1 June 19$2');
	txt.value=txt.value.replace(/(\d)\/0?7\/(\d)(?!)/g, '$1 July 19$2');
	txt.value=txt.value.replace(/(\d)\/0?8\/(\d)(?!)/g, '$1 August 19$2');
	txt.value=txt.value.replace(/(\d)\/0?9\/(\d)(?!)/g, '$1 September 19$2');
	txt.value=txt.value.replace(/(\d)\/10\/(\d)(?!)/g, '$1 October 19$2');
	txt.value=txt.value.replace(/(\d)\/11\/(\d)(?!)/g, '$1 November 19$2');
	txt.value=txt.value.replace(/(\d)\/12\/(\d)(?!)/g, '$1 December 19$2');
	txt.value=txt.value.replace(/(1)\/0?1\/(\d)(?!)/g, '$1 January 19$2');
	txt.value=txt.value.replace(/(1)\/0?2\/(\d)(?!)/g, '$1 February 19$2');
	txt.value=txt.value.replace(/(1)\/0?3\/(\d)(?!)/g, '$1 March 19$2');
	txt.value=txt.value.replace(/(1)\/0?4\/(\d)(?!)/g, '$1 April 19$2');
	txt.value=txt.value.replace(/(1)\/0?5\/(\d)(?!)/g, '$1 May 19$2');
	txt.value=txt.value.replace(/(1)\/0?6\/(\d)(?!)/g, '$1 June 19$2');
	txt.value=txt.value.replace(/(1)\/0?7\/(\d)(?!)/g, '$1 July 19$2');
	txt.value=txt.value.replace(/(1)\/0?8\/(\d)(?!)/g, '$1 August 19$2');
	txt.value=txt.value.replace(/(1)\/0?9\/(\d)(?!)/g, '$1 September 19$2');
 	txt.value=txt.value.replace(/(1)\/10\/(\d)(?!)/g, '$1 October 19$2');
	txt.value=txt.value.replace(/(1)\/11\/(\d)(?!)/g, '$1 November 19$2');
	txt.value=txt.value.replace(/(1)\/12\/(\d)(?!)/g, '$1 December 19$2');

//2-digit year ('60-'99) US style
	txt.value=txt.value.replace(/()0?1\/(\d)\/(\d)(?!)/g, '$1 January $2, 19$3');
	txt.value=txt.value.replace(/()0?2\/(\d)\/(\d)(?!)/g, '$1 February $2, 19$3');
	txt.value=txt.value.replace(/()0?3\/(\d)\/(\d)(?!)/g, '$1 March $2, 19$3');
	txt.value=txt.value.replace(/()0?4\/(\d)\/(\d)(?!)/g, '$1 April $2, 19$3');
	txt.value=txt.value.replace(/()0?5\/(\d)\/(\d)(?!)/g, '$1 May $2, 19$3');
	txt.value=txt.value.replace(/()0?6\/(\d)\/(\d)(?!)/g, '$1 June $2, 19$3');
	txt.value=txt.value.replace(/()0?7\/(\d)\/(\d)(?!)/g, '$1 July $2, 19$3');
	txt.value=txt.value.replace(/()0?8\/(\d)\/(\d)(?!)/g, '$1 August $2, 19$3');
	txt.value=txt.value.replace(/()0?9\/(\d)\/(\d)(?!)/g, '$1 September $2, 19$3');
	txt.value=txt.value.replace(/()10\/(\d)\/(\d)(?!)/g, '$1 October $2, 19$3');
	txt.value=txt.value.replace(/()11\/(\d)\/(\d)(?!)/g, '$1 November $2, 19$3');
	txt.value=txt.value.replace(/()12\/(\d)\/(\d)(?!)/g, '$1 December $2, 19$3');
	txt.value=txt.value.replace(/()0?1\/(1)\/(\d)(?!)/g, '$1 January $2,19$3');
	txt.value=txt.value.replace(/()0?2\/(1)\/(\d)(?!)/g, '$1 February $2, 19$3');
	txt.value=txt.value.replace(/()0?3\/(1)\/(\d)(?!)/g, '$1 March $2, 19$3');
	txt.value=txt.value.replace(/()0?4\/(1)\/(\d)(?!)/g, '$1 April $2, 19$3');
	txt.value=txt.value.replace(/()0?5\/(1)\/(\d)(?!)/g, '$1 May $2, 19$3');
	txt.value=txt.value.replace(/()0?6\/(1)\/(\d)(?!)/g, '$1 June $2, 19$3');
	txt.value=txt.value.replace(/()0?7\/(1)\/(\d)(?!)/g, '$1 July $2, 19$3');
	txt.value=txt.value.replace(/()0?8\/(1)\/(\d)(?!)/g, '$1 August $2, 19$3');
	txt.value=txt.value.replace(/()0?9\/(1)\/(\d)(?!)/g, '$1 September $2, 19$3');
	txt.value=txt.value.replace(/()10\/(1)\/(\d)(?!)/g, '$1 October $2, 19$3');
	txt.value=txt.value.replace(/()11\/(1)\/(\d)(?!)/g, '$1 November $2, 19$3');
	txt.value=txt.value.replace(/()12\/(1)\/(\d)(?!)/g, '$1 December $2, 19$3');

//universal
	txt.value=txt.value.replace(/()\s0?1\/0?1\/(\d{2,4})(?!)/g, '$1 1 January \'$2');
	txt.value=txt.value.replace(/()\s0?2\/0?2\/(\d{2,4})(?!)/g, '$1 2 February \'$2');
	txt.value=txt.value.replace(/()\s0?3\/0?3\/(\d{2,4})(?!)/g, '$1 3 March \'$2');
	txt.value=txt.value.replace(/()\s0?4\/0?4\/(\d{2,4})(?!)/g, '$1 4 April \'$2');
	txt.value=txt.value.replace(/()\s0?5\/0?5\/(\d{2,4})(?!)/g, '$1 5 May \'$2');
	txt.value=txt.value.replace(/()\s0?6\/0?6\/(\d{2,4})(?!)/g, '$1 6 June \'$2');
	txt.value=txt.value.replace(/()\s0?7\/0?7\/(\d{2,4})(?!)/g, '$1 7 July \'$2');
	txt.value=txt.value.replace(/()\s0?8\/0?8\/(\d{2,4})(?!)/g, '$1 8 August \'$2');
	txt.value=txt.value.replace(/()\s0?9\/0?9\/(\d{2,4})(?!)/g, '$1 9 September \'$2');
	txt.value=txt.value.replace(/()\s10\/10\/(\d{2,4})(?!)/g, '$1 10 October \'$2');
	txt.value=txt.value.replace(/()\s11\/11\/(\d{2,4})(?!)/g, '$1 11 November \'$2');
	txt.value=txt.value.replace(/()\s12\/12\/(\d{2,4})(?!)/g, '$1 12 December \'$2');

//UK style
	txt.value=txt.value.replace(/(\d)\/0?1\/(\d{2,4})(?!)/g, '$1 January \'$2');
	txt.value=txt.value.replace(/(\d)\/0?2\/(\d{2,4})(?!)/g, '$1 February \'$2');
	txt.value=txt.value.replace(/(\d)\/0?3\/(\d{2,4})(?!)/g, '$1 March \'$2');
	txt.value=txt.value.replace(/(\d)\/0?4\/(\d{2,4})(?!)/g, '$1 April \'$2');
	txt.value=txt.value.replace(/(\d)\/0?5\/(\d{2,4})(?!)/g, '$1 May \'$2');
	txt.value=txt.value.replace(/(\d)\/0?6\/(\d{2,4})(?!)/g, '$1 June \'$2');
	txt.value=txt.value.replace(/(\d)\/0?7\/(\d{2,4})(?!)/g, '$1 July \'$2');
	txt.value=txt.value.replace(/(\d)\/0?8\/(\d{2,4})(?!)/g, '$1 August \'$2');
	txt.value=txt.value.replace(/(\d)\/0?9\/(\d{2,4})(?!)/g, '$1 September \'$2');
	txt.value=txt.value.replace(/(\d)\/10\/(\d{2,4})(?!)/g, '$1 October \'$2');
	txt.value=txt.value.replace(/(\d)\/11\/(\d{2,4})(?!)/g, '$1 November \'$2');
	txt.value=txt.value.replace(/(\d)\/12\/(\d{2,4})(?!)/g, '$1 December \'$2');
	txt.value=txt.value.replace(/(1)\/0?1\/(\d{2,4})(?!)/g, '$1 January \'$2');
	txt.value=txt.value.replace(/(1)\/0?2\/(\d{2,4})(?!)/g, '$1 February \'$2');
	txt.value=txt.value.replace(/(1)\/0?3\/(\d{2,4})(?!)/g, '$1 March \'$2');
	txt.value=txt.value.replace(/(1)\/0?4\/(\d{2,4})(?!)/g, '$1 April \'$2');
	txt.value=txt.value.replace(/(1)\/0?5\/(\d{2,4})(?!)/g, '$1 May \'$2');
	txt.value=txt.value.replace(/(1)\/0?6\/(\d{2,4})(?!)/g, '$1 June \'$2');
	txt.value=txt.value.replace(/(1)\/0?7\/(\d{2,4})(?!)/g, '$1 July \'$2');
	txt.value=txt.value.replace(/(1)\/0?8\/(\d{2,4})(?!)/g, '$1 August \'$2');
	txt.value=txt.value.replace(/(1)\/0?9\/(\d{2,4})(?!)/g, '$1 September \'$2');
 	txt.value=txt.value.replace(/(1)\/10\/(\d{2,4})(?!)/g, '$1 October \'$2');
	txt.value=txt.value.replace(/(1)\/11\/(\d{2,4})(?!)/g, '$1 November \'$2');
	txt.value=txt.value.replace(/(1)\/12\/(\d{2,4})(?!)/g, '$1 December \'$2');

//US style
	txt.value=txt.value.replace(/()0?1\/(\d)\/(\d{2,4})(?!)/g, '$1 January $2, \'$3');
	txt.value=txt.value.replace(/()0?2\/(\d)\/(\d{2,4})(?!)/g, '$1 February $2, \'$3');
	txt.value=txt.value.replace(/()0?3\/(\d)\/(\d{2,4})(?!)/g, '$1 March $2, \'$3');
	txt.value=txt.value.replace(/()0?4\/(\d)\/(\d{2,4})(?!)/g, '$1 April $2, \'$3');
	txt.value=txt.value.replace(/()0?5\/(\d)\/(\d{2,4})(?!)/g, '$1 May $2, \'$3');
	txt.value=txt.value.replace(/()0?6\/(\d)\/(\d{2,4})(?!)/g, '$1 June $2, \'$3');
	txt.value=txt.value.replace(/()0?7\/(\d)\/(\d{2,4})(?!)/g, '$1 July $2, \'$3');
	txt.value=txt.value.replace(/()0?8\/(\d)\/(\d{2,4})(?!)/g, '$1 August $2, \'$3');
	txt.value=txt.value.replace(/()0?9\/(\d)\/(\d{2,4})(?!)/g, '$1 September $2, \'$3');
	txt.value=txt.value.replace(/()10\/(\d)\/(\d{2,4})(?!)/g, '$1 October $2, \'$3');
	txt.value=txt.value.replace(/()11\/(\d)\/(\d{2,4})(?!)/g, '$1 November $2, \'$3');
	txt.value=txt.value.replace(/()12\/(\d)\/(\d{2,4})(?!)/g, '$1 December $2, \'$3');
	txt.value=txt.value.replace(/()0?1\/(1)\/(\d{2,4})(?!)/g, '$1 January $2,\'$3');
	txt.value=txt.value.replace(/()0?2\/(1)\/(\d{2,4})(?!)/g, '$1 February $2, \'$3');
	txt.value=txt.value.replace(/()0?3\/(1)\/(\d{2,4})(?!)/g, '$1 March $2, \'$3');
	txt.value=txt.value.replace(/()0?4\/(1)\/(\d{2,4})(?!)/g, '$1 April $2, \'$3');
	txt.value=txt.value.replace(/()0?5\/(1)\/(\d{2,4})(?!)/g, '$1 May $2, \'$3');
	txt.value=txt.value.replace(/()0?6\/(1)\/(\d{2,4})(?!)/g, '$1 June $2, \'$3');
	txt.value=txt.value.replace(/()0?7\/(1)\/(\d{2,4})(?!)/g, '$1 July $2, \'$3');
	txt.value=txt.value.replace(/()0?8\/(1)\/(\d{2,4})(?!)/g, '$1 August $2, \'$3');
	txt.value=txt.value.replace(/()0?9\/(1)\/(\d{2,4})(?!)/g, '$1 September $2, \'$3');
	txt.value=txt.value.replace(/()10\/(1)\/(\d{2,4})(?!)/g, '$1 October $2, \'$3');
	txt.value=txt.value.replace(/()11\/(1)\/(\d{2,4})(?!)/g, '$1 November $2, \'$3');
	txt.value=txt.value.replace(/()12\/(1)\/(\d{2,4})(?!)/g, '$1 December $2, \'$3');


// Add a tag to the summary box
 var txt=document.editform.wpSummary;
    var summary = "resolved ]";
	if (txt.value.indexOf(summary) == -1) {
		if (txt.value.match(/?\s*$/)) {
			txt.value += " | ";
		}
		txt.value += summary;
	}
   document.forms.editform.wpMinoredit.checked = true;
//   document.editform.wpDiff.click();
}

//////
function Ohc_US_slash_dates(){
 var txt=document.editform.wpTextbox1;
// resolvable ambiguous date formats

//4-digit year US style
	txt.value=txt.value.replace(/()0?1\/(\d)\/(\d{4})(?!)/g, '$1 January $2, $3');
	txt.value=txt.value.replace(/()0?2\/(\d)\/(\d{4})(?!)/g, '$1 February $2, $3');
	txt.value=txt.value.replace(/()0?3\/(\d)\/(\d{4})(?!)/g, '$1 March $2, $3');
	txt.value=txt.value.replace(/()0?4\/(\d)\/(\d{4})(?!)/g, '$1 April $2, $3');
	txt.value=txt.value.replace(/()0?5\/(\d)\/(\d{4})(?!)/g, '$1 May $2, $3');
	txt.value=txt.value.replace(/()0?6\/(\d)\/(\d{4})(?!)/g, '$1 June $2, $3');
	txt.value=txt.value.replace(/()0?7\/(\d)\/(\d{4})(?!)/g, '$1 July $2, $3');
	txt.value=txt.value.replace(/()0?8\/(\d)\/(\d{4})(?!)/g, '$1 August $2, $3');
	txt.value=txt.value.replace(/()0?9\/(\d)\/(\d{4})(?!)/g, '$1 September $2, $3');
	txt.value=txt.value.replace(/()10\/(\d)\/(\d{4})(?!)/g, '$1 October $2, $3');
	txt.value=txt.value.replace(/()11\/(\d)\/(\d{4})(?!)/g, '$1 November $2, $3');
	txt.value=txt.value.replace(/()12\/(\d)\/(\d{4})(?!)/g, '$1 December $2, $3');

//2-digit year ('00-'19) US style
	txt.value=txt.value.replace(/()0?1\/(\d)\/(\d)(?!)/g, '$1 January $2, 20$3');
	txt.value=txt.value.replace(/()0?2\/(\d)\/(\d)(?!)/g, '$1 February $2, 20$3');
	txt.value=txt.value.replace(/()0?3\/(\d)\/(\d)(?!)/g, '$1 March $2, 20$3');
	txt.value=txt.value.replace(/()0?4\/(\d)\/(\d)(?!)/g, '$1 April $2, 20$3');
	txt.value=txt.value.replace(/()0?5\/(\d)\/(\d)(?!)/g, '$1 May $2, 20$3');
	txt.value=txt.value.replace(/()0?6\/(\d)\/(\d)(?!)/g, '$1 June $2, 20$3');
	txt.value=txt.value.replace(/()0?7\/(\d)\/(\d)(?!)/g, '$1 July $2, 20$3');
	txt.value=txt.value.replace(/()0?8\/(\d)\/(\d)(?!)/g, '$1 August $2, 20$3');
	txt.value=txt.value.replace(/()0?9\/(\d)\/(\d)(?!)/g, '$1 September $2, 20$3');
	txt.value=txt.value.replace(/()10\/(\d)\/(\d)(?!)/g, '$1 October $2, 20$3');
	txt.value=txt.value.replace(/()11\/(\d)\/(\d)(?!)/g, '$1 November $2, 20$3');
	txt.value=txt.value.replace(/()12\/(\d)\/(\d)(?!)/g, '$1 December $2, 20$3');

//2-digit year ('60-'99) US style
	txt.value=txt.value.replace(/()0?1\/(\d)\/(\d)(?!)/g, '$1 January $2, 19$3');
	txt.value=txt.value.replace(/()0?2\/(\d)\/(\d)(?!)/g, '$1 February $2, 19$3');
	txt.value=txt.value.replace(/()0?3\/(\d)\/(\d)(?!)/g, '$1 March $2, 19$3');
	txt.value=txt.value.replace(/()0?4\/(\d)\/(\d)(?!)/g, '$1 April $2, 19$3');
	txt.value=txt.value.replace(/()0?5\/(\d)\/(\d)(?!)/g, '$1 May $2, 19$3');
	txt.value=txt.value.replace(/()0?6\/(\d)\/(\d)(?!)/g, '$1 June $2, 19$3');
	txt.value=txt.value.replace(/()0?7\/(\d)\/(\d)(?!)/g, '$1 July $2, 19$3');
	txt.value=txt.value.replace(/()0?8\/(\d)\/(\d)(?!)/g, '$1 August $2, 19$3');
	txt.value=txt.value.replace(/()0?9\/(\d)\/(\d)(?!)/g, '$1 September $2, 19$3');
	txt.value=txt.value.replace(/()10\/(\d)\/(\d)(?!)/g, '$1 October $2, 19$3');
	txt.value=txt.value.replace(/()11\/(\d)\/(\d)(?!)/g, '$1 November $2, 19$3');
	txt.value=txt.value.replace(/()12\/(\d)\/(\d)(?!)/g, '$1 December $2, 19$3');


// Add a tag to the summary box
 var txt=document.editform.wpSummary;
    var summary = "resolved ]";
	if (txt.value.indexOf(summary) == -1) {
		if (txt.value.match(/?\s*$/)) {
			txt.value += " | ";
		}
		txt.value += summary;
	}
   document.forms.editform.wpMinoredit.checked = true;
//   document.editform.wpDiff.click();
}

function Ohc_UK_slash_dates(){
 var txt=document.editform.wpTextbox1;
// resolvable ambiguous date formats
//4-digit year UK style
	txt.value=txt.value.replace(/(\d)\/0?1\/(\d{4})(?!)/g, '$1 January $2');
	txt.value=txt.value.replace(/(\d)\/0?2\/(\d{4})(?!)/g, '$1 February $2');
	txt.value=txt.value.replace(/(\d)\/0?3\/(\d{4})(?!)/g, '$1 March $2');
	txt.value=txt.value.replace(/(\d)\/0?4\/(\d{4})(?!)/g, '$1 April $2');
	txt.value=txt.value.replace(/(\d)\/0?5\/(\d{4})(?!)/g, '$1 May $2');
	txt.value=txt.value.replace(/(\d)\/0?6\/(\d{4})(?!)/g, '$1 June $2');
	txt.value=txt.value.replace(/(\d)\/0?7\/(\d{4})(?!)/g, '$1 July $2');
	txt.value=txt.value.replace(/(\d)\/0?8\/(\d{4})(?!)/g, '$1 August $2');
	txt.value=txt.value.replace(/(\d)\/0?9\/(\d{4})(?!)/g, '$1 September $2');
	txt.value=txt.value.replace(/(\d)\/10\/(\d{4})(?!)/g, '$1 October $2');
	txt.value=txt.value.replace(/(\d)\/11\/(\d{4})(?!)/g, '$1 November $2');
	txt.value=txt.value.replace(/(\d)\/12\/(\d{4})(?!)/g, '$1 December $2');

//2-digit year ('00-'19) UK style
	txt.value=txt.value.replace(/(\d)\/0?1\/(\d)(?!)/g, '$1 January 20$2');
	txt.value=txt.value.replace(/(\d)\/0?2\/(\d)(?!)/g, '$1 February 20$2');
	txt.value=txt.value.replace(/(\d)\/0?3\/(\d)(?!)/g, '$1 March 20$2');
	txt.value=txt.value.replace(/(\d)\/0?4\/(\d)(?!)/g, '$1 April 20$2');
	txt.value=txt.value.replace(/(\d)\/0?5\/(\d)(?!)/g, '$1 May 20$2');
	txt.value=txt.value.replace(/(\d)\/0?6\/(\d)(?!)/g, '$1 June 20$2');
	txt.value=txt.value.replace(/(\d)\/0?7\/(\d)(?!)/g, '$1 July 20$2');
	txt.value=txt.value.replace(/(\d)\/0?8\/(\d)(?!)/g, '$1 August 20$2');
	txt.value=txt.value.replace(/(\d)\/0?9\/(\d)(?!)/g, '$1 September 20$2');
	txt.value=txt.value.replace(/(\d)\/10\/(\d)(?!)/g, '$1 October 20$2');
	txt.value=txt.value.replace(/(\d)\/11\/(\d)(?!)/g, '$1 November 20$2');
	txt.value=txt.value.replace(/(\d)\/12\/(\d)(?!)/g, '$1 December 20$2');

//2-digit year ('60-'99) UK style
	txt.value=txt.value.replace(/(\d)\/0?1\/(\d)(?!)/g, '$1 January 19$2');
	txt.value=txt.value.replace(/(\d)\/0?2\/(\d)(?!)/g, '$1 February 19$2');
	txt.value=txt.value.replace(/(\d)\/0?3\/(\d)(?!)/g, '$1 March 19$2');
	txt.value=txt.value.replace(/(\d)\/0?4\/(\d)(?!)/g, '$1 April 19$2');
	txt.value=txt.value.replace(/(\d)\/0?5\/(\d)(?!)/g, '$1 May 19$2');
	txt.value=txt.value.replace(/(\d)\/0?6\/(\d)(?!)/g, '$1 June 19$2');
	txt.value=txt.value.replace(/(\d)\/0?7\/(\d)(?!)/g, '$1 July 19$2');
	txt.value=txt.value.replace(/(\d)\/0?8\/(\d)(?!)/g, '$1 August 19$2');
	txt.value=txt.value.replace(/(\d)\/0?9\/(\d)(?!)/g, '$1 September 19$2');
	txt.value=txt.value.replace(/(\d)\/10\/(\d)(?!)/g, '$1 October 19$2');
	txt.value=txt.value.replace(/(\d)\/11\/(\d)(?!)/g, '$1 November 19$2');
	txt.value=txt.value.replace(/(\d)\/12\/(\d)(?!)/g, '$1 December 19$2');

// Add a tag to the summary box
 var txt=document.editform.wpSummary;
    var summary = "resolved ]";
	if (txt.value.indexOf(summary) == -1) {
		if (txt.value.match(/?\s*$/)) {
			txt.value += " | ";
		}
		txt.value += summary;
	}
   document.forms.editform.wpMinoredit.checked = true;
//   document.editform.wpDiff.click();
}

function Ohc_fix_common_errors() {
 var txt=document.editform.wpTextbox1;

// capitalise month names
	txt.value=txt.value.replace(/(\s)jan(|uary|\.)(\s)/g, '$1Jan$2$3');
	txt.value=txt.value.replace(/(\s)feb(|ruary|\.)(\s)/g, '$1Feb$2$3');
	txt.value=txt.value.replace(/(\d\s)mar(|ch|\.)(\s)/g, '$1Mar$2$3');
	txt.value=txt.value.replace(/(\s)mar(|ch|\.)(\s\d)/g, '$1Mar$2$3');
	txt.value=txt.value.replace(/(\s)apr(|il|\.)(\s)/g, '$1Apr$2$3');
	txt.value=txt.value.replace(/(\d\s)may(,|\.)(\s)/g, '$1May$2$3');
	txt.value=txt.value.replace(/(\s)may(|\.)(\s\d)/g, '$1May$2$3');
	txt.value=txt.value.replace(/(\s)jun(|e|\.)(\s)/g, '$1Jun$2$3');
	txt.value=txt.value.replace(/(\s)jul(|y|\.)(\s)/g, '$1Jul$2$3');
	txt.value=txt.value.replace(/(\s)aug(|ust|\.)(\s)/g, '$1Aug$2$3');
	txt.value=txt.value.replace(/(\s)sep(|tember|\.)(\s)/g, '$1Sep$2$3');
	txt.value=txt.value.replace(/(\d{1,2}\s)sept(\s)/g, '$1Sep$2');
	txt.value=txt.value.replace(/(\s)oct(|ober|\.)(\s)/g, '$1Oct$2$3');
	txt.value=txt.value.replace(/(\s)nov(|ember|\.)(\s)/g, '$1Nov$2$3');
	txt.value=txt.value.replace(/(\s)dec(|ember|\.)(\s)/g, '$1Dec$2$3');

//underscore in linked dates - dmy
	txt.value=txt.value.replace(/(\?\d)_(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\]\])/gi, '$1 $2$3');
//underscore in linked dates - mdy
	txt.value=txt.value.replace(/(\?\d\]\])/gi, '$1$2 $3');

//remove leading zero from linked date
	txt.value=txt.value.replace(/(\\])/gi, '$1$2 $3$4');
	txt.value=txt.value.replace(/(\\])/gi, '$1$2 $3$4');

//rem redundant spaces (and commas) in date formats
	txt.value=txt.value.replace(/(\?\d)+(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\]\])?*,*(\?\]?)/gi, '$1 $2$3 $4');
	txt.value=txt.value.replace(/(\+(?\d|30|31)(\]?\]?)(?:*,*)(\?\]?)/gi, '$1$2 $3$4, $5');
	txt.value=txt.value.replace(/(\+(?\d|30|31)(\]?\]?)+(\?\]?)/gi, '$1$2 $3$4, $5');

	txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?:, | of )(\d{3,4})/gi, '$1 $2'); //repeat after delinking

 Ohc_protect_dates_in_titles();
//remove unlinked ordinal date formats
	txt.value=txt.value.replace(/(?:the\s?)?(?\d)(?:th|st|nd|rd|), (?\d)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s?\d)(?:th|st|nd|rd|)(?:\sof\s?)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))()/gi, '$1, $2$3 $4 $5');
	txt.value=txt.value.replace(/(?:the\s?)?(?\d)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s?\d)(?:th|st|nd|rd|)(?:\sof\s?)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))()/gi, '$1$2 $3$4');
	txt.value=txt.value.replace(/(?:the\s?)?(?\d)(?:th|st|nd|rd|)(?:\sof\s?)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\w\d])/gi, '$1 $2$3');
	txt.value=txt.value.replace(/(?:the\s?)?(?\d)(?:th|st|nd|rd|)(?:\sof\s?)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))()/gi, '$1 $2$3');
	txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?:the\s)?(?\d)(?:th|st|nd|rd|),\s(?:the\s)?(?\d)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s)(?:the\s)?(?\d)(?:th|st|nd|rd|)(\|\w\d])/gi, '$1 $2, $3$4 $5$6');
	txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?:the\s)?(?\d)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s)(?:the\s)?(?\d)(?:th|st|nd|rd|)(\|\w\d])/gi, '$1 $2$3$4$5');
	txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?:the\s)?(?\d)(?:th|st|nd|rd)(\|\w\d])/gi, '$1 $2$3');

//fix 'bda' template redirect
	txt.value=txt.value.replace(/{{bda\|(+)}}/gi, '{{birth date and age|$1}}');

//zap redundant templates ('date', 'as of', 'English', '#dateformat:') 
	txt.value=txt.value.replace(/\{\{date\|(+)(?:+)?\}\}/gi, '$1');
	txt.value=txt.value.replace(/{{#dateformat:(+)(?:\|dmy|\|mdy)?}}/gi,'$1'); 

}

function Ohc_protect_dates_in_titles(){
 var txt=document.editform.wpTextbox1;

//permanent protection for dmy dates within images
	txt.value=txt.value.replace(/((?:file|image|img)*{1,30})\s(?\d|30|31)(th|st|nd|rd|)(\sof)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(,)?(\s(?:\d{3,4}))?/gi, '$1_$2$3$4_$5$6$7');
	txt.value=txt.value.replace(/(\((?:file|image|img)*?\d)(th|st|nd|rd|)(\sof)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(,)?(\s(?:\d{3,4}))?/gi, '$1$2$3_$4$5_$6$7');

	txt.value=txt.value.replace(/(?\d|30|31)(th|st|nd|rd|)(\sof)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(,)?\s(\d{3,4})(\.jpe?g)/gi, '$1$2$3_$4$5_$6$7');
	txt.value=txt.value.replace(/(?\d|30|31)(th|st|nd|rd|)(\sof)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\.jpe?g)/gi, '$1$2$3_$4$5');

//protect dmy date formats within titles of citation templates
	txt.value=txt.value.replace(/(\|*(?:title|work|quote)*=*)((?:?\d)(?:th|st|nd|rd|),?(?:\sof)?)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))({0,30}\|)/gi, '$1$2&nbsp;$3$4');
//blockquotes
	txt.value=txt.value.replace(/(<blockquote>+?)((?:?\d)(?:th|st|nd|rd|),?(?:\sof)?)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(,)?\s?(\d{1,4})?(+?<\/blockquote>)/g, '$1$2&nbsp;$3$4');

 
//permanent protection for mdy dates within images
	txt.value=txt.value.replace(/((?:file|image|img)*{1,60})\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s(?\d|30|31)(th|st|nd|rd|)(,)?(\s(?:\d{3,4}))?/gi, '$1_$2$3_$4$5$6$7');
	txt.value=txt.value.replace(/((?:file|image|img)*)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s(?\d|30|31)(th|st|nd|rd|)(,)?(\s(?:\d{3,4}))?/gi, '$1$2$3_$4$5$6$7'); //re-enabled 13 Aug 2010
	txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s(?\d|30|31)(th|st|nd|rd|)(,)?\s(\d{3,4})(\.(?:png|jpe?g))/gi, '$1$2_$3$4$5_$6$7');
	txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s(?\d|30|31)(th|st|nd|rd|)(\.png|\.jpe?g)/gi, '$1$2_$3$4$5');

//protect mdy date formats within titles of citation templates
	txt.value=txt.value.replace(/(\|*(?:title|work|quote|chapter)*=+?)()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s((?:?\d)(?:th|st|nd|rd|))()/gi, '$1$2$3$4&nbsp;$5$6');
//blockquotes
	txt.value=txt.value.replace(/(<blockquote>+?)()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s((?:?\d)(?:th|st|nd|rd|),?)\s(\d{1,4})(+?<\/blockquote>)/g, '$1$2$3$4&nbsp;$5&nbsp;$6$7');

 
}


function Ohc_code_delink_dates() {
 var txt=document.editform.wpTextbox1;
 Ohc_protect_dates ();
 Ohc_fix_common_errors();
//delink ISO8601 dates
	txt.value=txt.value.replace(/\\d-\d)\]\]/gi, '$1');
	txt.value=txt.value.replace(/\\]-\\d-\d)\]\]/gi, '$1-$2');
	txt.value=txt.value.replace(/(\d{4})-\\d-\d)\]\]/gi, '$1-$2');
	txt.value=txt.value.replace(/\\]-(\d-\d)/gi, '$1-$2');

//delink full dates - dmy
	txt.value=txt.value.replace(/(?:the\s)?\?\d)(?:th|st|nd|rd|)(?:of)?(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\]\]/gi, '$1 $2');  

//delink single md or 'm the dth'
	txt.value=txt.value.replace(/\(?:the)?(?\d)(?:th|st|nd|rd|)\]\]()/gi, '$1 $2$3');

//Month+day_number "]th" -> "March 7"
	txt.value=txt.value.replace(/\?\d)\]\](?:th|st|nd|rd)/gi, '$1');

//removal of 'year in foo' in full dates (with or without links) with incorrect ']'
	txt.value=txt.value.replace(/(\|)\]?\]?),\s\]{1,32}\]\]/gi, '$1 $2');
	txt.value=txt.value.replace(/(\|)\]?\]?),\s{{(?:avyear|by|fy|ly|mlb|scy|sdy)\|(\d{1,4})}}/gi, '$1 $2');
	txt.value=txt.value.replace(/(\|)\s(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\]?\]?)\s\]{1,32}\]\]/gi, '$1 $2');
	txt.value=txt.value.replace(/(\|)\s(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\]?\]?)\s{{(?:avyear|by|fy|ly|mlb|scy|sdy)\|(\d{1,4})}}/gi, '$1 $2');

//month+day+year piped pseudo-ISO dates
	txt.value=txt.value.replace(/\?\d|30|31)\|?\d-?\d\]\]-(?:\\d\d\d)(\|\d{2,4})?(?:\]\])?/gi, '$1$2, $3');
	txt.value=txt.value.replace(/\\d\s(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))\|?\d-?\d\]\]-(?:\\d{3})(\]\])?/gi, '$1 $2');

//month+day piped
	txt.value=txt.value.replace(/(?:the\s)?\(?:of)?(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\|(]{1,30})\]\]/gi, '$1');

 //']Xyyyy ' to 'month day, year'
	txt.value=txt.value.replace(/\\].(\d{3,4})/gi, '$1 $2, $3'); 
 //']Xyyyy' to 'day month year'
	txt.value=txt.value.replace(/\\].(\d{3,4})/gi, '$1 $2 $3'); 

// century
	txt.value=txt.value.replace(/\\]/gi, '$1$2$3');
	txt.value=txt.value.replace(/\(?:century|centuries)(?:\sAD|\sBC|\sCE|\sBCE|)\|(]{1,30})\]\]/gi, '$1');
	txt.value=txt.value.replace(/\)(century|centuries)(\sAD|\sBC|\sCE|\sBCE|)\]\]/gi, '$1$2$3');
	txt.value=txt.value.replace(/\(?:century|centuries)(?:\sAD|\sBC|\sCE|\sBCE|)\|(]{1,30})\]\]/gi, '$1');

// months
	txt.value=txt.value.replace(/\\]/gi, '$1');
	txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1');

// decades and years
	txt.value=txt.value.replace(/\\]/g, '$1s');
	txt.value=txt.value.replace(/\]{1,30})\]\]/g, '$1');
	txt.value=txt.value.replace(/\\]/gi, '$1$2 $3');
	txt.value=txt.value.replace(/\?)(AD|BC|CE|BCE|)\]\]/gi, '$1$2');
	txt.value=txt.value.replace(/\?)(\d{1,4})\]\]/gi, '$3$2$1');
	txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1');
	txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1');

//month+year
//Identify surprise or 'Easter egg' diversions linking month+years to year articles. Turn them into month+year links to be dealt with below
	txt.value=txt.value.replace(/\]+\|((?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s\d{3,4})\]\]/gi, '$1');
	txt.value=txt.value.replace(/\\]/gi, '$1');
	txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1');

//removed piped years when in full date
	txt.value=txt.value.replace(/(\\],?\s?\]{1,32}\|(\d{1,4}\]\])/gi, '$1$2');
	txt.value=txt.value.replace(/(\\],?\s?\]{1,32}\|(\d{1,4}\]\])/gi, '$1$2');

//Identify surprise or 'Easter egg' diversions linking months to year articles.
	txt.value=txt.value.replace(/\]+\|(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\]\]/gi, '$1');

// month and day piped
	txt.value=txt.value.replace(/(\d{4,4}-)\\d{1,2}(?:th|st|nd|rd|)\|(\d-)(\d)\]\]/gi, '$10$20$3');
	txt.value=txt.value.replace(/(\d{4,4}-)\\d{1,2}(?:th|st|nd|rd|)\|(\d\d-)(\d)\]\]/gi, '$1$20$3');
	txt.value=txt.value.replace(/(\d{4,4}-)\\d{1,2}(?:th|st|nd|rd|)\|(\d-)(\d\d)\]\]/gi, '$10$2$3');
	txt.value=txt.value.replace(/\\d{1,2}(?:th|st|nd|rd|)\|(]{1,30})\]\]/gi, '$1');
	txt.value=txt.value.replace(/\(?:of)?(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\|(]{1,30})\]\]/gi, '$1');
	txt.value=txt.value.replace(/\\]/gi, '$1');

//4 digit years piped
	txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1');

	txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?:, | of )(\d{3,4})/gi, '$1 $2'); //repeat removal of commas and 'of' between month and year

//double/triple spaces
	txt.value=txt.value.replace(/(?:   ?)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))/gi, ' $1');
	txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(   ?)/gi, '$1 ');

// spaces and commas - mdy birth and death date ranges
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31),? (\d{1,3}|?\d{3})(?:**)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31),? (\d{1,3}|?\d{3})()/gi, '$1$2 $3, $4 – $5 $6, $7$8');
//dmy birth and death date ranges)
	txt.value=txt.value.replace(/()(?\d|30|31)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),? (\d{1,3}|?\d{3})(?:\s?\s?)(?\d|30|31)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),? (\d{1,3}|?\d{3})()/gi, '$1$2 $3 $4 – $5 $6 $7$8');

}

function Ohc_delink_ISO_to_dmy() {
    var txt = document.editform.wpTextbox1;
 
    txt.value = yyyymmdd_to_dmy(txt.value);  // See User:Plastikspork/datetools.js
	txt.value=txt.value.replace(/()(\d{4}-\d\d-\d\d)(<\s?\/ref.*?>)/g, '$1$2 $3');

//code to convert ref ISO-dates outside citation templates
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-01-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 January $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-02-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 February $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-03-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 March $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-04-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 April $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-05-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 May $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-06-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 June $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-07-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 July $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-08-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 August $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-09-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 September $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-10-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 October $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-11-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 November $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-12-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 December $3$5$6');
 
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-01-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 January $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-02-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 February $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-03-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 March $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-04-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 April $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-05-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 May $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-06-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 June $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-07-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 July $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-08-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 August $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-09-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 September $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-10-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 October $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-11-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 November $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-12-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 December $3$5$6'); 

    Ohc_remove_leading_zeros_from_nonlinked_dates ();   
 
}
 
function Ohc_delink_ISO_to_mdy() {
    var txt = document.editform.wpTextbox1;
 
    txt.value = yyyymmdd_to_mdy(txt.value);  // See User:Plastikspork/datetools.js    
	txt.value=txt.value.replace(/()(\d{4}-\d\d-\d\d)(<\s?\/ref.*?>)/g, '$1$2 $3');

//code to convert ref ISO-dates outside citation templates
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-01-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2January $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-02-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2February $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-03-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2March $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-04-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2April $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-05-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2May $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-06-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2June $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-07-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2July $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-08-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2August $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-09-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2September $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-10-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2October $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-11-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2November $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-12-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2December $4, $3$5$6');
 
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-01-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2January $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-02-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2February $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-03-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2March $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-04-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2April $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-05-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2May $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-06-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2June $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-07-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2July $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-08-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2August $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-09-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2September $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-10-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2October $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-11-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2November $4, $3$5$6');
	txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-12-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2December $4, $3$5$6'); 

    Ohc_remove_leading_zeros_from_nonlinked_dates ();  
}
 
 
function Ohc_delink_year_in_X(){
 var txt=document.editform.wpTextbox1;

	txt.value=txt.value.replace(/{{(?:avyear|by|baseball\syear|fy|ly|mlby|mlb\syear|scy|sdy)\|(\d{1,4})}}/gi, '$1');
	txt.value=txt.value.replace(/{{(?:avyear|by|baseball\syear|fy|ly|mlby|mlb\syear|scy|sdy)\|(?:\d{1,4})\|(\d{1,4})}}/gi, '$1');
	txt.value=txt.value.replace(/\+\|(\d{1,4})\]\]/gi, '$1');
	txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1');

	txt.value=txt.value.replace(/\\]/gi, '$1$2');


}

var linkmap=;
function Ohc_protect_dates(){
 var txt=document.editform.wpTextbox1;
	txt.value=txt.value.replace(/Image:+/gi, function(img){
        linkmap.push(img);
        return "\x02"+(linkmap.length-1)+"\x03";
    });
//protect certain dates 
	txt.value=txt.value.replace(/(\[\[4)(AD)/gi, '$1♫$2');
	txt.value=txt.value.replace(/(March )((?:8|14) Alliance)/gi, '$1♫$2');
	txt.value=txt.value.replace(/(6th\sof\s)(October City)/gi, '$1♫$2');
	txt.value=txt.value.replace(/(\\])/gi, '$1 in France|May 1968$2');
	txt.value=txt.value.replace(/(\\])/gi, '$1♫$2'); //June 1, 1974 is the name of an album
	txt.value=txt.value.replace(/(\'\'June )(1, 1974\'\')/gi, '$1♫$2'); 
	txt.value=txt.value.replace(/(\\])/gi, '$1♫$2');
}
 
function Ohc_unprotect_dates(){
 var txt=document.editform.wpTextbox1;

//unprotect certain dates
	txt.value=txt.value.replace(/(\[\[4)♫(AD)/gi, '$1♫$2');
	txt.value=txt.value.replace(/(\[\[(?:8|14))♫(March Alliance)/gi, '$1$2');
	txt.value=txt.value.replace(/(6th\sof\s)♫(October City)/gi, '$1$2');
	txt.value=txt.value.replace(/(June )♫(1, 1974)/gi, '$1$2');
	txt.value=txt.value.replace(/(\\])/gi, '$1 $2');
	txt.value=txt.value.replace(/(\w)♫(\w)/g, '$1$2');	//2010-10-06 quick patch to remove any spurious protection markers
	txt.value=txt.value.replace(/\x02(+)\x03/g, function(x, n){
        return linkmap;
    });
}

function Ohc_remove_leading_zeros_from_nonlinked_dates () {
 var txt=document.editform.wpTextbox1;
//remove leading zero from nonlinked date
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s0(\d)(?:th|st|nd|rd|),?\s(\d{4})(|*\r)/gi, '$1$2 $3, $4$5');
	txt.value=txt.value.replace(/()0(\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(\d{4})(|*\r)/gi, '$1$2 $3 $4$5');

	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s0(\d)(?:th|st|nd|rd|)(|*\r)/gi, '$1$2 $3$4');
	txt.value=txt.value.replace(/()0(\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$2 $3$4');

}


function Ohc_dates_to_dmy(){
 var txt=document.editform.wpTextbox1;
// insert 'dmy' template
	txt.value=txt.value.replace(/{{(use (dmy|mdy) dates|mdy)(\|*)?}}/gi, '{{Use dmy dates|date=November 2010}}');
  if (txt.value.search(/{{use dmy dates|date=November 2010}}/gi) == -1)
  {
	txt.value='{{Use dmy dates|date=November 2010}}\r\n'+txt.value;
  }

 Ohc_code_delink_dates();
//repeat protect dates because 'unprotect dates' function is within 'delink dates' function
 Ohc_protect_dates();

//change start and end templates
	txt.value=txt.value.replace(/({{(start\sdate|end\sdate)*\|)df=ye?s?\|(*df=ye?s?)/gi, '$1$2');

//change deprecated birth and death templates
	txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)*)\|mf=ye?s?/gi, '$1');
	txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)*\|)/gi, '$1df=yes|');
	txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)*\|)df=ye?s?\|(*df=ye?s?)/gi, '$1$2');

//convert mdy-mdy to dmy-dmy (birth and death date ranges)
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31), (?\d{0,3})(?:\s?\s?)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31), (?\d{0,3})()/gi, '$1$3 $2 $4 – $6 $5 $7$8');

//convert md-mdy date ranges to dm-dmy
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){0,6}),?(\/|\s?\s?|\s(?:and|to|&)\s)(?\d|30|31)(?:th|st|nd|rd|),?\s(?:of\s)?(\d{3,4})/gi, '$1$3$4$5$6 $2 $7');
//test code	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){0,6}),? (?\d|30|31)(?:th|st|nd|rd|),?\s(?:of\s)?(\d{3,4})/gi, '$1$3$4, $5 $2$6');
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){0,6}), (?\d|30|31)(?:th|st|nd|rd|)(|*\r)/gi, '$1$3$4, $5 $2$6');

//convert md,d,d, date ranges to d,d,dm  (multiple, separated by commas)
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){0,6}),?(\/|\s?\s?|\s(?:and|to|&)\s)(?\d|30|31)(?:th|st|nd|rd|)(|*\r)/gi, '$1$3$4$5$6 $2$7');
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))((?:\s?\d(?:th|st|nd|rd|),?){1,6})(\s(?:and|to|&)\s)(?\d|30|31)(?:th|st|nd|rd|)(|*\r)/gi, '$1$3$4$5 $2$6');
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){1,6})(|*\r)/gi, '$1$3$4 $2$5');
//convert md date ranges to dm  (simple, separated by hyphens and dashes  or 'to')
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|)(\s?\s?|\sto\s)(?\d|30|31)(?:th|st|nd|rd|)(|*\r)/gi, '$1$3 $4$5 $2$6');

//'md, md,' to 'dm, dm,'
	txt.value=txt.value.replace(/()( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))( ?\d|30|31),( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))( ?\d|30|31)()/gi, '$1$3$2,$5$4,$6'); 

//convert simple mdy dates to dmy
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31)(?:th|st|nd|rd|),?\s(\d{1,4}\s?(?:AD|BC|CE|BCE))/gi, '$1$3 $2 $4');
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31)(?:th|st|nd|rd|),?\s(\d{3,4})(|*\r)/gi, '$1$3 $2 $4$5');
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31)(?:th|st|nd|rd|)(|*\r)/gi, '$1$3 $2$4');
//Repeat line to capture some instances that get missed first time 
//(needed because the date component 'September 19, 1881' within the string 'March 4-September 19, 1881' is blocked from conversion by the '4')
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31)(?:th|st|nd|rd|),?\s(\d{1,4})(|*\r)/gi, '$1$3 $2 $4$5');

//Month+day_number " 7th March" -> "7 March"
	txt.value=txt.value.replace(/()(?\d|30|31)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(\d{1,4})(|*\r)/gi, '$1$2 $3 $4$5');
	txt.value=txt.value.replace(/()(?\d|30|31)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$2 $3$4');

 Ohc_remove_leading_zeros_from_nonlinked_dates ();
//remove comma in International date format
	txt.value=txt.value.replace(/(?\d)(?:th|st|nd|rd|)\s(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?),?\s?(\d{3,4})()/gi, '$1 $2 $3$4');

 Ohc_unprotect_dates();

}

function Ohc_dates_to_mdy(){
 var txt=document.editform.wpTextbox1;
// insert 'mdy' template
	txt.value=txt.value.replace(/{{(use (dmy|mdy) dates|dmy)(\|*)?}}/gi, '{{Use mdy dates|date=November 2010}}');
  if (txt.value.search(/{{use mdy dates|date=November 2010}}/gi) == -1)
  {
	txt.value='{{Use mdy dates|date=November 2010}}\r\n'+txt.value;
  }

 Ohc_code_delink_dates();
//repeat protect dates because 'unprotect dates' function is within 'delink dates' function
 Ohc_protect_dates();

//change deprecated birth and death templates
	txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)*)\|df=ye?s?/gi, '$1');
//	txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)*\|)/gi, '$1mf=yes|');
	txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)*\|)mf=ye?s?\|(*mf=ye?s?)/gi, '$1$2');

//convert dmy-dmy to mdy-mdy (birth and death date ranges)
	txt.value=txt.value.replace(/()(?\d|30|31)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),? (?\d{0,3})(?:\s?\s?)(?\d|30|31)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),? (?\d{0,3})()/gi, '$1$3 $2, $4 – $6 $5, $7$8');

//convert dm-dmy date ranges to md-mdy
	txt.value=txt.value.replace(/()((?:?\d)(?:th|st|nd|rd|),\s){0,6}(?\d|30|31)(?:th|st|nd|rd|)(\/|{0,3}(?:and|to|&|-|–){0,3})(?\d|30|31)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(\d{3,4})/gi, '$1$6 $2$3$4$5, $7');

//convert d,d,dm date ranges to md,d,d  (multiple, separated by commas)
	txt.value=txt.value.replace(/()((?:?\d(?:th|st|nd|rd|),?\s){0,6})(?\d|30|31)(?:th|st|nd|rd|)(\/|{0,3}(?:and|to|&|-|–){0,3})(?\d|30|31)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$6 $2$3$4$5$7');
	txt.value=txt.value.replace(/()((?:?\d(?:th|st|nd|rd|),?{1,3}){1,6})(?\d|30|31)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$4 $2$3$5');
//convert dm date ranges to md  (simple, separated by hyphen, dash or 'to')
	txt.value=txt.value.replace(/()(?\d|30|31)(?:th|st|nd|rd|)({0,3}{0,3}|\sto{0,3})(?\d|30|31)(?:th|st|nd|rd|){1,3}(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$5 $2$3$4$6');

//'dm, dm,' to 'md, md,'
	txt.value=txt.value.replace(/()( ?\d|30|31)( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))),( ?\d|30|31)( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))(?)/gi, '$1$3$2,$5$4,$6'); 

	txt.value=txt.value.replace(/()(?\d|30|31)(?:th|st|nd|rd|){1,3}(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),?\s(\d{1,4}\s?(?:AD|BC|CE|BCE))/gi, '$1$3 $2, $4');
	txt.value=txt.value.replace(/()(?\d|30|31)(?:th|st|nd|rd|){1,3}(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),?\s(\d{3,4})(|*\r)/gi, '$1$3 $2, $4$5');
	txt.value=txt.value.replace(/()(?\d|30|31)(?:th|st|nd|rd|){1,3}(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$3 $2$4');

//repeat previous two bits of code to capture some date ranges that were missed first time round
//	txt.value=txt.value.replace(/()(?\d|30|31)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(\d{1,4})(|*\r)/gi, '$1$3 $2, $4$5');
//	txt.value=txt.value.replace(/()(?\d|30|31)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$3 $2$4');

//Month+day_number "March 7th" -> "March 7"
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31)(?:th|st|nd|rd)(|*\r)/gi, '$1$2 $3$4');

//add comma when missing
	txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d|30|31)(?:th|st|nd|rd|)(\s\d{1,4})/gi, '$1$2 $3,$4');

 Ohc_remove_leading_zeros_from_nonlinked_dates ();
 Ohc_unprotect_dates();

}

function Ohc_MOSNUM_edit_summary(){
// Add a tag to the summary box
 var txt=document.editform.wpSummary;
    var summary = "] by ]";
	if (txt.value.indexOf(summary) == -1) {
		if (txt.value.match(/?\s*$/)) {
			txt.value += ", ";
		}
		txt.value += summary;
	}
	document.forms.editform.wpMinoredit.checked = true;
	document.editform.wpDiff.click();
}

function yyyymmdd_to_dmy(str) {
// This code from User:Plastikspork/datetools.js
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 January $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 February $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 March $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 April $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 May $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 June $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 July $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 August $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 September $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 October $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 November $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 December $2');

	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 January $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 February $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 March $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 April $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 May $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 June $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 July $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 August $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 September $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 October $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 November $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 December $2');
  return str;
}

function yyyymmdd_to_mdy(str) {
// This code from User:Plastikspork/datetools.js
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1January $3, $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1February $3, $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1March $3, $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1April $3, $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1May $3, $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1June $3, $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1July $3, $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1August $3, $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1September $3, $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1October $3, $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1November $3, $2');
	str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1December $3, $2');

	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1January $3, $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1February $3, $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1March $3, $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1April $3, $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1May $3, $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1June $3, $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1July $3, $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1August $3, $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1September $3, $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1October $3, $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1November $3, $2');
	str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1December $3, $2');
  return str;
}

function Ohc_all_dates_to_dmy() {
  Ohc_dates_to_dmy();
  Ohc_delink_ISO_to_dmy();
  Ohc_delink_year_in_X();
  Ohc_MOSNUM_edit_summary();
}

function Ohc_all_dates_to_mdy() {
  Ohc_dates_to_mdy();
  Ohc_delink_ISO_to_mdy();
  Ohc_delink_year_in_X();
  Ohc_MOSNUM_edit_summary();
}

function Ohc_body_to_dmy() {
  Ohc_dates_to_dmy();
  Ohc_MOSNUM_edit_summary();
}

function Ohc_body_to_mdy() {
  Ohc_dates_to_mdy();
  Ohc_MOSNUM_edit_summary();
}

function Ohc_ISO_to_dmy() {
  Ohc_delink_ISO_to_dmy();
//  Ohc_MOSNUM_edit_summary();
}

function Ohc_ISO_to_mdy() {
  Ohc_delink_ISO_to_mdy();
//  Ohc_MOSNUM_edit_summary();
}

addOnloadHook(function () {
 if(document.forms.editform) {
  addPortletLink('p-tb', 'javascript:Ohc_all_dates_to_dmy()', 'ALL dates to dmy', 'ca-unitfixer', 'Align all dates to dmy', '', '');
  addPortletLink('p-tb', 'javascript:Ohc_all_dates_to_mdy()', 'ALL dates to mdy', 'ca-unitfixer', 'Align all dates to mdy', '', '');
  addPortletLink('p-tb', 'javascript:Ohc_body_to_dmy()', 'Body dates to dmy', 't-dmy', 'day month', '', '');
  addPortletLink('p-tb', 'javascript:Ohc_body_to_mdy()', 'Body dates to mdy', 't-mdy', 'month day', '', '');
  addPortletLink('p-tb', 'javascript:Ohc_ISO_to_dmy()', 'ISO to dmy', 't-ISOdmy', 'ISO day month', '', '');
  addPortletLink('p-tb', 'javascript:Ohc_ISO_to_mdy()', 'ISO to mdy', 't-ISOmdy', 'ISO month day', '', '');
  addPortletLink('p-tb', 'javascript:Ohc_delink_year_in_X()'  , 'Del year-in-X dates', 't-yearinX',  'Year in X', '', '');
  addPortletLink('p-tb', 'javascript:Ohc_unambiguous_dates()', 'unambiguous dates', 't-slash', 'resolves slash date format', '', '');
  addPortletLink('p-tb', 'javascript:Ohc_US_slash_dates()', 'US-slash dates', 't-US', 'US-slash', '', '');
  addPortletLink('p-tb', 'javascript:Ohc_UK_slash_dates()', 'UK-slash dates', 't-UK', 'UK-slash', '', '');
  }
});