//<!----

function validate(theForm){
	nombreusuario = theForm.nombreusuario.value;
	email = theForm.email.value;
	clave = theForm.clave.value;
	repetirclave = theForm.repetirclave.value;

	if (nombreusuario ==""){
		alert ("debe ingresar su nombre de usuario");
		theForm.nombreusuario.focus();
		return false;
	} 
	if (!isEmail(email)){
		alert ("debe ingresar su email de usuario");
		theForm.email.focus();
		return false;
	}
	if (clave ==""){
		alert ("debe ingresar su clave de usuario");
		theForm.clave.focus();
		return false;
	} 
	if (repetirclave ==""){
		alert ("debe ingresar la repeticion de su clave de usuario");
		theForm.repetirclave.focus();
		return false;
	} 

	if (clave != repetirclave){
		alert ("La clave y su repeticion no coinciden");
		theForm.clave.focus();
		return false;
	} 
	
	return true;
	
}


function userToFactura(theForm){
	userNombre = theForm.userNombre.value;
	userApellido = theForm.userApellido.value;
	userRut = theForm.userRut.value;
	userDigito = theForm.userDigito.value;
	userTelefono = theForm.userTelefono.value;

	if (theForm.copiar.checked == true){
		theForm.razonsocial.value = userNombre + ' ' + userApellido;
		theForm.giro.value = 'Particular';
		theForm.rutfactura.value = userRut;
		theForm.rutDigito.value = userDigito;
		theForm.fonofactura.value = userTelefono;
	} else {
		theForm.razonsocial.value = '';
		theForm.giro.value = '';
		theForm.rutfactura.value = '';
		theForm.fonofactura.value = '';
		theForm.rutDigito.value = '';
	}	
	return false;
}

function userToDespacho(theForm){
	userNombre = theForm.userNombre.value;
	userApellido = theForm.userApellido.value;
	userTelefono = theForm.userTelefono.value;

	if (theForm.copiardatos.checked == true){
		theForm.nombre.value = userNombre;
		theForm.apellido.value = userApellido;
		theForm.fono.value = userTelefono;
	} else {
		theForm.nombre.value = '';
		theForm.apellido.value = '';
		theForm.fono.value = '';
	}	
	return false;
}

// ---->


