$(document).ready(function() {
    var link = "http://www.ne-pesh.com/";
    $("ul.products form").submit(function() {
        // Get the product ID and the quantity 
	var id = $(this).find('input[name=product_id]').val();
	var qty = $(this).find('input[name=quantity]').val();
			 
        $.ajax({
                type: "POST",
                url: link+'items/add_cart_item',
                data: {product_id: id, quantity: qty},
                success: alert ('Товар добавлен!')
               });
               
         
        
        return false;
       
	 });
         
         $('.duplicates form').submit(function() {
             var id = $(this).find('input[name=product_id]').val();
             var qty = $(this).find('input[name=quantity]').val();
			 
             $.ajax({
                type: "POST",
                url: link+'items/add_cart_item',
                data: {product_id: id, quantity: qty},
                success: alert ('Товар добавлен!')
               });
               
         
        
             return false;
         });
         
         $('.duplicatesto form').submit(function() {
             var id = $(this).find('input[name=product_id]').val();
             var qty = $(this).find('input[name=quantity]').val();
			 
             $.ajax({
                type: "POST",
                url: link+'items/add_cart_itemto',
                data: {product_id: id, quantity: qty},
                success: alert ('Товар добавлен!')
               });
               
         
        
             return false;
         });
         
         $('.duplicates2 form').submit(function() {
             var id = $(this).find('input[name=product_id]').val();
             var qty = $(this).find('input[name=quantity]').val();
			 
             $.ajax({
                type: "POST",
                url: link+'items/add_cart_item2',
                data: {product_id: id, quantity: qty},
                success: alert ('Товар добавлен!')
               });
               
         
        
             return false;
         });
         
         
         show();
         setInterval('show()',1000);  
         
});
function show() {
    var link = "http://www.ne-pesh.com/";
          $.ajax({
             type: "POST",
             url: link+'items/return_total',
             cache: false,  
             success: function(html){  
                    $("#head-cart").html(html);
                    
                }  
         }) 
       }
