(function($) {


	$.fn.clickMe = function(op_user) {
		
		var menuName = this,				
			op = $.extend( cm.op_default , op_user);
			
		$(menuName).find("li:has(ul)").addClass("arrow");
		
		$(op.moveIt).css({ marginTop: op.moveItMargin });
		
		
		$(menuName).find("a").click(function() {
		
			var ulsVisible = $(menuName).find("ul").is(":visible");
			var testUl = $(this).next("ul").is(":visible");
			
		
			if (ulsVisible) {
			
				if(testUl) {					
					$(menuName).find("li").removeClass(op.activeMenu);
					moveContent(); 
					$(this).next("ul").animate(op.aniHide, op.speed);			
				} else {
					$(menuName).find("li").removeClass(op.activeMenu);						
					$(menuName).find("ul").animate(op.aniHide, op.speed);
					$(this).parent("li").addClass(op.activeMenu);
					 moveContent();
					$(this).next("ul").animate(op.aniShow, op.speed );
				}
			} else {
				$(this).parent("li").addClass(op.activeMenu);
				moveContent();
				$(this).next("ul").animate( op.aniShow, op.speed);			
			}
		});
			
	
		function moveContent() {
				
			var ulHeight = $("."+op.activeMenu +" ul").height() ;
			var moveMargin = parseFloat($(op.moveIt).css("margin-top"));
			var dif = ulHeight + op.moveItMargin - moveMargin;					
						
			if (ulHeight == moveMargin) {

			} else if (ulHeight < moveMargin) {			
				$(op.moveIt).animate({marginTop: "+=" + dif}, op.speed);

			} else if (ulHeight > moveMargin){
				$(op.moveIt).animate({marginTop: "+=" + dif}, op.speed);			
				
			}				 							
		}
		
	};

	var cm = $.fn.clickMe;
	cm.op = {};
	cm.op_default = {
		<!--activeMenu: "current",-->
		moveIt: ".content",
		moveItMargin : 0,
		aniShow: {  height: "show"},
		aniHide: {  height: "hide"},
		speed: "slow"
		        

	};

})(jQuery);
       




