Opmerking: nadat u de wijzigingen hebt gepubliceerd is het wellicht nodig uw browsercache te legen.

  • Firefox / Safari: houd Shift ingedrukt terwijl u op Vernieuwen klikt of druk op Ctrl-F5 of Ctrl-R (⌘-Shift-R op een Mac)
  • Google Chrome: druk op Ctrl-Shift-R (⌘-Shift-R op een Mac)
  • Internet Explorer / Edge: houd Ctrl ingedrukt terwijl u op Vernieuwen klikt of druk op Ctrl-F5
  • Opera: druk op Ctrl-F5.
//<pre><nowiki>

/*
****************************************************************************************
*             !!! Dit script wordt voor allerlei experimenten gebruikt !!!             *
*    Zie http://nl.wikipedia.org/w/index.php?title=Gebruiker:RonaldB/verwlijst.js      *
*       voor een geteste en stabiele versie voor nominatie- en sjabloonplaktools       *
****************************************************************************************
*/
 
/* 
General description
The script is triggered by the well-known event handlers. Although the event handler for a deletion page is somewhat special.
The transfer to the deletion list of a pagename is accomplished by adding a parameter "delpagename" to the url. This is because a copy/paste via the clipboard only works for IE and is blocked in FF for security reasons. Hence the two different event handlers.

1. Normal page
When a page is in edit mode, the function addButtons defines the extra buttons and adds those to the document. This function also tests wether a template is already present in the text area. Finally this function takes care of the modified special chars.
When one of the extra buttons is clicked (via the onclick event defined in function createbtn), the addremovetemplate function is called
The addremovetemplate function adds or removes a template to/from the text area and keeps track of the changes in the remark field. It also enables or disables the ++ button, depending on wether an edit on the delete list is required.
Note: the extra buttons are disabled after a timeout of no activity. This is a precaution for the rare case the page is called just before midnight.

2. Deletion list
Clicking the ++ button saves the page, but also triggers the function openDellist, which subsequently calls the function newwin.
The newwin function opens the deletion list (subpage) in a new window. If that window is already existing, it will get the focus (brought to foreground).
The url called by that window is appended by the "delpagename" parameter, which existence triggers the eventhandler, which is calling the funtion addPage2dellist
This function is appending the page title to the text area. The function positioncursor is called subsequently in order to get the focus and the cursor at the right position

3. Miscellaneous functions
Function utc2cet takes care of the conversion of the server time (derived from the initial page) to CET or CEST.
The lay-out of the special character field is modified in order to improve the user friendliness. Functions sc and scs are used for that purpose.


Extra bonus functions (can be deselected):
* Improved special chars layout (to deselect add: var noSC = true)
* GoogleTab, enabling search on any selected (hilighted) text. 
	Searches on literal string, contrary to similar FF and OP functionalities. (to deselect add: var noGoogleTab = true)
* Extra Google search function in sidebar. Searches in nl.wikipedia domain (to deselect add: var noGoogleSearch = true)
In order to deselect the main functionality add: var noButtons = true)


The script has been tested with following browsers:
IE(5.0/6.0), MZ(1.7.6), FF(1.0), OP(7.5/9.0)

*/


//****************
//Parameter vars *
//****************
var imgAddBefore = escape('==Direct te verwijderen==')	//'%3D%3DDirect%20te%20verwijderen%3D%3D'
var catAddBefore = escape('==Kandidaten directe verwijdering==')	//'%3D%3DKandidaten%20directe%20verwijdering%3D%3D'
var templAddBefore = escape('==Kandidaten directe verwijdering==')	//'%3D%3DKandidaten%20directe%20verwijdering%3D%3D'
if (typeof(testmode)=='undefined') var testmode = false


//*************
//Global vars *
//*************
var srvrds
var srvryyyy, srvrmm, srvrdd
var pagetitle
var dellisturl
var delpagename
var delreason

var btnprops = new Array()
var btnsub = new Array()
var popbtns = new Array()



//****************
//Event handlers *
//****************

if (typeof(noGoogleTab)=='undefined') var noGoogleTab = false
if (!noGoogleTab) {
	if (window.addEventListener)
		window.addEventListener('load', addGoogleTab, false);
	else if (window.attachEvent)
		window.attachEvent('onload', addGoogleTab);
}

if (typeof(noGoogleSearch)=='undefined') var noGoogleSearch = false
if (!noGoogleSearch) {
	if (window.addEventListener)
		window.addEventListener('load', addGoogleSearch, false);
	else if (window.attachEvent)
		window.attachEvent('onload', addGoogleSearch);
}

