function showage(event,valu)
{
	//determina un margen de pixels del div al raton
	margin=5;

	//La variable IE determina si estamos utilizando IE
	var IE = document.all?true:false;
	//Si no utilizamos IE capturamos el evento del mouse
	if (!IE) document.captureEvents(Event.MOUSEMOVE)

	var tempX = 0;
	var tempY = 0;

	if(IE)
	{ //para IE
		tempX = event.clientX + document.body.scrollLeft;
		tempY = event.clientY + document.body.scrollTop;
	}else{ //para netscape
		tempX = event.pageX;
		tempY = event.pageY;
	}
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;}
	//modificamos el valor del id "posicion" para indicar la posicion del mouse
	//document.getElementById('posicion').innerHTML="PosX = "+tempX+" | PosY = "+tempY+"<br> Value = "+valu;
	if(valu.substr(9)==12)
	{
		rrz=ag[valu.substr(0,9)]
		rui=rrz.split("+")
		rrz=""
		for (i=0;i<rui.length; i++) rrz=rrz+rui[i]+"<br>"
		document.getElementById('posicion').innerHTML=rrz
	}
	if(valu.substr(9)==13)
	{
		rrz=rz[valu.substr(0,9)]
		rui=rrz.split("+")
		rrz=""
		for (i=0;i<rui.length; i++) rrz=rrz+rui[i]+"<br>"
		document.getElementById('posicion').innerHTML=rrz
	}
	if(valu.substr(9)==14)
	{
		rrz=cr[valu.substr(0,9)]
		rui=rrz.split("+")
		rrz=""
		for (i=0;i<rui.length; i++) rrz=rrz+rui[i]+"<br>"
		document.getElementById('posicion').innerHTML=rrz
	}
	document.getElementById('flotante').style.top = (tempY+margin);
	document.getElementById('flotante').style.left = (tempX+margin);
	document.getElementById('flotante').style.display='block';
	return;
}
function showdiv(event,valu)
{
	//determina un margen de pixels del div al raton
	margin=5;

	//La variable IE determina si estamos utilizando IE
	var IE = document.all?true:false;
	//Si no utilizamos IE capturamos el evento del mouse
	if (!IE) document.captureEvents(Event.MOUSEMOVE)

	var tempX = 0;
	var tempY = 0;

	if(IE)
	{ //para IE
		tempX = event.clientX + document.body.scrollLeft;
		tempY = event.clientY + document.body.scrollTop;
	}else{ //para netscape
		tempX = event.pageX;
		tempY = event.pageY;
	}
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;}
	//modificamos el valor del id "posicion" para indicar la posicion del mouse
	//document.getElementById('posicion').innerHTML="PosX = "+tempX+" | PosY = "+tempY+"<br> Value = "+valu;
	document.getElementById('posicion').innerHTML=pac[valu]

	document.getElementById('flotante').style.top = (tempY+margin);
	document.getElementById('flotante').style.left = (tempX+margin);
	document.getElementById('flotante').style.display='block';
	return;
}
function recov(param)
{
	var flo="S"+param.name
	//alert(flo)
	ecog=""
	eva=""
	prof=document.getElementById(flo)
	if (prof.value=="") alert("DEBE ASIGNAR\rUN PROFESIONAL") 
	else
	{
		if(param.value =="A")
		{
			inne="AR"
			rg=12
			bgC="#4ED1F7"
		}
		if(param.value =="V")
		{
			inne="VR"
			rg=13
			var fl1 =document.getElementById(flo+12).innerHTML
			if(fl1.indexOf("AR")== -1)
			{
				 alert("DEBE AGENDAR PRIMERO") 
				return
			}
			pp=param.name
			pp=pp.substr(0,7)
			alert(pp)
			if(xy[pp]=="02" || xy[pp]=="01")
			{
				ecog = prompt("Introduzca ECOG","");
				eva = prompt("Introduzca EVA","");
			}
			bgC="#FCA8E3"
		}
		if(param.value =="C")
		{
			inne="CR"
			rg=14
			var fl1 =document.getElementById(flo+13).innerHTML
			if(fl1.indexOf("VR")== -1)
			{
				alert("VISITA NO CONFIRMADA") 
				return
			}
			bgC="#B0FC8E"
		}
		if(param.value =="T") return
		if(!confirm("Confirma ??")) return
		fld=param.name + "+" + prof.value + "+" + param.value
		var flo="P"+param.name
		fl0=flo+9
		var fl1 =document.getElementById(fl0).innerHTML
		//alert(fl1)
		var res=fl1.split("&")
		fl1=res[1]
		fld=fld+"+"+fl1.substr(5)
		fl0=flo+10
		var fl1=document.getElementById(fl0).innerHTML
		//alert(10+ "--"+fl1)
		var res=fl1.split("&")
		fl1=res[1]
		fld=fld+"+"+fl1.substr(5)+"+"+ecog+"+"+eva
		vari="../cgi-bin/agenda.cgi?"+fld
		//alert(fld)
		parm="width=1,height=1,top=0,left=0,menubar=no,titlebar=no,scrollbars=no,resizable=no,mimimizable=no,dialog=no"
		var obj_calwindow = window.open(vari,"",parm)
		param.style.display="none"
		var flo="S"+param.name.substr(0,9)
		fl0=flo+rg
		var fl1 =document.getElementById(fl0)
		fl1.innerHTML="<p align=\"center\"><font size=\"3\" face=\"Arial\">&nbsp;"+inne+"&nbsp;</font></p>"
		fl1.style.backgroundColor=bgC
	}
}
lar=document.anlsform.elements.length
for (i=3;i<lar;i+=6)
	{
		fl1=document.anlsform.elements[i]
		ss=ag[fl1.name]
		if(ag[fl1.name])
		{
			//if( i< 40) alert("fl="+ fl1.name+ " ag="+ss+ " i=" +i)
			s1=ss.split("+")
			fl1.style.display="none"
			fl0=document.anlsform.elements[i-1]
			fl0.value=s1[2]
		}
		fl1=document.anlsform.elements[i+1]
		if(rz[fl1.name])
		{
			//if( i< 40) alert("fl="+ fl1.name+ " ag="+ss+ " i=" +i)
			fl1.style.display="none"
			//alert("RZ" +i)
			fl0=document.anlsform.elements[i-1]
			//fl0.value=s1[2]
		}
		fl1=document.anlsform.elements[i+2]
		if(cr[fl1.name])
		{
			//if( i< 40) alert("fl="+ fl1.name+ " ag="+ss+ " i=" +i)
			fl1.style.display="none"
			//alert("CR" +i)
			fl0=document.anlsform.elements[i-1]
			//fl0.value=s1[2]
		}
		fl0=document.anlsform.elements[i-1]
		if(pr[fl1.name.substr(0,7)])
		fl0.value=pr[fl1.name.substr(0,7)]
	}
