var

rs_act=new Array(
     0,  'Míč zachytil útočící hráč, akce pokračuje.',
     1,  'Míč nezachycen, směřuje přímo do autu.',
     2,  'Míč zachytil obránce, má ho na kopačce.',
     3,  'Míč vypíchl obránce do autu. ',
     4,  'Míč vypíchl brankář do rohu. ',
     5,  'Míč směřuje vedle brány.',
     6,  'Míč směřuje těsně vedle brány.',
     7,  'Míč odráží brankář před sebe.',
     8,  'Míč zachytil brankář.',
     9,  'Míč končí v bráně, gól.',
    10,  'Míč trefil konstrukci.')

mt_act=new Array(
     'ROZS',  'Míč ze středu hřiště bude rozehrávat hráč X. ',
     'ROZL',  'Míč z levé strany hřiště bude rozehrávat hráč X. ',
     'ROZP',  'Míč z pravé strany hřiště bude rozehrávat hráč X. ',
     'AUTL',  'Aut z levé strany hřiště bude rozehrávat hráč X. ',
     'AUTP',  'Aut z pravé strany hřiště bude rozehrávat hráč X. ',
     'ROHCL', 'Centrovaný roh z levé strany hřiště bude zahrávat hráč X. ',
     'ROHCP', 'Centrovaný roh z pravé strany hřiště bude zahrávat hráč X. ',
     'ROHRL', 'Roh z levé strany hřiště bude rozehrávat hráč X. ',
     'ROHRP', 'Roh z pravé strany hřiště bude rozehrávat hráč X. ')

mt_cnt=new Array(
     -5,  'Hráči se svezl míč a odcentroval daleko do autu. ', 1,
     -4,  'Hráč se snažil položit míč na hlavu hráči X, ale centr byl nepřesný a směřoval do autu. ', 1,
     -3,  'Hráč se snažil najít X, ale obránce Y byl výborně postaven a míč bez problému zachytil. ', 2,
     -2,  'Hráč se snažil najít X, ale obránce Y na poslední chvíli míč vypíchl. ', 3,
     -1,  'Hráč se snažil najít X, ale míč poslal nepřesně, takže útočící hráč míč sice zachytil, ale dostal se mimo střeleckou pozici. ',0,
     0,   'Hráč dobře odcentroval na X, ale obránící hráč Y mu znemožnil zakončit. ',0,
     1,   'Hráč se snažil najít hráče X, ale odcentroval nepřesně, míč vypíchl Y, ale nedostatečně. ',0,
     2,   'Hráč dobře odcentroval na X, bránící hráči pozdě zareagovali. ',0,
     3,   'Centrující hráč zahrál nacvičený signál. ',0,
     4,   'Centrující hráč totálně zmátl bránící tým. V nestřeženém okamžiku uviděl volného X a perfektně odcentroval. ',0,
     5,   'Perfektni centr, faleš jak od Antonína Panenky. Brankář ani nezareagoval a centr skončil v brance. ',9)

mt_komb=new Array(
     99,  'Přihrávku zpracoval hráč WW. ', null,
     -5,  'Útočící hráči se špatně pohybují, obránci nemají problém s jejich obsazením. Hráč navíc zkazil jednoduchou přihrávku a posplal míč daleko do autu. ',1,
     -4,  'Útočící hráči se špatně pohybují. Bránící hráč Y v pohodě zachytil přihrávku. ',2,
     -3,  'Útočící hráči se celkem dobře pohybují, obránci mají problém s jejich obsazením. Přihrávka na X je ale velmi nepřesná. ',1,
     -2,  'Uvolnil se hráč X, ale obránce Y jeho úmysl vystihl a přihrávku na poslední chvíli zachytil. ',3,
     -1,  'Uvolnil se hráč X, ale obránce Y ho donutil vyklidit prostor. ',0,
      0,  'Útočníkům se jen tak tak daří udržet míč na kopačkách. ',0,
      1,  'Útočící hráči se dobře pohybují, obráncům se jen taktak daří zamezit útočníkům k finální akci. ',0,
      2,  'Výborně se ukázal a uvolnil hráč X, který výborně zpracoval přihrávku a dostal se tak do vyložené šance. ',0,
      3,  'Útočící hráči přečíslili obránu. ',0,
      4,  'Útočící hráči kombinací na jeden dotek přímo ztrapnili obránce. ',0,
      5,  'Útočník poslal uličkou hráče X do zakončení.',0)

