/* Force first pic to become active.. we have stored the big image url into the thumbs name property (dirtty!!!!) */

var first = document.getElementById('productfoto1');
if(first)
{
	
	img = '/resizer/resize.php?h=300&img='+encodeURIComponent(first.name);
	doSwapImage(img,false);
}


/* Scrolling stuff */
var layer = document.getElementById('productimages_wrap');
var time;

function doScrollLeft()
{
 layer.scrollLeft = layer.scrollLeft-5;
 time = setTimeout('doScrollLeft()',20);
}

function doScrollRight()
{
 layer.scrollLeft = layer.scrollLeft+5;
 time = setTimeout('doScrollRight()',20);
}


function doStopScroll()
{
	if(time) { clearTimeout(time); } 
}


/* Swap image */
function swapImage(src)
{
	
	src = '/resizer/resize.php?h=300&img='+encodeURIComponent(src);
	
	/* Check if we need to do anything */
	if(src != document.getElementById('productimagebig').src)
	Effect.Fade('productimagebig',{duration: 0.2, afterFinish: function(){doSwapImage(src,true);}});	
	
}


function doSwapImage(src,appear)
{
//	if(appear) document.getElementById('productimagebig').display = 'none';
//	
//	document.getElementById('productimagebig').src = src;
//	
//	if(appear) 	Effect.Appear('productimagebig',{duration: 0.2});	
return true;
}


