////////////////////
//HEMO TEXT      //
//////////////////
function part19() {
    this.vbl = 0 ;
    this.canvaspart;
    this.initdone = 0 ;
    var visage_x=0;
    var visage_y=842;
    var visage_mytile = 0 ;
    var visage_canvas;  
    var visage_black;
    var vbl_visage=0;
    var visage_all_drawn=0;
    var visage_init_done = 0 ;
    var SIZEx = 200;
    var SIZEy = 234;
   
    var mycanvas3_vis;
    var cpt_visage_y=0;
    var pos_y=-266;
    var rot=0;
    var vbl_visage=0;
    var mycanvas_scr2;
    var mycanvas_scr3;
    var mycanvas_scr4;
    
  
    
    var move_pac2=0;
    var i_pacmove2=0;
    var i_pac2=0;
    var mycanvas_pacman2;
    var mycanvas_white ; 
    var scr_move=0;
    var scr_stop=0;
    var scr_vbl=0;
    var vbl_visage=0;

    function do_visage(dest) {
      visage.drawTile(dest,visage_mytile,visage_x,visage_y) ;
      visage_mytile ++
      visage_x += visage.tilew ;
      if ( visage_x >= visage.img.width ) {
          visage_x = 0 ;
          visage_y -= visage.tileh;
     
        if ( visage_y <= 0 ) visage_all_drawn = 1 ;
      }
  }
    
    this.init = function(dest,black) {
       
        this.canvaspart.fill("#0"); 
        this.canvaspart.draw(black);
        mycanvas3_vis=new canvas(32*SIZEx,32*SIZEy);
        visage_canvas = new canvas(visage.img.width, visage.img.height) ;
        visage_black = new canvas(dest.width, dest.height) ;
        visage_black.fill("#203341") ;
        visage_init_done = 1 ;
        visage.initTile(visage.img.width,1,0) ;

       
        mycanvas_pacman2=new canvas(720,576);
        mycanvas_white = new canvas(720,576) ;
        mycanvas_white.fill("#000000") ;
        
        mycanvas_scr2=new canvas(720,576);
        mycanvas_scr4=new canvas(720,576);
        mycanvas_scr3=new canvas(1200,1200);
        background.draw(mycanvas_scr3,0,0);
        background.draw(mycanvas_scr3,0,800);
        myfont_big.initTile(450,417,32);
        myscrolltext_big = new scrolltext_horizontal();
        myscrolltext_big.scrtxt="PLEASE WAIT    ";
        myscrolltext_big.init(mycanvas_scr4,myfont_big,12);
        
  
        end_total=1;
        this.initdone = 1 ;
    }
var fade_visage=1;
    this.render = function(dest) {
        
        if (this.initdone == 0) { this.canvaspart = new canvas(720,576) ; this.init(this.canvaspart,dest) ; }
        
        this.canvaspart.fill("#0");

          if (visage_all_drawn == 0) 
          {
            do_visage(visage_canvas) ;
            cpt_visage_y++;
            if (cpt_visage_y>=576) pos_y+=1; 
            visage_canvas.draw(this.canvaspart,0,pos_y) ;
             this.canvaspart.draw(dest);
          }
          else
          {
            vbl_visage++;
            if (vbl_visage<=100){dest.fill("#0");visage_canvas.draw(this.canvaspart,0,pos_y) ; fade_visage=fade_visage-0.01;this.canvaspart.draw(dest,0,0,fade_visage);}
            
            if (vbl_visage>=100){visage_black.fill("#0") ;visage_black.draw(this.canvaspart,0,pos_y,1) ;}
           
           }

           
        
        if (this.vbl<100) mycanvasblack.draw(dest,60,88,1-this.vbl/100);
          
            if (this.vbl > intro_parts[part_running].part_duration-400){ 
            var myalpha = 1-(intro_parts[part_running].part_duration-400-this.vbl+200)/200 ;
            if (myalpha < 0 ) myalpha = 0 ;
            mycanvas_white.draw(dest,0,0,myalpha);
        }
        
        if (vbl_visage>100){
      //  if (this.vbl > intro_parts[part_running].part_duration-550){ 
         
            mycanvas_scr2.clear();
            mycanvas_scr4.clear();
            myscrolltext_big.draw(0);
            mycanvas_scr4.draw(mycanvas_scr2,0,scr_move);
  
            scr_stop++;
            if (scr_stop<120){scr_move++;}
            if ((scr_stop>=120)&&(scr_stop<=238)){scr_move--;}
            if (scr_stop>238){scr_stop=0}
            
            mycanvas_scr2.contex.globalCompositeOperation='source-in';
            mycanvas_scr3.draw(mycanvas_scr2,-200+Math.sin((scr_vbl*Math.PI)/200)*100,-100+Math.cos((scr_vbl*Math.PI)/200)*50);
            mycanvas_scr2.contex.globalCompositeOperation='source-over';
            
            mycanvas_scr2.draw(this.canvaspart,0,30,1);
             this.canvaspart.draw(dest);
            scr_vbl++;

        if (this.vbl>intro_parts[part_running].part_duration-200){ 
                var myalpha = 1-(intro_parts[part_running].part_duration-this.vbl)/200 ;
                mycanvas_white.draw(dest,0,0,myalpha);
            }
            }
   //    this.canvaspart.draw(dest);
            
             this.vbl++ ;
    }

          

    return this ;
}

///////////////
//END PART19//
/////////////