function getCartSummary(updateId) {
  var cartId = getCookie('uid');
  if (cartId != null && cartId != "") {
    xmlhttpPost("/cgi-bin/cart-summary.cgi", updateId)
  }
}

function xmlhttpPost(strURL, updateId) {
  var xmlHttpReq = false;
  var self = this;
  // Mozilla/Safari
  if (window.XMLHttpRequest) {
    self.xmlHttpReq = new XMLHttpRequest();
  }
  // IE
  else if (window.ActiveXObject) {
    self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
  }
  self.xmlHttpReq.open('GET', strURL, true);
  self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  self.xmlHttpReq.onreadystatechange = function() {
    if (self.xmlHttpReq.readyState == 4) {
      document.getElementById(updateId).innerHTML = (self.xmlHttpReq.responseText);
    }
  }
  self.xmlHttpReq.send(null);
}

function getCookie(cookieName) {
  var cookieValue = "";
  if (document.cookie.length > 0) {
    var cookieStart = document.cookie.indexOf(cookieName + "=");
    if (cookieStart != -1) { 
      cookieStart = cookieStart + cookieName.length + 1; 
      var cookieEnd = document.cookie.indexOf(";", cookieStart);
      if (cookieEnd == -1) {
        cookieEnd = document.cookie.length;
      }
      cookieValue = unescape(document.cookie.substring(cookieStart,cookieEnd));
    } 
  }
  return cookieValue;
}

