var thumbsRotator = new Array();
var pic_url = "http://thumbs.gaytube.co.uk/";

function rotateIt(start, i, num_thumbs, thumb, attempt)
{
	if (thumbsRotator[start])
	{
		if ( i > num_thumbs )
		{
			i = 1;
		}			
		
		lthumb = new Image();
		lthumb.src = pic_url + "thumb/" + i + "_" + thumb + ".jpg";
		
		if ( lthumb.complete )
		{
			document.getElementById(start).src = pic_url + "thumb/" + i + "_" + thumb + ".jpg";
			i++;
			setTimeout("rotateIt('" + start + "'," + i + ", " + num_thumbs + ", '" + thumb + "', 1)", 600);
		}
		else
		{
			setTimeout("rotateIt('" + start + "'," + i + ", " + num_thumbs + ", '" + thumb + "', 1)", 20);
		}
	}
}	

function startThumbChange(start, num_thumbs, thumb)
{	
	thumbsRotator[start] = true;
	num_thumbs = num_thumbs - 1;	
	rotateIt(start, 1, num_thumbs, thumb, 1);
}

function endThumbChange(start, thumb)
{
	thumbsRotator[start] = false;
	document.getElementById(start).src = pic_url + "thumb/" + thumb;
}