﻿/***************************/
//@Author: Adrian "yEnS" Mato Gondelle & Ivan Guardado Castro
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

$(document).ready(function(){
	$(".menu > li").click(function(e){
		var toCheck = e.target.id;
		if(toCheck != "tab1" && toCheck != "tab2" && toCheck != "tab3" && toCheck != "tab4" && toCheck != "tab5"){
                  toCheck = e.target.parentNode.id;
                }
		switch(toCheck){
			case "tab1":
				//change status & style menu
				$("#tab1").addClass("active");
				$("#tab2").removeClass("active");
				$("#tab2").addClass("off");
				$("#tab3").removeClass("active");
				$("#tab3").addClass("off");
				$("#tab4").removeClass("active");
				$("#tab4").addClass("off");
				$("#tab5").removeClass("active");
				$("#tab5").addClass("bottom");
				//display selected division, hide others
				$("div.tab1").fadeIn();
				$("div.tab2").css("display", "none");
				$("div.tab3").css("display", "none");
				$("div.tab4").css("display", "none");
				$("div.tab5").css("display", "none");
			break;
			case "tab2":
				//change status & style menu
				$("#tab1").removeClass("active");
				$("#tab1").addClass("top");
				$("#tab2").addClass("active");
				$("#tab3").removeClass("active");
				$("#tab3").addClass("off");
				$("#tab4").removeClass("active");
				$("#tab4").addClass("off");
				$("#tab5").removeClass("active");
				$("#tab5").addClass("bottom");
				//display selected division, hide others
				$("div.tab2").fadeIn();
				$("div.tab1").css("display", "none");
				$("div.tab3").css("display", "none");
				$("div.tab4").css("display", "none");
				$("div.tab5").css("display", "none");
			break;
			case "tab3":
				//change status & style menu
				$("#tab1").removeClass("active");
				$("#tab1").addClass("top");
				$("#tab2").removeClass("active");
				$("#tab2").addClass("off");
				$("#tab3").addClass("active");
				$("#tab4").removeClass("active");
				$("#tab4").addClass("off");
				$("#tab5").removeClass("active");
				$("#tab5").addClass("bottom");
				
				//display selected division, hide others
				$("div.tab3").fadeIn();
				$("div.tab1").css("display", "none");
				$("div.tab2").css("display", "none");
				$("div.tab4").css("display", "none");
				$("div.tab5").css("display", "none");
			break;
			
			case "tab4":
				//change status & style menu
				$("#tab1").removeClass("active");
				$("#tab1").addClass("top");
				$("#tab2").removeClass("active");
				$("#tab2").addClass("off");
				$("#tab3").removeClass("active");
				$("#tab3").addClass("off");
				$("#tab4").addClass("active");
				$("#tab5").removeClass("active");
				$("#tab5").addClass("bottom");
				
				//display selected division, hide others
				$("div.tab4").fadeIn();
				$("div.tab1").css("display", "none");
				$("div.tab2").css("display", "none");
				$("div.tab3").css("display", "none");
				$("div.tab5").css("display", "none");
			break;
			
			case "tab5":
				//change status & style menu
				$("#tab1").removeClass("active");
				$("#tab1").addClass("top");
				$("#tab2").removeClass("active");
				$("#tab2").addClass("off");
				$("#tab3").removeClass("active");
				$("#tab3").addClass("off");
				$("#tab4").removeClass("active");
				$("#tab4").addClass("off");
				$("#tab5").addClass("active");
				
				
				//display selected division, hide others

				$("div.tab5").fadeIn();
				$("div.tab1").css("display", "none");
				$("div.tab2").css("display", "none");
				$("div.tab3").css("display", "none");
				$("div.tab4").css("display", "none");
			break;
		}
		//alert(e.target.id);
		return false;
	});
});
