function CreateShowReel(id)
{
	var numItems = projectName.length;
	if (numItems == 0)
	{
		return;
	}
	else if(numItems == 1)
	{
		document.getElementById("image_center").innerHTML = CreateHTML(id, 260);
	}
	else if(numItems == 2)
	{
		document.getElementById("image_center").innerHTML = CreateHTML(id, 260);
		document.getElementById("image_small_right").innerHTML = CreateHTML(CalculateNext(id, numItems), 170);
	}
	else
	{
		document.getElementById("image_center").innerHTML = CreateHTML(id, 260);
		document.getElementById("image_small_left").innerHTML = CreateHTML(CalculatePrevious(id, numItems), 170);
		document.getElementById("image_small_right").innerHTML = CreateHTML(CalculateNext(id, numItems), 170);
	}
}

function CreateHTML(i, size)
{
	var html = '<a href="' + projectLink[i] + '">';
	html = html + projectImage[i].replace("_width_", size).replace("_height_", size);
	if (size == 260)
	{
		html = html + '</a><br /><strong><a href="' + projectLink[i] + '">' + projectName[i] + '</a></strong>';
		html = html + '<div class="project_sublink"><a href="' + projectLink[i] + '">BEKIJK DIT PROJECT</a></div>'
	}
	
	return html;
}

function ReelNext()
{
	var val = Math.round(document.getElementById("active").value);
	val = val + 1;
	if (val >= projectName.length)
	{
		val = 0;
	}
	document.getElementById("active").value = (val);
	CreateShowReel(val);
}

function ReelPrevious()
{
	var val = Math.round(document.getElementById("active").value);
	val = val - 1;
	if (val < 0)
	{
		val = projectName.length - 1;
	}
	document.getElementById("active").value = (val);
	CreateShowReel(val);
}

function CalculateNext(id, total)
{
	var val;
	if ((id + 1) > (total - 1))
	{
		val = 0;
	}
	else
	{
		val = (id + 1);
	}
	return val;
}

function CalculatePrevious(id, total)
{
	var val;
	if ((id - 1) <0 )
	{
		val = (total - 1);
	}
	else
	{
		val = (id - 1);
	}
	return val;
}

function SwitchImage(caller)
{
	bigSrc = document.getElementById("detail_image").src;

	document.getElementById("detail_image").src = caller.src;
	caller.src = bigSrc;
}
