// The script for expanding deletion reasons
// dedicated to putnik@ruwiki
// some ideas from [[:ru:User:Alex Smotrov/misc/charcounter.js]]

if (document.URL.match(/action=delete/))
$(function(){
 reasonBox = document.getElementById('wpReason'); //global var
 if (!reasonBox) return;
 
 addEvent(reasonBox, 'keyup', replaceReason);
 addEvent(reasonBox, 'mouseup', replaceReason);
 replaceReason();
})
 
function replaceReason(){
 /* delReasons array should be defined before this */
 for (var i in delReasons){if (reasonBox.value==i) reasonBox.value=delReasons[i];}
}
 
function addEvent(obj, event, func) {
 if (obj.addEventListener) obj.addEventListener( event, func, false );
 else if (obj.attachEvent) obj.attachEvent ('on'+event, func)
}