<script type="text/javascript">

str_hide = "http://gta-life.ru/uploads/0005/2a/09/3865-1.png"
str_show = "http://gta-life.ru/uploads/0005/2a/09/3865-1.png"
tit_hide = "Скрыть категорию"
tit_show = "Показать категорию"
offset=0
tableOffset=0
catCount=0

str=document.URL
page=str.substring(str.lastIndexOf('/')+1)

if( true/*page=="" || page=="index.php"*/ ) {
  findT();
  findO();

hideCat("Grand Theft Auto","close")
  hideCat("Grand Theft Auto")
  hideCat("Grand Theft Auto","close")

hideCat("GTA London 1969","close")
  hideCat("GTA London 1969")
  hideCat("GTA London 1969","close")

hideCat("GTA 2","close")
  hideCat("GTA 2")
  hideCat("GTA 2","close")

hideCat("GTA 3","close")
  hideCat("GTA 3")
  hideCat("GTA 3","close")

hideCat("GTA Vice City","close")
  hideCat("GTA Vice City")
  hideCat("GTA Vice City","close")

hideCat("GTA San Andreas","close")
  hideCat("GTA San Andreas")
  hideCat("GTA San Andreas","close")

hideCat("Grand Theft Auto 4","close")
  hideCat("Grand Theft Auto 4")
  hideCat("Grand Theft Auto 4","close")

hideCat("GTA Chinatown Wars","close")
  hideCat("GTA Chinatown Wars")
  hideCat("GTA Chinatown Wars","close")

hideCat("Форум","close")
  hideCat("Форум")
  hideCat("Форум","close")

hideCat("Беседка","close")
  hideCat("Беседка")
  hideCat("Беседка","close")

hideCat("Админка... House - Life","close")
  hideCat("Админка... House - Life")
  hideCat("Админка... House - Life","close")

hideCat("Модераторский раздел!","close")
  hideCat("Модераторский раздел!")
  hideCat("Модераторский раздел!","close")

  window.onunload = saveCookie
}

function checkCookie(name,index) {
if(window.navigator.appName!="Microsoft Internet Explorer")
  return false
cook = unescape(document.cookie)
         if( (pos=cook.indexOf(name))!=-1 )
{
    state=cook.substring(pos-2,pos)
    if(state=="op")
    showCat(index)
    else if(state=="cl") closeCat(index)
   
    return true
}
return false
}

function saveCookie() {
if(window.navigator.appName!="Microsoft Internet Explorer")
  return
s=""
for(i=0;i<20;i++)
{
    elem=document.getElementById("inp"+i)
    if(elem)
    {
    if(document.getElementById("tab"+i).style.display=="none") state="cl"
    else state="op"
    name = document.getElementById("tab"+i).name
    s+=escape(state+name+'\n');
   
    catCount--
    }
   
    if(catCount==0)
    break;
}
document.cookie=s+'; expires=Fri, 01-Jan-2010 00:00:01 GMT';
}

function hideCat(name, state){
  index = findCat(name)

  if(index==-1) return -1
  catCount++

  str  = "<div class=\"catleft\"><!-- --></div>"
  str += "<img title=\"" + tit_show + "\" align=\"right\" style=\"cursor: hand;\" src=" + str_show + " id=inp"+index+" onclick='changeCat("+index+")'>"   
  str += name
  str += "<div class=\"catright\"><!-- --></div>"
  document.getElementsByTagName ("h2") [index+offset] .innerHTML = str
 
  document.getElementsByTagName ("table") [index+tableOffset] .id = "tab"+index
  document.getElementById("tab"+index).name = name

  cl=checkCookie(name,index)
  if(state=="close" && !cl)
  closeCat(index) 
}

function findT()
{
  i=0
  arr=document.getElementsByTagName ("table")
 
  while(arr[i].summary.toLowerCase().substring(0,27)!="список форумов в категории:")
    i++

  tableOffset = i
}
function findO()
{
  arr = document.getElementsByTagName ("h2")
  i=0
  while(arr[i].innerHTML.substring(0,2)!="<D")
    i++
 
  offset=i
}

function findCat(name)
{
  arr = document.getElementsByTagName ("h2")
  i=offset

  while(arr[i].innerHTML.substring(0,2)=="<D")
  {
if(arr[i].innerHTML.toLowerCase().indexOf(name.toLowerCase())!=-1)
    return (i-offset)
i++
  }
 
  return -1
}

function changeCat(index){
  if(index==-1) return

  if(  document.getElementById("tab"+index).style.display!="none") closeCat(index)
  else showCat(index)
}

function closeCat(index){
  document.getElementById("tab"+index).style.display="none"
  document.getElementById("inp"+index).src = str_show
  document.getElementById("inp"+index).title = tit_show + " " + document.getElementById("tab"+index).name
}

function showCat(index){
    document.getElementById("tab"+index).style.display="block"
document.getElementById("inp"+index).src = str_hide
document.getElementById("inp"+index).title = tit_hide + " " + document.getElementById("tab"+index).name
}
</script>