mt_kombx=new Array(
     99,  'Přihrávku zpracoval hráč WW. ',null,
     -5,  'Rozehrávající hráč zkazil přihrávku a posplal míč daleko do autu. ',1,
     -4,  'Bránící hráč Y v pohodě zachytil přihrávku. ',2,
     -3,  'Přihrávka na X je velmi nepřesná. ',1,
     -2,  'Uvolnil se hráč X, ale obránce Y jeho úmysl vystihl a přihrávku na poslední chvíli zachytil. ',2,
     -1,  'Uvolnil se hráč X, který zpracoval přihrávku, ale obránce Y ho donutil vyklidit prostor. ',0,
      0,  'Po serii přihrávek se dostal k míči hráč X.',0,
      1,  'Po serii přihrávek se uvolnil hráč X.',0,
      2,  'Výborně se ukázal a uvolnil hráč X, který výborně zpracoval přihrávku a dostal se tak do vyložené šance. ',0,
      3,  'Útočící hráči přečíslili obránu. ',0,
      4,  'Útočící hráči kombinací na jeden dotek přímo ztrapnili obránce. ',0,
      5,  'Obránci teď špatně vykryli prostor. Rozehrávající hráč překvapil brankáře. ',9)


mt_fin= Array(
     99,  'Míč má ve velkém vápně hráč WW, který se chystá zakončovat. ',null,
     -5,  'Hráči při pokusu o zakončení zakopl. ',5,
     -4,  'Hráč zakončil vypálil ránu jako z děla ale 20 metrů nad. ',5,
     -3,  'Brankář v pohodě míč chytil. ',8,
     -2,  'Těsně vedle jen milimetry chyběly. ',6,
     -1,  'Brankář včas zareagoval, ale na míč nedosáhl. Naštěstí míč trefil jen konstrukci branky. ',10,
      0,  'Brankář včas zareagoval, ale míč vyrazil jen před sebe. ', 7,
      1,  'Brankář vůbec nereagoval. Naštěstí míč trefil jen konstrukci branky. ',10,
      2,  'Brankář vyškrábl míč do autu. ',4,
      3,  'Brankář na míč sice dosáhl, ale střela byla dostatečně razantní, takže míč už nevyškrábl. ',9,
      4,  'Brankář nereagoval. Míč zapadl přesně vedle tyče do brány. ',9,
      5,  'Prostě paráda, fotbalista nekompromisně zavěsil. Brankář se jen díval. ',9)

mt_fink= Array(
     99,  'Míč doskákal do oblasti malého vápna. K míči se dostal včas útočící hráč WW. ',null,
     -9,  'Míč doskákal do oblasti malého vápna, naštěstí k míči se dostal včas bránící hráč Y. ',null,
     -5,  'Hráč však při pokusu o zakončení upadl. ',5,
     -4,  'Hráč zakončil "pánu bohu do oken". ',5,
     -3,  'Hráč zakončil cca metr vedle brány. ', 6,
     -2,  'Brankář včas zareagoval a dorážku zneškodnil. ',8,
     -1,  'Brankář se natáhl jak nejvíce mohl a posledními články prstů míč ze šibenice vyškrábl. ',4,
      0,  'Míč trefil brankáře do hlavy a pak šel do autu. ',4,
      1,  'Brankář včas včas zareagoval a míč chytil. ',8,
      2,  'Brankář včas zareagoval a míč s vypětím všech sil chytil.',8,
      3,  'Brankář na míč sice dosáhl, ale dorážka byla dostatečně razantní, takže míč už nevyškrábl. ',9,
      4,  'Brankář neměl sebemenší šanci. ',9,
      5,  'Prostě paráda, fotbalista patičkou ztrapnil brankáře. ',9)

var tpxm=1

function fnm_get3(id, arr)
{
var i;
var r=id;
for ( i=0; i < arr.length; i=i+3 )
if ( (id+'')==(arr[i]+'') )
 r=arr[i+1];
return r;
}

function fnm_get3e(id, arr)
{
var i;
var r=id;
for ( i=0; i < arr.length; i=i+3 )
if ( (id+'')==(arr[i]+'') )
 r=arr[i+2];
return r;
}


