﻿/***************************/
//@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(){
	$(".tripDetailMenu > li").click(function(e){
		var target = e.target.id;
		var scope = target.substr(target.indexOf('-')+1,target.length);
		
		switch(target){
			case "tdoverview-"+scope:
				//change status & style menu
				$("#tdoverview-"+scope).addClass("active");
				$("#tddescription-"+scope).removeClass("active");
				$("#tdduration-"+scope).removeClass("active");
				$("#tdhousing-"+scope).removeClass("active");
				$("#tdtours-"+scope).removeClass("active");
				$("#tdrecreation-"+scope).removeClass("active");
				$("#tdservices-"+scope).removeClass("active");
				$("#tdextras-"+scope).removeClass("active");
				$("#tdinfos-"+scope).removeClass("active");
				$("#tdorganizer-"+scope).removeClass("active");
				//display selected division, hide others
				$("div.tdoverview-"+scope).fadeIn();
				$("div.tddescription-"+scope).css("display", "none");
				$("div.tdduration-"+scope).css("display", "none");
				$("div.tdhousing-"+scope).css("display", "none");
				$("div.tdtours-"+scope).css("display", "none");
				$("div.tdrecreation-"+scope).css("display", "none");
				$("div.tdservices-"+scope).css("display", "none");
				$("div.tdextras-"+scope).css("display", "none");
				$("div.tdinfos-"+scope).css("display", "none");
				$("div.tdorganizer-"+scope).css("display", "none");
				//switch popeye off
				$("div.ppy-"+scope).css("display", "none");
				break;
				
			case "tddescription-"+scope:
				//change status & style menu
				$("#tdoverview-"+scope).removeClass("active");
				$("#tddescription-"+scope).addClass("active");
				$("#tdduration-"+scope).removeClass("active");
				$("#tdhousing-"+scope).removeClass("active");
				$("#tdtours-"+scope).removeClass("active");
				$("#tdrecreation-"+scope).removeClass("active");
				$("#tdservices-"+scope).removeClass("active");
				$("#tdextras-"+scope).removeClass("active");
				$("#tdinfos-"+scope).removeClass("active");
				$("#tdorganizer-"+scope).removeClass("active");
				//display selected division, hide others
				$("div.tdoverview-"+scope).css("display", "none");
				$("div.tddescription-"+scope).fadeIn();
				$("div.tdduration-"+scope).css("display", "none");
				$("div.tdhousing-"+scope).css("display", "none");
				$("div.tdtours-"+scope).css("display", "none");
				$("div.tdrecreation-"+scope).css("display", "none");
				$("div.tdservices-"+scope).css("display", "none");
				$("div.tdextras-"+scope).css("display", "none");
				$("div.tdinfos-"+scope).css("display", "none");
				$("div.tdorganizer-"+scope).css("display", "none");
				//switch popeye on
				$("div.ppy-"+scope).css("display", "inline");
		 		$("#tripDetailPopeye-"+scope).popeye();
				break;
				
			case "tdduration-"+scope:
				//change status & style menu
				$("#tdoverview-"+scope).removeClass("active");
				$("#tddescription-"+scope).removeClass("active");
				$("#tdduration-"+scope).addClass("active");
				$("#tdhousing-"+scope).removeClass("active");
				$("#tdtours-"+scope).removeClass("active");
				$("#tdrecreation-"+scope).removeClass("active");
				$("#tdservices-"+scope).removeClass("active");
				$("#tdextras-"+scope).removeClass("active");
				$("#tdinfos-"+scope).removeClass("active");
				$("#tdorganizer-"+scope).removeClass("active");
				//display selected division, hide others
				$("div.tdoverview-"+scope).css("display", "none");
				$("div.tddescription-"+scope).css("display", "none");
				$("div.tdduration-"+scope).fadeIn();
				$("div.tdhousing-"+scope).css("display", "none");
				$("div.tdtours-"+scope).css("display", "none");
				$("div.tdrecreation-"+scope).css("display", "none");
				$("div.tdservices-"+scope).css("display", "none");
				$("div.tdextras-"+scope).css("display", "none");
				$("div.tdinfos-"+scope).css("display", "none");
				$("div.tdorganizer-"+scope).css("display", "none");
				//switch popeye off
				$("div.ppy-"+scope).css("display", "none");
				break;
				
			case "tdhousing-"+scope:
				//change status & style menu
				$("#tdoverview-"+scope).removeClass("active");
				$("#tddescription-"+scope).removeClass("active");
				$("#tdduration-"+scope).removeClass("active");
				$("#tdhousing-"+scope).addClass("active");
				$("#tdtours-"+scope).removeClass("active");
				$("#tdrecreation-"+scope).removeClass("active");
				$("#tdservices-"+scope).removeClass("active");
				$("#tdextras-"+scope).removeClass("active");
				$("#tdinfos-"+scope).removeClass("active");
				$("#tdorganizer-"+scope).removeClass("active");
				//display selected division, hide others
				$("div.tdoverview-"+scope).css("display", "none");
				$("div.tddescription-"+scope).css("display", "none");
				$("div.tdduration-"+scope).css("display", "none");
				$("div.tdhousing-"+scope).fadeIn();
				$("div.tdtours-"+scope).css("display", "none");
				$("div.tdrecreation-"+scope).css("display", "none");
				$("div.tdservices-"+scope).css("display", "none");
				$("div.tdextras-"+scope).css("display", "none");
				$("div.tdinfos-"+scope).css("display", "none");
				$("div.tdorganizer-"+scope).css("display", "none");
				//switch popeye off
				$("div.ppy-"+scope).css("display", "none");
				break;
				
			case "tdtours-"+scope:
				//change status & style menu
				$("#tdoverview-"+scope).removeClass("active");
				$("#tddescription-"+scope).removeClass("active");
				$("#tdduration-"+scope).removeClass("active");
				$("#tdhousing-"+scope).removeClass("active");
				$("#tdtours-"+scope).addClass("active");
				$("#tdrecreation-"+scope).removeClass("active");
				$("#tdservices-"+scope).removeClass("active");
				$("#tdextras-"+scope).removeClass("active");
				$("#tdinfos-"+scope).removeClass("active");
				$("#tdorganizer-"+scope).removeClass("active");
				//display selected division, hide others
				$("div.tdoverview-"+scope).css("display", "none");
				$("div.tddescription-"+scope).css("display", "none");
				$("div.tdduration-"+scope).css("display", "none");
				$("div.tdhousing-"+scope).css("display", "none");
				$("div.tdtours-"+scope).fadeIn();
				$("div.tdrecreation-"+scope).css("display", "none");
				$("div.tdservices-"+scope).css("display", "none");
				$("div.tdextras-"+scope).css("display", "none");
				$("div.tdinfos-"+scope).css("display", "none");
				$("div.tdorganizer-"+scope).css("display", "none");
				//switch popeye off
				$("div.ppy-"+scope).css("display", "none");
				break;
				
			case "tdrecreation-"+scope:
				//change status & style menu
				$("#tdoverview-"+scope).removeClass("active");
				$("#tddescription-"+scope).removeClass("active");
				$("#tdduration-"+scope).removeClass("active");
				$("#tdhousing-"+scope).removeClass("active");
				$("#tdtours-"+scope).removeClass("active");
				$("#tdrecreation-"+scope).addClass("active");
				$("#tdservices-"+scope).removeClass("active");
				$("#tdextras-"+scope).removeClass("active");
				$("#tdinfos-"+scope).removeClass("active");
				$("#tdorganizer-"+scope).removeClass("active");
				//display selected division, hide others
				$("div.tdoverview-"+scope).css("display", "none");
				$("div.tddescription-"+scope).css("display", "none");
				$("div.tdduration-"+scope).css("display", "none");
				$("div.tdhousing-"+scope).css("display", "none");
				$("div.tdtours-"+scope).css("display", "none");
				$("div.tdrecreation-"+scope).fadeIn();
				$("div.tdservices-"+scope).css("display", "none");
				$("div.tdextras-"+scope).css("display", "none");
				$("div.tdinfos-"+scope).css("display", "none");
				$("div.tdorganizer-"+scope).css("display", "none");
				//switch popeye off
				$("div.ppy-"+scope).css("display", "none");
				break;
				
			case "tdservices-"+scope:
				//change status & style menu
				$("#tdoverview-"+scope).removeClass("active");
				$("#tddescription-"+scope).removeClass("active");
				$("#tdduration-"+scope).removeClass("active");
				$("#tdhousing-"+scope).removeClass("active");
				$("#tdtours-"+scope).removeClass("active");
				$("#tdrecreation-"+scope).removeClass("active");
				$("#tdservices-"+scope).addClass("active");
				$("#tdextras-"+scope).removeClass("active");
				$("#tdinfos-"+scope).removeClass("active");
				$("#tdorganizer-"+scope).removeClass("active");
				//display selected division, hide others
				$("div.tdoverview-"+scope).css("display", "none");
				$("div.tddescription-"+scope).css("display", "none");
				$("div.tdduration-"+scope).css("display", "none");
				$("div.tdhousing-"+scope).css("display", "none");
				$("div.tdtours-"+scope).css("display", "none");
				$("div.tdrecreation-"+scope).css("display", "none");
				$("div.tdservices-"+scope).fadeIn();
				$("div.tdextras-"+scope).css("display", "none");
				$("div.tdinfos-"+scope).css("display", "none");
				$("div.tdorganizer-"+scope).css("display", "none");
				//switch popeye off
				$("div.ppy-"+scope).css("display", "none");
				break;
				
			case "tdextras-"+scope:
				//change status & style menu
				$("#tdoverview-"+scope).removeClass("active");
				$("#tddescription-"+scope).removeClass("active");
				$("#tdduration-"+scope).removeClass("active");
				$("#tdhousing-"+scope).removeClass("active");
				$("#tdtours-"+scope).removeClass("active");
				$("#tdrecreation-"+scope).removeClass("active");
				$("#tdservices-"+scope).removeClass("active");
				$("#tdextras-"+scope).addClass("active");
				$("#tdinfos-"+scope).removeClass("active");
				$("#tdorganizer-"+scope).removeClass("active");
				//display selected division, hide others
				$("div.tdoverview-"+scope).css("display", "none");
				$("div.tddescription-"+scope).css("display", "none");
				$("div.tdduration-"+scope).css("display", "none");
				$("div.tdhousing-"+scope).css("display", "none");
				$("div.tdtours-"+scope).css("display", "none");
				$("div.tdrecreation-"+scope).css("display", "none");
				$("div.tdservices-"+scope).css("display", "none");
				$("div.tdextras-"+scope).fadeIn();
				$("div.tdinfos-"+scope).css("display", "none");
				$("div.tdorganizer-"+scope).css("display", "none");
				//switch popeye off
				$("div.ppy-"+scope).css("display", "none");
				break;
				
			case "tdinfos-"+scope:
				//change status & style menu
				$("#tdoverview-"+scope).removeClass("active");
				$("#tddescription-"+scope).removeClass("active");
				$("#tdduration-"+scope).removeClass("active");
				$("#tdhousing-"+scope).removeClass("active");
				$("#tdtours-"+scope).removeClass("active");
				$("#tdrecreation-"+scope).removeClass("active");
				$("#tdservices-"+scope).removeClass("active");
				$("#tdextras-"+scope).removeClass("active");
				$("#tdinfos-"+scope).addClass("active");
				$("#tdorganizer-"+scope).removeClass("active");
				//display selected division, hide others
				$("div.tdoverview-"+scope).css("display", "none");
				$("div.tddescription-"+scope).css("display", "none");
				$("div.tdduration-"+scope).css("display", "none");
				$("div.tdhousing-"+scope).css("display", "none");
				$("div.tdtours-"+scope).css("display", "none");
				$("div.tdrecreation-"+scope).css("display", "none");
				$("div.tdservices-"+scope).css("display", "none");
				$("div.tdextras-"+scope).css("display", "none");
				$("div.tdinfos-"+scope).fadeIn();
				$("div.tdorganizer-"+scope).css("display", "none");
				//switch popeye off
				$("div.ppy-"+scope).css("display", "none");
				break;
				
			case "tdorganizer-"+scope:
				//change status & style menu
				$("#tdoverview-"+scope).removeClass("active");
				$("#tddescription-"+scope).removeClass("active");
				$("#tdduration-"+scope).removeClass("active");
				$("#tdhousing-"+scope).removeClass("active");
				$("#tdtours-"+scope).removeClass("active");
				$("#tdrecreation-"+scope).removeClass("active");
				$("#tdservices-"+scope).removeClass("active");
				$("#tdextras-"+scope).removeClass("active");
				$("#tdinfos-"+scope).removeClass("active");
				$("#tdorganizer-"+scope).addClass("active");
				//display selected division, hide others
				$("div.tdoverview-"+scope).css("display", "none");
				$("div.tddescription-"+scope).css("display", "none");
				$("div.tdduration-"+scope).css("display", "none");
				$("div.tdhousing-"+scope).css("display", "none");
				$("div.tdtours-"+scope).css("display", "none");
				$("div.tdrecreation-"+scope).css("display", "none");
				$("div.tdservices-"+scope).css("display", "none");
				$("div.tdextras-"+scope).css("display", "none");
				$("div.tdinfos-"+scope).css("display", "none");
				$("div.tdorganizer-"+scope).fadeIn();
				//switch popeye off
				$("div.ppy-"+scope).css("display", "none");
				break;
				
			}
		return false;
	});
});