$(document).ready(function(){
	$('#slideshow').cycle({
		fx:     'fade',
		speed:    300,
	});
						   
//References
	var sections = $("#menu li");

	var op2 = $("#op2");
	var op3 = $("#op3");
	var op4 = $("#op4");
	var op5 = $("#op5");
	var op6 = $("#op6");

	//Cambia estados de los botones
	sections.click(function(){
		switch(this.id){

			case "op2":
			cleanmenu();
			op2.addClass("op2actual");
			break;
			case "op3":
			cleanmenu();
			op3.addClass("op3actual");
			break;
			case "op4":
			cleanmenu();
			op4.addClass("op4actual");
			break;
			case "op5":
			cleanmenu();
			op5.addClass("op5actual");
			break;
			case "op6":
			cleanmenu();
			op6.addClass("op6actual");
			//envio_datos();
			break;
		}
	});

	//limpia los estados sobre
	function cleanmenu(){
		op2.removeClass("op2actual");
		op3.removeClass("op3actual");
		op4.removeClass("op4actual");
		op5.removeClass("op5actual");
		op6.removeClass("op6actual");

	};


	$("#menu ul li a").each(function(){
		var href = $(this).attr("href");
		$(this).attr({ href: "#"});
		$(this).click(function(){
			$("#content").fadeOut(400,function(){
				//$("#content").load(href);

				$.ajax({
					type: "POST",
					url: href,
					success: function(msg){
						$("#content").html(msg);
						$("#content").fadeIn(400);
						if(href == 'seis.html'){
							envio_datos();
						}
					}

				});


			});
		});
	});
	
});


