function emot(text_post){
text_post = '' + text_post + '';
if(document.post.text_post.createtext_postRange && document.post.text_post.caretPos){
var caretPos = document.post.text_post.caretPos;
caretPos.text_post = caretPos.text_post.charAt(caretPos.text_post.length - 1) == ' ' ? text_post + ' ' : text_post;
document.post.text_post.focus();
}
else{
document.post.text_post.value+= text_post;
document.post.text_post.focus();
}}


var zero='';
function text(form){
if(form.type_text.value!=zero){
if(form.type_text.value=='[code]'){ var close_type='[/code]'; }
if(form.type_text.value=='[quot]'){ var close_type='[/quot]'; }
var code_type=''+form.type_text.value+'';
}
else{ var code_type=''; var close_type=''; }
if(form.style_text.value!=zero){
if(form.style_text.value=='[b]'){ var close_style='[/b]'; }
if(form.style_text.value=='[i]'){ var close_style='[/i]'; }
if(form.style_text.value=='[u]'){ var close_style='[/u]'; }
if(form.style_text.value=='[del]'){ var close_style='[/del]'; }
var code_style=''+form.style_text.value+''; 
}
else{ var code_style=''; var close_style=''; }
if(form.color_text.value!=zero){
var code_color=''+form.color_text.value+'';
var close_color='[/color]';
}
else{ var code_color=''; var close_color=''; }
var format_text=''+form.format_text.value+'';
var wszystko=''+code_type+code_style+code_color+format_text+close_color+close_style+close_type+'';
document.post.text_post.value+=wszystko;
}
