function MM_openBrWindow(theURL,winName,features) { //v2.0 
window.open(theURL,winName,features); 
}



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];}
}


function validarFormulario(form) {


var validado=false;

	// comprueba si ha validado el formulario
	if (form.verificar.checked){ validado= true; } else { validado= false;}



	if (form.nombre.value == ""){
		alert ('Please enter the name, this information is required');
		form.nombre.focus();
		return false;
		}

	if (form.apellidos.value == ""){
		alert ('Please enter the surname, this information is required');
		form.apellidos.focus();
		return false;
		}
	
	// Comprueba si ha seleccionado el sexo
   var seleccionado= 'false';
	 for(var i=0; i <form.sexo.length; i++){
		if(form.sexo[i].checked){
		   seleccionado= 'true';
		   break;
		}
	  }

	
	if (seleccionado == 'false'){
      alert("Please enter the gender, this information is required");
      return false; 
	}
	
	
	if (form.direccion.value == ""){
		alert ('Please enter the postal address, this information is required');
		form.direccion.focus();
		return false;
		}
	
	if (form.cp.value == ""){
		alert ('Please enter the postal code, this information is required');
		form.cp.focus();
		return false;
		}	
		
	if (form.poblacion.value == ""){
		alert ('Please enter the city, this information is required');
		form.poblacion.focus();
		return false;
		}	
	
	if (form.provincia.value == ""){
		alert ('Please enter the province, this information is required');
		form.provincia.focus();
		return false;
		}	
		
	if (form.email.value == ""){
		alert ('Please enter the email address, this information is required');
		form.email.focus();
		return false;
		}	
	
	if (form.email.value != ""){
			if( !(/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(form.email.value)) ) {
			  	alert('Please enter a correct address Email');
			  	form.email.focus();
			  	return false;
		  	}
	}
	
	if (form.telefono.value == ""){
		alert ('Please enter the telephone, this information is required');
		form.telefono.focus();
		return false;
		}	
	
	
	// Comprueba tipo de trabajo
   var seleccionado3= 'false';
	 for(var i=0; i <form.tipoTrabajador.length; i++){
		if(form.tipoTrabajador[i].checked){
		   seleccionado3= 'true';
		   break;
		}
	  }

	
	if (seleccionado3 == 'false'){
      alert("You must indicate the type of position you are interested");
      return false; 
	}
	



	// Comprueba residencia
   var seleccionado2= 'false';
	 for(var i=0; i <form.cambioResidencia.length; i++){
		if(form.cambioResidencia[i].checked){
		   seleccionado2= 'true';
		   break;
		}
	  }

	
	if (seleccionado2 == 'false'){
      alert("You must indicate whether you would be willing to relocate");
      return false; 
	}
	
	
	if (form.paisTrabajar.selectedIndex==0){
		alert ('Please enter the country in which you would like to work');
		form.paisTrabajar.focus();
		return false;
		}

	
	
	<!-- comprueba si el fichero que se adjunta tiene el formáto válido -->
		
		if (form.archivo.value != ""){
			
			var fichero = form.archivo.value;
			var inicio = fichero.length-3;
			var tipoFichero = fichero.substring(fichero.length-3,fichero.length);
			
			if (tipoFichero != "doc"){
				alert ('The type of file "'+ tipoFichero +'"that you have entered is not the correct .\n Remember that the format is allowed doc');
				form.archivo.focus();
				return false;
			}
		
		} else {
			alert ('Please enter the curriculum vitae, this information is required');
			form.archivo.focus();
			return false;
		}

		
		if (form.codSeguridadUsuario.value == ""){
		alert ('Please enter the secure code, this information is required');
		form.codSeguridadUsuario.focus();
		return false;
		}	
		
		if (!validado){
		alert ('Please validate that you accept the terms of use');
		return false;
		}


		if (!validado){
		alert ('Please validate that you accept the terms of use');
		return false;
		}
		
		
return true;
}




function validarFormularioKO(form) {


var validado=false;

	// comprueba si ha validado el formulario
	if (form.verificar.checked){ validado= true; } else { validado= false;}



	if (form.nombre.value == ""){
		alert ('Please enter the name, this information is required');
		form.nombre.focus();
		return false;
		}

	if (form.apellidos.value == ""){
		alert ('Please enter the surnames, this information is required');
		form.apellidos.focus();
		return false;
		}
	
	// Comprueba si ha seleccionado el sexo
   var seleccionado= 'false';
	 for(var i=0; i <form.sexo.length; i++){
		if(form.sexo[i].checked){
		   seleccionado= 'true';
		   break;
		}
	  }

	
	if (seleccionado == 'false'){
      alert("Please enter the postal address, this information is required");
      return false; 
	}
	
	
	if (form.direccion.value == ""){
		alert ('Please enter the postal address, this information is required');
		form.direccion.focus();
		return false;
		}
	
	if (form.cp.value == ""){
		alert ('Por favor el codigo postal');
		form.cp.focus();
		return false;
		}	
		
	if (form.poblacion.value == ""){
		alert ('Please enter the city, this information is required');
		form.poblacion.focus();
		return false;
		}	
	
	if (form.provincia.value == ""){
		alert ('Please enter the province, this information is required');
		form.provincia.focus();
		return false;
		}	
		
	if (form.email.value == ""){
		alert ('Please enter the email address, this information is required');
		form.email.focus();
		return false;
		}	
	
	if (form.email.value != ""){
			if( !(/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(form.email.value)) ) {
			  	alert('Por favor introduzca un Email correcto');
			  	form.email.focus();
			  	return false;
		  	}
	}
	
	if (form.telefono.value == ""){
		alert ('Please enter the telephone, this information is required');
		form.telefono.focus();
		return false;
		}	
	
	
	// Comprueba si ha seleccionado el e-mail
   var seleccionado2= 'false';
	 for(var i=0; i <form.cambioResidencia.length; i++){
		if(form.cambioResidencia[i].checked){
		   seleccionado2= 'true';
		   break;
		}
	  }

	
	if (seleccionado2 == 'false'){
      alert("You must indicate whether you would be willing to relocate");
      return false; 
	}
	
	
		
	<!-- comprueba si el fichero que se adjunta tiene el formáto válido -->
		
		if (form.archivo.value != ""){
			
			var fichero = form.archivo.value;
			var inicio = fichero.length-3;
			var tipoFichero = fichero.substring(fichero.length-3,fichero.length);
			
			if (tipoFichero != "doc"){
				alert ('The type of file "'+ tipoFichero +'"that you have entered is not the correct .\n Remember that the format is allowed doc');
				form.archivo.focus();
				return false;
			}
		
		} else {
			alert ('Please enter the curriculum vitae, this information is required');
			form.archivo.focus();
			return false;
		}

		
		if (form.codSeguridadUsuario.value == ""){
		alert ('Please enter the secure code, this information is required');
		form.codSeguridadUsuario.focus();
		return false;
		}	
		
		
		if (!validado){
		alert ('Please validate that you accept the terms of use');
		return false;
		}

		
		if (!validado){
		alert ('Please validate that you accept the terms of use');
		return false;
		}
				
		
return true;
}


