function validaEncuesta(){
	if (!document.getElementById('radio1').checked && !document.getElementById('radio2').checked)
	//alert('Debe seleccionar una opcion');
	return;

	else{

		document.getElementById('fEncuesta').submit();
	}
}

function validaPublicarComentario(){
	if (document.getElementById('comentario').value == ""){
		alert("Por favor, introduzca su comentario");
		document.getElementById('comentario').focus();
		return;
	}
	else if (document.getElementById('tx_usuario').value == ""){
		alert("Por favor, introduzca su nombre de usuario");
		document.getElementById('tx_usuario').focus();
		return;
	}
	else{
		document.getElementById('frmProcesarComentario').submit();

	}
}

function validarComentario(){
	if (document.getElementById('participante_concurso_nombre').value == ""){
		alert("Por favor, introduzca su nombre");
		document.getElementById('participante_concurso_nombre').focus();
		return;
	}
	

	else if (document.getElementById('participante_concurso_provincia').value == ""){
		alert("Por favor, seleccione la provincia a la que pertenece");
		document.getElementById('participante_concurso_provincia').focus();
		return;
	}		
	
	else if (document.getElementById('participante_concurso_edad').value == ""){
		alert("Por favor, introduzca su edad");
		document.getElementById('participante_concurso_edad').focus();
		return;
	}	
	else if (isNaN(document.getElementById('participante_concurso_edad').value) && document.getElementById('participante_concurso_edad').value != "")    {
		alert("Por favor, introduzca una edad valida");
		document.getElementById('participante_tipo_participacion').focus();
		return;
	}
	


	else if (document.getElementById('participante_concurso_mail').value != "")    {
		if (isEmail(document.getElementById('participante_concurso_mail').value) ==  false){
			alert('Email invalido');
			document.getElementById('participante_concurso_mail').focus();
			return;
		}
	}



	else if (document.getElementById('participante_tipo_participacion').value == ""){
		alert("Por favor,seleccione tipo de participacion");
		document.getElementById('participante_tipo_participacion').focus();
		return;
	}
	else if (document.getElementById('participante_concurso_texto').value == ""){
		alert("Por favor,introduzca el texto de su comentario");
		document.getElementById('participante_concurso_texto').focus();
		return;
	}
	else{
		document.getElementById('frmNinnosComentan').submit();

	}
}


function validarParticipacionConcurso(){
	if (document.getElementById('participante_concurso_nombre').value == ""){
		alert("Por favor, introduzca su nombre");
		document.getElementById('participante_concurso_nombre').focus();
		return;
	}

	else if (document.getElementById('participante_concurso_provincia').value == ""){
		alert("Por favor, seleccione la provincia a la que pertenece");
		document.getElementById('participante_concurso_provincia').focus();
		return;
	}		
	
	else if (document.getElementById('participante_concurso_edad').value == ""){
		alert("Por favor, introduzca su edad");
		document.getElementById('participante_concurso_edad').focus();
		return;
	}		
	else if (isNaN(document.getElementById('participante_concurso_edad').value) && document.getElementById('participante_concurso_edad').value != "")    {
		alert("Por favor, introduzca una edad valida");
		document.getElementById('participante_tipo_participacion').focus();
		return;
	}

	else if (isWhitespace(document.getElementById('participante_concurso_mail').value)){
		alert("Por favor, introduzca su dirección de correo electrónico");
		document.getElementById('participante_concurso_mail').focus();

		return;
	}

	else if (!isEmail(document.getElementById('participante_concurso_mail').value)){
		alert('Dirección de correo electrónico inválida');
		document.getElementById('participante_concurso_mail').focus();

	}

	else if (document.getElementById('participante_concurso_titulo').value == ""){
		alert("Por favor, introduzca el titulo del trabajo");
		document.getElementById('participante_concurso_titulo').focus();
		return;
	}


	else if (document.getElementById('participante_concurso_adjunto').value == ""){
		alert("Por favor, seleccione el fichero de su trabajo");
		document.getElementById('participante_concurso_adjunto').focus();
		return;
	}
	else{
		document.getElementById('frmInscripcionConcurso').submit();

	}
}

function validarClubMariposa(){
	if (document.getElementById('participante_concurso_nombre').value == ""){
		alert("Por favor, introduzca su nombre");
		document.getElementById('participante_concurso_nombre').focus();
		return;
	}

	else if (document.getElementById('participante_concurso_provincia').value == ""){
		alert("Por favor, seleccione la provincia a la que pertenece");
		document.getElementById('participante_concurso_provincia').focus();
		return;
	}

	else if (document.getElementById('tx_ocupacion').value == ""){
		alert("Por favor, introduzca su ocupaci&oacute;n");
		document.getElementById('tx_ocupacion').focus();
		return;
	}


	else if (isWhitespace(document.getElementById('participante_concurso_mail').value)){
		alert("Por favor, introduzca su dirección de correo electrónico");
		document.getElementById('participante_concurso_mail').focus();

		return;
	}

	else if (!isEmail(document.getElementById('participante_concurso_mail').value)){
		alert('Dirección de correo electrónico inválida');
		document.getElementById('participante_concurso_mail').focus();

	}
	/*
	else if (document.getElementById('numero_hijos').value == ""){
	alert("Por favor, introduzca su número de hijos");
	document.getElementById('numero_hijos').focus();
	return;
	}
	*/

	else if (isNaN(document.getElementById('numero_hijos').value) && document.getElementById('numero_hijos').value != "")    {
		alert("Por favor, introduzca un número válido");
		document.getElementById('numero_hijos').focus();
		return;
	}


	else if (document.getElementById('numero_hijos').value != 0 && document.getElementById('edad_hijos').value == "")    {
		alert("Por favor, introduzca las edades de sus hijos");
		document.getElementById('edad_hijos').focus();
		return;
	}


	else{
		document.getElementById('frmClubMariposa').submit();

	}
}



function checkUrl(){
	/*location_str = String(this.location);

	if(location_str.substr(location_str.length-1,1) == '/')
	this.location = location_str.substr(0,location_str.length-1);
	*/
	current = String(document.getElementById('link_home').href);

	if(current.substr(current.length-1,1) == '/'){
		document.getElementById('link_home').href = current.substr(0,current.length-1);
	}

	//alert(this.location);
}

function validaEmail(url){
	var correo = document.getElementById('correo_input').value;
	if (isWhitespace(correo)){
		alert("Por favor, introduzca su dirección de correo electrónico");
		return;
	}

	if (isEmail(correo)){
		document.getElementById('frmSuscripcion').action = url;
		document.getElementById('frmSuscripcion').submit();
	}
	else{
		alert('Dirección de correo electrónico inválida');
	}

}

