function initMenus() {
	$('ul.menu ul').hide();
	$('ul.menu li.active ul').show();
	$.each($('ul.menu'), function(){
		$('#' + this.id + '.expandfirst ul:first').show();
	});
	//$('ul.menu li a').click(
	$('ul.menu li a').click(
		function() {
			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;

			if($('#' + parent).hasClass('noaccordion')) {
				$(this).next().slideToggle('normal');
				return false;
			}
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				if($('#' + parent).hasClass('collapsible')) {
					//$('#' + parent + ' ul:visible').slideUp('normal');
				}
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				//$('#' + parent + ' ul:visible').slideUp('normal');
				checkElement.slideDown('normal');
				return false;
			}
		}
	);
}
$(document).ready(function() {
		initMenus();
		

		
		$('table.cal td').tooltip({ 
		    delay: 1,
		    showURL: false,
		    top: 2,
			left: 5,
		    bodyHandler: function() { 
		    	var val = $(this).attr('content');
		    	if (val != undefined && val != ' ') {
		    		return $("<div/>").html( val	 );
		    	}
		    } 
		});

});


function popup(url, name, width, height, menu, resize, status) {
	custompop(url, width, height, status, menu);
	return true;
}

function custompop(url, width, height, status, menu) {
   win = window.open(url, 'bmwin_popup', 'toolbar=no,location=no,directories=no,status=' + status +  ',menubar=' + menu + ',scrollbars=yes,resizable=yes,copyhistory=no,width=' + width + ',height=' + height);
   win.focus();
}