<head>
<script>
<?php
$functionsFile = "../includes/functions.php";
ini_set("display_errors",0);
include($functionsFile);
$iboInfo = getDbEntry("ibo_settings");
$imageArray = array();
if($iboInfo['ad1_image'])
{
	$imageArray[] = $iboInfo['ad1_image'];
}
if($iboInfo['ad2_image'])
{
	$imageArray[] = $iboInfo['ad2_image'];
}
if($iboInfo['ad3_image'])
{
	$imageArray[] = $iboInfo['ad3_image'];
}
if($iboInfo['ad4_image'])
{
	$imageArray[] = $iboInfo['ad4_image'];
}
if($iboInfo['ad5_image'])
{
	$imageArray[] = $iboInfo['ad5_image'];
}
if($iboInfo['ad6_image'])
{
	$imageArray[] = $iboInfo['ad6_image'];
}
if($iboInfo['ad7_image'])
{
	$imageArray[] = $iboInfo['ad7_image'];
}
if($iboInfo['ad8_image'])
{
	$imageArray[] = $iboInfo['ad8_image'];
}
if($iboInfo['ad9_image'])
{
	$imageArray[] = $iboInfo['ad9_image'];
}
if($iboInfo['ad10_image'])
{
	$imageArray[] = $iboInfo['ad10_image'];
}
$durationMs = $iboInfo['ad_duration'] * 1000;
if(!$durationMs)
{
	$durationMs = 10000;
}
if(count($imageArray) > 1)
{
?>
const images = <?php echo json_encode($imageArray); ?>;;
var counter = 0;

function multiStep() 
{
	counter++;
	var index = counter % images.length;
	var newtime = <?php echo $durationMs; ?>;
	document.getElementById("imgContainerId").src = images[index];
	setTimeout(multiStep, newtime);
	
}
var newtime = <?php echo $durationMs; ?>;
setTimeout(multiStep, newtime);
<?php } ?>
</script>
</head>
<body style="margin:0;padding:0;">
<img id="imgContainerId" src="<?php echo $imageArray[0]; ?>" style="border-radius:7px;width:100vw;height:100vh;margin:0;"/>
</body>