/***************************************************/
/*****************DECISION**************************/
/***************************************************/
function decision(message, url)
	{
	if(confirm(message)) location.href = url;
	}

/***************************************************/
/*****************VENTANA***************************/
/***************************************************/
function ventana(pagina,ancho,alto) 
	{
	window.open(pagina, 'popup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+ancho+', height='+alto+', left = 100,top = 50');
	}

/***************************************************/
/*****************VALIDAR_EMAIL*********************/
/***************************************************/
function validarEmail(valor) 
	{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
		{
   		//alert("La dirección de email " + valor    + " es correcta.") 
   		return (true)
  		} else {
   		//alert("La dirección de email es incorrecta.");
   		return (false);
  		}
	}

/***************************************************/
/************VALIDA RECOMENDAR ARTICULO***************/
/***************************************************/
function Validar_Recomendar_Articulo() 
	{
	var sigue=true;
	var emailvalido = validarEmail(document.getElementById("email").value)
	
	if (document.getElementById("nombre").value == '')
		{
		sigue = false;
		mensaje_alerta= "Debe ingresar su Nombre.";
		}
	if (!emailvalido)
		{
		sigue = false;
		mensaje_alerta= "El email es invalido o esta en blanco.";
		}
	

	if (!sigue)
		{
		alert (mensaje_alerta)
		return false;
		}
		else 
		{
		return true;
		}
	}


/***************************************************/
/************VALIDA NUEVO ARTICULO***************/
/***************************************************/
function Validar_Nuevo_Articulo() 
	{
	var sigue=true;
	
	if (document.getElementById("titulo_articulo").value == '')
		{
		sigue = false;
		mensaje_alerta= "Debe ingresar un Titulo.";
		}
	if (document.getElementById("descripcion").value == '')
		{
		sigue = false;
		mensaje_alerta= "Debe ingresar una Descripcion.";
		}
	if (document.getElementById("categorias").value == '')
		{
		sigue = false;
		mensaje_alerta= "Debe ingresar al menos una Categoria.";
		}
	if (document.getElementById("articulo").value == '')
		{
		sigue = false;
		mensaje_alerta= "Debe ingresar un Texto.";
		}

	if (!sigue)
		{
		alert (mensaje_alerta)
		return false;
		}
		else 
		{
		return true;
		}
	}
	
function cambiarDisplay() {
  if (!document.getElementById) return false;
  fila1 = document.getElementById('pass1');
  fila2 = document.getElementById('pass2');
  if (fila1.style.display != "none" && fila2.style.display != "none") {
    fila1.style.display = "none"; //ocultar fila 
	fila2.style.display = "none";
  } else {
    fila1.style.display = ""; //mostrar fila 
	fila2.style.display = "";
  }
}