////////////////////
//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;
    
    function noAA(dest) {
      dest.canvas.setAttribute("style","image-rendering:optimizeSpeed; image-rendering:-moz-crisp-edges; image-rendering:-o-crisp-edges; image-rendering:-webkit-optimize-contrast; image-rendering:optimize-contrast; image-rendering:crisp-edges; image-rendering:pixelated; -ms-interpolation-mode:nearest-neighbor;") ;
      dest.contex.imageSmoothingEnabled = false;
      dest.contex.mozImageSmoothingEnabled = false;
      dest.contex.oImageSmoothingEnabled = false;
      dest.contex.webkitImageSmoothingEnabled = false;
    }

    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 ;
      }
  }

    
    var move_pac2=0;
    var i_pacmove2=0;
    var i_pac2=0;
    var mycanvas_pacman2;
    var mycanvas_white ; 
    
    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) ;
        noAA(this.canvaspart);
        for(var y=0;y<32*SIZEy;y+=SIZEy){
        for(var x=0;x<32*SIZEx;x+=SIZEx){
        visage2.draw(mycanvas3_vis,x,y);
        }
        }
       // mycanvas4=new canvas(720,576);
       
        mycanvas_pacman2=new canvas(720,576);
        mycanvas_white = new canvas(720,576) ;
        mycanvas_white.fill("#000000") ;
        end_total=1;
        this.initdone = 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>575) pos_y+=1; 
  } /*
  else
  {
    vbl_visage++;  
    if (vbl_visage>200)
    {

      mycanvas3_vis.sethandle((32*SIZEx)/2+Math.sin(rot/6)*50,(32*SIZEy)/2+Math.sin(rot/10)*70);
      
      mycanvas3_vis.draw(this.canvaspart,320,240,1,rot*2,2.15+Math.sin(rot/50)*2,2.15+Math.sin(rot/50)*2);
      rot+=0.2;
       
    }
    else
    {
      visage_canvas.draw(this.canvaspart,0,pos_y) ;
    }
      visage_canvas.draw(this.canvaspart,0,pos_y) ;
    
  }*/

    visage_canvas.draw(this.canvaspart,0,pos_y) ;

        this.canvaspart.draw(dest);
        
        if (this.vbl<100) mycanvasblack.draw(dest,60,88,1-this.vbl/100);
        //if (this.vbl>intro_parts[part_running].part_duration-100) mycanvasblack.draw(dest,60,88,1-(intro_parts[part_running].part_duration-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 (this.vbl > intro_parts[part_running].part_duration-300){ 
//              mycanvasblack.draw(dest,60,88,1-(intro_parts[part_running].part_duration-this.vbl)/100);
//              fond_global.draw(mycanvas_pacman2,0,0);
            //if (move_pac2 > 220){
                //mycanvas_pacman.drawPart(dest,0,0,0,0,move_pac2-210,576,1,0,1,1);}
        
            bigpac[i_pac2].draw(dest,dest.width-(-500+move_pac2),10,1,0,-1,1);
            move_pac2+=5;
          
            i_pacmove2=i_pacmove2+1;
            if (i_pacmove2>=5){i_pac2=i_pac2-1;}
            if (i_pacmove2<=4){i_pac2=i_pac2+1;}
            if (i_pacmove2==8){i_pac2=0;i_pacmove2=0;}

            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.vbl++ ;
    }

    return this ;
}

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