function replM(s,ch,pl)
{
  var c
  var x
  var y
  if (((ch == 'WW' || ch == 'X') && tpxm == 1) || (ch == 'Y' && tpxm == 2 )) {
    c = 'red'
    x = 'homed'
    y = 'plnmx'
  } else {
    c = 'black'
    x = 'hostd'
    y = 'plnmy'
  }
  var dress = pl
  if (pl >=1 && pl<=11)
    dress = document.all[x+pl].innerHTML+'&nbsp;'+document.all[y+pl].innerHTML
  return s.replace(ch,'<B style="border: 1px solid '+c+'">'+dress+'</B>')
}


var
  shows = new Array()
  num = 7

function tox(x)
{
  return parseInt(x.replace('px',''))
}


function setSquatAct(idtype, actp, pl) {
 if ((actp == 'ROHCL')||(actp == 'ROHRL'))
   if (idtype==1)
     setPlayerHome (pl, 0, 120)
   else
     setPlayerHost (pl, 0, 120)

 if ((actp == 'ROHCP')||(actp == 'ROHRP'))
   if (idtype==1)
     setPlayerHome (pl, 100, 120)
   else
     setPlayerHost (pl, 100, 120)

 if ((actp == 'AUTL'))
   if (idtype==1)
     setPlayerHome (pl, 0, 70)
   else
     setPlayerHost (pl, 0, 70)

 if ((actp == 'AUTP'))
   if (idtype==1)
     setPlayerHome (pl, 100, 70)
   else
     setPlayerHost (pl, 100, 70)
}

function planSeq0(idser, idtype, actp, seq, pl, u, o ){
  var
    styy = 0
    stx = 0
    sty = 0
    sttx = 0
    stty = 0
    stdx = 0
    stdy = 0
    stox = 0
    stoy = 0
    stodx = 0
    stody = 0
    stux = 0
    stuy = 0
    studx = 0
    study = 0
    stbx = 0
    stby = 0
    stk = 0
  if ( pl!=null ) {
    if (idtype==1){
        sty = tox(document.all["home"+pl].style.left)
        stx = tox(document.all["home"+pl].style.top)
        stk = tox(document.all["host1"].style.left)
      } else {
        sty = tox(document.all["host"+pl].style.left)
        stx = tox(document.all["host"+pl].style.top)
        stk = tox(document.all["home1"].style.left)
      }
    if ( actp != 'ROHCP' && actp != 'ROHCL' && actp != 'ROHRP' && actp != 'ROHRL') {
     if (idtype==1){
        stty = sty + 30
        if ( stk < stty )
          stty = stk
        sttx = stx
      } else {
        stty = sty - 30
        if ( stk > stty )
          stty = stk
        sttx = stx
      }
    } else {
      stty = sty
      sttx = stx
    }

    stdx = Math.round((sttx - stx)/num)
    stdy = Math.round((stty - sty)/num)
  }

  if (u!=null) {
    if (idtype==1){
      stuy = tox(document.all["home"+u].style.left)
      stux = tox(document.all["home"+u].style.top)
      styy = stuy + 15
    } else {
      stuy = tox(document.all["host"+u].style.left)
      stux = tox(document.all["host"+u].style.top)
      styy = stuy - 15
    }
    studx = 0
    study = Math.round((styy - stuy)/num)
  }

  if (o!=null) {
    if (idtype==1){
      stoy = tox(document.all["host"+o].style.left)
      stox = tox(document.all["host"+o].style.top)
      if ( stoy > stuy)
        styy = stoy - 15
      else
        styy = stoy + 15
    } else {
      stoy = tox(document.all["home"+o].style.left)
      stox = tox(document.all["home"+o].style.top)
      if ( stoy < stuy)
        styy = stoy + 15
      else
        styy = stoy - 15
    }
    stodx = 0
    stody = Math.round((styy - stoy)/num)
  }

  if (seq == 'L') {
    stbx = stox
    stby = stoy + 2*stody
    stdy = stody
  } else {
    stbx = stx
    stby = sty
  }

  if ( seq == 'K1' && (actp == 'AUTL' || actp == 'AUTP')) {
    stbx = stx - 31
    stby = sty
  }

  stdx0 = stdx
  stdy0 = stdy

  if (seq == 'D') {
    stbx = tox(document.all["ball"].style.top)
    stby = tox(document.all["ball"].style.left)
    stdy = Math.round((stty - stby)/num)
    stdx = Math.round((sttx - stbx)/num)
  }

  if (seq == 'V') {
    stby = tox(document.all["ball"].style.left)
    if ( idtype == 1)
      styy = specHostX(-5,40)
    else
      styy = specHomeX(60,-5)
    stdy = Math.round((styy - stby)/num)
    if ( idtype == 1)
      styy = specHostY(-5,40)
    else
      styy = specHomeY(60,-5)
    stbx = tox(document.all["ball"].style.top)
    stdx = Math.round((styy - stbx)/num)
  }

  if (seq == 'W') {
    stby = tox(document.all["ball"].style.left) - 2*stdy
    stbx = tox(document.all["ball"].style.top)
    stdy = 0
    styy = specHostY(0,50)
    if ( styy > stbx )
      styy = specHostY(0,105)
    else
      styy = specHostY(0,-5)
    stdx = Math.round((styy - stbx)/num)
  }

  shows[shows.length]=new Array
  (
    stx,
    sty,
    sttx,
    stty,
    stdx,
    stdy,
    stox,
    stoy,
    stodx,
    stody,
    stux,
    stuy,
    studx,
    study,
    u,
    o,
    stdx0,
    stdy0,
    pl,
    stbx,
    stby,
    idser,
    idtype
  )
  showSeq(1)
}

