
function getcart(){
		new Ajax.Request('updater.php', {
			   method: 'GET',
			   onComplete: function(tr){
						document.getElementById('cart').innerHTML=tr.responseText;
				}
			
		   });
		new Ajax.Request('updater.php?totale', {
		   method: 'GET',
		   onComplete: function(tr){
					document.getElementById('totale').innerHTML=tr.responseText+' euro';
        	}
        
       });
	
	resize_images();
}

function removeFromCart(id){
	new Ajax.Request('updater.php?ext=1&remove='+id, {
			   method: 'GET',
			   onComplete: function(tr){
						document.getElementById('cart_riepilogo').innerHTML=tr.responseText;
				}
			
		   });
	new Ajax.Request('updater.php?totale', {
		   method: 'GET',
		   onComplete: function(tr){
					document.getElementById('totpartial').innerHTML=tr.responseText;
        	}
        
    });
}

function incrementItem(id){
		new Ajax.Request('updater.php?id='+id, {
			   method: 'GET',
			   onComplete: function(tr){
						getcart_extended();
				}
			
		   });
	new Ajax.Request('updater.php?totale', {
		   method: 'GET',
		   onComplete: function(tr){
					document.getElementById('totpartial').innerHTML=tr.responseText;
        	}
        
    });
}

function getcart_extended(){
		new Ajax.Request('updater.php?ext=1', {
			   method: 'GET',
			   onComplete: function(tr){
						document.getElementById('cart_riepilogo').innerHTML=tr.responseText;
				}
			
		   });
		
	resize_images();
}
	
function x(id){
		new Ajax.Request('updater.php?id='+id, {
			   method: 'GET',
			   onComplete: function(tr){
						document.getElementById('cart').innerHTML=tr.responseText;
						document.getElementById('ok'+id).innerHTML = '<img src=\"img/ok.gif\" id=\"minus\" name=\"minus\" title=\"Aggiunto al carrello\" width=\"30\" height=\"30\" />';
				}
			
		   });
		new Ajax.Request('updater.php?totale', {
			   method: 'GET',
			   onComplete: function(tr){
						document.getElementById('totale').innerHTML=tr.responseText+' euro';
				}
			
		   });
}
	
function resetcart(){
		new Ajax.Request('updater.php?resetcart', {
			   method: 'GET',
			   onComplete: function(tr){
						document.getElementById('cart').innerHTML=tr.responseText;
						window.location = 'default.php?site=store&where=store';
				}
			
		   });
}

function redirecttohome(){
		window.location = 'default.php?site=store';
}

function redirecttochart(){
		window.location = 'default.php?site=cart&where=cart';
}

function redirecttospedizioni(){
		window.location = 'default.php?site=spedizioni';
}

function redirecttopagamenti(){
		window.location = 'default.php?site=pagamenti';
}

function redirecttopermuta(){
		window.location = 'default.php?site=permuta';
}

function redirecttoreserved(){
		window.location = 'default.php?site=login';	
}

function redirecttologout(){
		window.location = 'login.php?logout=1';	
}

function resize_images(){
    for (i = 0; i < document.images.length; i++)
    {
      while ( !document.images[i].complete )
      {
        break;
      }
	  
	  if ( document.images[i].width > 100 )
      {
        document.images[i].width = 100;
      }
    }
}

function disable_privato(){
	window.location = 'default.php?site=buy&formtype=privato';
	event.stopPropagation();
}

function disable_azienda(){
	window.location = 'default.php?site=buy&formtype=azienda';
	event.stopPropagation();
}

function myPopup2() {
	window.open( "http://www.musicworks.it/spese_sped.php", "Spedizioni", "status = 1, height = 350, width = 750, resizable = 0" );
}

