// JavaScript Document

$(document).ready(function() { 
    $('#publications .brief_publication').click(function() { 
        $.blockUI({ css: { 
            border: 'none', 
            padding: '15px', 
            backgroundColor: '#000', 
            '-webkit-border-radius': '10px', 
            '-moz-border-radius': '10px', 
            opacity: .5, 
            color: '#fff' 
        } }); 
 
        setTimeout($.unblockUI, 2000); 
    }); 
});

// Highlight the news on mouse hover.
$(document).ready(function(){
	$('#publications .brief_publication').hover(function(){
		if (this.id == 'brief_1'){
			$('#publications .brief_publication').removeClass('news_highlight');
			$(this).addClass('news_highlight');
		}
		if (this.id == 'brief_2'){
			$('#publications .brief_publication').removeClass('news_highlight');
			$(this).addClass('news_highlight');
		}
		if (this.id == 'brief_3'){
			$('#publications .brief_publication').removeClass('news_highlight');
			$(this).addClass('news_highlight');
		}
	},function(){
		$('#publications .brief_publication').removeClass('news_highlight');
	});
});

// side menu code
function initMenu() {
	$('#left_pane .left_pane_tooltip').hide();
	$("#left_pane .left_pane_content").each(function(){
		var _this = $(this);
		_this._sliding = false;

		$(this).hover(
			function() {
				if(_this._sliding) return false;
				_this._sliding = true;
				var _slider = $(this).find("div.left_pane_tooltip").eq(0);
				if(_slider) {
					$(this).addClass("active")
					$(_slider).slideDown(300,function(){
						_sliding = false;
					});
				}
			},
			function() {
				_this = $(this);
				var _int;
				_int = setInterval(function(){
					if(!_this._sliding){
						clearTimeout(_int);
						var _slider = $(_this).find("div.left_pane_tooltip").eq(0);
						if(_slider) {
							$(_this).removeClass("active")
							$(_slider).slideUp(300);
						}
					}
				},200);
			}
		);
	});
}

// page init code
$(document).ready(function(){
	initMenu();
});
