//++
//
//  JavaScript:
//	docs/swwww_button
//
//  Provides:
//	swwww_set_colors
//	swwww_set_color
//	swwww_set_default
//
//  Copyright:
//	Copyright © 2005 - 2010 Corpita Pty Ltd
//	15 Bedford Street, Collingwood 3066, Australia
//
//  History:
//	2010-04-22 by SLJ
//	    Move button hover effect from HTML to JavaScript
//	2010-04-01 by SLJ
//	    Integrate with Romber
//	06-Feb-2005 by Simon L. Jackson
//	    Initial version
//
//--

lcl_colors = new Object ();
lcl_default = new Object ();

lcl_default = 0;


function swwww_set_colors () {

  var lcl_button;
  var lcl_index;
  var lcl_suffix;

  lcl_colors[0] = "#A59C94";
  lcl_colors[1] = "#000000";
  lcl_colors[2] = "#F7B529";
  lcl_colors[3] = "#D62929";
  lcl_colors[4] = "#00848C";
  lcl_colors[5] = "#004A8C";
  lcl_colors[6] = "#000000";

  for ( lcl_index = 1; lcl_index <= 6; lcl_index++ ) {
    swwww_set_color ( lcl_index, 0 );
    lcl_suffix = lcl_index.toString();
    lcl_button = romber_find_element ( "button_" + lcl_suffix );
    lcl_button.setAttribute ( "onmouseout", "swwww_set_color(" + lcl_suffix + ",0);" );
    lcl_button.setAttribute ( "onmouseover", "swwww_set_color(" + lcl_suffix + ",1);" );
  }
  
}


function swwww_set_color ( arg_index, arg_state ) {

  var lcl_color;
  var lcl_command;
  var lcl_button;

  if ( arg_state == 1 || arg_index == lcl_default )
    lcl_color = lcl_colors[arg_index];
  else
    lcl_color = lcl_colors[0];

  lcl_button = romber_find_element ( "button_" + arg_index.toString() ); 
  lcl_button.style.backgroundColor = lcl_color;

}


function swwww_set_default ( arg_index ) {

  lcl_default = arg_index + 0;

}

