/*jQuery(document).ready(function() {*/
								$(document).ready(function(){
    // Avanceret søgning
    $('.tSea dd').hide();
    	$('.tSea dt').click(function() {
    	$(this).next(".tSea dd").slideToggle("fast");
    	$(this).toggleClass("active");
    	$(this).siblings(".tSea dt").removeClass("active");
    });
    
    // Login
    $('#login dd').hide();
    	$('#login dt').click(function() {
    	$(this).next("#login dd").slideToggle("fast");
    	$(this).toggleClass("active");
    	$(this).siblings("#login dt").removeClass("active");
 });
    
    // Anbefalinger
	$('#anbfl dd').hide();
    	$('#anbfl dt').click(function() {
    	$(this).next("#anbfl dd").slideToggle("fast");
    	$(this).toggleClass("active");
    	$(this).siblings("#anbfl dt").removeClass("active");
 });

 // Anbefalinger
 $('#mit dd').hide();
 $('#mit dt').click(function() {
     $(this).next("#mit dd").slideToggle("fast");
     $(this).toggleClass("active");
     $(this).siblings("#mit dt").removeClass("active");
 });
    
    // Billedegalleri
	$('.imageroll290').cycle({ 
    	fx:     'fade', 
    	speed:  'fast', 
    	timeout: 0, 
    	next:   '.nextI', 
    	prev:   '.prevI' 
	});
	// Top nyheder
	$('.newslist').cycle({ 
    	fx:     'none', 
    	speed:  'fast', 
    	timeout: 0, 
    	next:   '.nextN', 
    	prev:   '.prevN',
    	sliderExpr: 'li' 
	});
	
	// RadioButton Fix START
	$("#list li > a").live('click', function (event) {
	// First disable the normal link click
	event.preventDefault();
	
	// Remove all list and links active class.
	$('#list .active').removeClass("active");
	
	// Grab the link clicks ID
	var id = this.id;
	
	// The id will now be something like "link1"
	// Now we need to replace link with option (this is the ID's of the checkbox)
	var newselect = id.replace('link', 'option');
	
	// Make newselect the option selected.
	$('#'+newselect).attr('checked', true);
	
	// Now add active state to the link and list item
	$(this).addClass("active").parent().addClass("active");
	
	return false;
	});
	// RadioButton SLUT
	// DropDown
	
	$(function(){
	
		$("ul#navi li").hover(function(){
		
			$(this).addClass("hover");
			$('ul:first',this).css('visibility', 'visible');
		
		}, function(){
		
			$(this).removeClass("hover");
			$('ul:first',this).css('visibility', 'hidden');
		
		});
		
		$("ul#navi li ul li:has(ul)").find("a:first").append(" &raquo; ");
	
	});
	// DropDown end
	
	// Label
	
	$(".sSea input").labelify({ text: "label", labelledClass: "labelinside" });
	$(".nyhedsbrev input").labelify({ text: "label", labelledClass: "labelinside" });
	$(".levesog input").labelify({ text: "label", labelledClass: "labelinside" });
	
	// Mit
	$('#mine div').hide();
	$('#mine li.subs').click(function() {
	    $(this).next("div").slideToggle("fast")
		.siblings("div:visible").slideUp("fast");
	    $(this).toggleClass("active");
	    $(this).siblings("li.subs").removeClass("active");
	});


	// Tabs

	$(function() {
			var tabContainers = $('div#tabs > div');
			tabContainers.hide().filter(':first').show();
			
			$('div#tabs ul.tabNavigation a').click(function () {
					tabContainers.hide();
					tabContainers.filter(this.hash).show();
					$('div#tabs ul.tabNavigation a').removeClass('selected');
					$(this).addClass('selected');
					return false;
			}).filter(':first').click();
});

//TopMenu
$(function() {
    var tabContainers = $('div#topMenu > div');
    tabContainers.hide().filter(':first').show();

    $('div#topMenu ul.tabNavigations a').click(function() {
        tabContainers.hide();
        tabContainers.filter(this.hash).show();
        $('div#topMenu ul.tabNavigations a').removeClass('sel');
        $(this).addClass('sel');
        return false;
    }).filter(':first').click();
});
	
                
     // Liste
     /*$('.tabAccord div div div dd').hide(); 
		$('.tabAccord div div div dt').click(function() {
	  $(this).next("dd").slideToggle("fast")
		.siblings("dd:visible").slideUp("fast");
		$(this).toggleClass("active");
		$(this).siblings("dt").removeClass("active");
	});*/
	/*
	$('.tabAccord dd').hide(); 
		$('.tabAccord dt').click(function() {
	  $(this).next("dd").slideToggle("fast")
		.siblings("dd:visible").slideUp("fast");
		$(this).toggleClass("active");
		$(this).siblings("dt").removeClass("active");
	});
	*/
	
	// Jobbørs accordion
     $('.jobAccord dd').hide(); 
		$('.jobAccord dt').click(function() {
	  $(this).next("dd").slideToggle("fast")
		.siblings("dd:visible").slideUp("fast");
		$(this).toggleClass("active");
		$(this).siblings("dt").removeClass("active");
	});

	// Start MiniKalendar 
	$(function () {
	$('.date_has_event').each(function () {
		// options
		var distance = 10;
		var time = 250;
		var hideDelay = 200;

		var hideDelayTimer = null;

		// tracker
		var beingShown = false;
		var shown = false;

		var trigger = $(this);
		var popup = $('.events ul', this).css('opacity', 0);

		// set the mouseover and mouseout on both element
		$([trigger.get(0), popup.get(0)]).mouseover(function () {
			// stops the hide event if we move from the trigger to the popup element
			if (hideDelayTimer) clearTimeout(hideDelayTimer);

			// don't trigger the animation again if we're being shown, or already visible
			if (beingShown || shown) {
				return;
			} else {
				beingShown = true;

				// reset position of popup box
				popup.css({
					left: 10,
					top: -125,
					display: 'block' // brings the popup back in to view
				})

				// (we're using chaining on the popup) now animate it's opacity and position
				.animate({
					top: '+=' + distance + 'px',
					opacity: 1
				}, time, 'swing', function() {
					// once the animation is complete, set the tracker variables
					beingShown = false;
					shown = true;
				});
			}
		}).mouseout(function () {
			// reset the timer if we get fired again - avoids double animations
			if (hideDelayTimer) clearTimeout(hideDelayTimer);

			// store the timer so that it can be cleared in the mouseover if required
			hideDelayTimer = setTimeout(function () {
				hideDelayTimer = null;
				popup.animate({
					top: '-=' + distance + 'px',
					opacity: 0
				}, time, 'swing', function () {
					// once the animate is complete, set the tracker variables
					shown = false;
					// hide the popup entirely after the effect (opacity alone doesn't do the job)
					popup.css('display', 'none');
				});
			}, hideDelay);
		});
	});
	
	});
	
	// End MiniKalendar
	
	// Fancybox 
	$("#saveit").fancybox({
		'modal' : true
	});
	
	$(".testlink").fancybox({
		'scrolling'		: 'no',
		'autoScale'		: true
	});
	
	$(".videolink").fancybox({
		'scrolling'		: 'no',
		'autoScale'		: true
	});
	
	$("a.group").fancybox({
		'hideOnContentClick' : false,
		'titleShow' : false,
		'showNavArrows' : true
	});
	// End Fancybox	
	// Coverflow start
	/*$(".jCarouselLite").jCarouselLite({
        btnNext: ".jCnext",
        btnPrev: ".jCprev",
        speed: "1000",
		visible: 6
		});*/
 	// Coverlow end
});
