function validarCamposComentarios(){	
	if(trim(document.getElementById('txtNombre').value)==''){
		window.alert("Introduzca Nombre.");
		document.getElementById('txtNombre').select();
		document.getElementById('txtNombre').focus();
	}else{			
		if(!(validarTextoCorreo(document.getElementById('txtEmail').value))){
			window.alert("Introduzca E-mail Correcto.");
			document.getElementById('txtEmail').select();
			document.getElementById('txtEmail').focus();
		}else{
			if(trim(document.getElementById('txtComentario').value)==''){
				window.alert("Introduzca Comentario.");
				document.getElementById('txtComentario').select();
				document.getElementById('txtComentario').focus();
			}else{
				insertarRegistro();
			}
		}
	}
}

function validarCamposLoginUserClasificados(){	
	if(trim(document.getElementById('user').value)==''){
		window.alert("Introduzca Usuario.");
		document.getElementById('user').select();
		document.getElementById('user').focus();
	}else{			
		if(trim(document.getElementById('pass').value)==''){
			window.alert("Introduzca Password.");
			document.getElementById('pass').select();
			document.getElementById('pass').focus();
		}else{
			insertarRegistro();
		}
	}
}

function validarCamposHemeroteca(){
	if(!(validarFecha(document.getElementById('txtFecha').value))){
		window.alert("Introduzca Fecha correcta.");
		document.getElementById('txtFecha').select();
		document.getElementById('txtFecha').focus();
	}else{
		insertarRegistro();
	}	
}

function validarPrioridad(){
	if(document.getElementById('cmbPosicion').value==0){
		window.alert("Seleccione una posición para la nota");
	}else{
		if(document.getElementById('cmbPrioridad').value==0){
			window.alert("Seleccione una prioridad para la nota");
		}else{
			insertarRegistro();
		}
	}
}

function validarPrioridadEstatal(){
	if(document.getElementById('cmbPosicion').value==0){
		window.alert("Seleccione una posición para la nota");
	}else{
		if(document.getElementById('cmbPrioridad').value==0){
			window.alert("Seleccione una prioridad para la nota");
		}else{
			if(document.getElementById('cmbLocalidad').value==0){
				window.alert("Seleccione una Localidad");
			}else{
				insertarRegistro();
			}
		}
	}
}

function validarPrioridadOpinion(){
	if(!(validarFecha(document.getElementById('txtFecha').value))){
		window.alert("Introduzca Fecha correcta.");
		document.getElementById('txtFecha').select();
		document.getElementById('txtFecha').focus();
	}else{
		if(document.getElementById('cmbPrioridad').value==0){
			window.alert("Seleccione una prioridad para la nota");
		}else{
			insertarRegistro();
		}
	}
}

function validarFecha(cFecha){      
    if (/^(0?[1-9]|1[0-9]|2|2[0-9]|3[0-1])-(0?[1-9]|1[0-2])-(\d{2}|\d{4})$/.test(cFecha)){
         return true
    }else{            
        return false;
   }                   
}

function validarTextoCorreo(sCorreo){      
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(sCorreo)){
         return true
    }else{            
        return false;
   }                   
}

//Función que permite introducir sólo valores numéricos enteros
function digita_numeros_enteros(e){	
	var key = window.event ? e.keyCode : e.which;
	if ( (key == 8) || (key ==0)){
		return true;
	}
	var keychar = String.fromCharCode(key);
	reg = /\d/;
	return reg.test(keychar);
}

function trim(sString){
	while (sString.substring(0,1) == ' '){
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' '){
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}




