function anichange (objName) {
  if ( $(objName).css('display') == 'none' ) {
    $(objName).animate({height: 'show'}, 400);
  } else {
    $(objName).animate({height: 'hide'}, 200);
  }
}

$(function(){
	$('.slide-out-div').tabSlideOut({
		tabHandle: '.handle',                     //класс элемента вкладки
		pathToTabImage: 'images/coral.png', //путь к изображению "обязательно"
		imageHeight: '296px',                      //высота изображения "обязательно"
		imageWidth: '42px',                      //ширина изображения "обязательно"    
		tabLocation: 'right',                      //сторона на которой будет вкладка top, right, bottom, или left
		speed: 300,                               //скорость анимации
		action: 'click',                          //опции=: 'click' или 'hover', анимация при нажатии или наведении
		topPos: '220px',                          //расположение от верхнего края/ использовать если tabLocation = left или right
		leftPos: '20px',                          //расположение от левого края/ использовать если tabLocation = bottom или top
		fixedPosition: true                      //опции: true сделает данную вкладку неподвижной при скролле
	});
});

$(document).ready(function(){ 
	$('#exampleMenu').sweetMenu({
		top: 220,
		padding: 5,
		iconSize: 48,
		easing: 'easeOutBounce',
		duration: 500,
		icons: [
			'images/but_home.png',
			'images/but_find.png',
			'images/but_service.png',
			'images/but_contact.png',
		]
	});
});

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    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();
    });
};

jQuery(document).ready(function() {
    jQuery('#mycarouselz').jcarousel({
        auto: 4,
        wrap: 'circular',
        initCallback: mycarousel_initCallback
    });
});

jQuery(window).load(function(){ //jQuery(window).load() must be used instead of jQuery(document).ready() because of Webkit compatibility				

	// Tabs > No height
	jQuery(".tabs-noheight").sliderkit({
		auto:false,
		tabs:true,
		freeheight:true,
		circular:true
	});

	// Tabs > No height
	jQuery(".tabs-noheight-long").sliderkit({
		auto:false,
		tabs:true,
		freeheight:true,
		circular:true
	});

	// Photo gallery > Standard
	jQuery(".photosgallery-std").sliderkit({
		mousewheel:false,
		shownavitems:4,
		//navfx:"none",
		panelbtnshover:true,
		auto : true,
              autospeed : 3500,
              circular:true,
              navscrollatend:true
	});

	// Button : Make the standard tabs menu slide
	var myStandardTabs = $(".tabs-standard").data("sliderkit");
	$("#tabs-standard-slide").click(
		function(){
			// Applies only once
			if($(".sliderkit-panels-wrapper",myStandardTabs.domObj).size() == 0){
				// Set the transition effect to "sliding"
				myStandardTabs.options.panelfx = "sliding";
				// The sliding effect requires a wrapper around the panels
				myStandardTabs._wrapPanels();
			}
			
			// Stops the click
			return false;
		}
	);
});	