if(location.href.match(/delpagename=(.+)/)) {
	delpagename=decodeurl(RegExp.$1).split('&')[0]
	delreason=decodeurl(RegExp.$1).split('&delreason=')[1]
	if (window.addEventListener)
		window.addEventListener('load', addPage2dellist, false);
	else if (window.attachEvent)
		window.attachEvent('onload', addPage2dellist);
} else if(location.href.match(/action=(edit)|(submit)/)) {
	if (window.addEventListener) {
		window.addEventListener('load', addButtons, false);
	} else if (window.attachEvent) {
		window.attachEvent('onload', addButtons);
	}
}

if (typeof(noSC)=='undefined') var noSC = false
if (typeof(noButtons)=='undefined') var noButtons = false



function addGoogleTab() {
	var tag = document.getElementById('ca-watch')
	if (!tag) var tag = document.getElementById('ca-unwatch')

	if (tag) {
		var li=document.createElement('li')
		li.innerHTML='<a href=\"javascript:openGoogle()\" title=\"Selecteer een stuk tekst en zoek hiermee in Google\">Google</a>'
		tag.parentNode.insertBefore(li,null)
	}
}



function addGoogleSearch() {
	var tag = document.getElementById('searchBody')

	if (tag) {
		var srchbtn=document.createElement('input')
		with (srchbtn) {
			type='button'
			style.width= '90%'
			className = 'searchButton'
			value = 'Zoek met Google'
		}

		if (srchbtn.addEventListener) {
			srchbtn.addEventListener('click', searchGoogle, false);
		} else if (srchbtn.attachEvent) {
			srchbtn.attachEvent('onclick', searchGoogle);
		}

		tag.insertBefore(srchbtn,null)
	}
}



//*****************************************************
//Functions used to add/remove templates on edit page *
//*****************************************************
function addButtons() {
var ss
	//return if this happens not to be an edit page (extra check via existence of specchars)
	if (!document.getElementById('specialchars')) return false

	if (document.editform) {
		if (document.editform.wpStarttime) {
			utc2cet()
			setTimeout(disablebtn,300000)	//5 minutes grace time (to ensure correct date for deletion subpage around midnight)
		}

		//get page title
		if (ss=/title\=(.*)&action/.exec(location.href))
			pagetitle=ss[1]

		//sort out which page type is to be edited, note that template for template needs to be placed on talk page
		if (/^(Afbeelding:)|(Image:)|(Bestand:)|(File:)/i.exec(pagetitle))
			setbtnprops('image')
		else if (/^(Categorie:)|(Category:)/i.exec(pagetitle))
			setbtnprops('cat')
		else if (/^(Overleg_sjabloon:)|(Overleg_template:)/i.exec(pagetitle))
			setbtnprops('template')
		else if (/^(Overleg_gebruiker:)|(Overleg_user:)/i.exec(pagetitle))
			setbtnprops('user')
		else
			setbtnprops('article')

		//rewrite the special chars area
		document.getElementById('specialchars').style.textAlign='left'
		document.getElementById('specialchars').title=''
		document.getElementById('specialchars').innerHTML='<table cellpading=0 cellspacing=0 border=0><tr><td align=center valign=top><div id=btngrp></div></td><td Style=\"padding:0px 2em;color:#00a;\" valign=top title="Speciale tekens worden op de plaats van de cursor ingevoegd">'+(noSC? document.getElementById('specialchars').innerHTML: scs())+'</td></tr></table>'

		if (!noButtons) {
			addButtonSpecial()
			refreshButtons()
		}
		return false; 
	}
}


