	//----------------------------------------------------------		
function Mouse(system){

	var X;
	var Y;
	var nodeUnder;
	var button;
	var launch;
this.launch=false;

this.system=system;

this.runService=function(){

	this.launch=true;

	}
	
this.stopService=function(){

	this.launch=false;
	}	
	// souris deplacé
/*document.onmousemove=function (ev){
	
	if(this.system.mymouse.launch){
	if(ev){
		this.system.ev=ev;

		}
	else{
		this.system.ev=window.event;

		}
	this.system.mymouse.actionmouseMove();
	}

}

// bouton souris doble click;
document.ondblclick= function (ev){

		if(this.system.mymouse.launch){
	if(ev){
		this.system.ev=ev;

		}
	else{
	
		this.system.ev=window.event;

		}
this.system.mymouse.actionDblclick();	
}

}
document.oncontextmenu=function (ev){ // Place le sommaire et l'affiche à l'écran

	if(this.system.mymouse.launch){
		
	if(ev){
		this.system.ev=ev;

		}
	else{
		this.system.ev=window.event;

		}
 return false;}
}

// bouton souris relaché
document.onmouseup=function (ev){
		if(this.system.mymouse.launch){
	if(ev){
		this.system.ev=ev;

		}
	else{
		this.system.ev=window.event;

		}
	this.system.mymouse.actionmouseUp();
	this.system.mymouse.Up(ev.which);	
		}
}

// bouton souris enfoncé
document.onmousedown= function (ev){

	//	alert(window.event.button);
			if(system.mymouse.launch){
		if(ev){
		this.system.ev=ev;

		}
	else{
		this.system.ev=window.event;

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

		
	//***************************************************
	//CONSTRUCTEUR
	this.button= new Array(false,false,false);
	//***************************************************

	
	//***************************************************
	//bouton enfoncé
	this.Down =function (_num){
		this.button[_num]= true;
		}
	//***************************************************
	
	
	//***************************************************
	//bouton relaché
	this.Up =function (_num){
		this.button[_num]= false;
			
		}
		
	//***************************************************
	// bouton est il enfoncé  ?
	this.isDown =function (_num){

		return this.button[_num]== true;
		}
		

//****************DOWN***********************************
//****************DOWN***********************************	

	this.actionDown=function (){
		if( this.system.ev.which==3){
			if(this.system.actionObjet){
	
				this.system.actionObjet.makeaction();
	
			}
			}else{
		if( this.nodeUnder.base &&  this.nodeUnder.base.obj && this.nodeUnder.base.obj.Kdos)
			this.nodeUnder.base.obj.makeaction();
			}
	}

	
	
//****************UP***********************************
//****************UP***********************************
	
	
		this.actionmouseUp=function (){
			
				if( this.system.ev.which==3){
			if(this.system.actionObjet){
	
				this.system.actionObjet.makeaction();
			
			}
			}else{
			if( this.nodeUnder.base &&  this.nodeUnder.base.obj && this.nodeUnder.base.obj.Kdos)
				this.nodeUnder.base.obj.makeaction();
			else
			if(this.system.actionObjet)
				this.system.actionObjet=null;
			}
	}
		
	
	
	//****************DBLCLICK***********************************
//****************DBLCLICK***********************************
	this.actionDblclick=function (){

			if( this.nodeUnder.base &&  this.nodeUnder.base.obj && this.nodeUnder.base.obj.Kdos)
			this.nodeUnder.base.obj.makeaction();


	}

	//-----------------------------------------------------------------------
	
		

		
//****************MOVE***********************************
//****************MOVE***********************************
		
this.actionmouseMove=function (){	

	this.nodeUnder=this.system.ev.target;
	
	this.X=	this.system.ev.clientX;
	this.Y=	this.system.ev.clientY;	

/*	if( this.nodeUnder.base &&  this.nodeUnder.base.obj && this.nodeUnder.base.obj.Kdos)
			this.nodeUnder.base.obj.makeaction(ev);
*/
	if(this.system.actionObjet){
			
			this.system.actionObjet.makeaction();
			
			}

		}
		
	}
	
	//----------------------------------------------------------		
