function alCargarPestanas() {
	var seccion = document.getElementById("seccion").value;
	if (seccion == "Conocenos") {
		document.getElementById('tabConocenos').className='imgMenuConocenos_seleccionado';
	}else if (seccion == "NuestrosProductos"){
		document.getElementById("tabProductos").className='imgMenuProductos_seleccionado';
	}else if (seccion == "TusRecetas"){
		document.getElementById("tabRecetas").className='imgMenuRecetas_seleccionado';
	}else if (seccion == "Nutricion"){
		document.getElementById("tabNutricion").className='imgMenuNutricion_seleccionado';
	}else if (seccion == "Soluciones"){
		document.getElementById("tabSoluciones").className='imgMenuSoluciones_seleccionado';
	}
}

function alCargar() {
	change_image();
}

function change_image() {
	var valor_ran = get_random();
	/*if (valor_ran >= 0 && valor_ran < 4) {
		document.getElementById("fondo1_portada_recetas").style.backgroundImage="url(imagenes/fondo_portada_recetas_2.jpg)";
	}
	else {
		
		document.getElementById("fondo1_portada_recetas").style.backgroundImage="url(imagenes/fondo_portada_recetas_3.jpg)";
		/*
		if (valor_ran >= 4 && valor_ran < 8) {
			document.getElementById("fondo1_portada_recetas").style.backgroundImage="url(imagenes/fondo_portada_recetas_2.jpg)";
		}
		else {
			document.getElementById("fondo1_portada_recetas").style.backgroundImage="url(imagenes/fondo_portada_recetas_3.jpg)";
		}*/
	/*}*/
	
}

function get_random()
{
    var ranNum= Math.floor(Math.random()*11);
    return ranNum;
}

function buscaRecetas() {
	new_action = "/Tus-recetas/Recetario/buscador/" + document.getElementById('buscador_recetas_input').value;
	document.location.href = new_action;
}


function validaEmail() {
	var valor = document.getElementById("email_receta_amigo_to").value;
	var valor_2 = document.getElementById("email_receta_amigo_subject").value;
	var valor_3 = document.getElementById("email_receta_amigo_nombre").value;
	
	if (valor_3 == null || valor_3 == "" || valor_3.length == 0 || valor_3.length > 100) {
		alert("La longitud de tu nombre est&aacute; afuera de los l�mites permitidos (m�ximo 100 caracteres)");
		return false;
	}
	
	if (valor == null || valor == "" || valor.length == 0 || valor.length > 200) {
		alert("La longitud de la direcci�n del correo electr�nico est� afuera de los l�mites permitidos (m�ximo 200 caracteres)");
		return false;
	}
	
	if (valor_2 == null || valor_2 == "" || valor_2.length == 0 || valor_2.length > 500) {
		alert("La longitud del asunto del correo electr�nico est� afuera de los l�mites permitidos (m�ximo 500 caracteres)");
		return false;
	}
	
	return true;
}

function enviaRecetaEmail() {
	if (validaEmail()==true) {
                document.getElementById('recetaEnviaAmigo').submit();
		/*var action = document.getElementById("email_id_receta").value;
		action = action + "&email_to=" + document.getElementById("email_receta_amigo_to").value;
		action = action + "&email_subject=" + document.getElementById("email_receta_amigo_subject").value;
		action = action + "&email_nombre=" + document.getElementById("email_receta_amigo_nombre").value;
		//action = action + "&email_body=" + document.getElementById("ficha_receta_completa").innerHTML;
		document.location.href = action;*/
	}
}

function showEmail() {
	var showmode = document.getElementById("capa_envia_receta_amigo").style.display;
	if (showmode == "none") {
		document.getElementById("capa_envia_receta_amigo").style.display = "block";
	}
	else {
		document.getElementById("capa_envia_receta_amigo").style.display = "none";
	}
}

function puntuaReceta(value) {
	var action_puntua = "/Tus-recetas/Recetario/votar/" + document.getElementById("email_id_receta").value + "_" + value;
	document.location.href = action_puntua;
}

