function MultiPlayer(){
this.TableM = new TableModel();

/*Inisialisation du tableau des données */

            this.T = new Array(10,4);
			this.values = null;

            //Tableau des données des cartes 

           

            // Inisialisation Des scors 
            this.HoldScor = 7.5; 
            this.UserScors = 500;
            this.Player2Scors = 500;
            this.UserRoundScor = 0;
            this.Player2RoundScor = 0;
            this.Round = 0;
            this.NumberCarteImage = 1;
			this.NumberCarteImagePlayer2 = 1;
			
           

            // Fin Inisialisation Des scors 

            this.Tour = 0 ;
            this.gameFinish = false ;
			this.WriteDiv = 0 ;
			this.countLine = 0 ;
			this.RoundFinish = false ;  			
            this.GameTour = 1; 
            this.TableCarteTirer = new Array(50);
            this.CarteTirer = 0 ;
            this.CarteUser = 0;
            this.CartePlayer2 = 0;
            this.TiragePlayer2 = 0;
            this.FirstCartePlayer2Image = 0;
			this.FirstCartePlayer1Image = 0;			
            this.FirstCarteUser = 0;
            this.FirstCartePlayer2 = 0; 
            this.NumberCarte = Math.floor((Math.random() * 10) + 0);
			this.NumberColor = Math.floor((Math.random() * 4) + 0);	
            this.Carte = 0;
            this.Couleur = 0;
            this.i = 0;
            this.kingScor = 0;
            this.TirageKingPlayer2 = 0;  
            this.TirageKing = 0;
			
			this.Player2 = document.getElementById('SpaceCardPlayer2') ; 
	        this.player = document.getElementById('SpaceCardPlayer') ; 
};

// Test Game finished
MultiPlayer.prototype.GameIsFinish=function()
{ 
        if (this.UserScors==0)
		{
		  document.getElementById("MessageWin").innerHTML="Player 2  Win The Game" ;
		  $('my_popup').popup("show");
		  setTimeout($('my_popup').popup(hide),4000);
		  this.Write("Player 2  Win The Game ","Green",150);
		  this.gameFinish=true ;
		  return true ;
		  
		}
		else if (this.Player2Scors==0)
		{
		   document.getElementById("MessageWin").innerHTML="Player 1  Win The Game" ;
		   $('my_popup').popup("show");
		   setTimeout($('my_popup').popup("hide"),4000);
		   this.Write("Player 1  Win The Game ","Green",150);
		   this.gameFinish=true ;
		   return true ;
		}
	return false ;	
}
// Machine a écrire 
MultiPlayer.prototype.Write=function(text,color,delai,text2)
{
   this.WriteDiv++;
   this.countLine++
   if (this.countLine==8)
   {
		document.getElementById('Journal').innerHTML = "" ;
		this.countLine = 0 ;
	}
   if (delai==null)
   delai= 0 ; 
   if (text2==null)
   {
      
	   document.getElementById('Journal').innerHTML += '<div id="ecrire'+this.WriteDiv+'" class="ecrire"> '+text+'</div> <br />';
	   $("#ecrire"+this.WriteDiv).css("color",color) ;
	   $("#ecrire"+this.WriteDiv).machineEcrire({ 'delai' : delai });
   }
   else
   { 
       document.getElementById('Journal').innerHTML += '<div id="ecrire'+this.WriteDiv+'" class="ecrire"> '+text+'  '+text2+'</div> <br />';
	   $("#ecrire"+this.WriteDiv).css("color",color) ;
	   $("#ecrire"+this.WriteDiv).machineEcrire({ 'delai' : delai });
   }
}
// chercher si une carte a été tirrer déja 

MultiPlayer.prototype.SearchNumber=function(number){

for(var i=0;i<this.TableCarteTirer.Length;i++)
            {
                if (this.TableCarteTirer[i]==number)
                {
                    return true ; 
                }
            }
            return false ; 
}

