﻿// Top List Script by Dmhope
// Data: 13.12.2009  23:00
// Author: DMhope
// Site: www.dmhope.ru
function DMmswitch( what_to_switch ) {
	var active_bgcolor = '#608ad8';
    var active_color = "#ffffff";
    var bgcolor = "#ffffff";
    var color = "#000000";
    var active_cursor = "default";
    var cursor = "pointer";
    var link_comment = mp_get_by_id('link_comment' );
    var link_posts = mp_get_by_id('link_posts' );
    var link_reputation = mp_get_by_id('link_reputation' );
    var div_comment = mp_get_by_id('div_comment' );
    var div_posts = mp_get_by_id('div_posts' );
    var div_reputation = mp_get_by_id('div_reputation' );

    if( what_to_switch == "reputation" )
    {
      if( link_comment )
      {
        link_comment.style.backgroundColor = bgcolor;
        link_comment.style.color = color;
        link_comment.style.cursor = cursor;
      }
      if( link_posts )
      {
        link_posts.style.backgroundColor = bgcolor;
        link_posts.style.color = color;
        link_posts.style.cursor = cursor;
      }
      if( link_reputation )
      {
        link_reputation.style.backgroundColor = active_bgcolor;
        link_reputation.style.color = active_color;
        link_reputation.style.cursor = active_cursor;
      }
      hide_mp_div( div_comment );
      hide_mp_div( div_posts );
      show_mp_div( div_reputation );
    }
    else if( what_to_switch == "posts" )
    {
      if( link_comment )
      {
        link_comment.style.backgroundColor = bgcolor;
        link_comment.style.color = color;
        link_comment.style.cursor = cursor;
      }
      if( link_posts )
      {
        link_posts.style.backgroundColor = active_bgcolor;
        link_posts.style.color = active_color;
        link_posts.style.cursor = active_cursor;
      }
      if( link_reputation )
      {
        link_reputation.style.backgroundColor = bgcolor;
        link_reputation.style.color = color;
        link_reputation.style.cursor = cursor;
      }
      hide_mp_div( div_comment );
      show_mp_div( div_posts );
      hide_mp_div( div_reputation );
    }
    else if( what_to_switch == "comment" )
    {
      if( link_comment )
      {
        link_comment.style.backgroundColor = active_bgcolor;
        link_comment.style.color = active_color;
        link_comment.style.cursor = active_cursor;
      }
      if( link_posts )
      {
        link_posts.style.backgroundColor = bgcolor;
        link_posts.style.color = color;
        link_posts.style.cursor = cursor;
      }
      if( link_reputation )
      {
        link_reputation.style.backgroundColor = bgcolor;
        link_reputation.style.color = color;
        link_reputation.style.cursor = cursor;
      }
      show_mp_div( div_comment );
      hide_mp_div( div_posts );
      hide_mp_div( div_reputation );
    }
    else
    {
      return false;
    }

    return true;  
  }



  
   function DMhide_el( id )
  {
    var element = mp_get_by_id( id );
    if( !element )
    {
      return false;
    }
    hide_mp_div( element );
    return true;
  }
 
   function hide_mp_div( element )
  {
    if( !element )
    {
      var element = mp_get_by_id( element );
      if( !element )
      {
        return false;
      }
    }
    element.style.display = "none";
    return true;
  }
 function mp_get_by_id( id )
  {
    var element = null;
    if( document.getElementById )
    {
      element = document.getElementById( id );
    }
    else if( document.all )
    {
      element = document.all[id];
    }
    else if( document.layers )
    {
      element = document.layers[id];
    }

    return element;
  }

 
  function DMshow_el( id )
  {
    var element = mp_get_by_id( id );
    if( !element )
    {
      return false;
    }
    show_mp_div( element );
    return true;
  }

  function show_mp_div( element )
  {
    if( !element )
    {
      var element = mp_get_by_id( element );
      if( !element )
      {
        return false;
      }
    }
    element.style.display = '';
    return true;
  }

  var searchfield_clicked = false;