function the4man() {
	/*
		Funciones de the4man
	*/
	this.Version =  '1.0.0'
 	this.tooltip = ''
	this.showToolTip = function() {
		this.tooltip = new ToolTips();
		this.tooltip.Iniciar();
		/* this.tooltip.start(); */
	}
	this.attachLoadEvent = function( funcion ) {
		if(typeof window.addEventListener != 'undefined') {
			//.. gecko, safari, konqueror and standard
			window.addEventListener('load', funcion , false);
		}else if(typeof document.addEventListener != 'undefined') {
			//.. opera 7
			document.addEventListener('load', funcion , false);
		} else if(typeof window.attachEvent != 'undefined') {
			//.. win/ie
			window.attachEvent('onload', funcion );
		}
	}
}
/*
Clase para determinar la posicion del cursor
*/
function Posicion() {
	this.Version = '1.0.0'
	this.getX = function( e ) {
		var posx ;
		if(e==null) {
			e=window.event;
		}
		if(e.pageX || e.pageY){
			posx=e.pageX - window.pageXOffset ;
		} else if ( e.clientX || e.clientY ) {
			posx=e.clientX;
		}
		if (document.documentElement.scrollTop) { } else {
			posx=posx +  document.body.scrollLeft;
		}
		return posx ;

	}

	this.getY = function( e ){
		var posy ;
		if(e==null) { e=window.event; 	}
		if(e.pageX || e.pageY){
		  	posy=e.pageY;

		}else if(e.clientX || e.clientY){

		    if(document.documentElement.scrollTop){
			posy=e.clientY+document.documentElement.scrollTop;
			}
		    else{
			posy=e.clientY+document.body.scrollTop;
			}
		    }
		return posy ;
	}
	this.findPosX = function(obj) {
		var curleft = 0;
		if (obj.offsetParent) {
			while (obj.offsetParent) {
				curleft += obj.offsetLeft
				obj = obj.offsetParent;
			}
		}
		else if (obj.x) {
			curleft += obj.x;
		}
		return curleft;
	}
	this.findPosY = function(obj) 	{
		var curtop = 0;
		if (obj.offsetParent){
			while (obj.offsetParent) {
				curtop += obj.offsetTop
				obj = obj.offsetParent;
			}
		}
		else if (obj.y) {
			curtop += obj.y;
		}
		return curtop;
	}

}

function ToolTips() {
	this.Version = '1.0.1'
	this.posicion = ''

	this.createTooltip = function(el, titulo ) {
		var tooltip, s, b ;
		var htmlTooltip ;
		htmlTooltip = '<span class="tooltip" style="display:block;"><span class="top"  style="display:block;margin-right: 2px; margin-left: 2px;">' ;
		htmlTooltip += titulo ;
		htmlTooltip += '</span>' ;
		htmlTooltip += '<b class="bottom" id="bToolTip" style="display:block;"></b>' ;
		htmlTooltip +='</span>';
		if (el.name=='a'){
			el.removeAttribute("title");
			l=el.getAttribute("href");
			if(l.length>30) l=l.substr(0,27)+"...";
				b.appendChild(document.createTextNode(l));
			}else{
				el.title="";
			}
			el.onmouseover = function(e) {
				document.getElementById("btc").innerHTML =  '<div id="iframetooltip" style="z-index: -1; position: absolute; " width="150" height="300" frameborder="0" src=""></div>' ;
				iFrame = document.getElementById( 'iframetooltip' );
				iFrame.style.filter="alpha(opacity:0)";
				iFrame.style.KHTMLOpacity="0";
				iFrame.style.MozOpacity="0";
				iFrame.style.opacity="0";

				document.getElementById("btc").innerHTML += htmlTooltip ;
				el.Locate(e);
			} ;
			el.onmouseout = function( e ) {
				var d=document.getElementById("btc");
				d.innerHTML = '';
			} ;
			el.posicion = new Posicion( ) ;

			el.Locate = function( e ) {
				var posx=0,posy=0;
				var altoFrame = 300 ;
				posx = el.posicion.getX( e );
				posy = el.posicion.getY( e );
				if (  document.body.clientWidth  <  ( posx + 150 )) {
					posx = posx - 150 ;
				}

				document.getElementById("btc").style.top=(posy+10)+"px";
				document.getElementById("btc").style.left=(posx-20)+"px";
				altoFrame =  el.posicion.findPosY( document.getElementById( 'bToolTip' ))  -  el.posicion.findPosY( document.getElementById( 'iframetooltip' ))  ;
				document.getElementById( 'iframetooltip' ).height = altoFrame + 20;
			};
	}
	this.Iniciar = function(  ) {
		this.posicion = new Posicion()  ;
		var links,i,h;
		if(!document.getElementById || !document.getElementsByTagName) return;
		if(document.getElementById("btc"))$("#btc").remove();
	    h=document.createElement("span");
	    h.id="btc";
	    h.setAttribute("id","btc");
	    h.style.position="absolute";
	    document.body.appendChild(h);
	    this.BuscarElementosyPreparar();
	}

	this.BuscarElementosyPreparar = function () {
		var elementos = ['a','abbr','acronym','img','tr','input','textarea'];
		for (var i=0; i<elementos.length; i++ ) {
			links=document.body.getElementsByTagName(elementos[i]);
			if (links.length>0) {
				for(var j=0;j<links.length;j++){
					this.Prepare(links[j]);
				}
			}
		}
	}
	this.Prepare = function(el) {
		var tooltip,t,b,s,l;
		t=el.getAttribute("title");
		if (!t) t = '';
		max=el.getAttribute("maxlength");
		if (max && max<2000) t = t + ((max)?" (Max: " + max + " caracteres)":"")
		if(t!=null  && t.length>0){
			this.createTooltip( el, t);
		}
	}
	this.setOpacity = function(el) {
		el.style.filter="alpha(opacity:95)";
		el.style.KHTMLOpacity="0.95";
		el.style.MozOpacity="0.95";
		el.style.opacity="0.95";
	}
	this.CreateEl =function(t,c) {
		var x=document.createElement(t);
		x.className=c;
		x.style.display="block";
		return(x);
	}
	this.AddCss = function() {
		return ;
	}
}
var _the4man = new the4man();
_the4man.attachLoadEvent(  _the4man.showToolTip  ) ;
