// JavaScript Document
var actual='';
var heroesPos=0;
var heroesCount=5;
var heroesWidth=789;
var heroesHeight=341;
var heroesMoving=0;
var heroesInterval=null;
var myBanner=null;

function moveHeroes() {
	if (heroesMoving==1) return;
	window.clearInterval(heroesInterval);
	if (heroesPos<heroesCount)
	{
		heroesPos++;
		heroesMoving=1;
		
		$('#heroesWrapper').animate({marginTop:-(heroesPos*heroesHeight)+'px'},500,'linear',function () { heroesMoving=0; 
			$('.pos').attr('src','images2/heroes-empty.png');
			if (heroesPos<heroesCount)
				$('#pos'+heroesPos).attr('src','images2/heroes-full.png');
			else
				$('#pos0').attr('src','images2/heroes-full.png');
			
		});
		
		var dure=4;
		if (heroesPos==4)
		{
			document.getElementById('banner').startBanner();
			heroesInterval=window.setInterval('moveHeroes()',20*1000);
			return;
		}
		heroesInterval=window.setInterval('moveHeroes()',dure*1000);
	}
	else
	{
		$('#heroesWrapper').css({marginTop:0+'px'});
		heroesPos=0;
		moveHeroes();
	}
	
}

function moveClick(obj) {
	if (heroesMoving==1) return;
	var desiredPos=obj.attr('id').substr(3,1);
	window.clearInterval(heroesInterval);
	heroesPos=desiredPos;
	heroesMoving=1;
	
	$('#heroesWrapper').animate({marginTop:-(heroesPos*heroesHeight)+'px'},500,'linear',function () { heroesMoving=0; 
			$('.pos').attr('src','images2/heroes-empty.png');
			if (heroesPos<4)
				$('#pos'+heroesPos).attr('src','images2/heroes-full.png');
			else
				$('#pos0').attr('src','images2/heroes-full.png');
		});
		
	var dure=4;
		
	heroesInterval=window.setInterval('moveHeroes()',dure*1000);
}