function getActEnd(actp, res)
{
   if ( actp == 'C' )
    return fnm_get3e(res, mt_cnt);
   if ( actp == 'K1' )
    return fnm_get3e(res, mt_komb);
   if ( actp == 'K2' )
    return fnm_get3e(res, mt_kombx);
   if ( actp == 'K3' )
    return fnm_get3e(res, mt_kombx);
   if ( actp == 'F' )
    return fnm_get3e(res, mt_fin);
   if ( actp == 'D' )
    return fnm_get3e(res, mt_fink);
}


function planSeq(idser, idtype, actp, seq, pl, u, o, res ){
  if ( pl != null )
    planSeq0( idser, idtype, actp, seq, pl, u, o )
  var
    stx = 0
    sty = 0
    sttx = 0
    stty = 0
    stdx = 0
    stdy = 0
    stox = 0
    stoy = 0
    stodx = 0
    stody = 0
    stux = 0
    stuy = 0
    studx = 0
    study = 0

  var k = getActEnd(seq, res)

  if (pl!=null) {
    if (idtype==1){
      sty = tox(document.all["home"+pl].style.left)
      stx = tox(document.all["home"+pl].style.top)
    } else {
      sty = tox(document.all["host"+pl].style.left)
      stx = tox(document.all["host"+pl].style.top)
    }
  } else {
      sty = tox(document.all["ball"].style.left)
      stx = tox(document.all["ball"].style.top)
  }
  if (idtype==1){
     if (u!=null) {
       stty = tox(document.all["home"+u].style.left)+20
       sttx = tox(document.all["home"+u].style.top)
       if (o!=null) {
         stty = (stty+tox(document.all["host"+o].style.left))/2
         sttx = (sttx+tox(document.all["host"+o].style.top))/2
       }
     }
    } else {
     if (u!=null) {
       stty = tox(document.all["host"+u].style.left)-20
       sttx = tox(document.all["host"+u].style.top)
       if (o!=null) {
         stty = (stty+tox(document.all["home"+o].style.left))/2
         sttx = (sttx+tox(document.all["home"+o].style.top))/2
       }
     }
    }

  stdx = Math.round((sttx - stx)/num)
  stdy = Math.round((stty - sty)/num)

  if (o!=null) {
    if (idtype==1){
      stoy = tox(document.all["host"+o].style.left)
      stox = tox(document.all["host"+o].style.top)
    } else {
      stoy = tox(document.all["home"+o].style.left)
      stox = tox(document.all["home"+o].style.top)
    }
    stodx = Math.round((sttx - stox)/num)
    stody = Math.round((stty - stoy)/num)
  }
  if (u!=null) {
    if (idtype==1){
      stuy = tox(document.all["home"+u].style.left)
      stux = tox(document.all["home"+u].style.top)
    } else {
      stuy = tox(document.all["host"+u].style.left)
      stux = tox(document.all["host"+u].style.top)
    }
    studx = Math.round((sttx - stux)/num)
    study = Math.round((stty - stuy)/num)
  }

  if ( k==99) {
    if (idtype==2)
      styy = specHostY(55,0)
    else
      styy = specHomeY(0,55)
    stdx = Math.round((styy - stx)/num)
    if (idtype==2)
      styy = specHostX(55,0)
    else
      styy = specHomeX(0,55)
    stdy = Math.round((styy - sty)/num)
  }

  if ( k==1) {
    stdx = Math.round(stdx * 1.2)
    stdy = Math.round(stdy * 1.5)
  }

  if ( k==4 || k==7 || k==8) {
    if (idtype==1)
      styy = tox(document.all["host1"].style.top)
    else
      styy = tox(document.all["home1"].style.top)
    stdx = Math.round((styy - stx)/num)
    if (idtype==1)
      styy = tox(document.all["host1"].style.left)
    else
      styy = tox(document.all["home1"].style.left)
    stdy = Math.round((styy - sty)/num)
  }

  if ( k==5) {
    if (idtype==1)
      styy = specHostY(-15,20)
    else
      styy = specHomeY(20,-15)
    stdx = Math.round((styy - stx)/num)
    if (idtype==1)
      styy = specHostX(-15,20)
    else
      styy = specHomeX(20,-15)
    stdy = Math.round((styy - sty)/num)
  }

  if ( k==6) {
    if (idtype==1)
      styy = specHostY(-10,35)
    else
      styy = specHomeY(35,-10)
    stdx = Math.round((styy - stx)/num)
    if (idtype==1)
      styy = specHostX(-10,35)
    else
      styy = specHomeX(35,-10)
    stdy = Math.round((styy - sty)/num)
  }

  if ( k==10 ) {
    if (idtype==1)
      styy = specHostY(-4,50)
    else
      styy = specHomeY(50,-4)
    stdx = Math.round((styy - stx)/num)
    if (idtype==1)
      styy = specHostX(-4,50)
    else
      styy = specHomeX(50,-4)
    stdy = Math.round((styy - sty)/num)
  }

  if ( k==9) {
    if (idtype==1)
      styy = specHostY(-8,50)
    else
      styy = specHomeY(50,-8)
    stdx = Math.round((styy - stx)/num)
    if (idtype==1)
      styy = specHostX(-8,50)
    else
      styy = specHomeX(50,-8)
    stdy = Math.round((styy - sty)/num)
  }


  shows[shows.length]=new Array
  (
    stx,
    sty,
    sttx,
    stty,
    stdx,
    stdy,
    stox,
    stoy,
    stodx,
    stody,
    stux,
    stuy,
    studx,
    study,
    u,
    o,
    0,
    0,
    pl,
    stx,
    sty,
    idser,
    idtype
  )
  showSeq(1)

  if ( k==2 ) {
    planSeq0( idser, idtype, actp, 'L', pl, u, o )
  }
  if ( k==4 ) {
    planSeq0( idser, idtype, actp, 'V', pl, u, o )
  }
  if ( k==3 ) {
    planSeq0( idser, idtype, actp, 'W', pl, u, o )
  }

}

