/********************************************
Description:	autoWidth, resoze product listing columns
Author:		Mittoni Pty Ltd
Date:		28 June 2005
Updated:	1 August 2009 (allow 10 cols, sCount)
*******************************************/
autoWidth = function(){
	if (!document.getElementById("ProdTable")){return;}
	if (!document.getElementById("ProdListNo")){return;}
	var allW = document.getElementById("ProdTable").offsetWidth;	
	var itemCount = document.getElementById("ProdListNo").className;
	var itemEnd = itemCount.indexOf(" ");	
	if (itemEnd == -1){itemEnd = itemCount.length;}
	itemCount = parseInt(itemCount.substring(4,itemEnd));	
	allW = parseInt(allW);	
	if (allW < 500){allW = 500;}	
	var sCount = parseInt(allW / 250);	
	if (sCount > 10){sCount = 10;}	
	if (sCount > itemCount){sCount = itemCount;}
	var sPd = parseInt((allW - (250 * sCount)) / (sCount+sCount));
	var hps;
	sPd = sPd +"px";	
	for (var i=1;i<=itemCount;i++){
		if (document.getElementById("Product"+i)){
			hps = document.getElementById("Product"+i);
			hps.style.posTop = "0px";
			hps.style.paddingLeft = 0;
			hps.style.paddingRight = sPd;
			hps.style.paddingLeft = sPd;			
		}	
	}
}
