function confirmLink(theLink, ConfirmMsg)
{
    // Confirmation is not required in the configuration file
    // or browser is Opera (crappy js implementation)
//    if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
    if (typeof(window.opera) != 'undefined') {
		return true;
    }
//    var is_confirmed = confirm(confirmMsg + ' :\n' + theSqlQuery);
    var is_confirmed = confirm(ConfirmMsg);
    if (is_confirmed) {
        theLink.href += '&is_js_confirmed=1';
    }
    return is_confirmed;
} // end of the 'confirmLink()' function

function display(id) {
    	if (document.layers) {
    		current = (document.layers[id].display != 'block') ? 'block' : 'none'
    		document.layers[id].display = current;
    	} else if (document.all) {
    		current = (document.all[id].style.display != 'block') ? 'block'	: 'none';
    		document.all[id].style.display = current;
    	} else if (document.getElementById) {
    		current = (document.getElementById(id).style.display != 'block') ? 'block' : 'none';
    		document.getElementById(id).style.display = current;
        }
}

// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

// Insert emoticon. Code from phpBB2 -> http://www.phpbb.com/
function emoticon(text) {
	var txtarea = document.form.comment;
//	text = ' ' + text + ' ';
	text = text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}


