function ValidaCamposPuntos() {
mensaje = "";
	/*validacion del formulario*/
	for (var i=0;i<document.formulario.length;i++){
		obj=document.formulario.elements[i].name;
			//alert(document.formulario.elements[i].name);
			if ( obj=="nameUser" ){ 
				objForm=document.formulario.nameUser.value;
				var NomObj="Para";
				validoVacio(objForm,NomObj);
			}
			if ( obj=="motivo" ){ 
				objForm=document.formulario.motivo.value;
				var NomObj="Motivo";
				validoVacio(objForm,NomObj);
			}
			if ( obj=="cantidad" ){ 
				objForm=document.formulario.cantidad.value;
				var NomObj="Puntos";
				vacio=validoVacio(objForm,NomObj);
				numero=numeroEntero(objForm,NomObj);
				if (numero==true && vacio == true){
					maximo=document.formulario.cant_max.value;
					if( objForm==0){
						mensaje += "\n     - "+ NomObj +" (Los puntos a enviar NO puede ser cero.)";
					}else if ( ( parseInt (objForm) ) > ( parseInt (maximo) ) ) { 
						mensaje += "\n     - "+ NomObj +" (No puede enviar mas puntos de los acumulados.)";
					}else if ( ( parseInt (maximo) ) == 0 ) { 
						mensaje += "\n     - "+ NomObj +" (No tiene puntos para enviar.)";
					}
				}
			}

	}
	/*Formatear mensaje de salida*/
	if (mensaje != "") {
		mensaje ="_____________________________\n" +
			"Te ha faltado introducir los siguientes datos:\n" +
		mensaje + "\n_____________________________" +
			"\n Por favor pulsa enter, revisa el item marcados y reintentalo.";
		alert(mensaje);
		return false;
	}else{ 
		if ( confirm("¿Es seguro que quiere enviar estos puntos?") ) {
			return true
		}else return false
	}
}

function numeroEntero(objForm,NomObj){
	var ubicacion;
	var caracteres = "0123456789"; 
	var contador = 0;
	for (var j=0; j < objForm.length; j++) 
	{
		ubicacion = objForm.substring(j, j + 1)
		if (caracteres.indexOf(ubicacion) != -1) 
		{
		  contador++
		} else {
			mensaje += "\n     - "+ NomObj +" (Debe se numero entero.)";
			return false;
		}
	}
	return true;
}

function validoVacio(objForm,NomObj){
		if (objForm == "" || objForm == null ) {
			mensaje += "\n     - "+ NomObj +" (No puede estar vacio.)";
			return false;
		}else return true;
}

function validaCkeck(){
	for(var i = 0; i < document.formulario.length; i++){
		if(document.formulario.elements[i].checked)return true;
	}
	alert('Debes seleccionar algún mensaje para ejecutar.');
	return false;
}

function ValidaCampos() {
mensaje = "";
	/*validacion del formulario*/
	for (var i=0;i<document.formulario.length;i++){
		obj=document.formulario.elements[i].name;
			//alert(document.formulario.elements[i].name);
			if ( obj=="nameUser" ){ 
				objForm=document.formulario.nameUser.value;
				var NomObj="Para";
				validoVacio(objForm,NomObj);
			}
			if ( obj=="asunto" ) {
				objForm=document.formulario.asunto.value;
				var NomObj="Asunto";
				validoVacio(objForm,NomObj);
			}
			if ( obj=="mensaje" ){
				objForm=document.formulario.mensaje.value;
				var NomObj="Mensaje";
				validoVacio(objForm,NomObj);
			}
	}
	/*Formatear mensaje de salida*/
	if (mensaje != "") {
		mensaje ="_____________________________\n" +
			"Te ha faltado introducir los siguientes datos:\n" +
		mensaje + "\n_____________________________" +
			"\n Por favor pulsa enter, revisa el item marcados y reintentalo.";
		alert(mensaje);
		return false;
	}else return true;
}
function compruebaCambio(){
		if ( confirm("¿Es seguro que relizar el cambio?") ) {
			return true;
		}else return false;
}


 
///////
