


function Keyboard(system){
var  key;

var launch;
this.launch=false;
this.system=system;

this.runService=function(){
	this.launch=true;

	}
this.stopService=function(){
	this.launch=false;
	}	


// touche clavier enfoncé


this.key = new Array(256);

	this.down =function (_num){
	//	alert(_num);
			this.key[_num]= true;
			
			}
		//***************************************************
		
		//***************************************************
		//bouton relaché
		this.up =function (_num){
			this.key[_num]= false;
				
			}
			
		//***************************************************
		// bouton est il enfoncé  ?
		this.isdown =function (_num){
	
			return this.key[_num]== true;
			}
			
			
			
			
			
			
	//-------------------------------		
this.actionKeyUp=function(ev){
	if(	this.system.activeObjet){
	
 
switch(ev.which){
	case 65:
	

	
	break;
	
	
		}

	}
	this.system.mykeyboard.Up(ev.which);}



//--------------------------------------------
this.actionKeyDown=function(ev){
//alert(ev.which);
if(this.system.activeObjet){


switch(ev.which){
	case 65:

	
	this.system.activeObjet.setA(0.2);
	
	break;
	case 69:

	
	this.system.activeObjet.setA(1);
	
	break;
	
	case 90:
	this.system.activeObjet.setA(0.7);
	
	break;
	
	case 8:
	return false;

	case 16:
	break;

/*	case 32:



if (!G_Activedoz.txtzone.hasChildNodes()){
G_Activedoz.txtzone.appendChild(document.createElement("p"));	
G_Activedoz.txtzone.lastChild.innerHTML="&nbsp;";
}else{
	
//G_Activedoz.txtzone.lastChild.appendData("_");
//G_Activedoz.txtzone.innerHTML="i";
G_Activedoz.txtzone.lastChild.innerHTML=G_Activedoz.txtzone.lastChild.firstChild.data+"&nbsp;";}



break;
		case 226:
		if (MonTableau[16]){
if (G_Activedoz.txtzone.childNodes.length>0){	

			 var nombre_signes = G_Activedoz.txtzone.lastChild.firstChild.data.length;
			 
			 if (nombre_signes>0){
 G_Activedoz.txtzone.lastChild.firstChild.deleteData(nombre_signes-1,1);
 }else{
	

G_Activedoz.txtzone.removeChild(G_Activedoz.txtzone.lastChild);

}
	 }
 

		}
	break;
	case 13:

G_Activedoz.txtzone.appendChild(document.createElement("p"));

	
	break;
	
	default:


if (!G_Activedoz.txtzone.hasChildNodes()){
G_Activedoz.txtzone.appendChild(document.createElement("p"));	
}

if (!G_Activedoz.txtzone.lastChild.hasChildNodes()){
G_Activedoz.txtzone.lastChild.appendChild(document.createTextNode(""));	
}

ascii=ev.which;

if (!MonTableau[226]&&ev.which>64&&ev.which<91)
	ascii=ascii+32;
	
touche=String.fromCharCode(ascii);
cpt=5;
switch (ev.which){
	case 38: 
	if(MonTableau[226]){
		G_Activedoz.height=G_Activedoz.height-cpt;
		if(G_Activedoz.height>0)
		G_Activedoz.style.height=G_Activedoz.height;
		}
	else
		G_Activedoz.style.top=parseInt(G_Activedoz.style.top)-cpt;
	break;
		case 40 : 
		if(MonTableau[226]){
		G_Activedoz.height=G_Activedoz.height+cpt;
		if(G_Activedoz.height>0)
		G_Activedoz.style.height=G_Activedoz.height;
		}
	else
	G_Activedoz.style.top=parseInt(G_Activedoz.style.top)+cpt;
	break;
		case 37: 
			if(MonTableau[226]){
		G_Activedoz.width=G_Activedoz.width-cpt;
		if(G_Activedoz.width>0)
		G_Activedoz.style.width=G_Activedoz.width;
		}
	else
	G_Activedoz.style.left=parseInt(G_Activedoz.style.left)-cpt;
	break;
		case 39: 
					if(MonTableau[226]){
		G_Activedoz.width=G_Activedoz.width+cpt;
		if(G_Activedoz.width>0)
		G_Activedoz.style.width=G_Activedoz.width;
		}
	else
	G_Activedoz.style.left=parseInt(G_Activedoz.style.left)+cpt;
	break;
		case 36: 
	G_Activedoz.style.left=parseInt(G_Activedoz.style.left)-cpt;
	G_Activedoz.style.top=parseInt(G_Activedoz.style.top)-cpt;
	break;
		case 33: 
	touche="[/>]"
		G_Activedoz.style.left=parseInt(G_Activedoz.style.left)+cpt;
	G_Activedoz.style.top=parseInt(G_Activedoz.style.top)-cpt;
	break;
	
		case 35: 
	touche="[</]"
	G_Activedoz.style.left=parseInt(G_Activedoz.style.left)-cpt;
	G_Activedoz.style.top=parseInt(G_Activedoz.style.top)+cpt;
	break;
		case 34: 
	touche="[\\>]"
	G_Activedoz.style.left=parseInt(G_Activedoz.style.left)+cpt;
	G_Activedoz.style.top=parseInt(G_Activedoz.style.top)+cpt;
	break;
		case 12: 
	touche="[O]"
	break;
	
	
	default:
//G_Activedoz.txtzone.lastChild.innerHTML=G_Activedoz.txtzone.lastChild.firstChild.data+"("+touche+","+ascii+")";
G_Activedoz.txtzone.lastChild.innerHTML=G_Activedoz.txtzone.lastChild.firstChild.data+touche;
}
















}
}

switch(ev.which){
	case 68 : 
	if (MonTableau[16])
	if (!MonTableau[ev.which])
	//makemeadoz(300,200,(G_I*18)+100,(G_I*20)+100); 
	
	
	break; //d

	case 88 :
	if (MonTableau[16]){ //shift X
	if (!MonTableau[ev.which]){
	if (G_Activedoz.oldactdoz){
tmpoldactdoz=G_Activedoz.oldactdoz;
	G_Activedoz.obj.detruire();
//oldactive(tmpoldactdoz);
}
}
}
	break;
	
	case 17 : break; //ctrl
	case 91 : break; //windows	
	
	
	

	*/
	}
}
this.system.mykeyboard.Down(ev.which);

		}
		
		
		
		
		
		
		




}
