


/*  -------------------------------------    BALLON POPUP    ------------------------------------------  */
/*   AJOUTER A LA BALISE BODY :      <BODY ONMOUSEMOVE="MOVEALLACTION(EVENT);" ONMOUSEUP="LEAVEALLACTION();">  */
/* -------------------------------------------------------------------------------------------------------- */
document.write ('<div id="BALLON" style="margin-top:20px; background:#FFFF9B; display:none; position:absolute; z-Index:10000; "></div>');


function BALLON(largeur,hauteur,scroll,calque,include,e)
	{ positionY = e.clientY;
		var parent_largeur=document.body.clientWidth; // RECUPERE LA LARGEUR DU TABLEAU SUR LEQUEL ON S'ALIGNE , LE TABLEAU DOIT AVOIT L'ID='TABLE'
		var parent_hauteur=document.body.scrollTop+positionY; // RECUPERE LA LARGEUR DU TABLEAU SUR LEQUEL ON S'ALIGNE , LE TABLEAU DOIT AVOIT L'ID='TABLE'
			var lcenter=(parent_largeur*0.5)-(largeur*0.5);
			var hcenter=350;				
			styleleft=lcenter;
			styletop=hcenter;
		positionne('BALLON', styleleft, styletop, hauteur, largeur);
		isClicked = false;
		var calque=document.getElementById(calque);	
		calque.style.display=calque.style.display=="none"?"block":"none";  // AFFICHAGE OU MASQUAGE DU DIV CALQUE 

	// AFFICHAGE DU CONTENU DU DIV CALQUE 																																																																																															<IFRAME src="'+include+'" width="'+largeur+'px" height="'+hauteur+'px" scrolling="'+scroll+'" FRAMEBORDER="0"></IFRAME>
calque.innerHTML='<table width="'+largeur+'px" height="'+hauteur+'px" cellpadding="0px" cellspacing="1px"><tr><td align="right" height="22px" colspan="3"><span class="rose" onclick="CBALLON(\'BALLON\');" style="cursor:url(charte/VistaRC1Cursor06.cur), hand">FERMER LA FENETRE <img src="charte/mars00171.gif" width="16px" height="16px" border="0" align="top"> &nbsp;&nbsp;</span></td></tr><tr><td>&nbsp;</td><td align="center"> <IFRAME id="FBALLON" src="'+include+'" width="'+largeur+'px" height="'+hauteur+'px" scrolling="'+scroll+'" FRAMEBORDER="0"></IFRAME> </td><td>&nbsp;</td></tr><tr><td height="5px" colspan="3"></td></tr></table>';
	return false;
	}
function CBALLON(calque)
	{ //  MASQUAGE DU DIV CALQUE
	document.getElementById(calque).style.display=document.getElementById(calque).style.display=="none"?"block":"none";
	}	
function PARENTCBALLON(calque)
	{ //  MASQUAGE DU DIV CALQUE DEPUIS L'IFRAME
	parent.document.getElementById(calque).style.display=parent.document.getElementById(calque).style.display=="none"?"block":"none";
	}	
/* ----------------------------------------------------------------------------------------------------------------------------- */
	


		
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------   DRAGDROP    ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	
var isClicked = false;
var objectToDrag = 0;
var ecartX;
var ecartY;
var curX;
var curY;
var initialHeight;
var initialWidth;
var initialCurX;
var initialCurY;
var theAction;
var minWidth = 40;
var minHeight = 40;
var thePadding = 15;

var _MOVE_ 		= 0;
var _RESIZE_N_ 	= 1;
var _RESIZE_S_ 	= 2;
var _RESIZE_W_ 	= 3;
var _RESIZE_E_ 	= 4;
var _RESIZE_NW_ = 5;
var _RESIZE_NE_ = 6;
var _RESIZE_SW_ = 7;
var _RESIZE_SE_ = 8;

function positionne(p_id, p_posX, p_pos_Y ){
	//	,p_pos_H,p_pos_W
	document.getElementById(p_id).style.left = p_posX;
	document.getElementById(p_id).style.top = p_pos_Y;
	//     document.getElementById(p_id).style.height = p_pos_H;
	//     document.getElementById(p_id).style.width = p_pos_W;
	document.getElementById(p_id).style.zIndex = 10000000;
}
function getPositionCurseur(e){
	//ie
	if(document.all){
		curX = event.clientX;
		curY = event.clientY;
	}
	//netscape 4
	if(document.layers){
		curX = e.pageX;
		curY = e.pageY;
	}
	//mozilla
	if(document.getElementById){
		curX = e.clientX;
		curY = e.clientY;
	}
}
function downAction(p_obj,e){
	isClicked = true;
	objectToDrag = p_obj;
	getPositionCurseur(e);
	ecartX = curX - parseInt(objectToDrag.style.left);
	ecartY = curY - parseInt(objectToDrag.style.top);
	objectToDrag.style.zIndex = 10000000;
	
	initialWidth = objectToDrag.offsetWidth;
	initialHeight = objectToDrag.offsetHeight;
	initialCurX = curX;
	initialCurY = curY;
	theAction = modifCurseur(p_obj, e);
}
function moveAction(p_obj,e){
	if(isClicked == false){
		modifCurseur(p_obj, e);
	}
   }
