$(document).ready(function(){
	$('#t_menu li').hover(
		function(){$(this).addClass('jshover');},
		function(){$(this).removeClass('jshover');}
	);
	
	$('#t_menu ul ul').each(
		function(){
			$(this).children('li:eq(0)').addClass('first');
			$(this).children('li:last').addClass('last');
		}
	);
	

	var tr = document.getElementsByTagName('tr');
	{
		for (var i=0, len=tr.length; i<len; i++) {
			if(tr[i].getElementsByTagName('td')[0])
			{
			  tr[i].getElementsByTagName('td')[0].className+=" td_f";
			}
		}
	}
	
	
var scroll_area;
sc_init();



$('#scr_left').click(function(){	
	//текущее положение скроллера
	L = $("#wrap_area").position().left;
	newL = L+scroll_area;

	if(newL>=0)
	{
		newL = 0;
		$('#scr_left').addClass('dis');
	}
	else
	{
		$('#scr_right').removeClass('dis');
	}

	//листаем
	gogo(newL);
	
});

$('#scr_right').click(function(){
	//текущее положение скроллера
	L = $("#wrap_area").position().left;
	//определяем в какую сторону листать
	
	newL = L-scroll_area;

	if(newL>=maxL)
	{
		newL = L-scroll_area;
		$('#scr_left').removeClass('dis');
	}
	else
	{
		newL = maxL;
		$('#scr_right').addClass('dis');		
	}
	
	//листаем	
	gogo(newL);	

	
});

function gogo(newL) { //листалка
	$("#wrap_area").animate({ 
		left : newL
	}, 700 );
}

function sc_init() {
//	scroll_area = $('#scroll_area').width();//видимая область
	scroll_area = 133; //ширина листания
	maxw = ($(".block").size())*$(".block").width(); //вся область
	maxL = (scroll_area*6)-maxw; //максимально докуда листать

	$('#scr_left').addClass('dis');
}

});


function menu_init() {
	$('#t_menu>ul>li').each(function(){
		var a = $(this).children('a');
		$(this).addClass('hover');							   		
		$(this).css('width',a.outerWidth());
		$(this).removeClass('hover');
	});
}

function wo(link,ww,hh,title) {
	w=window.open(link,'',(ww ? 'width='+ww+',' : '')+(hh ? 'height='+hh+',' : '')+'toolbar=0,scrollbars=0,resizable=yes');
	if (link.indexOf('.html')==-1) {
		if (document.layers) title='';
		w.document.open();
		w.document.write('<html><head><title>'+title+'</title><meta http-equiv=Content-Type content="text/html; charset=windows-1251"></head>');
		w.document.write('<body bgcolor=white marginwidth=0 marginheight=0 topmargin=0 leftmargin=0><table width=100% height=100% border=0 cellspacing=0 cellpadding=0><tr><td align=center><img src='+link+' width='+ww+' height='+hh+' border=0 alt=""></td></tr></table></body></html>');
		w.document.close();
	}
	w.focus();
}

function SubmitSearchForm( ) {
	if ( document.searchForm.searchtext.value.length > 0 && document.searchForm.searchtext.value != 'Поиск...' ) {
		document.searchForm.submit( );
	}
}