<!--
function tabla(n){
  this.length=n
  for(var i=1;i<=n;i++)
    this[i]=null
  return this
}

var maxday=new tabla(12)
maxday[1]=31
maxday[2]=28
maxday[3]=31
maxday[4]=30
maxday[5]=31
maxday[6]=30
maxday[7]=31
maxday[8]=31
maxday[9]=30
maxday[10]=31
maxday[11]=30
maxday[12]=31

var monthname=new tabla(12)
monthname[1]="Enero"
monthname[2]="Febrero"
monthname[3]="Marzo"
monthname[4]="Abril"
monthname[5]="Mayo"
monthname[6]="Junio"
monthname[7]="Julio"
monthname[8]="Agosto"
monthname[9]="Septiembre"
monthname[10]="Octubre"
monthname[11]="Noviembre"
monthname[12]="Diciembre"

var adddays=new tabla(7)
adddays[1]=14
adddays[2]=35
adddays[3]=70
adddays[4]=84
adddays[5]=161
adddays[6]=189
adddays[7]=280

// Calcula la fecha
function calcNewDate(month,day,year,adddays){
  newday = eval(day) + adddays
  newmonth = month + 1
  newyear = eval(year)
  var max
  for (var i = 0; i < 12; i++) {
    if (newmonth == 2 && (newyear % 4) == 0) {
    max = 29
  }else
    max = maxday[newmonth]
    if (newday > max) {
      newday = newday - max
      newmonth = newmonth + 1
      if (newmonth > 12) {
      newyear = newyear + 1
      newmonth = 1
    }
  }
  else
  break
  }
  newmonth=(newmonth<10?"0"+newmonth:newmonth)
  newday=(newday<10?"0"+newday:newday)
  var datestring = newyear + "-" + newmonth + "-" + newday
  return datestring
}
function CheckTextarea(inField,longmax,inData){
  if(inField.length>longmax){
    alert("Se excedió de la longitud del campo: " + inData);
    return false;
  }
  return true;
}
function validEmail(email){
  invalidChars=" /:,;";
  if(email==""){
    return false;
  }
  for(i=0;i < invalidChars.length;i++){
    badChar=invalidChars.charAt(i);
    if(email.indexOf(badChar,0)>-1){
      return false;
    }
  }
  atPos=email.indexOf("@",1);
  if(atPos==-1){
    return false;
  }
  if(email.indexOf("@",atPos+1)!=-1){
    return false;
  }
  periodPos=email.indexOf(".",atPos);
  if(periodPos==-1){
    return false;
  }
  if(periodPos+3>email.length){
    return false;
  }
  return true;
}
function Check_Registro_Doctores(inForm){
  if(!validEmail(inForm.email.value)){
    alert("Lo siento. La direccion de email parece estar incorrecta");
    return false;
  }
  if(inForm.email.value==""){
    alert("Su nombre de usuario no ha sido proporcionado");
    return false;
  }
  if(inForm.password.value==""){
    alert("Su contraseña no ha sido proporcionada");
    return false;
  }
  if(inForm.password.value!=inForm.confirmar_password.value){
    alert("Su contraseña y la confirmación de su contraseña no son iguales");
    return false;
  }
  if(inForm.nombre.value == ""){
    alert("Su nombre no ha sido proporcionado");
    return false;
  }
  if(inForm.apellido_paterno.value==""){
    alert("Su apellido paterno no ha sido proporcionado");
    return false;
  }
  if(inForm.apellido_materno.value==""){
    alert("Su apellido materno no ha sido proporcionado");
    return false;
  }
  /*
  if(inForm.edad.value==""){
    alert("Su edad no ha sido proporcionada");
    return false;
  }
  if(isNaN(inForm.edad.value)){
    alert("Su edad está mal escrita");
    return false;
  }
  */
  if(inForm.pais.selectedIndex==0){
    alert("El país donde vives no ha sido proporcionado");
    return false;
  }
  if(inForm.ciudad.value==""){
    alert("Su ciudad no ha sido proporcionada");
    return false;
  }
  if(inForm.codigo_postal.value==""){
    alert("Su codigo postal no ha sido proporcionado");
    return false;
  }
  if(isNaN(inForm.codigo_postal.value)){
    alert("El codigo postal debe ser numerico");
    return false;
  }
  if(inForm.curriculum.value==""){
    alert("Su curriculum no ha sido proporcionado");
    return false;
  }
  return true;
}
function Check_Registro(inForm){
  if(!validEmail(inForm.mail.value)){
    alert("Lo siento. La direccion de email parece estar incorrecta");
    return false;
  }
  if(inForm.email.value==""){
    alert("Su nombre de usuario no ha sido proporcionado");
    return false;
  }
  /*
  if(inForm.edad.value==""){
    alert("Su edad no ha sido proporcionada");
    return false;
  }
  if(isNaN(inForm.edad.value)){
    alert("Su edad está mal escrita");
    return false;
  }
  */
  if(inForm.pais.selectedIndex==0){
    alert("El país donde vives no ha sido proporcionado");
    return false;
  }
  if( (inForm.pais[inForm.pais.selectedIndex].value=='MX') || (inForm.pais[inForm.pais.selectedIndex].value=='US') ){
	if(inForm.pais[inForm.pais.selectedIndex].value=='MX'){
	  if(inForm.estado_mx.selectedIndex==0){
        alert("El estado no ha sido proporcionado");
        return false;
      }
	}else{
	  if(inForm.estado_us.selectedIndex==0){
        alert("El estado no ha sido proporcionado");
        return false;
      }
	}
  }else{
    if(inForm.estado_texto.value==""){
      alert("El estado no ha sido proporcionado");
      return false;
    }  
  }
  if(inForm.ciudad.value==""){
    alert("Su ciudad no ha sido proporcionada");
    return false;
  }
  if(inForm.pais[inForm.pais.selectedIndex].value!='MX'){
  	if(inForm.codigo_postal.value==""){
      alert("Su código postal no ha sido proporcionado");
      return false;
	}
  }
  if(inForm.bebe[1].checked==true){
    if(inForm.nombre_bebe.value==""){
      alert("El nombre del bebé no ha sido proporcionado");
      return false;
    }
  }
  day=inForm.day.value
  year=inForm.year.value
  monthnum=inForm.month.selectedIndex
  inForm.fecha_nacimiento.value=calcNewDate(monthnum,day,year,adddays[7])
  return true;
}
function Check_Modificar(inForm){
  if(!validEmail(inForm.mail.value)){
    alert("Lo siento. La direccion de email parece estar incorrecta");
    return false;
  }
  if(inForm.email.value==""){
    alert("Su nombre de usuario no ha sido proporcionado");
    return false;
  }
  /*
  if(inForm.edad.value==""){
    alert("Su edad no ha sido proporcionada");
    return false;
  }
  if(isNaN(inForm.edad.value)){
    alert("Su edad está mal escrita");
    return false;
  }
  */
  if(inForm.pais.selectedIndex==0){
    alert("El país donde vives no ha sido proporcionado");
    return false;
  }
  if( (inForm.pais[inForm.pais.selectedIndex].value=='MX') || (inForm.pais[inForm.pais.selectedIndex].value=='US') ){
	if(inForm.pais[inForm.pais.selectedIndex].value=='MX'){
	  if(inForm.estado_mx.selectedIndex==0){
        alert("El estado no ha sido proporcionado");
        return false;
      }
	}else{
	  if(inForm.estado_us.selectedIndex==0){
        alert("El estado no ha sido proporcionado");
        return false;
      }
	}
  }else{
    if(inForm.estado_texto.value==""){
      alert("El estado no ha sido proporcionado");
      return false;
    }  
  }
  if(inForm.ciudad.value==""){
    alert("Su ciudad no ha sido proporcionada");
    return false;
  }
  if(inForm.codigo_postal.value==""){
    alert("Su código postal no ha sido proporcionado");
    return false;
  }
  if(inForm.nombre_bebe.value==""){
    alert("El nombre del bebé no ha sido proporcionado");
    return false;
  }
  day=inForm.day.value
  year=inForm.year.value
  monthnum=inForm.month.selectedIndex
  inForm.fecha_nacimiento.value=calcNewDate(monthnum,day,year,adddays[7])
  return true;
}
function Check_Login(inForm){
  if(inForm.email.value==""){
    alert("Su nombre de usuario no ha sido proporcionado");
    return false;
  }
  return true;
}

