document.write("<script type='text/javascript' src='../languajes/idiomas.js'></script>");
function comprueba_login(idioma){
	var ob = document.registro;
	var err = 0;
	var txt = introduccion[idioma]+":"+"<ul>";
	txt += (ob.f_password.value != ob.f_rpassword.value) ? '<li>'+contrasena_iguales[idioma]+'</li>': '';
	txt += (ob.f_password.value.length<6) ? '<li>'+contrasena_caracteres[idioma]+'</li>':'';
	txt += (!mailVALIDO(ob.f_mail.value)) ? '<li>'+mail_invalido[idioma]+'</li>': '';
	txt += (ob.f_nombre.value == "") ? '<li>'+nombre[idioma]+'</li>':'';
	txt += (ob.f_apellidos.value == "") ? '<li>'+apellido[idioma]+'</li>':'';
	txt += (ob.f_direccion.value == "") ? '<li>'+direccion[idioma]+'</li>':'';
	txt += (ob.f_cpostal.value == "") ? '<li>'+cp[idioma]+'</li>':'';
	txt += (ob.f_poblacion.value == "") ? '<li>'+provincia[idioma]+'</li>':'';
	//txt += (ob.f_pais.value == "") ? '<li>Pais':'';
	txt += (ob.f_telefono.value == "") ? '<li>'+telefono[idioma]+'</li>':'';
	
	if((ob.select_pais.value!='20') && (ob.select_pais.value!='00')) ob.f_pais.value=ob.select_pais.value;
	else if((ob.select_pais.value=='20') && (ob.alt_pais.value!='')) ob.f_pais.value=ob.alt_pais.value;
	else txt += '<li>'+pais[idioma]+'</li>';
	
	if(ob.txt_dia.value != ''){//Ha introducido la fecha de nacimiento
		txt += (esFecha(ob)) ? '':'<li>'+fecha[idioma]+'</li>';
	}
	txt += "</ul>";
	if(txt != introduccion[idioma]+":<ul></ul>") {
		document.getElementById('Campos_erroneos').innerHTML = txt;	
	}
	else{
		ob.f_nacimiento.value=ob.txt_anio.value + '-' + ob.txt_mes.value + '-' + ob.txt_dia.value;
		ob.submit();
	}
	
}

function mailVALIDO(texto){
	var mailres = true;             
    var cadena = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890@._-"; 
     
    var arroba = texto.indexOf("@",0); 
    if ((texto.lastIndexOf("@")) != arroba) arroba = -1; 
     
    var punto = texto.lastIndexOf("."); 
                 
     for (var contador = 0 ; contador < texto.length ; contador++){ 
        if (cadena.indexOf(texto.substr(contador, 1),0) == -1){ 
            mailres = false; 
            break; 
     } 
    } 

    if ((arroba > 1) && (arroba + 1 < punto) && (punto + 1 < (texto.length)) && (mailres == true) && (texto.indexOf("..",0) == -1)) 
     mailres = true; 
    else 
     mailres = false; 
                 
    return mailres; 
}
function esFecha(formu)
{
	var elDia=formu.txt_dia.value;
	var elMes=formu.txt_mes.value-1;
	var elAnio=formu.txt_anio.value;
	var ff = new Date(elAnio, elMes, elDia);
	if ( ff.getDate() != elDia ) return false;
	if ( ff.getMonth() != elMes ) return false;
	if ( ff.getFullYear() != elAnio ) return false;
	return true;
}
function nuevoITEM(modelo,ref,talla,precio){
v_talla = document.fSIZE.f_talla.value;
if(v_talla==0) document.getElementById('error').innerHTML = 'Select your size';
else{
var URL = "additem.php?id="+modelo+"&nombre="+ref+"&talla="+talla+"&precio="+precio;
document.location = URL;

}
return false;
}
function cambia(vista_mod){
	document.foto_G.src='img/'+vista_mod+'.jpg';
}

function compruba_conforme(formulario){
	if((formulario.f_privacidad.checked) && (formulario.f_condiciones.checked)) formulario.submit();
	else {
	 document.getElementById('politica_cc').style.border = "1px solid #FF00FF";
	  document.getElementById('politica_cc').style.background = "#FFA6A6";
	  scrollit();
	 return false;
	}
}
function compruba_conforme2(formulario){
	if((formulario.f_privacidad.checked) && (formulario.f_condiciones.checked)){
	formulario.p.focus();
	return true;
	}
	else {
	  formulario.p.blur();
	  document.getElementById('politica_cc').style.border = "1px solid #FF00FF";
	  document.getElementById('politica_cc').style.background = "#FFA6A6";
	  parent.scroll(0,0);
	 return false;
	}
}
function scrollit(){ 
	for (I=50; I>=0; I--){ 	
		parent.scroll(10,I)  
	}
}   
