

 obj_t.prototype.f_set_z = function( s_id, i_zoom_speed, i_width, i_step , i_zero )
  {
    this.s_id_img = s_id;

    this.img = document.getElementById( this.s_id_img ); 

    this.i_zoom_speed = i_zoom_speed;
    this.i_width = i_width;
    this.i_width_step = i_step;
    this.i_zoom_zero = i_zero;
  }


 obj_t.prototype.f_zoom_in = function()
  {
    if( this.i_width_step < this.i_width )
      {
        this.b_zooming = true;

        this.i_width_step += this.i_zoom_speed;

        if( this.i_width_step > this.i_width ) this.i_width_step = this.i_width;


        this.i_img_width = this.img.clientWidth;
        this.i_img_height = this.img.clientHeight;

        this.img.style.width = this.i_width_step;

        this.i_img_height = this.img.clientHeight - this.i_img_height;


        this.stepx = Math.round( this.i_zoom_speed / 2 );
        this.stepy = Math.round( this.i_img_height / 2 );

        this.i_fromx -= this.stepx;
        this.i_fromy -= this.stepy;

        this.i_tox -= this.stepx;
        this.i_toy -= this.stepy;

        this.i_bodx -= this.stepx;
        this.i_body -= this.stepy;

        this.object.style.left = this.i_bodx;
        this.object.style.top = this.i_body;
      }
     else this.b_zooming = false;
  }


 obj_t.prototype.f_zoom_out = function( s )
  {
    if( this.b_zoom_zero[ s ][ this.i_curent_action[ s ] ] == true )
      {
        i_zz = this.i_zoom_zero;
      }
     else
      {
        i_zz = 0;
      }

    if( this.i_width_step > i_zz )
      {
        this.b_zooming = true;

        this.i_width_step -= this.i_zoom_speed;

        if( this.i_width_step < 0 ) this.i_width_step = 0;


        this.i_img_width = this.img.clientWidth;
        this.i_img_height = this.img.clientHeight;

        this.img.style.width = this.i_width_step;

        this.i_img_height -= this.img.clientHeight;


        this.stepx = Math.round( this.i_zoom_speed / 2 )
        this.stepy = Math.round( this.i_img_height / 2 );

        this.i_fromx += this.stepx;
        this.i_fromy += this.stepy;

        this.i_tox += this.stepx;
        this.i_toy += this.stepy;

        this.i_bodx += this.stepx;
        this.i_body += this.stepy;

        this.object.style.left = this.i_bodx;
        this.object.style.top = this.i_body;
      }
     else this.b_zooming = false;
  }

 obj_t.prototype.f_blend = function()
  {
    if( this.i_opacity > 0 )
      {
        this.b_blending = true;

        this.i_opacity -= this.i_opacity_speed;

        this.f_opacity();
      }
     else this.b_blending = false;
  }

 obj_t.prototype.f_un_blend = function()
  {
    if( this.i_opacity < 100 )
      {
        this.b_blending = true;

        this.i_opacity += this.i_opacity_speed;

        this.f_opacity();
      }
     else this.b_blending = false;
  }

 obj_t.prototype.f_opacity = function()
  {
    if( this.i_opacity == 100 ) this.i_opacity --;

    this.object.style.opacity = ( this.i_opacity / 100 );
    this.object.style.filter = "alpha(opacity=" + this.i_opacity + ")";
  }

 obj_t.prototype.f_display = function()
  {
    if( this.b_display == true )
      {
        this.object.style.display="none";
        this.b_display = false;
      }
     else
      {
        this.object.style.display="block";
        this.b_display = true;
      }
  }

 obj_t.prototype.f_set = function( s_id, i_speed, i_fromx, i_fromy, i_tox, i_toy )
  {
    this.i = 0;

    this.s_id = s_id;

    this.object = document.getElementById( this.s_id );

    this.i_speed = i_speed ;

    this.i_fromx = i_fromx;
    this.i_fromy = i_fromy;

    this.i_tox = i_tox;
    this.i_toy = i_toy;

    this.i_vx = this.i_tox - this.i_fromx;
    this.i_vy = this.i_toy - this.i_fromy;

    if( Math.abs( this.i_tox - this.i_fromx ) > Math.abs( this.i_toy - this.i_fromy ) )
      {
        this.i_kroky = Math.abs( this.i_tox - this.i_fromx );
      }
     else
      {
        this.i_kroky = Math.abs( this.i_toy - this.i_fromy );
      }

    this.i_bodx = this.i_fromx;
    this.i_body = this.i_fromy;

    this.i = 0;
  }


 obj_t.prototype.f_step = function()
  {
    if( this.i_kroky != 0 )
      {
        this.i_bodx = Math.round( this.i_fromx + this.i_vx * ( this.i / this.i_kroky ) );
        this.i_body = Math.round( this.i_fromy + this.i_vy * ( this.i / this.i_kroky ) );
      }

    if( this.b_moveing == true ) this.i+=this.i_speed;
  }


 obj_t.prototype.f_move = function()
  {
    if( this.i <= this.i_kroky )
      {
        this.b_moveing = true;

        this.f_step();

        this.object.style.left = this.i_bodx;
        this.object.style.top = this.i_body;
      }
     else
      {
        this.b_moveing = false;

        this.i_bodx = this.i_tox;
        this.i_body = this.i_toy;

        this.object.style.left = this.i_bodx;
        this.object.style.top = this.i_body;
      }
   }


 obj_t.prototype.f_go_ahead_now = function()
  {
    this.b_waiting = false;
  }


 obj_t.prototype.action = function( s )
  {
    if( this.i_curent_action[ s ] <= this.i_actions[ s ] )
      {
        if( this.b_blending == false && this.b_moveing == false && this.b_zooming == false && this.b_waiting == false )
          {
            this.i_curent_action[ s ]++;

            if( this.i_curent_action[ s ] > this.i_actions[ s ] )
              {
                this.action( s );
                return;
              }

            if( this.b_move_to[ s ][ this.i_curent_action[ s ] ] == true )
              {
                this.f_set( this.s_id , this.i_speed , this.i_tox , this.i_toy , this.i_tox_a[ s ][ this.i_curent_action[ s ] ] , this.i_toy_a[ s ][ this.i_curent_action[ s ] ] );
                this.f_step();
              }

            if( this.b_wait[ s ][ this.i_curent_action[ s ] ] == true )
              {
                this.b_waiting = true;
              }

            if( this.o_obj[ s ][ this.i_curent_action[ s ] ] != null )
              {
                this.o_obj[ s ][ this.i_curent_action[ s ] ].f_go_ahead_now();
              }
          }

        if( this.b_blend[ s ][ this.i_curent_action[ s ] ] == true )
          {
            this.f_blend();
          }

        if( this.b_un_blend[ s ][ this.i_curent_action[ s ] ] == true )
          {
            this.f_un_blend();
          }

        if( this.b_move[ s ][ this.i_curent_action[ s ] ] == true )
          {
            this.f_move();
          }

        if( this.b_zoom_in[ s ][ this.i_curent_action[ s ] ] == true )
          {
            this.f_zoom_in();
          }
        
        if( this.b_zoom_out[ s ][ this.i_curent_action[ s ] ] == true )
          {
            this.f_zoom_out( s );
          }


        var myClass = this;

        function call_action()
         {
           myClass.action( s );
         }

        setTimeout( call_action , this.i_delay );

      }
     else
      {
        this.i_curent_action[ s ] = 0;
        this.b_work_on_actions = false;
        return;
      }
  }

 obj_t.prototype.do_action = function( s )
  {
    if( this.b_work_on_actions == false )
      {
        this.b_work_on_actions = true;

        this.i_curent_action[ s ] = 0;

        this.action( s );

        return s;
      }
     else return null;
  }


 obj_t.prototype.add_action = function( s , b_blend , b_un_blend , b_move , b_zoom_in , b_zoom_out , b_zoom_zero , b_move_to , i_tox , i_toy , b_wait , o_obj )
  {
    this.i_actions[ s ]++;

    this.b_blend    [ s ][ this.i_actions[ s ] ] = b_blend;
    this.b_un_blend [ s ][ this.i_actions[ s ] ] = b_un_blend;
    this.b_move     [ s ][ this.i_actions[ s ] ] = b_move;
    this.b_zoom_in  [ s ][ this.i_actions[ s ] ] = b_zoom_in;
    this.b_zoom_out [ s ][ this.i_actions[ s ] ] = b_zoom_out;
    this.b_zoom_zero[ s ][ this.i_actions[ s ] ] = b_zoom_zero;
    this.b_move_to  [ s ][ this.i_actions[ s ] ] = b_move_to;
    this.b_wait     [ s ][ this.i_actions[ s ] ] = b_wait;

    this.i_tox_a[ s ][ this.i_actions[ s ] ] = i_tox;
    this.i_toy_a[ s ][ this.i_actions[ s ] ] = i_toy;

    this.o_obj[ s ][ this.i_actions[ s ] ] = o_obj;
  }


 function obj_t()
  {
    this.b_blend     = [];
    this.b_un_blend  = [];
    this.b_move      = [];
    this.b_zoom_in   = [];
    this.b_zoom_out  = [];
    this.b_zoom_zero = [];
    this.b_move_to   = [];
    this.b_wait      = [];

    this.o_obj       = [];


    this.i_actions         = [];
    this.i_curent_action   = [];
    this.b_work_on_actions = false;


    this.s_what_to_do = [];

    this.s_what_to_do [ 0 ] = "pre_load";
    this.s_what_to_do [ 1 ] = "load";
    this.s_what_to_do [ 2 ] = "un_load";
    this.s_what_to_do [ 3 ] = "over";
    this.s_what_to_do [ 4 ] = "out";
    this.s_what_to_do [ 5 ] = "click";

    this.i_tox_a = [];
    this.i_toy_a = [];

    this.i_work_max = 6;


    this.i_work = 0;

    for( ; this.i_work < this.i_work_max ; this.i_work++ )
     {
       this.i_actions  [ this.s_what_to_do[ this.i_work ] ] = 0;

       this.b_blend    [ this.s_what_to_do[ this.i_work ] ] = [];
       this.b_un_blend [ this.s_what_to_do[ this.i_work ] ] = [];
       this.b_move     [ this.s_what_to_do[ this.i_work ] ] = [];
       this.b_zoom_in  [ this.s_what_to_do[ this.i_work ] ] = [];
       this.b_zoom_out [ this.s_what_to_do[ this.i_work ] ] = [];
       this.b_zoom_zero[ this.s_what_to_do[ this.i_work ] ] = [];
       this.b_move_to  [ this.s_what_to_do[ this.i_work ] ] = [];
       this.b_wait     [ this.s_what_to_do[ this.i_work ] ] = [];
       this.o_obj      [ this.s_what_to_do[ this.i_work ] ] = [];


       this.i_tox_a[ this.s_what_to_do[ this.i_work ] ] = [];
       this.i_toy_a[ this.s_what_to_do[ this.i_work ] ] = [];


       this.i_curent_action[ this.s_what_to_do[ this.i_work ] ] = 0;
       this.i_actions[ this.s_what_to_do[ this.i_work ] ] = 0;
     }

    this.i_delay = 10;

    this.b_moveing  = false;
    this.b_blending = false;
    this.b_zooming  = false;
    this.b_waiting  = false;


    this.s_id = "movetext";

    this.i_fromx = 0;
    this.i_fromy = 0;

    this.i_tox = 0;
    this.i_toy = 0;

    this.i_vx = 0;
    this.i_vy = 0;

    this.i_bodx = 0;
    this.i_body = 0;

    this.i_kroky = 0;
    this.i = 0;

    this.i_speed = 3;

    this.i_opacity_speed = 10;

    this.i_opacity = 0;

    this.b_display = false;

    this.s_id_img = "moveimg";
    this.i_zoom_speed = 10;
    this.i_width_step = 100;
    this.i_zoom_zero = 100;
    this.i_width = 120;
    this.i_img_width = 0;
    this.i_img_height = 0;
  }