MultiPlayer.prototype.pull=function()
{
   if (this.gameFinish==false)
	{   
    if (this.RoundFinish==false)
	{
            if ((this.UserRoundScor == 7.5) && (this.GameTour % 2 != 0) && (this.Tour == 0))
            {
                this.Tour = 1;
				this.Write("Player 1 Pull a Card","orange",0);
                this.GamePlayer2();
            }
        
			if ((this.Player2RoundScor == 7.5) && (this.GameTour % 2 == 0) && (this.Tour == 1))
            {
			    this.GameUser();
				this.Write("Player 2 Pull a Card","orange",0);
				
                this.Tour = 0;
				
                
            }
			if ((this.UserScors != 0) && (this.Player2Scors !=0) &&  (this.Tour == 1))
			{
			    this.Write("Player 2 Pull a Card","orange",0);
				
				this.GamePlayer2();
				
			}
            if ((this.UserScors != 0) && (this.Player2Scors !=0) &&  (this.Tour == 0))
			{
			    this.Write("Player 1 Pull a Card","orange",0);
				
				this.GameUser();
			
			}
	   }
	}
}


MultiPlayer.prototype.CardReveal=function()
{
        document.getElementById('ScorPlayer2').innerHTML= "<p>Scor Round Player 2 :"+this.Player2RoundScor+"</p>";
		document.getElementById('ScorPlayer').innerHTML= "<p>Scor Round Player  :"+this.UserRoundScor+"</p>";
		document.getElementById('RoundScorPlayer2').innerHTML= "<p>Scor  Player 2 :"+this.Player2Scors+"</p>";
		document.getElementById('RoundScorPlayer').innerHTML= "<p>Scor Round Player  :"+this.UserScors+"</p>";
		document.getElementById('FirstCardPlayer2').innerHTML =  '<img class="FirstCard" src="app/images/cards/'+this.FirstCartePlayer2Image+'.png" />' ; 
		document.getElementById('FirstCardPlayer').innerHTML =  '<img class="FirstCard" src="app/images/cards/'+this.FirstCartePlayer1Image+'.png" />' ;
}
MultiPlayer.prototype.pass=function()
{
  if (this.gameFinish==false)
  {
    if (this.RoundFinish==false)
	{
    if ( (this.Tour == 0) && (this.GameTour % 2 == 0))
	{
	   
		this.RoundFinish = true ;
		this.TestWin();
        return false ; 			   
	}
	else if ((this.Tour == 1) && (this.GameTour % 2 != 0))
	{
	    this.Write("Player 2 Passed","Red",0);
	    this.RoundFinish = true ;
        this.TestWin();
		return false ;
	}
	else
	{
	  
    if ((this.UserRoundScor <= this.HoldScor) && (this.Tour == 0) && (this.GameTour % 2 != 0) && (this.Player2Scors != 0) && (this.UserScors != 0))
            {
			    this.Write("Player 1 Passed","Red",0);
				
                this.Tour = 1;   
            }
    
	else if ((this.Player2RoundScor <= this.HoldScor) && (this.Tour == 1) && (this.GameTour % 2 != 0) && (this.Player2Scors != 0) && (this.UserScors != 0))
            {
			    this.Write("Player 2 Passed","Red",0);
				
                this.Tour = 0;   
            }
		if ((this.UserRoundScor <= this.HoldScor) && (this.Tour == 0) && (this.GameTour % 2 == 0) && (this.Player2Scors != 0) && (this.UserScors != 0))
            {
			    this.Write("Player 1 Passed","Red",0);
				
                this.Tour = 1;   
            }
    
	else if ((this.Player2RoundScor <= this.HoldScor) && (this.Tour == 1) && (this.GameTour % 2 == 0) && (this.Player2Scors != 0) && (this.UserScors != 0))
            {
			    this.Write("Player 2 Passed","Red",0);
				
                this.Tour = 0;   
            }	
	}	
 }	
 }
    
}

