<!--

	function isdefined(variable)
	{
	    return (typeof(window[variable]) == "undefined")?  false: true;
	}

    function makeRequest(url) {

        var http_request = false;

        //alert(url);

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() { alertContents(http_request); };
        http_request.open('GET', url, true);
        http_request.send(null);
        
        //return alertContents(http_request);;

    }

    function alertContents(http_request) {
        //alert(http_request.readyState);
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
               //alert("Text "+http_request.responseText);

//               var returnedXML = http_request.responseXML.getElementsByTagName("total");
              
                //The node value will give you actual data
//               var sTotal = returnedXML[0].nodeValue; 
               var sTotal = http_request.responseText.split(":")[0];
              // alert("Total "+sTotal);
               
               if (typeof document.CartForm.Subtotal != "undefined"){
//               if (isdefined(document.CartForm.Subtotal)) {
               	document.CartForm.Subtotal.value = sTotal;
	             //  alert("SubTotal "+document.CartForm.Subtotal.value);
               }

               var sDiscount = http_request.responseText.split(":")[1];
//               alert("Discount "+sDiscount);
               if (typeof document.CartForm.Discount != "undefined"){
//               if (isdefined(document.CartForm.Discount)) {
                  document.CartForm.Discount.value = sDiscount;
                  }
               
            } else {
                alert('There was a problem with the request.'+http_request.status);
            }
        }

    }




function removeProduct(id) {
   removeURL = "/order/removeitem.php?ID="+id;
   makeRequest(removeURL);
   toggleItem(id);
}

function removeWish(id) {
   removeURL = "/order/removewish.php?ID="+id;
   makeRequest(removeURL);
   toggleItem(id);
}


function plusProduct(id) {
   var qtyField = eval("document.CartForm." + id + "qty");
   qtyField.value = Number(qtyField.value)+1;
   //alert(qtyField.value)
   scriptURL = "/order/plusitem.php?ID="+id;
   makeRequest(scriptURL);
}

function minusProduct(id){
   var qtyField = eval("document.CartForm."+id+"qty");
   //alert(qtyField.value)
   if (qtyField.value == '1') {
   	alert('Please use the X button to remove items from your cart.');
   	return;
   }
   qtyField.value = Number(qtyField.value)-1;
  // if (qtyField.value == "0") {
  // qtyField.value = "1"
  // 	}
   scriptURL = "/order/minusitem.php?ID="+id;
   makeRequest(scriptURL);
}

function addProduct(id,title,price,quantity,cid,pcount,store) {
   scriptURL = "/order/ajaxadditem.php?ID="+id+"&TITLE="+title+"&PRICE="+price+"&QTY="+quantity+"&CID="+cid+"&PCOUNT="+pcount+"&STORE="+store;
   makeRequest(scriptURL);
}


function addToWish(id,title,price,quantity,cid,pcount,store) {
   alert('Adding to wish list');
//   scriptURL = "/order/ajaxaddwish.php?ID="+id+"&TITLE="+title+"&PRICE="+price+"&QTY="+quantity+"&CID="+cid+"&PCOUNT="+pcount+"&STORE="+store;
//   makeRequest(scriptURL);
}

function toggleItem(id) {
  var obj = null;
  if (  (document.getElementById && (obj = document.getElementById(id)))
     || (document.all && (obj = document.all[ id ]))) {
    obj.style.visibility = "hidden";
    obj.style.display = "none";
    obj.style.overflow = "hidden" ;
//    obj.style.clip = "auto";
    obj.style.height = "0";
    }
  else if (document.layers && (obj = document.layers[id])) {
    obj.visibility = "hide";
    obj.style.display = "none";
    obj.style.overflow = "hidden" ;
   obj.style.clip = "auto";
    obj.style.height = "0";
   }


}

-->