$(document).ready(function(){
	
	$("#bartextarea").keyup( 
		function() { 
			var perex = $("#bartextarea").val();
			if(perex.length>=254) {
				$("#bartextarea").val(perex.substring(254,0));
				$("#bar").width(254);
			}
			else {
				$("#bar").width(perex.length);
			}
		}
	);

	$("#left > ul.multimenu").css({"margin-top":"10px","margin-left":"0px"});
	$("#left > ul.multimenu").width("192px");
	$("#left > ul.multimenu").show();

	$(document).click(
		function() {
			$("#left li ul.multimenu").fadeOut(0);
			$("#left ul.multimenu li a").css({"background-color":"transparent","color":"Black","font-weight":"Normal"});
			$("#left ul.multimenu li div").css({"background-color":"transparent","color":"Black","font-weight":"Normal"});
		}
	);

	$(".multimenu > li").mouseover( 
		function() {
			$(this).siblings().children("ul.multimenu").fadeOut(0);
			$(this).siblings().children("a").css({"background-color":"transparent","color":"Black","font-weight":"Normal"});
			$(this).siblings().children("div").css({"background-color":"transparent","color":"Black","font-weight":"Normal"});
			$(this).siblings().children("ul").children("li").children("a").css({"background-color":"transparent","color":"Black","font-weight":"Normal"});
			$(this).children("ul.multimenu").fadeIn(0);
			$(this).children("a").css({"background-color":"Black","color":"White","font-weight":"Bold"});
			$(this).children("div").css({"background-color":"Black","color":"White","font-weight":"Bold"});
		}	
	);
	
	$(".control").click(
		function() {
			if($(this).siblings('ul').css('display')=='none') {
				$(this).siblings('ul').show(200);
				$(this).css('background-image','url("/images/tree/minus.gif")');
			}
			else {
				$(this).siblings('ul').hide(200);
				$(this).css('background-image','url("/images/tree/plus.gif")');
			}
		}	
	);


});