MultiPlayer.prototype.Next=function()
{
    this.Inisialisation(); 
   if ((this.Player2Scors > 0) && (this.UserScors > 0))
            {
                // Next Round
			
				  
				   this.Inisialisation(); 
				 
			
                
            }
            else
            {
			   document.getElementById('RoundScorPlayer').innerHTML= "<p>Scor Player : "+this.UserScors+"</p>";
			   document.getElementById('RoundScorPlayer2').innerHTML= "<p>Scor Player2 :"+this.Player2Scors+"</p>";
               
            }
}
 

//Calcule de la valeur Du joker ( Rois Carreau ) 
MultiPlayer.prototype.CalculeRoisCarreau=function(){
    if (this.Tour == 0)
            {
                if (this.UserRoundScor < this.HoldScor)
                {
                    if (this.UserRoundScor == 0)
                    {
                        this.UserRoundScor = 7;
                    }
                    else if (this.UserRoundScor == 7)
                    {
                        this.UserRoundScor = this.UserRoundScor + 0.5;
                    }
                    
                    else
                    {
                        this.kingScor = (this.HoldScor - this.UserRoundScor);
                        this.UserRoundScor = this.UserRoundScor + this.kingScor;

                    }
                }
                else
                {
                    this.UserRoundScor = this.UserRoundScor + 0.5;
                }
            }
            else if (this.Tour == 1)
            {
                if (this.Player2RoundScor < this.HoldScor)
                {
                    if (this.Player2RoundScor == 0)
                    {
                        this.Player2RoundScor = 7;
                    }
                    else if (this.Player2RoundScor == 7)
                    {
                        this.Player2RoundScor = this.UserRoundScor + 0.5;
                    }
                    else
                    {
                        this.kingScor = (this.HoldScor - this.Player2RoundScor);
                        this.Player2RoundScor = this.Player2RoundScor + this.kingScor;
                    }
                }
                else
                {
                    this.Player2RoundScor = this.Player2RoundScor + 0.5;
                }
            } 
}

// Calcule du Joker (Rois Carreau) aprés le Tirage 
MultiPlayer.prototype.CalculeAfterKing=function(){
	if (this.Tour == 0)
            {
                this.UserRoundScor = (this.UserRoundScor - this.kingScor);
                if (this.UserRoundScor < this.HoldScor)
                {

                   this.kingScor = (this.HoldScor - this.UserRoundScor);
                    this.UserRoundScor = this.UserRoundScor + this.kingScor;
                }
                else
                {
                    this.UserRoundScor = this.UserRoundScor + 0.5;
                }
            }
            else if (this.Tour == 1)
            {
                this.Player2RoundScor = (this.Player2RoundScor - this.kingScor);
                if (this.Player2RoundScor < this.HoldScor)
                {

                    this.kingScor = (this.HoldScor - this.Player2RoundScor);
                    this.FirstCartePlayer2 = this.kingScor;
                    this.Player2RoundScor = this.Player2RoundScor + this.kingScor;
                }
                else
                {
                    this.Player2RoundScor = this.Player2RoundScor + 0.5;
                }
            }

}

 

