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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function loginpacientes(theForm)
{
  if (theForm.user.value == "" || isNaN(theForm.user.value))
  {
    alert("El Número de documento es incorrecto");
    theForm.user.focus();
    return (false);
  }
  if (theForm.password.value == "")
  {
    alert("Debe informar la contraseña");
    theForm.password.focus();
    return (false);
  }
   theForm.submit();
}

function reclamoclave() {
		window.open('/internas/pedidoClave.asp','','resizable=no,status=no,x=100,y=100,width=350,height=180');
}

function AbrirEnGrande(Pic,X,Y,W,H) {
	window.open('/comunes/MostrarImagen.asp?PIC='+Pic,'','resizable=no,status=no,x='+X+',y='+Y+',width='+W+',height='+H);
}

function popup(sPage, nAncho, nAlto) {
	var x;
	x=window.open(sPage,'_blank','resizable=no,status=no,width='+nAncho+',height='+nAlto+',left=50,top=50')
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function validarEncuesta() {
	var f = document.encuesta;
	var i;
	for(i=0;i<f.opcion.length;i++) {
		if (f.opcion[i].checked == true)
			return true;
	}
	alert('Debe seleccionar alguna opción!');
	return false;
}

function verEncuestas() {
	window.open("/pacientes/encuestames/encuestas.asp","encuestas","width=500,height=350,scrollbars=yes,resizable=no");
}

function mostrarNota(nid,cat) {
	window.open("/pacientes/notas/notas.asp?categoria="+cat+"#"+nid,"notas","width=650,height=450,scrollbars=yes,resizable=no");
}

function mostrarNotas() {
	window.open("/pacientes/notas/notas.asp","notas","width=650,height=450,scrollbars=yes,resizable=no");
}

function calcularimc() 
{
	var altura = document.frmIMC.altura.value;
	var peso = document.frmIMC.peso.value;
	if (altura != "" && peso != "") 
	{
		if ((altura.indexOf(".")!=-1) || (peso.indexOf(".")!=-1) ) 
		{
			alert("Para especificar decimales utilice la coma!");
			return;
		}
		window.open("CalculoIMC.asp?altura="+altura+"&peso="+peso,'imc','height=160,width=300,resizeable=no,scrollbars=no');
		
	}
	else alert("Por Favor, Complete todos los campos!");
}

function mostrarCalorias()
{
	window.open("calorias.asp",'calorias','height=409,width=500,resizeable=no,scrollbars=yes');
}

function verNota(nId) {
	window.open("/pacientes/notas/verNota.asp?id="+nId,"nota"+nId,"width=500,height=500,scrollbars=yes");
}

function ow(page, name, w, h) {
  window.open(page,name,"resizable=0,width="+w+",height="+h+",left=50,top=50,scrollbars=no");
}