/* *************************************************************************************************** */
// Abre Ventanita

	function abreVentana(url,target,width,height){
		var h=(screen.height-height)/2;
		var w=(screen.width-width)/2;
		var woptions='toolbar=no,directories=no,menubar=no,location=no,resizable=no,top='+h+',left='+w+',scrollbars=yes,status=no,width=' + width + ',height=' + height;
		var FLOAT=open(url,target,woptions);
		if (FLOAT.focus!=null) FLOAT.focus();
	}

/* *************************************************************************************************** */
// Tama�o del cuerpo

function tamdiv(){
	var con = document.getElementById('cuerpo').offsetHeight;
	var cont = document.getElementById('cuerpo');
	var col = document.getElementById('col_izq');
	if(con > 500){
		col.style.height=con+"px";
	} else {
		
		col.style.height='500px';
		cont.style.height='500px';
	}
}

function tamDivNoticia(){
	var con = document.getElementById('contenidos').offsetHeight;
	var cont = document.getElementById('contenidos');
	var col = document.getElementById('col_izq');
	var cue = document.getElementById('cuerpo');

	if(con > 500){
		col.style.height=con+"px";
		cue.style.height=con+"px";
	} else {
		
		col.style.height='500px';
		cont.style.height='500px';
	}
}


/* *************************************************************************************************** */
// AJAX

function nuevoAjax(){
	var xmlhttp=false;
	 try {
	 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
		try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	 }
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	 xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
/* *************************************************************************************************** */
// Recomendar Notas
	function enviarNota(){
		var des, nom, enviado;
		enviado = document.getElementById('enviado');
		nom = document.getElementById('nombre').value;
		des = document.getElementById('destinatario').value;
		ajax=nuevoAjax();
		ajax.open("POST", "contenidos/enviar_nota.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==1) {
				enviado.innerHTML = '<img src=img/precarga.gif />'
			}
	
			else if (ajax.readyState==4) {
				enviado.innerHTML = ajax.responseText
			}
		}
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("nom="+nom+"&des="+des)
	}
/* *************************************************************************************************** */
// Comentar Notas
	function enviarComentario(){
		var des, nom, email, comentario, num_noticia, area, enviado;
		enviado = document.getElementById('enviado');
		nom = document.getElementById('nombre').value;
		email = document.getElementById('email').value;
		comentario = document.getElementById('comentario').value;
		num_noticia = document.getElementById('num_noticia').value;
		area = document.getElementById('area').value;
		ajax=nuevoAjax();
		ajax.open("POST", "contenidos/enviar_comentario.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==1) {
				enviado.innerHTML = '<img src=img/precarga.gif />'
			}
	
			else if (ajax.readyState==4) {
				enviado.innerHTML = ajax.responseText
			}
		}
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("nom="+nom+"&email="+email+"&comentario="+comentario+"&num_noticia="+num_noticia+"&area="+area)
	}
	
// Habilitar comentario	
	function habilitarComentario(id_noticia){
		var des, nom, email, comentario, num_noticia, area, enviado;
		enviado = document.getElementById('enviado');
		nom = document.getElementById('nombre').value;
		email = document.getElementById('email').value;
		comentario = document.getElementById('comentario').value;
		num_noticia = document.getElementById('num_noticia').value;
		area = document.getElementById('area').value;
		ajax=nuevoAjax();
		ajax.open("POST", "contenidos/enviar_comentario.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==1) {
				enviado.innerHTML = '<img src=img/precarga.gif />'
			}
	
			else if (ajax.readyState==4) {
				enviado.innerHTML = ajax.responseText
			}
		}
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("nom="+nom+"&email="+email+"&comentario="+comentario+"&num_noticia="+num_noticia+"&area="+area)
	}
/* *************************************************************************************************** */
// Guarda Pedido
	function guardarPedido(){
		var afiliado, dni, telefono, horario, email, medicamentos, enviado;
		enviado = document.getElementById('enviado');
		afiliado = document.getElementById('afiliado').value;
		dni = document.getElementById('dni').value;
		telefono = document.getElementById('telefono').value;
		horario = document.getElementById('horario').value;
		email = document.getElementById('email').value;
		medicamentos = document.getElementById('medicamentos').value;
		btn = document.getElementById('btn_env');
		if( (afiliado=="") || (dni=="") || (telefono=="") || (medicamentos=="") ){
			enviado.innerHTML = "<p align='center' class='rojo'><b>:: Falta completar datos :: </b></p>";
		}else{
			ajax=nuevoAjax();
			ajax.open("POST", "contenidos/guardar_pedido.php",true);
			ajax.onreadystatechange=function() {
				if (ajax.readyState==1) {
					btn.disabled="disabled";
					enviado.innerHTML = '<img src=img/precarga.gif />'
				}
		
				else if (ajax.readyState==4) {
					enviado.innerHTML = ajax.responseText
				}
			}
			ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			ajax.send("afiliado="+afiliado+"&dni="+dni+"&telefono="+telefono+"&horario="+horario+"&email="+email+"&medicamentos="+medicamentos)
		}
	}
