// 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";
    }
  }
}

// local and google search menu
function searchStats(){
  document.write('<div id="navlist2">');
  document.write('<div><a id="searchstats1a" href="javascript:switchCells(1,'); document.write("'searchstats'"); document.write(',3);">Exporty</a></div>');
  document.write('<div><a id="searchstats2a" accesskey="l" href="javascript:switchCells(2,'); document.write("'searchstats'"); document.write(',3);"><span class="u">L</span>okální hledání</a></div>');
  document.write('<div><a id="searchstats3a" accesskey="g" href="javascript:switchCells(3,'); document.write("'searchstats'"); document.write(',3);"><span class="u">G</span>oogle hledání</a></div>');
  document.write('</div>');
}
// blogroll menu
function blogrollStats(){
  document.write('<h2>Blogroll</h2>');
  document.write('<div id="navlist3">');
  document.write('<div><a id="news1a" href="javascript:switchCells(1,'); document.write("'news'"); document.write(',4);">A List Apart</a></div>');
  document.write('<div><a id="news2a" href="javascript:switchCells(2,'); document.write("'news'"); document.write(',4);">Dionidium</a></div>');
  document.write('<div><a id="news3a" href="javascript:switchCells(3,'); document.write("'news'"); document.write(',4);">Psyched Blog</a></div>');
  document.write('<div><a id="news4a" href="javascript:switchCells(4,'); document.write("'news'"); document.write(',4);">A Whole Nothing</a></div>');
  document.write('</div>');
}

// article stats menu
function articleStats(){
  //document.write('<h2>Statistika</h2>');
  document.write('<div id="navlist1">');
  document.write('<div><a id="articlestats1a" href="javascript:switchCells(1,'); document.write("'articlestats'"); document.write(',5)">Nejlépe hodnocené</a></div>');
  document.write('<div><a id="articlestats2a" href="javascript:switchCells(2,'); document.write("'articlestats'"); document.write(',5);">Nejčastěji čtené</a></div>');
  document.write('<div><a id="articlestats5a" href="javascript:switchCells(5,'); document.write("'articlestats'"); document.write(',5);">Poslední články</a></div>');
  document.write('</div>');
}

function initCells(){
  switchCells(2,"articlestats",5);
  switchCells(1,"news",7);
  switchCells(0,"searchstats",3);
}

window.onload = initCells;


