$(document).ready(function() {
	$("#carusel_wrapper").jCarouselLite({
		btnNext: ".jcarousel-next",
		btnPrev: ".jcarousel-prev",
		visible: 5,
		scroll:1,
		speed: 600
	});
	$("#carusel_wrapper_galery").jCarouselLite({
		btnNext: ".jcarousel-next_galery",
		btnPrev: ".jcarousel-prev_galery",
		visible: 3,
		scroll:1,
		speed: 600
	});
	$("#carusel_wrapper_games").jCarouselLite({
		btnNext: ".jcarousel-next_games ",
		btnPrev: ".jcarousel-prev_games ",
		visible: 5,
		scroll:1,
		speed: 600
	});
	
	$('#hide_cirk').click(function() {
		  $('#hide_block').slideToggle('slow', function() {
			if($(this).hasClass('first')) {
				$(this).removeClass('first');
				$("#carousel").featureCarousel({
					smallFeatureWidth:0.8,
					smallFeatureHeight:0.8,
					autoPlay:0,
					topPadding:0,
					sidePadding:0,
					smallFeatureOffset:23
				});
			}
//			vg = ''; // осень
			vg = '_zima'; // зима
			put1 = 'url(../img/hide'+vg+'.png) 0 100% no-repeat';
			put2 = 'url(../img/hide_arrow'+vg+'.png) 0 100% no-repeat';
			
			if ($('#hide_cirk span').text()=='Показать цирк') {
				$('#hide_cirk').css('background',put1).find('span').text('Спрятать цирк');
			}
			else {
				$('#hide_cirk').css('background',put2).find('span').text('Показать цирк');
			}
			$('div.l-page').css('zoom','1');
		  });
	});
	$('div.plah_carusel_1 > div.smallblock > div.hover_block').hover(
		function(){$(this).addClass('smallblock_active');},
		function(){$(this).removeClass('smallblock_active');}
	);
	$('div.navi a:first').addClass('navifirst');
	$('a').click(function(){
		if ( !$(this).hasClass('user_set_enlarge_image') && !$(this).hasClass('logon') && !$(this).parent().hasClass('uss_img_pre') && !$(this).hasClass('game_vote') && $(this).attr('target')!='_blank' && !$(this).hasClass('navifirst') && !$(this).hasClass('backos')) {
			window.location=$(this).attr('href')+'#bighome'; return false;
		}
	});
	$('#backos').click(function() {
		history.back();return false;
	});
/*	
	$('div.plah_carusel_1 > div.smallblock > div.hover_block').click(
		function(){window.location=$(this).find("a").attr("href"); return false;}
	);
*/	
	$('.content_menu li').click(
		function(){window.location=$(this).find('a').attr("href")+'#bighome'; return false;}
	);
	$('.clickos').click(
		function(){window.location=$(this).find('a').attr("href")+'#bighome'; return false;}
	);
	$('div.carousel-caption').click(
		function(){window.location=$(this).prev('a.par_link').attr("href")+'#bighome'; return false;}
	);
	
	$('div.plah_carusel_1 > div.smallblock_1 > div.hover_block').click(
		function(){
			cico(1);
			$(this).parents('div.plah_carusel_1').find('div.smallblock > div.hover_block').removeClass('smallblock_curent');
			$(this).addClass('smallblock_curent');}
	);
	$('div.plah_carusel_1 > div.smallblock_2 > div.hover_block').click(
		function(){
			cico(2);
			$(this).parents('div.plah_carusel_1').find('div.smallblock > div.hover_block').removeClass('smallblock_curent');
			$(this).addClass('smallblock_curent');}
	);
	$('div.plah_carusel_1 > div.smallblock_3 > div.hover_block').click(
		function(){
			cico(3);
			$(this).parents('div.plah_carusel_1').find('div.smallblock > div.hover_block').removeClass('smallblock_curent');
			$(this).addClass('smallblock_curent');}
	);
	$('div.plah_carusel_1 > div.smallblock_4 > div.hover_block').click(
		function(){
			cico(4);
			$(this).parents('div.plah_carusel_1').find('div.smallblock > div.hover_block').removeClass('smallblock_curent');
			$(this).addClass('smallblock_curent');}
	);
	$('div.plah_carusel_1 > div.smallblock_5 > div.hover_block').click(
		function(){
			cico(5);
			$(this).parents('div.plah_carusel_1').find('div.smallblock > div.hover_block').removeClass('smallblock_curent');
			$(this).addClass('smallblock_curent');}
	);
	$('div.plah_carusel_1 > div.smallblock_6 > div.hover_block').click(
		function(){
			cico(6);
			$(this).parents('div.plah_carusel_1').find('div.smallblock > div.hover_block').removeClass('smallblock_curent');
			$(this).addClass('smallblock_curent');}
	);
	
	$('div.feed_form textarea').focus(function(){
		if ($(this).attr('value')=='Задайте ваш вопрос') {$(this).attr('value','');}
		if ($(this).html()=='Задайте ваш вопрос') {$(this).html('');}
	});
	$('div.feed_form textarea').blur(function(){
		if ($(this).attr('value')=='') {$(this).attr('value','Задайте ваш вопрос');}
	});
	$('div.friends_photo_fon,html').css('zoom','1');
});

function cico(number){$('#tracker-'+number).click();return false;}
