function addShipping(shippingMethod) {
var url="updateshipping.php?method=" + shippingMethod;
createMySQLRequest(request,url);


/*
// находим куда вставлять цену доставки
var shippingPriceElement = document.getElementById("shipping_price");
// удаляем старое значение цены, если есть
var childText = shippingPriceElement.firstChild;
if (childText != null) {
shippingPriceElement.removeChild(childText)
}
// вставляем новое значение цены
var newPriceText = document.createTextNode(shippingPrice + " руб.");
shippingPriceElement.appendChild(newPriceText);

*/
// теперь поехали апдейтить общую цену

}


function updateQuantity(count) {

var quantity = new Array();
var request_tail = "";

// получили текст из окон
for (var i = 0; i < count; i++) {
var idSpanElement = document.getElementById("id_" + i);
id = idSpanElement.innerHTML;
quantity[id] = document.getElementById("quantity_" + i).value;
request_tail = request_tail + "&result[" + i + "][id]=" + id + "&result[" + i + "][quantity]=" + quantity[id];
}

var url="updatebasket.php?" + request_tail;
createMySQLRequest(request,url);
}
/*
// подсчитываем изменившуюся цену
var new_price = price * quantity;

// сюда цену
var priceElement = document.getElementById("price_" + id);
// удаляем старое значение цены
var childText = priceElement.firstChild
if (childText != null) {
priceElement.removeChild(childText)
}
// вставляем новое значение цены
var newTextElement = document.createTextNode(new_price);
priceElement.appendChild(newTextElement);

// и общую цену
// сюда цену
var priceElement = document.getElementById("full_price");
// удаляем старое значение цены
var childText = priceElement.firstChild
if (childText != null) {
priceElement.removeChild(childText)
}
// вставляем новое значение цены
//var newTextElement = document.createTextNode(new_price);
//priceElement.appendChild(newTextElement);
*/


function createMySQLRequest(request,url) {
request.open("GET",url,true);
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.onreadystatechange = updatePage;
request.send(null);
}

function updatePage() {
if (request.readyState == 4 && request.status == 200) {
/* СЮДА ВСТАВЛЯЕМ ФУНКЦИЮ ВОЗВРАЩЕНИЯ ЗНАЧЕНИЯ */
var theResult = request.responseText;
if (theResult) {
window.location="http://www.sun-sling.ru/basket.php"
}
}
}