//============
//  TEventos
//============

TEventos.prototype._Evento = null;


TEventos.prototype.Cancelar = function ()
{
	if (window.event) this._Evento.returnValue = false;
	else this._Evento.preventDefault ();
}


TEventos.prototype.Detener = function ()
{
	if (window.event) this._Evento.cancelBubble = true;
	else this._Evento.stopPropagation ();
}


TEventos.prototype.Origen = function ()
{
	if (this._Evento.srcElement) return (this._Evento.srcElement);
	return (this._Evento.currentTarget);
}


TEventos.prototype.PosX = function ()
{
	if (this._Evento.pageX) return this._Evento.pageX;
	return this._Evento.clientX;
}


TEventos.prototype.PosY = function ()
{
	if (this._Evento.pageY) return this._Evento.pageY;	// FireFox
	return this._Evento.clientY + Math.max(document.body.scrollTop, document.documentElement.scrollTop);
}


function TEventos (Evento)
{
	if (window.event) this._Evento = window.event;
	else this._Evento = Evento;
}


function TEvento ()
{
	if (window.event) return (new TEventos (null));
	return (new TEventos (this.TEvento.caller.arguments [0]));
}	


//=============
//  Funciones


function addEvento (oElemento, sEvento, oFuncion)
{
	if (oElemento.addEventListener)	oElemento.addEventListener (sEvento, oFuncion, false);
	else if (oElemento.attachEvent) oElemento.attachEvent ('on' + sEvento, oFuncion);
}


function SinImagen (event, sImagen)
{
	var oImg = TEvento ().Origen ();
	if (typeof (sImagen) != 'string') alert ('SinImagen: tiene que indicar una imagén.');
	if (oImg && oImg.src && oImg.src.substr (oImg.src.length - sImagen.length) != sImagen) oImg.src = sImagen;
}

function experttaSIS( aURL, aWinName, aRuta )
{
var wOpen;
var sOptions;

sOptions = 'directories=yes,status=no,toolbar=no,menubar=no,scrollbars=yes';
sOptions = sOptions + ',resizable=yes,location=no,maximize=yes';
sOptions = sOptions + ',width=' + (screen.availWidth - 12).toString();
sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';

wOpen = window.open( '', aWinName, sOptions );
wOpen.location = aURL;
wOpen.focus();
wOpen.moveTo( 0, 0 );
wOpen.resizeTo( screen.availWidth, screen.availHeight );
return wOpen;
}

//==============================================================
//==============================================================






