function _(_e){
  return document.getElementById(_e);
}
function changeTabsEnf(e){
    var _divs=_('contentEnf');
    var nodes=_divs.childNodes.length;
    for(each=0;each<nodes;each++){
      _divsHidden=_divs.childNodes[each].id;
      _(_divsHidden).style.display='none';
    }
     _(e).style.display='block';
}

function IsNumeric(input){
  var RE = /^-?(0|INF|(0[1-7][0-7]*)|(0x[0-9a-fA-F]+)|((0|[1-9][0-9]*|(?=[\.,]))([\.,][0-9]+)?([eE]-?\d+)?))$/;
  return (RE.test(input));
}


function getPDF(){
  __u=document.location.href;
  RegExenfermedad=/enfermedades\-a\-z\/([a-zA-Z])\/(\w)/;
  RegExEmbarazo=/embarazo/;
  RegExSalud=/salud/;
  RegExHospital=/hospitales\/hospitales\-en\-mexico/;

  if(__u.match(RegExenfermedad)){
    __pa=__u.split('/');
    __art=__pa[__pa.length-2];
    if(__art.length==1 || __art.length==0){
        __art=__pa[__pa.length-1];
    }
    outPdf('enfermedad',__art);

  }else if(__u.match(RegExEmbarazo)){
    __pa=__u.split('/');
    __art=__pa[__pa.length-1];
    if(typeof __art=="undefined" || __art=="" ){
        __art=__pa[__pa.length-2];
    }
    outPdf('embarazo',__art,true);
  }else if(__u.match(RegExSalud)){
    __pa=__u.split('/');
    __art=__pa[__pa.length-1];
    if(typeof __art=="undefined" || __art=="" ){
        __art=__pa[__pa.length-2];
    }
    outPdf('salud',__art,true);
  } else if(__u.match(RegExHospital)){
    __pa=__u.split('/');
    __art=__pa[__pa.length-1];
    if(typeof __art=="undefined" || __art=="" || IsNumeric(__art)){
        __art=__pa[__pa.length-2];
    }
    outPdf('hospital',__art,true);
  }
  else{
    alert('Lo sentimos no puedes genera un pdf desde este link');
  }
 // alert($url);
}


function outPdf(type,article,ext){
    if(typeof ext=="undefined" || ext=="" ){
        ext='';
    }else{
        __url=location.href.toString();
        ext=':'+b64.encode(__url);
    }
    location.href='http://www.doctorweb.mx/generate/pdf/'+type+':'+article+ext;
}



function goPrint()
{
	getPDF();
	//$("#content div p").printArea([options]);
	//jQuery.jPrintArea("#content div p"); 
}
function goPrintOld() {
	  __u=document.location.href;
	  RegExenfermedad=/enfermedades\-a\-z\/([a-zA-Z])\/(\w)/;
	  RegExEmbarazo=/embarazo/;
	  RegExSalud=/salud/;
	  RegExHospital=/hospitales\/hospitales\-en\-mexico/;

	  if(__u.match(RegExenfermedad)){
	    __pa=__u.split('/');
	    __art=__pa[__pa.length-2];
	    if(__art.length==1 || __art.length==0){
	        __art=__pa[__pa.length-1];
	    }
	    outPrint('enfermedad',__art);

	  }else if(__u.match(RegExEmbarazo)){
	    __pa=__u.split('/');
	    __art=__pa[__pa.length-1];
	    if(typeof __art=="undefined" || __art=="" ){
	        __art=__pa[__pa.length-2];
	    }
	    outPrint('embarazo',__art,true);
	  }else if(__u.match(RegExSalud)){
	    __pa=__u.split('/');
	    __art=__pa[__pa.length-1];
	    if(typeof __art=="undefined" || __art=="" ){
	        __art=__pa[__pa.length-2];
	    }
	    outPrint('salud',__art,true);
	  } else if(__u.match(RegExHospital)){
	    __pa=__u.split('/');
	    __art=__pa[__pa.length-1];
	    if(typeof __art=="undefined" || __art=="" || IsNumeric(__art)){
	        __art=__pa[__pa.length-2];
	    }
	    outPrint('hospital',__art,true);
	  }
	  else{
	    alert('Lo sentimos no se puede imprimir esta pagina');
	  }	
	
	/*
	 * if (window.print)
    	window.print();
    else
    alert("Lo siento, pero a tu navegador no se le puede ordenar imprimir"+" desde la web. Actualizate o hazlo desde los menús");
    */
}

function outPrint(type,article,ext){
    if(typeof ext=="undefined" || ext=="" ){
        ext='';
    }else{
        __url=location.href.toString();
        ext=':'+b64.encode(__url);
    }
    __url='http://www.doctorweb.mx/generate/imprimir/'+type+':'+article+ext;
    var docTitle = document.title.toString();
	window.open(__url,'win2','width=500,height=500,menubar=no,resizable=no,scrollbars=yes,titlebar=yes,directories=no,location=no');    
}

var min=12;
var max=16;
function increaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
   var li = document.getElementsByTagName('li');
   for (i=0;i<ul.length;i++) {
	  if(p[i].style.fontSize) {
	   	var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
        var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
	  li[i].style.fontSize = s+"px"
   }
}
function decreaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }
}






function votar(form){
  var _f=document.getElementById(form);
  var _i=_f.respuesta.length;
  var _r;
  for(i=0;i<_i;i++){
    if(_f.respuesta[i].checked){
      var _r=_f.respuesta[i].value;
      }
  }
  jQuery.noConflict();
  (function($) {
    $(function() {
      $.ajax({
        url: "/ajax/",
        context: document.body,
        data:'res='+_r,
        type:'POST',
        beforeSend: function(){
            $("#encuesta").html("Cargando");
       },
        success: function(data){
            $("#encuesta").html(data);
        }
        });
    });
  })(jQuery);

}
/*
 * 
 * 
 * 
 * $.each([52, 97], function(index, value) { 
  alert(index + ': ' + value); 
});

 */

jQuery.noConflict();
(function($) {
  $(function() {
	  var map = { 
			  'a': '#content div p', 
			  'b': '#body div p' 
			}; 

	  //var arrayContainers=array('','');
	  
	  // Reset Font Size
	  $.each(map, function(index,e){
		  var originalFontSize = $(e).css('font-size');  
		  //var originalFontSize2 = $('·entry_enf p').css('font-size');	  
		  /*  $(".resetFont").click(function(){
		    $('#content p').css('font-size', originalFontSize);
		  });*/
		  // Increase Font Size
		  $(".increaseFont").click(function(){
		    var currentFontSize = $(e).css('font-size');
		    var currentFontSizeNum = parseFloat(currentFontSize, 10);
		    var newFontSize = currentFontSizeNum*1.2;
		    $(e).css('font-size', newFontSize);
		    return false;
		  });
		  // Decrease Font Size
		  $(".decreaseFont").click(function(){
		    var currentFontSize = $(e).css('font-size');
		    var currentFontSizeNum = parseFloat(currentFontSize, 10);
		    var newFontSize = currentFontSizeNum*0.8;
		    $(e).css('font-size', newFontSize);
		    return false;
		  });
	  });
});
})(jQuery);





















