Cufon.replace('.contacts_lable, .contacts_field, .footer .label, .create, h1, h2, .yearer', { fontFamily: 'cambria', hover: true });

$(document).ready(function() {
	
	//Добавляем всем картинкам в новости 
	jQuery('.newswrapper img').addClass('news_pic');
	jQuery('.news_pic').wrap('<a href />');
	
	
	var countOfElement = jQuery('.gallery_scroller li').size();
	var countMove = 0;
	
	//Подгоняем размер скроллера картинок
	if (jQuery('.gallery_scroller li')) {
		var countLi = jQuery('.gallery_scroller li').size();
		if (countLi<7) 	jQuery('.gallery_previews_container').width(countLi*101+10);
	}
	
	
	
	
	
	$(".footer_bg").append('<div class="corner_lt"></div><div class="corner_rt"></div><div class="corner_lb"></div><div class="corner_rb"></div><div class="divider_left"></div><div class="divider_right"></div>');
	
	$("ol.styled li").wrapInner('<div class="wrapper"></div>');
	
	$(".pic_popup").append('<div class="close"></div>');
	
	$(".news_pic").click(function(){
		jQuery('.pic_popup img').attr('src',jQuery(this).attr('src'));
		$(".shade").fadeTo(300,0.67, function(){  $(".pic_popup").slideDown(300).css({top:$(window).scrollTop()+150+'px', left:$(window).width()/2-$(".pic_popup").width()/2+'px'})  });
		return false;
	});
	$(".pic_popup .close").click(function(){
		$(".pic_popup").slideUp(300, function(){$(".shade").fadeOut(300)});
	});
	
	$(".gallery_section").append('<div class="gallery_section_l"></div><div class="gallery_section_r"></div><div class="gallery_section_trigger"></div>');
	
	jQuery(".gallery_previews_container .prev").addClass('unActive');
	
	$(".gallery_previews_container .prev").click(function(){
		if (countMove<1) return false;
		
		countMove--;	
		$(".gallery_scroller").animate({left: '+=103'},300);
		
		if (countMove==0) jQuery(".gallery_previews_container .prev").addClass('unActive');
		if (countMove==(countOfElement-8)) jQuery(".gallery_previews_container .next").removeClass('unActive');
		
		return false;
	});
	$(".gallery_previews_container .next").click(function(){
		
		if (countMove>=(countOfElement-7)) return false;
		
		if (countMove<(countOfElement-7) && countOfElement>7) {
			
			$(".gallery_scroller").animate({left: '-=103'},300);
		}	
		countMove++;
		if (countMove==1) jQuery(".gallery_previews_container .prev").removeClass('unActive');
		if (countMove==(countOfElement-7)) jQuery(".gallery_previews_container .next").addClass('unActive');
		
		
		
		
		return false;
		
	});

	$(".gallery_section .big_trigger, .gallery_section_trigger").click(function(){
		$(".gallery_section .dropdown").slideToggle(300);
	});
});

