// JavaScript Document
var error = 'Por favor completa los siguientes campos:\n\n';
function validarForm(form) {
	var a = "";
	if (form.nombre.value=="") {a+="Nombre Completo\n";}
	if (form.tel.value=="") {a+="Teléfono \n";}
	if (form.mail.value=="") {a+="E-mail \n";}
	if (form.msj.value=="") {a+="Mensaje \n";}
	
	if (a!="") {alert(error+a); return true;}
	form.submit();
	}

function LeftBar(Static,Float,Add) {
	
	var DivLeft = document.getElementById(Static).offsetParent.offsetLeft;
	if (DivLeft == 0) { DivLeft = document.getElementById(Static).offsetLeft; }
	
	var NewLeft = DivLeft + Add 
	var NewLefT = NewLeft+"px";
	document.getElementById(Float).style.left = NewLefT;
	var NL = document.getElementById(Float).style.left;

	}

function bgCol (div,color) {
	document.getElementById(div).style.backgroundColor = color;
	}

function HeightDiv() {
	var DivLeft = document.getElementById("DivLeft").offsetHeight;
	var DivRight = document.getElementById("DivRight").offsetHeight;
	var DivCenter = document.getElementById("DivCenter").offsetHeight+10;

	if (DivCenter>DivRight) {Hth= DivCenter;} else {Hth= DivRight;}
	document.getElementById("DivLeft").style.height = (Hth-80)+"px";
 } 

function HeightDiv2() {
	var DivBottom = document.getElementById("DivBottom").offsetHeight;
	var DivCenter = document.getElementById("DivCenter").offsetHeight+10;
	var Hth=400;
	
	if (DivCenter>DivBottom) {Hth= DivCenter;} else {Hth= DivBottom;}
	document.getElementById("DivBottom").style.height = (Hth-190)+"px";
 } 

function Marco(ident) {
	var DivTop = document.getElementById("Imags").offsetTop;
	var DivLeft = document.getElementById("Imags").offsetLeft;	
	var DivCenter = document.getElementById(ident);

DivCenter.style.top = (DivTop-0)+"px";
DivCenter.style.left = (DivLeft-0)+"px";

} 
 

function valida_submenus (form) {
	var a = "";
	if (document.getElementById("titulo").value=="") {a+="El campo de título no puede estar vacío\n";}
 if (a!="") {alert(a); return true;}
 form.submit();
	}
	
var segundos = 10; //cada cuantos segundos cambia la imagen
var dire = "mediafiles" //directorio o ruta donde están las imágenes

var imagenes=new Array(); var Txt = new Array();
imagenes[0]="img_1.jpg"
Txt[0]="<h2>Mujer Salva tu vida</h2>";
imagenes[1]="img_2.jpg"
Txt[1]="<h2>Cada 2 horas muere una mujer por cáncer cervicouterino</h2>";
imagenes[2]="img_3.jpg"
Txt[2]="<h2>¡Es una enfermedad 100% curable si se detecta a tiempo!  </h2>";
imagenes[3]="img_4.jpg"
Txt[3]="<h2>Comprometidas en mejorar tu calidad de vida,  llevamos 12 años realizando 16,000 estudios  anuales. </h2> ";	

if(dire != "" && dire.charAt(dire.length-1) != "/")
	{dire = dire + "/"}
var preImagenes = new Array()
for (pre = 0; pre < imagenes.length; pre++){
	preImagenes[pre] = new Image()
	preImagenes[pre].src = dire + imagenes[pre]
}
cont=0
function presImagen(){
	document.foto.src= dire + imagenes[cont]
	document.getElementById("textCont").innerHTML= Txt[cont]
	subeOpacidad()
	if (cont < imagenes.length-1)
		{cont ++}
	else
		{cont=0}
	tiempo=window.setTimeout('bajaOpacidad()',segundos*1000)
}
var iex = navigator.appName=="Microsoft Internet Explorer" ? true : false;
var fi = iex?'filters.alpha.opacity':'style.MozOpacity'
var opa = iex ? 100 : 1;
function bajaOpacidad(){
	opa = 0
	cambia()
	presImagen()
}

function subeOpacidad(){
	opaci = iex?100:1;
	if(opa <= opaci){
		cambia()
		opa += iex?10: 0.1;
		setTimeout('subeOpacidad()',10)
	}
}

function cambia(){
	eval('document.foto.' + fi + ' = opa')
}
var tiempo
function inicio(){
	clearTimeout(tiempo)
	bajaOpacidad()
}

function crea_popup(URL,h,w) {
window.open(URL,"ventana","width="+w+",height="+h+",resizable=1,scrollbars=1") 
}
