function addToCart(good, sID) {
/*
	var overflow = document.createElement('div');

	overflow.style.backgroundColor = 'lightgrey';
	overflow.style.opacity = 0.7;
	overflow.style.display = 'block';
	overflow.style.top = 0;
	overflow.style.left = 0;
	overflow.style.height = '100%';
	overflow.style.width = '100%';
	overflow.style.position = 'fixed';
	overflow.style.zIndex = 1000;

	document.body.appendChild(overflow);
	document.body.style.cursor = 'wait';
*/

	var xmlHttp = getXmlHttpObject();

	if (!xmlHttp) 
		return true;

	xmlHttp.open('GET', 'modules/goods_cart/addtocart.php?good='+good, true);
	xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState == 4) {
/*
			document.body.style.cursor = '';
			document.body.removeChild(overflow);
*/

			try {
				var xmlDoc = xmlHttp.responseXML.documentElement;
			}
			catch (e) {
				alert('Ошибка при обработке запроса.');
			}

			try {
				var amount = xmlDoc.getElementsByTagName('amount')[0].childNodes[0].nodeValue;
				var summ = xmlDoc.getElementsByTagName('summ')[0].childNodes[0].nodeValue;

				document.getElementById('cart_amount').innerHTML = amount;
				document.getElementById('cart_summ').innerHTML = summ;
			}
			catch (e) {}

			try {
				addedToCart();
			}
			catch (e) {}
		}
	}
	xmlHttp.send(null);

	return false;
}

function validAmount(field) {
	var value = field.value;
	var set = !isNaN(value) && parseInt(value, 10) > 0 ? parseInt(value, 10) : 0;

	if (set > 10000)
		set = 10000;
	if (set < 0)
		set = 0;

	field.value = set;
}

function addedToCart() {
	confirm('Выбранный товар добавлен в корзину.\nПерейти к оформлению заказа?') ? window.location = linkToCart : null;
}