function showNextTNGroup()
{
	var oContainer = document.getElementById('gallerycontainer');
	if (oContainer.curThumbGroupID == null)
	{
		id = 1;
		oContainer.curThumbGroupID = id;
	} else { id = oContainer.curThumbGroupID; }	
	
	redrawControls(id+1);
	return showTNGroup(id+1);
}

function showPrevTNGroup()
{
	var oContainer = document.getElementById('gallerycontainer');
	if (oContainer.curThumbGroupID == null)
	{
		id = 1;
		oContainer.curThumbGroupID = id;
	} else { id = oContainer.curThumbGroupID; }	
	
	redrawControls(id-1);
	return showTNGroup(id-1);	
}

function showTNGroup(showid)
{
	document.getElementById('tngroup_'+showid).style.display = "block";	

	var oContainer = document.getElementById('gallerycontainer');
	if (oContainer.curThumbGroupID == null)
	{
		id = 1;
		oContainer.curThumbGroupID = id;
	} else { id = oContainer.curThumbGroupID; }
	
	var oNextDiv = document.getElementById('tngroup_'+showid);
	if (oNextDiv == null)
	{
		//alert('no next div, leave');
		return false;
	}
	
	var oThisDiv = document.getElementById('tngroup_'+id);
	if (oThisDiv == null)
	{
		//alert('no this div, something badly wrong'+ 'thumbgroup_'+id);
		return false;
	}
	
	oThisDiv.style.display = 'none';
	oNextDiv.style.display = 'block';
	
	oContainer.curThumbGroupID = showid;
	
	return true;
}

function redrawControls(showid)
{
	//alert('Redrawing controls, showid='+showid);
	
	if (document.getElementById('tngroup_'+(showid+1)) == null)
	{
		//alert('no next group!');
		document.getElementById('shownext').style.display = 'none';	
		document.getElementById('showprev').style.display = 'block';	
	}
	
	if (document.getElementById('tngroup_'+(showid-1)) == null)
	{
		//alert('no prev group!');
		document.getElementById('showprev').style.display = 'none';
		document.getElementById('shownext').style.display = 'block';		
	}	
}