$(document).ready(function(){

	if ($('.items ul').size()>0) $('.items ul').jcarousel({scroll:1, wrap:'circular', initCallback:function(){
		$('.jcarousel-container').prepend('<div class="fade-l"></div><div class="fade-r"></div>');
	}});

	if ($('.thumbs ul').size()>0) $('.thumbs ul').jcarousel({vertical:true, scroll:1});

	/*
	$('.thumbs a').click(function(){
		$('.popup-img-box .tale').show();
		$('.popup-img-box img').attr('src',$(this).attr('href'));
		$('.popup-img-box').show().animate({top:$(this).parents('li').position().top + parseInt($('.jcarousel-list').css('top')) ,'margin-top':-$('.popup-img-box').height()/2 + 60});
		return false;
	})
	*/
	$('.smallimgclick').click(function() {
		var img1 = $(this).find('img').attr('src');
		img1 = img1.replace('s_','');

		var img2 = $('.img-in a img').attr('src');
		$(this).find('img').attr('src', img2);
		$('.img-in a img').attr('src', img1);
		$('.img-in a').attr('href', img1)
		return false;
	});


	$('.popup-img-box').click(function(){
		$(this).fadeOut('300');
	});

	$('.thumbs .jcarousel-next, .thumbs .jcarousel-prev').click(function(){
		$('.popup-img-box .tale').hide();
	});

	$('.tabs dt').click(function(){
		if ($(this).hasClass('active') == false) {
			$('.tabs dt, .tabs dd').removeClass('active');
			$(this).addClass('active');
			$(this).next('dd').addClass('active');
			$('.tabs dd').hide();
		}

		return false;
	});

	$('.ask ').click(function(){
		$(this).parents('.question').find('form').fadeToggle();
		return false;
	});
});
