/* Inits */
var countPoints;

$(document).ready(function() {
	$( '.map_container a' ).click( function( e ) {
		e.preventDefault();
		$( this ).toggleClass( 'active' );
		if( $( this ).hasClass( 'active' ) ) {
			$( this ).parent('div').height(500);
			$( this ).next( 'div.map' ).css( 'display', 'none' ).css( 'left', 0 ).slideDown();
		} else {
			$( this ).parent('div').css( 'height', 'auto' );
			$( this ).next( 'div.map' ).hide().css( 'left', -100000 );
		}
	} );
	if ($.browser.msie && $.browser.version == 7) {
		var menu_container = $( '#top-menu' );
		var menu_items = $( '#top-menu>li' );
		var menu_count = menu_items.length;
		var total_items_width = 0;
		menu_items.each( function(){
			total_items_width += $(this).width();
		} );
		var margin_right = Math.round( ( menu_container.width() - total_items_width ) / ( menu_count - 1 ) );
		menu_items.each( function(){
			$(this).css( "marginRight", margin_right );
		} );
	}

	/* Search focusIn focusOut events */
	var srch_inpt = $( 'input#search_input' );
	srch_inpt.focus(function() {
		if(srch_inpt.val() == 'Поиск') {
			srch_inpt.val('');
		}
	}).blur( function() {
		if(srch_inpt.val() == '') {
			srch_inpt.val('Поиск');
		}
	});
	
	
	
	$(function() {
	$('#cru_proj_x_t').jCarouselLite({
		btnGo: ['#z1_2', '#z2_2', '#z3_2'],
		btnNext: '.btnCarouselRight',
		btnPrev: '.btnCarouselLeft',
		visible: 1,
		speed: 400,
		awakeAuto: 5000,
		stopAnimationOnBtnGoClick: true
	});

	$('#cru_proj_x_i').jCarouselLite({
		btnGo: ['#z1_2', '#z2_2', '#z3_2'],
		visible: 1,
		beforeStart: function() {
			$('#cru_proj_x_t').hide();
		},
		afterEnd: function() {
			$('#cru_proj_x_t').fadeIn(400);
			$('img.carou_dot').attr('src', '/general/img/point-carousel.png');
			if (this._currentItem + 1 == this._carouselLength) { $('#z1_2').attr('src', '/general/img/activepoint-carousel.png'); }
			$('#z' + (this._currentItem) + '_2').attr('src', '/general/img/activepoint-carousel.png');

		},
		btnNext: '.btnCarouselRight',
		btnPrev: '.btnCarouselLeft',
		speed: 400,
		awakeAuto: 5000,
		stopAnimationOnBtnGoClick: true
	});
	
	$('#cru_proj_x_l').jCarouselLite({
		visible: 1,
		btnGo: ['#z1_2', '#z2_2', '#z3_2'],
		btnNext: '.btnCarouselRight',
		btnPrev: '.btnCarouselLeft',
		speed: 400,
		awakeAuto: 5000,
		stopAnimationOnBtnGoClick: true
	});
	$('#cru_proj_x_r').jCarouselLite({
		visible: 1,
		btnGo: ['#z1_2', '#z2_2', '#z3_2'],
		btnNext: '.btnCarouselRight',
		btnPrev: '.btnCarouselLeft',
		speed: 400,
		awakeAuto: 5000,
		stopAnimationOnBtnGoClick: true
	});
});
});

function getMonthName(month) {
 var arr_months = ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'];
 return arr_months[ parseInt(month - 1) ];
}

/* Functions */