function Check_Email(inForm){
  if(!validEmail(inForm.email.value)){
    alert("Lo siento. La direccion de email parece estar incorrecta");
    return false;
  }
  return true;
}

function Check_Pregunta(inForm){
  if(inForm.pregunta.value==""){
    alert("Necesita ingresar la pregunta");
    return false;
  }
  return true;
}

function Check_Pregunta_General(inForm){
  if(inForm.pregunta.value==""){
    alert("Necesita ingresar la pregunta");
    return false;
  }
  if(inForm.clasificacion.selectedIndex==0){
    alert("Seleccione una clasificación de la pregunta");
    return false;
  }
  if(!CheckTextarea(inForm.pregunta.value,500,"pregunta")){
    return false;
  }
  return true;
}
function Check_Preg_General(inForm){
  if(inForm.pregunta.value==""){
    alert("Necesita ingresar la pregunta");
    return false;
  }
  if(!CheckTextarea(inForm.pregunta.value,500,"pregunta")){
    return false;
  }
  return true;
}
function PopUp(inPage,inDoc){
  window.open("/popup.phtml?registro_doctores=" + inDoc + "&pag_registro=" + inPage,"autentificacion","toolbar=false,location=false,directories=false,status=false,menubar=no,scrollbars=no,resizeable=no,marginheight=2,marginwidth=2,copyhistory=false,width=350,height=350,screenX=100,screenY=100,top=100,left=100");
}
function Check_Poll(inForm){
  for(var j=0; j < inForm.poll_voteNr.length; j++){
    if(inForm.poll_voteNr[j].checked){
      return true;
    }
  }
  alert("Debe seleccionar una opción en la encuesta");
  return false;
}
function DateOfBirth(inForm){
  day=inForm.day.value
  year=inForm.year.value
  monthnum=inForm.month.selectedIndex
  inForm.birth.value=calcNewDate(monthnum,day,year,adddays[7])
  return true;
}
function PutDate(stringDate,inYear,inMonth,inDay){
  splitString=stringDate.split("-")
  for (i=0; i<inYear.length; i++) {
    if(inYear.options[i].value == Math.abs(splitString[0]))
      inYear.options[i].selected=true;
  }
  for (i=0; i<inMonth.length; i++) {
    if(inMonth.options[i].value == Math.abs(splitString[1]))
      inMonth.options[i].selected=true;
  }
  for (i=0; i<inDay.length; i++) {
    if(inDay.options[i].value == Math.abs(splitString[2]))
      inDay.options[i].selected=true;
  }
}
function PutDateSpacial(stringDate,inYear,inMonth,inDay,inForm){
  splitString=stringDate.split("-")
  for (i=0; i<inYear.length; i++) {
    if(inYear.options[i].value == Math.abs(splitString[0]))
      inYear.options[i].selected=true;
  }
  changeDays(0,inForm);
  for (i=0; i<inMonth.length; i++) {
    if(inMonth.options[i].value == Math.abs(splitString[1]))
      inMonth.options[i].selected=true;
  }
  changeDays(0,inForm);
  for (i=0; i<inDay.length; i++) {
    if(inDay.options[i].value == Math.abs(splitString[2]))
      inDay.options[i].selected=true;
  }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
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_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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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_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 MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function getCookie(Name){
  var search=Name + "=";
  if(document.cookie.length > 0){ // if there are any cookies
    offset=document.cookie.indexOf(search);
	if(offset!=-1){ // if cookie exists
	  offset += search.length;  // set index of beginning of value
	  end = document.cookie.indexOf(";", offset);          // set index of end of cookie value
	  if(end == -1)
	    end = document.cookie.length
	  return unescape(document.cookie.substring(offset, end))
	}
  }
}

function Llena_Categoria(inForm,selected){
  selectedArray=Categoria;
  var longitud=inForm.categoria.options.length;
  for (var j=1;j < longitud;j++){
    inForm.categoria.options[(inForm.categoria.options.length - 1)] = null;
  }
  var longitud=inForm.tema.options.length;
  for (var j=1;j < longitud;j++){
    inForm.tema.options[(inForm.tema.options.length - 1)] = null;
  }
  var k=1;
  for(var i=0;i < selectedArray.length;i++){
    if(selectedArray[i][2]==selected){
      inForm.categoria.options[k]=new Option(selectedArray[i][0],selectedArray[i][1]); 
      k++;
    }
  }
  
  if (inForm.seccion[0].value==''){
    inForm.seccion[0]=null;
    if (navigator.appName=='Netscape'){
      if(parseInt(navigator.appVersion)>4){
        window.history.go(0);
      }else{
        if(navigator.platform=='Win32' || navigator.platform=='Win16'){
          window.history.go(0);
        }
      }
    }
  }
}

function Llena_Tema(inForm,selected){
  selectedArray=Tema;
  var longitud=inForm.tema.options.length;
  for (var j=1;j < longitud;j++){
    inForm.tema.options[(inForm.tema.options.length - 1)] = null;
  }
  var k=1;
  for(var i=0;i < selectedArray.length;i++){
    if(selectedArray[i][2]==selected){
      inForm.tema.options[k]=new Option(selectedArray[i][0],selectedArray[i][1]); 
      k++;
    }
  }
  
  if (inForm.categoria[0].value==''){
    inForm.categoria[0]=null;
    if (navigator.appName=='Netscape'){
      if(parseInt(navigator.appVersion)>4){
        window.history.go(0);
      }else{
        if(navigator.platform=='Win32' || navigator.platform=='Win16'){
          window.history.go(0);
        }
      }
    }
  }
}

function Check_Mapeo(inForm){
  if(inForm.categoria.selectedIndex==0){
    alert ("Necesita escoger la categoría");
    return false;
  }
return true;
}

function pop1() {
  MM_openBrWindow('/sitios/lambi/pop1/index.html','lambi01','width=444,height=534');
}
function pop2() {
  window.open("/sitios/lambi/pop2/pop2.htm","lambi02","height=537,width=523,left=0,top=0");
}
function pop3() {
  window.open("/sitios/lambi/pop3/index.htm","lambi03","height=316,width=490,left=0,top=0");
}
function pop4() {
  window.open("/sitios/lambi/pop4/index.htm","lambi04","height=270,width=490,left=0,top=0");
}
function pop5() {
  window.open("/sitios/lambi/pop5/index.html","lambi05","height=480,width=570,left=0,top=0,scrollbars=1");
}
function pop6() {
  window.open("/sitios/lambi/pop6/index.html","lambi06","height=480,width=568,left=0,top=0,scrollbars=1");
}
function pop7() {
  window.open("/sitios/lambi/pop7/index.html","lambi07","height=480,width=525,left=0,top=0,scrollbars=1");
}
function pop8() {
  window.open("/sitios/lambi/pop8/index.html","lambi08","width=445,height=535,left=0,top=0");
}
function pop9() {
  window.open("/sitios/lambi/pop9/index.html","lambi09","width=500,height=530,left=0,top=0");
}
function pop_hse01() {
  MM_openBrWindow('/sitios/hse/banners/banner01.html','hse01','width=326,height=542');
}
function pop_pediatrix01() {
  MM_openBrWindow('/sitios/pediatrixscreening/popups/pop1.html','screen01','width=550,height=550');
}
function pop_methodist01(){
  window.open("/sitios/methodist/popups/index.phtml","homepage_methodist","toolbar=false,location=false,directories=false,status=false,menubar=no,scrollbars=no,resizeable=no,marginheight=2,marginwidth=2,copyhistory=false,width=330,height=530,screenX=10,screenY=10,top=10,left=10");
}
function pop_methodist02(){
  window.open("/sitios/methodist/popups/popup02.phtml","methodist_popup02","toolbar=false,location=false,directories=false,status=false,menubar=no,scrollbars=no,resizeable=no,marginheight=2,marginwidth=2,copyhistory=false,width=400,height=450,screenX=10,screenY=10,top=10,left=10");
}
function pop_methodist03(){
  window.open("/sitios/methodist/popups/popup03.phtml","methodist_popup03","toolbar=false,location=false,directories=false,status=false,menubar=no,scrollbars=no,resizeable=no,marginheight=2,marginwidth=2,copyhistory=false,width=330,height=360,screenX=10,screenY=10,top=10,left=10");
}
function pop_methodist04(){
  window.open("/sitios/methodist/popups/popup04.phtml","methodist_popup04","toolbar=false,location=false,directories=false,status=false,menubar=no,scrollbars=no,resizeable=no,marginheight=2,marginwidth=2,copyhistory=false,width=330,height=410,screenX=10,screenY=10,top=10,left=10");
}
function pop_methodist05(){
  window.open("/sitios/methodist/popups/popup05.phtml","methodist_popup05","toolbar=false,location=false,directories=false,status=false,menubar=no,scrollbars=no,resizeable=no,marginheight=2,marginwidth=2,copyhistory=false,width=400,height=460,screenX=10,screenY=10,top=10,left=10");
}
function pop_methodist06(){
  window.open("/sitios/methodist/popups/popup06.phtml","methodist_popup06","toolbar=false,location=false,directories=false,status=false,menubar=no,scrollbars=no,resizeable=no,marginheight=2,marginwidth=2,copyhistory=false,width=330,height=250,screenX=10,screenY=10,top=10,left=10");
}
function pop_methodist07(){
  window.open("/sitios/methodist/popups/popup07.phtml","methodist_popup06","toolbar=false,location=false,directories=false,status=false,menubar=no,scrollbars=no,resizeable=no,marginheight=2,marginwidth=2,copyhistory=false,width=330,height=250,screenX=10,screenY=10,top=10,left=10");
}
// -->