// JavaScript Document

function validarUser(f) {
    
    document.getElementById('mail').style.backgroundColor='#ffffff';
    document.getElementById('password').style.backgroundColor='#ffffff';
    document.getElementById('name').style.backgroundColor='#ffffff';
    document.getElementById('empresa').style.backgroundColor='#ffffff';
    document.getElementById('cp').style.backgroundColor='#ffffff';
    document.getElementById('cif').style.backgroundColor='#ffffff';
    document.getElementById('pais').style.backgroundColor='#ffffff';
    document.getElementById('ciudad').style.backgroundColor='#ffffff';
    //document.getElementById('check').style.backgroundColor='#ffffff';
    document.getElementById('tipo').style.backgroundColor='#ffffff';
    document.getElementById('categoria1').style.backgroundColor='#ffffff';
    
    document.getElementById('web').style.backgroundColor='#ffffff';
    document.getElementById('tel').style.backgroundColor='#ffffff';
    
    document.getElementById('con').style.backgroundColor='#ffffff';

	//if(f.mail.value=='' || f.password.value=='' || f.name.value=='' || f.empresa.value==''|| f.cp.value=='' || f.cif.value=='' || f.pais.value==''|| f.ciudad.value=='' || f.check.value=='' || f.tipo.value=='' || f.categoria1.value=='') {
	if(f.mail.value=='' || f.password.value=='' || f.name.value=='' || f.empresa.value==''|| f.cp.value=='' || f.cif.value=='' || f.pais.value==''|| f.ciudad.value=='' || f.tipo.value=='' || f.categoria1.value=='') {
		document.getElementById('error').style.display="block";
		document.getElementById('error').innerHTML="<span class=\"L\"></span><span class=\"R\"></span>"+MSG_216;
		
		if (f.mail.value=='') {
		    document.getElementById('mail').style.backgroundColor='#fbf7bd';
		}
		if (f.password.value=='') {
		    document.getElementById('password').style.backgroundColor='#fbf7bd';
		}
		if (f.name.value=='') {
		    document.getElementById('name').style.backgroundColor='#fbf7bd';
		}
		if (f.empresa.value=='') {
		    document.getElementById('empresa').style.backgroundColor='#fbf7bd';
		}
		if (f.cp.value=='') {
		    document.getElementById('cp').style.backgroundColor='#fbf7bd';
		}
		if (f.cif.value=='') {
		    document.getElementById('cif').style.backgroundColor='#fbf7bd';
		}
		if (f.pais.value=='') {
		    document.getElementById('pais').style.backgroundColor='#fbf7bd';
		}
		if (f.ciudad.value=='') {
		    document.getElementById('ciudad').style.backgroundColor='#fbf7bd';
		}
		/*
		if (f.check.value=='') {
		    document.getElementById('check').style.backgroundColor='#fbf7bd';
		}
		*/
		if (f.tipo.value=='') {
		    document.getElementById('tipo').style.backgroundColor='#fbf7bd';
		}
		if (f.categoria1.value=='') {
		    document.getElementById('categoria1').style.backgroundColor='#fbf7bd';
		}
		
		return false;
	}

	if(isEmail(f.mail)==false){
		document.getElementById('error').style.display="block";
		document.getElementById('mail').style.background="#fbf7bd";
		f.mail.focus();
		return false;
		}


	if(isPassword(f.password)==false){
		document.getElementById('error').style.display="block";
		document.getElementById('password').style.background="#fbf7bd";
		f.password.focus();
		return false;
		}

	if(isText100(f.name)==false){
		document.getElementById('error').style.display="block";
		document.getElementById('name').style.background="#fbf7bd";
		f.name.focus();
		return false;
		}

	if(isEmpresa(f.empresa)==false){
		document.getElementById('error').style.display="block";
		document.getElementById('empresa').style.background="#fbf7bd";
		f.empresa.focus();
		return false;
		}

	/*
	if(isCif(f.cif)==false){
		document.getElementById('error').style.display="block";
		document.getElementById('cif').style.background="#fbf7bd";
		f.cif.focus();
		return false;
		}
		*/

	if(f.web.value != ''){
		if(isWeb(f.web)==false){
			document.getElementById('error').style.display="block";
			document.getElementById('web').style.background="#fbf7bd";
			f.cif.focus();
			return false;
		}
	}

	if(isText50(f.cp)==false){
		document.getElementById('error').style.display="block";
		document.getElementById('cp').style.background="#fbf7bd";
		f.cp.focus();
		return false;
		}

	if(isText50(f.ciudad)==false){
		document.getElementById('error').style.display="block";
		document.getElementById('ciudad').style.background="#fbf7bd";
		f.ciudad.focus();
		return false;
		}

	if(f.tel.value != ''){
		if(isTel(f.tel)==false){
			document.getElementById('error').style.display="block";
			document.getElementById('tel').style.background="#fbf7bd";
			f.tel.focus();
			return false;
		}
	}
	if(f.password.value != f.passconf.value){
		document.getElementById('error').style.display="block";
		document.getElementById('error').innerHTML="<span class=\"L\"></span><span class=\"R\"></span>"+MSG_217;
		return false;
		}

	if(f.con.checked== false){
		document.getElementById('error').style.display="block";
		document.getElementById('error').innerHTML="<span class=\"L\"></span><span class=\"R\"></span>"+MSG_218;
		document.getElementById('con').style.backgroundColor='#fbf7bd';
		return false;
		}

}

function validarLopUs(I){
		if(isText50(I)==false){
			document.getElementById('user').style.backgroundColor="#fbf7bd";
			document.getElementById('result').innerHTML= "<div class=\"Error\"><span class=\"L\"></span><span class=\"R\"></span>"+MSG_219+"</div>";
			return false;
		}else{
		document.getElementById('user').style.backgroundColor="#ffffff";
		document.getElementById('result').innerHTML="";
		return true;
		}
	}

function validarLopPass(I){
		if(isPassword(I)==false){
			document.getElementById('pass').style.backgroundColor="#fbf7bd";
			document.getElementById('result').innerHTML= "<div class=\"Error\"><span class=\"L\"></span><span class=\"R\"></span>"+MSG_219+"</div>";
			return false;
		}else{
			document.getElementById('pass').style.backgroundColor="#ffffff";
			document.getElementById('result').innerHTML= "";
			return true;
		}
	}


