  var offset_top = 0;
  var offset_left = 0;
  var offset = 0;
  var current_game = 0;
  var t;

  function get_top( e ) {
    e = document.getElementById(e);
    return get_top_coord(e, 0);
  }

  function get_left( e ) {
    e = document.getElementById(e);
    return get_left_coord(e, 0);
  }

  function get_top_coord( el, offset ) {
   if ( el.offsetParent ) offset += get_top_coord(el.offsetParent, offset);
   offset += el.offsetTop;
   return offset;
  }

  function get_left_coord( el, offset ) {
   if ( el.offsetParent ) offset += get_left_coord(el.offsetParent, offset);
   offset += el.offsetLeft;
   return offset;
  }

  function products_select_click( game_id ) {
    if ( game_id == current_game ) {
	    hide_products_select( game_id );
    } else {
	    hide_products_select( current_game );
	    show_products_select( game_id );
    }
    current_game = ( game_id == current_game ) ? 0 : game_id;
  }

  function show_products_select( game_id ) {

	    el = document.getElementById("game_goods" + game_id);
	    el.style.top = get_top("game" + game_id) + 20;
  	  el.style.left = get_left("game" + game_id);
	    el.style.display = "block";

	    el = document.getElementById("game_bottom" + game_id);
	    el.style.display = "none";
    	current_game = ( game_id = current_game ) ? 0 : game_id;
  }


  function hide_products_select( game_id ) {
		if ( game_id == 0 ) return;

    el = document.getElementById("game_goods" + game_id);
    el.style.top = get_top("game" + game_id) + 25;
	  el.style.left = get_left("game" + game_id);
    el.style.display = "none";

    el = document.getElementById("game_bottom" + game_id);
    el.style.display = "block";
  }

