/*************************************************************************************************
*                                                               Функция открытия нового окна
*************************************************************************************************/
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height){
  if(popUpWin){if(!popUpWin.closed) popUpWin.close();}
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function admin(URLStr){
  if(popUpWin){if(!popUpWin.closed) popUpWin.close();}
  popUpWin = open(URLStr, 'popUpWin', 'fullscreen=yes,resizable=yes,status=no,menubar=no,scrollbar=yes');
}
/*************************************************************************************************
*                                                                 Функция выхода из админки
*************************************************************************************************/
function closeWindow(){
 window.close();
}


/*************************************************************************************************
*                                                                       Функция смены фона
*************************************************************************************************/
function fonon(a){document.all[a].style.backgroundColor="#616161";}
function fonoff(a){document.all[a].style.backgroundColor="#333333";}
function go_to(a){location.href=a;return true;}


/*************************************************************************************************
*                                                                Функция перехода на раздел
*************************************************************************************************/
function gopage(obj){
  var uri = obj.options[obj.selectedIndex].value;
  if( uri != '' )
  document.location.href = uri;
}

/*************************************************************************************************
*                                                              Функции для работы с контентом
*************************************************************************************************/
function mark(x){
  if(document.selection){
    loaded.content.focus()
    rng = document.selection.createRange()
      if(x=='br' || x=='hr' || x=='plus') rng.text = '['+x+']' + rng.text
      else if (x=='||') rng.text = '\\r||\\r' + rng.text
      else{
        if(x=='a') rng.text = '[url=http://ваша_ссылка.ru]' + rng.text + '[/url]'
        else if(x=='img1') rng.text = '[img1]'
        else if(x=='img2') rng.text = '[img2]'
        else if(x=='img3') rng.text = '[img3]'
        else if(x=='img4') rng.text = '[img4]'
        else if(x=='img5') rng.text = '[img5]'
        else if(x=='img6') rng.text = '[img6]'
        else if(x=='img7') rng.text = '[img7]'
        else if(x=='img8') rng.text = '[img8]'
        else if(x=='img9') rng.text = '[img9]'
        else if(x=='table1') rng.text = '[table1]'
        else if(x=='table2') rng.text = '[table2]'
        else if(x=='table3') rng.text = '[table3]'
        else if(x=='table4') rng.text = '[table4]'
        else if(x=='table5') rng.text = '[table5]'
        else if(x=='table6') rng.text = '[table6]'
        else if(x=='table7') rng.text = '[table7]'
        else if(x=='table8') rng.text = '[table8]'
        else if(x=='table9') rng.text = '[table9]'
        else if(x=='table10') rng.text = '[table10]'
        else if(x=='table11') rng.text = '[table11]'
        else if(x=='table12') rng.text = '[table12]'
        else rng.text = '['+x+']' + rng.text + '[/'+x+']'
      }
  }
  else loaded.content.value += '['+x+'][/'+x+']'
  x='';
}