var
    ser = 0;
    seq = 0;
    zal = -1;

var time = 60;

function showSeq(mode) {
  if (mode == 0)
    ser = ser + 1
  else {
    ser = num
    seq = shows.length-1
  }
  if (ser > num) {
    ser = 1
    seq = seq + 1
  }
  if (seq < shows.length) {
  var
    stx = shows[seq][0]
    sty = shows[seq][1]
    sttx = shows[seq][2]
    stty = shows[seq][3]
    stdx = shows[seq][4]
    stdy = shows[seq][5]
    stox = shows[seq][6]
    stoy = shows[seq][7]
    stodx = shows[seq][8]
    stody = shows[seq][9]
    stux = shows[seq][10]
    stuy = shows[seq][11]
    studx = shows[seq][12]
    study = shows[seq][13]
    u = shows[seq][14]
    o = shows[seq][15]
    stdx0 = shows[seq][16]
    stdy0 = shows[seq][17]
    pl = shows[seq][18]
    stbx = shows[seq][19]
    stby = shows[seq][20]
    idact = shows[seq][21]
    idtype = shows[seq][22]
    if ( idact != zal ) {
      document.all["act"].innerHTML = actxs[idact]
      document.all["acttype"].innerHTML = 'Min:'+actms[idact]+'<BR>'+actts[idact]
      prepSquat(idtype)
    }
    if ( pl!=null )
      if (idtype==1){
        changePlHome(pl,(sty + stdy0*ser),(stx + stdx0*ser))
      } else {
        changePlHost(pl,(sty + stdy0*ser),(stx + stdx0*ser))
      }
    changeBall((stby + stdy*ser),(stbx + stdx*ser))
    if (u!=null) {
      if (idtype==1){
        changePlHome(u,(stuy + study*ser),(stux + studx*ser))
      } else {
        changePlHost(u,(stuy + study*ser),(stux + studx*ser))
      }
    }
    if (o!=null) {
      if (idtype==1){
        changePlHost(o,(stoy + stody*ser),(stox + stodx*ser))
      } else {
        changePlHome(o,(stoy + stody*ser),(stox + stodx*ser))
      }
    }
   zal = idact
   var timex = time
   if ( shows.length>seq+1 && ser == num)
     if ( shows[seq+1][21]!=idact )
       timex=500
   if (mode==0)
     casovac = setTimeout("showSeq(0)",timex);
  } else {
    switchAct(1)
    if ( goalh[1]!=null )
      T_hgoalv(goalh[1][0],goalh[1][1],goalh[1][2],goalh[1][3])
    if ( goalh[2]!=null )
      T_hgoalv(goalh[2][0],goalh[2][1],goalh[2][2],goalh[2][3])
  }
}


