window.onload = function() {
  reg_btn=document.getElementById('reg');
  login_btn=document.getElementById('login');
  moddata_btn=document.getElementById('moddata');
  newtopic_btn=document.getElementById('newtopic');
  fpsw_btn=document.getElementById('fpsw');
  fr_btn=document.getElementById('fr');
  newcomment_btn=document.getElementById('new_comment');
  cwf=document.getElementById('commentwriteform');

  t_1 = document.getElementById('tab_1');
  t_2 = document.getElementById('tab_2');
  t_3 = document.getElementById('tab_3');
  t_4 = document.getElementById('tab_4');

  if (newcomment_btn) {
   newcomment_btn.onclick=function() {
     cwf.style.display='block';
   }

  }
	
  if (reg_btn) {
    reg_btn.onmouseover=function() {
      reg_btn.src='images/register2.png';
    }

    reg_btn.onmouseout=function() {
      reg_btn.src='images/register1.png';
    }

    reg_btn.onclick=function() {
      t_2.style.display='none';		
      t_1.style.display='block';
      if (t_3) t_3.style.display='none';
    }
  }

  if (login_btn) {
    login_btn.onmouseover=function() {
      login_btn.src='images/login2.png';
    }

    login_btn.onmouseout=function() {
      login_btn.src='images/login1.png';
    }

    login_btn.onclick=function() {
      t_1.style.display='none';
      t_2.style.display='block';
      if (t_3) t_3.style.display='none';
    }
  }

  if (moddata_btn) {
    moddata_btn.onmouseover=function() {
      moddata_btn.src='images/moddata2.png';
    }

    moddata_btn.onmouseout=function() {
      moddata_btn.src='images/moddata1.png';
    }

    moddata_btn.onclick=function() {
      t_4.style.display='none';		
      t_2.style.display='none';		
      t_1.style.display='block';
      if (t_3) t_3.style.display='none';
    }
  }

  if (newtopic_btn) {
    newtopic_btn.onmouseover=function() {
      newtopic_btn.src='images/newtopic2.png';
    }

    newtopic_btn.onmouseout=function() {
      newtopic_btn.src='images/newtopic1.png';
    }

    newtopic_btn.onclick=function() {
      t_4.style.display='none';
      t_1.style.display='none';
      t_2.style.display='block';
      if (t_3) t_3.style.display='none';
   }
  }

  if (fpsw_btn) {
    fpsw_btn.onmouseover=function() {
      fpsw_btn.src='images/forgottenpsw2.png';
    }

    fpsw_btn.onmouseout=function() {
      fpsw_btn.src='images/forgottenpsw1.png';
    }

    fpsw_btn.onclick=function() {
      t_2.style.display='none';
      t_1.style.display='none';
      if (t_3) t_3.style.display='block';
    }
  }

  if (fr_btn) {
    fr_btn.onmouseover=function() {
      fr_btn.src='images/forumrules2.png';
    }

    fr_btn.onmouseout=function() {
      fr_btn.src='images/forumrules1.png';
    }
  }
}
