//ayuda_tooltip



function mostrar_ayuda(id_ayuda){
	
	if(document.getElementById(id_ayuda)){
		var obj_enlace=document.getElementById(id_ayuda);	
		addEvent(obj_enlace, 'mouseover', click_mostrar_ayuda);
		addEvent(obj_enlace, 'mouseout', click_ocultar_ayuda);

	}
	
}

function click_mostrar_ayuda(evnt){
	ev = (evnt) ? evnt : event;
    enlace_actual = (ev.target) ? ev.target : ev.srcElement;
	var id_bloque_ayuda='tooltip_'+enlace_actual.id;
	
	
	
	tmp_width=eval(enlace_actual.id).width;
	tmp_top=eval(enlace_actual.id).top;
	tmp_right=eval(enlace_actual.id).right;
	tmp_bottom=eval(enlace_actual.id).bottom;
	tmp_left=eval(enlace_actual.id).left;	
	
	var tmp = new Object();
				tmp.top='0';
				tmp.right='0';
				tmp.bottom='';
				tmp.left='';
				tmp.width='250px';
				
	if(tmp_top=='' && tmp_bottom==''){tmp_top=tmp.top;tmp_bottom=tmp.bottom;}
	if(tmp_right=='' && tmp_left==''){tmp_right=tmp.right;tmp_left=tmp.left;}	
	
	if(document.getElementById(id_bloque_ayuda)){
		var bloque_ayuda=document.getElementById(id_bloque_ayuda);
		
		
		var obj_padre=bloque_ayuda.parentNode
		 while(obj_padre.tagName!='DIV')
		{
			obj_padre=obj_padre.parentNode;
		}
		
		obj_padre.style.position="relative";			
		bloque_ayuda.style.display="block";	
		if(tmp_top!=''){bloque_ayuda.style.top=tmp_top;}		
		if(tmp_right!=''){bloque_ayuda.style.right=tmp_right;}
		if(tmp_bottom!=''){bloque_ayuda.style.bottom=tmp_bottom;}
		if(tmp_left!=''){bloque_ayuda.style.left=tmp_left;}
		if(tmp_width!=''){bloque_ayuda.style.width=tmp_width;}
	}
	
	

}

function click_ocultar_ayuda(evnt){
	ev = (evnt) ? evnt : event;
    enlace_actual = (ev.target) ? ev.target : ev.srcElement;
	var id_bloque_ayuda='tooltip_'+enlace_actual.id;
	
	
	
	if(document.getElementById(id_bloque_ayuda)){
		var bloque_ayuda=document.getElementById(id_bloque_ayuda);		
		bloque_ayuda.style.display="none";		
	}
	
	

}



//Lanzar el evento onload del body

function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}

