$('document').ready(function(){
	fontSize("#font_size", "#content, #sidebar, #menu_main, #menu_meta, #menu_language, #menu_root", 9, 12, 15);
	
	$("#to_top").css({"visibility":"visible"});
	
	if ($.browser.msie && $.browser.version < 9){
		$("#overlay_open").click(function(){
			$("#quicklinks").stop().show();
			$("#overlay").stop().show();
			$("#overlay_open").stop().hide();
		});
		$("#overlay_close").click(function(){
			$("#quicklinks").stop().hide();
			$("#overlay").stop().hide();
			$("#overlay_open").stop().show();
		});
	}
	else {
		$("#overlay_open").click(function(){
			$("#quicklinks").stop().fadeIn('slow').show();
			$("#overlay").stop().fadeIn('slow').show();
			$("#overlay_open").stop().fadeOut('slow').hide();
		});
		$("#overlay_close").click(function(){
			$("#quicklinks").stop().fadeOut('slow').hide();
			$("#overlay").stop().fadeOut('slow').hide();
			$("#overlay_open").stop().fadeIn('slow').show();
		});
	}


	if(!$.cookie('visits')){
	  $.cookie('visits',1, {expires: 1});
	}
	$.cookie('visits', (parseInt($.cookie('visits')) + 1), {expires: 1})
	if(parseInt($.cookie('visits')) < 3){
	    $('#quicklinks, #overlay').show();
	    $('#overlay_open').hide();
	}

	var hoehe = $('.container').outerHeight();
	$("#overlay").css({'height':hoehe});
	
	$("#to_top").click(function(){
		$('html, body').animate({ scrollTop: 0 }, 'fast');
	});
	var sort_order = jQuery.url.param("tx_indexedsearch[order]");
	if (sort_order == "mtime") {
		$("option.mtime").attr("selected", "selected");
	} else  {
		$("option.rank_flag").attr("selected", "selected");
	}
});