// Inisilisation des variables
MultiPlayer.prototype.Inisialisation=function()
{
  
    if (this.gameFinish==false)
    {	
            this.UserRoundScor = 0;
			this.values = null ; 
            this.Player2RoundScor = 0;
            this.Round = 0;
			this.RoundFinish=false ; 
            this.NumberCarteImage = 1;
            this.NumberCarteImagePlayer2 = 1;
			this.FirstCartePlayer1Image=0;
            this.kingScor = 0;
            this.TirageKing = 0;
            this.TirageKingPlayer2 = 0;
            this.i = 0;
            this.TableCarteTirer = new Array(50);
            this.CarteTirer = 0;
            this.CarteUser = 0;
            this.CartePlayer2 = 0;
            
			 var Player2 = document.getElementById('SpaceCardPlayer2') ; 
			 var player = document.getElementById('SpaceCardPlayer') ; 
			
				Player2.innerHTML = '' ;
				player.innerHTML = '' ;
				
			

            // fin Inisilisation pour chaque tour
            // Message Round

             this.Write(" Round "+this.GameTour,"Blue");
			 

            // fin Message Round
            // First Carte User 
            this.Carte = Math.floor((Math.random() * 10) + 0);
            this.Couleur = Math.floor((Math.random() * 4) + 0);
			
			this.values = T[this.Carte] ; 
            this.FirstCarteUser = this.values[this.Couleur];
			this.FirstCartePlayer1Image= (this.Carte * 100) + this.Couleur;
            this.CarteUser = (this.Carte * 100) + this.Couleur;
            
            
            this.TableCarteTirer[this.i] = (this.Carte * 100) + this.Couleur;
            this.i++;
           
            if (this.CarteUser == 900)
            {
                this.UserRoundScor = 7;
                this.TirageKing = 1;
                this.kingScor = 7;
				
            }
            else
            {
                this.UserRoundScor =  this.FirstCarteUser;
				
            }
            // Fin First Carte User

            // First Carte Player2 
            this.Carte = Math.floor((Math.random() * 10) + 0);
            this.Couleur =Math.floor((Math.random() * 4) + 0);
            this.CartePlayer2 = (this.Carte * 100) + this.Couleur;
           
            while (this.SearchNumber(this.CartePlayer2))
            {
                this.Carte = Math.floor((Math.random() * 10) + 0);
                this.Couleur = Math.floor((Math.random() * 4) + 0);
                this.CartePlayer2 = (this.Carte * 100) + this.Couleur;
            }
            
             if (this.CartePlayer2 == 900)
            {
                
                this.FirstCartePlayer2 = 7;
                this.TirageKingPlayer2 = 1;
                this.kingScor = 7;
            }
            else
            {
				this.values = T[this.Carte] ; 
                this.FirstCartePlayer2 = this.values[this.Couleur];
                this.Player2RoundScor = this.FirstCartePlayer2;
            }
            this.FirstCartePlayer2Image = this.CartePlayer2;
			this.values = T[this.Carte] ;
            this.FirstCartePlayer2 = this.values[this.Couleur];
            this.TableCarteTirer[this.i] = (this.Carte * 100) + this.Couleur;
            this.i++;
           

            // Fin First Carte Player2
           

            // fin Affectation des Cartes Face caché

           
            document.getElementById('RoundScorPlayer').innerHTML= "<p>Scor Player :"+this.UserScors+"</p>";
            document.getElementById('RoundScorPlayer2').innerHTML= "<p>Scor Player2 :"+this.Player2Scors+"</p>";
			document.getElementById('ScorPlayer').innerHTML= "<p>Scor Round Player : 0</p>";
			document.getElementById('FirstCardPlayer').innerHTML =  '<img class="FirstCard" src="app/images/Game/carte_cachee.png" />' ; 
			
            document.getElementById('ScorPlayer2').innerHTML= "<p>Scor Round Player2 : 0</p>";
            document.getElementById('FirstCardPlayer2').innerHTML =  '<img class="FirstCard" src="app/images/Game/carte_cachee.png" />' ; 
            if (this.GameTour % 2 == 0)
            {
                this.Tour = 1; 
                //GamePlayer2();
                
            }
            else
            {
               this.Tour = 0; 
               //this.GameUser();

            }
			 
           
        }
    }
