var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
{
let window = _____WB$wombat$assign$function_____("window");
let self = _____WB$wombat$assign$function_____("self");
let document = _____WB$wombat$assign$function_____("document");
let location = _____WB$wombat$assign$function_____("location");
let top = _____WB$wombat$assign$function_____("top");
let parent = _____WB$wombat$assign$function_____("parent");
let frames = _____WB$wombat$assign$function_____("frames");
let opener = _____WB$wombat$assign$function_____("opener");
function insertAfter(node, referenceNode) {
referenceNode.parentNode.insertBefore(node, referenceNode.nextSibling);
}
function loadGrins() {
var grinsDiv = document.createElement('div');
grinsDiv.id = 'wp_grins';
grinsDiv.innerHTML = ' ';
if ($('postdiv')) {
var type = 'child';
var node = $('postdiv');
}
else if (document.getElementById('postdivrich')) {
var type = 'child';
var node = $('postdivrich');
}
else if (document.getElementById('comment')) {
var type = 'before';
var node = $('comment');
}
else {
return;
}
switch (type) {
case 'child':
grinsDiv.style.paddingTop = '5px';
node.appendChild(grinsDiv);
break;
case 'before':
node.parentNode.insertBefore(grinsDiv, node);
break;
}
}
Event.observe(window, 'load', loadGrins, false);
function grin(tag) {
var myField;
if ($('content') && $('content').type == 'textarea') {
myField = document.getElementById('content');
if ($('postdivrich') && typeof tinyMCE != 'undefined' && (!$('edButtons') || $('quicktags').style.display == 'none')) {
tinyMCE.execInstanceCommand('mce_editor_0', 'mceInsertContent', false, ' ' + tag + ' ');
tinyMCE.selectedInstance.repaint();
return;
}
}
else if ($('comment') && $('comment').type == 'textarea') {
myField = $('comment');
}
else {
return false;
}
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = ' ' + tag + ' ';
myField.focus();
}
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
var cursorPos = endPos;
myField.value = myField.value.substring(0, startPos)
+ ' ' + tag + ' '
+ myField.value.substring(endPos, myField.value.length);
cursorPos += tag.length + 2;
myField.focus();
myField.selectionStart = cursorPos;
myField.selectionEnd = cursorPos;
}
else {
myField.value += tag;
myField.focus();
}
}
}