$(document).ready(function(){
	
/*******************************************
Brødkrumme
*******************************************/

	var nav = $(".page-navigator");

	nav.parent().height(0);
	
	var section = nav.find("a").eq(1).text();
	//alert(section);
	var menuLink;
	$(".swPageCol .link a").each(function(index){
		if(jQuery.trim($(this).text()) == section) {
			menuLink = $(this).attr("href");
		}
	});
	nav.find("a").eq(1).attr("href", menuLink);
	
	
	
/*******************************************
Nyheder
*******************************************/
	
	$(".news table").eq(0).addClass("heading");
	$(".news table").eq(1).addClass("heading-space");
	
	$(".news .heading tr").eq(1).addClass("tr-space");
	
	$(".swShow_news_small_List .swShow_news_small:first").addClass("newsTopItem");
	
	if ($(".swParent").text().length == 0) {
		$(".swShow_news_small_List .swShow_news_small:first").addClass("hidden");
	}
	


/*******************************************
Søgning
*******************************************/

	$("*[@behaviours='inputInitValue']").focus(function() {

		if (!$(this).attr("oldValue")) {
			$(this).attr("oldValue", $(this).attr("value"));
		}
		
		if ($(this).attr("value") == $(this).attr("oldValue")) {
			$(this).attr("value", "");
		}
	});
	
	$("*[@behaviours='inputInitValue']").blur(function() {
	
		if (!$(this).attr("value")) {
				$(this).attr("value", $(this).attr("oldValue"));
		}
	});

	inputInitValue();


});


/*******************************************
Søgning
*******************************************/

/* Clear and set initial value of input fields */
function inputInitValue() {

	$("*[behaviours='inputInitValue']").focus(function() {

		if (!$(this).attr("oldValue")) {
			$(this).attr("oldValue", $(this).attr("value"));
		}
		
		if ($(this).attr("value") == $(this).attr("oldValue")) {
			$(this).attr("value", "");
		}
	});
	
	$("*[behaviours='inputInitValue']").blur(function() {
	
		if (!$(this).attr("value")) {
				$(this).attr("value", $(this).attr("oldValue"));
		}
	});
}