var homes = new Array()
var hosts = new Array()

function prepSquat(idt) {

    if ( idt == 1) {
      for (var i=0; i<11;i++)
      {
        changePlHome(i+1,homes[i][0]+30,homes[i][1])
        changePlHost(i+1,hosts[i][0]+15,hosts[i][1])
      }
    } else {
      for (var i=0; i<11;i++)
      {
        changePlHome(i+1,homes[i][0]-15,homes[i][1])
        changePlHost(i+1,hosts[i][0]-30,hosts[i][1])
      }
    }
}

function changeBall(x,y){
  if ( x >= -100 && x <=1000 && y >= -100 && y <= 1000) {
    document.all["ball"].style.left = x
    document.all["ball"].style.top = y + 12
    document.all["ball"].style.zIndex=y + 12
  }
}


function changePlHome(i,x,y){
  if ( x >= -100 && x <=1000 ) {
    document.all["home"+i].style.left=x
    document.all["plx"+i].style.left=x+30
  }
  if ( y >= -100 && y <=1000 ) {
    document.all["home"+i].style.top=y
    document.all["plx"+i].style.top=y
    document.all["home"+i].style.zIndex=y
  }
}

function changePlHost(i,x,y){
  if ( x >= -100 && x <=1000 ) {
    document.all["host"+i].style.left=x
    document.all["ply"+i].style.left=x+30
  }
  if ( y >= -100 && y <=1000 ) {
    document.all["host"+i].style.top=y
    document.all["ply"+i].style.top=y
    document.all["host"+i].style.zIndex=y
  }
}

var offs = 0

function initAct(){

if ( offs == 0) {
  if (expert>=2)
    window.scrollTo(0,700)
  else
    window.scrollTo(0,100)
} else
  window.scrollTo(0,offs)


  if (homes.length==0)
    for (var i=0; i<11;i++)
    {
      homes[i]=new Array(tox(document.all["home"+(i+1)].style.left),tox(document.all["home"+(i+1)].style.top))
      hosts[i]=new Array(tox(document.all["host"+(i+1)].style.left),tox(document.all["host"+(i+1)].style.top))
    }
  if (casovac!=null)
    clearTimeout(casovac)
  ser = 0
  seq = 0
  zal = -1
  shows = new Array()
}

var casovac = null;

function runAct(){
  seq = 0
  ser = 0
  zal = -1
  if (document.all.rlist!=null && document.all.rlist.value!=null)
    time = 30 + (18*(document.all.rlist.value-1))
  casovac = setTimeout("showSeq(0)",200);
}

