<!--
// *********************************************
//
// Nombre	: sgElementoFlotante.js
// Autor	: Oscar Salazar Romero
// Fecha	: 02/12/2007
//
//	Librería con funciones para un elemento flotante.
//
// *********************************************
// All JavaScripts contained herein are
// Copyright since 2001 MejorAmor.com All rights reserved.
// Commercial distribution or modification prohibited without express written permission.

/* Variables globales que el usuario utiliza para configurar el elemento */
var gint_fnElementoFlotante_Mostrando = 0;
var gstr_fnElementoFlotante_ElementoID = ""; //Cadena para instrucciones que necesitas un STR
var gobj_fnElementoFlotante_ElementoID = null; //Apuntador para instrucciones que necesitan OBJETO
var gint_fnElementoFlotante_ReferenciaX = 0;

function int_fnElementoFlotante_MedidaClienteX()
{
	var intMedidaReturn;
	
	if (document.layers)
	{
		intMedidaReturn = window.innerWidth;
	}
	else if (document.all)
	{
		intMedidaReturn = document.body.clientWidth;
	}
	else if (document.getElementById&&!document.all)
	{
		intMedidaReturn = window.innerWidth;
	}
	else
	{
		//Por defecto intentaremos usar la función general width de JavaScript
		intMedidaReturn = screen.availWidth;
	}
	
	return intMedidaReturn;
}

function int_fnElementoFlotante_MedidaClienteY()
{
	var intMedidaReturn;
	
	if (document.layers)
	{
		intMedidaReturn = window.innerHeight;
	}
	else if (document.all)
	{
		intMedidaReturn = document.body.clientHeight;
	}
	else if (document.getElementById&&!document.all)
	{
		intMedidaReturn = window.innerHeight;
	}
	else
	{
		//Por defecto intentaremos usar la función general width de JavaScript
		intMedidaReturn = screen.availHeight;
	}
	
	return intMedidaReturn;
}

function fnElementoFlotante(intAccion)
{
	var strVisible = "";
	var intScreenWidth = 0;
	
	if (intAccion == 2)
	{
		//Mostrar Elemento flotante
		strVisible = "visible";
		gintElementoFlotanteAbierto = 1;
	}
	else
	{
		//Ocultar Elemento flotante
		strVisible = "hidden";
		gintElementoFlotanteAbierto = 0;
	}
	document.getElementById(gstr_fnElementoFlotante_ElementoID).style.visibility = strVisible;
}

function fnElementoFlotante_ActualizarPosicionX()
{
	var intScreenWidth = 0;
	
	intScreenWidth = int_fnElementoFlotante_MedidaClienteX();
	intLeftPosition = (intScreenWidth / 2)
		
	if (intLeftPosition > gint_fnElementoFlotante_ReferenciaX)
	{
		intLeftPosition = intLeftPosition - gint_fnElementoFlotante_ReferenciaX;
	}
		
	if (gintElementoFlotanteAbierto == 1)
	{
		fnElementoFlotante_AsignarPosicionX(intLeftPosition);
		
		//document.getElementById(gstr_fnElementoFlotante_ElementoID).style.left = intLeftPosition;
		setTimeout('fnElementoFlotante_ActualizarPosicionX()', 20);
	}
}

function fnElementoFlotante_AsignarPosicionX(intPosicionX)
{
	if (document.layers)
	{
		document.gobj_fnElementoFlotante_ElementoID.pageX = intPosicionX;
	}
	else if (document.all)
	{
		gobj_fnElementoFlotante_ElementoID.style.left = intPosicionX;
	}
	else if (document.getElementById&&!document.all)
	{
		document.getElementById(gstr_fnElementoFlotante_ElementoID).style.left = intPosicionX;		
	}
}

//-->