function updateCart() {

	if(document.cartform.hidCartId.length){
		hidCartId_v = new Array();
		for (var i=0; i < document.cartform.hidCartId.length; i++){   
      		hidCartId_v[i] = document.cartform.hidCartId[i].value;    
   		}
	}else{
		hidCartId_v = document.cartform.hidCartId.value;
	}
   
   if(document.cartform.hidProductId.length){
   		hidProductId_v = new Array();
		for (var i=0; i < document.cartform.hidProductId.length; i++){   
      		hidProductId_v[i] = document.cartform.hidProductId[i].value;    
  		}
   }else{
	   hidProductId_v = document.cartform.hidProductId.value;
   }
   
   if(document.cartform.txtQty.length){
	   txtQty_v = new Array();
		for (var i=0; i < document.cartform.txtQty.length; i++){   
      		txtQty_v[i] = document.cartform.txtQty[i].value;    
   		}
   }else{  
      	txtQty_v = document.cartform.txtQty.value;  		
   }
	
	var xhr = getTransport_cart();
    xhr.onreadystatechange = function() {
        updateChange_cart(xhr);
    }

	xhr.open('post', 'datasource/updateCart.php', true);
	xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    xhr.send('hidCartId='+hidCartId_v+'&hidProductId='+hidProductId_v+'&txtQty='+txtQty_v);
 
}
             
function getTransport_cart() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        try {
        	return new ActiveXObject('Msxml2.XMLHTTP');
            } catch(e) {
            return new ActiveXObject('Microsoft.XMLHTTP');
    	}
    }
}

function updateContent_cart(html) {
                var content = document.getElementById('content');
                content.innerHTML = html;
                
                while (html.match(/(<script[^>]+javascript[^>]+>\s*(\/\/*<!\[CDATA\[)?(<!--)?\s*)/i)) {
                    html = html.substr(html.indexOf(RegExp.$1) + RegExp.$1.length);
                    if (!html.match(/((\/\/ *\]\]>)?(-->)?\s*<\/script>)/)) break;
                    block = html.substr(0, html.indexOf(RegExp.$1));
                    html = html.substring(block.length + RegExp.$1.length);
                    eval(block);
                }
}
            
function updateChange_cart(xhr) {	
    if (xhr.readyState != 4) {
		document.getElementById('content').innerHTML='<div align="center"><img src="../imagenes/ajax-loader.gif" width="220" height="19" /></div>';
	}else{
        if (xhr.status == 200) {
            updateContent_cart(xhr.responseText);           
        } else {
            alert('Error: ' + xhr.status + '!');
        }
    }
}