// JavaScript Document
// Funciones javascript para el calendario de CICE
// Víctor J. Chamorro. Ipdea.com

window.document.write('<script language="javascript" type="text/javascript" src="../js/XHConn.js"></script>');

var timeout;
//____________________________________________________________________________________

function CargarCalendario(mes, anio){
	
	if (typeof(grande) == "string"){
		page('cal-big', '../../includes/calendario.php', 'mes='+mes+'&anio='+anio, '<br />&nbsp;<br />&nbsp;<br /><br /><br /><br /><br /><br /><p style="text-align:center"><img style="text-align:center" src="../img/calendar/loading.gif" /></p>');
	}else{
		page('cal', '../../includes/calendario.php', 'mes='+mes+'&anio='+anio, '<br /><br /><p style="text-align:center"><img style="text-align:center" src="../img/calendar/loading.gif" /></p>');
	}
	
}
//____________________________________________________________________________________

function CreaCapaToolTip(datos, obj){
	
	x = GetLeftPos(obj) + obj.offsetWidth;
	y = GetTopPos(obj);
	
	document.getElementById('bocadillo').style.top = y+20+"px";
	document.getElementById('bocadillo').style.left = x+"px";	
	document.getElementById('texto-capa').innerHTML = datos;
	document.getElementById('bocadillo').style.display='block';
	
	ConservaCapaToolTip();
}
//____________________________________________________________________________________

function OcultaCapaToolTip(){
	
	clearTimeout(timeout);
	timeout = setTimeout(	function(timeout){ 
								  document.getElementById('bocadillo').style.display='none'; 
								  clearTimeout(timeout); 
							}, 1000);
	
}
//____________________________________________________________________________________

function ConservaCapaToolTip(){
	
	clearTimeout(timeout);
	timeout = setTimeout("OcultaCapaToolTip();", 3000);
	
}
//____________________________________________________________________________________

function GetTopPos(Obj){
	
	var returnValue = Obj.offsetTop;
	if (typeof(grande) == "string"){
		while((Obj = Obj.offsetParent) != null){
			if(Obj.tagName!='HTML') returnValue += Obj.offsetTop;
		}
	}
	return returnValue;
	
}
//____________________________________________________________________________________

function GetLeftPos(Obj){
	
	var returnValue = Obj.offsetLeft;
	if (typeof(grande) == "string"){
		while((Obj = Obj.offsetParent) != null){
			if(Obj.tagName!='HTML') returnValue += Obj.offsetLeft;
		}
	}
	return returnValue;
	
}