for (i in ag)
{
	fl0="S"+i+12
	//alert("fl0="+ fl0)
	fl2=document.getElementById(fl0)
	if(fl2!=null)
	{
		fl2.innerHTML="<p onmouseover=\"showage(event,\'"+i+12+"\');\" onmousemove=\"showage(event,\'"+i+12+"\');\" onmouseout=\"javascript:document.getElementById(\'flotante\').style.display='none';\" align=\"center\"><font size=\"3\" face=\"Arial\">&nbsp;AR&nbsp;</font></p>"
		fl2.style.backgroundColor="#4ED1F7"
	}
}
for (i in rz)
{
	fl0="S"+i+13
	//alert("fl0="+ fl0)
	fl2=document.getElementById(fl0)
	if(fl2!=null)
	{
		fl2.innerHTML="<p onmouseover=\"showage(event,\'"+i+13+"\');\" onmousemove=\"showage(event,\'"+i+13+"\');\" onmouseout=\"javascript:document.getElementById(\'flotante\').style.display='none';\" align=\"center\"><font size=\"3\" face=\"Arial\">&nbsp;VR&nbsp;</font></p>"
		fl2.style.backgroundColor="#FCA8E3"
	}
}
for (i in cr)
{
	fl0="S"+i+14
	//alert("fl0="+ fl0)
	fl2=document.getElementById(fl0)
	if(fl2!=null)
	{
		//fl2.innerHTML="<p align=\"center\"><font size=\"3\" face=\"Arial\">&nbsp;CR&nbsp;</font></p>"
		fl2.innerHTML="<p onmouseover=\"showage(event,\'"+i+14+"\');\" onmousemove=\"showage(event,\'"+i+14+"\');\" onmouseout=\"javascript:document.getElementById(\'flotante\').style.display='none';\" align=\"center\"><font size=\"3\" face=\"Arial\">&nbsp;CR&nbsp;</font></p>"
		fl2.style.backgroundColor="#B0FC8E"
	}
}
