$(document).ready(function () {
	$("ul.menu2 li a[data-bg]").hover(function () {
		if ($(this).hasClass("active")) return;
		$(this).css("background-color","#"+$(this).attr("data-bg"));
	},
	function () {
		if ($(this).hasClass("active")) return;
		$(this).css("background-color","");
	});

	$('#gallery a').lightBox();
	
/*
	$("#texto_busqueda").click(function() {
		if ($(this).attr("value") == "buscar")
			$(this).attr("value", "");
	});
	
	$("#texto_busqueda").blur(function() {
		if ($(this).attr("value") == "")
			$(this).attr("value", "buscar");
	});
*/
	
});

	// ****** Click en un proyecto del menu lateral
	//$("div.menu_proyectos > div.carril > div.menupro > div.menu > a").click(function (e) {
		//e.preventDefault();
	function enviarAmigo() {
		var data = {};
		var self = this;
		data = $("form[name='formulario']").serialize();
		
		$.ajax({
			//url: $(self).attr("href"),
			url: '/enviafriend.php',
			type: "post",
			contentType: "application/x-www-form-urlencoded; charset=utf-8",
			data: data,
			beforeSend: function () {
				//$("img.on").remove();
				//var aux = $('<img class="on" src="/images/bgmenupro_on.png" />');
				//aux.insertAfter($(self));
			},
			success: function (r) {
				//var r = $('<div>'+r+'</div>');
				//var cont = r.find("div.main_proyectos").html();				
				//$("div.main_proyectos").html(cont);
				//eventosProyecto();
				if (r != "") {
					$("input[name='captcha']").css("border-color","red").focus();
					alert(r);
				}
				else {
					$("#enviaramigo").fadeOut('slow', function() {
						$("#exitoamigo").fadeIn();
					});
				}
			}
		});		
	}
//	});
