// JavaScript Document

// Main menu and dropdown hover scripts

        $(document).ready(function () {
			
		
			
            
			function addMega() {
                $(this).addClass("hovering");
				
				
				
            }

            function removeMega() {
                $(this).removeClass("hovering");
				
            }

            var megaConfig = {
                interval: 0,
                sensitivity: 4,
                over: addMega,
                timeout: 0,
                out: removeMega
            };

			var nextClass = '';
            $("li.mega").hoverIntent(megaConfig);
			

        });
		
		
		
		
		






	/* Search
	/*-------------------------------------------------------------------*/
	$(function () {
		/* Search inputs */
		$('#SiteSearchField').focus(function ()
		{
			var defaultValue = $(this).attr('title');
			if($(this).val() == defaultValue)
			{
				$(this).val('');
			}
		});
		$('#SiteSearchField').blur(function ()
		{
			var defaultValue = $(this).attr('title');
			var theText = $.trim( $(this).val() );
			if(theText == '')
			{
				$(this).val(defaultValue);
			}
		});
		$('#SiteSearchField').keypress(function (e)
		{
			var returnValue = true;
			if((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13))
			{
				var theText = $.trim( $(this).val() );
				if(theText != '')
				{
					$('#SiteSearchForm').submit();
					returnValue = false;
				}
			}
			return returnValue;
		});
	});




	/*-------------------------------------------------------------------*/
	/* Timeline
	/*-------------------------------------------------------------------*/
	$(function () {
		$('#timeline ul li').hover(
			function () {
				$(this).addClass('hover');
			},
			function () {
				$(this).removeClass('hover');
			}
		);
		$('#timeline ul li').click(function () {
			$('#timeline ul li').removeClass('active');
			$(this).addClass('active');
			$('#timelinetext div.tbox').hide();
			$('#' + $(this).attr('rel')).show();
		});
	});

/* tilføj class single til menupunkter uden underpunkter */
	$(function () {
		if($('div.mmn-clm ul.first li').hasClass('last')){
			$('div.mmn-clm ul.first li').addClass('single')	
		}
	});
	
	
	
	$(function () {
		$('.prog').hover(function () {
		
			$('.mainpic').css({'background-image': 'url(' + $(this).attr('rel') + ')'});
		});
	});
	
	$(function () {
		$('.prog').hover(
			function () {
				console.log($(this).attr('rel'));
				$('.mainpic').css({'background-image': 'url(' + $(this).attr('rel') + ')'});
			},
			function () {
				//$('.mainpic').css({'background-image': 'url(' + $('.prog1').attr('rel') + ')'});
				$('.mainpic').css({'background-image': 'url(/vers2011/gfx/fee-frontp-bg1.png)'});
				
			});
	});
	

	
