function add_img() {
    var img_url = $('#add_imgin').val();
    if(img_url==""){$('#add_imgin').css({border:'2px ridge red'});_uWnd.alert('Не заполнено поле <b>Ссылка</b>!','Ошибка!',{w: 300, h: 60, tm: 5000});}
    else{parent.window.document.getElementById("mchatMsgF").value+='[img]'+img_url+'[/img]';$('#add_img').hide();$('#add_imgin').val('');}
};
function add_url() {
    var url = $('#add_urlin').val();
    var url_name = $('#add_urlnamein').val();
    if(url=="" && url_name==""){$('#add_urlin').css({border:'2px ridge red'});$('#add_urlnamein').css({border:'2px ridge red'});_uWnd.alert('Не заполнены поля <b>Ссылка</b> или <b>Название</b>!','Ошибка!',{w: 300, h: 60, tm: 5000});}
    else{parent.window.document.getElementById("mchatMsgF").value+='[url='+url+']'+url_name+'[/url]';$('#add_url').hide();$('#add_urlin').val('');$('#add_urlnamein').val('');}
};
function show_img_url() {
    $('#add_img').fadeIn('200');$('#choose_color').hide();$('#add_url').hide();setTimeout(function(){$('#add_img').fadeOut('slow');},15000);
};
function show_add_url() {
    $('#add_url').fadeIn('200');$('#choose_color').hide();$('#add_img').hide();setTimeout(function(){$('#add_url').fadeOut('slow');},15000);
};
function add_bb_code_b() {
    parent.window.document.getElementById("mchatMsgF").value+='[b][/b]';$('#choose_color').hide();$('#add_img').hide();$('#add_url').hide();
};
function add_bb_code_u() {
    parent.window.document.getElementById("mchatMsgF").value+='[u][/u]';$('#choose_color').hide();$('#add_img').hide();$('#add_url').hide();
};
function add_bb_code_i() {
    parent.window.document.getElementById("mchatMsgF").value+='[i][/i]';$('#choose_color').hide();$('#add_img').hide();$('#add_url').hide();
};
function add_bb_code_s() {
    parent.window.document.getElementById("mchatMsgF").value+='[s][/s]';$('#choose_color').hide();$('#add_img').hide();$('#add_url').hide();
};
function show_choose_color() {
    $('#choose_color').fadeIn('200');$('#add_img').hide();$('#add_url').hide();setTimeout(function(){$('#choose_color').fadeOut('slow');},15000);
};
function add_red_color() {
    parent.window.document.getElementById("mchatMsgF").value+='[color=red][/color]';$('#choose_color').hide();
};
function add_blue_color() {
    parent.window.document.getElementById("mchatMsgF").value+='[color=blue][/color]';$('#choose_color').hide();
};
function add_yellow_color() {
    parent.window.document.getElementById("mchatMsgF").value+='[color=yellow][/color]';$('#choose_color').hide();
};
function add_green_color() {
    parent.window.document.getElementById("mchatMsgF").value+='[color=green][/color]';$('#choose_color').hide();
};
function add_orange_color() {
    parent.window.document.getElementById("mchatMsgF").value+='[color=orange][/color]';$('#choose_color').hide();
};
function add_gray_color() {
    parent.window.document.getElementById("mchatMsgF").value+='[color=gray][/color]';$('#choose_color').hide();
};
function add_purple_color() {
    parent.window.document.getElementById("mchatMsgF").value+='[color=purple][/color]';$('#choose_color').hide();
};
function clear_msg() {
    parent.window.document.getElementById("mchatMsgF").value='';$('#choose_color').hide();$('#add_img').hide();$('#add_url').hide();
};
