$(function(){
	//заменяем шрифты	   
	//Cufon.replace('h1, h2, .mnu_link, .ann_title, .pub_title, .item_title', {hover: true});
	$("table.striped tr:nth-child(even)").addClass('darkstrip');
	
	$('.item_photo a').lightBox();
	$('.banner').slideShow();
	$('.kolgallery').kolgallery();
	
	
	//подгонка контента по высоте
	function fixHeight()
	{
		var leftbar_height = $('#leftbar').height();
		if(leftbar_height > $('#content').height())
			$('#content').height(leftbar_height);
	}
	//fixHeight();
	
/********** события поискового поля ввода *********/
	var srch_sample = "Поиск по сайту";
	var srch_textbox = $('#search .textbox');
	
	//пишем в пустом поле "например"
	function sample_textbox()
	{
		var trim_val = $.trim(srch_textbox.val()) 
		if (trim_val == "")
			srch_textbox.removeClass("active").val(srch_sample);
		else
			srch_textbox.val(trim_val);
	}
		
	srch_textbox.focus(function(){
	 if(!srch_textbox.hasClass("active"))
		srch_textbox.addClass("active").val("");
	});
	
	srch_textbox.blur(function(){
		sample_textbox()
	});
	
	sample_textbox();	
	
	$('#search').submit(function(event){
		//отправляем форму, если в строку поиска введено значение
		if(srch_textbox.hasClass("active") && $.trim(srch_textbox.val())!="")
			return true;
		else
			return false;
	})

	//скрытие-раскрытие разделов каталога
	/*
	$('.tree a').click(function(event) {
		var block = $(this).parent();
		var next_ul = block.next("ul");								   
		if(next_ul.length >0 ){
			if(next_ul.css("display")=="none")
			{
				block.addClass("Open");
				next_ul.slideDown(300);
			}
			else
				next_ul.slideUp(300, function() {
					block.removeClass("Open");											  
				});
			return false;
		}
	})
	*/
});