MultiPlayer.prototype.TestWin=function()
{
   
			
    if (this.Player2Scors==0)
	{
	
	         this.Write("Player 1 Win the Round "+this.GameTour,"Green",25,"Click Enter For Next Round");
			 this.GameTour++;
			
			 
			 
	}
	else if (this.UserScors==0)
	{
	         this.Write("Player 2 Win the Round "+this.GameTour,"Green",25,"Click Enter For Next Round");
			this.GameTour++;

	}
	else
	{
		if (this.RoundFinish == true )
		{	
			  if (this.Player2RoundScor>this.HoldScor)
			  { 
				 this.CardReveal();
				 this.UserScors = this.UserScors + 100;
                 this.Player2Scors = this.Player2Scors - 100;
				 this.Write("Player 1 Win the Round "+this.GameTour,"Green",25,"Click Enter For Next Round");
			     this.GameTour++;
			  }
			  else if (this.UserRoundScor>this.HoldScor)
			  { 
				 this.CardReveal();
				 this.UserScors = this.UserScors - 100;
                 this.Player2Scors = this.Player2Scors + 100;
				 this.Write("Player 2 Win the Round "+this.GameTour,"Green",25,"Click Enter For Next Round");
				 this.GameTour++;
			  }
			  else if (this.Player2RoundScor<this.UserRoundScor)
			  {
				this.CardReveal();
				this.UserScors = this.UserScors + 100;
                    this.Player2Scors = this.Player2Scors - 100;
				this.Write("Player 1 Win the Round "+this.GameTour,"Green",25,"Click Enter For Next Round");
				this.GameTour++;
			  }
			  else if (this.Player2RoundScor>this.UserRoundScor)
			  {
				this.CardReveal();
				this.UserScors = this.UserScors - 100;
                    this.Player2Scors = this.Player2Scors + 100;
				this.Write("Player 2 Win the Round "+this.GameTour,"Green",25,"Click Enter For Next Round");
				this.GameTour++;
			  }
			  else if (this.Player2RoundScor==this.UserRoundScor)
			  {
				this.CardReveal();
				this.Write("Equality in the Round "+this.GameTour,"Yellow",25,"Click Enter For Next Round");
				this.GameTour++;
				
				
			  }
			}
		}
		this.GameIsFinish();
}		
		
// methode  qui calcule le scor si le rois carreau est tirrer 
MultiPlayer.prototype.CalculeRoisCarreau=function()
{
             
            if (this.Tour == 0)
            {
                if (this.UserRoundScor < this.HoldScor)
                {
                    if (this.UserRoundScor == 0)
                    {
                        this.UserRoundScor = 7;
                    }
                    else if (this.UserRoundScor == 7)
                    {
                        this.UserRoundScor = this.UserRoundScor + 0.5;
                    }
                    
                    else
                    {
                        this.kingScor = (this.HoldScor - this.UserRoundScor);
                        this.UserRoundScor = this.UserRoundScor + this.kingScor;

                    }
                }
                else
                {
                    this.UserRoundScor = this.UserRoundScor + 0.5;
                }
            }
            else if (this.Tour == 1)
            {
                if (this.Player2RoundScor < this.HoldScor)
                {
                    if (this.Player2RoundScor == 0)
                    {
                        this.Player2RoundScor = 7;
                    }
                    else if (this.Player2RoundScor == 7)
                    {
                        this.Player2RoundScor = this.UserRoundScor + 0.5;
                    }
                    else
                    {
                        this.kingScor = (this.HoldScor - this.Player2RoundScor);
                        this.Player2RoundScor = this.Player2RoundScor + this.kingScor;
                    }
                }
                else
                {
                    this.Player2RoundScor = this.Player2RoundScor + 0.5;
                }
            }
}
// Tirer Carte By User 
MultiPlayer.prototype.TirerCarteUser=function(){

 this.TableCarteTirer[this.i] = this.CarteUser;
                    this.i++;
                    if (this.CarteUser == 900)
                    {
                        this.TirageKing = 1;
                        this.CalculeRoisCarreau();
                    }
                    else
                    {
                        if (this.TirageKing == 0)
						{
						    this.values = T[this.Carte] ;
                            this.UserRoundScor = this.UserRoundScor + this.values[this.Couleur];
							}
                        else
                        {
						    this.values = T[this.Carte] ;
                            this.UserRoundScor = this.UserRoundScor + this.values[this.Couleur];
                            this.CalculeAfterKing();
                        }

                    }
					
                    
					document.getElementById('ScorPlayer').innerHTML= "<p>Scor Round Player :"+this.UserRoundScor+"</p>";
					this.player.innerHTML +=  '  <div id="CardPickedPlayer'+(((this.NumberCarteImage-1)))+'"> <img class="Card" src="app/images/cards/'+this.CarteUser+'.png" /></div>' ; 
                    this.NumberCarteImage++;

}


