// JavaScript Document
$(document).ready(function(){
	
	
	
	
	$("#buscar").click( function(){
		var keyword = $("#txtbuscar").val()					   	
		buscar('productos.php',keyword)							
	});	
	
	
	$("#men_nosotros a").click(function(){
		$("#men_nosotros a").removeClass("activando_menu");
		$(this).addClass("activando_menu");
	});	
	
	$(".scrollable").scrollable({ vertical: true,mousewheel:true});

	
	$("#album ul li a").eq(0).find("img").show();
	$("#album ul li a").click(function(){
		$("#album ul li a").find("img").hide();
		$(this).find("img").fadeIn("slow");
	});
	
	$(".zoom").hover(
	 function(){ 
		$(this).next("img").css("opacity", 0.7); },
	 function(){ 
		$(this).next("img").css("opacity", 1);
	});


		/* =Reflection Nav
	-------------------------------------------------------------------------- */	
		
		// Append span to each LI to add reflection
		
		$("#nav-reflection li").append("<span></span>");	
		
		// Animate buttons, move reflection and fade
		
		$("#nav-reflection a").hover(function() {
		    $(this).stop().animate({ marginTop: "-10px" }, 200);
		    $(this).parent().find("span").stop().animate({ marginTop: "18px", opacity: 0.25 }, 200);
		},function(){
		    $(this).stop().animate({ marginTop: "0px" }, 300);
		    $(this).parent().find("span").stop().animate({ marginTop: "1px", opacity: 1 }, 300);
		});
				
	/* =Shadow Nav
	-------------------------------------------------------------------------- */
	
		// Append shadow image to each LI
		
		$("#nav-shadow li").append(/*'<img class="shadow" src="images/icons-shadow.jpg" width="81" height="27" alt="" />'*/);
	
		// Animate buttons, shrink and fade shadow
		
		$("#nav-shadow li").hover(function() {
		/*	var e = this;
		    $(e).find("a").stop().animate({ marginTop: "-14px" }, 450, function() {
		    	$(e).find("a").animate({ marginTop: "-10px" }, 450);
		    });
		    $(e).find("img.shadow").stop().animate({ width: "80%", height: "20px", marginLeft: "8px", opacity: 0.25 }, 250);
		},function(){
			var e = this;
		    $(e).find("a").stop().animate({ marginTop: "4px" }, 250, function() {
		    	$(e).find("a").animate({ marginTop: "0px" }, 250);
		    });
		    $(e).find("img.shadow").stop().animate({ width: "100%", height: "27px", marginLeft: "0", opacity: 1 }, 250);*/
		});

	
	
});

	
function search_enter(e) { 
	tecla = (document.all) ? e.keyCode : e.which; 
    if (tecla==13){
		buscar('productos.php',document.getElementById("txtbuscar").value);
	}
	return true;
}
function buscar(url,texto){
	location.replace(url+'?q='+ texto);
}

function busqueda(url,texto){
	
	document.fbuscar.action = url+'&q=' + texto.value;
	document.fbuscar.submit();
}

function checkTheKey(keyCode){
	if(event.keyCode==13){	
		valida();
		return true ;
	}
	return false ;
}

var testresults
function checkemail(value){
	var str = value
	var filter=/^.+@.+\..{2,3}$/
		if (filter.test(str))
		testresults=true
	else{
		alert("Por favor ingrese un e-mail valido...");
		testresults=false
	}
	return (testresults)
}


function validate_soporte(f1){
	if(f1.nombre.value == ""){
		alert("Por favor ingrese su apellido y nombres.");
		f1.nombre.focus();
		return false;
	}else if(f1.email.value == ""){
		alert("Por favor ingrese su email.");
		f1.email.focus();
		return false;
	}else if(checkemail(f1.email.value) == false){
		f1.email.focus();
		return false;
	}else if(document.getElementById("producto").value == ""){
		alert("Seleccione producto");
		document.getElementById("producto").focus();
		return false;
	}
}

function validate_disponibilidad(f1){
	if(f1.nombre.value == ""){
		alert("Por favor ingrese su apellido y nombres.");
		f1.nombre.focus();
		return false;
	}else if(document.getElementById("curso").value == ""){
		alert("Seleccione un curso");
		document.getElementById("curso").focus();
		return false;
	}else if(f1.email.value == ""){
		alert("Por favor ingrese su email.");
		f1.email.focus();
		return false;
	}else if(checkemail(f1.email.value) == false){
		f1.email.focus();
		return false;
	}
}

