// JavaScript Document

//------------------ MARQUEE HOME -----------------------

function populate() {
	if (iedom){
		cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
		cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
		cross_marquee.innerHTML=marqueecontent
		actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
	} else if (document.layers) {
		ns_marquee=document.ns_marquee.document.ns_marquee2
		ns_marquee.left=parseInt(marqueewidth)+8
		ns_marquee.document.write(marqueecontent)
		ns_marquee.document.close()
		actualwidth=ns_marquee.document.width
	}
	lefttime=setInterval("scrollmarquee()",20)
}

function scrollmarquee(){
	if (iedom){
		if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
		cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
		else
		cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
	} else if (document.layers) {
		if (ns_marquee.left>(actualwidth*(-1)+8)) ns_marquee.left-=copyspeed
		else ns_marquee.left=parseInt(marqueewidth)+8
	}
}
//-----------------------
//-----------------------
function Suscripcion (nombre, email, boletin) {
	url = "pop_suscripcion.php?nombre=" + nombre + "&email=" + email + "&boletin=" + boletin;
	win = window.open (url, 'susc','top=50,left=50,width=400, height=300');
	win.focus();
}


function  ValidarSuscripcion(form) {
	var i;
	var j;
	var control = 0;

	Email = form.email.value;
	EmailLength = String(Email).length;

	Nombre = form.nombre.value;
	NombreLength= String(Nombre).length;

	Boletin = form.boletin.value;

	if (isNaN(Boletin))  {
		alert("Seleccione un Boletin" +Boletin);
		form.nombre.boletin();
		control++;
		return false;
	}

	if (Nombre == "")  {
		alert("Ingrese su nombre");
		form.nombre.focus();
		control++;
		return false;
	}

	NombreDummy = '';
	for (i = 0; i < NombreLength; i++)		{
		NombreDummy = String(NombreDummy) + " ";
	}

	if (String(Nombre) == String(NombreDummy) && String(Nombre).length > 0)	{
		alert("Ingrese su nombre");
		control++;
		return false;
	}


	if (Email == "")  {
		alert("Ingrese su correo electr&oacute;nico");
		form.email.focus();
		control++;
		return false;
	}

	EmailDummy = "";
	for (i = 0; i < EmailLength; i++) {
		EmailDummy = String(EmailDummy) + " ";
	}


	if (String(Email) == String(EmailDummy) && String(Email).length > 0)	{
		alert("Direcci&oacute;n de correo electr&oacute;nico inv&aacute;lida");
		form.email.focus();
		control++;
		return false;
	}

	if ((Email != "") && (String(Email).indexOf("@") != -1) && (String(Email).indexOf(".") != -1) )
	var emailChars =  true;
	else   {
		alert("Direcci&oacute;n de correo electr&oacute;nico inv&aacute;lida");
		form.email.focus();
		control++;
		return false;
	}

	if(control == 0) {
		Suscripcion (Nombre, Email, Boletin);
	}
	return false;

}




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_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_findObj(n, d) { //v4.01
	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 && d.getElementById) x=d.getElementById(n); return x;
}

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];}
}

