	
var clickOui_move=false;
var clickOui_taille=false;

var defdivmove;
var colonne;
var colonne2;

var tableId;

var x_move;
var y_move;
var old_mouse_x = 0;
var old_mouse_y = 0;
var x;// OLD DIV POSITION;
var y;// OLD DIV POSITION;
var zindex=0;
//var table;


function testClick(div) { //pour déplacement des divs bascule déplacement  
	

	defDivMove(div);

	clickOui_move=!clickOui_move;
	//alert(x_move);
	if(clickOui_move){

		old_mouse_x = x_move;
		old_mouse_y = y_move;
	
	}
	
}

function testClick2() { //pour déplacement des divs bascule déplacement  
	

	clickOui_move=!clickOui_move;
	//alert(x_move);
	if(clickOui_move){

		old_mouse_x = x_move;
		old_mouse_y = y_move;
	
	}
	
}


function stop(){
	
	clickOui_move=false;
}

function caseFermer(div){//la case à fermer du div
	defDivMove(div);
	parentNode = defdivmove.parentNode;
	parentNode.removeChild(defdivmove);

}

function get_mouse_move(e){ //positionne div suivant la souris

	x_move = (document.all) ? event.x : e.pageX;
	y_move = (document.all) ? event.y : e.pageY;
	
	if(clickOui_move){	
		leftX = Number(defdivmove.style.left.slice(0,-2)) + (x_move-old_mouse_x);
		topY = Number(defdivmove.style.top.slice(0,-2)) + (y_move-old_mouse_y);
		
		defdivmove.style.left = leftX+'px';
		defdivmove.style.top = topY+'px';
		window.status = 'X='+(Number(defdivmove.style.left.slice(0,-2))+(x_move-old_mouse_x))+' Y='+(Number(defdivmove.style.top.slice(0,-2)) + (y_move-old_mouse_y));
	  
		old_mouse_x = x_move;
		old_mouse_y = y_move;
	
  	}

	if(clickOui_taille){
		//ENTETE	
		cell1 = colonne.parentNode.cells[colonne.cellIndex-1]; //Colonne 1
		cell2 = colonne.parentNode.cells[colonne.cellIndex+1]; //Colonne 2

		tableIdVide = document.getElementById('table_vide');
		
		widthCol1=x_move-old_mouse_x+Number(cell1.style.width.slice(0,-2)); //Taille du resize colonne1
		widthCol2=Number(cell2.style.width.slice(0,-2))-(x_move-old_mouse_x); //Taille du resize colonne2


		//resize col1 + text

		if(widthCol1>2 && widthCol2>2){
			cell1.style.width = widthCol1+'px';
			cell1.childNodes[0].style.width = widthCol1+'px';

			cell2.style.width = widthCol2;
			cell2.childNodes[0].style.width = widthCol2;
		} else {
		
			mouseUpColonne();
		
		}
		
		//Colonnes
		for (i=0; i<tableId.rows.length; i++){

			//Colonne1
			tableId.rows[i].cells[colonne.cellIndex-1].style.width = widthCol1+'px';
			tableId.rows[i].cells[colonne.cellIndex-1].childNodes[0].style.width = widthCol1+'px';
			//colonne2
			tableId.rows[i].cells[colonne.cellIndex+1].style.width = widthCol2+'px';
			tableId.rows[i].cells[colonne.cellIndex+1].childNodes[0].style.width = widthCol2+'px';

		}


			//Colonne1
			tableIdVide.rows[0].cells[colonne.cellIndex-1].style.width = widthCol1+'px';

			//colonne2
			tableIdVide.rows[0].cells[colonne.cellIndex+1].style.width = widthCol2+'px';


		
		old_mouse_x = x_move;

	}


	
}
	
document.onmousemove = get_mouse_move;

		
function defDivMove(gdiv){ //définie un div suivant le navigateur
		
	defdivmove = document.getElementById(gdiv);
//	defdivmove2 = document.getElementById(gdiv2);

	
	
	if(defdivmove) 
		return true;
	else
		return false;
				
}

//CHANGER TAILLE DES COLONNES
function mouseDownColonne(obj, strTable) { //pour déplacement des divs bascule déplacement  
	
	colonne = obj;

	tableId = document.getElementById(strTable);
	//table = document.getElementById(oTable);
	clickOui_taille=!clickOui_taille;
	//alert(x_move);
	if(clickOui_taille){

		old_mouse_x = x_move;
		old_mouse_y = y_move;
	
	}
	
}


function mouseUpColonne(){
	
	clickOui_taille=false;
}



//CENTER A WINDOW
function Xcenter(obj){

	document.getElementById(obj).style.left = (document.body.clientWidth/2) - (parseInt(document.getElementById(obj).offsetWidth)/2) + 'px';
}

function Ycenter(obj){
	document.getElementById(obj).style.top = (document.body.clientHeight/2) - (parseInt(document.getElementById(obj).offsetHeight)/2) + 'px';
}

function centerWindow(obj){

	Xcenter(obj);
	Ycenter(obj);

}