/* *************************************************************************************************** */
// Guarda Consulta
	function guardarConsulta(){
		var destinatario, nya, telefono, paises, estados, consulta, email, enviado;
		enviado = document.getElementById('enviado');
		destinatario = document.getElementById('destinatario').value;
		nya = document.getElementById('nya').value;
		telefono = document.getElementById('telefono').value;
		paises = document.getElementById('paises').value;
		estados = document.getElementById('estados').value;
		email = document.getElementById('email').value;
		consulta = document.getElementById('consulta').value;
		ajax=nuevoAjax();
		ajax.open("POST", "contenidos/guardar_consulta.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==1) {
				enviado.innerHTML = '<img src=img/precarga.gif />'
			}
	
			else if (ajax.readyState==4) {
				enviado.innerHTML = ajax.responseText
			}
		}
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("destinatario="+destinatario+"&nya="+nya+"&telefono="+telefono+"&paises="+paises+"&email="+email+"&estados="+estados+"&consulta="+consulta)
	}
/* *************************************************************************************************** */
// Guarda Consulta Promotor
	function guardarConsultaPromotor(){
		var destinatario, nya, telefono, paises, estados, consulta, email, enviado, dire, tel1, horario1, tel2, horario2, cumple, obra_social, cambio, antig, cony, edad_cony, hijos, men_21, may_21, men_26, padres, rel_lab ;
		enviado = document.getElementById('enviado');
		destinatario = document.getElementById('destinatario').value;
		nya = document.getElementById('nya').value;
		telefono = document.getElementById('telefono').value;
		paises = document.getElementById('paises').value;
		estados = document.getElementById('estados').value;
		email = document.getElementById('email').value;
		dire = document.getElementById('dire').value;
		tel1 = document.getElementById('tel1').value;
		horario1 = document.getElementById('horario1').value;
		tel2 = document.getElementById('tel2').value;
		horario2 = document.getElementById('horario2').value;
		cumple = document.getElementById('cumple').value;
		obra_social = document.getElementById('obra_social').value;
		cambio = document.getElementById('cambio').value;
		antig = document.getElementById('antig').value;
		cony = document.getElementById('cony').value;
		edad_cony = document.getElementById('edad_cony').value;
		hijos = document.getElementById('hijos').value;
		men_21 = document.getElementById('men_21').value;
		may_21 = document.getElementById('may_21').value;
		men_26 = document.getElementById('men_26').value;
		padres = document.getElementById('padres').value;
		rel_lab = document.getElementById('rel_lab').value;
		consulta = document.getElementById('consulta').value;
		ajax=nuevoAjax();
		ajax.open("POST", "contenidos/guardar_consulta_prom.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==1) {
				enviado.innerHTML = '<img src=img/precarga.gif />'
			}
	
			else if (ajax.readyState==4) {
				enviado.innerHTML = ajax.responseText
			}
		}
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("destinatario="+destinatario+"&nya="+nya+"&telefono="+telefono+"&paises="+paises+"&email="+email+"&estados="+estados+"&dire="+dire+"&tel1="+tel1+"&horario1="+horario1+"&tel2="+tel2+"&horario2="+horario2+"&cumple="+cumple+"&obra_social="+obra_social+"&cambio="+cambio+"&antig="+antig+"&cony="+cony+"&edad_cony="+edad_cony+"&hijos="+hijos+"&men_21="+men_21+"&may_21="+may_21+"&men_26="+men_26+"&padres="+padres+"&rel_lab="+rel_lab+"&consulta="+consulta)
	}
/* *************************************************************************************************** */
// Tama�o de fuente
	function cambiarFuente(tipo){
		var fuenteActual, fuenteNueva;
		if(tipo=='C'){
			var texto=document.getElementById('cuerpo_fuente');
			fuenteActual=texto.style.fontSize;
			//fuenteNueva=fuenteActual;
			//alert(fuenteNueva);
			texto.style.fontSize='11px';
		}else{
			var texto=document.getElementById('cuerpo_fuente');
			fuenteActual=texto.style.fontSize;
			//fuenteNueva=fuenteActual;
			//alert(fuenteNueva);
			texto.style.fontSize='13px';
			tamDivNoticia();
		}
	}

/* *************************************************************************************************** */
// Devuelve la fecha actual

function darFecha(){
	fecha= new Date();
	dia=fecha.getDay();
	switch(dia)
	{
		case 0: document.write("Domingo "); break;
		case 1: document.write("Lunes "); break;
		case 2: document.write("Martes "); break;
		case 3: document.write("Mi�rcoles "); break;
		case 4: document.write("Jueves "); break;
		case 5: document.write("Viernes "); break;
		case 6: document.write("Sabado "); break;
	}	
	document.write(fecha.getDate()+" de ");
	mes=fecha.getMonth();
	switch(mes)
	{
		case 0: document.write("Enero"); break;
		case 1: document.write("Febrero"); break;
		case 2: document.write("Marzo"); break;
		case 3: document.write("Abril"); break;
		case 4: document.write("Mayo"); break;
		case 5: document.write("Junio"); break;
		case 6: document.write("Julio"); break;
		case 7: document.write("Agosto"); break;
		case 8: document.write("Septiembre"); break;
		case 9: document.write("Octubre"); break;
		case 10: document.write("Noviembre"); break;
		case 11: document.write("Diciembre"); break;
	}	
	document.write(" de "+fecha.getFullYear());
}
function showContent(vThis)
{
// http://www.javascriptjunkie.com
// alert(vSibling.className + " " + vDef_Key);
vParent = vThis.parentNode;
vSibling = vParent.nextSibling;
while (vSibling.nodeType==3) { // Fix for Mozilla/FireFox Empty Space becomes a TextNode or Something
vSibling = vSibling.nextSibling;
};
if(vSibling.style.display == "block")
{
vSibling.style.display = "none";
} else {
vSibling.style.display = "block";
}
return;
}

