$(document).ready(function() {

	var puntuarReceta = function(id) {
		$("div.puntuar_receta div").each(function(index) {
			$(this).removeClass("on");
			$(this).removeClass("off");
			if(index <= id) $(this).addClass("on"); else $(this).addClass("off");
		});
	}

	var valorarDificultad = function(id) {
		$("div.valorar_dificultad div").each(function(index) {
			$(this).removeClass("on");
			$(this).removeClass("off");
			if(index <= id) $(this).addClass("on"); else $(this).addClass("off");
		});
	}
		
	$("div.puntuar_receta div").each(function(index) {
		$(this).click(function(){ puntuarReceta(index); });
		$(this).click(function(){ $("div.puntuar_receta input").val(index+1); });
	});
		
	$("div.valorar_dificultad div").each(function(index) {
		$(this).click(function(){ valorarDificultad(index); });
		$(this).click(function(){ $("div.valorar_dificultad input").val(index+1); });
	});

	$("div.recomendar_amigo_si").click(function() {
		$("div.recomendar_amigo_no").css("filter","alpha(opacity=70)");
		$("div.recomendar_amigo_no").css("opacity","0.7");
		$(this).css("filter","alpha(opacity=100)");
		$(this).css("opacity","1");
		$("#Recomendar_amigo").val("si");
	});

	$("div.recomendar_amigo_no").click(function() {
		$("div.recomendar_amigo_si").css("filter","alpha(opacity=70)");
		$("div.recomendar_amigo_si").css("opacity","0.7");
		$(this).css("filter","alpha(opacity=100)");
		$(this).css("opacity","1");
		$("#Recomendar_amigo").val("no");
	});
	
});

var popUp = function(page,title) {
	var opts = 'top=50,width=400,height=500,scrollbars=1';
	window.open(page,title,opts);
}

