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_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_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];}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function minibuscador(){
if(document.mini.keyword.value.length<4){
alert('la cadena de búsqueda debe tener 4 ó más caracteres');
return;
}
document.mini.submit();
}
function minibuscador2(){
document.mini.submit();
}
var paisesComunitarios = new Array("Andorra", "Alemania", "Austria", "Bélgica", "Chipre", "Dinamarca", "España", "Eslovaquia", "Eslovenia", "Estonia", "Finlandia", "Francia", "Grecia", "Holanda", "Hungría", "Irlanda", "Islandia", "Italia", "Letonia", "Liechtenstein", "Lituania", "Luxemburgo", "Malta", "Noruega", "Polonia", "Portugal", "Reino Unido", "República Checa", "Suecia")
function cambioTextFocus(){
		valor = document.infocursos.domicilio.value;
		if (valor == "Calle, Pza, Avda,...") {
			document.infocursos.domicilio.value = "";
			document.infocursos.domicilio.style.fontStyle = 'normal';
		} else {document.infocursos.domicilio.style.fontStyle = 'normal';}
}
function cambiaPais(form){
	if(form.pais.options[form.pais.selectedIndex].value=="España"){
		form.provincia.value="";
		form.Noprovincia.value="";
		cambiaNacion(form);
		document.getElementById('NoprovinciaTexto').style.display='none';
		document.getElementById('provinciaTexto').style.display='block';
	} else{
		form.provincia.value="";
		form.Noprovincia.value="";
		cambiaNacion(form);
		document.getElementById('NoprovinciaTexto').style.display='block';
		document.getElementById('provinciaTexto').style.display='none';
   }
}
function cambiaNacion(form){
	queNacion = form.nacionalidad.options[form.nacionalidad.selectedIndex].value;
	quePais = form.pais.options[form.pais.selectedIndex].value
	if (queNacion != "") {
		if((!es_pais_europeo(form.nacionalidad.options[form.nacionalidad.selectedIndex].value)) && (quePais=="España" || quePais=="Andorra")){
			document.getElementById('NIETexto').style.display='block';
		    document.getElementById('NIFTexto').style.display='none';
		} else{
			document.getElementById('NIETexto').style.display='none';
		    document.getElementById('NIFTexto').style.display='block';
		}
	}
}
function tipoConociste(){
	//Inicialización de los campos
	nodoCampos = new Array('verinternet','verradio','verrevistas','verfolleto','verprensa','verteletexto','vertelevision');
	for(i=0;i<nodoCampos.length;i++){
		document.getElementById(nodoCampos[i]).style.display = "none";
	}
	var tipo = document.infocursos.conocistes.options[document.infocursos.conocistes.selectedIndex].value;
	switch (tipo){
		case "Internet":
			document.getElementById("verinternet").style.display = "";
			break;
		case "Radio":
			document.getElementById("verradio").style.display = "";
			break;
		case "Revistas":
			document.getElementById("verrevistas").style.display = "";
			break;
		case "Folleto en Revista":
			document.getElementById("verfolleto").style.display = "";
			break;
		case "Prensa":
			document.getElementById("verprensa").style.display = "";
			break;
		case "Televisión":
			document.getElementById("vertelevision").style.display = "";
			break;
		case "Teletexto":
			document.getElementById("verteletexto").style.display = "";
			break;
	}
}
function es_pais_europeo(valor){
	es = false;
	for(i=0;i<paisesComunitarios.length;i++) {
		if (valor == paisesComunitarios[i]) {
			es = true;
			break
		}
	}
	return es;
}
function validarinfocursos(){
curso2=document.infocursos.curso.selectedIndex;
nombre=document.infocursos.nombre.value;
apellidos=document.infocursos.apellidos.value;
direccion=document.infocursos.domicilio.value;
numero=document.infocursos.num.value;
codigopostal=document.infocursos.cp.value;
poblacion=document.infocursos.poblacion.value;
nacionalidad=document.infocursos.nacionalidad.selectedIndex;
DNINIF=document.infocursos.DNINIF.value;
dia=document.infocursos.dia.selectedIndex;
mes=document.infocursos.mes.selectedIndex;
ano=document.infocursos.ano.selectedIndex;
telefono1=document.infocursos.telefono1.value;
telefono2=document.infocursos.telefono2.value;
email=document.infocursos.email.value;
document.getElementById('ccurso').style.backgroundColor = '#FFFFFF';
if(!curso2){
alert('Debe seleccionar un Curso');
document.getElementById('ccurso').style.backgroundColor = '#d1d0c1';
document.infocursos.curso.focus();
return false;
}

document.getElementById('cnombre').style.backgroundColor = '#FFFFFF';
if(nombre==''){
alert('El campo Nombre no se ha completado correctamente');
document.getElementById('cnombre').style.backgroundColor = '#d1d0c1';
document.infocursos.nombre.focus();
return false;
}
document.getElementById('capellidos').style.backgroundColor = '#FFFFFF';
if(apellidos==''){
alert('El campo Apellidos no se ha completado correctamente');
document.getElementById('capellidos').style.backgroundColor = '#d1d0c1';
document.infocursos.apellidos.focus();
return false;
}
document.getElementById('cdomicilio').style.backgroundColor = '#FFFFFF';
if(direccion=='' || direccion=='Calle, Pza, Avda,...'){
alert('El campo Dirección no se ha completado correctamente');
document.getElementById('cdomicilio').style.backgroundColor = '#d1d0c1';
document.infocursos.domicilio.focus();
return false;
}
document.getElementById('cnum').style.backgroundColor = '#FFFFFF';
if(numero==''){
alert('El campo Número no se ha completado correctamente');
document.getElementById('cnum').style.backgroundColor = '#d1d0c1';
document.infocursos.num.focus();
return false;
}
document.getElementById('ccp').style.backgroundColor = '#FFFFFF';
if(codigopostal==''){
alert('El campo Código Postal no se ha completado correctamente');
document.getElementById('ccp').style.backgroundColor = '#d1d0c1';
document.infocursos.cp.focus();
return false;
}
document.getElementById('cpoblacion').style.backgroundColor = '#FFFFFF';
if(codigopostal==''){
alert('El campo Población no se ha completado correctamente');
document.getElementById('cpoblacion').style.backgroundColor = '#d1d0c1';
document.infocursos.poblacion.focus();
return false;
}
document.getElementById('cnacionalidad').style.backgroundColor = '#FFFFFF';
if(!nacionalidad){
alert('Debe seleccionar su Nacionalidad');
document.getElementById('cnacionalidad').style.backgroundColor = '#d1d0c1';
document.infocursos.nacionalidad.focus();
return false;
}
document.getElementById('cDNINIF').style.backgroundColor = '#FFFFFF';
if(DNINIF==''){
alert('El campo DNI/NIF/NIE no se ha completado correctamente');
document.getElementById('cDNINIF').style.backgroundColor = '#d1d0c1';
document.infocursos.DNINIF.focus();
return false;
}
document.getElementById('cdia').style.backgroundColor = '#FFFFFF';
if(!dia){
alert('Debe seleccionar su Día de Nacimiento');
document.getElementById('cdia').style.backgroundColor = '#d1d0c1';
document.infocursos.dia.focus();
return false;
}
document.getElementById('cmes').style.backgroundColor = '#FFFFFF';
if(!mes){
alert('Debe seleccionar su Mes de Nacimiento');
document.getElementById('cmes').style.backgroundColor = '#d1d0c1';
document.infocursos.mes.focus();
return false;
}
document.getElementById('cano').style.backgroundColor = '#FFFFFF';
if(!ano){
alert('Debe seleccionar su Año de Nacimiento');
document.getElementById('cano').style.backgroundColor = '#d1d0c1';
document.infocursos.ano.focus();
return false;
}
document.getElementById('cemail').style.backgroundColor = '#FFFFFF';
if(email=='' || email.indexOf('@')==-1 ||  email.indexOf('.')==-1 ){
alert('El campo E-mail no se ha completado correctamente');
document.getElementById('cemail').style.backgroundColor = '#d1d0c1';
document.infocursos.email.focus();
return false;
}
document.getElementById('ctelefono1').style.backgroundColor = '#FFFFFF';
if(telefono1=='' && telefono2==''){
alert('Uno de los dos teléfonos es obligatorio');
document.getElementById('ctelefono1').style.backgroundColor = '#d1d0c1';
document.infocursos.telefono1.focus();
return false;
}
return true;
}
function pulsar(e) { 
	tecla = (document.all) ? e.keyCode :e.which; 
	return (tecla!=46); 
} 
function validar(){
var datoscom=new Array('nombre','comentarios');
var trad=new Array('Nombre y Apellidos','Comentarios');
var mail=document.f1.email.value;
for(i=0;i<datoscom.length;i++){
elem=eval("document.f1."+datoscom[i]+".value");
nom=trad[i];
men="Por favor complete el campo "+nom+"";
if(elem==''){alert(men);
eval("document.f1."+datoscom[i]+".focus();");
return;}
}
var filter=/^[A-Za-z]+\.*\-*\_*[A-Za-z0-9_\-]*@[A-Za-z0-9_\-]+\.[A-Za-z0-9_.]+[A-za-z]$/;
if(filter.test(mail)==0 || mail.length==0){
alert('Por favor ingrese o reingrese su e-mail');
document.f1.email.focus();
return;
}
document.f1.submit();
}
function ir_a(url){
	if(url!='http://www.educvirtual.info/competencias/' && url!='http://217.15.40.6/bm2005/indexcomp.asp'){
		window.parent.location=url;
	}else{
		window.open(url,'','');
	}
}