function setbtnprops(edittype) {
	//This function set properties of new buttons
	//first element in btnprops[n] array: template name
	//second element in array: true if edit on delete list may be required
	//third element in array: true if template to be added at end of text area
	//dellisturl: url of delete list for articles, images, etc. 
	btnprops.length=0
	btnsub.length=0
	if (edittype=='article') {
		btnprops[0] = new Array('wiu',true)
		btnprops[1] = new Array('weg',true)
		btnprops[2] = new Array('auteur',true)
		btnprops[3] = new Array('reclame',true)
		btnprops[4] = new Array('wb',true)
		btnprops[5] = new Array('##')
		btnprops[6] = new Array('beginnetje',false,true)
		btnprops[7] = new Array('nocat',false)
		btnprops[8] = new Array('wikify',false)
		btnprops[9] = new Array('twijfel',false)
		btnprops[10] = new Array('NPOV',false)
		btnsub[1] = new Array('Niet encyclopedisch')
		var lv = new Array('landen & volken','land=')
		btnsub[6] = new Array('geografie',lv,'steden','geschiedenis','oudheid','middeleeuwen','nieuwste tijd','kunst & cultuur','muziek','literatuur','##','mens & maatschappij','dagelijks leven','economie','film','media','politiek','religie','sport','voetbal','taal','##','wetenschap & technologie','biologie','filosofie','geneeskunde','informatica','natuurkunde','scheikunde','verkeer & vervoer','openbaar vervoer','wiskunde')
		dellisturl = 'http://nl.wikipedia.org/w/index.php?title=Wikipedia:Te_beoordelen_pagina%27s/Toegevoegd_'+srvryyyy+srvrmm+srvrdd+'&action=edit'
	} else if (edittype=='image') {
		btnprops[0] = new Array('afbweg',true)
		btnprops[1] = new Array('geeninfo',true)
		btnprops[2] = new Array('afbauteur',true)
		btnprops[3] = new Array('fairuse',true)
		btnprops[4] = new Array('GeenOTRS',true)
		dellisturl = 'http://nl.wikipedia.org/w/index.php?title=Wikipedia:Te_beoordelen_afbeeldingen/Toegevoegd_'+srvryyyy+srvrmm+srvrdd+'&action=edit'
	} else if (edittype=='cat') {
		btnprops[0] = new Array('catweg',true)
		dellisturl = 'http://nl.wikipedia.org/w/index.php?title=Wikipedia:Te_beoordelen_categorieën&action=edit&addbefore='+catAddBefore
	} else if (edittype=='template') {
		btnprops[0] = new Array('sjabloonweg',true)
		dellisturl = 'http://nl.wikipedia.org/w/index.php?title=Wikipedia:Te_beoordelen_sjablonen&action=edit&addbefore='+templAddBefore
	} else if (edittype=='user') {
		btnprops[0] = new Array('hola|gebruiker|~~~~',false)
		btnprops[1] = new Array('exlink',false)
		btnprops[2] = new Array('gpi',false)
		btnprops[3] = new Array('openproxy',false)
		btnsub[3] = new Array('open','anon','anonymizer','open WLAN','TOR')
		btnprops[4] = new Array('##')
		btnprops[5] = new Array('zb',false)
		btnprops[6] = new Array('brp',false)
		btnprops[7] = new Array('puber',false)
		btnprops[8] = new Array('ws',false)
		btnprops[9] = new Array('subst:vzb||Dolledre',false)
	}
}


function refreshButtons() {
	//estimate width of table columns
	var btnstyle='font-size:8pt;width:100%;'
	var dummystyle='font-size:8pt;visibility:hidden;line-height:0px;'

	var sublen=0, dummy
	for (k=0;k<btnprops.length;k++)
		if (btnprops[k][0].length>sublen) {sublen=btnprops[k][0].length; dummy=btnprops[k][0].replace(/ /g,'&nbsp;')}
	dummy='<div Style=\"'+dummystyle+'margin:0 1em;\">'+dummy+'</div>'

	var s='<table cellpading=0 cellspacing=0 border=0><td align=center valign=top>'+dummy
	//loop and create buttons; when finished insert buttons in specialchars div
	popbtns.length=0
	for (k=0;k<btnprops.length;k++) {
		if (btnprops[k][0]=='##')
			s+='<td  align=center valign=top>'+dummy
		else {
//			var re = new RegExp('\\{\\{(('+btnprops[k][0]+')|('+btnprops[k][0].substr(1)+'))[^}]*\\}\\}','i') //x prefix is optional for beta test period
			var re = new RegExp('\\{\\{x?'+btnprops[k][0]+'.*\\}\\}','i')
			var templPresent =re.test(document.getElementById('wpTextbox1').value)

			if (btnsub[k] && !templPresent) {
				//estimate width of (popup) table columns
				var sublen=10, dummypop='&nbsp;&nbsp;geen&nbsp;keuze&nbsp;&nbsp;', columns=1
				for (l=0;l<btnsub[k].length;l++) {
					var btnsubtxt = (typeof(btnsub[k][l]) == 'string') ? btnsub[k][l] : btnsub[k][l][0]
					if (btnsubtxt.length>sublen) {sublen=btnsubtxt.length; dummypop='&nbsp;&nbsp;'+btnsubtxt.replace(/ /g,'&nbsp;')+'&nbsp;&nbsp;'}
				}
				dummypop='<span Style=\"'+dummystyle+'margin:0 2em;\">'+dummypop+'</span><BR>'

				popbtns[k]='<table cellpadding=0 cellspacing=0 border=0><td  align=center valign=top>'+dummypop
				for (l=0;l<btnsub[k].length;l++) {
					var btnsubtxt = (typeof(btnsub[k][l]) == 'string') ? btnsub[k][l] : (btnsub[k][l][0]+'*')
					if (btnsubtxt=='##') {
						popbtns[k]+='<td  align=center valign=top>'+dummypop
						columns+=1
					} else
						popbtns[k]+='<input id=subbtn'+k+l+' type=button Style=\"'+btnstyle+'\" value=\"'+btnsubtxt+'\" onclick=\"hideTipNow();addremovetemplate('+templPresent+','+k+','+l+')\" title=\"'+(templPresent?'Verwijderen ':'Toevoegen ')+'van het '+btnprops[k][0]+'|'+btnsubtxt+' sjabloon\"><BR>'
				}

				popbtns[k]+='<tr><td align=center colspan=' + columns + '><input id=subbtn'+k+l+' type=button Style=\"'+btnstyle+'\" value=\"geen keuze" onclick=\"hideTipNow();addremovetemplate('+templPresent+','+k+',-1)\" title=\"'+(templPresent?'Verwijderen ':'Toevoegen ')+'van het '+btnprops[k][0]+' sjabloon\">'
				popbtns[k]+='</td></table>'

				s+='<input id=btn'+btnprops[k][0]+' type=button Style=\"'+btnstyle+'\" value=\"'+(templPresent?'-- ':'+ ')+btnprops[k][0]+(btnsub[k]?'*':'')+'\" onmouseover=\"tTip(this,popbtns['+k+'],0,-1)\" title=\"'+(templPresent?'Verwijderen ':'Toevoegen ')+'van het '+btnprops[k][0]+' sjabloon\"><BR>'
			} else
				s+='<input id=btn'+btnprops[k][0]+' type=button Style=\"'+btnstyle+'\" value=\"'+(templPresent?'-- ':'+ ')+btnprops[k][0]+(btnsub[k]?'*':'')+'\" onclick=\"addremovetemplate('+templPresent+','+k+')\" title=\"'+(templPresent?'Verwijderen ':'Toevoegen ')+'van het '+btnprops[k][0]+' sjabloon\"><BR>'
		}
	}
	s+='</table>'
	document.getElementById('btngrp').innerHTML=s
}


