function showhide(which, parent)
{
	if(lastseriewhich!='')
	{	// close last album
		if(lastseriecat!='' && document.getElementById(lastseriecat).style.display=='')
		{	// close
			document.getElementById(lastseriecat).style.display='none';
		}
		lastseriewhich.setAttribute('rel', '');
		rollout(lastseriewhich);
	}
	// open new album
	if(lastseriewhich=='' || lastseriewhich!=parent)
	{
		if(which!='')
			document.getElementById(which).style.display='';
		parent.setAttribute('rel', 'no');
		rollin(parent);
		lastseriewhich = parent;
		lastseriecat = which;
	}
	else
	{
		lastseriewhich = '';
		lastseriecat = '';
	}
}
function focuslink(which)
{
	if(which && (lastwhich=='' || which.src!=lastwhich.src))
	{
		if(lastwhich!='')
		{
			lastwhich.setAttribute('rel','');
			rollout(lastwhich);
		}
		lastwhich = which;
		which.setAttribute('rel','no');
		rollin(lastwhich);
	}
}

function preloadimgs(tablo)
{
	for (var i = 0; i < tablo.length; i++ )
	{
		myPreload[ i ]= new Image();
		myPreload[ i ].src = 'images/' + tablo[i] + '_1.jpg';
	}
}
function rollout(elm)
{
	if(!elm.getAttribute('rel') || !elm.getAttribute('rel').toLowerCase().match('no'))
	{
		var regRoll = new RegExp("^(.+_)([0])\.(jpg|gif)$", "g");
		if(m = regRoll.exec(elm.src))
			elm.src = m[1] + '1.' + m[3];
	}
}
function rollin(elm)
{
	var regRoll = new RegExp("^(.+_)([1])\.(jpg|gif)$", "g");
	if(m = regRoll.exec(elm.src))
		elm.src = m[1] + '0.' + m[3];
}

