var lTotalHPRImages = 11
var lThisHPRImage = Math.floor(Math.random() * lTotalHPRImages) + 1

function nextHPRImage(){
	for (var i = 1; i <= lTotalHPRImages; i++){
		if (i == lThisHPRImage){
			$("#HPR" + i).stop().animate({opacity:1},{queue:false,duration:2000,easing:"easeInBack"})
		}else{
			$("#HPR" + i).stop().animate({opacity:0},{queue:false,duration:2000,easing:"easeInBack"})
		}
	}
	
	lThisHPRImage++
	if (lThisHPRImage > lTotalHPRImages){
		lThisHPRImage = 1
	}
	
	setTimeout(function(){nextHPRImage()},5000)
}

function initHPRImages(){
	for (var i = 1; i <= lTotalHPRImages; i++){
		if (i == lThisHPRImage){
			$("#HPR" + i).stop().animate({opacity:1},{queue:false,duration:1,easing:"easeInBack"})
		}else{
			$("#HPR" + i).stop().animate({opacity:0},{queue:false,duration:1,easing:"easeInBack"})
		}
	}
}

$(function(){
		   initHPRImages()
		   setTimeout(function(){nextHPRImage()},10)
})