function addremovetemplate(templPresent,n,nn) {
//function is called by onclick event of one of the buttons
var s
	var txt=document.getElementById('wpTextbox1')
	var summary=document.getElementById('wpSummary')
	//if the selected template is found in the text, i.e. it is removed
	if (templPresent) {
		var re = new RegExp('\\+?(\\{\\{(('+btnprops[n][0]+')|('+btnprops[n][0].substr(1)+'))[^}]*\\}\\})(\\n|\\r)*','gi') //x prefix is optional for beta test period
		txt.value=txt.value.replace(re,'')
		s=RegExp.$1
		if (summary.value.match(re))
			summary.value=summary.value.replace(re,'')
		else
			summary.value+='-'+s
		if (summary.value=='') document.getElementById('SaveSpecial').disabled=true
	} else {
		//in other cases something is added
		var s0 = nn>=0 ? ((typeof(btnsub[n][nn])=='string') ? btnsub[n][nn] : btnsub[n][nn][0]) : ''
		var s1 = nn>=0 ? ((typeof(btnsub[n][nn])=='string') ? '' : btnsub[n][nn][1]) : ''
		var templ2add='{{'+btnprops[n][0]+'|'+s0+'|'+srvryyyy+'|'+srvrmm+'|'+srvrdd+(s1.length>0 ? ('|'+s1) : '')+'}}'
		var positiontxt = '{{'+btnprops[n][0]+'|'+s0
		positiontxt+=s0.length>0 ? ('|'+srvryyyy+'|'+srvrmm+'|'+srvrdd+(s1.length>0 ? ('|'+s1) : '}}')) : ''

		txt.value = (btnprops[n][2]? (txt.value+'\n'): '') + templ2add + (!btnprops[n][2]? ('\n'+txt.value): '')
		positioncursor(positiontxt)
		summary.value+='+{{'+btnprops[n][0]+'|'+(nn>=0? btnsub[n][nn]: '')+'|'+srvryyyy+'|'+srvrmm+'|'+srvrdd+'}}'

		//if the template manipulation may require an edit in the delete list, enable ++ button
		if (btnprops[n][1]) {
			document.getElementById('SaveSpecial').disabled=false
			delreason=btnprops[n][0].replace(/^x/,'')+(s0.length>0 ? encodeURI(' - '+s0) : '')
		}
	}

	refreshButtons()
}



