/**********************************************************************************/
/*                                                                                */
/*  Function Name:  toggle_state0()                                               */
/*  Description:                                                                  */
/*  Parameters                                                                    */
/*  Input:          ulref, id                                                     */
/*  Output:         FALSE                                                         */
/*                                                                                */
/*  Author:         Raymond Chow                                                  */
/*  Date:           27 February 2010                                              */
/*                                                                                */
/**********************************************************************************/
function toggle_state() {

  var arg = toggle_state.arguments;
  
  var ulref = arg[0];
  var id    = arg[1];

  var css_active    = "on";
  var css_inactive  = "off";
  
  var original = "";
  
  if (document.getElementById(id)) {  
      toggle_content(id);
      
      if  (ulref) {
      
          original = ulref.className;

          if (original == css_active)    { ulref.className = css_inactive; }
          if (original == css_inactive)  { ulref.className = css_active;   } 
  
      }
      
  }
  
  return false;
}

/**********************************************************************************/
/*                                                                                */
/*  Function Name:  toggle_content()                                              */
/*  Description:                                                                  */
/*  Parameters                                                                    */
/*  Input:          id, id, id...                                                 */
/*  Output:         FALSE                                                         */
/*                                                                                */
/*  Author:         Raymond Chow                                                  */
/*  Date:           27 February 2010                                              */
/*                                                                                */
/**********************************************************************************/

function toggle_content() {

  var arg = toggle_content.arguments;
  var original = "";

  for (i = 0; i < arg.length; i++) {
  
    if (document.getElementById(arg[i])) {

      original = document.getElementById(arg[i]).style.display;
      
      if (original == "none")  { toggle_content_on(arg[i]);   }
      if (original == "block") { toggle_content_off(arg[i]);  }

    }
  }
  
  return false;
}

/**********************************************************************************/
/*                                                                                */
/*  Function Name:  toggle_content_off()                                          */
/*  Description:                                                                  */
/*  Parameters                                                                    */
/*  Input:          id                                                            */
/*  Output:         FALSE                                                         */
/*                                                                                */
/*  Author:         Raymond Chow                                                  */
/*  Date:           27 February 2010                                              */
/*                                                                                */
/**********************************************************************************/

function toggle_content_off() {

  var arg = toggle_content_off.arguments;
  var id = arg[0];
 
  if (document.getElementById(id)) {
    document.getElementById(id).style.display = "none";
  } 

  return false;
}


/**********************************************************************************/
/*                                                                                */
/*  Function Name:  toggle_content_on()                                           */
/*  Description:                                                                  */
/*  Parameters                                                                    */
/*  Input:          id                                                            */
/*  Output:         FALSE                                                         */
/*                                                                                */
/*  Author:         Raymond Chow                                                  */
/*  Date:           27 February 2010                                              */
/*                                                                                */
/**********************************************************************************/


function toggle_content_on() {

  var arg = toggle_content_on.arguments;
  var id = arg[0];
 
  if (document.getElementById(id)) {   
    document.getElementById(id).style.display = "block";
  } 

  return false;
}


