function insertAtCursor(I,K,L,J,M){var O;if(L=="[url=null]"){L="";J=""}if(L=="[imgs]"&&K==null){L="";J="";K=""}var N=I.scrollTop;if(document.selection){var H=document.selection.createRange().text;I.focus();sel=document.selection.createRange();if(L=="[itemlist]"||L=="[orderlist]"){var B=K.split("\n");var F="\n";for(var C=0;C<B.length;C++){if(C<B.length-1){B[C]=B[C].substr(0,B[C].length-1)}F+="[item]"+B[C]+"[/item]\n"}K=F}if(J=="[/url]"||J=="[/mail]"){if(K==""){K=prompt("Podaj link lub mail:","")}L=L.replace(/%/gi,K)}sel.text=L+K+J+M;if(K==""){O=J.length;sel.moveStart("character",-O);sel.moveEnd("character",-O)}sel.select();return }else{if(I.selectionStart||I.selectionStart=="0"){var G=I.selectionStart;var A=I.selectionEnd;var E,D;if(K==""){K=I.value.substring(G,A)}if(L=="[itemlist]"||L=="[orderlist]"){var B=K.split("\n");var F="\n";for(var C=0;C<B.length;C++){F+="[item]"+B[C]+"[/item]\n"}K=F}if(J=="[/url]"||J=="[/mail]"){if(K==""){K=prompt("Podaj link lub mail:","")}L=L.replace(/%/gi,K)}I.value=I.value.substring(0,G)+L+K+J+M+I.value.substring(A,I.value.length);if(K==""){O=L.length;I.selectionStart=G+O;I.selectionEnd=A+O}else{O=L.length;E=J.length;D=K.length;I.selectionStart=G+D+O+E;I.selectionEnd=G+D+O+E}I.focus();I.scrollTop=N;return }else{I.value+=K;I.scrollTop=N;return }}}function paste_strinL(H,C,B,A,G,E){var F=document.forms[G];if(F){var D=document.forms[G].elements[E];insertAtCursor(D,getTextSelection(H),C,B,A)}}function pasteSel(){if(document.getSelection){selection=document.getSelection()}else{if(document.selection){selection=(document.selection.createRange()).text}else{if(window.getSelection){selection=window.getSelection()}else{selection=""}}}}function getTextSelection(A){if((typeof (A)).toLowerCase()=="string"){return A}else{if((typeof (A)).toLowerCase()=="object"){if(A.createRange){return A.createRange().text}else{return""}}else{return""}}}function bbCodeRollOver(B,A){if(B.className=="off"){return }else{B.className=A}}function onSelectFontSize(D,B,A,C){if(!D.options[0].selected){paste_strinL(B,"[size="+D.value+"]","[/size]","",A,C)}D.options[0].selected=true}function onSelectFontColor(D,B,A,C){if(!D.options[0].selected){paste_strinL(B,"[color="+D.value+"]","[/color]","",A,C)}D.options[0].selected=true};
