<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function AbrirPopup(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function showHideLayer(which,what)
{
  var obj;

  if(document.layers)
  {
    obj=document.layers[which];
    if(obj) obj.visibility=what;
  }
  else if(document.all)
  {
    obj=document.all[which];
    what=(what=="hide")?"hidden":"visible";
    if(obj) obj.style.visibility=what;
  }
}

function ValidarExtensionUpload(enviado){ 


var i; 
var ufilename; 
if (enviado.value.length > 0 ) 
{ 

	ufilename = enviado.value.toUpperCase(); 
	var extnarr = ufilename.split("."); 
	fileType = "." + extnarr[extnarr.length-1]; 
	valorpermitido = "." + permitido;

	alert(fileType);
	
	if (fileType != "." + valorpermitido) 
	{ 
		alert("Solo está permitido el envío de archivos con la extensión " + permitido); 
		return false; 
	} 
} 
}

function AVIFrame(IFrame,Height){
	document.all[IFrame].height = Height;
	if (Height==0) {
		document.all[IFrame].src=document.all[IFrame].src;
	}
}

function GuardarPaciente() {
	
	if (formDatos.Nombre.value == "") {
		
		alert("Debe ingresar Nombre");
		formDatos.Nombre.focus();
		return (false);
		
	}

	if (formDatos.Apellido.value == "") {
		
		alert("Debe ingresar apellido");
		formDatos.Apellido.focus();
		return (false);
		
	}

	if (formDatos.Telefono.value == "") {
		
		alert("Debe ingresar su telefono.");
		formDatos.Telefono.focus();
		return (false);
		
	}

	if (formDatos.HClinica.value == "") {
		
		alert("Debe ingresar historia clínita.");
		formDatos.HClinica.focus();
		return (false);
		
	}

}

function EnviarImagen() {
	
  if (formArchivos.cantarchivos.value == "" || formArchivos.cantarchivos.value == "1") {

		if (formArchivos.FILE.value == "") {
			
			alert("Debe seleccionar una imagen a enviar.");
			formArchivos.FILE.focus();
			return (false);
			
		}

		//if (formArchivos.FILE.value != "" && eval('formArchivos.TipoImagen[' + i + '].value') == "") {
			
			//alert("Debe seleccionar un tipo de imagen para la imagen " + (i+1));
			//return (false);
			
		//}
	}
	else
	{
		if (formArchivos.FILE1.value == "") {
			
			alert("Debe seleccionar una imagen a enviar.");
			formArchivos.FILE1.focus();
			return (false);
			
		}
		
		
		//for(i=0; i<formArchivos.cantarchivos.value; i++) {
			//if (eval('formArchivos.FILE' . i . '.value') != "" && eval('formArchivos.TipoImagen[' + i + '].value') == "") {
				
				//alert("Debe seleccionar un tipo de imagen para la imagen " + (i+1));
				//return (false);
				
			//}
		//}
	}

	formArchivos.submit();
	
}

function EnviarPresentacion() {
	
	if (formArchivos.FILE.value == "") {
		
		alert("Debe seleccionar una presentación a enviar.");
		formArchivos.FILE.focus();
		return (false);
		
	}
	
	archivo = new String(formArchivos.FILE.value);
	//archivo = archivo.toLowerCase;
	
	if (archivo.lastIndexOf(".ppt") == -1 && archivo.lastIndexOf(".pps") == -1) {
		alert("Debe seleccionar una presentación en formato Powerpoint (.PPT)");
		formArchivos.FILE.focus();
		return (false);
	}

	if (formArchivos.NotaPresentacion.value == "") {
		
		alert("Debe ingresar una nota para la presentación.");
		formArchivos.NotaPresentacion.focus();
		return (false);
		
	}
		
	formArchivos.Pacientes.value = "";
	
	//alert(formArchivos.Pacientes.value);

//	for(i=0;i<IFramePacientes.formDatos.Pacientes.length;i++) {
//		if (IFramePacientes.formDatos.Pacientes[i].checked) {
//			if (formArchivos.Pacientes.value == "") {
//				formArchivos.Pacientes.value = formArchivos.Pacientes.value + IFramePacientes.formDatos.Pacientes[i].value;
//				alert(formArchivos.Pacientes.value);
//			}
//			else
//			{
//				formArchivos.Pacientes.value = formArchivos.Pacientes.value + "," + IFramePacientes.formDatos.Pacientes[i].value;
//				alert(formArchivos.Pacientes.value);
//			}
//		}
//	}
			
	//formArchivos.Pacientes.value = IFramePacientes.formDatos.Pacientes.value;

	//alert(formArchivos.Pacientes.value);

	formArchivos.submit();
	
}

function ExportarImagenes() {
	
	IFrameImagenes.formImagenes.submit();
	
}

function EvolucionesToggle() {
	
  if (document.all['IFrameEvoluciones'].height == 150) {
		document.all['IFrameEvoluciones'].height = 20;
		//document.all['IFrameEvoluciones'].innerHTML = '<table width="100%" border="0" cellpadding="2" cellspacing="0" class="tabla_gris">
		//																								<tr> 
		//																								<td colspan="6" class="td_verdetit"><strong>Evoluciones</strong></td>
		//																								</tr>';
	}
	else
	{
		document.all['IFrameEvoluciones'].height = 150;
		//document.all['IFrameEvoluciones'].scroll = 'auto';
	}

}

function CirugiasToggle() {
	
  if (document.all['IFrameCirugias'].height != 0) {
		document.all['IFrameCirugias'].height = 0;
	}
	else
	{
		document.all['IFrameCirugias'].height = 150;
		ObservacionesToggle();
		ImagenesToggle();
	}

}

function ObservacionesToggle() {
	
  if (document.all['IFrameObservaciones'].height != 0) {
		document.all['IFrameObservaciones'].height = 0;
		document.all['BotonObservaciones'].src = 'images/bot_mas.gif';
	}
	else
	{
		document.all['IFrameObservaciones'].height = 150;
		document.all['BotonObservaciones'].src = 'images/bot_mas.gif';
		CirugiasToggle();
		ImagenesToggle();
	}

}

function ImagenesToggle() {
	
  if (document.all['IFrameImagenes'].height != 0) {
		document.all['IFrameImagenes'].height = 0;
		document.all['BotonImagenes'].src = 'images/bot_mas.gif';
	}
	else
	{
		document.all['IFrameImagenes'].height = 250;
		document.all['BotonImagenes'].src = 'images/bot_menos.gif';
		CirugiasToggle();
		ObservacionesToggle();
	}

}

function BuscarAvTexto() {
	
	formAvTexto.Cirujanos.value = "";
	
	for(i=0;i<IFrameCirujanos.formDatos.Checkbox.length;i++) {
		if (IFrameCirujanos.formDatos.Checkbox[i].checked) {
			if (formAvTexto.Cirujanos.value == "") {
				formAvTexto.Cirujanos.value = formAvTexto.Cirujanos.value + IFrameCirujanos.formDatos.Checkbox[i].value;
			}
			else
			{
				formAvTexto.Cirujanos.value = formAvTexto.Cirujanos.value + "," + IFrameCirujanos.formDatos.Checkbox[i].value;
			}
		}
	}

	formAvTexto.Diagnosticos.value = "";
	
	for(i=0;i<IFrameDiagnosticos.formDatos.Checkbox.length;i++) {
		if (IFrameDiagnosticos.formDatos.Checkbox[i].checked) {
			if (formAvTexto.Diagnosticos.value == "") {
				formAvTexto.Diagnosticos.value = formAvTexto.Diagnosticos.value + IFrameDiagnosticos.formDatos.Checkbox[i].value;
			}
			else
			{
				formAvTexto.Diagnosticos.value = formAvTexto.Diagnosticos.value + "," + IFrameDiagnosticos.formDatos.Checkbox[i].value;
			}
		}
	}

	formAvTexto.SubDiagnosticos.value = "";
	
	for(i=0;i<IFrameSubDiagnosticos.formDatos.Checkbox.length;i++) {
		if (IFrameSubDiagnosticos.formDatos.Checkbox[i].checked) {
			if (formAvTexto.SubDiagnosticos.value == "") {
				formAvTexto.SubDiagnosticos.value = formAvTexto.SubDiagnosticos.value + IFrameSubDiagnosticos.formDatos.Checkbox[i].value;
			}
			else
			{
				formAvTexto.SubDiagnosticos.value = formAvTexto.SubDiagnosticos.value + "," + IFrameSubDiagnosticos.formDatos.Checkbox[i].value;
			}
		}
	}

	formAvTexto.Tratamientos.value = "";
	
	for(i=0;i<IFrameTratamientos.formDatos.Checkbox.length;i++) {
		if (IFrameTratamientos.formDatos.Checkbox[i].checked) {
			if (formAvTexto.Tratamientos.value == "") {
				formAvTexto.Tratamientos.value = formAvTexto.Tratamientos.value + IFrameTratamientos.formDatos.Checkbox[i].value;
			}
			else
			{
				formAvTexto.Tratamientos.value = formAvTexto.Tratamientos.value + "," + IFrameTratamientos.formDatos.Checkbox[i].value;
			}
		}
	}

	formAvTexto.SubTratamientos.value = "";
	
	for(i=0;i<IFrameSubTratamientos.formDatos.Checkbox.length;i++) {
		if (IFrameSubTratamientos.formDatos.Checkbox[i].checked) {
			if (formAvTexto.SubTratamientos.value == "") {
				formAvTexto.SubTratamientos.value = formAvTexto.SubTratamientos.value + IFrameSubTratamientos.formDatos.Checkbox[i].value;
			}
			else
			{
				formAvTexto.SubTratamientos.value = formAvTexto.SubTratamientos.value + "," + IFrameSubTratamientos.formDatos.Checkbox[i].value;
			}
		}
	}

	formAvTexto.Implantes.value = "";
	
	for(i=0;i<IFrameImplantes.formDatos.Checkbox.length;i++) {
		if (IFrameImplantes.formDatos.Checkbox[i].checked) {
			if (formAvTexto.Implantes.value == "") {
				formAvTexto.Implantes.value = formAvTexto.Implantes.value + IFrameImplantes.formDatos.Checkbox[i].value;
			}
			else
			{
				formAvTexto.Implantes.value = formAvTexto.Implantes.value + "," + IFrameImplantes.formDatos.Checkbox[i].value;
			}
		}
	}
		
	formAvTexto.submit();
	
}

function BuscarAvImagen() {
	
	formAvImagen.submit();
	
}

function AgregarEvolucion() {

	if (formEvolucion.evolucion.value == "") {
		alert("Debe ingresar un texto para la evolución");
		formEvolucion.evolucion.focus();
		return (false);
	}
	
	formEvolucion.submit();
	  
}

function AgregarScore() {

	if (formScore.TipoScore.value == "") {
		alert("Debe seleccionar un tipo de score");
		formScore.TipoScore.focus();
		return (false);
	}

	if (IFrameCalificaciones.formDatos.Calificacion.value == "") {
		alert("Debe seleccionar una calificación");
		IFrameCalificaciones.formDatos.Calificacion.focus();
		return (false);
	}
		
	formScore.Calificacion.value = IFrameCalificaciones.formDatos.Calificacion.value;
	
	formScore.submit();
	  
}

function AgregarObservacion() {

	if (formObservacion.observacion.value == "") {
		alert("Debe ingresar un texto para la observación");
		formObservacion.observacion.focus();
		return (false);
	}
	
	formObservacion.submit();
	  
}
function AgregarEvaluacion() {

	if (formEvaluacion.evaluacion.value == "") {
		alert("Debe ingresar un texto para la evaluación");
		formEvaluacion.evaluacion.focus();
		return (false);
	}
	
	formEvaluacion.submit();
	  
}

function AgregarCirugia() {

	if (formPaciente.paciente.value == "" && formPaciente.TipoPaciente[0].checked) {
		alert("Debe seleccionar un paciente para ingresar la cirugía");
		formBuscarPaciente.BuscarHC.focus();
		return (false);
	}
	
	formPaciente.submit();
	  
}

function AbrirPopupCentrado(theURL,winName,ancho,alto) { //v2.0

	var      x = screen.width ;
	var      y = screen.height ;
	var    top = parseInt( ( y - alto ) / 2 ) ;
	var   left = parseInt( ( x - ancho  ) / 2 ) ;

  x = window.open(theURL,winName,"top=" + top + ",left=" + left + ",width=" + ancho + ",height=" + alto + ",scrollbars=yes");
  x.focus();
  
}

function AbrirPopupCentradoIFrame(theURL,winName,features,width,height) { //v2.0

	var      x = parent.screen.width ;
	var      y = parent.screen.height ;
	var    top = parseInt( ( y - height ) / 2 ) ;
	var   left = parseInt( ( x - width  ) / 2 ) ;

  window.open(theURL,winName,features + ",top=" + top + ",left=" + left);
  
}

function TablaPintarLineaColor (element) { 
   var allTables = document.getElementsByTagName('TABLE'); 
   var save_cell_contents = element.innerHTML; 
   var c, cells, j, i = allTables.length; 


   while( i--) { 
     cells = allTables[i].getElementsByTagName('TR'); 
     j = cells.length; 


     while ( j-- ) { 
       c = cells[j]; 
       if ( save_cell_contents == c.innerHTML ) { 
         c.style.backgroundColor = 'lime'; 
       } else { 
         c.style.backgroundColor = 'white'; 
       } 
     } 
   } 



} 


function TablaPintarLinea(e) { 
   e = e || window.event; 
   var tgt = e.target || e.srcElement; 
   while ( tgt.parentNode && 'TR' != tgt.nodeName ) { 
     tgt = tgt.parentNode; 
   } 
   if ( 'TR' == tgt.nodeName ) { 
     highlight_cell(tgt); 
   } 


} 

function EsNumerico() {
  var code = event.keyCode
  var habilitado = false

  // teclas para decimales
  if (code == 188 || code == 190 || code == 110 ) {
  var habilitado = true
  }
  // teclas de edicion
  if (code == 27 || code == 8 || code == 37 || code == 39 || code == 46 ) {
  var habilitado = true
  }

  //window.status = code

  return ( ((code >= 48) && (code <= 57) ||(code >= 94) && (code <= 105)  )
|| habilitado   )
}

function TextoObligatorio(campo, camponombre) {

//alert(camponombre);

if (eval('document.formDatos.' + camponombre + '.value') == "") {
	alert("Por favor, complete el campo " + campo + ".");
	eval('document.formDatos.' + camponombre + '.focus();');
	return false;
	}
else
	{
	return true
}
}

function ComboObligatorio(campo, camponombre) {

//alert(camponombre);

if (eval('document.formDatos.' + camponombre + '.value') == "0") {
	alert("Por favor, seleccione un elemento para el campo " + campo + ".");
	eval('document.formDatos.' + camponombre + '.focus();');
	return false;
	}
else
	{
	return true
}	
}

function EsNumerico() {
  var code = event.keyCode
  var habilitado = false

  // teclas para decimales
  if (code == 188 || code == 190 || code == 110 ) {
  var habilitado = true
  }
  // teclas de edicion
  if (code == 27 || code == 8 || code == 37 || code == 39 || code == 46 ) {
  var habilitado = true
  }

  //window.status = code

  return ( ((code >= 48) && (code <= 57) ||(code >= 94) && (code <= 105)  )
|| habilitado   )
}

function ComboObligatorioIFRAME(campo, camponombre) {

//alert(camponombre);

if (eval(camponombre + '.value') == "0") {
	alert("Por favor, seleccione un elemento para el campo " + campo + ".");
	eval('document.formDatos.' + camponombre + '.focus();');
	return false;
	}
else
	{
	return true
}	
}

function RadioObligatorio(campo, camponombre) {

//alert(camponombre);

if (eval('!document.formDatos.' + camponombre + '[0].checked') && eval('!document.formDatos.' + camponombre + '[1].checked')){ 
	alert("Por favor, seleccione una opción para el campo " + campo + ".");
	return false;
	}
	return true;
}

/*

EJEMPLO LAYERS CON CONTENIDO DINAMICO

function switchTab(n) {

	tabs = new Array("global","asia","euro","us");
	
	for (i=0; i<4; i++){
		if (n != tabs[i]){
			document.getElementById(tabs[i]+'_content').style.display='none';
			imgSwap(tabs[i]+'_tab',tabs[i]+'_tab_off');
		}
		else{
			document.getElementById(tabs[i]+'_content').style.display='';
			setTabSessionState(tabs[i]+'_tab');
			imgSwap(tabs[i]+'_tab',tabs[i]+'_tab_on');
		}
	}
}
function imgSwap (imgName,imgFile)  { 
        if (document.images)  {
			document.images[imgName].src = eval (imgFile + ".src");
		}
}

</script>
<script language="javascript" type="text/javascript">
 function setTabSessionState(tab,state){
	if( document.layers && document.layers['tabSessionState'].load ) {
		document.layers['lhTabSessionState'].load('/corporate/include/set_lh_tab_state.cfm?tab='+tab,0);
	} 
	else if( window.frames && window.frames.length ) {
		window.frames['lhTabSessionStateFrame'].window.location.replace('/corporate/include/set_lh_tab_state.cfm?tab='+tab);
	} 
	else {
		alert( 'Doesn\'t work' );
	}
}

*/

//-->
