+ $('.akap-edit-button', $overlay).click(function(){
+ var textAreaOpened = $('textarea', $overlay)[0];
+ var startTag = "";
+ var endTag = "";
+ var buttonName = this.innerHTML;
+
+ if(buttonName == "słowo obce") {
+ startTag = "<slowo_obce>";
+ endTag = "</slowo_obce>";
+ } else if (buttonName == "wyróżnienie") {
+ startTag = "<wyroznienie>";
+ endTag = "</wyroznienie>";
+ } else if (buttonName == "tytuł dzieła") {
+ startTag = "<tytul_dziela>";
+ endTag = "</tytul_dziela>";
+ }
+ var myField = textAreaOpened;
+
+ //IE support
+ if (document.selection) {
+ textAreaOpened.focus();
+ sel = document.selection.createRange();
+ sel.text = startTag + sel.text + endTag;
+ }
+ //MOZILLA/NETSCAPE support
+ else if (textAreaOpened.selectionStart || textAreaOpened.selectionStart == '0') {
+ var startPos = textAreaOpened.selectionStart;
+ var endPos = textAreaOpened.selectionEnd;
+ textAreaOpened.value = textAreaOpened.value.substring(0, startPos)
+ + startTag + textAreaOpened.value.substring(startPos, endPos) + endTag + textAreaOpened.value.substring(endPos, textAreaOpened.value.length);
+ }
+ });
+