$(document).ready(function(){

// Menu processor
var menuItems = $("a.a_menu");
for ( var i=0, n=menuItems.length; i<n; i++){
	var div_el = $(menuItems[i]).parent();
	$(div_el).hover(
		function () {
			$(this).addClass("div_menu_cell_hover");
			  }, 
			  function () {
				$(this).removeClass("div_menu_cell_hover");
			  }
			);
}
	
// Hot News
var h_main_content = $("div.e_rndc").outerHeight();
var h_left_content = $("div.div_menu").outerHeight(true) + $("div.div_hn").outerHeight(true);

var adj = 0;
if ( navigator.appName == "Microsoft Internet Explorer" ){
	msft = 1;
	adj = 2;
} else {
	msft = 0;
}

if( h_main_content < h_left_content) {
	h = $("div.main_content").height();
	$("div.main_content").height(h + h_left_content - h_main_content - adj);
} else if ( h_main_content > h_left_content){
	h =  $("div.hn_content").height();
	$("div.hn_content").height(h + h_main_content - h_left_content);
} // and skip if equals

// Lng btn animate
var fadeToValue = 0.5;
$("img.img_btn_ln").fadeTo("fast",fadeToValue);
$("img.img_btn_ln").hover(
			  function () {
				$(this).fadeTo("fast", 1.0);
			  }, 
			  function () {
				$(this).fadeTo("fast", fadeToValue);
			  }
			);
						  

// News
$("table.tbl_news tr").hover(
	function(){
		$(this).addClass("tr_news_w_hover");
	},
	function(){
		$(this).removeClass("tr_news_w_hover");
	});
$("table.tbl_news tr").click(
	function(){
		window.location=$(this).find("a:first").attr("href");
	});


// Grant Projects
$("div.div_gp").hover(
	function(){
		$(this).addClass("div_gp_w_hover");
	},
	function(){
		$(this).removeClass("div_gp_w_hover");
	});
$("div.div_gp").click(
	function(){
		window.location=$(this).find("a:first").attr("href");
	});

// Library
$("div.div_lib_container").hover(
	function(){
		$(this).addClass("div_lib_container_w_hover");
	},
	function(){
		$(this).removeClass("div_lib_container_w_hover");
	});
});
