/*function cargaRuedaImg(imagen,div){
	var obj = document.getElementById(div); 
	var peticion = false; 
	if (window.XMLHttpRequest) { 
    	peticion = new XMLHttpRequest(); 
    } else if (window.ActiveXObject) { 
        peticion = new ActiveXObject("Microsoft.XMLHTTP"); 
	}
	if(peticion) { 
		var url=imagen;
     	peticion.open("GET", url);   //
     	peticion.onreadystatechange = function()  {
		if(peticion.readyState == 1){
			$(div).startWaiting('images/loading.gif');
		}
			if (peticion.readyState == 4) { 
				$(div).stopWaiting();
         		obj.innerHTML = peticion.responseText;
		   	} 
     	} 
		peticion.send(null); 
	}
} 
*/

function validar_curriculum(f){
	if(f.dni.value==""){
		alert("Debes introducir tu DNI");
		return false;
	}
	if(f.nombre.value==""){
		alert("Debes introducir tu nombre");
		return false;
	}
	if(f.apellidos.value==""){
		alert("Debes introducir tus apellidos");
		return false;
	}
	if(f.email.value==""){
		alert("Debes introducir tu email");
		return false;
	}
	if(f.contrasena.value==""){
		alert("Debes introducir la contraseña");
		return false;
	}
	return true;
}

function validar_empresa_oferta(f){
	if(f.nombre.value==""){
		alert("Debes introducir el nombre de la empresa");
		return false;
	}
	if(f.email.value==""){
		alert("Debes introducir tu email");
		return false;
	}
	if(f.sector.value==""){
		alert("Debes introducir el sector de la oferta");
		return false;
	}
	if(f.titulo.value==""){
		alert("Debes introducir el titulo de la oferta");
		return false;
	}
	return true;
}

function validarregistrocurriculum(f){
		if(f.email.value==""){
			alert("Debes introducir tu e-mail");
			f.email.focus();
			return false;
		} else { 
			if(f.email.value!=""){
				var str=f.email.value;
				var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
				if (filter.test(str)){
					testresults=true;
				}else{
					alert("El E-mail no es correcto");
					f.email.focus();
					return false;
				}
			}
		}
		if(f.contrasena.value==""){
			alert("Debes introducir la contraseña");
			f.contrasena.focus();
			return false;
		}
		return true;
}

function validarmailcurriculum(f){
		if(f.email.value==""){
			alert("Debes introducir tu e-mail");
			f.email.focus();
			return false;
		} else { 
			if(f.email.value!=""){
				var str=f.email.value;
				var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
				if (filter.test(str)){
					testresults=true;
				}else{
					alert("El E-mail no es correcto");
					f.email.focus();
					return false;
				}
			}
		}
		if(f.cod_uno.value==""){
			alert("Debes introducir el código de la imagen");
			f.cod_uno.focus();
			return false;
		}
		return true;
}

function cambio_color_azul(celda,enlace_id){
	var obj=document.getElementById(celda);
	var enlace=document.getElementById(enlace_id);
	obj.style.backgroundColor='#006699';
	enlace.style.color="#FFFFFF";
}
function cambio_color_blanco(celda,enlace_id){
	var obj=document.getElementById(celda);
	var enlace=document.getElementById(enlace_id);
	enlace.style.color="#006699";
	obj.style.backgroundColor='#FFFFFF';
	
}

function iluminar_linea(linea){
	var obj = document.getElementsByName(linea); 
    for (i = 0; i< obj.length; i++) { 
		obj[i].style.backgroundColor='#669900';
		obj[i].style.color='#FFFFFF';
	}
}

function no_iluminar_linea(linea){
	var obj = document.getElementsByName(linea); 
    for (i = 0; i< obj.length; i++) { 
		obj[i].style.backgroundColor='#FFFFFF';
		obj[i].style.color='#000000';
	}
}