// sys buf start

 buf_t.prototype.select = function( i_object )
  {
    if( !this.i_poradie_start[ i_object ] )
      {
        return null;
      }
     else i_swap = this.i_poradie_start[ i_object ];

    if( this.i_poradie_start[ i_object ] != this.i_poradie_stop[ i_object ] ) this.i_poradie_start[ i_object ]++;
     else this.i_poradie_start[ i_object ] = this.i_poradie_stop[ i_object ] = 0;

    this.i_selected = i_object;
    this.s_selected = this.s_obj[ i_object ][ i_swap ];

    this.add( this.i_selected , this.s_selected , false );

    return this.s_selected;
  }

// sys buf stop


 buf_t.prototype.del = function( i_order )
  {
    this.b_set[ this.i_object_in_the_order[ i_order ] ] = false;

    this.i_max_order--;

    this.i_object_in_the_order[ i_order ] = this.i_object_in_the_order[ this.i_max_order ] ;
  }


 buf_t.prototype.add = function( i_object , s_action , b_sys )
  {

// sys buf start

    if( b_sys == true )
      {
        if( !this.i_poradie_stop[ i_object ] )
          {
            this.i_poradie_stop[ i_object ]++;
            this.i_poradie_start[ i_object ] = this.i_poradie_stop[ i_object ];
          }
         else this.i_poradie_stop[ i_object ]++;

        this.s_obj[ i_object ][ this.i_poradie_stop[ i_object ] ] = s_action;

        if( this.b_set[ i_object ] == false ) this.select( i_object );
      }

// sys buf stop

     else
      {
        if( this.b_set[ i_object ] == true )
          {
            this.s_action_wait[ i_object ] = s_action;
          }
         else
          {
            this.b_set[ i_object ] = true;
            this.s_action_wait[ i_object ] = s_action;
            this.i_sequence_object[ i_object ] = this.i_max_order;
            this.i_object_in_the_order[ this.i_max_order ] = i_object;
            this.i_max_order++;
          }
      }
  }


 buf_t.prototype.preload = function( i_max )
  {
    this.i_max_objects = i_max;

    for( i_max = 0 ; i_max < this.i_max_objects ; i_max++ )
     {
       this.b_set[ i_max ] = false;
       this.s_action_pass[ i_max ] = null;

// sys buf start

       this.s_obj[ i_max ] = [];
       this.i_poradie_start[ i_max ] = 0;
       this.i_poradie_stop[ i_max ] = 0;

// sys buf stop

     }
  }


 function buf_t()
  {

    this.b_set = [];
    this.i_max_objects = 0;

    this.s_action_pass = [];
    this.s_action_wait = [];


    this.i_sequence_object = [];     // poradie objektu - if( b_set[ i_object ] == true  ) => i_sequence_object[ i_object ] == i_order
    this.i_object_in_the_order = []; // objekt v poradi - if( b_set[ i_object ] == flase ) => i_sequence_object[ i_object ] = i_max_order & this.i_object_in_the_order[ i_max_order ] = i_object;

    this.i_max_order = 0;

// sys buf start

    this.s_obj = [];
    this.i_poradie_start = [];
    this.i_poradie_stop = [];

    this.i_selected = 0;
    this.s_selected = null;

// sys buf stop

  }


