
//jQuery onReady

$(document).ready(function(){


/*---- 
	This function enables the menu with the id of ul_nav
	to show the submenu. Works in all browsers
----*/
 	
$('.side-nav li').hover(function(){
	$(this).addClass("hover");
}, function(){
	$(this).removeClass("hover");
});

//cosmetic fix on form
$('.csc-mailform-submit').parent().addClass("none");

//----
// 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;");
});

//--------
//Anchor to top
//----------
$('.content-bottom .top').each(function(){
	var siteUrl = window.location;
	var topId = $('#header a:first').attr("id");
	$(this).attr("href", siteUrl + "#" + topId);
});
 
//----------
//Section menu fix
//-------------
$('.menu-box .box ul li:eq(3)').addClass("last");
$('.menu-box .last ul li:eq(3)').addClass("last");


//-------
//pagebrowser
//---------
$('.results_numbers a:contains("Næste")').addClass("browse-next");
$('.results_numbers a:contains("Forrige")').addClass("browse-prev");

$("input:text").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);
 }
 });
});
 

}); // 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
