function validarRegistracion() {

	//valida que el campo nombre de usuario no este vacio
	if(document.registracion.usuario.value == ''){
		jAlert('Por favor ingres&aacute; tu nombre de usuario','Alerta', function(){document.registracion.usuario.focus();});
		return false;
	}

	if(document.registracion.email.value == ''){
		jAlert('Por favor ingres&aacute; tu email','Alerta', function(){document.registracion.email.focus();});
		return false;
	}


	//valida que el campo de contraseņa este bien ingresado
		if(document.registracion.password.value == ''){
		jAlert('Por favor ingres&aacute; tu contrase&ntilde;a','Alerta', function(){document.registracion.password.focus();});
		return false;
	}

	//valida que el campo de contraseņa este bien ingresado
	if(document.registracion.repassword.value == ''){
		jAlert('Por favor ingres&aacute; nuevamente tu contrase&ntilde;a','Alerta', function(){document.registracion.repassword.focus();});
		return false;
	}

	//valida que el campo de contraseņa este bien ingresado
	if(document.registracion.password.value != document.registracion.repassword.value){
		jAlert('Las contra&ntilde;as no coinciden.', 'Alerta', function(){document.registracion.repassword.focus();});
		return false;
	}

	//valida que el campo de contraseņa este bien ingresado
	if(document.registracion.nombre.value == ''){
		jAlert('Por favor ingrese su(s) nombre(s).', 'Alerta', function(){document.registracion.nombre.focus();});
		return false;
	}

	//valida que el campo de contraseņa este bien ingresado
	if(document.registracion.apellido.value == ''){
		jAlert('Por favor ingrese su(s) apellido(s).', 'Alerta', function(){document.registracion.apellido.focus();});
		return false;
	}

	//valida que el campo de contraseņa este bien ingresado
	if(document.registracion.captcha.value == ''){
		jAlert('Por favor ingrese codigo de seguridad.', 'Alerta', function(){document.registracion.captcha.focus();});
		return false;
	}


	//valida TERMINOS
	if(!document.registracion.aceptoterminos.checked){
		jAlert('Tiene que aceptar los terminos y condiciones para poder registrarse al sitio','Alerta', function(){document.registracion.aceptoterminos.focus();});
		return false;
	}

	return true;

}


function validarLogin() {
	//valida que el campo nombre de usuario no este vacio
	if(document.login.usuario.value == ''){
		jAlert('Por favor ingres&aacute; tu nombre de usuario','Alerta', function(){document.login.usuario.focus();});
		return false;
	}

	//valida que el campo de contraseņa este bien ingresado
		if(document.login.password.value == ''){
		jAlert('Por favor ingres&aacute; tu contrase&ntilde;a','Alerta', function(){document.login.password.focus();});
		return false;
	}

	return true;

}

function validarContacto() {
	if(document.contacto.nombre.value == ''){
		jAlert('Por favor ingres&aacute; tu nombre','Alerta', function(){document.contacto.nombre.focus();});
		return false;
	}
	if(document.contacto.email.value == ''){
		jAlert('Por favor ingres&aacute; tu email','Alerta', function(){document.contacto.email.focus();});
		return false;
	}
	if(document.contacto.comentario.value == ''){
		jAlert('Por favor ingres&aacute; tu comentario','Alerta', function(){document.contacto.comentario.focus();});
		return false;
	}

	return true;

}

function submitRegistracion(){
	if(validarRegistracion()){
		document.registracion.submit();
	}
	else
		return false;
}

function submitLogin(){
	if(validarLogin())
		document.login.submit();
	else
		return false;
}


function submitContacto(){
	if(validarContacto())
		document.contacto.submit();
	else
		return false;
}

function displayImage(newsId,imageId,totalImages){
	for(i = 0 ; i < totalImages ; i++){
		$("#image"+newsId+i).hide();
		$("#bt"+newsId+i).css({ color: "#666666"});
	}
	$("#image"+newsId+imageId).show();
	$("#bt"+newsId+imageId).css({ color: "#C7C5C5"});

}

