 	var $down=true;

	function slideSwitch() {
    var $active = $('#dop img.active');

    if ( $active.length == 0 ) $active = $('#dop img:last');
	if ( $down) { 
		if ($active.next().length) {
			var $next =  $active.next(); 
		} else {  
			var $next =  $active.prev();
			$down = false;
		}
	} else { 
		if ($active.prev().length) {
			var $next =  $active.prev();
		} else {
			var $next =   $active.next(); 
			$down = true;
		}
	}

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}
function ajax(adres, motion, mod){
	$.post("/ind_ajax.php", {adr: adres, part: 'cont'}, function(data){
	   //alert("mod="+mod);
		switch (mod) {
			case 'list' :
				var obj = $("#intext");
				break;
			case 'item':
				var obj = $("#items");
				break;
		}
		margin=obj.css('marginLeft');
		if (motion=='left') {
			obj.animate(
				{marginLeft: '+=1000'}, 
				600, 
				function(){
						obj.css('marginLeft',function(index, value) {
											return parseInt(value) -2000;}).html(data).animate(
											{marginLeft: margin}, 
											600);
						$("#text a").hover(function(){$(this).find("span").slideDown(600);}, function(){ $(this).find("span").slideUp(600);});
						}
			);
		} else {
			obj.animate(
				{marginLeft: '-=1000'}, 
				600, 
				function(){
						obj.css('marginLeft',function(index, value) {
											return parseInt(value) +2000;}); 
						obj.html(data).animate(
											{marginLeft: margin}, 
											600);
						$("#text a").hover(function(){$(this).find("span").slideDown(600);}, function(){ $(this).find("span").slideUp(600);});
						}
			);
		}
 });
	$.post("/ind_ajax.php", {adr: adres, part: 'page'}, function(data){
		//alert("Data:"+data);
		$("#textbot").html(data);
		//alert("Data:"+data);
	});
	
	return false;
}
$(document).ready(function(){
	$("#content").css("display", "none");
    $("#content").fadeIn(1000);
	$("a.fade").click(function(event){
		event.preventDefault();
		linkLocation = this.href;
		$("#content").fadeOut(1000, redirectPage);
	});
	$("#text a").hover(function(){$(this).find("span").slideDown(600);}, function(){ $(this).find("span").slideUp(600);})
	function redirectPage() {
		window.location = linkLocation;
	}
$(function() {
	setInterval( "slideSwitch()", 1500 );
});

});
