$j(document).ready(function(){
	var wallItemI = 2;
	var t;

	function wallOver(wallId) {
    var $jactive = $j('#' + wallId + ' .fotoList .active');
    if ( $jactive.length == 0 ) $jactive = $j('#' + wallId + '.fotoList img:last');
    var $jnext =  $jactive.next().length ? $jactive.next()
        : $j('#' + wallId + ' .fotoList img:first');
    $jactive.addClass('last-active');
    $jnext.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 150, function() {
            $jactive.removeClass('active last-active');
        });
}
	$j('.wallItem').hover(function(){
		if ($j(this).children('.gray').not(':animated').length) {
			$j(this).children('.gray').fadeTo(450, 0);
			$j(this).children('.darkGray').fadeOut(450);
			var wallId = $j(this).attr('id');
			var fotosC = $j('#' + wallId + ' .wallFoto').length;
			t = setInterval(function(){
				wallOver(wallId);
			}, 150*fotosC);
		}
	}, function(){
		clearInterval(t);
		/*
		$j('.wallFoto').css({
			'opacity': '1',
			'display': 'block'
		});
		*/
		wallItemI = 2;
		$j(this).children('.gray').fadeTo(450, 1);
		$j(this).children('.darkGray').fadeIn(450);
	});

});


