(function ($) {
	$(document).ready(function() {
		// Start Code
		// Add menu link desc
		$(".megamenu-parent-title a").append("<span class=\"desc\"></span>");			
		$(".megamenu-parent-title a").each(function() {
			// var hoverText = $(this).attr("title"); //for menu with title attrb.
			var hoverText = ''
			var linktext = $(this).text();
			switch (linktext) {
				// Hier Menu Subtitles anpassen!
				case 'Start': hoverText = 'Startseite'; break;
				case 'Aktive': hoverText = 'Aktive Mannschaften'; break;
				case 'Jugend': hoverText = 'Jugend Mannschaften'; break;
				case 'Verein': hoverText = 'Rund um die SG Nußloch'; break;
				case 'Intern': hoverText = 'Interne Trainerplatform'; break;
				}
			$(this).find("span.desc").text(hoverText);		
		});
		// Add menu sublink desc
		$(".megamenu-slot-title a").append("<span class=\"desc\"></span>");			
		$(".megamenu-slot-title a").each(function() {
			// var hoverText = $(this).attr("title"); //for menu with title attrb.
			var hoverText = ''
			var linktext = $(this).text();
			switch (linktext) {
				// Hier Menu Subtitles anpassen!
				case '1. Herren': hoverText = 'Badenliga'; break;
				case '1. Damen': hoverText = 'Badenliga'; break;
				case '2. Herren': hoverText = '3. Kreisliga'; break;
				case '3. Herren': hoverText = '4. Kreisliga'; break;
				}
			$(this).find("span.desc").text(hoverText);		
		});
		
		/* Overlay Support */
		function lightsout(opacity, color) {
				var docHeight = $(document).height();
				$("body").append("<div id='overlay'></div>");
				$("#overlay")
					.height(docHeight)
					.css({
						 'opacity' : opacity,
						 'position': 'absolute',
						 'top': 0,
						 'left': 0,
						 'background-color': color,
						 'width': '100%',
						 'z-index': 5000
					 });
		}
		
		
		// Cookie & Show Intro
		if ($.cookie('visit') != 'yes') {
			if ($(".pagetitle").text() == 'Startseite') { // Nur auf Startseite ausblenden!
				$.cookie('visit', 'yes');
				lightsout(0.4,'black');
				$("#intro").fadeIn();
			}
    }
		
		// Fixed Btn Popup & Close
		$(".fixedbtn").click(function() {
				lightsout(0.4,'black');
				$("#intro").fadeIn();
		});
			
		// Close
		$("#intro .close").click(function() {
			$("#overlay").detach();
			$("#intro").fadeOut();
		});
		// End Code
	});
})(jQuery);
;

