 var defaultPosLeft = 0;	// Posición por defecto donde se muestran las ventanas loggin.
 var defaultPosTop = 0;		// Posición por defecto donde se muestran las ventanas loggin.
 
/**
 * showFloatingBox
 * @param {String} boxID
 * @param {String} boxContent. Contenido a mostrar en la caja flotante
 * @param {Event} e
 * @param {int} posX. Desplazamiento horizontal del punto de accion del evento.
 * @param {int} posY. Desplazamiento vertical del punto de accion del evento.
 * @param {int} maxWidth. Máximo tamaño de la caja.
 * @param {int} Ancho de la sombra de la caja. Cero, sin sombra.
 * Description Muestra una caja flotante
 */
 function showFloatingBox(e,boxID,boxContent,posX,posY,maxWidth,shadowSize) {
 	var bodyWidth = Math.max(document.body.clientWidth,document.documentElement.clientWidth) - 20;
 	var box = false;
 	var box_iframe = false;
 	var boxShadow = false;
 	hideFloatingBox(boxID,shadowSize);
	box = document.createElement('DIV');
	box.id = boxID;
	document.body.appendChild(box);
	if (shadowSize>0){
		boxShadow = document.createElement('DIV');
		boxShadow.id = boxID+'Shadow';
		document.body.appendChild(boxShadow);
	}
	if(isMSIEBrowser()){
		box_iframe = document.createElement('IFRAME');
		box_iframe.frameborder='5';
		box_iframe.id=boxID+'_IFRAME';
		box_iframe.style.backgroundColor='#FFFFFF';
		box_iframe.src = '#'; 	
		box_iframe.style.zIndex = 100;
		box_iframe.style.position = 'absolute';
		document.body.appendChild(box_iframe);
	}
	box.style.display='block';
	if (shadowSize>0){
		boxShadow.style.display='block';
	}
	if(isMSIEBrowser()){
		box_iframe.style.display='block';
	}
	var leftPos = getLeftPosition(e) + posX;
	defaultPosLeft=leftPos;
	box.style.width = null;	// Reset style width if it's set 
	box.innerHTML = boxContent;
	box.style.left = leftPos + 'px';
	box.style.top = getTopPosition(e) + posY + 'px';
	defaultPosTop=getTopPosition(e) + posY;
	if (shadowSize>0){
		boxShadow.style.left =  leftPos + shadowSize + 'px';
		boxShadow.style.top = getTopPosition(e) + posY  + shadowSize + 'px';		
	}
	
	if(box.offsetWidth>maxWidth){	/* Exceeding max width of tooltip ? */
		box.style.width = maxWidth + 'px';
	}
	
	var boxWidth = box.offsetWidth;		
	if(boxWidth<10){ /* Por defecto son 10Px de ancho minimo*/
		boxWidth = 10;
	}
		
	box.style.width = boxWidth + 'px';
	if (shadowSize>0){
		boxShadow.style.width = box.offsetWidth + 'px';
		boxShadow.style.height = box.offsetHeight + 'px';		
		
		if((leftPos + boxWidth)>bodyWidth){
			box.style.left = (boxShadow.style.left.replace('px','') - ((leftPos + boxWidth)-bodyWidth)) + 'px';
			boxShadow.style.left = (boxShadow.style.left.replace('px','') - ((leftPos + boxWidth)-bodyWidth) + shadowSize) + 'px';
		}		
	}
	if(isMSIEBrowser()){
		box_iframe.style.left = box.style.left;
		box_iframe.style.top = box.style.top;
		box_iframe.style.width = box.offsetWidth + 'px';
		box_iframe.style.height = box.offsetHeight   + 'px';	
	}
 }
 
 function showDefaultFloatingBox(boxID,boxContent,posX,posY,maxWidth,shadowSize) {
 	var bodyWidth = Math.max(document.body.clientWidth,document.documentElement.clientWidth) - 20;
 	var box = false;
 	var box_iframe = false;
 	var boxShadow = false;
 	hideFloatingBox(boxID,shadowSize);
	box = document.createElement('DIV');
	box.id = boxID;
	document.body.appendChild(box);
	if (shadowSize>0){
		boxShadow = document.createElement('DIV');
		boxShadow.id = boxID+'Shadow';
		document.body.appendChild(boxShadow);
	}
	if(isMSIEBrowser()){
		box_iframe = document.createElement('IFRAME');
		box_iframe.frameborder='5';
		box_iframe.id=boxID+'_IFRAME';
		box_iframe.style.backgroundColor='#FFFFFF';
		box_iframe.src = '#'; 	
		box_iframe.style.zIndex = 100;
		box_iframe.style.position = 'absolute';
		document.body.appendChild(box_iframe);
	}
	box.style.display='block';
	if (shadowSize>0){
		boxShadow.style.display='block';
	}
	if(isMSIEBrowser()){
		box_iframe.style.display='block';
	}
	var leftPos = defaultPosLeft+ posX;
	defaultPosLeft=leftPos;
	box.style.width = null;	// Reset style width if it's set 
	box.innerHTML = boxContent;
	box.style.left = leftPos + 'px';
	box.style.top = defaultPosTop+ posY + 'px';
	defaultPosTop=defaultPosTop + posY;
	if (shadowSize>0){
		boxShadow.style.left =  leftPos + shadowSize + 'px';
		boxShadow.style.top = defaultPosTop+ posY  + shadowSize + 'px';		
	}
	
	if(box.offsetWidth>maxWidth){	/* Exceeding max width of tooltip ? */
		box.style.width = maxWidth + 'px';
	}
	
	var boxWidth = box.offsetWidth;		
	if(boxWidth<10){ /* Por defecto son 10Px de ancho minimo*/
		boxWidth = 10;
	}
		
	box.style.width = boxWidth + 'px';
	if (shadowSize>0){
		boxShadow.style.width = box.offsetWidth + 'px';
		boxShadow.style.height = box.offsetHeight + 'px';		
		
		if((leftPos + boxWidth)>bodyWidth){
			box.style.left = (boxShadow.style.left.replace('px','') - ((leftPos + boxWidth)-bodyWidth)) + 'px';
			boxShadow.style.left = (boxShadow.style.left.replace('px','') - ((leftPos + boxWidth)-bodyWidth) + shadowSize) + 'px';
		}		
	}
	if(isMSIEBrowser()){
		box_iframe.style.left = box.style.left;
		box_iframe.style.top = box.style.top;
		box_iframe.style.width = box.offsetWidth + 'px';
		box_iframe.style.height = box.offsetHeight   + 'px';	
	}
 }
 
 function showFloatingBoxGeneric(boxID,boxContent,x,y,maxWidth,shadowSize) {
 	var bodyWidth = Math.max(document.body.clientWidth,document.documentElement.clientWidth) - 20;
 	var box = false;
 	var box_iframe = false;
 	var boxShadow = false;
 	
 	hideFloatingBox(boxID,shadowSize);
 	
	box = document.createElement('DIV');
	box.id = boxID;
	document.body.appendChild(box);
	if (shadowSize>0){
		boxShadow = document.createElement('DIV');
		boxShadow.id = boxID+'Shadow';
		document.body.appendChild(boxShadow);
	}
	if(isMSIEBrowser()){
		box_iframe = document.createElement('IFRAME');
		box_iframe.frameborder='5';
		box_iframe.id=boxID+'_IFRAME';
		box_iframe.style.backgroundColor='#FFFFFF';
		box_iframe.src = '#'; 	
		box_iframe.style.zIndex = 100;
		box_iframe.style.position = 'absolute';
		document.body.appendChild(box_iframe);
	}
	box.style.display='block';
	if (shadowSize>0){
		boxShadow.style.display='block';
	}
	if(isMSIEBrowser()){
		box_iframe.style.display='block';
	}
	var leftPos =x ;
	box.style.width = null;	// Reset style width if it's set 
	box.innerHTML = boxContent;
	box.style.left = leftPos + 'px';
	box.style.top = y + 'px';
	defaultPosTop=y ;
	defaultPosLeft=leftPos;
	if (shadowSize>0){
		boxShadow.style.left =  leftPos + shadowSize + 'px';
		boxShadow.style.top = y + shadowSize + 'px';		
	}
	
	if(box.offsetWidth>maxWidth){	/* Exceeding max width of tooltip ? */
		box.style.width = maxWidth + 'px';
	}
	
	var boxWidth = box.offsetWidth;		
	if(boxWidth<10){ /* Por defecto son 10Px de ancho minimo*/
		boxWidth = 10;
	}
		
	box.style.width = boxWidth + 'px';
	if (shadowSize>0){
		boxShadow.style.width = box.offsetWidth + 'px';
		boxShadow.style.height = box.offsetHeight + 'px';		
		
		if((leftPos + boxWidth)>bodyWidth){
			box.style.left = (boxShadow.style.left.replace('px','') - ((leftPos + boxWidth)-bodyWidth)) + 'px';
			boxShadow.style.left = (boxShadow.style.left.replace('px','') - ((leftPos + boxWidth)-bodyWidth) + shadowSize) + 'px';
		}		
	}
	if(isMSIEBrowser()){
		box_iframe.style.left = box.style.left;
		box_iframe.style.top = box.style.top;
		box_iframe.style.width = box.offsetWidth + 'px';
		box_iframe.style.height = box.offsetHeight   + 'px';	
	}
 }
/**
 * hideFloatingBox
 * @param {String} boxID
 * @param {int} shadowSize
 * @author fmolina
 * Description Esconde la caja flotante.
 */
 function hideFloatingBox(boxID,shadowSize) {

 	if(document.getElementById(boxID)!=null){ /* Se desactiva una caja previa */
		objBox= document.getElementById(boxID);
		objBox.style.display='none';
		document.body.removeChild(objBox);

		if (shadowSize>0){

			objShadowBox= document.getElementById(boxID+'Shadow');
			objShadowBox.style.display='none';
			document.body.removeChild(objShadowBox);
		}
		if(isMSIEBrowser()){

			objBoxFrame= document.getElementById(boxID+'_IFRAME');
			objBoxFrame.style.display='none';
			document.body.removeChild(objBoxFrame);
		}		
	}
 }