// script written by Radek HULAN
// http://hulan.info/blog/

// comments parents and children
var arrsP='';
var arrsC='';
var arrsU='';
var arrsF='';

var clanek='';
var komentar='';
var news='';

function clearStyles(){
  arrsP='';
  arrsC='';
  arrsU='';
  arrsF='';
}
function removeStyles(){
 for (var i = 0; i < arrsP.length; i++){
  document.getElementById(arrsP[i]).className="commentbody";
 }
 for (var i = 0; i < arrsC.length; i++){
  document.getElementById(arrsC[i]).className="commentbody";
 }
 for (var i = 0; i < arrsU.length; i++){
  document.getElementById(arrsU[i]).className="commentbody";
 }
 for (var i = 0; i < arrsF.length; i++){
  document.getElementById(arrsF[i]).className="commentbody";
 }
}
function sP(arr){ 
 arrsP=arr;
 for (var i = 0; i < arr.length; i++){
  document.getElementById(arr[i]).className="commentparent";
 }
}      
function sC(arr){ 
 arrsC=arr;
 for (var i = 0; i < arr.length; i++){
  document.getElementById(arr[i]).className="commentchild";
 }
}      
function sU(arr){ 
 arrsU=arr;
 for (var i = 0; i < arr.length; i++){
  document.getElementById(arr[i]).className="commentactive";
 }
}      
function sF(arr){ 
 for (var i = 0; i < arrsF.length; i++){
  document.getElementById(arrsF[i]).className="commentbody";
 }
 arrsF=arr;
 for (var i = 0; i < arr.length; i++){
  document.getElementById(arr[i]).className="commentactive";
 }
}
// comments emoticons      
function insertext(text){ 
 document.getElementById('nucleus_cf_body').focus(); 
 document.getElementById('nucleus_cf_body').value+=" "+ text;
}

// switchCells
function switchCells(currentitem,itemtext,totalitems){
  for (var i = 1; i<=Number(totalitems); i++){
    var item=String(itemtext)+String(i);
    if ( i != Number(currentitem) ){
      if (p=document.getElementById(item)) p.style.display="none";
      if (p=document.getElementById(item+String("a"))) p.className="";
      if (p=document.getElementById(item+String("h2"))) p.display="none";
    } else {
      if (p=document.getElementById(item)) p.style.display="block";
      if (p=document.getElementById(item+String("a"))) p.className="active";
      if (p=document.getElementById(item+String("h2"))) p.style.display="none";
    }
  }
}

// article stats menu
function articleStats(){
  document.write('<h2>Statistics</h2>');
  document.write('<div id="navlist1">');
  document.write('<div><a id="articlestats1a" href="javascript:switchCells(1,'); document.write("'articlestats'"); document.write(',3);">Most karma</a></div>');
  document.write('<div><a id="articlestats2a" href="javascript:switchCells(2,'); document.write("'articlestats'"); document.write(',3);">Most viewed</a></div>');
  document.write('<div><a id="articlestats3a" href="javascript:switchCells(3,'); document.write("'articlestats'"); document.write(',3);">Latest comments</a></div>');
  document.write('</div>');
}

function initCells(){
  switchCells(1,"articlestats",3);
}

window.onload = initCells;

