jQuery(document).ready(function($) {


	$('stang_thickbox').click(function(){
		tb_remove();
		return false;
	});



	function bg_size(){
		$("#bg1, #bg2, #bg3, #bg4, #bg5, #bg6, #bg7, #bg8").css("min-height", $(document).height());
	}
	$(window).load(function(){
		setTimeout(bg_size, 1000)
		$(window).resize(function(){
			$("#bg1, #bg2, #bg3, #bg4, #bg5, #bg6, #bg7, #bg8").css("min-height", "auto");
			$("#bg1, #bg2, #bg3, #bg4, #bg5, #bg6, #bg7, #bg8").css("min-height", $(document).height());
		});
	});
	
    // $() will work as an alias for jQuery() inside of this function
	//Cufon.replace('h1');  
	var orgSrc = $('.dropdown_sida').find('img:first').attr("src"),
		nySrc = $('.dropdown_sida').find('.dropdown_over').html(),
		openClose = false;
	
	$('.dropdown_sida').click(function(){

		if (!openClose) {
		
			openClose = true;// set the dropdown to open status if clicked again
			$(this).find('img:first').attr("src", nySrc);// change image
			$(this).find('.dropdown_boxen').show();
		}
		else {
			openClose = false;// set the status to closed
			$(this).find('img:first').attr("src", orgSrc);
			$(this).find('.dropdown_boxen').hide();
		}

	});
	
	var myUrl = location.pathname.split("/");
	var langd = (myUrl.length - 2);
	
	
	$('.overrull[href*="'+ myUrl[langd] +'"]').each(function(){
		var imgHref = $(this).find('img').attr('src'),
			aRel = $(this).attr('rel');
		$(this).find('img').attr('src', aRel);
		$(this).attr('rel', imgHref);
	});
	
	$('.overrull').each(function(){
		var imgHref = $(this).find('img').attr('src'),
			aRel = $(this).attr('rel');
		$(this).hover(function(){
			$(this).find('img').attr('src', aRel);
		}, function(){
			$(this).find('img').attr('src', imgHref);
		});
	});

/* sidomenyn padding


	$('#sidebar a').each(function(){
		var padL = $(this).css("padding-left"),
			nyPadL = (parseFloat(padL.replace(/[^\d\.]/g, '')) + 10);
			
		
		$(this).hover(function(){	
			$(this).stop().animate({"paddingLeft": nyPadL}, 200);
		}, function(){
			$(this).stop().animate({"paddingLeft": padL}, 200);
		});
		
	});
*/

/* content minst lika hoeg som sidebar
$(window).load(function() {
	var psSidebarHeight = 0;
	var psFinalHeight = $("#sidebar").each(function(){
		var sidebarHeight = $(this).outerHeight();
		if(psSidebarHeight < sidebarHeight){
			psSidebarHeight = sidebarHeight;
		}
		return psSidebarHeight;
	});
	var psContentHeight = $("#content").outerHeight();
	if(psContentHeight < psFinalHeight.outerHeight()){
		$("#content").css({"min-height": psFinalHeight.outerHeight() + "px"});
	}else{
		$("#sidebar").css({"min-height": psContentHeight + "px"});
	}
});
*/

$(window).load(function() {
	var pageHojd = $("#pageWrapper").outerHeight();
	
	$("#pageWrapper > div, #pageWrapper > ul").each(function(){
		
		var thisHeight = $(this).outerHeight(),
			diff = ( parseInt(pageHojd) - parseInt(thisHeight) );
		if(diff != 0){
			$(this).css({"min-height": ($(this).height() + diff) + "px"});
		}
		
	});
	
	//$("#pageWrapper > div, #pageWrapper > ul").css({"min-height": pageHojd + "px"});
});


//$('.rund').corner();


});