function ObtenerDatos(datos,divID) { 
	var obj = document.getElementById(divID); 
	var peticion = false; 
	if (window.XMLHttpRequest) { 
    	peticion = new XMLHttpRequest(); 
    } else if (window.ActiveXObject) { 
        peticion = new ActiveXObject("Microsoft.XMLHTTP"); 
	}
	if(peticion) { 
		var url=datos;
     	peticion.open("GET", url);   //
     	peticion.onreadystatechange = function()  { 
        	/*if (peticion.readyState == 1) { 
				obj.innerHTML="<img src='images/cargando.jpg' alt=cargando width='601' height='447'>";
		   	}*/
			if (peticion.readyState == 4) { 
         		obj.innerHTML = peticion.responseText;
		   	} 
     	} 
		peticion.send(null); 
	}
	
}


function MostrarFilas(Fila) { 
var elementos = document.getElementsByName(Fila); 
    for (i = 0; i< elementos.length; i++) { 
        if(navigator.appName.indexOf("Microsoft") > -1){ 
               var visible = 'block'; 
        } else { 
               var visible = 'table-row'; 
        } 
elementos[i].style.display = visible; 
        } 
} 
  
function OcultarFilas(Fila) { 
    var elementos = document.getElementsByName(Fila); 
    for (k = 0; k< elementos.length; k++) { 
         elementos[k].style.display = "none"; 
    } 
}  




function validarmail(f){
	var aux=f.cod_uno.value.toUpperCase();
	if(aux==f.cod_dos.value && f.cod_uno.value!="" && f.cod_dos.value!=""){
		if(!f.proteccion.checked){
			alert("Debes leer y aceptar las condiciones de la Ley de Protección de Datos");
			return false;
		}
		return true;
	}else{
		alert("Rellena el codigo de la imagen");
		return false;
	}
	
}


//////////Codigo galeria fotografica/////////////

function ObtenerDatosGaleria(divID,id,pos) { 
	var imagen = document.getElementById("id_imagen");

	if(pos!="no"){
		imagen.value=pos;
	}
	var obj = document.getElementById(divID); 
	var peticion = false; 
	if (window.XMLHttpRequest) { 
    	peticion = new XMLHttpRequest(); 
    } else if (window.ActiveXObject) { 
        peticion = new ActiveXObject("Microsoft.XMLHTTP"); 
	}
	if(peticion) { 
		var url='galeria_auxiliar.php?id=' + id;
     	peticion.open("GET", url);   //
     	peticion.onreadystatechange = function()  { 
        	if (peticion.readyState == 4) { 
         		obj.innerHTML = peticion.responseText;
		   	} 
     	} 
		peticion.send(null); 
	}
}

function bucle(){
	var imagen = document.getElementById("id_imagen");
	
	if(imagen.value<9){
		imagen.value=eval(imagen.value + "+ 1");
	} else {
		imagen.value=0;
	}
	aux=imagen.value;
	return aux;
}

var matriz=new Array(9);

function MoverFoto() { 
	var cadena=document.getElementById("sw");
	var aux2;
	var aux=cadena.value;
	
	for(i=0;i<10;i++){
		if(aux.substr(0,1)!=""){
			if(aux.substr(2,1)!="" && aux.substr(2,1)!="-"){
				matriz[i]=aux.substr(0,3);
				aux=aux.substr(4);
			}else{
				if(aux.substr(1,1)!="" && aux.substr(1,1)!="-"){
					matriz[i]=aux.substr(0,2);
					aux=aux.substr(3);
				}else{
					matriz[i]=aux.substr(0,1);
					aux=aux.substr(2);
				}
			}			
		}else{
			matriz[i]="";
		}
	}
if(matriz[2]!=""){
		setInterval("aux2=bucle();if(eval(matriz[aux2]!='')){ObtenerDatosGaleria('foto', eval(matriz[aux2]),'no');}else{ObtenerDatosGaleria('foto', eval(matriz[0]),'0');}",4000);
}
}

//////////Fin codigo galeria fotografica/////////////