// Documento JavaScript
$(document).ready(function(){

	//Efecto correr la imagen
	/*$(".button").mouseover(function() { $("img", this).animate({left:"-10px"},200); });
	$(".button").mouseout(function() { $("img", this).animate({ left:"-1px" },200); });*/

	//Efecto devanecimiento del menú
	/*$(".fade").dwFadingLinks({
		color: "#66a2bc",
		duration: 700
	});*/

	//Scroll animado
 	$('a.scroll').click(function(e){
 		//console.log(e.target);
 		e.preventDefault();
 		var nava = $(e.target).closest('a').attr('href');
 		$('html, body').animate({
 		scrollTop: $(nava).offset().top
 		}, 500,function(){
 		   });
 		
 	});
	
	// Menú navegación Hover
	$('#menu a').hover(function(){
			$(this).find('img').stop().animate({marginTop: '-25px'}, 300);
		},function(){
			$(this).find('img').stop().animate({marginTop: '0px'}, 300);
	});	
	
	//Sobre mí
	// Imagen esfuerzo
	$("#esfuerzo").hover(
	function() {
	$("img", this).stop().animate({"opacity": "0"}, 300);
	},
	function() {
	$("img", this).stop().animate({"opacity": "1"}, 300);
	});
	
	// Servicios
	$('#numeros li').hover(function(){
		$(this).find('img').stop().animate({marginTop: '-110px'}, 200)
	},function(){
		$(this).find('img').stop().animate({marginTop: '0'}, 200)
	});	
	
	//Cambio de imagen en servicios
	$(".sobre").hover(
	function() {
	$("img.a", this).stop().animate({"opacity": "0"}, 300);
	},
	function() {
	$("img.a", this).stop().animate({"opacity": "1"}, 300);
	});
	
	// Portfolio
	$('#menu_ver li').hover(function(){
		$(this).find('img').stop().animate({marginTop: '-24px'}, 200)
	},function(){
		$(this).find('img').stop().animate({marginTop: '0'}, 200)
	});	
	
	//Cambio de imagen en Portfolio
	$(".hoverpicture").hover(
	function() {
	$("img.a", this).stop().animate({"opacity": "0"}, 300);
	},
	function() {
	$("img.a", this).stop().animate({"opacity": "1"}, 300);
	});
	
	//Botones del Portfolio
	$(".disenoWeb_btn").click(function () {
	$(".branding_t").each(function (index, domEle) {
		$(domEle).hide("slow");
	});
	$(".disenoWeb_t").show("slow");
	$(".grafica_t").hide("slow");
	$(".multimedia_t").hide("slow");
	});
	$(".todo_btn").click(function () {
		$(".branding_t").show("slow");
		$(".disenoWeb_t").show("slow");
		$(".grafica_t").show("slow");
		$(".multimedia_t").show("slow");
	});
	$(".branding_btn").click(function () {
		$(".branding_t").show("slow");
		$(".disenoWeb_t").each(function () {
			$(this).hide("slow");
		});
		$(".grafica_t").hide("slow");
		$(".multimedia_t").hide("slow");
	});	
	$(".grafica_btn").click(function () {
		$(".branding_t").hide("slow");
		$(".disenoWeb_t").hide("slow");
		$(".grafica_t").show("slow");
		$(".multimedia_t").hide("slow");
	});
	$(".multimedia_btn").click(function () {
		$(".branding_t").hide("slow");
		$(".disenoWeb_t").hide("slow");
		$(".multimedia_t").show("slow");
		$(".grafica_t").hide("slow");
	});
	
	//Botón Enviar del Contacto
	$("#contacto a").hover(
	function() {
	$("img.a", this).stop().animate({"opacity": "0"}, 300);
	},
	function() {
	$("img.a", this).stop().animate({"opacity": "1"}, 300);
	});
	


});

	//Background del copyright

	//lista de colores:
	var randombgcolors=new Array("#ff6666", "#9175d0", "#66a2bc", "#1d7eb0", "#429dc3")

	var rbcssrule=""
	var randomnum=Math.floor(Math.random()*randombgcolors.length)
	if (randombgcolors[randomnum].indexOf(":")!=-1){
	rbcssrule="background-color: "+randombgcolors[randomnum].split(":")[0]+";"
	rbcssrule+="color: "+randombgcolors[randomnum].split(":")[1]+";"
	}
	else
	rbcssrule="background-color: "+randombgcolors[randomnum]+";"

	document.write('<style type="text/css">\n')
	document.write('.randomcolor{'+rbcssrule+'}\n')
	if (randombgcolors[randomnum].split(":").length==3) //if link color specified
	document.write('.randomcolor a{color:'+randombgcolors[randomnum].split(":")[2]+';}\n')
	document.write('<\/style>')
	
	//Background del currículum

	//lista de colores:
	var randombgcolors=new Array("#ff6666", "#9175d0", "#66a2bc", "#1d7eb0", "#429dc3", "#ffc803", "#ff8fdc", "#ff9668")

	var rbcssrule=""
	var randomnum=Math.floor(Math.random()*randombgcolors.length)
	if (randombgcolors[randomnum].indexOf(":")!=-1){
	rbcssrule="background-color: "+randombgcolors[randomnum].split(":")[0]+";"
	rbcssrule+="color: "+randombgcolors[randomnum].split(":")[1]+";"
	}
	else
	rbcssrule="background-color: "+randombgcolors[randomnum]+";"

	document.write('<style type="text/css">\n')
	document.write('.randomcurricolor{'+rbcssrule+'}\n')
	if (randombgcolors[randomnum].split(":").length==3) //if link color specified
	document.write('.randomcurricolor a{color:'+randombgcolors[randomnum].split(":")[2]+';}\n')
	document.write('<\/style>')
