var Subpage = {
	InitializeAccordion: function () {
		$("#Sidebar h2")
			.append('<img src="/Images/Interface/Interface_Arrow_Down.gif" alt="" />')
			.each(function (index) {
				if (index < 3) Subpage.ToggleAccordionModule(this);
				$(this).parent().removeClass("SidebarOpen");
				$(this).click(function () {
					Subpage.ToggleAccordionModule(this);
				});
			});
	},
	
	ToggleAccordionModule: function (module) {
		$(module).parent().toggleClass("SidebarOpen");
		$(module).children(":first")
			.attr("src", ($(module).next().toggle().is(":visible"))
				? "/Images/Interface/Interface_Arrow_Down.gif"
				: "/Images/Interface/Interface_Arrow_Left.gif"
			);
	},
	
	SideBarController: function(){
		$("#SubPageMenu .SideBarSub").hide();
		$("#SubPageMenu a").hover(
			function() {
				if($(this).next().hasClass("SideBarSub") & $(this).next().css("display") != "block"){
					$("#SubPageMenu .SideBarSub").hide("fast");
					$(this).next().show("fast");
				}
			},
			function(){
			}
		);
	},
	
	WebCMSshowhide:function(){
		$(".showhidetarget").hide();
		$(".showhide").toggle(
			function(){
				$(this).next(".showhidetarget").show("fast");
			},
			function(){
				$(this).next(".showhidetarget").hide("fast");
			}
		);
	},
	
	CheckIfHttps:function(){
		if(document.location.protocol != "http:"){
			$("#TripPlanner h2").unbind('click');
			$("#TripPlanner h2").click(function(){
				window.location.href= '/BusService/TripPlanner.cfm';
			}); // click bind
		}
	}
	
};

$(Subpage.InitializeAccordion);
$(Subpage.SideBarController);
$(Subpage.WebCMSshowhide);
$(Subpage.CheckIfHttps);