// ************************************************************************
// Script generated by Weather Maps 6.0.0
// This script is protected by the international copyright law.
// Use is allowed only if licensed and in bundle with Weather Maps
// SPS 2000-2008. All rights reserved.
// ************************************************************************

var left = 20;
var idx_1 = 1;
var idx_2 = 12;
var idx_3 = 23;
var idx_4 = 32;
var idx_5 = 42;
var currFrame = 1;
var position = 1;
var space_btw = 2;
var num_buttons = 4;
var width_buttons = 103;
var visible_buttons = 3;
var width_nav_buttons = 16;

function _hide_Buttons()
{
   var i;

   for (i=1; i <= num_buttons; i++)
       {
           eval('btn_' + i.toString() + '.style.visibility = "hidden";');
       }
}

function _Init()
{
   var i;
   var j = 0;

   _Show(idx_1,idx_2);

   _hide_Buttons();

   btnLeft.style.left = left;
   btnRight.style.left = left + width_nav_buttons + (visible_buttons * width_buttons) + ((visible_buttons + 1) * space_btw);
   btnLeft.style.visibility = 'visible';
   btnRight.style.visibility = 'visible';

   for (i=1;i <= num_buttons; i++)
       {
           if (i <= visible_buttons)
               {
                   eval('btn_' + i.toString() + '.style.left =' + (left + width_nav_buttons + space_btw + ((j * width_buttons) + (j * space_btw))).toString() + ';');
                   eval('btn_' + i.toString() + '.style.visibility = "visible";');
                   j++;
               }
       }
}

function _MoveRight()
   {
       if ((position + (visible_buttons-1)) < num_buttons)
           {
               var i;
               var j = 0;
               position += 1;

               _hide_Buttons();

               for (i=position;i <= position + (visible_buttons-1); i++)
                   {
                       eval('btn_' + i.toString() + '.style.left =' + (left + width_nav_buttons  + space_btw + ((j * width_buttons) + (j * space_btw))).toString() + ';');
                       eval('btn_' + i.toString() + '.style.visibility = "visible";');
                       j++;
                   }
           }
   }

function _MoveLeft()
   {
       if (position > 1)
           {
               var i;
               var j = 0;
               position -= 1;

               _hide_Buttons();

               for (i=position;i <= position + (visible_buttons-1); i++)
                   {
                       eval('btn_' + i.toString() + '.style.left =' + (left + width_nav_buttons  + space_btw + ((j * width_buttons) + (j * space_btw))).toString() + ';');
                       eval('btn_' + i.toString() + '.style.visibility = "visible";');
                       j++;
                   }
           }
   }


function _showSprite(idx_start, idx_end, show)
{
   var i;

   for (i=idx_start; i<=idx_end-1; i++)
   {
      eval('sprite_' + i.toString() + '.style.visibility = (show == true) ? "visible" : "hidden";');
   }
}

function _Hide(idx_start, idx_end)
{
   _showSprite(idx_start, idx_end, false);

   eval('map_' + currFrame.toString() + '.style.visibility="hidden";');
}

function _Show(idx_start, idx_end)
{
   eval('map_' + currFrame.toString() + '.style.visibility="visible";');

   _showSprite(idx_start, idx_end, true);
}

function _Render(newFrame)
{
    if (currFrame != newFrame || newFrame == 0) 
    {
       if (newFrame == 0) newFrame = 1;

       _Hide(eval('idx_' + currFrame.toString()), eval('idx_' + (currFrame + 1).toString()));
       currFrame=newFrame;

          _Show(eval('idx_' + currFrame.toString()), eval('idx_' + (currFrame + 1).toString()));
    }
}

