$(document).ready(function() {
	
	// Forside
	$("#content-columns div").click(function(){
		window.location=$(this).find("a").attr("href");
		return false;
	});
	
	$(".select").click(function(){
		window.location=$(this).find("a").attr("href");
		return false;
	});
	
	// Artikkelvisning for bil + mer
	//$('div#content-navigation ul li a').click(function() {
	//	$('div#content-navigation ul li a').removeClass('active');
	//	$(this).addClass('active');
	//	return false;
	//});
	
	$('div#content-media').cycle({
		fx: 'scrollHorz',
		timeout: '7500',
		pause: 0,
		next: '#content-media'
	});

	$('div#content-forside').cycle({
		fx: 'scrollHorz',
		timeout: '3500',
		next: 0
	});
	
	$('div#content-media-tips').delay(3000).fadeOut(500);
	
	$('div#content-media').hover(function() {
		$('div#content-media-tips').stop(true, true).fadeIn().delay(3000).fadeOut(500);
		return false;
	}, function() {
		$('div#content-media-tips').stop(true, true).fadeOut();
		return false;
	});
	
	// Kampanjer
	// $("#content-grid ul li").click(function(){
	//	window.location=$(this).find("a").attr("href");
	//	return false;
	// });
	
	$("#content-grid.kampanjer div.grid-overlay").hide();
	$("#content-grid.kampanjer div.grid-text").hide();
	
	$("#content-grid.kampanjer ul li").toggle(
		function(){
			$(this).children("div.grid-overlay").stop(true, true).fadeIn();
			$(this).children("div.grid-text").stop(true, true).fadeIn();
			$(this).children("div.grid-text").click(function(){
				window.location=$(this).find("a").attr("href");
				return false;
			});
			
			return false;
		},
		
		function(){
			$(this).children("div.grid-overlay").stop(true, true).fadeOut();
			$(this).children("div.grid-text").stop(true, true).fadeOut();
			return false;
	});
	
	$("#content-grid.ansatte div.grid-extra").hide();
	
	$("#content-grid.ansatte ul li").hover(
		function(){
			$(this).children("div.grid-extra").stop(true, true).slideDown();
			return false;
		},
		
		function(){
			$(this).children("div.grid-extra").stop(true, true).slideUp();
			return false;
	});
});
