
$(document).ready(function(){	   
    
	$("#news_front tr:first").show();
	
	$("#news_front div.act a, #example a, div.nice_select a.link").focus(function(){
          $(this).blur();
    });
	
	flag_act=0; // флаг открытия блока новостей, 0 - закрыт, 1 - открыт
	$("#news_front div.act a").click( function() {
		if (flag_act==0) {	
			$("#news_front tr").show();
			$(this).text("Скрыть новости");
			flag_act=1;			
		} else {
			$("#news_front tr:not(:first)").hide();
			$(this).text("Ещё новости");
			flag_act=0;
		}
		return false;
	} );
	
	$("#example a").click( function() {
		var val = $(this).text();		
		$("#footer_right td.input input").attr("value",val);
		return false;
	} );
	
	
	// открытие селекта
	
	$("div.nice_select a.link").click( function() {		
		var text = $(this).text();
		var ul = $(this).next("ul");
		ul.slideToggle("fast");
		if (!$(this).hasClass("link_on")) {		
			ul.find("a.on").removeClass("on");
			ul.find("li").each(function(i){ 
  				if ($(this).find("div").text()==text) {
					$(this).find("a").addClass("on");
				}
			});	
		}	
		$(this).toggleClass("link_on");
		return false;
	} );
	
	$("div.nice_select ul a").hover(function(){ 
  		if (!$(this).hasClass("on")) {
			$(this).parents("ul").find("a.on").removeClass("on");
			$(this).addClass("on");
		}
	});

    
});





