mixin displayOtherTeam(team, text)
  - var teamvisible = team.collection.parents[0].get('visibleteam')
  - var isdef = typeof teamvisible
  if isdef != 'undefined' && teamvisible
    section.battle_team_preview
      p= text
      ul.row-fluid.unstyled
        - team.get('pokemon').each(function(pokemon) {
          li.px_40
             +displayPokemon(pokemon)
        - })

mixin displayYourTeam(team, text)
  section.battle_team_preview
    p= text
    ul.row-fluid.unstyled
      - for (var i = 0; i < battle.numActive; i++)
        li.px_40.lead_text
          if battle.numActive > 1
            | Lead #{i + 1}
          else
            | Lead
    ul.arrange_team.row-fluid.unstyled
      - yourTeam.get('pokemon').each(function(pokemon, i) {
        li.px_40.img-polaroid.arrange_pokemon
          +displayPokemon(pokemon, i)
      - })

    .button.submit_arrangement Start battle

mixin displayPokemon(pokemon, i)
  .team_pokemon
    - var style = window.PokemonIconBackground(pokemon)
    .pokemon_icon(data-index = i, style = style)
  if pokemon.get('gender') === 'F'
    .gender.gender_female &#9792;
  else if pokemon.get('gender') === 'M'
    .gender.gender_male &#9794;
  if pokemon.get('level') != 120
    .level Lv.#{pokemon.get('level')}

.battle_teams
  - var theirTeam = battle.getOpponentTeam()
  - var yourTeam = battle.getTeam()
  +displayOtherTeam(theirTeam, theirTeam.get('owner') + "'s team:")
  if !battle.get('spectating')
    +displayYourTeam(yourTeam, "Click Pokemon to switch them around:")
  else
    +displayOtherTeam(yourTeam, yourTeam.get('owner') + "'s team:")
