
			var scrollSpeed = 30;
			var step = 1;
			var current = 0;
			var restartPosition = 1614;
			function scrollBg(){
				current -= step;
				if (current == restartPosition){ current = 0; }
				$('#topclimat_header').css("background-position",""+current+"px 100%");
			}
			//var inittopbg = setInterval("scrollBg()", scrollSpeed);
			//$('#topclimat_header').css("background-position","100px 100%");
			//$("#topclimat_header").animate({ opacity: 0.5 }, 3500 );
			//$("#topclimat_header").animate({backgroundPosition: '-1000'}, 50000, 'linear');
	function scrollTopBg(){
		$("#topclimat_header").animate({backgroundPosition: '0'}, 50000, 'linear').animate({backgroundPosition: '-1600'}, 0);
		setTimeout("scrollTopBg()",50000);
	}
$(document).ready(function(){
	//scrollTopBg();

		$('.tabs_block .panes .pane_tabs').hide();
		$('.tabs_block .panes').find('.pane_tabs:eq(0)').show();
		$('.tabs_block .title_tabs a').removeClass('current');
		$('.tabs_block .title_tabs').find('a:eq(0)').addClass('current');
		$('.tabs_block .title_tabs a').click(function () {
			var thistab = $(this).parent().parent();
			thistab.find('.panes .pane_tabs').hide();
			thistab.find('.title_tabs a').removeClass('current');
			$(this).addClass('current');
			$('#'+$(this).attr('id')+'-pane').show();
			return false;
		});
	
	$('.butslidepub a').click(function () {
		if($(this).parent().prev().is(':visible')) { $(this).parent().prev().slideToggle();$(this).html('Читать полностью &or;'); }
		else { $(this).parent().prev().slideToggle();$(this).html('Свернуть &and;'); }
		return false;
	});
	$("#viewitem a").click(function(){ if($(this).attr('href').substr(0, 1)=='#' && $(this).attr('id')!='ontop' && $(this).attr('href')!='#') { $("html, body").animate({ scrollTop: ($($(this).attr('href')+', a[name="'+$(this).attr('href').substr(1)+'"]').offset().top-30) }, 2000);}});//return false;
	
	var	tcoffset = $("#topclimat_content .width").offset();
	$("#divStayTopRight").css({ marginLeft: 0-tcoffset.left });
	$("#ontop").css({ marginLeft: 0-tcoffset.left-$("#topclimat_content .rightcolumn").width()-8 });
	$(window).resize(function(tcoffset){
		var	tcoffset = $("#topclimat_content .width").offset();
		$("#divStayTopRight").css({ marginLeft: 0-tcoffset.left });
		$("#ontop").css({ marginLeft: 0-tcoffset.left-$("#topclimat_content .rightcolumn").width()-8 });
	});
	var offset = $("#divStayTopRight").offset();
	var header_h = $('#topclimat_header').height();
	var infcat_h = $('#tc_infcat').height();
	var cats_h = $('#tc_cats .cats_cont').height();
	var banner_h = 420;
	var topPadding = ($(window).height()-banner_h)/2;
	$(function() { 
		var wscrtop = $(window).scrollTop();
		if(wscrtop<(header_h+infcat_h+cats_h-topPadding+10)) topPadding2 = header_h+infcat_h+cats_h-wscrtop+10;
		else topPadding2 = 0;
		$("#divStayTopRight").stop().animate({ marginTop: wscrtop - offset.top + topPadding2 }, 4000);
		if (wscrtop==0) $("#ontop").hide();
	});
	$(window).scroll(function() {
		var wscrtop = $(window).scrollTop();
		var wheight = $(window).height();
		var dheight = $(document).height();
		if(wscrtop<(header_h+infcat_h+cats_h-topPadding+10)) topPadding2 = header_h+infcat_h+cats_h-wscrtop+10;
		else if(dheight<=(wheight+wscrtop+120)) topPadding2 = dheight-(wheight+wscrtop-(wheight-(banner_h+$('#topclimat_footer').height())));
		else topPadding2 = (wheight-banner_h)/2;
		if (wscrtop > offset.top) { $("#divStayTopRight").stop().animate({ marginTop: wscrtop - offset.top + topPadding2 }, 4000); } 
		else { $("#divStayTopRight").stop().animate({ marginTop: wscrtop - offset.top + topPadding2 }, 4000); };
		if (wscrtop==0) $("#ontop").hide();
		else $("#ontop").show();
		if((dheight-(wheight+wscrtop))<$('#topclimat_footer').height()) $("#ontop").css({ marginBottom: ($('#topclimat_footer').height()-(dheight-(wheight+wscrtop))) });
		else $("#ontop").css({ marginBottom: 0 });
	});
	
	$("#divStayTopRight .close").click(function() { $("#divStayTopRight").remove(); return false; });
	$("#ontop").click(function(){ $("html, body").animate({ scrollTop: 0 }, 2000);return false;});
	
	$(".ROP .item-vote a").click(function() { 
		var idsrate = jQuery(this).parent().parent().attr("id").split("-");
		var vote=0, value=0;
		var on, op, op2;
		if (idsrate[1]=='user') { on = ''; op = 'данного критика'; op2 = 'себя'; }
		if (idsrate[1]=='blog') { on = ' сообщество'; op = 'данное'; op2 = 'свое'; }
		if (idsrate[1]=='brands') { on = ' бренд'; op = 'данный'; op2 = 'свой'; }
		if (idsrate[1]=='firms') { on = ' раздел'; op = 'данный'; op2 = 'свой'; }
		if (idsrate[1]=='company') { on = ' компанию'; op = 'данную'; op2 = 'свою'; }
		if (idsrate[1]=='goods') { on = ' оборудование'; op = 'данное'; op2 = 'свое'; }
		
		if(jQuery(this).attr("title")=='+') value = 1;
		if(jQuery(this).attr("title")=='-') value = -1;
		//if(jQuery(this).hasClass('none')) {
		//} else 
		if(jQuery(this).hasClass('ok')) {
			vote=2;
		} else {
			$.post("/ajax.index.php", { option: idsrate[1], task: "vote", item: idsrate[2], value: value },
				function(data){
		//	alert(data);
					parsed = data.split('|');
					if(parsed[3]=='isok') vote=2;
					if(parsed[3]=='error') vote=4;
					if(parsed[3]=='noauth') vote=0;
					if(parsed[3]=='ok') {
						vote=1;
						classnum = (parsed[2]>0?'vote-good':(parsed[2]<0?'vote-poor':'vote-none'));
						$('#rate-'+parsed[0]+'-'+parsed[1]+' span span').html(parsed[2]).removeClass('vote-none').removeClass('vote-poor').removeClass('vote-good').addClass(classnum);
						$('#rate-'+parsed[0]+'-'+parsed[1]+' span a.vote-poor, #rate-'+parsed[0]+'-'+parsed[1]+' span a.vote-good').addClass('ok').removeClass('none');
					}
			//alert(vote);
		if (vote==0) { alert('Пожалуйста авторизируйтесь чтобы поставить оценку'); return false; }
		if (vote==1) { alert('Спасибо что поделились с нами своим отношением'); return false; }
		if (vote==2) { alert('Вы уже оценивали '+op+on); return false; }
		if (vote==3) { alert('Вы не можете оценивать '+op2+on); return false; } 
		if (vote==4) { alert('Во время обработки произошла ошибка'); return false; } 
					//$('body').noticeMsg(parsed[3]);
				}
			);
		}
	/*	if (vote==0) { alert('Пожалуйста авторизируйтесь чтобы поставить оценку'); return false; }
		if (vote==2) { alert('Вы уже оценивали '+op+on); return false; }
		if (vote==3) { alert('Вы не можете оценивать '+op2+on); return false; } 
		if (vote==4) { alert('Во время обработки произошла ошибка'); return false; } 
	*/
	 return false;
	});

	if((window.location.hash.substr(1,7)=='cgprice')) {
		//$("#listfirms .itemlist").hide();
		//$("#listfirms .itemlist#cgprice_"+window.location.hash.substr(9)).show();
		//window.scrollTop($("#gde_kupit_good").offset().top-0);
		//$("html, body").animate({ scrollTop: ($("#gde_kupit_good").offset().top-30) }, 0);
		//	return false;
	}
});