//******************************************
//Functions used to add extra main buttons *
//******************************************
function addButtonSpecial() {
	//Adds the ++ button adjacent to the Save button
		var newbtn=document.createElement('input')
		with (newbtn) {
			type='submit'
			value='++'
			name=testmode? 'wpPreview': 'wpSave'
			title='Sla uw wijzigingen op en voeg pagina toe op verwijderlijst'
			id='SaveSpecial'
			if (newbtn.addEventListener)	//FF/MZ
				newbtn.addEventListener('click', openDellist, false);
			else if (newbtn.attachEvent)	//IE
				newbtn.attachEvent('onclick', openDellist)

			with (style) {
				fontWeight='bold'
				marginLeft='-5px'
				marginRight='5px'
			}
		}
		if (!document.getElementById('wpSummary').value.match(/\+\{\{.*\}\}/) || !dellisturl) newbtn.disabled=true
		document.getElementById('wpSave').parentNode.insertBefore(newbtn,document.getElementById('wpPreview'))
}



//**************************************
//Functions used to edit deletion list *
//**************************************
function addPage2dellist() {
var s, ss, re
	with (document.getElementById('wpTextbox1')) {
		re=new RegExp('(\\r?\\n)*\\* *\\[\\[:?'+RegExpSafe(delpagename)+'\\]\\]') //evolves to: /(\r?\n)*\* *\[\[:?delpagename\]\]
		if (!value.match(re)) {
			ss=/&addbefore=(.*)&/.exec(location.href)
			if (ss)
				re=new RegExp('(\\r?\\n)*'+decodeurl(ss[1]),'i')
			else
				re=/(\r?\n)*$/

			var txt2add='*[[:'+delpagename+']] - ' + (delreason ? (delreason+' - ') : '') + '~~~~'
			s=re.exec(value)
			if (s)
				value=value.substr(0,s.index) + '\r\n' + txt2add + value.substr(s.index)
			else
				alert('Verkeerde config')

			positioncursor(txt2add)
		} else {
			positioncursor('*[[:'+delpagename+']]','*[['+delpagename+']]')
		}
	}
	document.getElementById('wpSummary').value='Pagina: [[:' + delpagename + ']] toegevoegd'
}


