// Copyright (c) 2005 Gram, gram@bg.nnov.ru, http://openproj.ru
////////////// а вот это функции для вставки кодов
function insertcodes() {
var dir=document.getElementsByTagName('base')[0].href+"/images/";
HAND = ' cursor: pointer ';
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('');
document.write('
');
document.write('
');
document.writeln('');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
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],"")
if (txt!=null) AddText(line1+txt+line2)
} else {
txt=prompt(codes_array[num][3],"")
if (txt!=null) {
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) {
element.value=element.value.substring(0,element.selectionStart)+text+element.value.substring(element.selectionEnd,element.value.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][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 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) {
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);
} else if (element) {
element.value+=text1 + text2;
}
}