$(document).ready(function() {
	
	 $('.anecdote').truncate({
		max_length: 150
		,more: translations['more']
		,less: translations['collapse']
	 });
	 
	if(-[1,]){
		$('.corner').corner();
	}
		
	$("#navmenu-h li,#navmenu-v li").hover(
		function() {
			$(this).addClass("iehover");
		},
		function() {
			$(this).removeClass("iehover");
		}
	);
	
	/*$('.thumb').click(function() {
		src = $(this).attr('src').split('/');
		src = src[src.length - 1];
		path = $(this).attr('path');
		$('.orig_pict').attr('src', path);
	});*/	
	
	var galleries = $('.ad-gallery').adGallery({
		slideshow: {
	    	enable: false
	    },
	    loader_image: domain + '/img/gallery_nav/loader.gif'
	});
	
	if($('.lightbox_item').length) {
		$('.lightbox_item').lightBox({
			fixedNavigation: true
			,txtImage: 'Картинка'
			,txtOf: 'из'
			,imageLoading: domain + '/img/lightbox/lightbox-ico-loading.gif'		
			/*,imageBtnPrev: domain + '/img/lightbox/lightbox-btn-prev.gif'			
			,imageBtnNext: domain + '/img/lightbox/lightbox-btn-next.gif'			
			,imageBtnClose: domain + '/img/lightbox/lightbox-btn-close.gif'*/		
			,imageBlank: domain + '/img/lightbox/lightbox-blank.gif'			
			,imageBtnPrev: ''			
			,imageBtnNext: ''			
			,imageBtnClose: domain + '/img/lightbox/' + current_language + '_close.png'
				
		});
	}
	
	$('#pet_type').change(function() {		
		window.location = domain + '/homelesspets/index/0/' + $(this).val();
	});
	
	if($('#ContactIndexForm').length) {
		$(function() {
			$(".ajax-fc-container").captcha({
				captchaDir: domain + "/js/captcha"
				,borderColor: "#CA4A11"
				,text: "Докажите что вы человек,<br />Перетащите <span>ножницы</span> в круг."				
				,formId: 'ContactIndexForm'
				,url: domain + "/contacts/generate_captcha_num"
				//,items: Array("��������", "�������", "����", "������", "����")
				,field_name: 'data[Contact][captcha]'
			});
		});
	}
	
	if($('#pets_carousel').length) {		
		jQuery('#pets_carousel').jcarousel({
	        auto: 1,
	        wrap: 'circular',
			animation: 10000,			
			vertical: true,
			buttonNextHTML: '',
			buttonPrevHTML: '',
			scroll: 1,
	        initCallback: mycarousel_initCallback
	    });		
	}
	
	function mycarousel_initCallback(carousel) {		
		 carousel.buttonNext.bind('click', function() {
			 carousel.startAuto(0);
		});
	
		carousel.buttonPrev.bind('click', function() {
			carousel.startAuto(0);
		});
	
		//Pause autoscrolling if the user moves with the cursor over the clip.
		carousel.clip.hover(function() {
			carousel.stopAuto();
		}, function() {
			carousel.startAuto();
		});
	}
	
	$('img').load(function() {
		height = $('#right_panel').height() - 47;
		$('.jcarousel-skin-tango .jcarousel-container-vertical').height(height);
		$('.jcarousel-skin-tango .jcarousel-clip-vertical').height(height);
	});
});


