$(document).ready(function(){
	/*Images over Nav */
	$("#dock a").hover(function() {
	  $(this).next("div").animate({opacity: "show", top: "-25"}, "slow");
	}, function() {
	  $(this).next("div").animate({opacity: "hide", top: "-35"}, "fast");
	});
	/* End Images over Nav */
	/* NAVIGATION */
	var currentPage = "#home";
	$("#shome").click(function() {
		if(currentPage == "#home") {
			//Do Nothing
		} else if(currentPage == "#portfolio") {
			$("#porftolio").fadeOut("slow");
			$("#circle").fadeOut("slow");
			$("#gallery_main").fadeOut("slow", function(){
				$("#home").fadeIn("slow");
				currentPage = "#home";
				$("#tree").fadeIn("slow");
			});	
		} else if(currentPage == "#resume_container") {
			$("#resume_container").fadeOut("slow");
			$("#resume").fadeOut("slow");
			$("#skills").fadeOut("slow");
			$("#ornament").fadeOut("slow");
			$("#awards").fadeOut("slow", function(){
				$("#home").fadeIn("slow");
				currentPage = "#home";
				$("#tree").fadeIn("slow");
			});
		} else {
			$(currentPage).fadeOut("slow", function(){
			$("#home").fadeIn("slow");
			$("#tree").fadeIn("slow");
			currentPage = "#home";
		});
		}
	});
	$("#sabout").click(function() {
		if(currentPage == "#about") {
			//Do Nothing.
		} else if(currentPage == "#portfolio") {
			$("#porftolio").fadeOut("slow");
			$("#circle").fadeOut("slow");
			$("#gallery_main").fadeOut("slow", function(){
				$("#about").fadeIn("slow");
				currentPage = "#about";
			});	
		} else if(currentPage == "#resume_container") {
			$("#resume_container").fadeOut("slow");
			$("#resume").fadeOut("slow");
			$("#skills").fadeOut("slow");
			$("#ornament").fadeOut("slow");
			$("#awards").fadeOut("slow", function(){
				$("#about").fadeIn("slow");
				currentPage = "#about";
			});
		} else {
			$(currentPage).fadeOut("slow", function(){
			$("#about").fadeIn("slow");
			$("#gallery_main").fadeOut("slow");
		});
		if($("#tree").css("display","block")) {
			$("#tree").fadeOut("slow");	
		}
		if($("#tree").css("display", "none")) {
			//Do nothing.	
		}
		currentPage = "#about";
		}
	});
	$("#sportfolio").click(function() {
		if(currentPage == "#portfolio") {
			//Do Nothing
		} else if(currentPage == "#resume_container") {
			$("#resume_container").fadeOut("slow");
			$("#resume").fadeOut("slow");
			$("#skills").fadeOut("slow");
			$("#ornament").fadeOut("slow");
			$("#awards").fadeOut("slow", function(){
				$("#portfolio").fadeIn("slow");
				$("#gallery_main").fadeIn("slow");
				currentPage = "#portfolio";
			});
		} else {
			$(currentPage).fadeOut("slow", function(){
			$("#portfolio").fadeIn("slow");
			$("#gallery_main").fadeIn("slow");
			$("#circle").fadeIn("slow");
		});
		if($("#tree").css("display","block")) {
			$("#tree").fadeOut("slow");	
		}
		if($("#tree").css("display", "none")) {
			//Do nothing.	
		}
		currentPage = "#portfolio";
		}
	});
	$("#sportfolio2").click(function() {
		if(currentPage == "#portfolio") {
			//Do Nothing
		} else if(currentPage == "#resume_container") {
			$("#resume_container").fadeOut("slow");
			$("#resume").fadeOut("slow");
			$("#skills").fadeOut("slow");
			$("#ornament").fadeOut("slow");
			$("#awards").fadeOut("slow", function(){
				$("#portfolio").fadeIn("slow");
				$("#gallery_main").fadeIn("slow");
				currentPage = "#portfolio";
			});
		} else {
			$(currentPage).fadeOut("slow", function(){
			$("#portfolio").fadeIn("slow");
			$("#gallery_main").fadeIn("slow");
			$("#circle").fadeIn("slow");
		});
		if($("#tree").css("display","block")) {
			$("#tree").fadeOut("slow");	
		}
		if($("#tree").css("display", "none")) {
			//Do nothing.	
		}
		currentPage = "#portfolio";
		}
	});
	$("#sresume").click(function() {
		if(currentPage == "#resume_container") {
			//Do Nothing.
		} else if(currentPage == "#portfolio") {
			$("#porftolio").fadeOut("slow");
			$("#circle").fadeOut("slow");
			$("#gallery_main").fadeOut("slow", function(){
				$("#resume_container").fadeIn("slow");
				$("#resume").fadeIn("slow");
				$("#skills").fadeIn("slow");
				$("#awards").fadeIn("slow");
				$("#ornament").fadeIn("slow");
				currentPage = "#resume_container";
			});	
		} else {
			$(currentPage).fadeOut("slow", function(){
			$("#resume_container").fadeIn("slow");
			$("#resume").fadeIn("slow");
			$("#skills").fadeIn("slow");
			$("#awards").fadeIn("slow");
			$("#ornament").fadeIn("slow");
			currentPage = "#resume_container";
		});
		if($("#tree").css("display","block")) {
			$("#tree").fadeOut("slow");	
		}
		if($("#tree").css("display", "none")) {
			//Do nothing.	
		}
		}
	});
	$("#scontact").click(function() {
		if(currentPage == "#contact") {
		} else if(currentPage == "#portfolio") {
			$("#porftolio").fadeOut("slow");
			$("#circle").fadeOut("slow");
			$("#gallery_main").fadeOut("slow", function(){
				$("#contact").fadeIn("slow");
				currentPage = "#contact";
			});	
		} else if(currentPage == "#resume_container") {
			$("#resume_container").fadeOut("slow");
			$("#resume").fadeOut("slow");
			$("#skills").fadeOut("slow");
			$("#ornament").fadeOut("slow");
			$("#awards").fadeOut("slow", function(){
				$("#contact").fadeIn("slow");
				currentPage = "#contact";
			});
		} else {
			$(currentPage).fadeOut("slow", function(){
			$("#contact").fadeIn("slow");
		});
		if($("#tree").css("display","block")) {
			$("#tree").fadeOut("slow");	
		}
		if($("#tree").css("display", "none")) {
			//Do nothing.	
		}
		currentPage = "#contact";
		}
	});
	/* END NAVIGATION */
	/* GALLERY TABS */
	var gallery = "#web";
	$("#sweb").click(function() {
		if(gallery == "#web") {
			//Do Nothing
		} else {
			$(gallery).fadeOut("slow", function(){
				$("#web").fadeIn("slow");
				gallery = "#web";
			});
		}
	});
	$("#sprint").click(function() {
		if(gallery == "#print") {
			//Do Nothing
		} else {
			$(gallery).fadeOut("slow", function(){
				$("#print").fadeIn("slow");
				gallery = "#print";
			});
		}
	});
	$("#smotion").click(function() {
		if(gallery == "#motion") {
			//Do Nothing
		} else {
			$(gallery).fadeOut("slow", function() {
				$("#motion").fadeIn("slow");
				gallery = "#motion";
			});
		}
	});
	$("#sinteractive").click(function() {
		if(gallery == "#interactive") {
			//Do Nothing
		} else {
			$(gallery).fadeOut("slow", function() {
				$("#interactive").fadeIn("slow");
				gallery = "#interactive";
			});
		}
	}); 
	/* GALLERY */
	/*PRINT */
	$("#p1_next").click(function() {
		$("#print1").fadeOut("slow", function() {
			$("#print2").fadeIn("slow");
		});
	});
	$("#p2_next").click(function() {
		$("#print2").fadeOut("slow", function() {
			$("#print3").fadeIn("slow");
		});
	});
	$("#p3_next").click(function() {
		$("#print3").fadeOut("slow", function() {
			$("#print4").fadeIn("slow");
		});
	});
	$("#p2_prev").click(function() {
		$("#print2").fadeOut("slow", function() {
			$("#print1").fadeIn("slow");
		});
	});
	$("#p3_prev").click(function() {
		$("#print3").fadeOut("slow", function() {
			$("#print2").fadeIn("slow");
		});
	});
	$("#p4_prev").click(function() {
		$("#print4").fadeOut("slow", function() {
			$("#print3").fadeIn("slow");
		});
	});
	/*WEB*/
	$("#w1_next").click(function() {
		$("#web1").fadeOut("slow", function() {
			$("#web2").fadeIn("slow");
		});
	});
	$("#w2_next").click(function() {
		$("#web2").fadeOut("slow", function() {
			$("#web3").fadeIn("slow");
		});
	});
	$("#w3_next").click(function() {
		$("#web3").fadeOut("slow", function() {
			$("#web4").fadeIn("slow");
		});
	});
	$("#w4_next").click(function() {
		$("#web4").fadeOut("slow", function() {
			$("#web5").fadeIn("slow");
		});
	});
	$("#w5_next").click(function() {
		$("#web5").fadeOut("slow", function() {
			$("#web6").fadeIn("slow");
		});
	});
	$("#w6_next").click(function() {
		$("#web6").fadeOut("slow", function() {
			$("#web7").fadeIn("slow");
		});
	});
	$("#w7_next").click(function() {
		$("#web7").fadeOut("slow", function() {
			$("#web8").fadeIn("slow");
		});
	});
	/* WEB PREVIOUS */
	$("#w2_prev").click(function() {
		$("#web2").fadeOut("slow", function() {
			$("#web1").fadeIn("slow");
		});
	});
	$("#w3_prev").click(function() {
		$("#web3").fadeOut("slow", function() {
			$("#web2").fadeIn("slow");
		});
	});
	$("#w4_prev").click(function() {
		$("#web4").fadeOut("slow", function() {
			$("#web3").fadeIn("slow");
		});
	});
	$("#w5_prev").click(function() {
		$("#web5").fadeOut("slow", function() {
			$("#web4").fadeIn("slow");
		});
	});
	$("#w6_prev").click(function() {
		$("#web6").fadeOut("slow", function() {
			$("#web5").fadeIn("slow");
		});
	});
	$("#w7_prev").click(function() {
		$("#web7").fadeOut("slow", function() {
			$("#web6").fadeIn("slow");
		});
	});
	$("#w8_prev").click(function() {
		$("#web8").fadeOut("slow", function() {
			$("#web7").fadeIn("slow");
		});
	});
	/* MOTION */
	$("#m1_next").click(function() {
		$("#motion1").fadeOut("slow", function() {
			$("#motion2").fadeIn("slow");
		});
	});
	$("#m2_next").click(function() {
		$("#motion2").fadeOut("slow", function() {
			$("#motion3").fadeIn("slow");
		});
	});
	$("#m3_next").click(function() {
		$("#motion3").fadeOut("slow", function() {
			$("#motion4").fadeIn("slow");
		});
	});
	$("#m2_prev").click(function() {
		$("#motion2").fadeOut("slow", function() {
			$("#motion1").fadeIn("slow");
		});
	});
	$("#m3_prev").click(function() {
		$("#motion3").fadeOut("slow", function() {
			$("#motion2").fadeIn("slow");
		});
	});
	$("#m4_prev").click(function() {
		$("#motion4").fadeOut("slow", function() {
			$("#motion3").fadeIn("slow");
		});
	});
	/* INTERACTIVE */
	$("#i1_next").click(function() {
		$("#interactive1").fadeOut("slow", function() {
			$("#interactive2").fadeIn("slow");
		});
	});
	$("#i2_prev").click(function() {
		$("#interactive2").fadeOut("slow", function() {
			$("#interactive1").fadeIn("slow");
		});
	});
	/* FANCYBOX OPTIONS */
	$("a#inline").fancybox({
		'frameWidth':	820,
		'frameHeight':	620
	});
	$("a#radio").fancybox({
		'frameWidth':	403,
		'frameHeight':	220
	});
	$("a.fullImages").fancybox();
	/* END GALLERY */
	/*RESUME TOOLTIPS*/
	$("#cat_d").hover(function() {
		$(".skillset_d").fadeIn("slow");
		}, function() {
			$(".skillset_d").fadeOut("slow");
		});
	$("#cat_p").hover(function() {
		$(".skillset_p").fadeIn("slow");
		}, function() {
			$(".skillset_p").fadeOut("slow");
		});
	$("#cat_wc").hover(function() {
		$(".skillset_wc").fadeIn("slow");
		}, function() {
			$(".skillset_wc").fadeOut("slow");
		});
	$("#cat_pm").hover(function() {
		$(".skillset_pm").fadeIn("slow");
		}, function() {
			$(".skillset_pm").fadeOut("slow");
		});
	$("#cat_l").hover(function() {
		$(".skillset_l").fadeIn("slow");
		}, function() {
			$(".skillset_l").fadeOut("slow");
		});
	$("#cat_s").hover(function() {
		$(".skillset_s").fadeIn("slow");
		}, function() {
			$(".skillset_s").fadeOut("slow");
		});
	/*End Skill Set */
	/* FORM */
	$("#ajax-form").submit(function() {
		//Variable
		var str = $(this).serialize();
		$.ajax({
			type: "POST",
			url: "sendmail.php",
			data: str,
			success: function(msg) {
				$("#note").ajaxComplete(function(event, request, settings) {
					if(msg == 'OK') {
						result= '<div class="not_yes">Message Received! Thank you for contacting me. I\'ll be in touch with you soon!</div>';
						$("#fields").fadeTo("slow", 0.2);
					} else {
						result = msg;
					}
					$(this).html(result);
				});
			}
		});
		return false;
	});
});