function insertcodes() { var dir = document.getElementsByTagName('base')[0].href + "/images/"; HAND = ' cursor: pointer '; document.write('' + codes_array[0][1] + ''); document.write('' + codes_array[1][1] + ''); document.write('' + codes_array[2][1] + ''); document.write('' + codes_array[18][1] + ''); document.write('|'); document.write(''); document.write('Малый'); document.write('Большой'); document.writeln(''); document.write('|'); document.write('' + codes_array[8][1] + ''); document.write('' + codes_array[17][1] + ''); document.write('' + codes_array[7][1] + ''); document.write('|'); document.write('' + codes_array[9][1] + ''); document.write('' + codes_array[10][1] + ''); document.write('' + codes_array[21][1] + ''); document.write('|'); document.write('' + codes_array[15][1] + ''); document.write('' + codes_array[12][1] + ''); document.write('' + codes_array[6][1] + ''); document.write('' + codes_array[13][1] + ''); var form_cookie = getCookie('IB2XP_form_mode') //if (form_cookie != null) document.postform.select.selectedIndex=form_cookie; //mode=document.postform.select.selectedIndex+1; } function select_onchange(number) { mode = number var form_cookie = getCookie('IB2XP_form_mode'); form_cookie = mode - 1; document.cookie = "IB2XP_form_mode=" + form_cookie + "; expires=Sun, 01-Jan-2034 00:00:00 GMT; path=/;"; } function c1(num) { line1 = "[" + codes_array[num][0] + "]"; line2 = "[/" + codes_array[num][0] + "]"; if (num == 6) { line1 = "[list][*]"; line2 = "\n[/list]"; } else if (num == 13) { line1 = "[table][tr][td]"; line2 = "[/td][/tr][/table]"; } if (num == 15) line2 = "" if (mode == 1) alert(codes_array[num][2]) else if (mode == 3) surText(document.postform.p_text, line1, line2) else { if (codes_array[num][3] == null) AddText(line1) else if (codes_array[num][4] == null) { txt = prompt(codes_array[num][3], getSelText(document.postform.p_text)) if (txt != null) AddText(line1 + txt + line2) } else { var SelText = getSelText(document.postform.p_text); if (num == 9 && SelText.indexOf('http') == 0) txt = prompt(codes_array[num][3], SelText); else txt = prompt(codes_array[num][3], ""); if (txt != null) { if (num == 9 && SelText.indexOf('http') != 0) txt2 = prompt(codes_array[num][4], SelText); else txt2 = prompt(codes_array[num][4], ""); if (txt2 != null) { if (txt2 == "") AddText(line1 + txt + line2) else if (codes_array[num][5] != null) AddText("[" + codes_array[num][0] + "=" + txt + "]" + txt2 + "[/" + codes_array[num][0] + "]") else AddText("[" + codes_array[num][0] + "=" + txt2 + "]" + txt + "[/" + codes_array[num][0] + "]") } } } } document.postform.p_text.focus(); } function custom(num, _mode) { mode = _mode; c1(num); } function AddText(text) { if (text != '') insertText(document.postform.p_text, text); document.postform.p_text.focus(); } function pasteN(text) { if (text != '') insertText(document.postform.p_text, "[b]" + text + "[/b]"); } function insertText(element, text) { if (element && element.caretPos) { element.caretPos.text = text; } else if (element && element.selectionStart + 1 && element.selectionEnd + 1) { var StoreSStart = element.selectionStart; element.value = element.value.substring(0, element.selectionStart) + text + element.value.substring(element.selectionEnd, element.value.length); if (text.indexOf(' :') == 0 && text.indexOf(': ') == text.length - 2) { element.selectionStart = StoreSStart + text.length; element.selectionEnd = element.selectionStart; } else { element.selectionStart = StoreSStart; element.selectionEnd = StoreSStart + text.length; } } else if (element) { element.value += text; } } function storeCaret(element) { if (document.selection && document.selection.createRange) { element.caretPos = document.selection.createRange().duplicate(); } } function getCookie(name) { var prefix = name + "=" var StartIndex = document.cookie.indexOf(prefix) if (StartIndex == -1) return null var EndIndex = document.cookie.indexOf(";", StartIndex + prefix.length) if (EndIndex == -1) EndIndex = document.cookie.length return unescape(document.cookie.substring(StartIndex + prefix.length, EndIndex)) } if (document.selection || document.getSelection) { Q = true } else { var Q = false } //////////// это для цитаты function copyQN(name, id) { txt = ''; lname = name; if (document.getSelection) { txt = document.getSelection() } else if (document.selection) { txt = document.selection.createRange().text; } if (document.getElementById && !txt && document.getElementById(id).innerText) { txt = document.getElementById(id).innerText; } else if (document.getElementById && !txt && document.getElementById(id).textContent) { txt = document.getElementById(id).textContent; } txt = '[q=' + name + ']' + txt + '[/q]\n'; } function splitQ() { insertText(document.postform.p_text, '[/q]\n' + getSelText(document.postform.p_text) + '[q=' + lname + ']'); } //////////// это для шрифта function alterfont(theval, thetag) { if (theval == '0') return; line1 = '[' + thetag + '=' + theval + ']'; line2 = '[/' + thetag + ']'; surText(document.postform.p_text, line1, line2); document.postform.ffont.selectedIndex = 0; //document.postform.fsize.selectedIndex=0; document.postform.fcolor.selectedIndex = 0; } function copyQ() { txt = '' if (document.getSelection) { txt = document.getSelection() } else if (document.selection) { txt = document.selection.createRange().text; } txt = '[q]' + txt + '[/q]\n'; } function pasteQ() { if (txt != '') insertText(document.postform.p_text, txt); } function getSelText(element) { if (element && element.selectionStart + 1 && element.selectionEnd + 1) { return element.value.substring(element.selectionStart, element.selectionEnd); } else { return ""; } } function surText(element, text1, text2) { if (element && element.caretPos) { element.caretPos.text = text1 + element.caretPos.text + text2; } else if (element && element.selectionStart + 1 && element.selectionEnd + 1) { var StoreSStart = element.selectionStart; var StoreSLen = element.selectionEnd - StoreSStart; element.value = element.value.substring(0, element.selectionStart) + text1 + element.value.substring(element.selectionStart, element.selectionEnd) + text2 + element.value.substring(element.selectionEnd, element.value.length); element.selectionStart = StoreSStart; element.selectionEnd = StoreSStart + StoreSLen + text1.length + text2.length; } else if (element) { element.value += text1 + text2; } }