$(function(){	
	/*Убирает рамочку в mozilla при нажатии*/
	$("a").focus(function(){
		$(this).blur();
	});
	/*менюшка*/
	$(".manu_item").hover(function(){
		$(this).children(".first").stop(false,true).animate({"opacity":"0"},1500,"easeOutBack");
		$(this).children(".last").stop(false,true).animate({"opacity":"1"},500,"easeInOutSine");
		
		var oAlpha = elem.filters['DXImageTransform.Microsoft.alpha'] || elem.filters.alpha;
		if (oAlpha) oAlpha.opacity = nOpacity;
		else elem.style.filter += "progid:DXImageTransform.Microsoft.Alpha(opacity="+nOpacity+")";
		
	},function(){
		if ($.browser.msie) {
			$(this).children(".first").stop(false,true).animate({"opacity":"0.6"},1500,"easeOutBack");	
		}else{
			$(this).children(".first").stop(false,true).animate({"opacity":"1"},1500,"easeOutBack");	
		}
		$(this).children(".last").stop(false,true).animate({"opacity":"0"},500,"easeInOutSine");		
		});
		
	/*мигающий текст*/
	$.fn.wait = function(time, type) {
			time = time || 500;
			type = type || "fx";
			return this.queue(type, function() {
				var self = this;
				setTimeout(function() {
					$(self).dequeue();
				}, time);
			});
	};
		function runIt() {
		  $(".link_table a").wait()
				  .animate({"opacity": 0.7},500)
				  .wait()
				  .animate({"opacity": 1},700,runIt);
		}
	runIt();	
			
	// Галерея работ
	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('.next').bind('click', function() {
			carousel.next();
			return false;
		});
		$('.next').hover(function(){
			var scr = $(this).children("img").attr("src","/assets/templates/onik/right_hover.png");
		},function(){
			var scr = $(this).children("img").attr("src","/assets/templates/onik/right.png");
		});
		
		$('.prev').hover(function(){
			var scr = $(this).children("img").attr("src","/assets/templates/onik/left_hover.png");
		},function(){
			var scr = $(this).children("img").attr("src","/assets/templates/onik/left.png");
		});

		jQuery('.prev').bind('click', function() {
			carousel.prev();
			return false;
		});
	};
	
	$('#carousel').jcarousel({
		auto: 4.5,
		wrap: 'circular',
		animation: 1800,
		easing: "easeOutQuad",
		initCallback: mycarousel_initCallback
	});
	
	$('#carousel_portfolio').jcarousel({
		auto: 0,
		wrap: 'last',
		animation: 1800,
		scroll: 4,
		rtl: false,
		easing: "easeInOutCubic",
		initCallback: mycarousel_initCallback
	});
	$('#carousel_portfolio2').jcarousel({
		auto: 0,
		wrap: 'last',
		animation: 1800,
		rtl: true,
		scroll: 4,
		easing: "easeInOutCubic",
		initCallback: mycarousel_initCallback
	});
	
	
}); 