function moveAllAction(e){
	var newPosX;
	var newPosY;

	if(isClicked == true){
		getPositionCurseur(e);		
		switch (theAction){
			case _MOVE_ :
				newPosX = curX - ecartX;
				newPosY = curY - ecartY;
				objectToDrag.style.left = newPosX + 'px';
				objectToDrag.style.top = newPosY + 'px';
				break;
		
		/*            resize desactivé            
			case _RESIZE_N_ :
				resizeByTop(curY);
				break;
			case _RESIZE_S_ :
				resizeByBottom(curY);
				break;
			case _RESIZE_W_ :
				resizeByLeft(curX);
				break;
			case _RESIZE_E_ :
				resizeByRight(curX);
				break;
			case _RESIZE_NW_ :
				resizeByTop(curY);
				resizeByLeft(curX);
				break;
			case _RESIZE_NE_ :
				resizeByTop(curY);
				resizeByRight(curX);
				break;
			case _RESIZE_SW_ :
				resizeByBottom(curY);
				resizeByLeft(curX);
				break;
			case _RESIZE_SE_ :
				resizeByBottom(curY);
				resizeByRight(curX);
				break;
		 */
		}
	}
}
function leaveAction(p_obj){
	if(p_obj == objectToDrag){
		isClicked = false;
		p_obj.style.zIndex = 10000000;
	}
}
function leaveAllAction(){
	if (isClicked) {
		isClicked = false;
		objectToDrag.style.zIndex = 10000000;
	}
}
function modifCurseur(p_obj, e){
	getPositionCurseur(e);
	
/*  resize desactivé      	

	// haut gauche
	if(((curY - parseInt(p_obj.style.top)) < thePadding) &&
		((curX - parseInt(p_obj.style.left)) < thePadding )){
			p_obj.style.cursor = 'nw-resize';
			return _RESIZE_NW_;
		}
	
	// haut droit
	if(((curY - parseInt(p_obj.style.top)) < thePadding) &&
		(((parseInt(p_obj.style.left) +  p_obj.offsetWidth) - curX) < thePadding)){
			p_obj.style.cursor = 'ne-resize';
			return _RESIZE_NE_;
		}
		
	// bas gauche
	if((((parseInt(p_obj.style.top) +  p_obj.offsetHeight) - curY) < thePadding) &&
		((curX - parseInt(p_obj.style.left)) < thePadding )){
			p_obj.style.cursor = 'sw-resize';
			return _RESIZE_SW_;
		}
		
	// bas droit
	if((((parseInt(p_obj.style.top) +  p_obj.offsetHeight) - curY) < thePadding) &&
		(((parseInt(p_obj.style.left) +  p_obj.offsetWidth) - curX) < thePadding)){
			p_obj.style.cursor = 'se-resize';
			return _RESIZE_SE_;
		}
		
	// cote gauche
	if((curX - parseInt(p_obj.style.left)) < thePadding ){
			p_obj.style.cursor = 'w-resize';
			return _RESIZE_W_;
		}
		
	// cote droit
	if(((parseInt(p_obj.style.left) +  p_obj.offsetWidth) - curX) < thePadding){
			p_obj.style.cursor = 'e-resize';
			return _RESIZE_E_;
		}
		
	// haut
	if((curY - parseInt(p_obj.style.top)) < thePadding){
			p_obj.style.cursor = 'n-resize';
			return _RESIZE_N_;
		}
		
	// bas
	if(((parseInt(p_obj.style.top) +  p_obj.offsetHeight) - curY) < thePadding){
			p_obj.style.cursor = 's-resize';
			return _RESIZE_S_;
		}
	*/
	p_obj.style.cursor = 'move';
	return _MOVE_;
}


/*  resize desactivé      	

function resizeByTop(p_curY){
	var newPosY;
	var newHeight;
	newHeight = (initialHeight + (initialCurY - p_curY));
	if(newHeight > minHeight){
		newPosY = p_curY - ecartY;
		objectToDrag.style.top = newPosY + 'px';
		objectToDrag.style.height = newHeight + 'px';
	}
}
function resizeByBottom(p_curY){
	var newHeight;
	newHeight = (initialHeight - (initialCurY - p_curY));
	if(newHeight > minHeight)
		objectToDrag.style.height = newHeight + 'px';
}
function resizeByLeft(p_curX){
	var newPosX;
	var newWidth;
	newWidth = (initialWidth + (initialCurX - p_curX));
	if(newWidth > minWidth){
		newPosX = p_curX - ecartX;
		objectToDrag.style.left = newPosX + 'px';
		objectToDrag.style.width = newWidth + 'px';
	}
}
function resizeByRight(p_curX){
	var newWidth;
	newWidth = (initialWidth - (initialCurX - p_curX));
	if(newWidth > minWidth)
		objectToDrag.style.width = newWidth + 'px';
}	

*/


