/*************************************************************************************************
*                                                               Функция отображения дерева
*************************************************************************************************/
var ns6 = navigator.appVersion;
function GetLayRef(id){
  if (navigator.appName == "Netscape") return document.getElementById(id);
  else return document.all[id];
}

function popUpWindow2(URLStr, left, top, width, height){
  if(popUpWin){if(!popUpWin.closed) popUpWin.close();}
  popUpWin = open(URLStr, 'popUpWin', '');
}

var label1 = "label1";
function SlideLayer(Num){
  var ptr = GetLayRef(Num);
  if (ptr.style.display=="block") ptr.style.display="none";
  else ptr.style.display="block";
  label1 = "true";
}

/*************************************************************************************************
*                                                               Функция времени
*************************************************************************************************/
function tick() {
  var hours, minutes, seconds, ap;
  var intHours, intMinutes, intSeconds;  var today;
  today = new Date();
  intDay = today.getDay();
  intDate = today.getDate();
  intMonth = today.getMonth();
  intYear = today.getYear();
  intHours = today.getHours();
  intMinutes = today.getMinutes();
  intSeconds = today.getSeconds();
  timeString = intDate;
  //timeString = DayNam[intDay]+" xs "+intDate;
  if (intDate == 1 || intDate == 21 || intDate == 31) {
    timeString= timeString + " ";
  } else if (intDate == 2 || intDate == 22) {
    timeString= timeString + " ";
  } else if (intDate == 3 || intDate == 23) {
    timeString= timeString + " ";
  } else {
    timeString = timeString + " ";
  }
  if (intYear < 2000){
        intYear += 1900;
  }
  timeString = "";
  if (intHours == 0) {
     hours = "12:";
     ap = "am";
  } else if (intHours < 12) {
     hours = intHours+":";
     ap = "am";
  } else if (intHours == 12) {
     hours = "12:";
     ap = "pm";
  } else {
     intHours = intHours - 12
     hours = intHours + ":";
     ap = "pm";
  }
  if (intMinutes < 10) {
     minutes = "0"+intMinutes;
  } else {
     minutes = intMinutes;
  }
  if (intSeconds < 10) {
     seconds = ":0"+intSeconds;
  } else {
     seconds = ":"+intSeconds;
  }
  //timeString = (document.all)? timeString+", "+hours+minutes+seconds+" "+ap:timeString+" "+hours+minutes+" "+ap;
  timeString = (document.all)? hours+minutes+" "+ap:timeString+" "+hours+minutes+" "+ap;
  var clock = (document.all) ? document.all("Clock") : document.getElementById("Clock");
  clock.innerHTML = timeString;
  (document.all)?window.setTimeout("tick();", 1000):window.setTimeout("tick();", 6000);
}
/*************************************************************************************************
*                                                               Функция открытия нового окна
*************************************************************************************************/
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,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function adminka(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 mark(x){
  if(document.selection){
    loaded.out_content.focus()
    rng = document.selection.createRange()
      if(x=='br' || x=='hr') 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=""1]'
        else if(x=='img2') rng.text = '[img2=""2]'
        else if(x=='img3') rng.text = '[img3=""3]'
        else if(x=='img4') rng.text = '[img4=""4]'
        else if(x=='img5') rng.text = '[img5=""5]'
        else if(x=='img6') rng.text = '[img6=""6]'
        else if(x=='img7') rng.text = '[img7=""7]'
        else if(x=='img8') rng.text = '[img8=""8]'
        else if(x=='img9') rng.text = '[img9=""9]'
        else if(x=='html1') rng.text = '[html1]'
        else if(x=='html2') rng.text = '[html2]'
        else if(x=='html3') rng.text = '[html3]'
        else if(x=='html4') rng.text = '[html4]'
        else if(x=='html5') rng.text = '[html5]'
        else if(x=='html6') rng.text = '[html6]'
        else if(x=='html7') rng.text = '[html7]'
        else if(x=='html8') rng.text = '[html8]'
        else if(x=='html9') rng.text = '[html9]'
        else if(x=='img1o') rng.text = '[img1o=""1]'
        else if(x=='img2o') rng.text = '[img2o=""2]'
        else if(x=='img3o') rng.text = '[img3o=""3]'
        else if(x=='img4o') rng.text = '[img4o=""4]'
        else if(x=='img5o') rng.text = '[img5o=""5]'
        else if(x=='img6o') rng.text = '[img6o=""6]'
        else if(x=='img7o') rng.text = '[img7o=""7]'
        else if(x=='img8o') rng.text = '[img8o=""8]'
        else if(x=='img9o') rng.text = '[img9o=""9]'
        else rng.text = '['+x+']' + rng.text + '[/'+x+']'
      }
  }
  else loaded.out_content.value += '['+x+'][/'+x+']'
  x='';
}

/*************************************************************************************************
*                                                       Функции для работы с контентом
*************************************************************************************************/
function mark2(x){
  if(document.selection){
    loaded2.out_content.focus()
    rng = document.selection.createRange()
      if(x=='br' || x=='hr') 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 rng.text = '['+x+']' + rng.text + '[/'+x+']'
      }
  }
  else loaded2.out_content.value += '['+x+'][/'+x+']'
  x='';
}

function go_to(a){location.href=a;return true;}