// systeme de jeu du joueur
MultiPlayer.prototype.GameUser=function()
{
		
		

            if ((this.Tour == 0) && (this.HoldScor > this.UserRoundScor))
            {
                this.Carte = Math.floor((Math.random() * 10) + 0);
                this.Couleur = Math.floor((Math.random() * 4) + 0);
                this.CarteUser = (this.Carte * 100) + this.Couleur;
				
                while (this.SearchNumber(this.CarteUser) == true)
                {
                    this.Carte = Math.floor((Math.random() * 10) + 0);
                    this.Couleur = Math.floor((Math.random() * 4) + 0);
                    this.CarteUser = (this.Carte * 100) + this.Couleur;
                }
				
					this.TirerCarteUser(); 
				
                  
                if (this.UserRoundScor > this.HoldScor)
                {
                    this.UserScors = this.UserScors - 100;
                    this.Player2Scors = this.Player2Scors + 100;
					this.RoundFinish=true;
					this.CardReveal();
					if (!this.GameIsFinish())
					{
						this.Write("Player 2 Win the Round "+this.GameTour,"Green",null,"Click Enter For Next Round");
						this.GameTour++;
					}
                    
                }
            }
            else 
            {
                if (this.UserRoundScor > this.HoldScor)
                {
                    this.UserScors = this.UserScors - 100;
                    this.Player2Scors = this.Player2Scors + 100;
					 this.RoundFinish=true;
					 this.CardReveal();
					 if (!this.GameIsFinish())
					 {
						 this.Write("Player 2 Win the Round "+this.GameTour,"Green",null,"Click Enter For Next Round");
						 this.GameTour++;
					 }
                }
                else
                {
                    
                        if ((this.Player2RoundScor > this.UserRoundScor))
                        {
                            this.UserScors = this.UserScors - 100;
                            this.Player2Scors = this.Player2Scors + 100;
							this.RoundFinish=true;
							this.CardReveal();
							if (!this.GameIsFinish())
							{
								this.Write("Player 2 Win the Round "+this.GameTour,"Green",null,"Click Enter For Next Round");
								this.GameTour++;
							}
                        }
                        else if ((this.Player2RoundScor < this.UserRoundScor))
                        {
                            this.Player2Scors = this.Player2Scors - 100;
                            this.UserScors = this.UserScors + 100;
							this.RoundFinish=true;
							this.CardReveal();
							if (!this.GameIsFinish())
							{
								this.Write("Player 1 Win the Round "+this.GameTour,"Green",null,"Click Enter For Next Round");
								this.GameTour++;
							}
                        }
                        else
						{
						        this.RoundFinish=true;
						        this.CardReveal();
								if (!this.GameIsFinish())
								{
									this.Write("Equality "+this.GameTour,"Yellow",null,"Click Enter For Next Round");
									this.GameTour++;
								}
						      
						}
							
                    


                }
               
            }
            
        }
		
		// systeme de jeu du joueur 2 
