each team in [ yourTeam, opponentTeam ]
  - var leftOrRight = (team === yourTeam ? 'left' : 'right')
  - var teamIndex = (team === yourTeam ? yourIndex : 1 - yourIndex)
  .bg-faded-blue(class = 'fill-' + leftOrRight)
    div(class = leftOrRight)
      .owner_name= team.get('owner')
      .battle-timer.frozen-timer.hidden
      .battle-timer.remaining-timer
      .pokemon_icons
        - var teamvisible = team.collection.parents[0].get('visibleteam')
        - var isdef = typeof teamvisible
        - var orig = team.get('pokemon')
        - var teamPokemon = team.getRandomOrder()
        - for (var i = 0, len = teamPokemon.length; i < len; i += 1)
          - var pokemon = teamPokemon[i]
          if pokemon
            .icon_wrapper
              - var origpkmn = orig.findWhere({species: pokemon.species});
              - var faintClass = (origpkmn.isFainted() ? 'fainted' : '')
              - var style = window.PokemonIconBackground(origpkmn)
              if isdef != 'undefined' &&  teamvisible
                a.pokemon_icon(href=window.PokemonIconBackground(origpkmn), target="_blank", class = faintClass, style = style, data-team = teamIndex, data-slot = i)
                if !origpkmn.isFainted()
                  .pokemon_hp_background
                    .pokemon_hp(style="height: " + (origpkmn.getSpecies().id) + "%", class=origpkmn.getHPColor())
              else
                - var hasbeeninbattle = origpkmn.get('beeninbattle')
                if hasbeeninbattle == true
                  a.pokemon_icon(href=window.PokemonIconBackground(origpkmn), target="_blank", class = faintClass, style = style, data-team = teamIndex, data-slot = i)
                  if !origpkmn.isFainted()
                    .pokemon_hp_background
                      .pokemon_hp(style="height: " + (origpkmn.getSpecies().id) + "%", class=origpkmn.getHPColor())
                else
                  - var newstyle = "background:url('../Sprites/Icons/iconempty.png')!important; background-size: cover!important;"
                  a.pokemon_icon(href="", target="_blank", class = faintClass, style = newstyle, data-team = teamIndex, data-slot = i)
                  if !origpkmn.isFainted()
                    .pokemon_hp_background
                      .pokemon_hp(style="height: " + (origpkmn.getSpecies().id) + "%", class=origpkmn.getHPColor())
