﻿Shifter = function()
{
}

Shifter.onLoad = function()
{
   Shifter.Pozice();
   Shifter.Ukaz();
   setTimeout('Shifter.onTimerPozice()', 1000);
}

Shifter.onTimerPozice = function()
{
   Shifter.Pozice();
   setTimeout('Shifter.onTimerPozice()', 1000);
}

Shifter.Ukaz = function()
{
   var oShifterLevy = Tygrik.System.ByID("Shifter_Left");
   var oShifterPravy = Tygrik.System.ByID("Shifter_Right");
   if (oShifterLevy != null && oShifterPravy != null)
   {
      Tygrik.Style.Visibility(oShifterLevy, true);
      Tygrik.Style.Visibility(oShifterPravy, true);
   }
}

Shifter.Pozice = function()
{
   var oShifterLevy = Tygrik.System.ByID("Shifter_Left");
   var oShifterPravy = Tygrik.System.ByID("Shifter_Right");
   var oAnimace = Tygrik.System.ByID("Animace_0");
   var boxPanel = Tygrik.System.ByID("BoxPanel");
   if (oShifterLevy != null && oShifterPravy != null && boxPanel != null && oAnimace != null)
   {
      var oPosA = new Tygrik.Style.Pos();
      Tygrik.Style.GetPositionAbsolute(oAnimace, oPosA);

      var oPos = new Tygrik.Style.Pos();
      Tygrik.Style.GetPositionAbsolute(oShifterLevy, oPos);
      oPos.y = oPosA.y + Tygrik.Style.SizeHeight(boxPanel);
      oPos.x = oPosA.x;
      Tygrik.Style.SetPosition(oShifterLevy, oPos);
      
      Tygrik.Style.GetPositionAbsolute(oShifterPravy, oPos);
      oPos.y = oPosA.y + Tygrik.Style.SizeHeight(boxPanel);
      oPos.x = oPosA.x + 490;
      Tygrik.Style.SetPosition(oShifterPravy, oPos);
   }
}
