function T() //get the selected text in frame f
{
try{
if(getSelection) return getSelection().toString();
if(document.selection) return document.selection.createRange().text;
}catch(e){} //if the frame is in another domain
return '';
}
function text_quote() {
  range = T();
}
function quote(text)
{
  document.post.post_text.value=document.post.post_text.value+'[quote='+text+']'+range+'[/quote]';
  toggleOn('fast_reply');
}
function clickbuttonover(obj) {
        var el = document.getElementById(obj);
                el.style.color = '#CCCCCC';
                el.style.backgroundColor = 'black';
}
function clickbuttonout(obj) {
        var el = document.getElementById(obj);
                el.style.color = 'white';
                el.style.backgroundColor = '#111111';
}
function incoming() {
toggleOn('list');
toggleOff('text');
MesInFocus=0;
PlayerInFocus=0;
set_text('<i>Данные загружаются...</i>', 'list');
load_data('./?act=ajax_incoming', 'list');
}
function outgoing() {
toggleOn('list');
toggleOff('text');
MesInFocus=0;
PlayerInFocus=0;
set_text('<i>Данные загружаются...</i>', 'list');
load_data('./?act=ajax_outgoing', 'list');
}
function private_new() {
toggleOn('text');
set_text('<i>Данные загружаются...</i>', 'text');
load_data('./?act=ajax_private_new&id='+PlayerInFocus, 'text');
}
function private_reply() {
toggleOn('text');
set_text('<i>Данные загружаются...</i>', 'text');
load_data('./?act=ajax_private_new&id='+PlayerInFocus+'&mid='+MesInFocus, 'text');
}
function private_delete() {
toggleOn('text');
set_text('<i>Сообщение удаляется...</i>', 'text');
load_data('./?act=ajax_private_delete&id='+MesInFocus, 'text');
}
function private_focus(i, j) {
MesInFocus=i;
PlayerInFocus=j;
toggleOn('text');
set_text('<i>Данные загружаются...</i>', 'text');
load_data('./?act=ajax_message&id='+i, 'text');
}
  function expand(x) {
          x = x.replace(/expand/,"");
          document.getElementById("block" + x).style.display = "";
          document.getElementById("expand" + x).style.display = "none";
          document.getElementById("collapse" + x).style.display = "";
  }
  function collapse(x) {
          x = x.replace(/collapse/,"");
          document.getElementById("block" + x).style.display = "none";
          document.getElementById("expand" + x).style.display = "";
          document.getElementById("collapse" + x).style.display = "none";
  }
  function NumberIncremental(tagType,tagId,prefixId) {
    var el = document.getElementsByTagName(tagType);
    var which = 0;
    var index=0;	
    for(index=0; index<el.length; index++) {
      if(el[index].id == tagId) {
        el[index].id = prefixId + which++;
        el[index].display = "";
      }
    }
  }
  function Init() {
    NumberIncremental("div", "blocker", "block");
    NumberIncremental("a", "collapser", "collapse");
    NumberIncremental("a", "expander", "expand");
    var index=0;
    for(index=0;; index++) {
      if(document.getElementById("block"+index))
        collapse("collapse"+index);
      else break;
    }
  }

