
//jQuery onReady
var jq = jQuery.noConflict();
jq(document).ready(function($){

//-----
// Fjern titeltekst på news catmenu
//-------
$('.arc-menu').children('a:first').remove();

//-----
// Flyt beskrivende tekst i news søgning til input feltet
//-----
$('.news-search-form .query').val($('.news-search-emptyMsg').text());
$('.news-search-emptyMsg').remove();
//tøm værdi på focus
$(".news-search-form .query").each(function(){
		var ov = $(this).val();
		
		$(this).focus(function(){
			var fv = $(this).val();
			if (fv == ov) {
  				$(this).val('');
  			}
		});
	
		$(this).blur(function(){
			var bv = $(this).val();
  			if (bv.length < 1) {
  				$(this).val(ov);
  			}
		});
});
	



$('.menu li:first a').addClass('first');

if($('.adv ul')){
$('.adv ul').each(function(){
// safeguard against missing LI's
 if ($(this).children('li').length > 0) {
 var what = $(this).children('li:last').html().replace(",", "");
 $(this).children('li:last').html(what);
 }
});
}
//----
// Carousel
//----
	$('.jcarousellite').jCarouselLite({
	    btnNext: ".jcarousellite .next",
	    btnPrev: ".jcarousellite .previous"
	});
	
	// Get alt text and put under img
	$('.jcarousellite li img').each(function(){
		var altText = $(this).attr('alt');
		$(this).after('<p>'+altText+'</p>');
	});
	
// End Carousel

//mouseover knapper
$('.box .version2').hover(function(){
    $('.logo').addClass("hovercs");
  },
  function () {
    $('.logo').removeClass("hovercs");
  }
);

$('.box .version1').hover(function(){
    $('.logo').addClass("hoverfonde");
  },
  function () {
    $('.logo').removeClass("hoverfonde");
  }
);

//----
// Accesskeys
//----

$('#accesskeys a').focus(function(){
		$('#accesskeys').attr("style","left: 10px; z-index:999;");
});
$('#accesskeys a').blur(function(){
		$('#accesskeys').attr("style","left: -9999px; z-index:0;");
});

//----
// Shadowbox
//----

//Shadowbox.init();
Shadowbox.init({
    // let's skip the automatic setup because we don't have any
    // properly configured link elements on the page
    skipSetup: true,
    // include the iframe player because we want to display some iframe content
    players: ["iframe","img"]
});

$('#kort area').each(function(){
	Shadowbox.setup($(this), {width:780, height:600});
	$(this).click(function(){
		var href = $(this).attr('href');
		return false;
	});
});
/*
//gallery shadowbox
$('.box02 .box li a').each(function(){
	Shadowbox.setup($(this));	

});
*/	
	
	

}); // End jQuery onReady

// cookie functions http://www.quirksmode.org/js/cookies.html
/*
function createCookie(name,value,days){
	if (days)	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name){
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++){
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name){
	createCookie(name,"",-1);
}
*/
// cookie functions end



