	function submitform()
	{
		if(document.getElementById('product-stock-popup'))
			showStockPopup();
		else
			submitFormConfirm();
		return false;
	}
	function submitFormConfirm()
	{
		document.getElementById('mainform').submit();
		return false;
	}
	
	function syncAccessoryCheckboxes(srcCb, baseName)
	{
		var state = srcCb.checked;
		var i = 0, cb;
		while(cb = document.getElementById("add_" + baseName + "_" + i)) {
			if(cb !== srcCb)
				cb.checked = state;
			i++;
		}
	}
	function openIconPopup(partno)
	{
		return openPopup('/product-specific-icons.php?partno='+partno, 'Product Feature Icons');
	}
	function showStockPopup()
	{
		var width = 1000;//document.documentElement.clientWidth;
		var height = document.documentElement.clientHeight;

		window.location.hash = "top";

		/*var disablerDiv = document.getElementById('product-disabler');
		disablerDiv.style.display = '';
		disablerDiv.style.width = width + 'px';
		disablerDiv.style.height = height + 'px';*/

		var popupDiv = document.getElementById('product-stock-popup');
		popupDiv.style.display = '';
		popupDiv.style.left = Math.floor((width - popupDiv.clientWidth) / 2) + 'px';
		popupDiv.style.top = Math.floor((height - popupDiv.clientHeight) / 2) + 'px';	
		
		return false;
	}
	function closeStockPopup()
	{
		var disablerDiv = document.getElementById('product-disabler');
		disablerDiv.style.display = 'none';
		var popupDiv = document.getElementById('product-stock-popup');
		popupDiv.style.display = 'none';
		return false;
	}
