//
//  Moduł dodający spis tresci do bloga (wygenerowany przez Blexa)
//  DeBergerac (c) 2007 http://debergerac.blox.pl
//

function toggle_visibility(id,id1) 
{
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
       {
          e.style.display = 'block';
		  var i = document.getElementById(id1);
          i.src = '/resource/toc.html';
       }
}


function ATCheckClick(e)
{
   var target = (e && e.target) || (event && event.srcElement);
   var obj = document.getElementById('SpisTresciBlogaTresc'); 
   
   if( ATCheckParent(target) )
   {
      obj.style.display='none';
	  document.onclick=null;
   }
}


function ATCheckParent(t)
{
   while(t.parentNode)
   {
      if(t==document.getElementById('SpisTresciBlogaTresc'))
	  {
         return false;
      }
      t=t.parentNode;
   }
   return true
} 


function AppendToc()
{
   var CatDiv = document.getElementById('BlogKategorie');
   if( CatDiv!=null )
   {
	var TextDiv = document.createElement("div");
	var IframeDiv = document.createElement("div");
   	
   	TextDiv.innerHTML = "<div id=\"SpisTresciBlogaTekst\" onclick=\"toggle_visibility('SpisTresciBlogaTresc','SpisTresciBlogaIframe');\">Spis tre\u015Bci</div><div id=\"SpisTresciBlogaTresc\"><iframe frameborder=\"0\" id=\"SpisTresciBlogaIframe\" src=\"\"></iframe></div>";
   	CatDiv.appendChild(TextDiv);
   }  
}


if (document.getElementById('BlogSzerokaSzpalta'))
{
	AppendToc();
}
else 
{
	if (window.addEventListener) { window.addEventListener('load', AppendToc, false);}
	else {if (window.attachEvent){ window.attachEvent('onload', AppendToc);} }
}

