var aktiv=new Array(200);
var index = 0;
var n;
var herkunft;
var liste = "";
var list_elem;

function getListElems()   {
   if(liste.indexOf(",") != -1)
      list_elem = liste.split(",");
   else   {
      list_elem = new Array(1);
      list_elem[0] = liste;
   }
}

function leerraum(anz)   {
   text="";
   for (j=1; j<=anz; j++)
      text=text+"&#160;";
   return text;
}

function bewegen(name)   {
   if(name != "")
      n = name;
   if(document.all)   {	
      weite=8;
      schrittdauer=100;
      for (i=1; i<=weite; i++)   {
         bef="window.document.all['flag_"+n+"'].innerHTML=leerraum("+i+");";
         window.setTimeout(bef,schrittdauer*i);
      }
      for (i=weite-1; i>=0; i--)   {
         bef="window.document.all['flag_"+n+"'].innerHTML=leerraum("+i+");";
         window.setTimeout(bef,schrittdauer*(2*weite-i));
      }
   }
}

function hervorheben2(name)   {
//window.location.href=window.location.href+'#'+name+'_'+nr;
//  if ((pos=document.URL.indexOf('#'+name+'_'+nr)) == -1)
//     window.location.hash=name+'_'+nr;
  //if (herkunft != "")
     //document.klick.src='/klick/'+herkunft+'/'+name;
  window.setTimeout("setList('"+name+"');",10);
}

function setList(name)   {
  if(document.all)   {
     liste = document.keys['X' + name].value;
     getListElems();
     hervorheben();
  }
}

function hervorheben()   {
  dauer=4800;
  for(nr = 0; nr < list_elem.length; nr++)   {
     altfarbe=window.document.all['country_' + list_elem[nr]].style.color;
     window.document.all['country_' + list_elem[nr]].style.color="red";
     bewegen(list_elem[nr]);
     aktiv[index]=window.setInterval("bewegen("+list_elem[nr]+")",1650);
     window.setTimeout("window.document.all['flag_"+list_elem[nr]+"'].innerHTML='';",dauer);
     window.setTimeout("window.document.all['country_"+list_elem[nr]+"'].style.color=altfarbe;",dauer);  
     window.setTimeout("window.clearInterval(aktiv["+index+"])",dauer);
     index++;
  }
}

function sprung(woher)   {
   herkunft=woher;
   if ((pos=document.URL.indexOf("#")) != -1)   {
      anker=document.URL.substr(pos+1,document.URL.length);
      if ((pos2=anker.indexOf("_")) != -1)   {
         //nr=anker.substr(pos2+1,anker.length);
         name=anker.substr(0,pos2);
         hervorheben2(name);
      }
   }
}

