

$(document).ready(function(){
	$('.tab_b ul li a').click(function(){
		var tab_class = $(this).parent().attr('class');
		if ($(this).hasClass('active')) {}
		else {
			$(this).parent().parent().find('li a').removeClass('active');
			$(this).addClass('active');
			$(this).parent().parent().parent().parent().find('.tabs_b_m .tb_cont').removeClass('tb_cont_active');
			$(this).parent().parent().parent().parent().find('.tabs_b_m .tb_cont').each(function(){
				if ($(this).hasClass(tab_class)) {
					$(this).addClass('tb_cont_active');
				}
			})
		}
		return false;
	});
})

/* Функция поддержки формы поиска. Вешается на поле ввода (input type="text") */
function SendSearch_Key(ev, text) {
	if (!ev) ev = window.event;
	if (ev.keyCode == 13) { SendSearch(text); return false; }
}

/* Функция поддержки формы поиска. Вешается на кнопку поиска (div) */
function SendSearch(text) {

	//debugger;
	var tx = document.getElementById(text);

	var oldForm = document.getElementById("MainForm");
	oldForm.action = "/search/";
	//document.body.removeChild(oldForm);


	var inp = document.createElement("input");
	inp.type = "text";
	inp.name = "text";
	inp.value = tx.value;
	inp.style.visibility = "hidden";

	var f = document.createElement("form");
	f.appendChild(inp);

	// Add it to the document body
	document.body.appendChild(f);

	// Add action and method attributes
	f.action = "/search/";
	f.method = "POST"

	// Call the form's submit method
	f.submit();

	return false;


	//	var newURL = "/search/?text=" + encodeURI(tx.value);
	//	window.location.href = newURL;
}

