 function hidealllines()
  {
   document.getElementById("attackline1").style.display='none';
   document.getElementById("attackline2").style.display='none';
   document.getElementById("attackline3").style.display='none';
   document.getElementById("attackline4").style.display='none';
   document.getElementById("defenderline1").style.display='none';
   document.getElementById("defenderline2").style.display='none';
   document.getElementById("defenderline3").style.display='none';
   document.getElementById("goalkeeperline1").style.display='none';
   document.getElementById("goalkeeperline2").style.display='none';
  }
 function updateformation()
  {
   // update formation
   str="<table border='0' cellpadding='2' cellspacing='2'>";
     str+="<tr>";
      str+="<td height='25' colspan='5'><b>Erster Sturm</b></td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td height='25'>";
       str+=document.formationform.attacker1_1[document.formationform.attacker1_1.selectedIndex].text;
      str+="</td>";
      str+="<td width='10'>&nbsp;</td>";
      str+="<td>";
       str+=document.formationform.attacker1_2[document.formationform.attacker1_2.selectedIndex].text;
      str+="</td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td colspan='3' height='25'>";
       str+=document.formationform.attacker1_3[document.formationform.attacker1_3.selectedIndex].text;
      str+="</td>";
     str+="</tr>";

     str+="<tr>";
      str+="<td height='25' colspan='5'><b>Zweiter Sturm</b></td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td height='25'>";
       str+=document.formationform.attacker2_1[document.formationform.attacker2_1.selectedIndex].text;
      str+="</td>";
      str+="<td width='10'>&nbsp;</td>";
      str+="<td>";
       str+=document.formationform.attacker2_2[document.formationform.attacker2_2.selectedIndex].text;
      str+="</td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td colspan='3' height='25'>";
       str+=document.formationform.attacker2_3[document.formationform.attacker2_3.selectedIndex].text;
      str+="</td>";
     str+="</tr>";

     str+="<tr>";
      str+="<td colspan='5' height='25'><b>Dritter Sturm</b></td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td height='25'>";
       str+=document.formationform.attacker3_1[document.formationform.attacker3_1.selectedIndex].text;
      str+="</td>";
      str+="<td width='10'>&nbsp;</td>";
      str+="<td>";
       str+=document.formationform.attacker3_2[document.formationform.attacker3_2.selectedIndex].text;
      str+="</td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td colspan='3' height='25'>";
       str+=document.formationform.attacker3_3[document.formationform.attacker3_3.selectedIndex].text;
      str+="</td>";
     str+="</tr>";

     str+="<tr>";
      str+="<td colspan='5' height='25'><b>Vierter Sturm</b></td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td height='25'>";
       str+=document.formationform.attacker4_1[document.formationform.attacker4_1.selectedIndex].text;
      str+="</td>";
      str+="<td width='10'>&nbsp;</td>";
      str+="<td>";
       str+=document.formationform.attacker4_2[document.formationform.attacker4_2.selectedIndex].text;
      str+="</td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td colspan='3' height='25'>";
       str+=document.formationform.attacker4_3[document.formationform.attacker4_3.selectedIndex].text;
      str+="</td>";
     str+="</tr>";
    str+="</table>";

   str+="<table border='0' cellpadding='2' cellspacing='2'>";
     str+="<tr>";
      str+="<td colspan='5' height='25'><b>Erste Verteidigerreihe</b></td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td height='25'>";
       str+=document.formationform.defender1_1[document.formationform.defender1_1.selectedIndex].text;
      str+="</td>";
      str+="<td width='10'>&nbsp;</td>";
      str+="<td>";
       str+=document.formationform.defender1_2[document.formationform.defender1_2.selectedIndex].text;
      str+="</td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td colspan='5' height='25'><b>Zweite Verteidigerreihe</b></td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td height='25'>";
       str+=document.formationform.defender2_1[document.formationform.defender2_1.selectedIndex].text;
      str+="</td>";
      str+="<td width='10'>&nbsp;</td>";
      str+="<td>";
       str+=document.formationform.defender2_2[document.formationform.defender2_2.selectedIndex].text;
      str+="</td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td colspan='5' height='25'><b>Dritte Verteidigerreihe</b></td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td height='25'>";
       str+=document.formationform.defender3_1[document.formationform.defender3_1.selectedIndex].text;
      str+="</td>";
      str+="<td width='10'>&nbsp;</td>";
      str+="<td>";
       str+=document.formationform.defender3_2[document.formationform.defender3_2.selectedIndex].text;
      str+="</td>";
     str+="</tr>";
    str+="</table>";

   str+="<table border='0' cellpadding='2' cellspacing='2'>";
     str+="<tr>";
      str+="<td colspan='5' height='25'><b>Torh&uuml;ter</b></td>";
     str+="</tr>";
     str+="<tr>";
      str+="<td height='25'>";
       str+=document.formationform.goalkeeper1[document.formationform.goalkeeper1.selectedIndex].text;
      str+="</td>";
      str+="<td width='10'>&nbsp;</td>";
      str+="<td>";
       str+=document.formationform.goalkeeper2[document.formationform.goalkeeper2.selectedIndex].text;
      str+="</td>";
     str+="</tr>";
    str+="</table>";

    document.getElementById("formation").innerHTML=str;
  }
 function selectline(index)
  {
   hidealllines();
   switch (index)
    {
     case 1:
      document.getElementById("attackline1").style.display='';
      break;
     case 2:
      document.getElementById("attackline2").style.display='';
      break;
     case 3:
      document.getElementById("attackline3").style.display='';
      break;
     case 4:
      document.getElementById("attackline4").style.display='';
      break;
     case 5:
      document.getElementById("defenderline1").style.display='';
      break;
     case 6:
      document.getElementById("defenderline2").style.display='';
      break;
     case 7:
      document.getElementById("defenderline3").style.display='';
      break;
     case 8:
      document.getElementById("goalkeeperline1").style.display='';
      break;
     case 9:
      document.getElementById("goalkeeperline2").style.display='';
      break;
    }

   updateformation();
  }
 function update_attackers()
  {
   curselectedattacker=0;

   for (cur=1;cur<=curattacker;cur++)
    {
     selectedattackers[cur]=0;
    }

   id=document.formationform.attacker1_1[document.formationform.attacker1_1.selectedIndex].value;
   if (document.formationform.attacker1_1.selectedIndex!=0)
    {
     curselectedattacker++;
     selectedattackers[curselectedattacker]=id;
    }
   id=document.formationform.attacker1_2[document.formationform.attacker1_2.selectedIndex].value;
   if (document.formationform.attacker1_2.selectedIndex!=0)
    {
     curselectedattacker++;
     selectedattackers[curselectedattacker]=id;
    }
   id=document.formationform.attacker1_3[document.formationform.attacker1_3.selectedIndex].value;
   if (document.formationform.attacker1_3.selectedIndex!=0)
    {
     curselectedattacker++;
     selectedattackers[curselectedattacker]=id;
    }

   id=document.formationform.attacker2_1[document.formationform.attacker2_1.selectedIndex].value;
   if (document.formationform.attacker2_1.selectedIndex!=0)
    {
     curselectedattacker++;
     selectedattackers[curselectedattacker]=id;
    }
   id=document.formationform.attacker2_2[document.formationform.attacker2_2.selectedIndex].value;
   if (document.formationform.attacker2_2.selectedIndex!=0)
    {
     curselectedattacker++;
     selectedattackers[curselectedattacker]=id;
    }
   id=document.formationform.attacker2_3[document.formationform.attacker2_3.selectedIndex].value;
   if (document.formationform.attacker2_3.selectedIndex!=0)
    {
     curselectedattacker++;
     selectedattackers[curselectedattacker]=id;
    }

   id=document.formationform.attacker3_1[document.formationform.attacker3_1.selectedIndex].value;
   if (document.formationform.attacker3_1.selectedIndex!=0)
    {
     curselectedattacker++;
     selectedattackers[curselectedattacker]=id;
    }
   id=document.formationform.attacker3_2[document.formationform.attacker3_2.selectedIndex].value;
   if (document.formationform.attacker3_2.selectedIndex!=0)
    {
     curselectedattacker++;
     selectedattackers[curselectedattacker]=id;
    }
   id=document.formationform.attacker3_3[document.formationform.attacker3_3.selectedIndex].value;
   if (document.formationform.attacker3_3.selectedIndex!=0)
    {
     curselectedattacker++;
     selectedattackers[curselectedattacker]=id;
    }

   id=document.formationform.attacker4_1[document.formationform.attacker4_1.selectedIndex].value;
   if (document.formationform.attacker4_1.selectedIndex!=0)
    {
     curselectedattacker++;
     selectedattackers[curselectedattacker]=id;
    }
   id=document.formationform.attacker4_2[document.formationform.attacker4_2.selectedIndex].value;
   if (document.formationform.attacker4_2.selectedIndex!=0)
    {
     curselectedattacker++;
     selectedattackers[curselectedattacker]=id;
    }
   id=document.formationform.attacker4_3[document.formationform.attacker4_3.selectedIndex].value;
   if (document.formationform.attacker4_3.selectedIndex!=0)
    {
     curselectedattacker++;
     selectedattackers[curselectedattacker]=id;
    }

   if (curselectedattacker!=0)
    {
     // some attackers selected

     // fill attacker1_1
     selectedid=document.formationform.attacker1_1[document.formationform.attacker1_1.selectedIndex].value;
     document.formationform.attacker1_1.length=0;
     document.formationform.attacker1_1.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curattacker;cur++)
      {
       if ((!in_array(attackers_id[cur],selectedattackers))||(selectedid==attackers_id[cur]))
        {
         cursel++;
         el=new Option(attackers_firstname[cur]+" "+attackers_lastname[cur]+" ("+attackers_strength[cur]+")",attackers_id[cur]);
         document.formationform.attacker1_1.options[cursel]=el;
         if (selectedid==attackers_id[cur])
          {
           document.formationform.attacker1_1.selectedIndex=cursel;
          }
        }
      }

     // fill attacker1_2
     selectedid=document.formationform.attacker1_2[document.formationform.attacker1_2.selectedIndex].value;
     document.formationform.attacker1_2.length=0;
     document.formationform.attacker1_2.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curattacker;cur++)
      {
       if ((!in_array(attackers_id[cur],selectedattackers))||(selectedid==attackers_id[cur]))
        {
         cursel++;
         el=new Option(attackers_firstname[cur]+" "+attackers_lastname[cur]+" ("+attackers_strength[cur]+")",attackers_id[cur]);
         document.formationform.attacker1_2.options[cursel]=el;
         if (selectedid==attackers_id[cur])
          {
           document.formationform.attacker1_2.selectedIndex=cursel;
          }
        }
      }

     // fill attacker1_3
     selectedid=document.formationform.attacker1_3[document.formationform.attacker1_3.selectedIndex].value;
     document.formationform.attacker1_3.length=0;
     document.formationform.attacker1_3.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curattacker;cur++)
      {
       if ((!in_array(attackers_id[cur],selectedattackers))||(selectedid==attackers_id[cur]))
        {
         cursel++;
         el=new Option(attackers_firstname[cur]+" "+attackers_lastname[cur]+" ("+attackers_strength[cur]+")",attackers_id[cur]);
         document.formationform.attacker1_3.options[cursel]=el;
         if (selectedid==attackers_id[cur])
          {
           document.formationform.attacker1_3.selectedIndex=cursel;
          }
        }
      }

     // fill attacker2_1
     selectedid=document.formationform.attacker2_1[document.formationform.attacker2_1.selectedIndex].value;
     document.formationform.attacker2_1.length=0;
     document.formationform.attacker2_1.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curattacker;cur++)
      {
       if ((!in_array(attackers_id[cur],selectedattackers))||(selectedid==attackers_id[cur]))
        {
         cursel++;
         el=new Option(attackers_firstname[cur]+" "+attackers_lastname[cur]+" ("+attackers_strength[cur]+")",attackers_id[cur]);
         document.formationform.attacker2_1.options[cursel]=el;
         if (selectedid==attackers_id[cur])
          {
           document.formationform.attacker2_1.selectedIndex=cursel;
          }
        }
      }

     // fill attacker2_2
     selectedid=document.formationform.attacker2_2[document.formationform.attacker2_2.selectedIndex].value;
     document.formationform.attacker2_2.length=0;
     document.formationform.attacker2_2.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curattacker;cur++)
      {
       if ((!in_array(attackers_id[cur],selectedattackers))||(selectedid==attackers_id[cur]))
        {
         cursel++;
         el=new Option(attackers_firstname[cur]+" "+attackers_lastname[cur]+" ("+attackers_strength[cur]+")",attackers_id[cur]);
         document.formationform.attacker2_2.options[cursel]=el;
         if (selectedid==attackers_id[cur])
          {
           document.formationform.attacker2_2.selectedIndex=cursel;
          }
        }
      }

     // fill attacker2_3
     selectedid=document.formationform.attacker2_3[document.formationform.attacker2_3.selectedIndex].value;
     document.formationform.attacker2_3.length=0;
     document.formationform.attacker2_3.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curattacker;cur++)
      {
       if ((!in_array(attackers_id[cur],selectedattackers))||(selectedid==attackers_id[cur]))
        {
         cursel++;
         el=new Option(attackers_firstname[cur]+" "+attackers_lastname[cur]+" ("+attackers_strength[cur]+")",attackers_id[cur]);
         document.formationform.attacker2_3.options[cursel]=el;
         if (selectedid==attackers_id[cur])
          {
           document.formationform.attacker2_3.selectedIndex=cursel;
          }
        }
      }

     // fill attacker3_1
     selectedid=document.formationform.attacker3_1[document.formationform.attacker3_1.selectedIndex].value;
     document.formationform.attacker3_1.length=0;
     document.formationform.attacker3_1.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curattacker;cur++)
      {
       if ((!in_array(attackers_id[cur],selectedattackers))||(selectedid==attackers_id[cur]))
        {
         cursel++;
         el=new Option(attackers_firstname[cur]+" "+attackers_lastname[cur]+" ("+attackers_strength[cur]+")",attackers_id[cur]);
         document.formationform.attacker3_1.options[cursel]=el;
         if (selectedid==attackers_id[cur])
          {
           document.formationform.attacker3_1.selectedIndex=cursel;
          }
        }
      }

     // fill attacker3_2
     selectedid=document.formationform.attacker3_2[document.formationform.attacker3_2.selectedIndex].value;
     document.formationform.attacker3_2.length=0;
     document.formationform.attacker3_2.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curattacker;cur++)
      {
       if ((!in_array(attackers_id[cur],selectedattackers))||(selectedid==attackers_id[cur]))
        {
         cursel++;
         el=new Option(attackers_firstname[cur]+" "+attackers_lastname[cur]+" ("+attackers_strength[cur]+")",attackers_id[cur]);
         document.formationform.attacker3_2.options[cursel]=el;
         if (selectedid==attackers_id[cur])
          {
           document.formationform.attacker3_2.selectedIndex=cursel;
          }
        }
      }

     // fill attacker3_3
     selectedid=document.formationform.attacker3_3[document.formationform.attacker3_3.selectedIndex].value;
     document.formationform.attacker3_3.length=0;
     document.formationform.attacker3_3.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curattacker;cur++)
      {
       if ((!in_array(attackers_id[cur],selectedattackers))||(selectedid==attackers_id[cur]))
        {
         cursel++;
         el=new Option(attackers_firstname[cur]+" "+attackers_lastname[cur]+" ("+attackers_strength[cur]+")",attackers_id[cur]);
         document.formationform.attacker3_3.options[cursel]=el;
         if (selectedid==attackers_id[cur])
          {
           document.formationform.attacker3_3.selectedIndex=cursel;
          }
        }
      }

     // fill attacker4_1
     selectedid=document.formationform.attacker4_1[document.formationform.attacker4_1.selectedIndex].value;
     document.formationform.attacker4_1.length=0;
     document.formationform.attacker4_1.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curattacker;cur++)
      {
       if ((!in_array(attackers_id[cur],selectedattackers))||(selectedid==attackers_id[cur]))
        {
         cursel++;
         el=new Option(attackers_firstname[cur]+" "+attackers_lastname[cur]+" ("+attackers_strength[cur]+")",attackers_id[cur]);
         document.formationform.attacker4_1.options[cursel]=el;
         if (selectedid==attackers_id[cur])
          {
           document.formationform.attacker4_1.selectedIndex=cursel;
          }
        }
      }

     // fill attacker4_2
     selectedid=document.formationform.attacker4_2[document.formationform.attacker4_2.selectedIndex].value;
     document.formationform.attacker4_2.length=0;
     document.formationform.attacker4_2.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curattacker;cur++)
      {
       if ((!in_array(attackers_id[cur],selectedattackers))||(selectedid==attackers_id[cur]))
        {
         cursel++;
         el=new Option(attackers_firstname[cur]+" "+attackers_lastname[cur]+" ("+attackers_strength[cur]+")",attackers_id[cur]);
         document.formationform.attacker4_2.options[cursel]=el;
         if (selectedid==attackers_id[cur])
          {
           document.formationform.attacker4_2.selectedIndex=cursel;
          }
        }
      }

     // fill attacker4_3
     selectedid=document.formationform.attacker4_3[document.formationform.attacker4_3.selectedIndex].value;
     document.formationform.attacker4_3.length=0;
     document.formationform.attacker4_3.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curattacker;cur++)
      {
       if ((!in_array(attackers_id[cur],selectedattackers))||(selectedid==attackers_id[cur]))
        {
         cursel++;
         el=new Option(attackers_firstname[cur]+" "+attackers_lastname[cur]+" ("+attackers_strength[cur]+")",attackers_id[cur]);
         document.formationform.attacker4_3.options[cursel]=el;
         if (selectedid==attackers_id[cur])
          {
           document.formationform.attacker4_3.selectedIndex=cursel;
          }
        }
      }

    }
   updateformation();
  }
 function update_defenders()
  {
   curselecteddefender=0;

   for (cur=1;cur<=curdefender;cur++)
    {
     selecteddefenders[cur]=0;
    }

   id=document.formationform.defender1_1[document.formationform.defender1_1.selectedIndex].value;
   if (document.formationform.defender1_1.selectedIndex!=0)
    {
     curselecteddefender++;
     selecteddefenders[curselecteddefender]=id;
    }
   id=document.formationform.defender1_2[document.formationform.defender1_2.selectedIndex].value;
   if (document.formationform.defender1_2.selectedIndex!=0)
    {
     curselecteddefender++;
     selecteddefenders[curselecteddefender]=id;
    }

   id=document.formationform.defender2_1[document.formationform.defender2_1.selectedIndex].value;
   if (document.formationform.defender2_1.selectedIndex!=0)
    {
     curselecteddefender++;
     selecteddefenders[curselecteddefender]=id;
    }
   id=document.formationform.defender2_2[document.formationform.defender2_2.selectedIndex].value;
   if (document.formationform.defender2_2.selectedIndex!=0)
    {
     curselecteddefender++;
     selecteddefenders[curselecteddefender]=id;
    }

   id=document.formationform.defender3_1[document.formationform.defender3_1.selectedIndex].value;
   if (document.formationform.defender3_1.selectedIndex!=0)
    {
     curselecteddefender++;
     selecteddefenders[curselecteddefender]=id;
    }
   id=document.formationform.defender3_2[document.formationform.defender3_2.selectedIndex].value;
   if (document.formationform.defender3_2.selectedIndex!=0)
    {
     curselecteddefender++;
     selecteddefenders[curselecteddefender]=id;
    }

   if (curselecteddefender!=0)
    {
     // some defenders selected

     // fill defender1_1
     selectedid=document.formationform.defender1_1[document.formationform.defender1_1.selectedIndex].value;
     document.formationform.defender1_1.length=0;
     document.formationform.defender1_1.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curdefender;cur++)
      {
       if ((!in_array(defenders_id[cur],selecteddefenders))||(selectedid==defenders_id[cur]))
        {
         cursel++;
         el=new Option(defenders_firstname[cur]+" "+defenders_lastname[cur]+" ("+defenders_strength[cur]+")",defenders_id[cur]);
         document.formationform.defender1_1.options[cursel]=el;
         if (selectedid==defenders_id[cur])
          {
           document.formationform.defender1_1.selectedIndex=cursel;
          }
        }
      }
     // fill defender1_2
     selectedid=document.formationform.defender1_2[document.formationform.defender1_2.selectedIndex].value;
     document.formationform.defender1_2.length=0;
     document.formationform.defender1_2.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curdefender;cur++)
      {
       if ((!in_array(defenders_id[cur],selecteddefenders))||(selectedid==defenders_id[cur]))
        {
         cursel++;
         el=new Option(defenders_firstname[cur]+" "+defenders_lastname[cur]+" ("+defenders_strength[cur]+")",defenders_id[cur]);
         document.formationform.defender1_2.options[cursel]=el;
         if (selectedid==defenders_id[cur])
          {
           document.formationform.defender1_2.selectedIndex=cursel;
          }
        }
      }

     // fill defender2_1
     selectedid=document.formationform.defender2_1[document.formationform.defender2_1.selectedIndex].value;
     document.formationform.defender2_1.length=0;
     document.formationform.defender2_1.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curdefender;cur++)
      {
       if ((!in_array(defenders_id[cur],selecteddefenders))||(selectedid==defenders_id[cur]))
        {
         cursel++;
         el=new Option(defenders_firstname[cur]+" "+defenders_lastname[cur]+" ("+defenders_strength[cur]+")",defenders_id[cur]);
         document.formationform.defender2_1.options[cursel]=el;
         if (selectedid==defenders_id[cur])
          {
           document.formationform.defender2_1.selectedIndex=cursel;
          }
        }
      }
     // fill defender2_2
     selectedid=document.formationform.defender2_2[document.formationform.defender2_2.selectedIndex].value;
     document.formationform.defender2_2.length=0;
     document.formationform.defender2_2.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curdefender;cur++)
      {
       if ((!in_array(defenders_id[cur],selecteddefenders))||(selectedid==defenders_id[cur]))
        {
         cursel++;
         el=new Option(defenders_firstname[cur]+" "+defenders_lastname[cur]+" ("+defenders_strength[cur]+")",defenders_id[cur]);
         document.formationform.defender2_2.options[cursel]=el;
         if (selectedid==defenders_id[cur])
          {
           document.formationform.defender2_2.selectedIndex=cursel;
          }
        }
      }

     // fill defender3_1
     selectedid=document.formationform.defender3_1[document.formationform.defender3_1.selectedIndex].value;
     document.formationform.defender3_1.length=0;
     document.formationform.defender3_1.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curdefender;cur++)
      {
       if ((!in_array(defenders_id[cur],selecteddefenders))||(selectedid==defenders_id[cur]))
        {
         cursel++;
         el=new Option(defenders_firstname[cur]+" "+defenders_lastname[cur]+" ("+defenders_strength[cur]+")",defenders_id[cur]);
         document.formationform.defender3_1.options[cursel]=el;
         if (selectedid==defenders_id[cur])
          {
           document.formationform.defender3_1.selectedIndex=cursel;
          }
        }
      }
     // fill defender3_2
     selectedid=document.formationform.defender3_2[document.formationform.defender3_2.selectedIndex].value;
     document.formationform.defender3_2.length=0;
     document.formationform.defender3_2.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curdefender;cur++)
      {
       if ((!in_array(defenders_id[cur],selecteddefenders))||(selectedid==defenders_id[cur]))
        {
         cursel++;
         el=new Option(defenders_firstname[cur]+" "+defenders_lastname[cur]+" ("+defenders_strength[cur]+")",defenders_id[cur]);
         document.formationform.defender3_2.options[cursel]=el;
         if (selectedid==defenders_id[cur])
          {
           document.formationform.defender3_2.selectedIndex=cursel;
          }
        }
      }


    }
   updateformation();
  }
 function update_goalkeepers()
  {
   curselectedgoalkeeper=0;

   for (cur=1;cur<=curgoalkeeper;cur++)
    {
     selectedgoalkeepers[cur]=0;
    }

   id=document.formationform.goalkeeper1[document.formationform.goalkeeper1.selectedIndex].value;
   if (document.formationform.goalkeeper1.selectedIndex!=0)
    {
     curselectedgoalkeeper++;
     selectedgoalkeepers[curselectedgoalkeeper]=id;
    }
   id=document.formationform.goalkeeper2[document.formationform.goalkeeper2.selectedIndex].value;
   if (document.formationform.goalkeeper2.selectedIndex!=0)
    {
     curselectedgoalkeeper++;
     selectedgoalkeepers[curselectedgoalkeeper]=id;
    }

   if (curselectedgoalkeeper!=0)
    {
     // some defenders selected

     // fill goalkeeper1
     selectedid=document.formationform.goalkeeper1[document.formationform.goalkeeper1.selectedIndex].value;
     document.formationform.goalkeeper1.length=0;
     document.formationform.goalkeeper1.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curgoalkeeper;cur++)
      {
       if ((!in_array(goalkeepers_id[cur],selectedgoalkeepers))||(selectedid==goalkeepers_id[cur]))
        {
         cursel++;
         el=new Option(goalkeepers_firstname[cur]+" "+goalkeepers_lastname[cur]+" ("+goalkeepers_strength[cur]+")",goalkeepers_id[cur]);
         document.formationform.goalkeeper1.options[cursel]=el;
         if (selectedid==goalkeepers_id[cur])
          {
           document.formationform.goalkeeper1.selectedIndex=cursel;
          }
        }
      }

     // fill goalkeeper2
     selectedid=document.formationform.goalkeeper2[document.formationform.goalkeeper2.selectedIndex].value;
     document.formationform.goalkeeper2.length=0;
     document.formationform.goalkeeper2.options[0]=new Option(html_entity_decode("-Bitte w&auml;hlen-"),0);
     cursel=0;
     for (cur=1;cur<=curgoalkeeper;cur++)
      {
       if ((!in_array(goalkeepers_id[cur],selectedgoalkeepers))||(selectedid==goalkeepers_id[cur]))
        {
         cursel++;
         el=new Option(goalkeepers_firstname[cur]+" "+goalkeepers_lastname[cur]+" ("+goalkeepers_strength[cur]+")",goalkeepers_id[cur]);
         document.formationform.goalkeeper2.options[cursel]=el;
         if (selectedid==goalkeepers_id[cur])
          {
           document.formationform.goalkeeper2.selectedIndex=cursel;
          }
        }
      }

    }
   updateformation();
  }