function RegExpSafe(s) {
//	return s.replace(/\(/,'\\(').replace(/\)/,'\\)')
	return s.replace(/\\/g,'\\\\').replace(/\[/g,'\\[').replace(/\^/g,'\\^').replace(/\$/g,'\\$').replace(/\./g,'\\.').replace(/\|/g,'\\|').replace(/\?/g,'\\?').replace(/\*/g,'\\*').replace(/\+/g,'\\+').replace(/\(/g,'\\(').replace(/\)/g,'\\)').replace(/\{/g,'\\{').replace(/\}/g,'\\}')
}



//*********************************
//Miscellaneous support functions *
//*********************************
function decodeurl(s) {
	return unescape(decodeURI(s).replace(/_/g,' '))
}


function utc2cet() {
	//This function takes the server time in UTC and converts this to globals in either CET or CEST, depending on winter/summer time
	var summertime=false
	var ts=document.editform.wpStarttime.value
	var srvrdate = new Date(Date.UTC(ts.substr(0,4),ts.substr(4,2)-1,ts.substr(6,2),ts.substr(8,2)))
	//Now decide wether is is summertime
	if (srvrdate.getUTCMonth()>2&&srvrdate.getUTCMonth()<9) summertime=true  //month is april-september
	 else if (srvrdate.getUTCMonth()==2&&srvrdate.getUTCDay()!=0&&srvrdate.getUTCDate()-srvrdate.getUTCDay()>25) summertime=true  //month is march and day is last monday-saturday
	  else if (srvrdate.getUTCMonth()==2&&srvrdate.getUTCDate()>=25&&srvrdate.getUTCDay()==0&&srvrdate.getUTCHours()>=1) summertime=true  //month is march and day is last sunday and time>01:00
      else if (srvrdate.getUTCMonth()==9&&srvrdate.getUTCDay()!=0&&srvrdate.getUTCDate()-srvrdate.getUTCDay()<25) summertime=true  //month is oct and day is not last monday-saturday
	    else if (srvrdate.getUTCMonth()==9&&srvrdate.getUTCDate()>=25&&srvrdate.getUTCDay()==0&&srvrdate.getUTCHours()<1) summertime=true  //month is oct and day is last sunday and time<01:00
	srvrdate= new Date(srvrdate.valueOf()+(summertime?2:1)*3600*1000)
	srvrds=(srvrdate.getUTCFullYear()*10000+srvrdate.getUTCMonth()*100+100+srvrdate.getUTCDate()).toString()
	srvryyyy=srvrds.substr(0,4)
	srvrmm=srvrds.substr(4,2)
	srvrdd=srvrds.substr(6,2)
}


function positioncursor(findTxt1, findTxt2) {
	with (document.getElementById('wpTextbox1')) {
		if (window.scrollIntoView) scrollIntoView() //no support by OP (7.x)
		focus()
		if (document.getElementById('wpTextbox1').createTextRange) {	//for IE
			var rng=createTextRange()
			if (findTxt1) rng.findText(findTxt1)
			if (findTxt2) rng.findText(findTxt2)
			rng.collapse(false)
			rng.select()
		} else {	// for FF/MZ
			if (findTxt1) {
				var ss
				var re = new RegExp(RegExpSafe(findTxt1))

				if (ss=re.exec(value)) {
					var curpos = ss.index+findTxt1.length
				}
				else if (findTxt2) {
//					var re = new RegExp(findTxt2.replace(/\{/g,'\\{'))
					var re = new RegExp(RegExpSafe(findTxt2))
					if (ss=re.exec(value))
						var curpos = ss.index+findTxt2.length
				}
			}
			if (curpos) {
				if (ss.index==0)
					scrollTop=0
				else
					scrollTop = scrollHeight
				if (setSelectionRange) setSelectionRange(curpos, curpos) //no support by OP(7.x)
				focus()
			}
		}
	}
}			


function openDellist() {
	newwin(dellisturl+'&delpagename='+pagetitle+(delreason.length>0 ? ('&delreason='+delreason) : ''),'deletelist')
}


function openGoogle() {
	if (document.selection)
		var sT = document.selection.createRange().text
	else if (window.getSelection) {
		var sT = window.getSelection().toString()
		if (!sT) {
			with (document.editform.wpTextbox1)
				var sT =value.substring(selectionStart,selectionEnd)
		}
	} else return

	if (sT.length>=12)
		newwin('http://www.google.com/search?hl=nl&q=%22'+sT.replace(/ /g,'+').replace(/'/,'\'')+'%22','google')
	else
		alert('De geselecteerde tekst moet minimaal 12 karakters lang zijn')
}


function searchGoogle() {
	var srchwrd = document.getElementById('searchInput').value
	if (srchwrd) newwin('http://www.google.com/search?hl=nl&q='+srchwrd+'+site%3Anl.wikipedia.org','srchgoogle')
}


function newwin(url, winname) {
	var winid=window.open(url, (winname)? winname: "new");
	if (winid)
		winid.focus()
	else
		alert('Pop-up blocker?')	//in case a pop-up blocker prevents opening a new window - to be sorted out
}


function disablebtn() {
	//precaution for close to midnight edits
	for (n=0;n<btnprops.length;n++)
		if (document.getElementById('btn'+btnprops[n][0])) document.getElementById('btn'+btnprops[n][0]).disabled=true
}



//**********************************************
//Functions used to modify spec. chars lay-out *
//**********************************************
function sc(chrs) {
var s=''
	for (k=0;k<chrs.length;k++)
		s+='<a Style=text-decoration:none href=\"javascript:insertTxt(\''+chrs.substr(k,1)+'\')\">'+chrs.substr(k,1)+'</a>'
	return s+'<BR>'
}


function scs() {
var divstyle='Style=\\\'padding: .3em .5em; font-family:monospace;font-size: 180%; color:#aaa; border:silver solid 2px;background:white;letter-spacing:0.2em;\\\''
var s='<B><font color=black>Speciale karakters:&nbsp;&nbsp;</font></B> '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÄäËëÏïÖöÜüŸÿ\')+sc(\'ÁáÉéÍíÓóÚúÝý\')+sc(\'ÀàÈèÌìÒòÙù\')+sc(\'ÂâÊêÎîÔôÛû\')+\'</div>\',0,-1)\">Veelgebruikte klinkers</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'– — ~ | ° ¹ ² ³ ¼½¾ €$¥£\')+sc(\'†× ????? ± ©®™ ‰ «» ¡¿\')+\'</div>\',0,-1)\">Symbolen</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÀÁÂÃÄÅÆAAAÇCCCCÐDÐÈÉÊËEEEE?GGGGHHÌÍÎÏIIII?J\')+sc(\'àáâãäåæaaaçccccðddèéêëeeee?gggghhìíîïiiii?j\')+\'&nbsp;<BR>\'+sc(\'KLLÑNNNÒÓÔÕÖØOŒORRßSSSŠÞTTÙÚÛÜUUUUUUWÝYŸZZŽ\')+sc(\'kllñnnnòóôõöøoœorrßsssšþttùúûüuuuuuuwýyÿzzž\')+\'</div>\',0,-1)\">Alle diakrieten</span><BR>'

	s+='<B><font color=black>Taal afhankelijk:&nbsp;&nbsp;</font></B> '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÄÖßÜ\')+sc(\'äößü\')+\'</div>\',0,-1)\">Duits</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÄÅÖŠŽ\')+sc(\'äåöšž\')+\'</div>\',0,-1)\">Fins</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÀÂÆÇÈÉÊËÎÏÔŒÙÛÜŸ\')+sc(\'àâæçèéêëîïôœùûüÿ\')+\'</div>\',0,-1)\">Frans</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'?a?ßG??d?e????T????????µ\')+sc(\'???????p??Ss/??t??Ff????O?\')+\'</div>\',0,-1)\">Grieks</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÁÉÍÓÖOÚÜU\')+sc(\'áéíóöoúüu\')+\'</div>\',0,-1)\">Hongaars</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÁÉÍÓÚ\')+sc(\'áéíóú\')+\'</div>\',0,-1)\">Iers</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÀÈÉÌÒÙ\')+sc(\'àèéìòù\')+\'</div>\',0,-1)\">Italiaans</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÇÊÎSÛ\')+sc(\'çêîsû\')+\'</div>\',0,-1)\">Koerdisch</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÀÁÂÃÄÅAÇÈÉÊËEÌÍÏÒÓÖÙÜ\')+sc(\'àáâãäåaçèéêëeìíïòóöùü\')+\'</div>\',0,-1)\">Perzisch</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ACELNÓSZZ\')+sc(\'acelnószz\')+\'</div>\',0,-1)\">Pools</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÀÁÂÃÇÉÊÍÓÔÕÚÜ\')+sc(\'àáâãçéêíóôõúü\')+\'</div>\',0,-1)\">Portugees</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'??????????????????\')+sc(\'????????????????\')+sc(\'????????????????\')+sc(\'??????????????\')+\'</div>\',0,-1)\">Russisch</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÁÄÅÆÐÉÍÓÖØÞÚÝ\')+sc(\'áäåæðéíóöøþúý\')+\'</div>\',0,-1)\">Scandinavisch</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'CCЊŽ\')+sc(\'ccdšž\')+\'</div>\',0,-1)\">Servisch/Kroatisch</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÀÁÇÈÉÍÏÑÒÓÚÜ\')+sc(\'àáçèéíïñòóúü\')+\'</div>\',0,-1)\">Spaans/Catelaans</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÁCDÉEÍNÓRŠTÚUÝŽ\')+sc(\'ácdéeínórštúuýž\')+\'</div>\',0,-1)\">Tsjechisch</span>&nbsp;- '
	s+='<span onmouseover=\"tTip(this,\'<div '+divstyle+'>\'+sc(\'ÇGIiÖSÜ\')+sc(\'çgiiösü\')+\'</div>\',0,-1)\">Turks</span>'

	return s
}


function insertTxt(txt) {
	var areas
	if (document.editform)
		var txtarea = document.editform.wpTextbox1;
	else if (areas = document.getElementsByTagName('textarea'))
		var txtarea = areas[0];

	if (!txtarea) return

	if (document.selection) {	//IE
		txtarea.focus();
		var selectedTxt = document.selection.createRange().text;

		if (selectedTxt.charAt(selectedTxt.length - 1) == " ") { // exclude ending space char, if any
			selectedTxt = selectedTxt.substring(0, selectedTxt.length - 1);
			document.selection.createRange().text = txt + selectedTxt + " ";
		} else {
			document.selection.createRange().text = txt + selectedTxt;
		}

	} else if(txtarea.selectionStart || txtarea.selectionStart == '0') {	//MZ/FF
		var replaced = false;
		var startPos = txtarea.selectionStart;
		var endPos = txtarea.selectionEnd;
		if (endPos-startPos)
			replaced = true;
		var scrollTop = txtarea.scrollTop;
		var myText = (txtarea.value).substring(startPos, endPos);
		if (!myText)
			myText='';
		if (myText.charAt(myText.length - 1) == " ") { // exclude ending space char, if any
			subst = txt + myText.substring(0, (myText.length - 1)) + " ";
		} else {
			subst = txt + myText;
		}
		txtarea.value = txtarea.value.substring(0, startPos) + subst +
			txtarea.value.substring(endPos, txtarea.value.length);
		txtarea.focus();
		//set new selection
		if (replaced) {
			var cPos = startPos+(txt.length+myText.length);
			txtarea.selectionStart = cPos;
			txtarea.selectionEnd = cPos;
		} else {
			txtarea.selectionStart = startPos+txt.length;
			txtarea.selectionEnd = startPos+txt.length+myText.length;
		}
		txtarea.scrollTop = scrollTop;
	}
	// reposition cursor if possible
	if (txtarea.createTextRange)
		txtarea.caretPos = document.selection.createRange().duplicate();
}



//******************************************
//Functions used for pop-up messages/menus *
//******************************************
//temp, to be moved to seperate file
var tt1,tt2,tt3;
var tipOn = false, menuOn = false;
var mouseX, mouseY;
var offX, offY;
var tooltip, tipcss;


function tTip(e,txt,oX,oY) {
	offX = (typeof(oX)=='undefined')? 12: oX; offY = (typeof(oY)=='undefined')? 12: oY;

	if (!tooltip) {
		var boxdiv = document.createElement('div')
		with (boxdiv) {
			id='tipDiv';style.position='absolute';style.visibility='hidden';style.zIndex=100
		}
		document.body.appendChild(boxdiv)

		tooltip = document.getElementById('tipDiv')
		if (tooltip) tipcss = tooltip.style
	}
	if (!tooltip) return;

	menuOn = offX==0||offY==0
	tipOn = !menuOn

	tooltip.className = (menuOn)? 'menuDiv': 'tipDiv'

 	tooltip.innerHTML = unescape(txt);

	document.onmousemove = trackMouse;
	e.onmouseout = hideTip;

	tooltip.onmouseout = hideTip
	tooltip.onmousemove = hideTipReset

	if (tt2>0) clearTimeout(tt2); tt2=0
	if (tt3>0) clearTimeout(tt3); tt3=0
	tt3=setTimeout('hideTip()',10000);

	if (tt1>0) clearTimeout(tt1);
	tt1=setTimeout("tipcss.visibility='visible'",400);
}


function trackMouse(e) {
	if (!e) var e = window.event;
	mouseX = (e.pageX)? e.pageX: e.clientX + ((document.documentElement && document.documentElement.scrollLeft)? document.documentElement.scrollLeft: document.body.scrollLeft);
	mouseY = (e.pageY)? e.pageY: e.clientY + ((document.documentElement && document.documentElement.scrollTop)? document.documentElement.scrollTop: document.body.scrollTop);
	if (tipOn || menuOn) positionTip();
	menuOn=false
}


function positionTip() {
	tipcss.width=null
	tipcss.height=null
	var winWd1 = (document.width && window.pageXOffset)? (document.width - window.pageXOffset): (window.innerWidth && window.pageXOffset)? (window.innerWidth-window.pageXOffset): (document.documentElement && document.documentElement.clientWidth)? document.documentElement.clientWidth: document.body.clientWidth
	var winWd2 = (window.pageXOffset)? window.pageXOffset: (document.documentElement && document.documentElement.scrollLeft)? document.documentElement.scrollLeft: document.body.scrollLeft
	var winHt1 = (document.height && window.pageYOffset)? (document.height - window.pageYOffset): (window.innerHeight && window.pageYOffset)? (window.innerHeight-window.pageYOffset): (document.documentElement && document.documentElement.clientHeight)? document.documentElement.clientHeight: document.body.clientHeight
	var winHt2 = (window.pageYOffset)? window.pageYOffset: (document.documentElement && document.documentElement.scrollTop)? document.documentElement.scrollTop: document.body.scrollTop
	var winWd = winWd1 + winWd2
	var winHt = winHt1 + winHt2
	var tpWd = tooltip.offsetWidth
	var tpHt = tooltip.offsetHeight

	with (tipcss) {
		if (offX==0) {
			if (mouseX-tpWd/2>0)
				left = ((mouseX+tpWd/2<winWd)? mouseX-tpWd/2: winWd-tpWd)+'px'
			else
				left = '0px'
		} else if (offX>0) {
			left = ((mouseX+offX+tpWd<winWd)? mouseX+offX: mouseX-offX-tpWd)+'px'
		} else {
			left = ((mouseX+offX-tpWd>winWd2)? mouseX+offX-tpWd: mouseX-offX)+'px'
		}

		if (offY==0) {
			if (mouseY-tpHt/2>0)
				top = ((mouseY+tpHt/2<winHt)? mouseY-tpHt/2: winHt-tpHt)+'px'
			else
				top = '0px'
		} else if (offY>0) {
			top = ((mouseY+offY+tpHt<winHt)? mouseY+offY: mouseY-offY-tpHt)+'px'
		} else {
			top = ((mouseY+offY-tpHt>winHt2)? mouseY+offY-tpHt: mouseY-offY)+'px'
		}
	}
}


function hideTip() {
	tt2 = setTimeout('hideTipNow()',100)
}


function hideTipNow() {
	tipcss.visibility='hidden';
	tipOn=false;
	menuOn=false;
	if (tt1>0) clearTimeout(tt1)
}


function hideTipReset() {
	if (tt2>0) clearTimeout(tt2)
}


//</pre></nowiki>