var lastProductEl;
var sizeUpTimerList = new Object();
var sizeDownTimerList = new Object();
var hideTimerList = new Object();

var widthStep = 13;
var timeStep = 10;
var containerWidth = 180;
var maxWidth = 250;
var minWidth = 150;

var isIE = document.all;

function sizeUpList(pid) {

	if (getCookie('product-zoom') == 'off') return;

	var orig = document.getElementById('orig-product-'+pid);
	var el = document.getElementById('product-img-'+pid);
	var divEl = document.getElementById('product-'+pid);	
	
	if (el.src.indexOf('images/coming_soon.jpg') >= 0) return;
	
//	divEl.style.position = 'absolute';
	var newLeft = Math.round((containerWidth - orig.width)/2);
	if(isIE){
		divEl.style.pixelLeft = newLeft;
	}
	else
		divEl.style.left = newLeft + "px";
	
	divEl.style.zIndex = 3;
	divEl.parentNode.style.zIndex = 3;
	divEl.style.display = '';
	
	if (el && el.width < maxWidth) {
/*		
		if(isIE){
			divEl.style.pixelTop -= topStep;
			divEl.style.pixelLeft -= leftStep;
		}
		else{
			divEl.style.top = (parseInt(divEl.style.top) - leftStep) + "px";
			divEl.style.left = (parseInt(divEl.style.left) - leftStep) + "px";
		}
*/	
		el.width = Math.min(el.width + widthStep,maxWidth);
			
		sizeUpTimerList[pid] = setTimeout('sizeUpList('+pid+')',timeStep);
		clearTimeout(sizeDownTimerList[pid]);
	}
	else{
		divEl.style.border = "1px solid #000000";
	}
}

function sizeDownList(pid) {
	
	if (getCookie('product-zoom') == 'off') return;

	var el = document.getElementById('product-img-'+pid);
	var divEl = document.getElementById('product-'+pid);
//	divEl.style.position = 'absolute';
	divEl.style.zIndex = 2;
	divEl.parentNode.style.zIndex = 2;
	divEl.style.display = '';
	divEl.style.border = "";
	
	if (el && el.width > minWidth) {
/*
		if(isIE){
			divEl.style.pixelTop += topStep
			divEl.style.pixelLeft += leftStep;
		}
		else{
			divEl.style.top = (parseInt(divEl.style.top) + leftStep) + "px";
			divEl.style.left = (parseInt(divEl.style.left) + leftStep) + "px";
		}
*/
		el.width = Math.max(el.width - widthStep,minWidth);
		sizeDownTimerList[pid] = setTimeout('sizeDownList('+pid+')',timeStep);
		clearTimeout(sizeUpTimerList[pid]);
	} else {
		divEl.style.zIndex = '';
		divEl.parentNode.style.zIndex = '';
		divEl.style.display = 'none';
	}
}

