function closeDummy() {
	$("#pageSelector").slideUp(200);
	return false;
}
function limitChars(textid, limit, infodiv) 
{ 
    var text = $("#"+textid).val();  
    var textlength = text.length; 
    if(textlength > limit) 
    {
        $("#" + infodiv).html("<em>Du kan ikke skrive mere end "+limit+" tegn!</em>"); 
        $("#" + textid).val(text.substr(0,limit)); 
        return false; 
    } 
    else
    { 
        $("#" + infodiv).html("<em>Tegn tilbage: "+ (limit - textlength) +"</em>"); 
        return true; 
    }
}

$(document).ready(function(){
  //$(".mainContainer1").prepend("<img class=\"logoillu\" src=\"/images/backgrounds/logoIllustration.gif\" /><div class=\"clipper\"><img src=\"/images/backgrounds/contentTop.png\" width=\"846\" height=\"31\" alt=\"\" /></div>").css("background","none");

  $(".mainMenu a.current").addClass("active").parents("ul").siblings("a").addClass("active arrow");
  //$(".mainMenu a ~ ul").siblings("a").wrapInner("<span></span>").click(function() {
  //   $(this).addClass("active").siblings("ul").slideDown(300).parent().siblings("li").children("a.active").removeClass("active").siblings("ul").slideUp(150);
  //    return true;
  //});

	$(".mainContent label a span").parent().css("cursor","default").hover(
		function () {
			if($("span",this).queue("fx").length < 2) {
	  			$("span",this).fadeIn(300);
			}
		}, 
		function () {
			$("span",this).fadeOut(150);
		}
	);
	$(".replyWithComments").click(function () { 
			var message = $(this).parent().parent();
			if (!message.next().show().hasClass("mForumThreadReply")) {
				$(".mForumThreadReply").clone().show().insertAfter(message).end().remove();
				
				
				$(".mForumThread .abort").click(function() {
				  $(".mForumThread .mForumThreadReply").hide();
				});
				var citeContent = $.trim($(".content", message).html().replace(new RegExp("(.|\\n)*<\/div>", "gi" ),''));
				if(citeContent.length > 0) {
				  var cite = "[citat skribent='" + $.trim($(".threadAuthor", message).text()) + "' dato='" + $.trim($(".threadDate", message).text()) + "']" + citeContent + "[/citat]";
				} else {
				  var cite = "";
				}
				$(".comment").text(cite).focus();
				$(".reply .comment").keyup(function() {
					var strLength = this.value.length;
					$(".reply .counter em").html("Tegn tilbage: "+ (4000 - strLength));
				});
				
				var strLength2 = $(".comment").val().length;
				$(".reply .counter em").html("Tegn tilbage: "+ (4000 - strLength2));

			}
			return false;
    });
	$(".comments li:odd").addClass("alt");
	
	$(".topMenu > li:has(ul)").hover(function() {
		$(this).children('a:first').addClass('hover').next().show();
	}, function() {
		$(this).children('a:first').removeClass('hover').next().hide();
	});
	$(".poiPointer").hover(function(){
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});
});