MultiPlayer.prototype.GamePlayer2=function()
{
		
		

            if ((this.Tour == 1) && (this.HoldScor > this.Player2RoundScor))
            {
                this.Carte = Math.floor((Math.random() * 10) + 0);
                this.Couleur = Math.floor((Math.random() * 4) + 0);
                this.CartePlayer2 = (this.Carte * 100) + this.Couleur;
				
                while (this.SearchNumber(this.CartePlayer2) == true)
                {
                    this.Carte = Math.floor((Math.random() * 10) + 0);
                    this.Couleur = Math.floor((Math.random() * 4) + 0);
                    this.CartePlayer2 = (this.Carte * 100) + this.Couleur;
                }
				
					this.TirerCartePlayer2(); 
				
                
                if (this.Player2RoundScor > this.HoldScor)
                {
                    this.UserScors = this.UserScors + 100;
                    this.Player2Scors = this.Player2Scors - 100;
					this.RoundFinish=true;
					this.CardReveal();
					if (!this.GameIsFinish())
					{
						this.Write("Player 1 Win the Round "+this.GameTour,"Green",50,"Click Enter For Next Round");
						this.GameTour++;
                    }
                }
            }
            else 
            {
                if (this.Player2RoundScor > this.HoldScor)
                {
                    this.UserScors = this.UserScors + 100;
                    this.Player2Scors = this.Player2Scors - 100;
					this.RoundFinish=true;
					this.CardReveal();
					if (!this.GameIsFinish())
					{
						this.Write("Player 2 Win the Round "+this.GameTour,"Green",50,"Click Enter For Next Round");
						this.GameTour++;
					}
				    
                }
                else
                {
                    
                        if ((this.Player2RoundScor > this.UserRoundScor))
                        {
                            this.UserScors = this.UserScors - 100;
                            this.Player2Scors = this.Player2Scors + 100;
							this.RoundFinish=true;
							this.CardReveal();
							if (!this.GameIsFinish())
							{
								this.Write("Player 2 Win the Round "+this.GameTour,"Green",50,"Click Enter For Next Round");
								this.GameTour++;
							}
                        }
                        else if ((this.Player2RoundScor < this.UserRoundScor))
                        {
                            this.Player2Scors = this.Player2Scors - 100;
                            this.UserScors = this.UserScors + 100;
							this.RoundFinish=true;
							this.CardReveal();
							if (!this.GameIsFinish())
							{
								this.Write("Player 1 Win the Round "+this.GameTour,"Green",50,"Click Enter For Next Round");
								 this.GameTour++;
							}
                        }
                        else
						{
						        this.RoundFinish=true;
						        this.CardReveal();
								if (!this.GameIsFinish())
								{
									this.Write("Equality "+this.GameTour,"Yellow",50,"Click Enter For Next Round");
									this.GameTour++;
								}
						      
						}
							
                    


                }
               
            }
            
        }
MultiPlayer.prototype.sleep=function(milliseconds) {
  var start = new Date().getTime();
  for (var i = 0; i < 1e7; i++) {
    if ((new Date().getTime() - start) > milliseconds){
      break;
    }
  }
}

// Tirer Carte By Player 2 
MultiPlayer.prototype.TirerCartePlayer2=function(){
			
			this.TableCarteTirer[this.i] = this.CarteUser;
                    this.i++;
                    if (this.CarteUser == 900)
                    {
                        this.TirageKingPlayer2 = 1;
                        this.CalculeRoisCarreau();
                    }
                    else
                    {
                        if (this.TirageKingPlayer2 == 0)
						{
						    this.values = T[this.Carte] ;
                            this.Player2RoundScor = this.Player2RoundScor + this.values[this.Couleur];
							}
                        else
                        {
						    this.values = T[this.Carte] ;
                            this.Player2RoundScor = this.Player2RoundScor + this.values[this.Couleur];
                            this.CalculeAfterKing();
                        }

                    }
					
                    
					document.getElementById('ScorPlayer2').innerHTML= "<p>Scor Round Player :"+this.Player2RoundScor+"</p>";
					this.Player2.innerHTML +=  '  <div id="CardPickedPlayer2'+(((this.NumberCarteImagePlayer2-1)))+'"> <img class="Card" src="app/images/cards/'+this.CartePlayer2+'.png" /></div>' ; 
                    this.NumberCarteImagePlayer2++;
			
            
        }


MultiPlayer.prototype.Game=function(){

           T = this.TableM.TableCartesFull();
           
           this.Inisialisation();

}