function canAddToCart(id)
{
	var count = document.forms['form_' + id].count.value;
	
	if (isNaN(parseInt(count)) || parseInt(count) <= 0)
	{
		alert("Количество товара должно быть целым положительным числом.");
		return false;
	}
	
	return true;
}


function canAddAllToCart()
{
	ids_all		= '';
	counts_all	= '';
	counts	= document.getElementsByName('count');
	ids		= document.getElementsByName('id');
	for(i = 0; i < counts.length; i++)
	{
		if(counts[i].value != '')
		{
			if (ids_all != '')
				ids_all += ',';
			if (counts_all != '')
				counts_all += ',';
			ids_all += ids[i].value;
			counts_all += counts[i].value;
		}
	}
	if (counts_all == '')
	{
		alert('Не введено количество не на одного товара..');
		return false;
	}
	
	document.getElementById('ids_all').value	= ids_all;
	document.getElementById('counts_all').value	= counts_all;

	return true;
}

function canDeleteFromCart()
{
	return confirm('Вы действительно хотите удалить выбранный товар из покупательской корзины?');
}

function canDeleteAllFromCart()
{
	return confirm('Вы действительно хотите отменить заказ?');
}

function showImage(image_file, width, height)
{
	left	= screen.width / 2 - width / 2;
	wtop	= screen.height / 2 - height / 2;
	
	window.open('../docs/image.php?image_file=' + image_file,
			'image',
			'top=' + wtop + 'px,left=' + left + 'px,height=' + height + 'px,width=' + width + 'px,scrollbars=no,resizable=no');
			
	return false;
}