$(document).ready(function() {
	$("#auth").click(function () {
     if ($(".top_line").is(":hidden")) {
       $(".top_line").slideDown(400);
	$("#auth").addClass("out");

     } else {
       $(".top_line").slideUp(400);
	$("#auth").removeClass("out");

     }
	});



(function(){


	var timer = 50;
	var slowDown = 800;
	var slowDownDistance = 800;
	
	var movedown;
	var maxIndent = $("#real-width").width();
	$("#real-width").clone().appendTo($('#block'))
	var currentIndent = 0;
	
	obj = $("#block");

	function moveMe(){
		--currentIndent
		if(currentIndent<=-maxIndent){currentIndent = -1;}
		obj.css({marginLeft: currentIndent});
	}

	var moveTimerId = setInterval(moveMe, timer)
	
	var slowDownFlag;

	$('#block a').colorbox({maxWidth:'100%', maxHeight: '100%'});

	$('#block').hover(function(){
		clearInterval(moveTimerId);
		slowDownFlag = true;
		$('#block').stop(1,0).animate({
			marginLeft: "-=20"
		}, slowDown, 'easeOutCubic',	function(){
			currentIndent = parseInt($("#block").css('marginLeft'));
			slowDownFlag = false;
		})

	},function(){
		if(!slowDownFlag){
			moveTimerId = setInterval(moveMe, timer)
		}else setTimeout(function(){
			if(!slowDownFlag) moveTimerId = setInterval(moveMe, timer)
		},500)
		
	}
	)






	



}())





















/* карусель */
/*
    $("#block").animate({ marginLeft: "-508px"}, 20000 );

	$("#block").mouseover(function(){
		 $(this).stop();
    });

	$("#block").mouseout(function(){
		$(this).animate({ marginLeft: "+508-px"}, 20000 );
	});
*/
/* // карусель */

/* выделение родительских пунктов меню */
	$("ul.menu li").hover(function () {
		 $(this).parents('li:first').children('a').addClass('act');
	}, function(){
		 $(this).parents('li:first').children('a').removeClass('act');
	});
/* // выделение родительских пунктов меню */

});



function clear_cookie() {
    document.cookie = "PHP_AUTH_LANG=0; path=/; expires=Wed, 1 Jan 1970 00:00:01 GMT";
    document.cookie = "PHP_AUTH_SID=0; path=/; expires=Wed, 1 Jan 1970 00:00:01 GMT";
    window.location = "/";
}
 
    


