function ReplyMessage(id) {
	tagList = document.getElementsByTagName('span');
	for (var i=0; i<tagList.length; i++)
	{
		tagList.item(i).innerHTML='';
	}
	$('span#reply-'+id).empty().html('<img src="/incforum/js/ajloadline.gif" width="220" height="19" border="0" alt="Выполнение команды">');
	$.get('/incforum/js/ajax-reply.php',{'id': id, 'rnd': Math.random()}, function(data) { $('div#replin-'+id).empty().html("<a href='javascript:ClearReplyForm("+id+");' class=forumlinks>Убрать форму</a>"); $('span#reply-'+id).empty().append(data); });
}
function ClearReplyForm(id) {
	$('div#replin-'+id).empty().html("<a href='javascript:ReplyMessage("+id+");' class=forumlinks>Ответить</a>");
	$('span#reply-'+id).empty();
}
function insertext(open, close, area){
    if(area=="short"){msgfield = document.addnews.body}

    // IE support
    if (document.selection && document.selection.createRange){
        msgfield.focus();
        sel = document.selection.createRange();
        sel.text = open + sel.text + close;
        msgfield.focus();
    }

    // Moz support
    else if (msgfield.selectionStart || msgfield.selectionStart == "0"){
        var startPos = msgfield.selectionStart;
        var endPos = msgfield.selectionEnd;

        msgfield.value = msgfield.value.substring(0, startPos) + open + msgfield.value.substring(startPos, endPos) + close + msgfield.value.substring(endPos, msgfield.value.length);
        msgfield.selectionStart = msgfield.selectionEnd = endPos + open.length + close.length;
        msgfield.focus();
    }

    // Fallback support for other browsers
    else {
        msgfield.value += open + close;
        msgfield.focus();
    }

    return;
}

function masearchForm()
    {
      var d=document;
      if (!d.getElementById) return;
      var el=d.getElementById('search_advform');
      if (!el) return;
      var els=el.getElementsByTagName('div');
      if (el.className!="line2_up")
       {
         d.getElementById('search_up').style.display='none';
         d.getElementById('search_down').style.display='inline';
         d.getElementById('search_roll_img').src='/incforum/js/box_down.gif';
         el.className="line2_up"
         el.style.height="2px";
         d='none';
       }
      else
       {
         d.getElementById('search_up').style.display='inline';
         d.getElementById('search_down').style.display='none';
         d.getElementById('search_roll_img').src='/incforum/js/box_up.gif';
         el.className="box1up"
         el.style.height="";
         d='block';
       }

      for (i=0;i<els.length;i++)
       {
         els[i].style.display=d;
       }

      return false;
    }
function showRollString()
    {
      if (document.getElementById)
       document.write('<div class="pad16" id="search_roll"><a href="#" onClick="return masearchForm()"><img id="search_roll_img" width="16" height="16" border="0" align="absmiddle" src="/incforum/js/box_up.gif"></a> <a href="#" onClick="return masearchForm()" class="a4"><span id="search_up">'+"Свернуть"+'</span><span class="none">/</span><span id="search_down" class="none">'+"Развернуть"+'</span> '+"<b>новая тема форума</b>&hellip;"+'</a></div>');
    }
function showBbsRollString()
    {
      if (document.getElementById)
       document.write('<div class="pad16" id="search_roll"><a href="#" onClick="return masearchForm()"><img id="search_roll_img" width="16" height="16" border="0" align="absmiddle" src="/incforum/js/box_up.gif"></a> <a href="#" onClick="return masearchForm()" class="a4"><span id="search_up">'+"Свернуть"+'</span><span class="none">/</span><span id="search_down" class="none">'+"Развернуть"+'</span> '+"<b>новое сообщение в доску объявлений</b>&hellip;"+'</a></div>');
    }