// JavaScript Document
function alerta (mensaje) {
	//alert (mensaje);
}

function activaBoton (num) {
	document.getElementById('mbot'+num).src="imagenesMenu/bot" + num + "_on.jpg";
}

function resetBotones () {
	for (var i=1; i<=7; i++) {
		document.getElementById('mbot'+i).src="imagenesMenu/bot"+i+"_off.jpg";
	}
}

function buscar() {
	
	resetBotones();
	
	var xmlHttp;
	try {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e) {
	  // Internet Explorer
	  try {
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e) {
		try {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e) {
		  alert("Your browser does not support AJAX!");
		  return false;
		}
	  }
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
		  document.getElementById('contenedorPrincipal').innerHTML=xmlHttp.responseText;
		}
	}
	searchquery = "busqueda=" + document.getElementById('query').value;
	xmlHttp.open("POST","seccion8.php",true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", searchquery.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(searchquery);
	
}

function activaSeccion(sec, subs, ints) {
	
	if (sec == undefined) {
		sec = 1;
	}
	if (subs == undefined) {
		subs = 1;
	}
	if (ints == undefined) {
		ints = 1;
	}
	
	resetBotones();
	activaBoton(sec);

	var xmlHttp;
	try {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e) {
	  // Internet Explorer
	  try {
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e) {
		try {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e) {
		  alert("Your browser does not support AJAX!");
		  return false;
		}
	  }
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
		  document.getElementById('contenedorPrincipal').innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET","seccion"+sec+".php?subs="+subs+"&ints="+ints,true);
	xmlHttp.send(null);
	
}

//FUNCIONES SECCION 2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function subseccion2 (num) {
	//alert(num);
	//resetea los botones
	for (var i=1; i<=4; i++) {
		document.getElementById('s2bot'+i).src="imagenesSeccion2/bot"+i+"_off.jpg";
	}
	//activa el boton
	document.getElementById('s2bot'+num).src="imagenesSeccion2/bot"+num+"_on.jpg";
	//actualiza la imagen
	document.getElementById('fotoSeccion2').src="imagenesSeccion2/pict"+num+".jpg";
	//actualiza el texto
	if (num == 2) {
		document.getElementById('textoSeccion2').innerHTML = "Somos un equipo de profesionales de la salud altamente calificados, cuyo propósito es inmunizar a las familias, ofreciendo los servicios de vacunación y seguimiento de  refuerzos en tiempos programados, disponemos de tecnología de vanguardia para el cuidado de la salud de las familias coadyuvando a que alcancen una mejor calidad de vida, en un marco de calidad, ética, innovación y humanismo.";
		document.getElementById('tituloSubSeccion').innerHTML = "Misión";
	} else if (num == 3) {
		document.getElementById('textoSeccion2').innerHTML = "En corto tiempo, ser una empresa líder en la aplicación de vacunas, ofertando productos y servicios innovadores, para lograr el posicionamiento a nivel nacional y ser reconocidos por nuestros usuarios como un Centro de Calidad en el manejo y aplicación de biológicos.";
		document.getElementById('tituloSubSeccion').innerHTML = "Visión";
	} else if (num == 4) {
		document.getElementById('textoSeccion2').innerHTML = "* La combinación de conocimiento y experiencia genera confianza en nuestros usuarios.<br /><br />* Nuestros pacientes son nuestra razón de ser.<br /><br />* Nuestros productos innovadores y de calidad son la clave para un mejor futuro.<br /><br />* Honestidad, trabajo en equipo, mejora continua, calidad e integridad son nuestros valores.";
		document.getElementById('tituloSubSeccion').innerHTML = "Filosofía y Valores";
	} else {
		document.getElementById('textoSeccion2').innerHTML = "Somos una empresa líder en la aplicación de vacunas, ofrecemos productos y servicios innovadores, disponemos de alta tecnología para el cuidado de la salud de las familias.";
		document.getElementById('tituloSubSeccion').innerHTML = "Quiénes Somos";
	}
}


//--------------------------------------------------------------------------------------------------------------------------------------

//FUNCIONES SECCION 3 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function subseccion3 (num) {
	//alert(num);
	//resetea los botones
	for (var i=1; i<=3; i++) {
		document.getElementById('s3bot'+i).src="imagenesSeccion3/bot"+i+"_off.jpg";
	}
	//activa el boton
	document.getElementById('s3bot'+num).src="imagenesSeccion3/bot"+num+"_on.jpg";
	
	//actualiza el contenido
	var xmlHttp;
	try {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e) {
	  // Internet Explorer
	  try {
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e) {
		try {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e) {
		  alert("Your browser does not support AJAX!");
		  return false;
		}
	  }
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
		  document.getElementById('contenedorSeccion3').innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET","seccion3-"+num+".html",true);
	xmlHttp.send(null);
}


//--------------------------------------------------------------------------------------------------------------------------------------

//FUNCIONES SECCION 4 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function subseccion4 (num) {
	//alert(num);
	//resetea los botones
	for (var i=1; i<=2; i++) {
		document.getElementById('s4bot'+i).src="imagenesSeccion4/bot"+i+"_off.jpg";
	}
	//activa el boton
	document.getElementById('s4bot'+num).src="imagenesSeccion4/bot"+num+"_on.jpg";
	
	//actualiza el contenido
	var xmlHttp;
	try {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e) {
	  // Internet Explorer
	  try {
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e) {
		try {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e) {
		  alert("Your browser does not support AJAX!");
		  return false;
		}
	  }
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
		  document.getElementById('contenedorSeccion4').innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET","seccion4-"+num+".html",true);
	xmlHttp.send(null);
}


//--------------------------------------------------------------------------------------------------------------------------------------

//FUNCIONES SECCION 5 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function subseccion5 (num) {
	//alert(num);
	//resetea los botones
	for (var i=1; i<=4; i++) {
		document.getElementById('s5bot'+i).src="imagenesSeccion5/bot"+i+"_off.jpg";
	}
	//activa el boton
	document.getElementById('s5bot'+num).src="imagenesSeccion5/bot"+num+"_on.jpg";
	
	//actualiza el contenido
	var xmlHttp;
	try {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e) {
	  // Internet Explorer
	  try {
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e) {
		try {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e) {
		  alert("Your browser does not support AJAX!");
		  return false;
		}
	  }
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
		  document.getElementById('contenedorSeccion5').innerHTML=xmlHttp.responseText;
		}
	}
	if (num == 4) {
		xmlHttp.open("GET","seccion5-"+num+".php",true);
		xmlHttp.send(null);		
	} else {
		xmlHttp.open("GET","seccion5-"+num+".html",true);
		xmlHttp.send(null);
	}
}


//--------------------------------------------------------------------------------------------------------------------------------------
