// Edit these to alter image sizes and opcaity levels
var A2Dtvmain_width = 647; // Width for main image viewing area
var A2Dtvmain_height = 485; // Height for main image viewing area
var A2Dtvthumb_width = 100; // Width for thumbnail viewing areas
var A2Dtvthumb_height = 75; // Height for thumbnail viewing areas
var A2Dtvthumb_opacity = 50; // Opacity level for thumbnails (0 (invisible) - 100 (no opacity))

// DO NOT EDIT BELOW HERE
browserdetect = document.getElementById('A2D_tvthumb1').filters? "ie" : typeof document.getElementById('A2D_tvthumb1').style.MozOpacity=="string"? "mozilla" : "";

// Load images into divs and set start opacity
for (i = 1; i < 12; i++) 
{
	if (browserdetect=="mozilla")
		A2Dtvthumb_style = '-moz-opacity:'+(A2Dtvthumb_opacity/100)+';';
	else if (browserdetect=="ie")
		A2Dtvthumb_style = 'filter:alpha(opacity='+A2Dtvthumb_opacity+');';
	document.getElementById('A2D_tvthumb'+i).style.height = A2Dtvthumb_height+'px';
	document.getElementById('A2D_tvthumb'+i).style.width = A2Dtvthumb_width+'px';
	document.getElementById('A2D_tvthumb'+i).innerHTML = '<a href="#" onClick="populate('+i+');return false;"><img style="'+A2Dtvthumb_style+'" src="'+A2Dtv_thumbs[i]+'" height="'+A2Dtvthumb_height+'" width="'+A2Dtvthumb_width+'" alt="" border="0" onMouseOver="slowhigh(this)" onMouseOut="slowlow(this)"></a>';
}

// Function to change main image on click
function populate(id) 
{
	document.getElementById('A2D_tvmain').innerHTML = '<img src="'+A2Dtv_thumbs[id]+'" height="'+A2Dtvmain_height+'" width="'+A2Dtvmain_width+'" alt="" border="0">';
}
// Functions used for fading in and out for onMouseOver and onMouseOut
function slowhigh(which2)
{
	imgobj = which2
	instantset(A2Dtvthumb_opacity)
	highlighting = setInterval("gradualfade(imgobj)",50)
}
function slowlow(which2)
{
	cleartimer()
	instantset(A2Dtvthumb_opacity)
}
function instantset(degree)
{
	if (browserdetect == "mozilla")
		imgobj.style.MozOpacity = degree/100
	else if (browserdetect == "ie")
		imgobj.filters.alpha.opacity = degree
}
function cleartimer()
{
	if (window.highlighting) clearInterval(highlighting)
}
function gradualfade(cur2)
{
	if (browserdetect == "mozilla" && cur2.style.MozOpacity<1)
		cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
	else if (browserdetect == "ie" && cur2.filters.alpha.opacity<100)
		cur2.filters.alpha.opacity+=10
	else if (window.highlighting)
		clearInterval(highlighting)
}

// Populate first div
populate(1);
