bSpryGrowThumbnailInit = false;

if(!bSpryGrowThumbnailInit)
{
	SpryGrowThumbnailZIndexStart = 1000;
	bSpryGrowThumbnailInit = true;
}

function SpryGrowThumbnailSetZIndex(element, effect)
{
	if (effect.direction == Spry.forwards)
	{
		element.style.zIndex = SpryGrowThumbnailZIndexStart;
		// Seems that IE needs a seperate solution
		if(/MSIE/.test(navigator.userAgent) && /Windows NT/.test(navigator.userAgent))
		{
			Spry.Effect.setStyleProp(	element.parentNode, 'zIndex', SpryGrowThumbnailZIndexStart);
		}
	}
	SpryGrowThumbnailZIndexStart++;
}

function SpryGrowThumbnailResetZIndex(element, effect)
{
	if (effect.direction == Spry.backwards)
	{
		element.style.zIndex=1;

		if(/MSIE/.test(navigator.userAgent) && /Windows NT/.test(navigator.userAgent))
		{
			Spry.Effect.setStyleProp(element.parentNode, 'zIndex', 1);
		}
	}
}

var SpryGrowThumbnailEffects = [];

function SpryGrowThumbnailToggle(targetElement)
{
	if (typeof SpryGrowThumbnailEffects[targetElement.id] == 'undefined')
	{
		SpryGrowThumbnailEffects[targetElement.id] = new Spry.Effect.Grow(targetElement, {duration: 500, from: '100%', to: '300%', toggle: true, setup: SpryGrowThumbnailSetZIndex, finish: SpryGrowThumbnailResetZIndex});
	}
	SpryGrowThumbnailEffects[targetElement.id].start();
}