function showAct( idt, idser ){
var
    idteam    = acts[idser][00]
    idtype    = acts[idser][01]
    idact     = acts[idser][02]
    idacttp   = acts[idser][03]
    actpl     = acts[idser][04]
    cntpl     = acts[idser][05]
    cntkoef   = acts[idser][06]
    cntres    = acts[idser][07]
    cntplu    = acts[idser][08]
    cntplo    = acts[idser][09]
    komb1pl   = acts[idser][10]
    komb1koef = acts[idser][11]
    komb1res  = acts[idser][12]
    komb1plu  = acts[idser][13]
    komb1plo  = acts[idser][14]
    komb2pl   = acts[idser][15]
    komb2koef = acts[idser][16]
    komb2res  = acts[idser][17]
    komb2plu  = acts[idser][18]
    komb2plo  = acts[idser][19]
    komb3pl   = acts[idser][20]
    komb3koef = acts[idser][21]
    komb3res  = acts[idser][22]
    komb3plu  = acts[idser][23]
    komb3plo  = acts[idser][24]
    finpl     = acts[idser][25]
    finkoef   = acts[idser][26]
    finres    = acts[idser][27]
    finplu    = acts[idser][28]
    finplo    = acts[idser][29]
    finkpl    = acts[idser][30]
    finkkoef  = acts[idser][31]
    finkres   = acts[idser][32]
    finkplu   = acts[idser][33]
    finkplo   = acts[idser][34]

    prepSquat(idtype)
    setSquatAct(idtype, idacttp, actpl)

    if (cntres != null) {
      planSeq(idser, idtype, idacttp, 'C', actpl, cntplu, cntplo, cntres )
    }

    if (komb1res != null)
      planSeq(idser, idtype, idacttp, 'K1', komb1pl, komb1plu, komb1plo, komb1res )

    if (komb2res != null)
      planSeq(idser, idtype, idacttp, 'K2', komb2pl, komb2plu, komb2plo, komb2res  )

    if (komb3res != null)
      planSeq(idser, idtype, idacttp, 'K3', komb3pl, komb3plu, komb3plo, komb3res  )

    if (finres != null)   {
      planSeq(idser, idtype, idacttp, 'F', finpl, finplu, finplo, finres  )
    }

    if (finkres != null) {
      planSeq(idser, idtype, idacttp, 'D', finkpl  ,finkpl,finkplo, finkres )
    }

}

function T_actType(
  idtype)
{
var w = '';
wln('<TD id=macttp'+(acts.length)+'>')
if (idtype==1)
  w=('<A HRef="javascript:initAct();showAct('+idtype+','+acts.length+');runAct();"><IMG BORDER=0 SRC="'+getPlayerImg(1)+'"><BR>Play</A>')
else
  w=('<A HRef="javascript:initAct();showAct('+idtype+','+acts.length+');runAct();"><IMG BORDER=0 SRC="'+getPlayerImg(2)+'"><BR>Play</A>')
wln(w)
actts[(actts.length)]=w
wln('</TD>')
}

var acts = new Array()
var actts = new Array()
var actxs = new Array()
var actms = new Array()

