function addtocart(form) {
	
	new Ajax.Request('/cart/warenkorb_hinz', { asynchronous:true, evalScripts:true, parameters:Form.serialize(form), 
	  
	  onSuccess: function(response) {
	    
	    jQuery(document).ready(function($) {
    	  $.modal(response.responseText, '', {'position':'fixed', 'textClass': '', 'width':'660px'}).find('.close').remove();	
    	});
	    
	  }
	  
	  }); 

		
	new Ajax.Updater('wkbox', '/cart/warenkorb_klein'); 	
		
}
function change(script,element)
{
  new Ajax.Updater(element,script, {
  method: 'post'
  });
}



function delete_wk(id) {
  
	var answer = confirm("Sind Sie sicher, dass Sie diesen Artikel aus dem Warenkorb entfernen möchten?");
	if (answer){
	  $('anzahl[' + id + ']').value = 0;
		$('cart_form').onsubmit();
	}
}

function getBestellscheinId(text, li) {
   		$("bestellschein").value = li.id;
   		$("buyid").value = li.id;
   		$('cart_form').onsubmit();
}

function bestellschein() { 
  new Ajax.Autocompleter("bestellschein", "BestellscheinChoices", "/products/suche", {afterUpdateElement : getBestellscheinId, parameters : 'bestellschein=1' });  
}
