
$(document).ready(function() {
	
	var Menu		= new MainMenu();
	var Bsa			= new BigScrollAnnounce();
	var Chsr		= new Chooser();

	
	if( $(".ribbon-scroll-viewport").length ) {
		ribbon_scroller		= new RibbonScroller();
	}
	
	$(".ribbon-scroll-viewport .item").hover(function() {
		$(this).find('.intro').show();
	}, function() {
		$(this).find('.intro').hide();
	});
	
	
	$("#main-menu A, #main-announce .scroll-left, #main-announce .scroll-right, #main-announce .settings-button, .chooser A, .clients-list-sectioned .section-divider-link A").clearFocusBorder();
	
	
	$(".clients-list-sectioned .section-divider-link A").click(function() {
		if( !$(this).parent().next().is('.active') ) {
			Set_Cookie("clients-list-opened-section-"+$(this).parent().parent().attr('type'), $(this).attr('href').substring(1) );
			$(".clients-list-sectioned .section-clients.active").slideUp(function() {$(this).removeClass("active"); }).prev().removeClass("active");
			$(this).parent().next().slideDown(function() {$(this).addClass("active")});
			$(this).parent().addClass('active');
			return false;
		} else {
			Set_Cookie("clients-list-opened-section-"+$(this).parent().parent().attr('type'), "" );
			$(".clients-list-sectioned .section-clients.active").slideUp(function() {$(this).removeClass("active"); }).prev().removeClass("active");
		}
	});
	
	
	$(window).scroll(function() {
		
		if( !($.browser.msie && $.browser.version=="6.0") ) {
			if( $(window).scrollTop() == 0 ) {
				$(".fixed-left-navigator:not(.year)").css('top', '150px');
			} else {
				$(".fixed-left-navigator:not(.year)").css('top', '110px');
			}
		}
	});
	
	$(".business-news-announce SELECT").change(function() {
		$(this).parent().find('.news_content').load(sHtmlRoot + "_ajax_handler.phtml?GetLastBusinessNews="+$(this).val());
	});
	
	
	$(".project-image:first .arr-up").hide();
	$(".project-image:not(.inbrowser):first .arr-down").css('top', '0px');
	$(".project-image.inbrowser:first .arr-down").css('top', '4px');
	$(".project-image:last .arr-down").hide();
	
	var img_counter = 0;
	$(".project-image").each(function() {
		$(this).attr("number", img_counter++);
	});
	
	$(".project-image .arr-up, .project-image .arr-down").click(function() {
		var cur_num = parseInt($(this).parents(".project-image").attr('number'));
		var delta = $(this).is('.arr-down')?1:-1;
		var to = $(".project-image[number="+(cur_num+delta)+"]");
		
		
		$(window).scrollTo(to, 500, { easing:'swing' });
		return false;
	});

	$(".sectors-links A").click(function() {
		Set_Cookie("ForceFilterReset", "1", 0, "/");
//		return false;
	});
	
	
});