function T_act(
  idteam,
  idtype,
  idact,
  idacttp,
  actpl,
  cntpl,
  cntkoef,
  cntres,
  cntplo,
  cntplu,
  komb1pl,
  komb1koef,
  komb1res,
  komb1plo,
  komb1plu,
  komb2pl,
  komb2koef,
  komb2res,
  komb2plo,
  komb2plu,
  komb3pl,
  komb3koef,
  komb3res,
  komb3plo,
  komb3plu,
  finpl,
  finkoef,
  finres,
  finplo,
  finplu,
  finkpl,
  finkkoef,
  finkres,
  finkplo,
  finkplu)
{
  acts[acts.length]=new Array (
  idteam,
  idtype,
  idact,
  idacttp,
  actpl,
  cntpl,
  cntkoef,
  cntres,
  cntplu,
  cntplo,
  komb1pl,
  komb1koef,
  komb1res,
  komb1plu,
  komb1plo,
  komb2pl,
  komb2koef,
  komb2res,
  komb2plu,
  komb2plo,
  komb3pl,
  komb3koef,
  komb3res,
  komb3plu,
  komb3plo,
  finpl,
  finkoef,
  finres,
  finplu,
  finplo,
  finkpl,
  finkkoef,
  finkres,
  finkplu,
  finkplo,
  0)

  tpxm= idtype
  var v = ''
  var w = ''
  gol = 0
  shotin = 0
  shotout = 0
  shotkeep = 0
  if (idacttp != null)
    v = v +  replM(fnm_get(idacttp,mt_act), 'X', actpl)
  if (cntres != null) {
    setgol(cntres,mt_cnt)
    v = v +  replM(replM(replM(fnm_get3a(cntres,mt_cnt,cntkoef), 'X', cntplu),'Y', cntplo),'WW',cntpl)
    mstat[4][idtype]+=1
  }
  if (komb1res != null) {
    setgol(komb1res,mt_komb)
    v = v +  replM(replM(replM(fnm_get3a(komb1res,mt_komb,komb1koef), 'X', komb1plu),'Y', komb1plo),'WW',komb1pl)
    mstat[4][idtype]+=1
  }
  if (komb2res != null) {
    setgol(komb2res,mt_kombx)
    v = v +  replM(replM(replM(fnm_get3(99,mt_kombx), 'X', komb2plu),'Y', komb2plo),'WW',komb2pl)
    v = v +  replM(replM(replM(fnm_get3a(komb2res,mt_kombx,komb2koef), 'X', komb2plu),'Y', komb2plo),'WW',komb2pl)
    mstat[4][idtype]+=1
  }
  if (komb3res != null) {
    setgol(komb3res,mt_kombx)
    v = v +  replM(replM(replM(fnm_get3(99,mt_kombx), 'X', komb3plu),'Y', komb3plo),'WW',komb3pl)
    v = v +  replM(replM(replM(fnm_get3a(komb3res,mt_kombx,komb3koef), 'X', komb3plu),'Y', komb3plo),'WW',komb3pl)
    mstat[4][idtype]+=1
  }
  if (finres != null)  {
    setgol(finres,mt_fin)
    v = v +  replM(replM(replM(fnm_get3(99,mt_fin), 'X', finplu),'Y', finplo),'WW',finpl)
    v = v +  replM(replM(replM(fnm_get3a(finres,mt_fin,finkoef), 'X', finplu),'Y', finplo),'WW',finpl)
    mstat[4][idtype]+=1
  }
  if (finkres != null) {
   if (finkres == -9) {
    v = v +  replM(replM(replM(fnm_get3(-9,mt_fink), 'X', finkplu),'Y', finkplo),'WW',finkpl)
    mstat[4][idtype]+=1
   } else {
    setgol(finkres,mt_fink)
    v = v +  replM(replM(replM(fnm_get3(99,mt_fink), 'X', finkplu),'Y', finkplo),'WW',finkpl)
    v = v +  replM(replM(replM(fnm_get3a(finkres,mt_fink,finkkoef), 'X', finkplu),'Y', finkplo),'WW',finkpl)
    mstat[4][idtype]+=1
     }
  }
if(isbreak)
 return
var wx = 'INFO'
if ( gol == 1 ) {
  wx = 'WARN'
  mstat[6][idtype]+=1
}
if ( gol == 2 ) {
  wx = 'GOL'
  mstat[1][idtype]+=1
}
if ( shotin == 1 ) {
  mstat[2][idtype]+=1
}
if ( shotout == 1 ) {
  mstat[3][idtype]+=1
}
if ( shotkeep == 1 ) {
  mstat[5][2-idtype+1]+=1
}
wln('<TD width=500 nowrap CLASS='+wx+' id=mact'+(acts.length-1)+'>')
wln(v)
wln('</TD></TR><TR STYLE="visibility:hidden; height:0px;" ID="mactx'+tb_row_cn3+'" CLASS="class'+gol+'">')
acts[(acts.length-1)][(acts[0].length-1)]=gol
actxs[(actxs.length)]='<DIV CLASS='+wx+'>'+v+'</DIV>'
actms[(actms.length)]=idact
tb_cols_i++
}

var gol = 0
var shotin = 0
var shotout = 0
var shotkeep = 0

function setgol(id,arr)
{
  if ( fnm_get3e(id,arr) >4 && gol < 1)
     gol = 1
  if ( fnm_get3e(id,arr) == 9 && gol < 2)
     gol = 2
  if ( fnm_get3e(id,arr) == 4 || fnm_get3e(id,arr) == 7 || fnm_get3e(id,arr) == 8 || fnm_get3e(id,arr) == 9 )
     shotin = 1
  if ( fnm_get3e(id,arr) == 5 || fnm_get3e(id,arr) == 6 || fnm_get3e(id,arr) == 10  )
     shotout = 1
  if ( fnm_get3e(id,arr) == 4 || fnm_get3e(id,arr) == 7 || fnm_get3e(id,arr) == 8 )
     shotkeep = 1
  if ( fnm_get3e(id,arr) == 9  )
     shotkeep = 0
}

function fnm_get3a(id, arr, koef)
{
return (fnm_get3(id, arr) + '('+koef+'%/'+id+'). ');
}

function play()
{
  initAct();
  for (var i=0;i<acts.length;i++){
    if (acts[i][(acts[0].length-1)]>=document.all.alist.value)
      showAct(acts[i][1],i);
  }
  runAct();
}
